-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.2355 2015/02/28 21:51:14 tom Exp $
+-- $Id: NEWS,v 1.2357 2015/03/07 23:38:25 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20150307
+ + document limitations of getwin in manual page (prompted by discussion
+ with John S Urban).
+ + extend test/savescreen.c to demonstrate that color pair values
+ and graphic characters can be restored using getwin.
+
20150228
+ modify win_driver.c to eliminate the constructor, to make it more
usable in an application which may/may not need the console window
-5:0:9 5.9 20150228
+5:0:9 5.9 20150307
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.1036 2015/02/28 17:36:40 tom Exp $
+# $Id: dist.mk,v 1.1037 2015/03/07 16:12:58 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 9
-NCURSES_PATCH = 20150228
+NCURSES_PATCH = 20150307
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
'\" t
.\"***************************************************************************
-.\" Copyright (c) 1998-2012,2013 Free Software Foundation, Inc. *
+.\" Copyright (c) 1998-2013,2015 Free Software Foundation, Inc. *
.\" *
.\" Permission is hereby granted, free of charge, to any person obtaining a *
.\" copy of this software and associated documentation files (the *
.\" authorization. *
.\"***************************************************************************
.\"
-.\" $Id: curs_util.3x,v 1.37 2013/07/20 19:43:45 tom Exp $
+.\" $Id: curs_util.3x,v 1.38 2015/03/07 23:33:38 tom Exp $
.TH curs_util 3X ""
.ie \n(.g .ds `` \(lq
.el .ds `` ``
the latter returns null where the former would display a meta character.
.PP
The \fBfilter\fR routine, if used, must be called before \fBinitscr\fR or
-\fBnewterm\fR are called. The effect is that, during those calls, \fBLINES\fR
+\fBnewterm\fR are called.
+The effect is that, during those calls, \fBLINES\fR
is set to 1; the capabilities \fBclear\fR, \fBcup\fR, \fBcud\fR, \fBcud1\fR,
\fBcuu1\fR, \fBcuu\fR, \fBvpa\fR are disabled; and the \fBhome\fR string is
set to the value of \fBcr\fR.
T}
.TE
.PP
-The \fBputwin\fR routine writes all data associated with window \fIwin\fR into
-the file to which \fIfilep\fR points. This information can be later retrieved
+The \fBputwin\fR routine writes all data associated
+with window (or pad) \fIwin\fR into
+the file to which \fIfilep\fR points.
+This information can be later retrieved
using the \fBgetwin\fR function.
.PP
The \fBgetwin\fR routine reads window related data stored in the file by
-\fBputwin\fR. The routine then creates and initializes a new window using that
-data. It returns a pointer to the new window.
+\fBputwin\fR.
+The routine then creates and initializes a new window using that
+data.
+It returns a pointer to the new window.
+There are a few caveats:
+.bP
+the data written is a copy of the \fBWINDOW\fP structure,
+and its associated character cells.
+The format differs between the wide-character (ncursesw) and
+non-wide (ncurses) libraries.
+.bP
+the retrieved window is always created as a top-level window (or pad),
+rather than a subwindow.
+.bP
+the window's character cells contain the color pair \fIvalue\fP,
+but not the actual color \fInumbers\fP.
+If cells in the retrieved window use color pairs which have not been
+created in the application using \fBinit_pair\fP,
+they will not be colored when the window is refreshed.
.PP
The \fBdelay_output\fR routine inserts an \fIms\fR millisecond pause
-in output. This routine should not be used extensively because
+in output.
+This routine should not be used extensively because
padding characters are used rather than a CPU pause.
If no padding character is specified,
this uses \fBnapms\fR to perform the delay.
.RE
.PP
The SVr4 documentation describes the action of \fBfilter\fR only in the vaguest
-terms. The description here is adapted from the XSI Curses standard (which
+terms.
+The description here is adapted from the XSI Curses standard (which
erroneously fails to describe the disabling of \fBcuu\fR).
.PP
The strings returned by \fBunctrl\fR in this implementation are determined
it determines whether to use the `M\-' prefix
for \*(``meta\*('' keys (codes in the range 128 to 255).
Both \fBuse_legacy_coding\fP and \fBmeta\fP succeed only after
-curses is initialized.
+curses is initialized.
X/Open Curses does not document the treatment of codes 128 to 159.
When treating them as \*(``meta\*('' keys
(or if \fBkeyname\fP is called before initializing curses),
The \fBkeyname\fP function may return the names of user-defined
string capabilities which are defined in the terminfo entry via the \fB\-x\fP
option of \fB@TIC@\fP.
-This implementation automatically assigns at run-time keycodes to
+This implementation automatically assigns at run-time keycodes to
user-defined strings which begin with "k".
-The keycodes start at KEY_MAX, but are not guaranteed to be
+The keycodes start at KEY_MAX, but are not guaranteed to be
the same value for different runs because user-defined codes are
merged from all terminal descriptions which have been loaded.
The \fBuse_extended_names\fP function controls whether this data is
-ncurses6 (5.9+20150228) unstable; urgency=low
+ncurses6 (5.9+20150307) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 28 Feb 2015 12:36:40 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 07 Mar 2015 11:12:58 -0500
ncurses6 (5.9-20131005) unstable; urgency=low
-ncurses6 (5.9+20150228) unstable; urgency=low
+ncurses6 (5.9+20150307) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 28 Feb 2015 12:36:40 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 07 Mar 2015 11:12:58 -0500
ncurses6 (5.9-20131005) unstable; urgency=low
-ncurses6 (5.9+20150228) unstable; urgency=low
+ncurses6 (5.9+20150307) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 28 Feb 2015 12:36:40 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 07 Mar 2015 11:12:58 -0500
ncurses6 (5.9-20120608) unstable; urgency=low
-; $Id: mingw-ncurses.nsi,v 1.89 2015/02/28 17:36:40 tom Exp $\r
+; $Id: mingw-ncurses.nsi,v 1.90 2015/03/07 16:12:58 tom Exp $\r
\r
; TODO add examples\r
; TODO bump ABI to 6\r
!define VERSION_MAJOR "5"\r
!define VERSION_MINOR "9"\r
!define VERSION_YYYY "2015"\r
-!define VERSION_MMDD "0228"\r
+!define VERSION_MMDD "0307"\r
!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}\r
\r
!define MY_ABI "5"\r
Summary: shared libraries for terminal handling
Name: mingw32-ncurses6
Version: 5.9
-Release: 20150228
+Release: 20150307
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
Summary: shared libraries for terminal handling
Name: ncurses6
Version: 5.9
-Release: 20150228
+Release: 20150307
License: X11
Group: Development/Libraries
Source: ncurses-%{version}-%{release}.tgz
/****************************************************************************
- * Copyright (c) 2007-2010,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2011,2015 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
* authorization. *
****************************************************************************/
/*
- * $Id: savescreen.c,v 1.15 2011/01/15 18:15:11 tom Exp $
+ * $Id: savescreen.c,v 1.21 2015/03/07 21:55:35 tom Exp $
*
* Demonstrate save/restore functions from the curses library.
* Thomas Dickey - 2007/7/14
static void
show_what(int which, int last)
{
- int y, x;
- time_t now = time((time_t *) 0);
+ int y, x, n;
+ time_t now;
+ char *mytime;
getyx(stdscr, y, x);
move(0, 0);
- printw("Saved %d of %d - %s", which, last + 1, ctime(&now));
+ printw("Saved %d of %d (? for help)", which, last + 1);
+
+ now = time((time_t *) 0);
+ mytime = ctime(&now);
+ for (n = (int) strlen(mytime) - 1; n >= 0; --n) {
+ if (isspace(UChar(mytime[n]))) {
+ mytime[n] = '\0';
+ } else {
+ break;
+ }
+ }
+ mvprintw(0, (COLS - n - 2), " %s", mytime);
move(y, x);
{
int ch;
- timeout(100);
+ timeout(50);
do {
show_what(which, last);
return ch;
}
+static void
+show_help(const char **help)
+{
+ WINDOW *mywin = newwin(LINES, COLS, 0, 0);
+ int n;
+
+ box(mywin, 0, 0);
+ wmove(mywin, 1, 1);
+ for (n = 0; help[n] != 0; ++n) {
+ wmove(mywin, 1 + n, 2);
+ wprintw(mywin, "%.*s", COLS - 4, help[n]);
+ }
+ wgetch(mywin);
+ delwin(mywin);
+ touchwin(stdscr);
+ refresh();
+}
+
+static void
+editor_help(void)
+{
+ static const char *msgs[] =
+ {
+ "You are now in the screen-editor, which allows you to make some",
+ "lines on the screen, as well as save copies of the screen to a",
+ "temporary file",
+ "",
+ "Keys:",
+ " q quit",
+ " n run the screen-loader to show the saved screens",
+ " <space> dump a screen",
+ "",
+ " a toggle between '#' and graphic symbol for drawing",
+ " c change color drawn by line to next in palette",
+ " h,j,k,l or arrows to move around the screen, drawing",
+ };
+ show_help(msgs);
+}
+
+static void
+replay_help(void)
+{
+ static const char *msgs[] =
+ {
+ "You are now in the screen-loader, which allows you to view",
+ "the dumped/restored screens.",
+ "",
+ "Keys:",
+ " q quit",
+ " <space> load the next screen",
+ " <backspace> load the previous screen",
+ };
+ show_help(msgs);
+}
+
static void
usage(void)
{
keypad(stdscr, TRUE);
curs_set(0);
if (has_colors()) {
+ short pair;
+ short color;
+
start_color();
- for (ch = 0; ch < COLOR_PAIRS; ++ch) {
- short pair = (short) (ch % COLOR_PAIRS);
- init_pair(pair, COLOR_WHITE, (short) (ch % COLORS));
+ /*
+ * Assume pairs is the square of colors, and assign pairs going down
+ * so that there is minimal conflict with the background color (which
+ * counts up). The intent is just to show how color pair values are
+ * saved and restored.
+ */
+ for (pair = 0; pair < COLOR_PAIRS; ++pair) {
+ color = (short) (pair % (COLORS - 1));
+ init_pair(pair, COLOR_WHITE - color, color);
}
}
done = TRUE;
break;
case 'q':
- endwin();
cleanup(files);
done = TRUE;
break;
if (++which > last)
which = 0;
break;
+ case '?':
+ replay_help();
+ break;
default:
beep();
continue;
wrefresh(curscr);
}
}
+ endwin();
} else {
- int y;
- int x;
-
- move(2, 0);
- printw("Use h,j,k,l or arrows to move around the screen\n");
- printw("Press 'q' to quit, ' ' to dump a screen\n");
- printw("When the last screen has been dumped, press 'n' to run the\n");
- printw("screen-loader. That allows only 'q', backspace and ' ' for\n");
- printw("stepping through the dumped/restored screens.\n");
- getyx(stdscr, y, x);
+ int y = 0;
+ int x = 0;
+ int color = 0;
+ int altchars = 0;
while (!done) {
switch (get_command(which, last)) {
done = TRUE;
break;
case 'q':
- endwin();
cleanup(files);
done = TRUE;
break;
}
++which;
if (has_colors()) {
+ int cx, cy;
short pair = (short) (which % COLOR_PAIRS);
+ /*
+ * Change the background color, to make it more
+ * obvious. But that changes the existing text-color.
+ * Copy the old values from the currently displayed
+ * screen.
+ */
bkgd((chtype) COLOR_PAIR(pair));
+ for (cy = 1; cy < LINES; ++cy) {
+ for (cx = 0; cx < COLS; ++cx) {
+ wmove(curscr, cy, cx);
+ wmove(stdscr, cy, cx);
+ waddch(stdscr, winch(curscr));
+ }
+ }
}
} else {
beep();
if (++x >= COLS)
x = 0;
break;
+ case 'a':
+ altchars = !altchars;
+ break;
+ case 'c':
+ color = (color + 1) % COLORS;
+ break;
+ case '?':
+ editor_help();
+ break;
+ default:
+ beep();
+ continue;
}
if (!done) {
- time_t now = time((time_t *) 0);
-
- move(0, 0);
- addstr(ctime(&now));
+ attr_t attr = (A_REVERSE | COLOR_PAIR(color * COLORS));
+ chtype ch2 = (altchars ? ACS_DIAMOND : '#');
move(y, x);
- addch('#' | A_REVERSE);
+ addch(ch2 | attr);
move(y, x);
}
}
+ endwin();
}
ExitProgram(EXIT_SUCCESS);
}
+
#else
int
main(int argc, char *argv[])