From 10451e0109fe718249a8ea0cda7bcab85d56b5f9 Mon Sep 17 00:00:00 2001 From: Roland Illig Date: Tue, 8 Feb 2005 06:57:14 +0000 Subject: [PATCH] * dialog.h: Moved and reformatted #definitions. * execute.h: Likewise. * mouse.h: Likewise. --- src/ChangeLog | 3 +++ src/dialog.h | 35 ++++++++++++++++------------------- src/execute.h | 7 ++++--- src/mouse.h | 10 +++++----- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index fb946771a..638dd6040 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2005-02-08 Roland Illig + * dialog.h: Moved and reformatted #definitions. + * execute.h: Likewise. + * mouse.h: Likewise. * widget.h: Moved constants to the appropriate places (just before the variable they will be used with). * widget.c: HISTORY_FILE_NAME was not needed in widget.h, diff --git a/src/dialog.h b/src/dialog.h index 2d4a94d44..ad336614b 100644 --- a/src/dialog.h +++ b/src/dialog.h @@ -121,42 +121,39 @@ typedef cb_ret_t (*callback_fn) (Widget *widget, widget_msg_t msg, int parm); struct Widget { int x, y; int cols, lines; + +#define W_WANT_HOTKEY (1 << 1) +#define W_WANT_CURSOR (1 << 2) +#define W_WANT_IDLE (1 << 3) +#define W_IS_INPUT (1 << 4) int options; - int dlg_id; /* Number of the widget, starting with 0 */ + int dlg_id; /* Number of the widget, starting with 0 */ struct Widget *next; struct Widget *prev; - callback_fn callback; /* The callback function */ + callback_fn callback; mouse_h mouse; struct Dlg_head *parent; }; -/* The options for the widgets */ -#define W_WANT_HOTKEY 2 -#define W_WANT_CURSOR 4 -#define W_WANT_IDLE 8 -#define W_IS_INPUT 16 - /* draw box in window */ void draw_box (Dlg_head *h, int y, int x, int ys, int xs); /* doubled line if possible */ void draw_double_box (Dlg_head *h, int y, int x, int ys, int xs); +/* Flags for create_dlg: */ +#define DLG_REVERSE (1 << 5) /* Tab order is opposite to the add order */ +#define DLG_WANT_TAB (1 << 4) /* Should the tab key be sent to the dialog? */ +#define DLG_WANT_IDLE (1 << 3) /* Dialog wants idle events */ +#define DLG_COMPACT (1 << 2) /* Suppress spaces around the frame */ +#define DLG_TRYUP (1 << 1) /* Try to move two lines up the dialog */ +#define DLG_CENTER (1 << 0) /* Center the dialog */ +#define DLG_NONE (000000) /* No options */ + /* Creates a dialog head */ Dlg_head *create_dlg (int y1, int x1, int lines, int cols, const int *color_set, dlg_cb_fn callback, const char *help_ctx, const char *title, int flags); - - -/* The flags: */ -#define DLG_REVERSE 32 /* Tab order is opposite to the add order */ -#define DLG_WANT_TAB 16 /* Should the tab key be sent to the dialog? */ -#define DLG_WANT_IDLE 8 /* Dialog wants idle events */ -#define DLG_COMPACT 4 /* Suppress spaces around the frame */ -#define DLG_TRYUP 2 /* Try to move two lines up the dialog */ -#define DLG_CENTER 1 /* Center the dialog */ -#define DLG_NONE 0 /* No options */ - int add_widget (Dlg_head *dest, void *Widget); /* Runs dialog d */ diff --git a/src/execute.h b/src/execute.h index 19b7b5aec..f5e95180c 100644 --- a/src/execute.h +++ b/src/execute.h @@ -1,9 +1,10 @@ #ifndef MC_EXECUTE_H #define MC_EXECUTE_H -#define EXECUTE_INTERNAL 1 -#define EXECUTE_AS_SHELL 4 -#define EXECUTE_HIDE 8 +/* flags for shell_execute */ +#define EXECUTE_INTERNAL (1 << 0) +#define EXECUTE_AS_SHELL (1 << 2) +#define EXECUTE_HIDE (1 << 3) /* Execute functions that use the shell to execute */ void shell_execute (const char *command, int flags); diff --git a/src/mouse.h b/src/mouse.h index 4db653214..d994ee3b0 100644 --- a/src/mouse.h +++ b/src/mouse.h @@ -12,9 +12,9 @@ /* These lines are modified version from the lines appearing in the */ /* gpm.h include file of the Linux General Purpose Mouse server */ -#define GPM_B_LEFT 4 -#define GPM_B_MIDDLE 2 -#define GPM_B_RIGHT 1 +#define GPM_B_LEFT (1 << 2) +#define GPM_B_MIDDLE (1 << 1) +#define GPM_B_RIGHT (1 << 0) /* Xterm mouse support supports only GPM_DOWN and GPM_UP */ /* If you use others make sure your code also works without them */ @@ -73,11 +73,11 @@ void disable_mouse (void); /* Mouse wheel events */ #ifndef GPM_B_DOWN -#define GPM_B_DOWN 32 +#define GPM_B_DOWN (1 << 5) #endif #ifndef GPM_B_UP -#define GPM_B_UP 16 +#define GPM_B_UP (1 << 4) #endif #ifdef HAVE_LIBGPM