Skip to content

Commit

Permalink
As described in previous commit 099fa28, the PDC_set_box_type() exten…
Browse files Browse the repository at this point in the history
…sion was unnecessary and is removed.
  • Loading branch information
Bill-Gray committed May 8, 2024
1 parent 099fa28 commit eef38df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 50 deletions.
13 changes: 2 additions & 11 deletions curses.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Defined by this header:
#define PDC_VER_MINOR 4
#define PDC_VER_CHANGE 0
#define PDC_VER_YEAR 2024
#define PDC_VER_MONTH 04
#define PDC_VER_DAY 13
#define PDC_VER_MONTH 05
#define PDC_VER_DAY 07

#define PDC_STRINGIZE( x) #x
#define PDC_stringize( x) PDC_STRINGIZE( x)
Expand Down Expand Up @@ -1774,7 +1774,6 @@ PDCEX int PDC_set_blink(bool);
PDCEX int PDC_set_bold(bool);
PDCEX int PDC_set_line_color(short);
PDCEX void PDC_set_title(const char *);
PDCEX int PDC_set_box_type( const int box_type);

PDCEX int PDC_clearclipboard(void);
PDCEX int PDC_freeclipboard(char *);
Expand Down Expand Up @@ -1851,14 +1850,6 @@ PDCEX int wunderscore(WINDOW *);
#define PDC_save_key_modifiers(x) (OK)
#define PDC_get_input_fd() 0

/* masks for PDC_set_box_type() */

#define PDC_BOX_DOUBLED_V 1
#define PDC_BOX_DOUBLED_H 2
#ifdef PDC_WIDE
#define PDC_BOX_THICK 4
#endif

/* return codes from PDC_getclipboard() and PDC_setclipboard() calls */

#define PDC_CLIP_SUCCESS 0
Expand Down
47 changes: 8 additions & 39 deletions pdcurses/border.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ border
int mvvline_set(int y, int x, const cchar_t *wch, int n);
int mvwhline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n);
int mvwvline_set(WINDOW *win, int y, int x, const cchar_t *wch, int n);
int PDC_set_box_type( const int box_type);
### Description
Expand All @@ -57,11 +56,6 @@ border
bl bottom left corner of border ACS_LLCORNER
br bottom right corner of border ACS_LRCORNER
PDC_set_box_type() can reset these defaults to use the double-line
characters. 'box_type' can include the bitflag constants.
PDC_BOX_DOUBLED_V and/or PDC_BOX_DOUBLED_H. The previously set
default box type is returned.
hline() and whline() draw a horizontal line, using ch, starting from
the current cursor position. The cursor position does not change. The
line is at most n characters long, or as many as will fit in the
Expand Down Expand Up @@ -107,8 +101,6 @@ border
**man-end****************************************************************/

static int _box_type = 0;

/* _attr_passthru() -- Takes a single chtype 'ch' and checks if the
current attribute of window 'win', as set by wattrset(), and/or the
current background of win, as set by wbkgd(), should by combined with
Expand Down Expand Up @@ -139,28 +131,13 @@ static chtype _attr_passthru(WINDOW *win, chtype ch)
attr |= win->_bkgd & (A_ATTRIBUTES ^ A_COLOR);

ch = (ch & A_CHARTEXT) | attr;
#ifdef PDC_WIDE
if( _box_type & PDC_BOX_THICK)
ch += WACS_T_HLINE - WACS_HLINE;
#endif
return ch;
}

int PDC_set_box_type( const int box_type)
{
const int rval = _box_type;

_box_type = box_type;
return( rval);
}

int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs,
chtype tl, chtype tr, chtype bl, chtype br)
{
int i, ymax, xmax;
chtype def_val;
const int doubled_v = (_box_type & PDC_BOX_DOUBLED_V);
const int doubled_h = (_box_type & PDC_BOX_DOUBLED_H);

PDC_LOG(("wborder() - called\n"));

Expand All @@ -171,22 +148,14 @@ int wborder(WINDOW *win, chtype ls, chtype rs, chtype ts, chtype bs,
ymax = win->_maxy - 1;
xmax = win->_maxx - 1;

def_val = (doubled_v ? ACS_D_VLINE : ACS_VLINE);
ls = _attr_passthru(win, ls ? ls : def_val);
rs = _attr_passthru(win, rs ? rs : def_val);
def_val = (doubled_h ? ACS_D_HLINE : ACS_HLINE);
ts = _attr_passthru(win, ts ? ts : def_val);
bs = _attr_passthru(win, bs ? bs : def_val);

if( doubled_v)
def_val = doubled_h ? ACS_D_LRCORNER : ACS_DS_LRCORNER;
else
def_val = doubled_h ? ACS_SD_LRCORNER : ACS_LRCORNER;

tl = _attr_passthru(win, tl ? tl : def_val + 2);
tr = _attr_passthru(win, tr ? tr : def_val + 1);
bl = _attr_passthru(win, bl ? bl : def_val + 3);
br = _attr_passthru(win, br ? br : def_val);
ls = _attr_passthru(win, ls ? ls : ACS_VLINE);
rs = _attr_passthru(win, rs ? rs : ACS_VLINE);
ts = _attr_passthru(win, ts ? ts : ACS_HLINE);
bs = _attr_passthru(win, bs ? bs : ACS_HLINE);
tl = _attr_passthru(win, tl ? tl : ACS_ULCORNER);
tr = _attr_passthru(win, tr ? tr : ACS_URCORNER);
bl = _attr_passthru(win, bl ? bl : ACS_LLCORNER);
br = _attr_passthru(win, br ? br : ACS_LRCORNER);

for (i = 1; i < xmax; i++)
{
Expand Down

0 comments on commit eef38df

Please sign in to comment.