keyparse.c (most-5.1.0) | : | keyparse.c (most-5.2.0) | ||
---|---|---|---|---|
/* | /* | |||
This file is part of MOST. | This file is part of MOST. | |||
Copyright (c) 1991, 1999, 2002, 2005-2018, 2019 John E. Davis | Copyright (c) 1991, 1999, 2002, 2005-2021, 2022 John E. Davis | |||
This program is free software; you can redistribute it and/or modify it | This program is free software; you can redistribute it and/or modify it | |||
under the terms of the GNU General Public License as published by the Free | under the terms of the GNU General Public License as published by the Free | |||
Software Foundation; either version 2 of the License, or (at your option) | Software Foundation; either version 2 of the License, or (at your option) | |||
any later version. | any later version. | |||
This program is distributed in the hope that it will be useful, but WITHOUT | This program is distributed in the hope that it will be useful, but WITHOUT | |||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | |||
more details. | more details. | |||
skipping to change at line 54 | skipping to change at line 54 | |||
* unsetkey "^K" | * unsetkey "^K" | |||
* setkey exit "^Kx" | * setkey exit "^Kx" | |||
* | * | |||
* Comments extend from the first '%' character to the end of the line. | * Comments extend from the first '%' character to the end of the line. | |||
*/ | */ | |||
#include <slang.h> | #include <slang.h> | |||
#include "jdmacros.h" | #include "jdmacros.h" | |||
#include "most.h" | #include "most.h" | |||
#include "keyparse.h" | #include "keyparse.h" | |||
#include "display.h" | #include "color.h" | |||
static unsigned int Line_Num; | static unsigned int Line_Num; | |||
static void parse_error (char *s) | static void parse_error (char *s) | |||
{ | { | |||
fprintf(stderr, "Most: Error reading config file on line %u.\n%s\n", | fprintf(stderr, "Most: Error reading config file on line %u.\n%s\n", | |||
Line_Num, s); | Line_Num, s); | |||
most_exit_error (NULL); | most_exit_error (NULL); | |||
} | } | |||
skipping to change at line 269 | skipping to change at line 269 | |||
} | } | |||
SLtt_set_mono (ct->value, NULL, mono_attr); | SLtt_set_mono (ct->value, NULL, mono_attr); | |||
return 0; | return 0; | |||
} | } | |||
ct++; | ct++; | |||
} | } | |||
parse_error ("Undefined color object"); | parse_error ("Undefined color object"); | |||
return -1; | return -1; | |||
} | } | |||
static char *Ansi_Color_Map[9] = | int most_setup_colors (void) | |||
{ | ||||
"black", | ||||
"red", | ||||
"green", | ||||
"yellow", | ||||
"blue", | ||||
"magenta", | ||||
"cyan", | ||||
"white", | ||||
"default" | ||||
}; | ||||
void most_setup_colors (void) | ||||
{ | { | |||
Color_Handle_Type *h; | Color_Handle_Type *h; | |||
int i; | int i; | |||
int fg, bg, at; | ||||
for (i = 1; i < 128; i++) | for (i = 1; i < MOST_EMBEDDED_COLOR_OFFSET; i++) | |||
{ | { | |||
SLtt_set_color (i, NULL, "default", "default"); | SLtt_set_color (i, NULL, "default", "default"); | |||
SLtt_set_mono (i, NULL, 0); | SLtt_set_mono (i, NULL, 0); | |||
} | } | |||
for (at = 0; at < 9; at++) | ||||
{ | ||||
for (fg = 0; fg < 9; fg++) | ||||
{ | ||||
for (bg = 0; bg < 9; bg++) | ||||
{ | ||||
i = fg + 9*(bg + 9*at); | ||||
if (i == 0) | ||||
continue; | ||||
i += MOST_EMBEDDED_COLOR_OFFSET; | ||||
SLtt_set_color (i, NULL, Ansi_Color_Map[fg], Ansi_Color_Map[bg] | ||||
); | ||||
} | ||||
} | ||||
} | ||||
h = Color_Handles; | h = Color_Handles; | |||
while (h->name != NULL) | while (h->name != NULL) | |||
{ | { | |||
/* if (h->value != 0)*/ /* Let COLORFGBG apply to initial color */ | /* if (h->value != 0)*/ /* Let COLORFGBG apply to initial color */ | |||
SLtt_set_color (h->value, NULL, h->fg, h->bg); | SLtt_set_color (h->value, NULL, h->fg, h->bg); | |||
SLtt_set_color (h->value+MOST_EMBEDDED_COLOR_OFFSET, NULL, h->fg, h->bg); | ||||
SLtt_set_mono (h->value, NULL, h->mono); | SLtt_set_mono (h->value, NULL, h->mono); | |||
SLtt_set_mono (h->value+MOST_EMBEDDED_COLOR_OFFSET, NULL, h->mono); | /* SLtt_set_color (h->value+MOST_EMBEDDED_COLOR_OFFSET, NULL, h->fg, h->b | |||
g); */ | ||||
/* SLtt_set_mono (h->value+MOST_EMBEDDED_COLOR_OFFSET, NULL, h->mono); */ | ||||
h++; | h++; | |||
} | } | |||
return most_setup_embedded_colors (); | ||||
} | } | |||
End of changes. 9 change blocks. | ||||
36 lines changed or deleted | 9 lines changed or added |