mirror of https://github.com/MidnightCommander/mc
editor now has its own color definitions that cna be set with MC_COLOR_TABLE
This commit is contained in:
parent
2a89ecbf51
commit
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>
|
1998-12-10 Paul Sheer <psheer@obsidian.co.za>
|
||||||
|
|
||||||
* syntax.c: perl syntax highlighting. syntax highlighting
|
* syntax.c: perl syntax highlighting. syntax highlighting
|
||||||
|
|
|
@ -102,6 +102,11 @@ struct colorpair color_map [] = {
|
||||||
{ "device=", 0, 0 },
|
{ "device=", 0, 0 },
|
||||||
{ "special=", 0, 0 },
|
{ "special=", 0, 0 },
|
||||||
{ "core=", 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 {
|
struct color_table_s {
|
||||||
|
@ -279,7 +284,7 @@ void init_colors (void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined HAVE_SLANG && !defined(OS2_NT)
|
#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 */
|
of the terminal */
|
||||||
char *Norm_Vid = SLtt_tgetstr ("me");
|
char *Norm_Vid = SLtt_tgetstr ("me");
|
||||||
|
|
||||||
|
@ -287,7 +292,7 @@ void init_colors (void)
|
||||||
Norm_Vid = SLtt_tgetstr ("se");
|
Norm_Vid = SLtt_tgetstr ("se");
|
||||||
if (Norm_Vid == NULL)
|
if (Norm_Vid == NULL)
|
||||||
Norm_Vid = "\033[0m";
|
Norm_Vid = "\033[0m";
|
||||||
SLtt_set_color_esc (31, Norm_Vid);
|
SLtt_set_color_esc (33, Norm_Vid);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
12
src/color.h
12
src/color.h
|
@ -30,6 +30,7 @@ extern int attr_pairs [];
|
||||||
#else
|
#else
|
||||||
#define MARKED_SELECTED_COLOR (PORT_COLOR (MY_COLOR_PAIR (4),A_REVERSE | A_BOLD))
|
#define MARKED_SELECTED_COLOR (PORT_COLOR (MY_COLOR_PAIR (4),A_REVERSE | A_BOLD))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ERROR_COLOR (PORT_COLOR (MY_COLOR_PAIR (5),0))
|
#define ERROR_COLOR (PORT_COLOR (MY_COLOR_PAIR (5),0))
|
||||||
#define MENU_ENTRY_COLOR (PORT_COLOR (MY_COLOR_PAIR (6),A_REVERSE))
|
#define MENU_ENTRY_COLOR (PORT_COLOR (MY_COLOR_PAIR (6),A_REVERSE))
|
||||||
#define REVERSE_COLOR (PORT_COLOR (MY_COLOR_PAIR(7),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_HOT_COLOR (PORT_COLOR (MY_COLOR_PAIR(14),0))
|
||||||
#define MENU_HOTSEL_COLOR (PORT_COLOR (MY_COLOR_PAIR(15),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
|
* This should be selectable independently. Default has to be black background
|
||||||
* foreground does not matter at all.
|
* foreground does not matter at all.
|
||||||
|
@ -48,7 +58,7 @@ extern int attr_pairs [];
|
||||||
#define INPUT_COLOR (PORT_COLOR (MY_COLOR_PAIR(22),0))
|
#define INPUT_COLOR (PORT_COLOR (MY_COLOR_PAIR(22),0))
|
||||||
|
|
||||||
#ifdef HAVE_SLANG
|
#ifdef HAVE_SLANG
|
||||||
# define DEFAULT_COLOR (PORT_COLOR (MY_COLOR_PAIR(31),0))
|
# define DEFAULT_COLOR (PORT_COLOR (MY_COLOR_PAIR(33),0))
|
||||||
# else
|
# else
|
||||||
# define DEFAULT_COLOR A_NORMAL
|
# define DEFAULT_COLOR A_NORMAL
|
||||||
#endif
|
#endif
|
||||||
|
|
10
src/slint.c
10
src/slint.c
|
@ -368,6 +368,10 @@ alloc_color_pair (char *foreground, char *background)
|
||||||
return max_index;
|
return max_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern struct colorpair {
|
||||||
|
char *name, *fg, *bg;
|
||||||
|
} color_map[];
|
||||||
|
|
||||||
int
|
int
|
||||||
try_alloc_color_pair (char *fg, char *bg)
|
try_alloc_color_pair (char *fg, char *bg)
|
||||||
{
|
{
|
||||||
|
@ -380,7 +384,7 @@ try_alloc_color_pair (char *fg, char *bg)
|
||||||
0, 0, 0, 0
|
0, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
c.index = NORMAL_COLOR;
|
c.index = EDITOR_NORMAL_COLOR;
|
||||||
p = &c;
|
p = &c;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
if (((fg && p->fg) ? !strcmp (fg, p->fg) : fg == p->fg) != 0
|
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->fg = fg ? strdup (fg) : 0;
|
||||||
p->bg = bg ? strdup (bg) : 0;
|
p->bg = bg ? strdup (bg) : 0;
|
||||||
if (!fg)
|
if (!fg)
|
||||||
fg = "white";
|
fg = color_map[28].fg;
|
||||||
if (!bg)
|
if (!bg)
|
||||||
bg = "blue";
|
bg = color_map[28].bg;
|
||||||
p->index = alloc_color_pair (fg, bg);
|
p->index = alloc_color_pair (fg, bg);
|
||||||
return p->index;
|
return p->index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,10 @@ char *default_edition_colors =
|
||||||
"link=lightgray,blue:"
|
"link=lightgray,blue:"
|
||||||
"device=brightmagenta,blue:"
|
"device=brightmagenta,blue:"
|
||||||
"core=red,blue:"
|
"core=red,blue:"
|
||||||
"special=black,blue";
|
"special=black,blue:"
|
||||||
|
"editnormal=lightgray,blue:"
|
||||||
|
"editbold=yellow,blue:"
|
||||||
|
"editmarked=black,cyan";
|
||||||
|
|
||||||
void
|
void
|
||||||
edition_post_exec (void)
|
edition_post_exec (void)
|
||||||
|
|
|
@ -860,7 +860,7 @@ display (WView *view)
|
||||||
view->cursor_col = col;
|
view->cursor_col = col;
|
||||||
}
|
}
|
||||||
boldflag = 2;
|
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) */
|
/* Print a hex number (sprintf is too slow) */
|
||||||
|
@ -906,7 +906,7 @@ display (WView *view)
|
||||||
view_set_color (view, BOLD_COLOR);
|
view_set_color (view, BOLD_COLOR);
|
||||||
goto setcursor;
|
goto setcursor;
|
||||||
case 2:
|
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;
|
goto setcursor;
|
||||||
case 3:
|
case 3:
|
||||||
view_set_color (view, 7);
|
view_set_color (view, 7);
|
||||||
|
|
Loading…
Reference in New Issue