Added curses_version(), after ncurses. Also gave a better description of

resize_term()... I'm counting this as fulfilling the "document resizing"
item in the TODO list, although perhaps more could be said.
This commit is contained in:
William McBrine
2006-12-11 04:24:24 +00:00
parent 04da172154
commit 96a657bafd
3 changed files with 33 additions and 12 deletions

2
TODO
View File

@@ -3,6 +3,4 @@ be completed.
- provide for all outstanding curses functions
- document how resizing works
- document how to use mouse functions that do exist

View File

@@ -11,7 +11,7 @@
* See the file maintain.er for details of the current maintainer. *
************************************************************************/
/* $Id: curses.h,v 1.248 2006/12/07 22:09:42 wmcbrine Exp $ */
/* $Id: curses.h,v 1.249 2006/12/11 04:24:24 wmcbrine Exp $ */
/*----------------------------------------------------------------------*
* PDCurses *
@@ -1438,6 +1438,7 @@ unsigned long getbmap(void);
/* NCurses */
const char *curses_version(void);
bool has_key(int);
int wresize(WINDOW *, int, int);
@@ -1475,8 +1476,8 @@ int PDC_setclipboard(const char *, long);
unsigned long PDC_get_input_fd(void);
unsigned long PDC_get_key_modifiers(void);
int PDC_save_key_modifiers(bool);
int PDC_return_key_modifiers(bool);
int PDC_save_key_modifiers(bool);
int PDC_return_key_modifiers(bool);
/*** Functions defined as macros ***/

View File

@@ -14,7 +14,7 @@
#include <curspriv.h>
#include <stdlib.h>
RCSID("$Id: initscr.c,v 1.92 2006/12/07 21:29:30 wmcbrine Exp $");
RCSID("$Id: initscr.c,v 1.93 2006/12/11 04:24:24 wmcbrine Exp $");
const char *_curses_notice = "PDCurses 3.0 - Public Domain 2006";
@@ -60,6 +60,7 @@ extern char linesrippedoff;
int resize_term(int nlines, int ncols);
bool is_termresized(void);
const char *curses_version(void);
X/Open Description:
The first curses routine called should be initscr(). This will
@@ -83,7 +84,7 @@ extern char linesrippedoff;
A program which outputs to more than one terminal should use
newterm() for each terminal instead of initscr(). The newterm()
function should be called once for each terminal. It returns a
value of type SCREEN* which should be saved as a reference to
value of type SCREEN * which should be saved as a reference to
that terminal. The arguments are the type of terminal to be
used in place of TERM (environment variable), a file pointer for
output to the terminal and another file pointer for input from
@@ -97,12 +98,27 @@ extern char linesrippedoff;
other routines affect only the current terminal.
PDCurses Description:
The resize_term() function is used to have PDCurses change its
internal structures to the new, specified size.
resize_term() is effectively two functions: When called with
nonzero values for nlines and ncols, it attempts to resize the
screen to the given size. When called with (0, 0), it merely
adjusts the internal structures to match the current size after
the screen is resized by the user. On the currently supported
platforms, this functionality is mutually exclusive: X11 allows
user resizing, while DOS, OS/2 and Win32 allow programmatic
resizing. If you want to support user resizing, you should check
for getch() returning KEY_RESIZE, and/or call is_termresized()
at appropriate times; if either condition occurs, call
resize_term(0, 0). Then, with either user or programmatic
resizing, you'll have to resize any windows you've created, as
appropriate; resize_term() only handles stdscr and curscr.
The is_termresized() function returns TRUE if the Curses screen
has been resized by external means, and requires a call to
resize_term().
is_termresized() returns TRUE if the curses screen has been
resized by the user, and a call to resize_term() is needed.
Checking for KEY_RESIZE is generally preferable, unless you're
not handling the keyboard.
curses_version() returns a string describing the version of
PDCurses.
PDCurses supports only one terminal via newterm() or set_term(),
and the parameters are ignored.
@@ -120,6 +136,7 @@ extern char linesrippedoff;
delscreen Y - 4.0
resize_term - - -
is_termresized - - -
curses_version - - -
**man-end****************************************************************/
@@ -339,3 +356,8 @@ bool is_termresized(void)
return SP->resized;
}
const char *curses_version(void)
{
return _curses_notice;
}