MAX_COLORS -> PDC_MAXCOL, a consolidated definition.

This commit is contained in:
William McBrine
2019-05-16 23:57:30 -04:00
parent a75a9444db
commit 166b5205c8
16 changed files with 27 additions and 35 deletions

View File

@@ -120,4 +120,6 @@ size_t PDC_wcstombs(char *, const wchar_t *, size_t);
#define PDC_CLICK_PERIOD 150 /* time to wait for a click, if
not set by mouseinterval() */
#define PDC_MAXCOL 768 /* maximum possible COLORS; may be less */
#endif /* __CURSES_INTERNALS__ */

View File

@@ -20,8 +20,8 @@ SDL_Surface *pdc_screen = NULL, *pdc_font = NULL, *pdc_icon = NULL,
*pdc_back = NULL, *pdc_tileback = NULL;
int pdc_sheight = 0, pdc_swidth = 0, pdc_yoffset = 0, pdc_xoffset = 0;
SDL_Color pdc_color[MAX_COLORS];
Uint32 pdc_mapped[MAX_COLORS];
SDL_Color pdc_color[PDC_MAXCOL];
Uint32 pdc_mapped[PDC_MAXCOL];
int pdc_fheight, pdc_fwidth, pdc_fthick, pdc_flastc;
bool pdc_own_screen;

View File

@@ -14,12 +14,10 @@ PDCEX int pdc_font_size;
PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;
#define MAX_COLORS 768
extern SDL_Surface *pdc_tileback; /* used to regenerate the background
of "transparent" cells */
extern SDL_Color pdc_color[MAX_COLORS]; /* colors for font palette */
extern Uint32 pdc_mapped[MAX_COLORS]; /* colors for FillRect(), as
extern SDL_Color pdc_color[PDC_MAXCOL]; /* colors for font palette */
extern Uint32 pdc_mapped[PDC_MAXCOL]; /* colors for FillRect(), as
used in _highlight() */
extern int pdc_fheight, pdc_fwidth; /* font height and width */
extern int pdc_fthick; /* thickness for highlights and

View File

@@ -62,7 +62,7 @@ void PDC_set_title(const char *title)
int PDC_set_blink(bool blinkon)
{
if (pdc_color_started)
COLORS = MAX_COLORS;
COLORS = PDC_MAXCOL;
if (blinkon)
{

View File

@@ -32,8 +32,8 @@ SDL_Surface *pdc_screen = NULL, *pdc_font = NULL, *pdc_icon = NULL,
*pdc_back = NULL, *pdc_tileback = NULL;
int pdc_sheight = 0, pdc_swidth = 0, pdc_yoffset = 0, pdc_xoffset = 0;
SDL_Color pdc_color[MAX_COLORS];
Uint32 pdc_mapped[MAX_COLORS];
SDL_Color pdc_color[PDC_MAXCOL];
Uint32 pdc_mapped[PDC_MAXCOL];
int pdc_fheight, pdc_fwidth, pdc_fthick, pdc_flastc;
bool pdc_own_window;

View File

@@ -15,12 +15,10 @@ PDCEX SDL_Window *pdc_window;
PDCEX SDL_Surface *pdc_screen, *pdc_font, *pdc_icon, *pdc_back;
PDCEX int pdc_sheight, pdc_swidth, pdc_yoffset, pdc_xoffset;
#define MAX_COLORS 768
extern SDL_Surface *pdc_tileback; /* used to regenerate the background
of "transparent" cells */
extern SDL_Color pdc_color[MAX_COLORS]; /* colors for font palette */
extern Uint32 pdc_mapped[MAX_COLORS]; /* colors for FillRect(), as
extern SDL_Color pdc_color[PDC_MAXCOL]; /* colors for font palette */
extern Uint32 pdc_mapped[PDC_MAXCOL]; /* colors for FillRect(), as
used in _highlight() */
extern int pdc_fheight, pdc_fwidth; /* font height and width */
extern int pdc_fthick; /* thickness for highlights and

View File

@@ -62,7 +62,7 @@ void PDC_set_title(const char *title)
int PDC_set_blink(bool blinkon)
{
if (pdc_color_started)
COLORS = MAX_COLORS;
COLORS = PDC_MAXCOL;
if (blinkon)
{

View File

@@ -10,7 +10,7 @@ static struct {short f, b;} atrtab[PDC_COLOR_PAIRS];
/* Color component table */
PDCCOLOR pdc_color[MAX_COLORS];
PDCCOLOR pdc_color[PDC_MAXCOL];
HANDLE std_con_out = INVALID_HANDLE_VALUE;
HANDLE pdc_con_out = INVALID_HANDLE_VALUE;

View File

@@ -96,7 +96,7 @@ int PDC_set_blink(bool blinkon)
else if (PDC_can_change_color()) /* is_nt */
{
if (SetConsoleMode(pdc_con_out, 0x0004)) /* VT */
COLORS = MAX_COLORS;
COLORS = PDC_MAXCOL;
SetConsoleMode(pdc_con_out, 0x0010); /* LVB */
}

