Use the current foreground color for the line attributes, unless

PDC_set_line_color() is explicitly called. After setting the line color,
you can reset it to this mode via "PDC_set_line_color(-1)".
This commit is contained in:
William McBrine
2006-11-12 10:26:14 +00:00
parent 8e964c0618
commit dc02f5f4c2
4 changed files with 13 additions and 8 deletions

View File

@@ -15,7 +15,7 @@
#include <stdlib.h>
#include <string.h>
RCSID("$Id: color.c,v 1.69 2006/10/23 05:03:30 wmcbrine Exp $");
RCSID("$Id: color.c,v 1.70 2006/11/12 10:26:14 wmcbrine Exp $");
/*man-start**************************************************************
@@ -65,9 +65,12 @@ RCSID("$Id: color.c,v 1.69 2006/10/23 05:03:30 wmcbrine Exp $");
pair_content() is used to determine what the colors of a given
color-pair consist of.
PDCurses Description:
PDC_set_line_color() is used to set the color, globally, for the
color of the lines drawn for the attributes: A_UNDERLINE,
A_OVERLINE, A_LEFTLINE and A_RIGHTLINE. PDCurses only feature.
A_OVERLINE, A_LEFTLINE and A_RIGHTLINE. A value of -1 (the
default) indicates that the current foreground color should be
used.
NOTE: COLOR_PAIR() and PAIR_NUMBER() are implemented as macros.
@@ -243,7 +246,7 @@ int pair_content(short pair, short *fg, short *bg)
int PDC_set_line_color(short color)
{
if (color < 0 || color >= COLORS)
if (color < -1 || color >= COLORS)
return ERR;
SP->line_color = color;

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <stdlib.h>
RCSID("$Id: initscr.c,v 1.88 2006/11/11 16:36:08 wmcbrine Exp $");
RCSID("$Id: initscr.c,v 1.89 2006/11/12 10:26:14 wmcbrine Exp $");
const char *_curses_notice = "PDCurses 3.0 - Public Domain 2006";
@@ -154,6 +154,7 @@ WINDOW *Xinitscr(int argc, char *argv[])
SP->linesrippedoff = 0;
SP->linesrippedoffontop = 0;
SP->delaytenths = 0;
SP->line_color = -1;
SP->orgcbr = PDC_get_ctrl_break();
SP->orig_cursor = PDC_get_cursor_mode();

View File

@@ -13,7 +13,7 @@
#include "pdcx11.h"
RCSID("$Id: pdcscrn.c,v 1.47 2006/11/11 16:36:08 wmcbrine Exp $");
RCSID("$Id: pdcscrn.c,v 1.48 2006/11/12 10:26:14 wmcbrine Exp $");
/*man-start**************************************************************
@@ -78,7 +78,6 @@ int PDC_scr_open(int argc, char **argv)
SP->sb_total_x = 0;
SP->sb_viewport_x = 0;
SP->sb_cur_x = 0;
SP->line_color = COLOR_WHITE;
return OK;
}

View File

@@ -28,7 +28,7 @@
#include <stdlib.h>
#include <string.h>
RCSID("$Id: x11.c,v 1.30 2006/11/11 20:27:21 wmcbrine Exp $");
RCSID("$Id: x11.c,v 1.31 2006/11/12 10:26:14 wmcbrine Exp $");
#ifndef XPOINTER_TYPEDEFED
typedef char * XPointer;
@@ -783,7 +783,9 @@ static int NewPacket(chtype attr, bool rev, int len, int col, int row,
{
int k;
XSetForeground(XCURSESDISPLAY, gc, colors[SP->line_color]);
if (SP->line_color != -1)
XSetForeground(XCURSESDISPLAY, gc,
colors[SP->line_color]);
if (attr & A_UNDERLINE) /* UNDER */
XDrawLine(XCURSESDISPLAY, XCURSESWIN, gc,