mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 12:56:51 +03:00
Fixed dialog colors definition, setup and handling.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
791404055b
commit
5feea4aead
@ -169,8 +169,10 @@ create_dlg (int y1, int x1, int lines, int cols, const int *color_set,
|
||||
y1 -= 2;
|
||||
|
||||
new_d = g_new0 (Dlg_head, 1);
|
||||
if (color_set != NULL)
|
||||
memmove (new_d->color, color_set, sizeof (new_d->color));
|
||||
if (color_set != NULL) {
|
||||
new_d->color = g_new (int, DLG_COLOR_NUM);
|
||||
memmove (new_d->color, color_set, sizeof (int) * DLG_COLOR_NUM);
|
||||
}
|
||||
new_d->help_ctx = help_ctx;
|
||||
new_d->callback = callback ? callback : default_dlg_callback;
|
||||
new_d->x = x1;
|
||||
@ -802,6 +804,7 @@ destroy_dlg (Dlg_head *h)
|
||||
g_free (h->current);
|
||||
h->current = c;
|
||||
}
|
||||
g_free (h->color);
|
||||
g_free (h->title);
|
||||
g_free (h);
|
||||
|
||||
|
15
src/dialog.h
15
src/dialog.h
@ -26,12 +26,6 @@
|
||||
#include "../src/tty/mouse.h"
|
||||
#include "util.h" /* Hook */
|
||||
|
||||
/* Color constants */
|
||||
#define DLG_NORMALC(h) ((h)->color[0])
|
||||
#define DLG_FOCUSC(h) ((h)->color[1])
|
||||
#define DLG_HOT_NORMALC(h) ((h)->color[2])
|
||||
#define DLG_HOT_FOCUSC(h) ((h)->color[3])
|
||||
|
||||
/* Common return values */
|
||||
#define B_EXIT 0
|
||||
#define B_CANCEL 1
|
||||
@ -89,11 +83,18 @@ typedef enum {
|
||||
struct Dlg_head;
|
||||
typedef cb_ret_t (*dlg_cb_fn)(struct Dlg_head *h, dlg_msg_t msg, int parm);
|
||||
|
||||
/* Dialog color constants */
|
||||
#define DLG_COLOR_NUM 4
|
||||
#define DLG_NORMALC(h) ((h)->color[0])
|
||||
#define DLG_FOCUSC(h) ((h)->color[1])
|
||||
#define DLG_HOT_NORMALC(h) ((h)->color[2])
|
||||
#define DLG_HOT_FOCUSC(h) ((h)->color[3])
|
||||
|
||||
typedef struct Dlg_head {
|
||||
/* Set by the user */
|
||||
int flags; /* User flags */
|
||||
const char *help_ctx; /* Name of the help entry */
|
||||
const int color[4]; /* Color set. Unused in viewer and editor */
|
||||
int *color; /* Color set. Unused in viewer and editor */
|
||||
/*notconst*/ char *title; /* Title of the dialog */
|
||||
|
||||
/* Set and received by the user */
|
||||
|
@ -1671,7 +1671,7 @@ mc_maybe_editor_or_viewer (void)
|
||||
static void
|
||||
do_nc (void)
|
||||
{
|
||||
const int midnight_colors[4] =
|
||||
const int midnight_colors[DLG_COLOR_NUM] =
|
||||
{
|
||||
NORMAL_COLOR, /* NORMALC */
|
||||
REVERSE_COLOR, /* FOCUSC */
|
||||
|
@ -50,7 +50,7 @@ Listbox *
|
||||
create_listbox_window_delta (int delta_x, int delta_y, int cols, int lines,
|
||||
const char *title, const char *help)
|
||||
{
|
||||
const int listbox_colors[4] =
|
||||
const int listbox_colors[DLG_COLOR_NUM] =
|
||||
{
|
||||
MENU_ENTRY_COLOR,
|
||||
MENU_SELECTED_COLOR,
|
||||
|
Loading…
Reference in New Issue
Block a user