From 67cfc5d84d389575a2e2b758436825a4904396ce Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Mon, 2 Sep 2002 18:42:49 +0000 Subject: [PATCH] * dlg.c: Remove unused code, make functions static if possible. --- src/ChangeLog | 2 ++ src/dlg.c | 55 +++++++++------------------------------------------ src/dlg.h | 9 +-------- 3 files changed, 12 insertions(+), 54 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 90ca95e4c..32d1fb452 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,7 @@ 2002-09-02 Pavel Roskin + * dlg.c: Remove unused code, make functions static if possible. + * chmod.c: Use common_dialog_repaint(). * chown.c: Likewise. * layout.c: Likewise. diff --git a/src/dlg.c b/src/dlg.c index 2f25feff3..0c0206abb 100644 --- a/src/dlg.c +++ b/src/dlg.c @@ -35,9 +35,6 @@ #include "layout.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) /* 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 */ 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) { move (h->y+y, h->x+x); @@ -304,45 +303,6 @@ int add_widget (Dlg_head *where, void *what) 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) { 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 * 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; @@ -391,7 +352,8 @@ int dlg_focus (Dlg_head *h) return 0; } -int dlg_unfocus (Dlg_head *h) +static int +dlg_unfocus (Dlg_head *h) { if (!h->current) return 0; @@ -563,7 +525,8 @@ void dlg_redraw (Dlg_head *h) update_cursor (h); } -void dlg_refresh (void *parameter) +static void +dlg_refresh (void *parameter) { dlg_redraw ((Dlg_head *) parameter); } @@ -688,7 +651,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key) return handled; } -int +static int dlg_key_event (Dlg_head * h, int d_key) { int handled; diff --git a/src/dlg.h b/src/dlg.h index ef5af3d78..e4902f8d4 100644 --- a/src/dlg.h +++ b/src/dlg.h @@ -142,8 +142,6 @@ Dlg_head *create_dlg (int y1, int x1, int lines, int cols, #define DLG_NONE 0 /* No options */ int add_widget (Dlg_head *dest, void *Widget); -int remove_widget (Dlg_head *dest, void *Widget); -int destroy_widget (Widget *w); /* Runs dialog 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 dlg_redraw (Dlg_head *h); -void dlg_refresh (void *parameter); void destroy_dlg (Dlg_head *h); 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_mouse (Dlg_head *h, Gpm_Event *event); typedef void (*destroy_fn)(void *); 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_down (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_item_number (Dlg_head *h); 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); -/* The inner workings of run_dlg, exported for the Tk and XView toolkits */ -int dlg_key_event (Dlg_head *h, int d_key); +/* Used in load_prompt() */ void update_cursor (Dlg_head *h); #endif /* MC_DLG_H */