1
1

* color.c: Remove unused code.

* color.h: Likewise.
Этот коммит содержится в:
Pavel Roskin 2001-09-03 04:32:16 +00:00
родитель f150c6b74a
Коммит 83c37cfd0f
3 изменённых файлов: 27 добавлений и 66 удалений

Просмотреть файл

@ -1,3 +1,8 @@
2001-09-03 Pavel Roskin <proski@gnu.org>
* color.c: Remove unused code.
* color.h: Likewise.
2001-09-02 Pavel Roskin <proski@gnu.org> 2001-09-02 Pavel Roskin <proski@gnu.org>
* key.c: Remove support for BUGGY_CURSES. * key.c: Remove support for BUGGY_CURSES.

Просмотреть файл

@ -16,13 +16,12 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <config.h> #include <config.h>
#include "tty.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "global.h" #include "global.h"
#include "tty.h"
#include "setup.h" /* For the externs */ #include "setup.h" /* For the externs */
#include "color.h" #include "color.h"
#include "x.h"
/* "$Id$" */ /* "$Id$" */
@ -39,12 +38,6 @@ int dialog_colors [4];
#define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) ) #define ELEMENTS(arr) ( sizeof(arr) / sizeof((arr)[0]) )
#ifdef HAVE_GNOME
# define CTYPE GdkColor *
void init_pair (int, CTYPE, CTYPE);
#else
#ifdef HAVE_SLANG #ifdef HAVE_SLANG
# define CTYPE char * # define CTYPE char *
#else #else
@ -52,7 +45,6 @@ void init_pair (int, CTYPE, CTYPE);
# define color_map_fg(n) (color_map[n].fg % COLORS) # define color_map_fg(n) (color_map[n].fg % COLORS)
# define color_map_bg(n) (color_map[n].bg % COLORS) # define color_map_bg(n) (color_map[n].bg % COLORS)
#endif #endif
#endif
struct colorpair { struct colorpair {
char *name; /* Name of the entry */ char *name; /* Name of the entry */
@ -120,7 +112,6 @@ struct color_table_s {
}; };
#ifndef HAVE_X
static struct color_table_s const color_table [] = { static struct color_table_s const color_table [] = {
{ "black", COLOR_BLACK }, { "black", COLOR_BLACK },
{ "gray", COLOR_BLACK | A_BOLD }, { "gray", COLOR_BLACK | A_BOLD },
@ -140,11 +131,7 @@ static struct color_table_s const color_table [] = {
{ "white", COLOR_WHITE | A_BOLD }, { "white", COLOR_WHITE | A_BOLD },
{ "default", 0 } /* hack for transparent background */ { "default", 0 } /* hack for transparent background */
}; };
#endif /* !HAVE_X */
#ifdef HAVE_GNOME
void get_color (char *cpp, CTYPE *colp);
#else
#ifdef HAVE_SLANG #ifdef HAVE_SLANG
# define color_value(i) color_table [i].name # define color_value(i) color_table [i].name
# define color_name(i) color_table [i].name # define color_name(i) color_table [i].name
@ -164,7 +151,6 @@ static void get_color (char *cpp, CTYPE *colp)
} }
} }
} }
#endif /* HAVE_GNOME */
static void get_two_colors (char **cpp, struct colorpair *colorpairp) static void get_two_colors (char **cpp, struct colorpair *colorpairp)
{ {
@ -193,7 +179,7 @@ static void get_two_colors (char **cpp, struct colorpair *colorpairp)
get_color (*cpp, state ? &colorpairp->bg : &colorpairp->fg); get_color (*cpp, state ? &colorpairp->bg : &colorpairp->fg);
} }
void configure_colors_string (char *the_color_string) static void configure_colors_string (char *the_color_string)
{ {
char *color_string, *p; char *color_string, *p;
int i, found; int i, found;
@ -256,20 +242,6 @@ load_dialog_colors (void)
dialog_colors [3] = COLOR_HOT_FOCUS; dialog_colors [3] = COLOR_HOT_FOCUS;
} }
#ifdef HAVE_X
void
init_colors (void)
{
int i;
use_colors = 1;
configure_colors ();
for (i = 0; i < ELEMENTS (color_map); i++)
if (color_map [i].name)
init_pair (i+1, color_map_fg(i), color_map_bg(i));
load_dialog_colors ();
}
#else
void init_colors (void) void init_colors (void)
{ {
int i; int i;
@ -281,9 +253,7 @@ void init_colors (void)
} }
if (use_colors){ if (use_colors){
#ifndef HAVE_X
start_color (); start_color ();
#endif
configure_colors (); configure_colors ();
#ifndef HAVE_SLANG #ifndef HAVE_SLANG
@ -293,7 +263,7 @@ void init_colors (void)
"Too many defined colors, resize MAX_PAIRS on color.c"); "Too many defined colors, resize MAX_PAIRS on color.c");
exit (1); exit (1);
} }
#endif #endif /* !HAVE_SLANG */
if (use_colors) { if (use_colors) {
#ifdef HAVE_SLANG #ifdef HAVE_SLANG
@ -305,10 +275,10 @@ void init_colors (void)
* document this feature. * document this feature.
*/ */
SLtt_set_color (DEFAULT_COLOR_INDEX, NULL, "default", "default"); SLtt_set_color (DEFAULT_COLOR_INDEX, NULL, "default", "default");
#elif defined(USE_NCURSES) #else
/* Always white on black */ /* Always white on black */
init_pair(DEFAULT_COLOR_INDEX, COLOR_WHITE, COLOR_BLACK); init_pair(DEFAULT_COLOR_INDEX, COLOR_WHITE, COLOR_BLACK);
#endif #endif /* !HAVE_SLANG */
} }
for (i = 0; i < ELEMENTS (color_map); i++){ for (i = 0; i < ELEMENTS (color_map); i++){
@ -324,16 +294,8 @@ void init_colors (void)
* later, to set the attribute with the colors. * later, to set the attribute with the colors.
*/ */
attr_pairs [i+1] = color_map [i].fg & A_BOLD; attr_pairs [i+1] = color_map [i].fg & A_BOLD;
#endif #endif /* !HAVE_SLANG */
} }
} }
load_dialog_colors (); load_dialog_colors ();
} }
#endif
void toggle_color_mode (void)
{
if (hascolors)
use_colors = !use_colors;
}

Просмотреть файл

@ -2,25 +2,19 @@
#define __COLOR_H #define __COLOR_H
void init_colors (void); void init_colors (void);
void toggle_color_mode (void);
void configure_colors_string (char *color_string);
extern int hascolors; extern int hascolors;
extern int use_colors; extern int use_colors;
extern int disable_colors; extern int disable_colors;
extern int attr_pairs []; extern int attr_pairs [];
#ifdef HAVE_GNOME
# define MY_COLOR_PAIR(x) x
# define PORT_COLOR(co,bw) co
#else
#ifdef HAVE_SLANG #ifdef HAVE_SLANG
# define MY_COLOR_PAIR(x) COLOR_PAIR(x) # define MY_COLOR_PAIR(x) COLOR_PAIR(x)
#else #else
# define MY_COLOR_PAIR(x) (COLOR_PAIR(x) | attr_pairs [x]) # define MY_COLOR_PAIR(x) (COLOR_PAIR(x) | attr_pairs [x])
#endif #endif
#define PORT_COLOR(co,bw) (use_colors?co:bw) #define PORT_COLOR(co,bw) (use_colors?co:bw)
#endif
/* Beware! When using Slang with color, not all the indexes are free. /* Beware! When using Slang with color, not all the indexes are free.
See myslang.h (A_*) */ See myslang.h (A_*) */