mirror of
https://github.com/VARCem/PDCurses.git
synced 2026-09-24 15:55:14 +00:00
Changed the function pointer PDC_initial_slk etc. to a straight call to
PDC_slk_initialize(). To Do: It seems likely that the function pointer was an attempt to avoid linking the slk module unless needed, but any such intent was defeated because PDC_initial_slk was always defined within the slk module. However, the goal still might be worth pursuing... it's a tradeoff between the size of the linked code, and legibility.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
* See the file maintain.er for details of the current maintainer. *
|
||||
************************************************************************/
|
||||
|
||||
/* $Id: curspriv.h,v 1.131 2006/10/31 14:37:58 wmcbrine Exp $ */
|
||||
/* $Id: curspriv.h,v 1.132 2006/11/01 16:12:35 wmcbrine Exp $ */
|
||||
|
||||
/* CURSPRIV.H
|
||||
|
||||
@@ -94,6 +94,7 @@ int PDC_scr_open(int, char **);
|
||||
int PDC_set_ctrl_break(bool);
|
||||
void PDC_set_keyboard_binary(bool);
|
||||
void PDC_slk_free(void);
|
||||
void PDC_slk_initialize(void);
|
||||
void PDC_sync(WINDOW *);
|
||||
void PDC_transform_line(int, int, int, const chtype *);
|
||||
const char *PDC_sysname(void);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <curspriv.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
RCSID("$Id: initscr.c,v 1.84 2006/10/31 14:37:58 wmcbrine Exp $");
|
||||
RCSID("$Id: initscr.c,v 1.85 2006/11/01 16:12:35 wmcbrine Exp $");
|
||||
|
||||
const char *_curses_notice = "PDCurses 3.0 - Public Domain 2006";
|
||||
|
||||
@@ -45,8 +45,6 @@ cchar_t pdc_wacs[] = {
|
||||
extern RIPPEDOFFLINE linesripped[5];
|
||||
extern char linesrippedoff;
|
||||
|
||||
extern void (*PDC_initial_slk)(void);
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
Name: initscr
|
||||
@@ -176,11 +174,8 @@ WINDOW *Xinitscr(int argc, char *argv[])
|
||||
exit(2);
|
||||
}
|
||||
|
||||
if (PDC_initial_slk)
|
||||
{
|
||||
(*PDC_initial_slk)();
|
||||
LINES -= SP->slklines;
|
||||
}
|
||||
PDC_slk_initialize();
|
||||
LINES -= SP->slklines;
|
||||
|
||||
/* We have to sort out ripped off lines here, and reduce the
|
||||
height of stdscr by the number of lines ripped off */
|
||||
@@ -332,7 +327,7 @@ int resize_term(int nlines, int ncols)
|
||||
|
||||
wmove(SP->slk_winptr, 0, 0);
|
||||
wclrtobot(SP->slk_winptr);
|
||||
(*PDC_initial_slk)();
|
||||
PDC_slk_initialize();
|
||||
slk_noutrefresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <curspriv.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
RCSID("$Id: slk.c,v 1.43 2006/10/31 15:33:30 wmcbrine Exp $");
|
||||
RCSID("$Id: slk.c,v 1.44 2006/11/01 16:12:35 wmcbrine Exp $");
|
||||
|
||||
/*man-start**************************************************************
|
||||
|
||||
@@ -41,6 +41,7 @@ RCSID("$Id: slk.c,v 1.43 2006/10/31 15:33:30 wmcbrine Exp $");
|
||||
|
||||
int PDC_mouse_in_slk(int y, int x);
|
||||
void PDC_slk_free(void);
|
||||
void PDC_slk_initialize(void);
|
||||
|
||||
X/Open Description:
|
||||
These functions manipulate a window that contain Soft Label Keys
|
||||
@@ -89,6 +90,7 @@ RCSID("$Id: slk.c,v 1.43 2006/10/31 15:33:30 wmcbrine Exp $");
|
||||
slk_wset Y
|
||||
PDC_mouse_in_slk - - -
|
||||
PDC_slk_free - - -
|
||||
PDC_slk_initialize - - -
|
||||
|
||||
**man-end****************************************************************/
|
||||
|
||||
@@ -102,10 +104,6 @@ static int label_fmt = 0;
|
||||
static int label_line = 0;
|
||||
static bool hidden = FALSE;
|
||||
|
||||
void (*PDC_initial_slk)(void);
|
||||
static void _slk_initial(void);
|
||||
static void _slk_calc(void);
|
||||
|
||||
static struct SLK {
|
||||
chtype label[32];
|
||||
int len;
|
||||
@@ -157,7 +155,6 @@ int slk_init(int fmt)
|
||||
return ERR;
|
||||
}
|
||||
|
||||
PDC_initial_slk = _slk_initial;
|
||||
label_fmt = fmt;
|
||||
|
||||
slk = calloc(labels, sizeof(struct SLK));
|
||||
@@ -386,49 +383,6 @@ int slk_attr_set(const attr_t attrs, short color_pair, void *opts)
|
||||
return slk_attrset(attrs | COLOR_PAIR(color_pair));
|
||||
}
|
||||
|
||||
static void _slk_initial(void)
|
||||
{
|
||||
int i;
|
||||
chtype save_attr;
|
||||
|
||||
if (label_fmt == 3)
|
||||
{
|
||||
SP->slklines = 2;
|
||||
label_line = 1;
|
||||
}
|
||||
else
|
||||
SP->slklines = 1;
|
||||
|
||||
if (!SP->slk_winptr)
|
||||
{
|
||||
if ((SP->slk_winptr = newwin(SP->slklines, COLS,
|
||||
LINES-SP->slklines, 0)) == (WINDOW *)0)
|
||||
return;
|
||||
|
||||
wattrset(SP->slk_winptr, A_REVERSE);
|
||||
}
|
||||
|
||||
_slk_calc();
|
||||
|
||||
/* if we have an index line, display it now */
|
||||
|
||||
if (label_fmt == 3)
|
||||
{
|
||||
save_attr = SP->slk_winptr->_attrs;
|
||||
wattrset(SP->slk_winptr, A_NORMAL);
|
||||
wmove(SP->slk_winptr, 0, 0);
|
||||
whline(SP->slk_winptr, 0, COLS);
|
||||
|
||||
for (i = 0; i < labels; i++)
|
||||
mvwprintw(SP->slk_winptr, 0, slk[i].start_col,
|
||||
"F%d", i + 1);
|
||||
|
||||
SP->slk_winptr->_attrs = save_attr;
|
||||
}
|
||||
|
||||
touchwin(SP->slk_winptr);
|
||||
}
|
||||
|
||||
static void _slk_calc(void)
|
||||
{
|
||||
int i, center, col = 0;
|
||||
@@ -517,6 +471,52 @@ static void _slk_calc(void)
|
||||
_redraw();
|
||||
}
|
||||
|
||||
void PDC_slk_initialize(void)
|
||||
{
|
||||
if (slk)
|
||||
{
|
||||
if (label_fmt == 3)
|
||||
{
|
||||
SP->slklines = 2;
|
||||
label_line = 1;
|
||||
}
|
||||
else
|
||||
SP->slklines = 1;
|
||||
|
||||
if (!SP->slk_winptr)
|
||||
{
|
||||
if ((SP->slk_winptr = newwin(SP->slklines, COLS,
|
||||
LINES - SP->slklines, 0)) == (WINDOW *)0)
|
||||
return;
|
||||
|
||||
wattrset(SP->slk_winptr, A_REVERSE);
|
||||
}
|
||||
|
||||
_slk_calc();
|
||||
|
||||
/* if we have an index line, display it now */
|
||||
|
||||
if (label_fmt == 3)
|
||||
{
|
||||
chtype save_attr;
|
||||
int i;
|
||||
|
||||
save_attr = SP->slk_winptr->_attrs;
|
||||
wattrset(SP->slk_winptr, A_NORMAL);
|
||||
wmove(SP->slk_winptr, 0, 0);
|
||||
whline(SP->slk_winptr, 0, COLS);
|
||||
|
||||
for (i = 0; i < labels; i++)
|
||||
mvwprintw(SP->slk_winptr, 0,
|
||||
slk[i].start_col, "F%d", i + 1);
|
||||
|
||||
SP->slk_winptr->_attrs = save_attr;
|
||||
}
|
||||
|
||||
touchwin(SP->slk_winptr);
|
||||
}
|
||||
}
|
||||
|
||||
void PDC_slk_free(void)
|
||||
{
|
||||
if (slk)
|
||||
|
||||
Reference in New Issue
Block a user