View File

@@ -13,11 +13,9 @@
# define _CRT_SECURE_NO_DEPRECATE 1 /* kill nonsense warnings */
#endif
#define MAX_COLORS 768
typedef struct {short r, g, b; bool mapped;} PDCCOLOR;
extern PDCCOLOR pdc_color[MAX_COLORS];
extern PDCCOLOR pdc_color[PDC_MAXCOL];
extern HANDLE pdc_con_out, pdc_con_in;
extern DWORD pdc_quick_edit;

View File

@@ -74,7 +74,7 @@ void PDC_set_title(const char *title)
int PDC_set_blink(bool blinkon)
{
if (pdc_color_started)
COLORS = MAX_COLORS;
COLORS = PDC_MAXCOL;
XCursesInstruct(blinkon ? CURSES_BLINK_ON : CURSES_BLINK_OFF);

View File

@@ -187,5 +187,3 @@ enum
};
extern short *xc_atrtab;
#define MAX_COLORS 768

View File

@@ -33,8 +33,8 @@ XCursesAppData xc_app_data;
# define PDC_SCROLLBAR_TYPE float
#endif
#define COLOR_CURSOR MAX_COLORS /* color of cursor */
#define COLOR_BORDER MAX_COLORS + 1 /* color of border */
#define COLOR_CURSOR PDC_MAXCOL /* color of cursor */
#define COLOR_BORDER PDC_MAXCOL + 1 /* color of border */
#define XCURSESDISPLAY (XtDisplay(drawing))
#define XCURSESWIN (XtWindow(drawing))
@@ -373,7 +373,7 @@ static XtActionsRec action_table[] =
};
static bool after_first_curses_request = FALSE;
static Pixel colors[MAX_COLORS + 2];
static Pixel colors[PDC_MAXCOL + 2];
static bool vertical_cursor = FALSE;
static XIM Xim = NULL;
@@ -2283,7 +2283,7 @@ static void _get_color(void)
Colormap cmap = DefaultColormap(XCURSESDISPLAY,
DefaultScreen(XCURSESDISPLAY));
if (index < 0 || index >= MAX_COLORS)
if (index < 0 || index >= PDC_MAXCOL)
_exit_process(4, SIGKILL, "exiting from _get_color");
tmp->pixel = colors[index];
@@ -2299,7 +2299,7 @@ static void _set_color(void)
Colormap cmap = DefaultColormap(XCURSESDISPLAY,
DefaultScreen(XCURSESDISPLAY));
if (index < 0 || index >= MAX_COLORS)
if (index < 0 || index >= PDC_MAXCOL)
_exit_process(4, SIGKILL, "exiting from _set_color");
if (XAllocColor(XCURSESDISPLAY, cmap, tmp))

View File

@@ -64,7 +64,7 @@ void PDC_set_title(const char *title)
int PDC_set_blink(bool blinkon)
{
if (pdc_color_started)
COLORS = MAX_COLORS;
COLORS = PDC_MAXCOL;
XCursesInstruct(blinkon ? CURSES_BLINK_ON : CURSES_BLINK_OFF);

View File

@@ -176,5 +176,3 @@ enum
extern short *xc_atrtab;
extern bool xc_resize_now;
#define MAX_COLORS 768

View File

@@ -33,8 +33,8 @@ XCursesAppData xc_app_data;
# define PDC_SCROLLBAR_TYPE float
#endif
#define COLOR_CURSOR MAX_COLORS /* color of cursor */
#define COLOR_BORDER MAX_COLORS + 1 /* color of border */
#define COLOR_CURSOR PDC_MAXCOL /* color of cursor */
#define COLOR_BORDER PDC_MAXCOL + 1 /* color of border */
#define XCURSESDISPLAY (XtDisplay(drawing))
#define XCURSESWIN (XtWindow(drawing))
@@ -373,7 +373,7 @@ static XtActionsRec action_table[] =
{"string", (XtActionProc)XCursesHandleString}
};
static Pixel colors[MAX_COLORS + 2];
static Pixel colors[PDC_MAXCOL + 2];
static bool vertical_cursor = FALSE;
static XIM Xim = NULL;
@@ -2067,7 +2067,7 @@ static void _get_color(void)
Colormap cmap = DefaultColormap(XCURSESDISPLAY,
DefaultScreen(XCURSESDISPLAY));
if (index < 0 || index >= MAX_COLORS)
if (index < 0 || index >= PDC_MAXCOL)
_exit_process(4, SIGKILL, "exiting from _get_color");
tmp->pixel = colors[index];
@@ -2083,7 +2083,7 @@ static void _set_color(void)
Colormap cmap = DefaultColormap(XCURSESDISPLAY,
DefaultScreen(XCURSESDISPLAY));
if (index < 0 || index >= MAX_COLORS)
if (index < 0 || index >= PDC_MAXCOL)
_exit_process(4, SIGKILL, "exiting from _set_color");
if (XAllocColor(XCURSESDISPLAY, cmap, tmp))