1
1

* dlg.c: Remove unused code, make functions static if possible.

Этот коммит содержится в:
Pavel Roskin 2002-09-02 18:42:49 +00:00
родитель 6f0c076c65
Коммит 67cfc5d84d
3 изменённых файлов: 12 добавлений и 54 удалений

Просмотреть файл

@ -1,5 +1,7 @@
2002-09-02 Pavel Roskin <proski@gnu.org> 2002-09-02 Pavel Roskin <proski@gnu.org>
* dlg.c: Remove unused code, make functions static if possible.
* chmod.c: Use common_dialog_repaint(). * chmod.c: Use common_dialog_repaint().
* chown.c: Likewise. * chown.c: Likewise.
* layout.c: Likewise. * layout.c: Likewise.

Просмотреть файл

@ -35,9 +35,6 @@
#include "layout.h" #include "layout.h"
#include "main.h" #include "main.h"
/* This is the current frame, used to group Tk packings */
char *the_frame = "";
#define waddc(w,y1,x1,c) move (w->y+y1, w->x+x1); addch (c) #define waddc(w,y1,x1,c) move (w->y+y1, w->x+x1); addch (c)
/* Primitive way to check if the the current dialog is our dialog */ /* Primitive way to check if the the current dialog is our dialog */
@ -47,6 +44,8 @@ Dlg_head *current_dlg = 0;
/* A hook list for idle events */ /* A hook list for idle events */
Hook *idle_hook = 0; Hook *idle_hook = 0;
static void dlg_broadcast_msg_to (Dlg_head *h, int message, int reverse, int flags);
static void slow_box (Dlg_head *h, int y, int x, int ys, int xs) static void slow_box (Dlg_head *h, int y, int x, int ys, int xs)
{ {
move (h->y+y, h->x+x); move (h->y+y, h->x+x);
@ -304,45 +303,6 @@ int add_widget (Dlg_head *where, void *what)
return (where->count - 1); return (where->count - 1);
} }
int remove_widget (Dlg_head *h, void *what)
{
Widget_Item *first, *p;
if (!h->current)
return 0;
first = p = h->current;
do {
if (p->widget == what){
/* Remove links to this Widget_Item */
p->prev->next = p->next;
p->next->prev = p->prev;
/* Make sure h->current is always valid */
if (p == h->current){
h->current = h->current->next;
if (h->current == p)
h->current = 0;
}
h->count--;
g_free (p);
return 1;
}
p = p->next;
} while (p != first);
return 0;
}
int destroy_widget (Widget *w)
{
send_message (w->parent, w, WIDGET_DESTROY, 0);
if (w->destroy)
w->destroy (w);
g_free (w);
return 1;
}
int send_message (Dlg_head *h, Widget *w, int msg, int par) int send_message (Dlg_head *h, Widget *w, int msg, int par)
{ {
return (*(w->callback))(h, w, msg, par); return (*(w->callback))(h, w, msg, par);
@ -351,7 +311,8 @@ int send_message (Dlg_head *h, Widget *w, int msg, int par)
/* broadcast a message to all the widgets in a dialog that have /* broadcast a message to all the widgets in a dialog that have
* the options set to flags. * the options set to flags.
*/ */
void dlg_broadcast_msg_to (Dlg_head *h, int message, int reverse, int flags) static void
dlg_broadcast_msg_to (Dlg_head *h, int message, int reverse, int flags)
{ {
Widget_Item *p, *first, *wi; Widget_Item *p, *first, *wi;
@ -391,7 +352,8 @@ int dlg_focus (Dlg_head *h)
return 0; return 0;
} }
int dlg_unfocus (Dlg_head *h) static int
dlg_unfocus (Dlg_head *h)
{ {
if (!h->current) if (!h->current)
return 0; return 0;
@ -563,7 +525,8 @@ void dlg_redraw (Dlg_head *h)
update_cursor (h); update_cursor (h);
} }
void dlg_refresh (void *parameter) static void
dlg_refresh (void *parameter)
{ {
dlg_redraw ((Dlg_head *) parameter); dlg_redraw ((Dlg_head *) parameter);
} }
@ -688,7 +651,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
return handled; return handled;
} }
int static int
dlg_key_event (Dlg_head * h, int d_key) dlg_key_event (Dlg_head * h, int d_key)
{ {
int handled; int handled;

Просмотреть файл

@ -142,8 +142,6 @@ Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
#define DLG_NONE 0 /* No options */ #define DLG_NONE 0 /* No options */
int add_widget (Dlg_head *dest, void *Widget); int add_widget (Dlg_head *dest, void *Widget);
int remove_widget (Dlg_head *dest, void *Widget);
int destroy_widget (Widget *w);
/* Runs dialog d */ /* Runs dialog d */
int run_dlg (Dlg_head *d); int run_dlg (Dlg_head *d);
@ -156,14 +154,11 @@ void init_dlg (Dlg_head *h);
void set_idle_proc (Dlg_head *d, int state); void set_idle_proc (Dlg_head *d, int state);
void dlg_redraw (Dlg_head *h); void dlg_redraw (Dlg_head *h);
void dlg_refresh (void *parameter);
void destroy_dlg (Dlg_head *h); void destroy_dlg (Dlg_head *h);
void widget_set_size (Widget *widget, int x1, int y1, int x2, int y2); void widget_set_size (Widget *widget, int x1, int y1, int x2, int y2);
void dlg_broadcast_msg_to (Dlg_head *h, int message, int reverse, int flags);
void dlg_broadcast_msg (Dlg_head *h, int message, int reverse); void dlg_broadcast_msg (Dlg_head *h, int message, int reverse);
void dlg_mouse (Dlg_head *h, Gpm_Event *event);
typedef void (*destroy_fn)(void *); typedef void (*destroy_fn)(void *);
typedef int (*callback_fn)(Dlg_head *, void *, int, int); typedef int (*callback_fn)(Dlg_head *, void *, int, int);
@ -203,7 +198,6 @@ int dlg_select_widget (Dlg_head *h, void *widget);
void dlg_one_up (Dlg_head *h); void dlg_one_up (Dlg_head *h);
void dlg_one_down (Dlg_head *h); void dlg_one_down (Dlg_head *h);
int dlg_focus (Dlg_head *h); int dlg_focus (Dlg_head *h);
int dlg_unfocus (Dlg_head *h);
int dlg_select_nth_widget (Dlg_head *h, int n); int dlg_select_nth_widget (Dlg_head *h, int n);
int dlg_item_number (Dlg_head *h); int dlg_item_number (Dlg_head *h);
Widget *find_widget_type (Dlg_head *h, callback_fn signature); Widget *find_widget_type (Dlg_head *h, callback_fn signature);
@ -222,8 +216,7 @@ typedef void (*movefn)(void *, int);
void x_set_dialog_title (Dlg_head *h, const char *title); void x_set_dialog_title (Dlg_head *h, const char *title);
/* The inner workings of run_dlg, exported for the Tk and XView toolkits */ /* Used in load_prompt() */
int dlg_key_event (Dlg_head *h, int d_key);
void update_cursor (Dlg_head *h); void update_cursor (Dlg_head *h);
#endif /* MC_DLG_H */ #endif /* MC_DLG_H */