From c3e1cd0a989a5478702f8dd03047ba87ab4eb0e4 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 22 Aug 2002 23:31:35 +0000 Subject: [PATCH] * dlg.h (struct Dlg_head): Eliminate "data" field, it duplicated functionality of "title". * wtools.c (query_callback): Use dialog_repaint(). (quick_callback): Use common_dialog_repaint(). --- src/ChangeLog | 5 +++++ src/dlg.h | 1 - src/wtools.c | 30 ++---------------------------- 3 files changed, 7 insertions(+), 29 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 886154fa8..456b96c19 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2002-08-22 Pavel Roskin + * dlg.h (struct Dlg_head): Eliminate "data" field, it duplicated + functionality of "title". + * wtools.c (query_callback): Use dialog_repaint(). + (quick_callback): Use common_dialog_repaint(). + * learn.c (learn_callback): Use common_dialog_repaint(). * achown.c (chl_callback): Likewise. diff --git a/src/dlg.h b/src/dlg.h index 80e0ef363..bb64ee1a0 100644 --- a/src/dlg.h +++ b/src/dlg.h @@ -97,7 +97,6 @@ typedef struct Dlg_head { int cols; int lines; - void *data; int flags; /* Different flags, specified in create_dlg() */ } Dlg_head; diff --git a/src/wtools.c b/src/wtools.c index 30b495d01..77b9747c9 100644 --- a/src/wtools.c +++ b/src/wtools.c @@ -154,26 +154,11 @@ int run_listbox (Listbox *l) /* {{{ Query Dialog functions */ -struct text_struct { - char *text; - char *header; -}; - static int query_callback (struct Dlg_head *h, int Id, int Msg) { - struct text_struct *info; - - info = (struct text_struct *) h->data; - switch (Msg){ case DLG_DRAW: - /* designate window */ - attrset (NORMALC); - dlg_erase (h); - draw_box (h, 1, 1, h->lines-2, h->cols-2); - attrset (HOT_NORMALC); - dlg_move (h, 1, (h->cols-strlen (info->header))/2); - addstr (info->header); + dialog_repaint (h, NORMALC, HOT_NORMALC); break; } return 0; @@ -196,7 +181,6 @@ int query_dialog (char *header, char *text, int flags, int count, ...) int cols, lines; char *cur_name; static int query_colors [4]; - static struct text_struct pass; /* set dialog colors */ query_colors [0] = (flags & D_ERROR) ? ERROR_COLOR : Q_UNSELECTED_COLOR; @@ -224,8 +208,6 @@ int query_dialog (char *header, char *text, int flags, int count, ...) lines += 4 + (count > 0 ? 2 : 0); xpos = COLS/2 - cols/2; ypos = LINES/3 - (lines-3)/2; - pass.header = header; - pass.text = text; /* prepare dialog */ query_dlg = create_dlg (ypos, xpos, lines, cols, query_colors, @@ -235,7 +217,6 @@ int query_dialog (char *header, char *text, int flags, int count, ...) /* The data we need to pass to the callback */ query_dlg->cols = cols; query_dlg->lines = lines; - query_dlg->data = &pass; query_dlg->direction = DIR_BACKWARD; @@ -379,13 +360,7 @@ static int quick_callback (struct Dlg_head *h, int id, int Msg) { switch (Msg){ case DLG_DRAW: - attrset (COLOR_NORMAL); - dlg_erase (h); - draw_box (h, 1, 1, h->lines-2, h->cols-2); - - attrset (COLOR_HOT_NORMAL); - dlg_move (h, 1,((h->cols-strlen (h->data))/2)); - addstr (h->data); + common_dialog_repaint (h); break; case DLG_KEY: if (id == '\n'){ @@ -432,7 +407,6 @@ int quick_dialog_skip (QuickDialog *qd, int nskip) /* We pass this to the callback */ dd->cols = qd->xlen; dd->lines = qd->ylen; - dd->data = qd->title; for (qw = qd->widgets; qw->widget_type; qw++){ xpos = (qd->xlen * qw->relative_x)/qw->x_divisions;