summaryrefslogtreecommitdiffstats
path: root/contrib/ncurses/panel
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2000-07-03 09:24:12 +0000
committerpeter <peter@FreeBSD.org>2000-07-03 09:24:12 +0000
commitcc6a5cc05f3c2cde24338d35c9714f1e7ebf032e (patch)
tree27e79485df3c9195e6fe58960df47f675f41f1e9 /contrib/ncurses/panel
parentb22d00e9129b5cb2fee8da1592ca70eff2222f7e (diff)
downloadFreeBSD-src-cc6a5cc05f3c2cde24338d35c9714f1e7ebf032e.zip
FreeBSD-src-cc6a5cc05f3c2cde24338d35c9714f1e7ebf032e.tar.gz
Import the most recent ncurses 5.1 prerelease (20000701).
Mostly this is intended to resolve the trace() badness once and for all. Obtained from: ftp://dickey.his.com/ncurses/
Diffstat (limited to 'contrib/ncurses/panel')
-rw-r--r--contrib/ncurses/panel/Makefile.in11
-rw-r--r--contrib/ncurses/panel/llib-lpanel24
-rw-r--r--contrib/ncurses/panel/p_bottom.c63
-rw-r--r--contrib/ncurses/panel/p_delete.c11
-rw-r--r--contrib/ncurses/panel/p_hidden.c4
-rw-r--r--contrib/ncurses/panel/p_hide.c55
-rw-r--r--contrib/ncurses/panel/p_move.c14
-rw-r--r--contrib/ncurses/panel/p_new.c21
-rw-r--r--contrib/ncurses/panel/p_replace.c9
-rw-r--r--contrib/ncurses/panel/p_show.c40
-rw-r--r--contrib/ncurses/panel/p_update.c7
-rw-r--r--contrib/ncurses/panel/panel.priv.h93
12 files changed, 174 insertions, 178 deletions
diff --git a/contrib/ncurses/panel/Makefile.in b/contrib/ncurses/panel/Makefile.in
index 3110f83..e5f528d 100644
--- a/contrib/ncurses/panel/Makefile.in
+++ b/contrib/ncurses/panel/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.28 1998/11/29 01:03:31 Rick.Ohnemus Exp $
+# $Id: Makefile.in,v 1.31 2000/05/28 01:40:32 tom Exp $
##############################################################################
-# Copyright (c) 1998 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2000 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 "Software"), #
@@ -67,6 +67,7 @@ LD = @LD@
LN_S = @LN_S@
CC = @CC@
+CPP = @CPP@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@ \
@@ -85,7 +86,7 @@ LINK = $(CC)
LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@
SHLIB_DIRS = -L../lib -L$(libdir)
-SHLIB_LIST = $(SHLIB_DIRS) -lncurses @SHLIB_LIST@
+SHLIB_LIST = $(SHLIB_DIRS) -lncurses@LIB_SUFFIX@ @SHLIB_LIST@
MK_SHARED_LIB = @MK_SHARED_LIB@
@@ -104,7 +105,9 @@ AUTO_SRC = \
../include/panel.h
################################################################################
-all install :: $(AUTO_SRC) $(LIBRARIES)
+all \
+libs \
+install :: $(AUTO_SRC) $(LIBRARIES)
sources: $(AUTO_SRC)
diff --git a/contrib/ncurses/panel/llib-lpanel b/contrib/ncurses/panel/llib-lpanel
index ab75ffe..2ca1a3e 100644
--- a/contrib/ncurses/panel/llib-lpanel
+++ b/contrib/ncurses/panel/llib-lpanel
@@ -35,30 +35,6 @@
#include "panel.priv.h"
-#undef _nc_free_obscure
-void _nc_free_obscure(
- PANEL *pan)
- { /* void */ }
-
-#undef _nc_override
-void _nc_override(
- const PANEL *pan,
- int show)
- { /* void */ }
-
-#undef _nc_calculate_obscure
-void _nc_calculate_obscure(void)
- { /* void */ }
-
-#undef _nc_panel_is_linked
-bool _nc_panel_is_linked(
- const PANEL *pan)
- { return(*(bool *)0); }
-
-#undef _nc_panel_link_bottom
-void _nc_panel_link_bottom(
- PANEL *pan)
- { /* void */ }
/* ./p_above.c */
diff --git a/contrib/ncurses/panel/p_bottom.c b/contrib/ncurses/panel/p_bottom.c
index 4e6e11d..f671864 100644
--- a/contrib/ncurses/panel/p_bottom.c
+++ b/contrib/ncurses/panel/p_bottom.c
@@ -36,44 +36,35 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_bottom.c,v 1.5 1999/09/29 15:22:32 juergen Exp $")
-
-/*+-------------------------------------------------------------------------
- __panel_link_bottom(pan) - link panel into stack at bottom
---------------------------------------------------------------------------*/
-static void
-panel_link_bottom(PANEL *pan)
-{
-#ifdef TRACE
- dStack("<lb%d>",1,pan);
- if(_nc_panel_is_linked(pan))
- return;
-#endif
-
- pan->above = (PANEL *)0;
- pan->below = (PANEL *)0;
-
- assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
-
- pan->below = _nc_bottom_panel;
- pan->above = _nc_bottom_panel->above;
- if (pan->above)
- pan->above->below = pan;
- _nc_bottom_panel->above = pan;
-
- dStack("<lb%d>",9,pan);
-}
+MODULE_ID("$Id: p_bottom.c,v 1.7 1999/11/25 13:49:26 juergen Exp $")
int
bottom_panel(PANEL *pan)
{
- if(!pan)
- return(ERR);
- if(Is_Bottom(pan))
- return(OK);
- dBug(("--> bottom_panel %s", USER_PTR(pan->user)));
- if(_nc_panel_is_linked(pan))
- (void)hide_panel(pan);
- panel_link_bottom(pan);
- return(OK);
+ int err = OK;
+
+ if (pan) {
+
+ if(!Is_Bottom(pan)) {
+
+ dBug(("--> bottom_panel %s", USER_PTR(pan->user)));
+
+ HIDE_PANEL(pan,err,FALSE);
+ assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
+
+ dStack("<lb%d>",1,pan);
+
+ pan->below = _nc_bottom_panel;
+ pan->above = _nc_bottom_panel->above;
+ if (pan->above)
+ pan->above->below = pan;
+ _nc_bottom_panel->above = pan;
+
+ dStack("<lb%d>",9,pan);
+ }
+ }
+ else
+ err = ERR;
+
+ return(err);
}
diff --git a/contrib/ncurses/panel/p_delete.c b/contrib/ncurses/panel/p_delete.c
index aabccdc..3f975d3 100644
--- a/contrib/ncurses/panel/p_delete.c
+++ b/contrib/ncurses/panel/p_delete.c
@@ -36,18 +36,19 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_delete.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_delete.c,v 1.4 1999/11/25 13:49:26 juergen Exp $")
int
del_panel(PANEL *pan)
{
+ int err = OK;
if(pan)
{
dBug(("--> del_panel %s", USER_PTR(pan->user)));
- if(_nc_panel_is_linked(pan))
- (void)hide_panel(pan);
+ HIDE_PANEL(pan,err,FALSE);
free((void *)pan);
- return(OK);
}
- return(ERR);
+ else
+ err = ERR;
+ return(err);
}
diff --git a/contrib/ncurses/panel/p_hidden.c b/contrib/ncurses/panel/p_hidden.c
index fa05e6a..7a13ec4 100644
--- a/contrib/ncurses/panel/p_hidden.c
+++ b/contrib/ncurses/panel/p_hidden.c
@@ -36,12 +36,12 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_hidden.c,v 1.3 1999/09/18 11:04:19 juergen Exp $")
+MODULE_ID("$Id: p_hidden.c,v 1.4 1999/11/22 18:02:41 juergen Exp $")
int
panel_hidden(const PANEL *pan)
{
if(!pan)
return(ERR);
- return(_nc_panel_is_linked(pan) ? FALSE : TRUE);
+ return(IS_LINKED(pan) ? FALSE : TRUE);
}
diff --git a/contrib/ncurses/panel/p_hide.c b/contrib/ncurses/panel/p_hide.c
index d614295..ecc9eed 100644
--- a/contrib/ncurses/panel/p_hide.c
+++ b/contrib/ncurses/panel/p_hide.c
@@ -36,61 +36,22 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_hide.c,v 1.3 1999/09/29 15:22:32 juergen Exp $")
-
-/*+-------------------------------------------------------------------------
- __panel_unlink(pan) - unlink panel from stack
---------------------------------------------------------------------------*/
-static void
-__panel_unlink(PANEL *pan)
-{
- PANEL *prev;
- PANEL *next;
-
-#ifdef TRACE
- dStack("<u%d>",1,pan);
- if(!_nc_panel_is_linked(pan))
- return;
-#endif
-
- PANEL_UPDATE(pan,(PANEL*)0);
-
- prev = pan->below;
- next = pan->above;
-
- if(prev)
- { /* if non-zero, we will not update the list head */
- prev->above = next;
- if(next)
- next->below = prev;
- }
- else if(next)
- next->below = prev;
- if(pan == _nc_bottom_panel)
- _nc_bottom_panel = next;
- if(pan == _nc_top_panel)
- _nc_top_panel = prev;
-
- pan->above = (PANEL *)0;
- pan->below = (PANEL *)0;
- dStack("<u%d>",9,pan);
-}
+MODULE_ID("$Id: p_hide.c,v 1.5 1999/11/25 13:49:26 juergen Exp $")
int
hide_panel(register PANEL *pan)
{
+ int err = OK;
+
if(!pan)
return(ERR);
dBug(("--> hide_panel %s", USER_PTR(pan->user)));
+ dStack("<u%d>",1,pan);
+
+ HIDE_PANEL(pan,err,TRUE);
- if(!_nc_panel_is_linked(pan))
- {
- pan->above = (PANEL *)0;
- pan->below = (PANEL *)0;
- return(ERR);
- }
+ dStack("<u%d>",9,pan);
- __panel_unlink(pan);
- return(OK);
+ return(err);
}
diff --git a/contrib/ncurses/panel/p_move.c b/contrib/ncurses/panel/p_move.c
index 3bc6328..d34b4fb 100644
--- a/contrib/ncurses/panel/p_move.c
+++ b/contrib/ncurses/panel/p_move.c
@@ -36,19 +36,19 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_move.c,v 1.3 1999/09/29 15:22:32 juergen Exp $")
+MODULE_ID("$Id: p_move.c,v 1.5 1999/11/25 13:49:26 juergen Exp $")
int
move_panel(PANEL *pan, int starty, int startx)
{
- WINDOW *win;
-
if(!pan)
return(ERR);
- if(_nc_panel_is_linked(pan))
- PANEL_UPDATE(pan,(PANEL*)0);
- win = pan->win;
- if(mvwin(win,starty,startx))
+
+ if (IS_LINKED(pan))
+ PANEL_UPDATE(pan,(PANEL*)0, TRUE);
+
+ if (mvwin(pan->win,starty,startx))
return(ERR);
+
return(OK);
}
diff --git a/contrib/ncurses/panel/p_new.c b/contrib/ncurses/panel/p_new.c
index f2f208d..43542fe 100644
--- a/contrib/ncurses/panel/p_new.c
+++ b/contrib/ncurses/panel/p_new.c
@@ -36,7 +36,12 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_new.c,v 1.4 1999/09/29 15:22:32 juergen Exp $")
+MODULE_ID("$Id: p_new.c,v 1.5 1999/11/22 18:02:41 juergen Exp $")
+
+#ifdef TRACE
+static char* stdscr_id;
+static char* new_id;
+#endif
/*+-------------------------------------------------------------------------
Get root (i.e. stdscr's) panel.
@@ -57,7 +62,9 @@ root_panel(void)
pan->below = (PANEL*)0;
pan->above = (PANEL*)0;
#ifdef TRACE
- pan->user = "stdscr";
+ if (!stdscr_id)
+ stdscr_id = strdup("stdscr");
+ pan->user = stdscr_id;
#else
pan->user = (void*)0;
#endif
@@ -72,7 +79,11 @@ new_panel(WINDOW *win)
{
PANEL *pan = (PANEL*)0;
- (void)root_panel();
+ if (!win)
+ return(pan);
+
+ if (!_nc_stdscr_pseudo_panel)
+ (void)root_panel();
assert(_nc_stdscr_pseudo_panel);
if (!(win->_flags & _ISPAD) && (pan = (PANEL*)malloc(sizeof(PANEL))))
@@ -81,7 +92,9 @@ new_panel(WINDOW *win)
pan->above = (PANEL *)0;
pan->below = (PANEL *)0;
#ifdef TRACE
- pan->user = "new";
+ if (!new_id)
+ new_id = strdup("new");
+ pan->user = new_id;
#else
pan->user = (char *)0;
#endif
diff --git a/contrib/ncurses/panel/p_replace.c b/contrib/ncurses/panel/p_replace.c
index 3c4aca1..b7d5174 100644
--- a/contrib/ncurses/panel/p_replace.c
+++ b/contrib/ncurses/panel/p_replace.c
@@ -36,15 +36,18 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_replace.c,v 1.3 1999/09/29 15:22:32 juergen Exp $")
+MODULE_ID("$Id: p_replace.c,v 1.5 1999/11/25 13:49:26 juergen Exp $")
int
replace_panel(PANEL *pan, WINDOW *win)
{
if(!pan)
return(ERR);
- if(_nc_panel_is_linked(pan))
- PANEL_UPDATE(pan,(PANEL*)0);
+
+ if (IS_LINKED(pan))
+ PANEL_UPDATE(pan,(PANEL*)0, TRUE);
+
pan->win = win;
+
return(OK);
}
diff --git a/contrib/ncurses/panel/p_show.c b/contrib/ncurses/panel/p_show.c
index d129fd5..4fc7b1d 100644
--- a/contrib/ncurses/panel/p_show.c
+++ b/contrib/ncurses/panel/p_show.c
@@ -36,32 +36,13 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_show.c,v 1.5 1999/09/29 15:22:32 juergen Exp $")
-
-static void
-panel_link_top(PANEL *pan)
-{
-#ifdef TRACE
- dStack("<lt%d>",1,pan);
- if(_nc_panel_is_linked(pan))
- return;
-#endif
-
- assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
-
- pan->above = (PANEL *)0;
- pan->below = (PANEL *)0;
-
- _nc_top_panel->above = pan;
- pan->below = _nc_top_panel;
- _nc_top_panel = pan;
-
- dStack("<lt%d>",9,pan);
-}
+MODULE_ID("$Id: p_show.c,v 1.7 1999/11/25 13:49:26 juergen Exp $")
int
show_panel(PANEL *pan)
-{
+{
+ int err = OK;
+
if(!pan)
return(ERR);
@@ -70,10 +51,17 @@ show_panel(PANEL *pan)
dBug(("--> show_panel %s", USER_PTR(pan->user)));
- if(_nc_panel_is_linked(pan))
- (void)hide_panel(pan);
+ HIDE_PANEL(pan,err,FALSE);
+
+ dStack("<lt%d>",1,pan);
+ assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
- panel_link_top(pan);
+ _nc_top_panel->above = pan;
+ pan->below = _nc_top_panel;
+ pan->above = (PANEL *)0;
+ _nc_top_panel = pan;
+
+ dStack("<lt%d>",9,pan);
return(OK);
}
diff --git a/contrib/ncurses/panel/p_update.c b/contrib/ncurses/panel/p_update.c
index 692a3f3..983d0b6 100644
--- a/contrib/ncurses/panel/p_update.c
+++ b/contrib/ncurses/panel/p_update.c
@@ -36,7 +36,7 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_update.c,v 1.3 1999/09/29 15:22:32 juergen Exp $")
+MODULE_ID("$Id: p_update.c,v 1.5 1999/11/25 13:49:26 juergen Exp $")
void
update_panels(void)
@@ -47,15 +47,14 @@ update_panels(void)
pan = _nc_bottom_panel;
while(pan && pan->above)
{
- PANEL_UPDATE(pan,pan->above);
+ PANEL_UPDATE(pan,pan->above, FALSE);
pan = pan->above;
}
pan = _nc_bottom_panel;
while (pan)
{
- if (is_wintouched(pan->win))
- Wnoutrefresh(pan);
+ Wnoutrefresh(pan);
pan = pan->above;
}
}
diff --git a/contrib/ncurses/panel/panel.priv.h b/contrib/ncurses/panel/panel.priv.h
index cd470a9..57bf793 100644
--- a/contrib/ncurses/panel/panel.priv.h
+++ b/contrib/ncurses/panel/panel.priv.h
@@ -1,4 +1,4 @@
-/* $Id: panel.priv.h,v 1.10 1999/09/29 15:21:58 juergen Exp $ */
+/* $Id: panel.priv.h,v 1.13 2000/01/15 20:39:53 juergen Exp $ */
#ifndef _PANEL_PRIV_H
#define _PANEL_PRIV_H
@@ -73,42 +73,103 @@
#define Is_Top(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_top_panel==(p)))
#define Is_Pseudo(p) ((p) && ((p)==_nc_bottom_panel))
+/* borrowed from curses.priv.h */
+#define CHANGED_RANGE(line,start,end) \
+ if (line->firstchar == _NOCHANGE \
+ || line->firstchar > (start)) \
+ line->firstchar = start; \
+ if (line->lastchar == _NOCHANGE \
+ || line->lastchar < (end)) \
+ line->lastchar = end
+
/*+-------------------------------------------------------------------------
- _nc_panel_is_linked(pan) - check to see if panel is in the stack
+ IS_LINKED(pan) - check to see if panel is in the stack
--------------------------------------------------------------------------*/
/* This works! The only case where it would fail is, when the list has
only one element. But this could only be the pseudo panel at the bottom */
-#define _nc_panel_is_linked(p) ((((p)->above!=(PANEL*)0)||((p)->below!=(PANEL*)0)||((p)==_nc_bottom_panel)) ? TRUE : FALSE)
+#define IS_LINKED(p) (((p)->above || (p)->below ||((p)==_nc_bottom_panel)) ? TRUE : FALSE)
#define PSTARTX(pan) ((pan)->win->_begx)
-#define PENDX(pan) ((pan)->win->_begx + getmaxx((pan)->win))
+#define PENDX(pan) ((pan)->win->_begx + getmaxx((pan)->win) - 1)
#define PSTARTY(pan) ((pan)->win->_begy)
-#define PENDY(pan) ((pan)->win->_begy + getmaxy((pan)->win))
+#define PENDY(pan) ((pan)->win->_begy + getmaxy((pan)->win) - 1)
/*+-------------------------------------------------------------------------
PANELS_OVERLAPPED(pan1,pan2) - check panel overlapped
---------------------------------------------------------------------------*/
#define PANELS_OVERLAPPED(pan1,pan2) \
(( !(pan1) || !(pan2) || \
- PSTARTY(pan1) >= PENDY(pan2) || PENDY(pan1) <= PSTARTY(pan2) ||\
- PSTARTX(pan1) >= PENDX(pan2) || PENDX(pan1) <= PSTARTX(pan2) ) \
+ PSTARTY(pan1) > PENDY(pan2) || PENDY(pan1) < PSTARTY(pan2) ||\
+ PSTARTX(pan1) > PENDX(pan2) || PENDX(pan1) < PSTARTX(pan2) ) \
? FALSE : TRUE)
-#define PANEL_UPDATE(pan,panstart) { int y; PANEL* pan2 = panstart;\
- if (!pan2) {\
+/*+-------------------------------------------------------------------------
+ Compute the intersection rectangle of two overlapping rectangles
+---------------------------------------------------------------------------*/
+#define COMPUTE_INTERSECTION(pan1,pan2,ix1,ix2,iy1,iy2)\
+ ix1 = (PSTARTX(pan1) < PSTARTX(pan2)) ? PSTARTX(pan2) : PSTARTX(pan1);\
+ ix2 = (PENDX(pan1) < PENDX(pan2)) ? PENDX(pan1) : PENDX(pan2);\
+ iy1 = (PSTARTY(pan1) < PSTARTY(pan2)) ? PSTARTY(pan2) : PSTARTY(pan1);\
+ iy2 = (PENDY(pan1) < PENDY(pan2)) ? PENDY(pan1) : PENDY(pan2);\
+ assert((ix1<=ix2) && (iy1<=iy2));\
+
+
+/*+-------------------------------------------------------------------------
+ Walk through the panel stack starting at the given location and
+ check for intersections; overlapping panels are "touched", so they
+ are incrementally overwriting cells that should be hidden.
+ If the "touch" flag is set, the panel gets touched before it is
+ updated.
+---------------------------------------------------------------------------*/
+#define PANEL_UPDATE(pan,panstart,touch)\
+{ PANEL* pan2 = ((panstart) ? (panstart) : _nc_bottom_panel);\
+ if (touch)\
Touchpan(pan);\
- pan2 = _nc_bottom_panel;\
- }\
while(pan2) {\
if ((pan2 != pan) && PANELS_OVERLAPPED(pan,pan2)) {\
- for(y = PSTARTY(pan); y < PENDY(pan); y++) {\
- if( (y >= PSTARTY(pan2)) && (y < PENDY(pan2)) &&\
- ((is_linetouched(pan->win,y - PSTARTY(pan)) == TRUE)) )\
- Touchline(pan2,y - PSTARTY(pan2),1);\
+ int y,ix1,ix2,iy1,iy2;\
+ COMPUTE_INTERSECTION(pan,pan2,ix1,ix2,iy1,iy2);\
+ for(y = iy1; y <= iy2; y++) {\
+ if (is_linetouched(pan->win,y - PSTARTY(pan))) {\
+ struct ldat* line = &(pan2->win->_line[y - PSTARTY(pan2)]);\
+ CHANGED_RANGE(line,ix1-PSTARTX(pan2),ix2-PSTARTX(pan2));\
+ }\
}\
}\
pan2 = pan2->above;\
- }\
+ }\
+}
+
+/*+-------------------------------------------------------------------------
+ Remove panel from stack.
+---------------------------------------------------------------------------*/
+#define PANEL_UNLINK(pan,err) \
+{ err = ERR;\
+ if (pan) {\
+ if (IS_LINKED(pan)) {\
+ if ((pan)->below)\
+ (pan)->below->above = (pan)->above;\
+ if ((pan)->above)\
+ (pan)->above->below = (pan)->below;\
+ if ((pan) == _nc_bottom_panel) \
+ _nc_bottom_panel = (pan)->above;\
+ if ((pan) == _nc_top_panel) \
+ _nc_top_panel = (pan)->below;\
+ err = OK;\
+ }\
+ (pan)->above = (pan)->below = (PANEL*)0;\
+ }\
}
+
+#define HIDE_PANEL(pan,err,err_if_unlinked)\
+ if (IS_LINKED(pan)) {\
+ PANEL_UPDATE(pan,(PANEL*)0,TRUE);\
+ PANEL_UNLINK(pan,err);\
+ } \
+ else {\
+ if (err_if_unlinked)\
+ err = ERR;\
+ }
+
#endif /* _PANEL_PRIV_H */
OpenPOWER on IntegriCloud