editor now has its own color definitions that cna be set with MC_COLOR_TABLE
Этот коммит содержится в:
родитель
2a89ecbf51
Коммит
8267abaebc
@ -1,3 +1,9 @@
|
||||
Fri Dec 11 00:05:50 1998 Paul Sheer <psheer@obsidian.co.za>
|
||||
|
||||
* syntax.c, slint.c, color.c, color.h: editor now has its
|
||||
own color configuration so you can set editor background
|
||||
colors with MC_COLOR_TABLE.
|
||||
|
||||
1998-12-10 Paul Sheer <psheer@obsidian.co.za>
|
||||
|
||||
* syntax.c: perl syntax highlighting. syntax highlighting
|
||||
|
@ -102,6 +102,11 @@ struct colorpair color_map [] = {
|
||||
{ "device=", 0, 0 },
|
||||
{ "special=", 0, 0 },
|
||||
{ "core=", 0, 0 },
|
||||
|
||||
/* editor colors start at 29 */
|
||||
{ "editnormal=", 0, 0 }, /* normal */
|
||||
{ "editbold=", 0, 0 }, /* search->found */
|
||||
{ "editmarked=", 0, 0 }, /* marked/selected */
|
||||
};
|
||||
|
||||
struct color_table_s {
|
||||
@ -279,7 +284,7 @@ void init_colors (void)
|
||||
#endif
|
||||
|
||||
#if defined HAVE_SLANG && !defined(OS2_NT)
|
||||
if (use_colors) { /* Hack to make COLOR_PAIR(31) be the default fg/bg
|
||||
if (use_colors) { /* Hack to make COLOR_PAIR(33) be the default fg/bg
|
||||
of the terminal */
|
||||
char *Norm_Vid = SLtt_tgetstr ("me");
|
||||
|
||||
@ -287,7 +292,7 @@ void init_colors (void)
|
||||
Norm_Vid = SLtt_tgetstr ("se");
|
||||
if (Norm_Vid == NULL)
|
||||
Norm_Vid = "\033[0m";
|
||||
SLtt_set_color_esc (31, Norm_Vid);
|
||||
SLtt_set_color_esc (33, Norm_Vid);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
12
src/color.h
12
src/color.h
@ -30,6 +30,7 @@ extern int attr_pairs [];
|
||||
#else
|
||||
#define MARKED_SELECTED_COLOR (PORT_COLOR (MY_COLOR_PAIR (4),A_REVERSE | A_BOLD))
|
||||
#endif
|
||||
|
||||
#define ERROR_COLOR (PORT_COLOR (MY_COLOR_PAIR (5),0))
|
||||
#define MENU_ENTRY_COLOR (PORT_COLOR (MY_COLOR_PAIR (6),A_REVERSE))
|
||||
#define REVERSE_COLOR (PORT_COLOR (MY_COLOR_PAIR(7),A_REVERSE))
|
||||
@ -40,6 +41,15 @@ extern int attr_pairs [];
|
||||
#define MENU_HOT_COLOR (PORT_COLOR (MY_COLOR_PAIR(14),0))
|
||||
#define MENU_HOTSEL_COLOR (PORT_COLOR (MY_COLOR_PAIR(15),0))
|
||||
|
||||
/*
|
||||
* editor colors - only 3 for normal, search->found, and select, respectively
|
||||
* Last is defined to view color.
|
||||
*/
|
||||
#define EDITOR_NORMAL_COLOR (PORT_COLOR (MY_COLOR_PAIR (29), 0))
|
||||
#define EDITOR_BOLD_COLOR (PORT_COLOR (MY_COLOR_PAIR (30),A_BOLD))
|
||||
#define EDITOR_MARKED_COLOR (PORT_COLOR (MY_COLOR_PAIR (31),A_REVERSE))
|
||||
#define EDITOR_UNDERLINED_COLOR VIEW_UNDERLINED_COLOR
|
||||
|
||||
/*
|
||||
* This should be selectable independently. Default has to be black background
|
||||
* foreground does not matter at all.
|
||||
@ -48,7 +58,7 @@ extern int attr_pairs [];
|
||||
#define INPUT_COLOR (PORT_COLOR (MY_COLOR_PAIR(22),0))
|
||||
|
||||
#ifdef HAVE_SLANG
|
||||
# define DEFAULT_COLOR (PORT_COLOR (MY_COLOR_PAIR(31),0))
|
||||
# define DEFAULT_COLOR (PORT_COLOR (MY_COLOR_PAIR(33),0))
|
||||
# else
|
||||
# define DEFAULT_COLOR A_NORMAL
|
||||
#endif
|
||||
|
10
src/slint.c
10
src/slint.c
@ -368,6 +368,10 @@ alloc_color_pair (char *foreground, char *background)
|
||||
return max_index;
|
||||
}
|
||||
|
||||
extern struct colorpair {
|
||||
char *name, *fg, *bg;
|
||||
} color_map[];
|
||||
|
||||
int
|
||||
try_alloc_color_pair (char *fg, char *bg)
|
||||
{
|
||||
@ -380,7 +384,7 @@ try_alloc_color_pair (char *fg, char *bg)
|
||||
0, 0, 0, 0
|
||||
};
|
||||
|
||||
c.index = NORMAL_COLOR;
|
||||
c.index = EDITOR_NORMAL_COLOR;
|
||||
p = &c;
|
||||
for (;;) {
|
||||
if (((fg && p->fg) ? !strcmp (fg, p->fg) : fg == p->fg) != 0
|
||||
@ -396,9 +400,9 @@ try_alloc_color_pair (char *fg, char *bg)
|
||||
p->fg = fg ? strdup (fg) : 0;
|
||||
p->bg = bg ? strdup (bg) : 0;
|
||||
if (!fg)
|
||||
fg = "white";
|
||||
fg = color_map[28].fg;
|
||||
if (!bg)
|
||||
bg = "blue";
|
||||
bg = color_map[28].bg;
|
||||
p->index = alloc_color_pair (fg, bg);
|
||||
return p->index;
|
||||
}
|
||||
|
@ -47,7 +47,10 @@ char *default_edition_colors =
|
||||
"link=lightgray,blue:"
|
||||
"device=brightmagenta,blue:"
|
||||
"core=red,blue:"
|
||||
"special=black,blue";
|
||||
"special=black,blue:"
|
||||
"editnormal=lightgray,blue:"
|
||||
"editbold=yellow,blue:"
|
||||
"editmarked=black,cyan";
|
||||
|
||||
void
|
||||
edition_post_exec (void)
|
||||
|
@ -860,7 +860,7 @@ display (WView *view)
|
||||
view->cursor_col = col;
|
||||
}
|
||||
boldflag = 2;
|
||||
view_set_color (view, view->view_side == view_side_left ? PICK_COLOR (15, 31));
|
||||
view_set_color (view, view->view_side == view_side_left ? PICK_COLOR (15, 33));
|
||||
}
|
||||
|
||||
/* Print a hex number (sprintf is too slow) */
|
||||
@ -906,7 +906,7 @@ display (WView *view)
|
||||
view_set_color (view, BOLD_COLOR);
|
||||
goto setcursor;
|
||||
case 2:
|
||||
view_set_color (view, view->view_side == view_side_left ? PICK_COLOR (31, 15));
|
||||
view_set_color (view, view->view_side == view_side_left ? PICK_COLOR (33, 15));
|
||||
goto setcursor;
|
||||
case 3:
|
||||
view_set_color (view, 7);
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user