* wtools.c (dialog_repaint): Eliminate, nobody should be using

non-standard colors.  Adjust all dependencies.
(common_dialog_repaint): Fix return code.
(query_callback): Eliminate, use common_dialog_callback()
instead.
This commit is contained in:
Pavel Roskin 2002-09-02 07:31:19 +00:00
parent 812e80c85a
commit 1f478c647a
4 changed files with 24 additions and 33 deletions

View File

@ -1,5 +1,11 @@
2002-09-02 Pavel Roskin <proski@gnu.org>
* wtools.c (dialog_repaint): Eliminate, nobody should be using
non-standard colors. Adjust all dependencies.
(common_dialog_repaint): Fix return code.
(query_callback): Eliminate, use common_dialog_callback()
instead.
* listmode.c (listmode_refresh): Use common_dialog_repaint().
Eliminate all global variables. Reformat the whole file.

View File

@ -145,15 +145,15 @@ static void remove_from_hotlist (struct hotlist *entry);
#define new_hotlist() g_new0(struct hotlist, 1)
static void hotlist_refresh (Dlg_head *dlg)
static void
hotlist_refresh (Dlg_head * dlg)
{
dialog_repaint (dlg, COLOR_NORMAL, COLOR_HOT_NORMAL);
common_dialog_repaint (dlg);
attrset (COLOR_NORMAL);
draw_box (dlg, 2, 5,
dlg->lines - (hotlist_state.moving ? 6 : 10),
dlg->cols - (UX*2));
draw_box (dlg, 2, 5, dlg->lines - (hotlist_state.moving ? 6 : 10),
dlg->cols - (UX * 2));
if (!hotlist_state.moving)
draw_box (dlg, dlg->lines-8, 5, 3, dlg->cols - (UX*2));
draw_box (dlg, dlg->lines - 8, 5, 3, dlg->cols - (UX * 2));
}
/* If current->data is 0, then we are dealing with a VFS pathname */

View File

@ -53,34 +53,30 @@
/* {{{ Common dialog callback */
void
dialog_repaint (struct Dlg_head *h, int back, int title_fore)
common_dialog_repaint (struct Dlg_head *h)
{
int space;
space = (h->flags & DLG_COMPACT) ? 0 : 1;
attrset (back);
attrset (NORMALC);
dlg_erase (h);
draw_box (h, space, space, h->lines - 2 * space, h->cols - 2 * space);
attrset (title_fore);
attrset (HOT_NORMALC);
if (h->title) {
dlg_move (h, space, (h->cols - strlen (h->title)) / 2);
addstr (h->title);
}
}
void
common_dialog_repaint (struct Dlg_head *h)
{
dialog_repaint (h, NORMALC, HOT_NORMALC);
}
int
common_dialog_callback (struct Dlg_head *h, int id, int msg)
{
if (msg == DLG_DRAW)
if (msg == DLG_DRAW) {
common_dialog_repaint (h);
return 0;
return MSG_HANDLED;
}
return MSG_NOT_HANDLED;
}
/* }}} */
@ -154,17 +150,6 @@ int run_listbox (Listbox *l)
/* {{{ Query Dialog functions */
static int query_callback (struct Dlg_head *h, int Id, int Msg)
{
switch (Msg){
case DLG_DRAW:
dialog_repaint (h, NORMALC, HOT_NORMALC);
break;
}
return 0;
}
Dlg_head *last_query_dlg;
static int sel_pos = 0;
@ -211,7 +196,8 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
/* prepare dialog */
query_dlg = create_dlg (ypos, xpos, lines, cols, query_colors,
query_callback, "[QueryBox]", "query", DLG_BACKWARD);
common_dialog_callback, "[QueryBox]",
"query", DLG_BACKWARD);
x_set_dialog_title (query_dlg, header);
if (count > 0){

View File

@ -1,12 +1,11 @@
#ifndef __WTOOLS_H
#define __WTOOLS_H
/* Dialog default background repaint routines */
void dialog_repaint (struct Dlg_head *h, int back, int title_fore);
/* Repaint the area, the frame and the title */
void common_dialog_repaint (struct Dlg_head *h);
/* For common dialogs, just repaint background */
int common_dialog_callback (struct Dlg_head *h, int id, int msg);
/* For common dialogs, just repaint */
int common_dialog_callback (struct Dlg_head *h, int id, int msg);
/* Listbox utility functions */
typedef struct {