aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/panel
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ncurses/panel')
-rw-r--r--contrib/ncurses/panel/p_above.c4
-rw-r--r--contrib/ncurses/panel/p_below.c6
-rw-r--r--contrib/ncurses/panel/p_bottom.c32
-rw-r--r--contrib/ncurses/panel/p_hidden.c4
-rw-r--r--contrib/ncurses/panel/p_hide.c7
-rw-r--r--contrib/ncurses/panel/p_move.c9
-rw-r--r--contrib/ncurses/panel/p_new.c12
-rw-r--r--contrib/ncurses/panel/p_replace.c6
-rw-r--r--contrib/ncurses/panel/p_show.c23
-rw-r--r--contrib/ncurses/panel/p_update.c6
-rw-r--r--contrib/ncurses/panel/panel.c186
-rw-r--r--contrib/ncurses/panel/panel.h44
-rw-r--r--contrib/ncurses/panel/panel.priv.h59
13 files changed, 130 insertions, 268 deletions
diff --git a/contrib/ncurses/panel/p_above.c b/contrib/ncurses/panel/p_above.c
index 0c3d10fc224c..fa32196db42b 100644
--- a/contrib/ncurses/panel/p_above.c
+++ b/contrib/ncurses/panel/p_above.c
@@ -35,7 +35,7 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_above.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_above.c,v 1.3 1999/09/18 11:03:28 juergen Exp $")
PANEL*
panel_above(const PANEL *pan)
@@ -44,7 +44,7 @@ panel_above(const PANEL *pan)
{
/* if top and bottom are equal, we have no or only the pseudo panel;
if not, we return the panel above the pseudo panel */
- return(_nc_bottom_panel==_nc_top_panel ? (PANEL*)0 : _nc_bottom_panel->above);
+ return(EMPTY_STACK() ? (PANEL*)0 : _nc_bottom_panel->above);
}
else
return(pan->above);
diff --git a/contrib/ncurses/panel/p_below.c b/contrib/ncurses/panel/p_below.c
index 7e0f2b24d07d..a7eb4705789e 100644
--- a/contrib/ncurses/panel/p_below.c
+++ b/contrib/ncurses/panel/p_below.c
@@ -35,7 +35,7 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_below.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_below.c,v 1.3 1999/09/18 11:03:33 juergen Exp $")
PANEL*
panel_below(const PANEL *pan)
@@ -43,11 +43,11 @@ panel_below(const PANEL *pan)
if(!pan)
{
/* if top and bottom are equal, we have no or only the pseudo panel */
- return(_nc_top_panel==_nc_bottom_panel ? (PANEL*)0 : _nc_top_panel);
+ return(EMPTY_STACK() ? (PANEL*)0 : _nc_top_panel);
}
else
{
/* we must not return the pseudo panel */
- return(pan->below==_nc_bottom_panel ? (PANEL*) 0 : pan->below);
+ return(Is_Pseudo(pan->below) ? (PANEL*) 0 : pan->below);
}
}
diff --git a/contrib/ncurses/panel/p_bottom.c b/contrib/ncurses/panel/p_bottom.c
index 47abc694a8f4..4e6e11d183b3 100644
--- a/contrib/ncurses/panel/p_bottom.c
+++ b/contrib/ncurses/panel/p_bottom.c
@@ -36,18 +36,44 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_bottom.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+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);
+}
int
bottom_panel(PANEL *pan)
{
if(!pan)
return(ERR);
- if(pan == _nc_bottom_panel)
+ if(Is_Bottom(pan))
return(OK);
dBug(("--> bottom_panel %s", USER_PTR(pan->user)));
if(_nc_panel_is_linked(pan))
(void)hide_panel(pan);
- _nc_panel_link_bottom(pan);
+ panel_link_bottom(pan);
return(OK);
}
diff --git a/contrib/ncurses/panel/p_hidden.c b/contrib/ncurses/panel/p_hidden.c
index 4b90a619da0b..fa05e6ab23df 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.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_hidden.c,v 1.3 1999/09/18 11:04:19 juergen Exp $")
int
panel_hidden(const PANEL *pan)
{
if(!pan)
return(ERR);
- return(_nc_panel_is_linked(pan) ? TRUE : FALSE);
+ return(_nc_panel_is_linked(pan) ? FALSE : TRUE);
}
diff --git a/contrib/ncurses/panel/p_hide.c b/contrib/ncurses/panel/p_hide.c
index bc7c192156cf..d61429538440 100644
--- a/contrib/ncurses/panel/p_hide.c
+++ b/contrib/ncurses/panel/p_hide.c
@@ -36,7 +36,7 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_hide.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_hide.c,v 1.3 1999/09/29 15:22:32 juergen Exp $")
/*+-------------------------------------------------------------------------
__panel_unlink(pan) - unlink panel from stack
@@ -53,8 +53,7 @@ __panel_unlink(PANEL *pan)
return;
#endif
- _nc_override(pan,P_TOUCH);
- _nc_free_obscure(pan);
+ PANEL_UPDATE(pan,(PANEL*)0);
prev = pan->below;
next = pan->above;
@@ -72,8 +71,6 @@ __panel_unlink(PANEL *pan)
if(pan == _nc_top_panel)
_nc_top_panel = prev;
- _nc_calculate_obscure();
-
pan->above = (PANEL *)0;
pan->below = (PANEL *)0;
dStack("<u%d>",9,pan);
diff --git a/contrib/ncurses/panel/p_move.c b/contrib/ncurses/panel/p_move.c
index 6bec36b91246..3bc6328fa6c6 100644
--- a/contrib/ncurses/panel/p_move.c
+++ b/contrib/ncurses/panel/p_move.c
@@ -36,7 +36,7 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_move.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_move.c,v 1.3 1999/09/29 15:22:32 juergen Exp $")
int
move_panel(PANEL *pan, int starty, int startx)
@@ -46,14 +46,9 @@ move_panel(PANEL *pan, int starty, int startx)
if(!pan)
return(ERR);
if(_nc_panel_is_linked(pan))
- _nc_override(pan,P_TOUCH);
+ PANEL_UPDATE(pan,(PANEL*)0);
win = pan->win;
if(mvwin(win,starty,startx))
return(ERR);
- getbegyx(win, pan->wstarty, pan->wstartx);
- pan->wendy = pan->wstarty + getmaxy(win);
- pan->wendx = pan->wstartx + getmaxx(win);
- if(_nc_panel_is_linked(pan))
- _nc_calculate_obscure();
return(OK);
}
diff --git a/contrib/ncurses/panel/p_new.c b/contrib/ncurses/panel/p_new.c
index b4acc27983cb..f2f208d6ec7b 100644
--- a/contrib/ncurses/panel/p_new.c
+++ b/contrib/ncurses/panel/p_new.c
@@ -36,7 +36,7 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_new.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_new.c,v 1.4 1999/09/29 15:22:32 juergen Exp $")
/*+-------------------------------------------------------------------------
Get root (i.e. stdscr's) panel.
@@ -54,18 +54,14 @@ root_panel(void)
PANEL* pan = _nc_stdscr_pseudo_panel;
WINDOW* win = stdscr;
pan->win = win;
- getbegyx(win, pan->wstarty, pan->wstartx);
- pan->wendy = pan->wstarty + getmaxy(win);
- pan->wendx = pan->wstartx + getmaxx(win);
pan->below = (PANEL*)0;
pan->above = (PANEL*)0;
- pan->obscure = (PANELCONS*)0;
#ifdef TRACE
pan->user = "stdscr";
#else
pan->user = (void*)0;
#endif
- _nc_panel_link_bottom(pan);
+ _nc_bottom_panel = _nc_top_panel = pan;
}
}
return _nc_stdscr_pseudo_panel;
@@ -84,15 +80,11 @@ new_panel(WINDOW *win)
pan->win = win;
pan->above = (PANEL *)0;
pan->below = (PANEL *)0;
- getbegyx(win, pan->wstarty, pan->wstartx);
- pan->wendy = pan->wstarty + getmaxy(win);
- pan->wendx = pan->wstartx + getmaxx(win);
#ifdef TRACE
pan->user = "new";
#else
pan->user = (char *)0;
#endif
- pan->obscure = (PANELCONS *)0;
(void)show_panel(pan);
}
return(pan);
diff --git a/contrib/ncurses/panel/p_replace.c b/contrib/ncurses/panel/p_replace.c
index c34d51d3813c..3c4aca185d4f 100644
--- a/contrib/ncurses/panel/p_replace.c
+++ b/contrib/ncurses/panel/p_replace.c
@@ -36,7 +36,7 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_replace.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_replace.c,v 1.3 1999/09/29 15:22:32 juergen Exp $")
int
replace_panel(PANEL *pan, WINDOW *win)
@@ -44,9 +44,7 @@ replace_panel(PANEL *pan, WINDOW *win)
if(!pan)
return(ERR);
if(_nc_panel_is_linked(pan))
- _nc_override(pan,P_TOUCH);
+ PANEL_UPDATE(pan,(PANEL*)0);
pan->win = win;
- if(_nc_panel_is_linked(pan))
- _nc_calculate_obscure();
return(OK);
}
diff --git a/contrib/ncurses/panel/p_show.c b/contrib/ncurses/panel/p_show.c
index 10781efb73a2..d129fd50715b 100644
--- a/contrib/ncurses/panel/p_show.c
+++ b/contrib/ncurses/panel/p_show.c
@@ -36,7 +36,7 @@
*/
#include "panel.priv.h"
-MODULE_ID("$Id: p_show.c,v 1.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_show.c,v 1.5 1999/09/29 15:22:32 juergen Exp $")
static void
panel_link_top(PANEL *pan)
@@ -47,17 +47,15 @@ panel_link_top(PANEL *pan)
return;
#endif
+ assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
+
pan->above = (PANEL *)0;
pan->below = (PANEL *)0;
- if(_nc_top_panel)
- {
- _nc_top_panel->above = pan;
- pan->below = _nc_top_panel;
- }
+
+ _nc_top_panel->above = pan;
+ pan->below = _nc_top_panel;
_nc_top_panel = pan;
- if(!_nc_bottom_panel)
- _nc_bottom_panel = pan;
- _nc_calculate_obscure();
+
dStack("<lt%d>",9,pan);
}
@@ -66,11 +64,16 @@ show_panel(PANEL *pan)
{
if(!pan)
return(ERR);
- if(pan == _nc_top_panel)
+
+ if (Is_Top(pan))
return(OK);
+
dBug(("--> show_panel %s", USER_PTR(pan->user)));
+
if(_nc_panel_is_linked(pan))
(void)hide_panel(pan);
+
panel_link_top(pan);
+
return(OK);
}
diff --git a/contrib/ncurses/panel/p_update.c b/contrib/ncurses/panel/p_update.c
index e7e31ef69295..692a3f33b95d 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.2 1998/02/11 12:14:01 tom Exp $")
+MODULE_ID("$Id: p_update.c,v 1.3 1999/09/29 15:22:32 juergen Exp $")
void
update_panels(void)
@@ -45,9 +45,9 @@ update_panels(void)
dBug(("--> update_panels"));
pan = _nc_bottom_panel;
- while(pan)
+ while(pan && pan->above)
{
- _nc_override(pan,P_UPDATE);
+ PANEL_UPDATE(pan,pan->above);
pan = pan->above;
}
diff --git a/contrib/ncurses/panel/panel.c b/contrib/ncurses/panel/panel.c
index 749664392080..1b79b77f147e 100644
--- a/contrib/ncurses/panel/panel.c
+++ b/contrib/ncurses/panel/panel.c
@@ -34,7 +34,7 @@
/* panel.c -- implementation of panels library, some core routines */
#include "panel.priv.h"
-MODULE_ID("$Id: panel.c,v 1.16 1998/09/19 21:26:31 Todd.Miller Exp $")
+MODULE_ID("$Id: panel.c,v 1.18 1999/09/29 15:22:32 juergen Exp $")
#ifdef TRACE
#ifndef TRACE_TXT
@@ -62,7 +62,7 @@ _nc_dPanel(const char *text, const PANEL *pan)
text, USER_PTR(pan->user),
(pan->below) ? USER_PTR(pan->below->user) : "--",
(pan->above) ? USER_PTR(pan->above->user) : "--",
- pan->wstarty, pan->wstartx);
+ PSTARTY(pan), PSTARTX(pan));
}
#endif
@@ -128,181 +128,9 @@ _nc_Touchline(const PANEL *pan, int start, int count)
}
#endif
-/*+-------------------------------------------------------------------------
- __panels_overlapped(pan1,pan2) - check panel overlapped
---------------------------------------------------------------------------*/
-static INLINE bool
-__panels_overlapped(register const PANEL *pan1, register const PANEL *pan2)
-{
- if(!pan1 || !pan2)
- return(FALSE);
-
- dBug(("__panels_overlapped %s %s", USER_PTR(pan1->user), USER_PTR(pan2->user)));
- /* pan1 intersects with pan2 ? */
- if( (((pan1->wstarty >= pan2->wstarty) && (pan1->wstarty < pan2->wendy)) ||
- ((pan2->wstarty >= pan1->wstarty) && (pan2->wstarty < pan1->wendy))) &&
- (((pan1->wstartx >= pan2->wstartx) && (pan1->wstartx < pan2->wendx)) ||
- ((pan2->wstartx >= pan1->wstartx) && (pan2->wstartx < pan1->wendx)))
- ) return(TRUE);
- else {
- dBug((" no"));
- return(FALSE);
- }
-}
-
-/*+-------------------------------------------------------------------------
- _nc_free_obscure(pan)
---------------------------------------------------------------------------*/
-void
-_nc_free_obscure(PANEL *pan)
-{
- PANELCONS *tobs = pan->obscure; /* "this" one */
- PANELCONS *nobs; /* "next" one */
-
- while(tobs)
- {
- nobs = tobs->above;
- free((char *)tobs);
- tobs = nobs;
- }
- pan->obscure = (PANELCONS *)0;
-}
-
-/*+-------------------------------------------------------------------------
- __override(pan,show)
---------------------------------------------------------------------------*/
-void
-_nc_override(const PANEL *pan, int show)
-{
- int y;
- PANEL *pan2;
- PANELCONS *tobs = pan->obscure; /* "this" one */
-
- dBug(("_nc_override %s,%d", USER_PTR(pan->user),show));
-
- switch (show)
- {
- case P_TOUCH:
- Touchpan(pan);
- /* The following while loop will now mark all panel window lines
- * obscured by use or obscuring us as touched, so they will be
- * updated.
- */
- break;
- case P_UPDATE:
- while(tobs && (tobs->pan != pan))
- tobs = tobs->above;
- /* The next loop will now only go through the panels obscuring pan;
- * it updates all the lines in the obscuring panels in sync. with
- * the lines touched in pan itself. This is called in update_panels()
- * in a loop from the bottom_panel to the top_panel, resulting in
- * the desired update effect.
- */
- break;
- default:
- return;
- }
-
- while(tobs)
- {
- if((pan2 = tobs->pan) != pan) {
- dBug(("test obs pan=%s pan2=%s", USER_PTR(pan->user), USER_PTR(pan2->user)));
- for(y = pan->wstarty; y < pan->wendy; y++) {
- if( (y >= pan2->wstarty) && (y < pan2->wendy) &&
- ((is_linetouched(pan->win,y - pan->wstarty) == TRUE)) )
- Touchline(pan2,y - pan2->wstarty,1);
- }
- }
- tobs = tobs->above;
- }
-}
-
-/*+-------------------------------------------------------------------------
- __calculate_obscure()
---------------------------------------------------------------------------*/
-void
-_nc_calculate_obscure(void)
-{
- PANEL *pan;
- PANEL *pan2;
- PANELCONS *tobs; /* "this" one */
- PANELCONS *lobs = (PANELCONS *)0; /* last one */
-
- pan = _nc_bottom_panel;
- while(pan)
- {
- if(pan->obscure)
- _nc_free_obscure(pan);
- dBug(("--> __calculate_obscure %s", USER_PTR(pan->user)));
- lobs = (PANELCONS *)0; /* last one */
- pan2 = _nc_bottom_panel;
- /* This loop builds a list of panels obsured by pan or obscuring
- pan; pan itself is in the list; all panels before pan are
- obscured by pan, all panels after pan are obscuring pan. */
- while(pan2)
- {
- if(__panels_overlapped(pan,pan2))
- {
- if(!(tobs = (PANELCONS *)malloc(sizeof(PANELCONS))))
- return;
- tobs->pan = pan2;
- dPanel("obscured",pan2);
- tobs->above = (PANELCONS *)0;
- if(lobs)
- lobs->above = tobs;
- else
- pan->obscure = tobs;
- lobs = tobs;
- }
- pan2 = pan2->above;
- }
- _nc_override(pan,P_TOUCH);
- pan = pan->above;
- }
-}
-
-/*+-------------------------------------------------------------------------
- _nc_panel_is_linked(pan) - check to see if panel is in the stack
---------------------------------------------------------------------------*/
-bool
-_nc_panel_is_linked(const PANEL *pan)
-{
- /* 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 */
- return ( ((pan->above!=(PANEL *)0) ||
- (pan->below!=(PANEL *)0) ||
- (pan==_nc_bottom_panel)) ? TRUE : FALSE );
-}
-
-
-/*+-------------------------------------------------------------------------
- __panel_link_bottom(pan) - link panel into stack at bottom
---------------------------------------------------------------------------*/
-void
-_nc_panel_link_bottom(PANEL *pan)
-{
-#ifdef TRACE
- dStack("<lb%d>",1,pan);
- if(_nc_panel_is_linked(pan))
- return;
+#ifndef TRACE
+# ifndef __GNUC__
+ /* Some C compilers need something defined in a source file */
+ static char GCC_UNUSED dummy;
+# endif
#endif
-
- pan->above = (PANEL *)0;
- pan->below = (PANEL *)0;
- if(_nc_bottom_panel)
- { /* the stdscr pseudo panel always stays real bottom;
- so we insert after bottom panel*/
- pan->below = _nc_bottom_panel;
- pan->above = _nc_bottom_panel->above;
- if (pan->above)
- pan->above->below = pan;
- _nc_bottom_panel->above = pan;
- }
- else
- _nc_bottom_panel = pan;
- if(!_nc_top_panel)
- _nc_top_panel = pan;
- assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel);
- _nc_calculate_obscure();
- dStack("<lb%d>",9,pan);
-}
diff --git a/contrib/ncurses/panel/panel.h b/contrib/ncurses/panel/panel.h
index 2ebc3292b3b1..dc33071ba175 100644
--- a/contrib/ncurses/panel/panel.h
+++ b/contrib/ncurses/panel/panel.h
@@ -40,37 +40,31 @@
typedef struct panel
{
- WINDOW *win;
- int wstarty;
- int wendy;
- int wstartx;
- int wendx;
- struct panel *below;
- struct panel *above;
- NCURSES_CONST void *user;
- struct panelcons *obscure;
-}
-PANEL;
+ WINDOW *win;
+ struct panel *below;
+ struct panel *above;
+ NCURSES_CONST void *user;
+} PANEL;
#if defined(__cplusplus)
extern "C" {
#endif
-extern WINDOW *panel_window(const PANEL *);
-extern void update_panels(void);
-extern int hide_panel(PANEL *);
-extern int show_panel(PANEL *);
-extern int del_panel(PANEL *);
-extern int top_panel(PANEL *);
-extern int bottom_panel(PANEL *);
-extern PANEL *new_panel(WINDOW *);
-extern PANEL *panel_above(const PANEL *);
-extern PANEL *panel_below(const PANEL *);
-extern int set_panel_userptr(PANEL *, NCURSES_CONST void *);
+extern WINDOW* panel_window(const PANEL *);
+extern void update_panels(void);
+extern int hide_panel(PANEL *);
+extern int show_panel(PANEL *);
+extern int del_panel(PANEL *);
+extern int top_panel(PANEL *);
+extern int bottom_panel(PANEL *);
+extern PANEL* new_panel(WINDOW *);
+extern PANEL* panel_above(const PANEL *);
+extern PANEL* panel_below(const PANEL *);
+extern int set_panel_userptr(PANEL *, NCURSES_CONST void *);
extern NCURSES_CONST void* panel_userptr(const PANEL *);
-extern int move_panel(PANEL *, int, int);
-extern int replace_panel(PANEL *,WINDOW *);
-extern int panel_hidden(const PANEL *);
+extern int move_panel(PANEL *, int, int);
+extern int replace_panel(PANEL *,WINDOW *);
+extern int panel_hidden(const PANEL *);
#if defined(__cplusplus)
}
diff --git a/contrib/ncurses/panel/panel.priv.h b/contrib/ncurses/panel/panel.priv.h
index 80b1d8f9f27d..cd470a983b16 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.8 1997/10/21 10:19:37 juergen Exp $ */
+/* $Id: panel.priv.h,v 1.10 1999/09/29 15:21:58 juergen Exp $ */
#ifndef _PANEL_PRIV_H
#define _PANEL_PRIV_H
@@ -28,20 +28,12 @@
# define INLINE
#endif
-typedef struct panelcons
-{
- struct panelcons *above;
- struct panel *pan;
-} PANELCONS;
-
#ifdef USE_RCS_IDS
# define MODULE_ID(id) static const char Ident[] = id;
#else
# define MODULE_ID(id) /*nothing*/
#endif
-#define P_TOUCH (0)
-#define P_UPDATE (1)
#ifdef TRACE
extern const char *_nc_my_visbuf(const void *);
@@ -76,10 +68,47 @@ typedef struct panelcons
#define _nc_top_panel _nc_panelhook()->top_panel
#define _nc_bottom_panel _nc_panelhook()->bottom_panel
-extern void _nc_panel_link_bottom(PANEL*);
-extern bool _nc_panel_is_linked(const PANEL*);
-extern void _nc_calculate_obscure(void);
-extern void _nc_free_obscure(PANEL*);
-extern void _nc_override(const PANEL*,int);
-
+#define EMPTY_STACK() (_nc_top_panel==_nc_bottom_panel)
+#define Is_Bottom(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_bottom_panel->above==(p)))
+#define Is_Top(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_top_panel==(p)))
+#define Is_Pseudo(p) ((p) && ((p)==_nc_bottom_panel))
+
+/*+-------------------------------------------------------------------------
+ _nc_panel_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 PSTARTX(pan) ((pan)->win->_begx)
+#define PENDX(pan) ((pan)->win->_begx + getmaxx((pan)->win))
+#define PSTARTY(pan) ((pan)->win->_begy)
+#define PENDY(pan) ((pan)->win->_begy + getmaxy((pan)->win))
+
+/*+-------------------------------------------------------------------------
+ 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) ) \
+ ? FALSE : TRUE)
+
+
+#define PANEL_UPDATE(pan,panstart) { int y; PANEL* pan2 = panstart;\
+ if (!pan2) {\
+ 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);\
+ }\
+ }\
+ pan2 = pan2->above;\
+ }\
+}
#endif /* _PANEL_PRIV_H */