* color.c: Define global array alarm_colors for the colors used

in the dialogs that should be most visible (error messages,
request to delete or overwrite).
(load_dialog_colors): Initialize alarm_colors.
* filegui.c: Use alarm_colors.
* wtools.c: Likewise.
* dlg.c (create_dlg): Make the color_set array constant.
This commit is contained in:
Pavel Roskin 2002-08-31 00:29:48 +00:00
parent 485a8cbac1
commit 180ec10d69
7 changed files with 27 additions and 20 deletions

View File

@ -1,5 +1,13 @@
2002-08-30 Pavel Roskin <proski@gnu.org>
* color.c: Define global array alarm_colors for the colors used
in the dialogs that should be most visible (error messages,
request to delete or overwrite).
(load_dialog_colors): Initialize alarm_colors.
* filegui.c: Use alarm_colors.
* wtools.c: Likewise.
* dlg.c (create_dlg): Make the color_set array constant.
* wtools.c (common_dialog_repaint): Use colors specific to the
current dialog, not fixed colors for "normal" dialogs.
* filegui.c (replace_callback): Eliminate, use

View File

@ -34,7 +34,9 @@ int disable_colors = 0;
/* Set if we are actually using colors */
int use_colors = 0;
/* Color styles for normal and error dialogs */
int dialog_colors [4];
int alarm_colors [4];
#define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
@ -235,6 +237,11 @@ load_dialog_colors (void)
dialog_colors [1] = COLOR_FOCUS;
dialog_colors [2] = COLOR_HOT_NORMAL;
dialog_colors [3] = COLOR_HOT_FOCUS;
alarm_colors [0] = ERROR_COLOR;
alarm_colors [1] = REVERSE_COLOR;
alarm_colors [2] = ERROR_COLOR;
alarm_colors [3] = COLOR_HOT_NORMAL;
}
void init_colors (void)

View File

@ -34,8 +34,8 @@ extern int attr_pairs [];
#define Q_SELECTED_COLOR BEST_COLOR (2, 0)
#define Q_UNSELECTED_COLOR REVERSE_COLOR
extern int sel_mark_color [4];
extern int dialog_colors [4];
extern int dialog_colors[4];
extern int alarm_colors[4];
/* Dialog colors */
#define COLOR_NORMAL BEST_COLOR (8, A_REVERSE)

View File

@ -186,7 +186,7 @@ int default_dlg_callback (Dlg_head *h, int id, int msg)
}
Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
int *color_set,
const int *color_set,
int (*callback) (struct Dlg_head *, int, int),
char *help_ctx, char *name,
int flags)

View File

@ -67,7 +67,7 @@ typedef struct Dlg_head {
/* Set by the user */
int flags; /* User flags */
char *help_ctx; /* Name of the help entry */
int *color; /* Color set */
const int *color; /* Color set */
char *title; /* Title of the dialog */
/* Set and received by the user */
@ -128,7 +128,7 @@ void draw_double_box (Dlg_head *h, int y, int x, int ys, int xs);
/* Creates a dialog head */
Dlg_head *create_dlg (int y1, int x1, int lines, int cols,
int *col,
const int *color_set,
int (*callback) (struct Dlg_head *, int, int),
char *help_ctx, char *name, int flags);

View File

@ -130,9 +130,6 @@ typedef struct {
} FileOpContextUI;
/* Replace dialog: color set */
static int replace_colors [4];
/* Used to save the hint line */
static int last_hint_line;
@ -613,12 +610,7 @@ init_replace (FileOpContext *ctx, enum OperationMode mode)
ui = ctx->ui;
replace_colors [0] = ERROR_COLOR;
replace_colors [1] = COLOR_NORMAL;
replace_colors [2] = ERROR_COLOR;
replace_colors [3] = COLOR_NORMAL;
ui->replace_dlg = create_dlg (0, 0, 16, rd_xlen, replace_colors,
ui->replace_dlg = create_dlg (0, 0, 16, rd_xlen, alarm_colors,
common_dialog_callback,
"[ Replace ]", "replace", DLG_CENTER);

View File

@ -180,13 +180,13 @@ int query_dialog (char *header, char *text, int flags, int count, ...)
int xpos, ypos;
int cols, lines;
char *cur_name;
static int query_colors [4];
static int *query_colors;
/* set dialog colors */
query_colors [0] = (flags & D_ERROR) ? ERROR_COLOR : Q_UNSELECTED_COLOR;
query_colors [1] = (flags & D_ERROR) ? REVERSE_COLOR : Q_SELECTED_COLOR;
query_colors [2] = (flags & D_ERROR) ? ERROR_COLOR : COLOR_HOT_NORMAL;
query_colors [3] = (flags & D_ERROR) ? COLOR_HOT_NORMAL : COLOR_HOT_FOCUS;
if (flags & D_ERROR)
query_colors = alarm_colors;
else
query_colors = dialog_colors;
if (header == MSG_ERROR)
header = _(" Error ");