diff --git a/curspriv.h b/curspriv.h index f87a6a38..3460cfe5 100644 --- a/curspriv.h +++ b/curspriv.h @@ -15,7 +15,7 @@ * See the file maintain.er for details of the current maintainer. * ************************************************************************/ -/* $Id: curspriv.h,v 1.121 2006/09/25 06:34:41 wmcbrine Exp $ */ +/* $Id: curspriv.h,v 1.122 2006/09/25 19:25:19 wmcbrine Exp $ */ /* CURSPRIV.H @@ -52,6 +52,8 @@ extern unsigned char *pdc_atrtab; */ void PDC_beep(void); +bool PDC_can_change_color(void); +int PDC_color_content(short, short *, short *, short *); bool PDC_check_bios_key(void); int PDC_curs_set(int); void PDC_flushinp(void); @@ -63,6 +65,7 @@ int PDC_get_cursor_mode(void); int PDC_get_rows(void); void PDC_gotoyx(int, int); void PDC_init_atrtab(void); +int PDC_init_color(short, short, short, short); WINDOW *PDC_makenew(int, int, int, int); int PDC_mouse_in_slk(int, int); void PDC_napms(int); diff --git a/dos/pdcscrn.c b/dos/pdcscrn.c index fb27d7ef..ce934bd2 100644 --- a/dos/pdcscrn.c +++ b/dos/pdcscrn.c @@ -24,7 +24,7 @@ # include #endif -RCSID("$Id: pdcscrn.c,v 1.53 2006/09/20 08:56:30 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.54 2006/09/25 19:25:19 wmcbrine Exp $"); int pdc_adapter; /* screen type */ int pdc_scrnmode; /* default screen mode */ @@ -722,3 +722,18 @@ void PDC_save_screen_mode(int i) saved_scrnmode[i] = pdc_scrnmode; } } + +bool PDC_can_change_color(void) +{ + return FALSE; +} + +int PDC_color_content(short color, short *red, short *blue, short *green) +{ + return ERR; +} + +int PDC_init_color(short color, short red, short blue, short green) +{ + return ERR; +} diff --git a/os2/pdcscrn.c b/os2/pdcscrn.c index bc587498..fed53ec3 100644 --- a/os2/pdcscrn.c +++ b/os2/pdcscrn.c @@ -25,7 +25,7 @@ #include #include -RCSID("$Id: pdcscrn.c,v 1.48 2006/09/20 08:56:30 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.49 2006/09/25 19:25:19 wmcbrine Exp $"); int pdc_font; /* default font size */ @@ -341,3 +341,18 @@ void PDC_save_screen_mode(int i) } #endif } + +bool PDC_can_change_color(void) +{ + return FALSE; +} + +int PDC_color_content(short color, short *red, short *blue, short *green) +{ + return ERR; +} + +int PDC_init_color(short color, short red, short blue, short green) +{ + return ERR; +} diff --git a/pdcurses/color.c b/pdcurses/color.c index b53290a9..b67ce262 100644 --- a/pdcurses/color.c +++ b/pdcurses/color.c @@ -20,7 +20,7 @@ #include #include -RCSID("$Id: color.c,v 1.57 2006/09/24 21:22:33 wmcbrine Exp $"); +RCSID("$Id: color.c,v 1.58 2006/09/25 19:25:19 wmcbrine Exp $"); /*man-start************************************************************** @@ -194,31 +194,40 @@ int init_color(short color, short red, short green, short blue) { PDC_LOG(("init_color() - called\n")); - return ERR; + if (color >= COLORS || color < 0 || !PDC_can_change_color()) + return ERR; + + return PDC_init_color(color, red, green, blue); } int color_content(short color, short *red, short *green, short *blue) { PDC_LOG(("color_content() - called\n")); - /* A crude implementation. Does not account for intensity. - ncurses uses 680 for non-A_BOLD, so let's copy that. - WJM3 */ - if ((color >= COLORS || color < 0) || (!red || !green || !blue)) return ERR; - *red = (color & COLOR_RED) ? 680 : 0; - *green = (color & COLOR_GREEN) ? 680 : 0; - *blue = (color & COLOR_BLUE) ? 680 : 0; + if (PDC_can_change_color()) + return PDC_color_content(color, red, green, blue); + else + { + /* A crude implementation. Does not account for + intensity. ncurses uses 680 for non-A_BOLD, so let's + copy that. - WJM3 */ - return OK; + *red = (color & COLOR_RED) ? 680 : 0; + *green = (color & COLOR_GREEN) ? 680 : 0; + *blue = (color & COLOR_BLUE) ? 680 : 0; + + return OK; + } } bool can_change_color(void) { PDC_LOG(("can_change_color() - called\n")); - return FALSE; + return PDC_can_change_color(); } int pair_content(short colorpair, short *foreground, short *background) diff --git a/win32/pdcscrn.c b/win32/pdcscrn.c index 94e621fa..1160284b 100644 --- a/win32/pdcscrn.c +++ b/win32/pdcscrn.c @@ -24,7 +24,7 @@ #define CURSES_LIBRARY 1 #include -RCSID("$Id: pdcscrn.c,v 1.59 2006/09/20 08:56:30 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.60 2006/09/25 19:25:19 wmcbrine Exp $"); #define PDC_RESTORE_NONE 0 #define PDC_RESTORE_BUFFER 1 @@ -397,6 +397,21 @@ void PDC_save_screen_mode(int i) { } +bool PDC_can_change_color(void) +{ + return FALSE; +} + +int PDC_color_content(short color, short *red, short *blue, short *green) +{ + return ERR; +} + +int PDC_init_color(short color, short red, short blue, short green) +{ + return ERR; +} + #ifdef PDC_DLL_BUILD BOOL WINAPI DllMain(HINSTANCE hDLL, DWORD dwReason, LPVOID pReserved) diff --git a/x11/pdcscrn.c b/x11/pdcscrn.c index 8ea356bc..881ee53d 100644 --- a/x11/pdcscrn.c +++ b/x11/pdcscrn.c @@ -17,7 +17,7 @@ #include "pdcx11.h" -RCSID("$Id: pdcscrn.c,v 1.41 2006/09/20 08:56:30 wmcbrine Exp $"); +RCSID("$Id: pdcscrn.c,v 1.42 2006/09/25 19:25:19 wmcbrine Exp $"); /*man-start************************************************************** @@ -161,3 +161,18 @@ void PDC_restore_screen_mode(int i) void PDC_save_screen_mode(int i) { } + +bool PDC_can_change_color(void) +{ + return FALSE; +} + +int PDC_color_content(short color, short *red, short *blue, short *green) +{ + return ERR; +} + +int PDC_init_color(short color, short red, short blue, short green) +{ + return ERR; +}