Empty framework for real init_color() support.

This commit is contained in:
William McBrine
2006-09-25 19:25:19 +00:00
parent be39bb9568
commit 55c856fb6b
6 changed files with 87 additions and 15 deletions

View File

@@ -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);

View File

@@ -24,7 +24,7 @@
# include <sys/movedata.h>
#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;
}

View File

@@ -25,7 +25,7 @@
#include <curses.h>
#include <stdlib.h>
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;
}

View File

@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <string.h>
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)

View File

@@ -24,7 +24,7 @@
#define CURSES_LIBRARY 1
#include <curses.h>
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)

View File

@@ -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;
}