mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-24 15:55:14 +00:00
Now, if start_color() is not called, the default colors are used, even
if PDC_ORIGINAL_COLORS is not set. This corresponds to other implementations. If PDC_ORIGINAL_COLORS _is_ set, the default colors are used even after start_color(). However, I'm going to mark this as deprecated.
This commit is contained in:
8
curses.h
8
curses.h
@@ -15,7 +15,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: curses.h,v 1.138 2006/02/27 21:48:03 wmcbrine Exp $ */
|
||||
/* $Id: curses.h,v 1.139 2006/02/28 02:04:56 wmcbrine Exp $ */
|
||||
|
||||
/*----------------------------------------------------------------------*
|
||||
* PDCurses *
|
||||
@@ -615,10 +615,10 @@ typedef struct
|
||||
bool bogus_adapter; /* TRUE if adapter has insane values */
|
||||
bool shell; /* TRUE if reset_prog_mode() needs
|
||||
to be called. */
|
||||
bool orig_attr; /* TRUE if we have the original colors */
|
||||
short orig_fore; /* Original screen foreground color */
|
||||
short orig_back; /* Original screen foreground color */
|
||||
chtype blank; /* Background character */
|
||||
chtype orig_attr; /* Original screen attributes -
|
||||
top 16 bits background,
|
||||
bottom 16 bits foreground */
|
||||
int cursrow; /* position of physical cursor */
|
||||
int curscol; /* position of physical cursor */
|
||||
int cursor; /* Current Cursor definition */
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
const char *rcsid_PDCscrn =
|
||||
"$Id: pdcscrn.c,v 1.21 2006/02/23 01:46:52 wmcbrine Exp $";
|
||||
"$Id: pdcscrn.c,v 1.22 2006/02/28 02:04:57 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
static unsigned short *saved_screen = NULL;
|
||||
@@ -156,7 +156,7 @@ int PDC_scr_open(SCREEN *internal, bool echo)
|
||||
#endif
|
||||
PDC_LOG(("PDC_scr_open() - called\n"));
|
||||
|
||||
internal->orig_attr = 0;
|
||||
internal->orig_attr = FALSE;
|
||||
internal->orig_emulation = getdosmembyte (0x487);
|
||||
|
||||
PDC_get_cursor_pos(&internal->cursrow, &internal->curscol);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
const char *rcsid_PDCscrn =
|
||||
"$Id: pdcscrn.c,v 1.18 2006/02/23 01:46:52 wmcbrine Exp $";
|
||||
"$Id: pdcscrn.c,v 1.19 2006/02/28 02:04:57 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#ifdef EMXVIDEO
|
||||
@@ -152,7 +152,7 @@ int PDC_scr_open(SCREEN *internal, bool echo)
|
||||
PDC_LOG(("PDC_scr_open() - called. internal: %x, echo: %d\n",
|
||||
internal, echo));
|
||||
|
||||
internal->orig_attr = 0;
|
||||
internal->orig_attr = FALSE;
|
||||
internal->orig_emulation = 0;
|
||||
|
||||
PDC_get_cursor_pos(&internal->cursrow, &internal->curscol);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#define CURSES_LIBRARY 1
|
||||
#include <curses.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* undefine any macros for functions defined in this module */
|
||||
@@ -35,7 +36,7 @@ static void PDC_init_pair(short, short, short);
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
const char *rcsid_color =
|
||||
"$Id: color.c,v 1.42 2006/02/23 01:46:52 wmcbrine Exp $";
|
||||
"$Id: color.c,v 1.43 2006/02/28 02:04:57 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
/*man-start**************************************************************
|
||||
@@ -148,7 +149,11 @@ int start_color(void)
|
||||
if (SP->mono)
|
||||
return ERR;
|
||||
|
||||
/* PDC_init_atrtab(); - already done in initscr() */
|
||||
if (SP->orig_attr && !getenv("PDC_ORIGINAL_COLORS"))
|
||||
{
|
||||
SP->orig_attr = FALSE;
|
||||
PDC_init_atrtab();
|
||||
}
|
||||
|
||||
memset(colorset, 0, PDC_COLOR_PAIRS);
|
||||
|
||||
@@ -250,21 +255,16 @@ int PDC_set_line_color(short color)
|
||||
|
||||
void PDC_init_atrtab(void)
|
||||
{
|
||||
int i, orig_fore, orig_back;
|
||||
int i;
|
||||
|
||||
if (SP->orig_attr == 0)
|
||||
if (!SP->orig_attr)
|
||||
{
|
||||
orig_fore = COLOR_WHITE;
|
||||
orig_back = COLOR_BLACK;
|
||||
}
|
||||
else
|
||||
{
|
||||
orig_fore = SP->orig_attr & A_CHARTEXT;
|
||||
orig_back = (SP->orig_attr & A_ATTRIBUTES) >> 16;
|
||||
SP->orig_fore = COLOR_WHITE;
|
||||
SP->orig_back = COLOR_BLACK;
|
||||
}
|
||||
|
||||
for (i = 0; i < PDC_COLOR_PAIRS; i++)
|
||||
PDC_init_pair(i, orig_fore, orig_back);
|
||||
PDC_init_pair(i, SP->orig_fore, SP->orig_back);
|
||||
}
|
||||
|
||||
static void PDC_init_pair(short pairnum, short fg, short bg)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
const char *rcsid_PDCscrn =
|
||||
"$Id: pdcscrn.c,v 1.26 2006/02/23 01:46:52 wmcbrine Exp $";
|
||||
"$Id: pdcscrn.c,v 1.27 2006/02/28 02:04:57 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
#define PDC_RESTORE_NONE 0
|
||||
@@ -203,17 +203,10 @@ int PDC_scr_open(SCREEN *internal, bool echo)
|
||||
return ERR;
|
||||
}
|
||||
|
||||
if (getenv("PDC_ORIGINAL_COLORS") != NULL)
|
||||
{
|
||||
chtype orig_back, orig_fore;
|
||||
internal->orig_fore = csbi.wAttributes & 0x0f;
|
||||
internal->orig_back = (csbi.wAttributes & 0xf0) >> 4;
|
||||
|
||||
orig_fore = csbi.wAttributes & 0x0f;
|
||||
orig_back = (csbi.wAttributes & 0xf0) >> 4;
|
||||
|
||||
internal->orig_attr = (orig_back << 16) | orig_fore;
|
||||
}
|
||||
else
|
||||
internal->orig_attr = 0;
|
||||
internal->orig_attr = TRUE;
|
||||
|
||||
internal->_restore = PDC_RESTORE_NONE;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#ifdef PDCDEBUG
|
||||
const char *rcsid_PDCscrn =
|
||||
"$Id: pdcscrn.c,v 1.17 2006/02/23 01:46:52 wmcbrine Exp $";
|
||||
"$Id: pdcscrn.c,v 1.18 2006/02/28 02:04:57 wmcbrine Exp $";
|
||||
#endif
|
||||
|
||||
bool GLOBAL_sb_on = FALSE;
|
||||
@@ -123,7 +123,7 @@ int PDC_scr_open(SCREEN *internal, bool echo)
|
||||
internal->audible = TRUE;
|
||||
internal->visibility = 1;
|
||||
internal->orig_cursor = internal->cursor;
|
||||
internal->orig_attr = 0;
|
||||
internal->orig_attr = FALSE;
|
||||
internal->orgcbr = 0;
|
||||
internal->blank = ' ';
|
||||
internal->resized = FALSE;
|
||||
|
||||
Reference in New Issue
Block a user