diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libpanel/Makefile | 3 | ||||
-rw-r--r-- | lib/libpanel/p_above.c | 42 | ||||
-rw-r--r-- | lib/libpanel/p_below.c | 44 | ||||
-rw-r--r-- | lib/libpanel/p_bottom.c | 44 | ||||
-rw-r--r-- | lib/libpanel/p_delete.c | 44 | ||||
-rw-r--r-- | lib/libpanel/p_hidden.c | 38 | ||||
-rw-r--r-- | lib/libpanel/p_hide.c | 90 | ||||
-rw-r--r-- | lib/libpanel/p_move.c | 50 | ||||
-rw-r--r-- | lib/libpanel/p_new.c | 90 | ||||
-rw-r--r-- | lib/libpanel/p_replace.c | 43 | ||||
-rw-r--r-- | lib/libpanel/p_show.c | 67 | ||||
-rw-r--r-- | lib/libpanel/p_top.c | 36 | ||||
-rw-r--r-- | lib/libpanel/p_update.c | 52 | ||||
-rw-r--r-- | lib/libpanel/p_user.c | 46 | ||||
-rw-r--r-- | lib/libpanel/p_win.c | 40 | ||||
-rw-r--r-- | lib/libpanel/panel.c | 499 | ||||
-rw-r--r-- | lib/libpanel/panel.h | 7 | ||||
-rw-r--r-- | lib/libpanel/panel.priv.h | 61 | ||||
-rw-r--r-- | lib/libpanel/shlib_version | 2 |
19 files changed, 848 insertions, 450 deletions
diff --git a/lib/libpanel/Makefile b/lib/libpanel/Makefile index 91f9ab85a37..8ade59430f5 100644 --- a/lib/libpanel/Makefile +++ b/lib/libpanel/Makefile @@ -1,5 +1,6 @@ LIB= panel -SRCS= panel.c +SRCS= p_above.c p_below.c p_bottom.c p_delete.c p_hidden.c p_hide.c p_move.c \ + p_new.c p_replace.c p_show.c p_top.c p_update.c p_user.c p_win.c panel.c HDRS= panel.h MAN= panel.3 CFLAGS+= -I${.CURDIR}/../libcurses -DHAVE_CONFIG_H diff --git a/lib/libpanel/p_above.c b/lib/libpanel/p_above.c new file mode 100644 index 00000000000..30d35b06a5a --- /dev/null +++ b/lib/libpanel/p_above.c @@ -0,0 +1,42 @@ +/* $OpenBSD: p_above.c,v 1.1 1997/12/03 05:17:51 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_above.c + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_above.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +PANEL* +panel_above(const PANEL *pan) +{ + if(!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); + } + else + return(pan->above); +} diff --git a/lib/libpanel/p_below.c b/lib/libpanel/p_below.c new file mode 100644 index 00000000000..10b380f97b8 --- /dev/null +++ b/lib/libpanel/p_below.c @@ -0,0 +1,44 @@ +/* $OpenBSD: p_below.c,v 1.1 1997/12/03 05:17:51 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_below.c + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_below.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +PANEL* +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); + } + else + { + /* we must not return the pseudo panel */ + return(pan->below==_nc_bottom_panel ? (PANEL*) 0 : pan->below); + } +} diff --git a/lib/libpanel/p_bottom.c b/lib/libpanel/p_bottom.c new file mode 100644 index 00000000000..52b666aad9e --- /dev/null +++ b/lib/libpanel/p_bottom.c @@ -0,0 +1,44 @@ +/* $OpenBSD: p_bottom.c,v 1.1 1997/12/03 05:17:52 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_bottom.c + * Place a panel on bottom of the stack; may already be in the stack + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_bottom.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +int +bottom_panel(PANEL *pan) +{ + if(!pan) + return(ERR); + if(pan == _nc_bottom_panel) + 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); + return(OK); +} diff --git a/lib/libpanel/p_delete.c b/lib/libpanel/p_delete.c new file mode 100644 index 00000000000..1ba076de2a5 --- /dev/null +++ b/lib/libpanel/p_delete.c @@ -0,0 +1,44 @@ +/* $OpenBSD: p_delete.c,v 1.1 1997/12/03 05:17:52 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_delete.c + * Remove a panel from stack, if in it, and free struct + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_delete.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +int +del_panel(PANEL *pan) +{ + if(pan) + { + dBug(("--> del_panel %s", USER_PTR(pan->user))); + if(_nc_panel_is_linked(pan)) + (void)hide_panel(pan); + free((void *)pan); + return(OK); + } + return(ERR); +} diff --git a/lib/libpanel/p_hidden.c b/lib/libpanel/p_hidden.c new file mode 100644 index 00000000000..7da81ac0a95 --- /dev/null +++ b/lib/libpanel/p_hidden.c @@ -0,0 +1,38 @@ +/* $OpenBSD: p_hidden.c,v 1.1 1997/12/03 05:17:52 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_hidden.c + * Test whether or not panel is hidden + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_hidden.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +int +panel_hidden(const PANEL *pan) +{ + if(!pan) + return(ERR); + return(_nc_panel_is_linked(pan) ? TRUE : FALSE); +} diff --git a/lib/libpanel/p_hide.c b/lib/libpanel/p_hide.c new file mode 100644 index 00000000000..9891e640212 --- /dev/null +++ b/lib/libpanel/p_hide.c @@ -0,0 +1,90 @@ +/* $OpenBSD: p_hide.c,v 1.1 1997/12/03 05:17:53 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_hide.c + * Remove a panel from the stack + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_hide.c,v 1.1 1997/10/12 13:16:22 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 + + _nc_override(pan,P_TOUCH); + _nc_free_obscure(pan); + + 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; + + _nc_calculate_obscure(); + + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + dStack("<u%d>",9,pan); +} + +int +hide_panel(register PANEL *pan) +{ + if(!pan) + return(ERR); + + dBug(("--> hide_panel %s", USER_PTR(pan->user))); + + if(!_nc_panel_is_linked(pan)) + { + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + return(ERR); + } + + __panel_unlink(pan); + return(OK); +} diff --git a/lib/libpanel/p_move.c b/lib/libpanel/p_move.c new file mode 100644 index 00000000000..3aa49f62a87 --- /dev/null +++ b/lib/libpanel/p_move.c @@ -0,0 +1,50 @@ +/* $OpenBSD: p_move.c,v 1.1 1997/12/03 05:17:53 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_move.c + * Move a panel to a new location + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_move.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +int +move_panel(PANEL *pan, int starty, int startx) +{ + WINDOW *win; + + if(!pan) + return(ERR); + if(_nc_panel_is_linked(pan)) + _nc_override(pan,P_TOUCH); + 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/lib/libpanel/p_new.c b/lib/libpanel/p_new.c new file mode 100644 index 00000000000..80c02a5a452 --- /dev/null +++ b/lib/libpanel/p_new.c @@ -0,0 +1,90 @@ +/* $OpenBSD: p_new.c,v 1.1 1997/12/03 05:17:54 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_new.c + * Creation of a new panel + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_new.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +/*+------------------------------------------------------------------------- + Get root (i.e. stdscr's) panel. + Establish the pseudo panel for stdscr if necessary. +--------------------------------------------------------------------------*/ +static PANEL* +root_panel(void) +{ + if(_nc_stdscr_pseudo_panel == (PANEL*)0) + { + + assert(stdscr && !_nc_bottom_panel && !_nc_top_panel); + _nc_stdscr_pseudo_panel = (PANEL*)malloc(sizeof(PANEL)); + if (_nc_stdscr_pseudo_panel != 0) { + 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); + } + } + return _nc_stdscr_pseudo_panel; +} + +PANEL * +new_panel(WINDOW *win) +{ + PANEL *pan = (PANEL*)0; + + (void)root_panel(); + assert(_nc_stdscr_pseudo_panel); + + if (!(win->_flags & _ISPAD) && (pan = (PANEL*)malloc(sizeof(PANEL)))) + { + 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/lib/libpanel/p_replace.c b/lib/libpanel/p_replace.c new file mode 100644 index 00000000000..e9a30b8ed1d --- /dev/null +++ b/lib/libpanel/p_replace.c @@ -0,0 +1,43 @@ +/* $OpenBSD: p_replace.c,v 1.1 1997/12/03 05:17:54 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_replace.c + * Replace a panels window. + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_replace.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +int +replace_panel(PANEL *pan, WINDOW *win) +{ + if(!pan) + return(ERR); + if(_nc_panel_is_linked(pan)) + _nc_override(pan,P_TOUCH); + pan->win = win; + if(_nc_panel_is_linked(pan)) + _nc_calculate_obscure(); + return(OK); +} diff --git a/lib/libpanel/p_show.c b/lib/libpanel/p_show.c new file mode 100644 index 00000000000..6de44075bd1 --- /dev/null +++ b/lib/libpanel/p_show.c @@ -0,0 +1,67 @@ +/* $OpenBSD: p_show.c,v 1.1 1997/12/03 05:17:54 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_show.c + * Place a panel on top of the stack; may already be in the stack + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_show.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +static void +panel_link_top(PANEL *pan) +{ +#ifdef TRACE + dStack("<lt%d>",1,pan); + if(_nc_panel_is_linked(pan)) + return; +#endif + + 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 = pan; + if(!_nc_bottom_panel) + _nc_bottom_panel = pan; + _nc_calculate_obscure(); + dStack("<lt%d>",9,pan); +} + +int +show_panel(PANEL *pan) +{ + if(!pan) + return(ERR); + if(pan == _nc_top_panel) + 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/lib/libpanel/p_top.c b/lib/libpanel/p_top.c new file mode 100644 index 00000000000..cff6d711377 --- /dev/null +++ b/lib/libpanel/p_top.c @@ -0,0 +1,36 @@ +/* $OpenBSD: p_top.c,v 1.1 1997/12/03 05:17:55 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_top.c + * Place a panel on top of the stack. + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_top.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +int +top_panel(PANEL *pan) +{ + return(show_panel(pan)); +} diff --git a/lib/libpanel/p_update.c b/lib/libpanel/p_update.c new file mode 100644 index 00000000000..bef2a08b049 --- /dev/null +++ b/lib/libpanel/p_update.c @@ -0,0 +1,52 @@ +/* $OpenBSD: p_update.c,v 1.1 1997/12/03 05:17:55 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_update.c + * wnoutrefresh windows in an orderly fashion + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_update.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +void +update_panels(void) +{ + PANEL *pan; + + dBug(("--> update_panels")); + pan = _nc_bottom_panel; + while(pan) + { + _nc_override(pan,P_UPDATE); + pan = pan->above; + } + + pan = _nc_bottom_panel; + while (pan) + { + if (is_wintouched(pan->win)) + Wnoutrefresh(pan); + pan = pan->above; + } +} diff --git a/lib/libpanel/p_user.c b/lib/libpanel/p_user.c new file mode 100644 index 00000000000..46b29b74ced --- /dev/null +++ b/lib/libpanel/p_user.c @@ -0,0 +1,46 @@ +/* $OpenBSD: p_user.c,v 1.1 1997/12/03 05:17:55 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_user.c + * Set/Get panels user pointer + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_user.c,v 1.2 1997/11/08 18:30:08 tom Exp $") + +int +set_panel_userptr(PANEL *pan, NCURSES_CONST void *uptr) +{ + if(!pan) + return(ERR); + pan->user = uptr; + return(OK); +} + +NCURSES_CONST void* +panel_userptr(const PANEL *pan) +{ + return(pan ? pan->user : (NCURSES_CONST void *)0); +} + diff --git a/lib/libpanel/p_win.c b/lib/libpanel/p_win.c new file mode 100644 index 00000000000..77ca4262ff1 --- /dev/null +++ b/lib/libpanel/p_win.c @@ -0,0 +1,40 @@ +/* $OpenBSD: p_win.c,v 1.1 1997/12/03 05:17:56 millert Exp $ */ + +/*************************************************************************** +* COPYRIGHT NOTICE * +**************************************************************************** +* panels is copyright (C) 1995 * +* Zeyd M. Ben-Halim * +* zmbenhal@netcom.com * +* Eric S. Raymond * +* esr@snark.thyrsus.com * +* * +* All praise to the original author, Warren Tucker. * +* * +* Permission is hereby granted to reproduce and distribute panels * +* by any means and for any fee, whether alone or as part of a * +* larger distribution, in source or in binary form, PROVIDED * +* this notice is included with any such distribution, and is not * +* removed from any of its header files. Mention of panels in any * +* applications linked with it is highly appreciated. * +* * +* panels comes AS IS with no warranty, implied or expressed. * +* * +***************************************************************************/ + +/* p_win.c + * Return a panels window. + */ +#include "panel.priv.h" + +MODULE_ID("Id: p_win.c,v 1.1 1997/10/12 13:16:22 juergen Exp $") + +WINDOW* +panel_window(const PANEL *pan) +{ + return(pan ? pan->win : (WINDOW *)0); +} + + + + diff --git a/lib/libpanel/panel.c b/lib/libpanel/panel.c index 1b13f02ef0b..a97a1fadb6e 100644 --- a/lib/libpanel/panel.c +++ b/lib/libpanel/panel.c @@ -1,3 +1,4 @@ +/* $OpenBSD: panel.c,v 1.3 1997/12/03 05:17:56 millert Exp $ */ /*************************************************************************** * COPYRIGHT NOTICE * @@ -21,126 +22,101 @@ * * ***************************************************************************/ -/* panel.c -- implementation of panels library */ +/* panel.c -- implementation of panels library, some core routines */ #include "panel.priv.h" -MODULE_ID("$Id: panel.c,v 1.2 1997/11/26 03:56:05 millert Exp $") +MODULE_ID("Id: panel.c,v 1.14 1997/10/18 18:34:31 tom Exp $") #ifdef TRACE -extern char *_nc_visbuf(const char *); -#ifdef TRACE_TXT -#define USER_PTR(ptr) _nc_visbuf((const char *)ptr) -#else -static char *my_nc_visbuf(const void *ptr) +#ifndef TRACE_TXT +const char *_nc_my_visbuf(const void *ptr) { char temp[40]; if (ptr != 0) - sprintf(temp, "ptr:%p", ptr); + snprintf(temp, sizeof(temp), "ptr:%p", ptr); else strcpy(temp, "<null>"); return _nc_visbuf(temp); } -#define USER_PTR(ptr) my_nc_visbuf((const char *)ptr) #endif #endif -static PANEL *__bottom_panel = (PANEL *)0; -static PANEL *__top_panel = (PANEL *)0; - -static PANEL __stdscr_pseudo_panel = { (WINDOW *)0, - 0,0,0,0, - (PANEL *)0, (PANEL *)0, - (void *)0, - (PANELCONS *)0 }; - -/* Prototypes */ -static void __panel_link_bottom(PANEL *pan); /*+------------------------------------------------------------------------- dPanel(text,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -static void -dPanel(const char *text, const PANEL *pan) +void +_nc_dPanel(const char *text, const PANEL *pan) { _tracef("%s id=%s b=%s a=%s y=%d x=%d", text, USER_PTR(pan->user), (pan->below) ? USER_PTR(pan->below->user) : "--", (pan->above) ? USER_PTR(pan->above->user) : "--", pan->wstarty, pan->wstartx); -} /* end of dPanel */ -#else -# define dPanel(text,pan) +} #endif /*+------------------------------------------------------------------------- dStack(fmt,num,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -static void -dStack(const char *fmt, int num, const PANEL *pan) +void +_nc_dStack(const char *fmt, int num, const PANEL *pan) { char s80[80]; snprintf(s80,sizeof(s80),fmt,num,pan); _tracef("%s b=%s t=%s",s80, - (__bottom_panel) ? USER_PTR(__bottom_panel->user) : "--", - (__top_panel) ? USER_PTR(__top_panel->user) : "--"); + (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--", + (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--"); if(pan) _tracef("pan id=%s", USER_PTR(pan->user)); - pan = __bottom_panel; + pan = _nc_bottom_panel; while(pan) { dPanel("stk",pan); pan = pan->above; } -} /* end of dStack */ -#else -# define dStack(fmt,num,pan) +} #endif /*+------------------------------------------------------------------------- Wnoutrefresh(pan) - debugging hook for wnoutrefresh --------------------------------------------------------------------------*/ #ifdef TRACE -static void -Wnoutrefresh(const PANEL *pan) +void +_nc_Wnoutrefresh(const PANEL *pan) { dPanel("wnoutrefresh",pan); wnoutrefresh(pan->win); -} /* end of Wnoutrefresh */ -#else -# define Wnoutrefresh(pan) wnoutrefresh((pan)->win) +} #endif /*+------------------------------------------------------------------------- Touchpan(pan) --------------------------------------------------------------------------*/ #ifdef TRACE -static void -Touchpan(const PANEL *pan) +void +_nc_Touchpan(const PANEL *pan) { dPanel("Touchpan",pan); touchwin(pan->win); -} /* end of Touchpan */ -#else -# define Touchpan(pan) touchwin((pan)->win) +} #endif /*+------------------------------------------------------------------------- Touchline(pan,start,count) --------------------------------------------------------------------------*/ #ifdef TRACE -static void -Touchline(const PANEL *pan, int start, int count) +void +_nc_Touchline(const PANEL *pan, int start, int count) { char s80[80]; snprintf(s80,sizeof(s80),"Touchline s=%d c=%d",start,count); dPanel(s80,pan); touchline(pan->win,start,count); -} /* end of Touchline */ -#else -# define Touchline(pan,start,count) touchline((pan)->win,start,count) +} #endif /*+------------------------------------------------------------------------- @@ -151,24 +127,25 @@ __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) && - (pan1->wstartx >= pan2->wstartx) && (pan1->wstartx < pan2->wendx)) - return(TRUE); - /* or vice versa test */ - if((pan2->wstarty >= pan1->wstarty) && (pan2->wstarty < pan1->wendy) && - (pan2->wstartx >= pan1->wstartx) && (pan2->wstartx < pan1->wendx)) - return(TRUE); - dBug((" no")); - return(FALSE); -} /* end of __panels_overlapped */ + 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); + } +} /*+------------------------------------------------------------------------- - __free_obscure(pan) + _nc_free_obscure(pan) --------------------------------------------------------------------------*/ -static INLINE void -__free_obscure(PANEL *pan) +void +_nc_free_obscure(PANEL *pan) { PANELCONS *tobs = pan->obscure; /* "this" one */ PANELCONS *nobs; /* "next" one */ @@ -180,40 +157,19 @@ __free_obscure(PANEL *pan) tobs = nobs; } pan->obscure = (PANELCONS *)0; -} /* end of __free_obscure */ - -/*+------------------------------------------------------------------------- - Get root (i.e. stdscr's) panel. - Establish the pseudo panel for stdscr if necessary. ---------------------------------------------------------------------------*/ -static PANEL* -__root_panel(void) -{ - if(!__stdscr_pseudo_panel.win) - { /* initialize those fields not already statically initialized */ - assert(stdscr && !__bottom_panel && !__top_panel); - __stdscr_pseudo_panel.win = stdscr; - __stdscr_pseudo_panel.wendy = LINES; - __stdscr_pseudo_panel.wendx = COLS; -#ifdef TRACE - __stdscr_pseudo_panel.user = "stdscr"; -#endif - __panel_link_bottom(&__stdscr_pseudo_panel); - } - return &__stdscr_pseudo_panel; } /*+------------------------------------------------------------------------- __override(pan,show) --------------------------------------------------------------------------*/ -static void -__override(const PANEL *pan, int show) +void +_nc_override(const PANEL *pan, int show) { int y; PANEL *pan2; PANELCONS *tobs = pan->obscure; /* "this" one */ - dBug(("__override %s,%d", USER_PTR(pan->user),show)); + dBug(("_nc_override %s,%d", USER_PTR(pan->user),show)); switch (show) { @@ -250,27 +206,27 @@ __override(const PANEL *pan, int show) } tobs = tobs->above; } -} /* end of __override */ +} /*+------------------------------------------------------------------------- __calculate_obscure() --------------------------------------------------------------------------*/ -static void -__calculate_obscure(void) +void +_nc_calculate_obscure(void) { PANEL *pan; PANEL *pan2; PANELCONS *tobs; /* "this" one */ PANELCONS *lobs = (PANELCONS *)0; /* last one */ - pan = __bottom_panel; + pan = _nc_bottom_panel; while(pan) { if(pan->obscure) - __free_obscure(pan); + _nc_free_obscure(pan); dBug(("--> __calculate_obscure %s", USER_PTR(pan->user))); lobs = (PANELCONS *)0; /* last one */ - pan2 = __bottom_panel; + 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. */ @@ -291,374 +247,53 @@ __calculate_obscure(void) } pan2 = pan2->above; } - __override(pan,P_TOUCH); + _nc_override(pan,P_TOUCH); pan = pan->above; } -} /* end of __calculate_obscure */ +} /*+------------------------------------------------------------------------- - __panel_is_linked(pan) - check to see if panel is in the stack + _nc_panel_is_linked(pan) - check to see if panel is in the stack --------------------------------------------------------------------------*/ -static INLINE bool -__panel_is_linked(const PANEL *pan) +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==__bottom_panel)) ? TRUE : FALSE ); -} /* end of __panel_is_linked */ - -/*+------------------------------------------------------------------------- - __panel_link_top(pan) - link panel into stack at top ---------------------------------------------------------------------------*/ -static void -__panel_link_top(PANEL *pan) -{ -#ifdef TRACE - dStack("<lt%d>",1,pan); - if(__panel_is_linked(pan)) - return; -#endif - - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - if(__top_panel) - { - __top_panel->above = pan; - pan->below = __top_panel; - } - __top_panel = pan; - if(!__bottom_panel) - __bottom_panel = pan; - __calculate_obscure(); - dStack("<lt%d>",9,pan); + (pan==_nc_bottom_panel)) ? TRUE : FALSE ); +} -} /* end of __panel_link_top */ /*+------------------------------------------------------------------------- __panel_link_bottom(pan) - link panel into stack at bottom --------------------------------------------------------------------------*/ -static void -__panel_link_bottom(PANEL *pan) +void +_nc_panel_link_bottom(PANEL *pan) { #ifdef TRACE dStack("<lb%d>",1,pan); - if(__panel_is_linked(pan)) + if(_nc_panel_is_linked(pan)) return; #endif pan->above = (PANEL *)0; pan->below = (PANEL *)0; - if(__bottom_panel) + if(_nc_bottom_panel) { /* the stdscr pseudo panel always stays real bottom; so we insert after bottom panel*/ - pan->below = __bottom_panel; - pan->above = __bottom_panel->above; + pan->below = _nc_bottom_panel; + pan->above = _nc_bottom_panel->above; if (pan->above) pan->above->below = pan; - __bottom_panel->above = pan; + _nc_bottom_panel->above = pan; } else - __bottom_panel = pan; - if(!__top_panel) - __top_panel = pan; - assert(__bottom_panel == &__stdscr_pseudo_panel); - __calculate_obscure(); + _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); -} /* end of __panel_link_bottom */ - -/*+------------------------------------------------------------------------- - __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(!__panel_is_linked(pan)) - return; -#endif - - __override(pan,P_TOUCH); - __free_obscure(pan); - - 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 == __bottom_panel) - __bottom_panel = next; - if(pan == __top_panel) - __top_panel = prev; - - __calculate_obscure(); - - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - dStack("<u%d>",9,pan); -} /* end of __panel_unlink */ - -/*+------------------------------------------------------------------------- - panel_window(pan) - get window associated with panel ---------------------------------------------------------------------------*/ -WINDOW * -panel_window(const PANEL *pan) -{ - return(pan ? pan->win : (WINDOW *)0); -} /* end of panel_window */ - -/*+------------------------------------------------------------------------- - update_panels() - wnoutrefresh windows in an orderly fashion ---------------------------------------------------------------------------*/ -void -update_panels(void) -{ - PANEL *pan; - - dBug(("--> update_panels")); - pan = __bottom_panel; - while(pan) - { - __override(pan,P_UPDATE); - pan = pan->above; - } - - pan = __bottom_panel; - while (pan) - { - if(is_wintouched(pan->win)) - Wnoutrefresh(pan); - pan = pan->above; - } -} /* end of update_panels */ - -/*+------------------------------------------------------------------------- - hide_panel(pan) - remove a panel from stack ---------------------------------------------------------------------------*/ -int -hide_panel(register PANEL *pan) -{ - if(!pan) - return(ERR); - - dBug(("--> hide_panel %s", USER_PTR(pan->user))); - - if(!__panel_is_linked(pan)) - { - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; - return(ERR); - } - - __panel_unlink(pan); - return(OK); -} /* end of hide_panel */ - -/*+------------------------------------------------------------------------- - show_panel(pan) - place a panel on top of stack -may already be in stack ---------------------------------------------------------------------------*/ -int -show_panel(register PANEL *pan) -{ - if(!pan) - return(ERR); - if(pan == __top_panel) - return(OK); - dBug(("--> show_panel %s", USER_PTR(pan->user))); - if(__panel_is_linked(pan)) - (void)hide_panel(pan); - __panel_link_top(pan); - return(OK); -} /* end of show_panel */ - -/*+------------------------------------------------------------------------- - top_panel(pan) - place a panel on top of stack ---------------------------------------------------------------------------*/ -int -top_panel(register PANEL *pan) -{ - return(show_panel(pan)); -} /* end of top_panel */ - -/*+------------------------------------------------------------------------- - del_panel(pan) - remove a panel from stack, if in it, and free struct ---------------------------------------------------------------------------*/ -int -del_panel(register PANEL *pan) -{ - if(pan) - { - dBug(("--> del_panel %s", USER_PTR(pan->user))); - if(__panel_is_linked(pan)) - (void)hide_panel(pan); - free((void *)pan); - return(OK); - } - return(ERR); -} /* end of del_panel */ - -/*+------------------------------------------------------------------------- - bottom_panel(pan) - place a panel on bottom of stack -may already be in stack ---------------------------------------------------------------------------*/ -int -bottom_panel(register PANEL *pan) -{ - if(!pan) - return(ERR); - if(pan == __bottom_panel) - return(OK); - dBug(("--> bottom_panel %s", USER_PTR(pan->user))); - if(__panel_is_linked(pan)) - (void)hide_panel(pan); - __panel_link_bottom(pan); - return(OK); -} /* end of bottom_panel */ - -/*+------------------------------------------------------------------------- - new_panel(win) - create a panel and place on top of stack ---------------------------------------------------------------------------*/ -PANEL * -new_panel(WINDOW *win) -{ - PANEL *pan = (PANEL *)malloc(sizeof(PANEL)); - - (void)__root_panel(); - - if(pan) - { - 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); -} /* end of new_panel */ - -/*+------------------------------------------------------------------------- - panel_above(pan) ---------------------------------------------------------------------------*/ -PANEL * -panel_above(const PANEL *pan) -{ - if(!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(__bottom_panel==__top_panel ? (PANEL*)0 : __bottom_panel->above); - } - else - return(pan->above); -} /* end of panel_above */ - -/*+------------------------------------------------------------------------- - panel_below(pan) ---------------------------------------------------------------------------*/ -PANEL * -panel_below(const PANEL *pan) -{ - if(!pan) - { - /* if top and bottom are equal, we have no or only the pseudo panel */ - return(__top_panel==__bottom_panel ? (PANEL*)0 : __top_panel); - } - else - { - /* we must not return the pseudo panel */ - return(pan->below==__bottom_panel ? (PANEL*) 0 : pan->below); - } -} /* end of panel_below */ - -/*+------------------------------------------------------------------------- - set_panel_userptr(pan,uptr) ---------------------------------------------------------------------------*/ -int -set_panel_userptr(PANEL *pan, const void *uptr) -{ - if(!pan) - return(ERR); - pan->user = uptr; - return(OK); -} /* end of set_panel_userptr */ - -/*+------------------------------------------------------------------------- - panel_userptr(pan) ---------------------------------------------------------------------------*/ -const void* -panel_userptr(const PANEL *pan) -{ - return(pan ? pan->user : (void *)0); -} /* end of panel_userptr */ - -/*+------------------------------------------------------------------------- - move_panel(pan,starty,startx) ---------------------------------------------------------------------------*/ -int -move_panel(PANEL *pan, int starty, int startx) -{ - WINDOW *win; - - if(!pan) - return(ERR); - if(__panel_is_linked(pan)) - __override(pan,P_TOUCH); - 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(__panel_is_linked(pan)) - __calculate_obscure(); - return(OK); -} /* end of move_panel */ - -/*+------------------------------------------------------------------------- - replace_panel(pan,win) ---------------------------------------------------------------------------*/ -int -replace_panel(PANEL *pan, WINDOW *win) -{ - if(!pan) - return(ERR); - if(__panel_is_linked(pan)) - __override(pan,P_TOUCH); - pan->win = win; - if(__panel_is_linked(pan)) - __calculate_obscure(); - return(OK); -} /* end of replace_panel */ - -/*+------------------------------------------------------------------------- - panel_hidden(pan) ---------------------------------------------------------------------------*/ -int -panel_hidden(const PANEL *pan) -{ - if(!pan) - return(ERR); - return(__panel_is_linked(pan) ? TRUE : FALSE); -} /* end of panel_hidden */ - -/* end of panel.c */ +} diff --git a/lib/libpanel/panel.h b/lib/libpanel/panel.h index 2f917827459..e371ed84085 100644 --- a/lib/libpanel/panel.h +++ b/lib/libpanel/panel.h @@ -1,3 +1,4 @@ +/* $OpenBSD: panel.h,v 1.3 1997/12/03 05:17:57 millert Exp $ */ /*************************************************************************** * COPYRIGHT NOTICE * @@ -37,7 +38,7 @@ typedef struct panel int wendx; struct panel *below; struct panel *above; - const void *user; + NCURSES_CONST void *user; struct panelcons *obscure; } PANEL; @@ -56,8 +57,8 @@ 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 *,const void *); -extern const void* panel_userptr(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 *); diff --git a/lib/libpanel/panel.priv.h b/lib/libpanel/panel.priv.h index 1d12e1822c1..e2365b2f702 100644 --- a/lib/libpanel/panel.priv.h +++ b/lib/libpanel/panel.priv.h @@ -1,4 +1,6 @@ -/* $Id: panel.priv.h,v 1.1 1997/11/26 03:56:06 millert Exp $ */ +/* $OpenBSD: panel.priv.h,v 1.2 1997/12/03 05:17:57 millert Exp $ */ + +/* Id: panel.priv.h,v 1.8 1997/10/21 10:19:37 juergen Exp $ */ #ifndef _PANEL_PRIV_H #define _PANEL_PRIV_H @@ -8,45 +10,78 @@ #endif #include <stdlib.h> +#include <string.h> #include <assert.h> #if HAVE_LIBDMALLOC -#include <dmalloc.h> /* Gray Watson's library */ +# include <dmalloc.h> /* Gray Watson's library */ #endif #if HAVE_LIBDBMALLOC -#include <dbmalloc.h> /* Conor Cahill's library */ +# include <dbmalloc.h> /* Conor Cahill's library */ #endif +#include <nc_panel.h> #include "panel.h" - #if ( CC_HAS_INLINE_FUNCS && !defined(TRACE) ) # define INLINE inline #else # define INLINE #endif - typedef struct panelcons { struct panelcons *above; struct panel *pan; } PANELCONS; -#ifdef TRACE -# define dBug(x) _tracef x -#else -# define dBug(x) -#endif - #ifdef USE_RCS_IDS -#define MODULE_ID(id) static const char Ident[] = id; +# define MODULE_ID(id) static const char Ident[] = id; #else -#define MODULE_ID(id) /*nothing*/ +# define MODULE_ID(id) /*nothing*/ #endif #define P_TOUCH (0) #define P_UPDATE (1) +#ifdef TRACE + extern const char *_nc_my_visbuf(const void *); +# ifdef TRACE_TXT +# define USER_PTR(ptr) _nc_visbuf((const char *)ptr) +# else +# define USER_PTR(ptr) _nc_my_visbuf((const char *)ptr) +# endif + + extern void _nc_dPanel(const char*, const PANEL*); + extern void _nc_dStack(const char*, int, const PANEL*); + extern void _nc_Wnoutrefresh(const PANEL*); + extern void _nc_Touchpan(const PANEL*); + extern void _nc_Touchline(const PANEL*, int, int); + +# define dBug(x) _tracef x +# define dPanel(text,pan) _nc_dPanel(text,pan) +# define dStack(fmt,num,pan) _nc_dStack(fmt,num,pan) +# define Wnoutrefresh(pan) _nc_Wnoutrefresh(pan) +# define Touchpan(pan) _nc_Touchpan(pan) +# define Touchline(pan,start,count) _nc_Touchline(pan,start,count) +#else /* !TRACE */ +# define dBug(x) +# define dPanel(text,pan) +# define dStack(fmt,num,pan) +# define Wnoutrefresh(pan) wnoutrefresh((pan)->win) +# define Touchpan(pan) touchwin((pan)->win) +# define Touchline(pan,start,count) touchline((pan)->win,start,count) #endif + +#define _nc_stdscr_pseudo_panel _nc_panelhook()->stdscr_pseudo_panel +#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); + +#endif /* _PANEL_PRIV_H */ diff --git a/lib/libpanel/shlib_version b/lib/libpanel/shlib_version index 1edea46de91..893819d18ff 100644 --- a/lib/libpanel/shlib_version +++ b/lib/libpanel/shlib_version @@ -1,2 +1,2 @@ major=1 -minor=0 +minor=1 |