diff options
author | peter <peter@FreeBSD.org> | 1999-08-24 01:06:48 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-08-24 01:06:48 +0000 |
commit | bacd15cb1fff2dee94d390e0f84c147cd82ea148 (patch) | |
tree | ad214c5b2c8142ad6dc6d2ce3a9c83e6317d7f77 /contrib/ncurses/panel | |
download | FreeBSD-src-bacd15cb1fff2dee94d390e0f84c147cd82ea148.zip FreeBSD-src-bacd15cb1fff2dee94d390e0f84c147cd82ea148.tar.gz |
Import unmodified (but trimmed) ncurses 5.0 prerelease 990821.
This contains the full eti (panel, form, menu) extensions.
bmake glue to follow.
Obtained from: ftp://ftp.clark.net/pub/dickey/ncurses
Diffstat (limited to 'contrib/ncurses/panel')
-rw-r--r-- | contrib/ncurses/panel/Makefile.in | 143 | ||||
-rw-r--r-- | contrib/ncurses/panel/headers | 31 | ||||
-rw-r--r-- | contrib/ncurses/panel/llib-lpanel | 167 | ||||
-rw-r--r-- | contrib/ncurses/panel/modules | 49 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_above.c | 51 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_below.c | 53 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_bottom.c | 53 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_delete.c | 53 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_hidden.c | 47 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_hide.c | 99 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_move.c | 59 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_new.c | 99 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_replace.c | 52 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_show.c | 76 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_top.c | 45 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_update.c | 61 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_user.c | 55 | ||||
-rw-r--r-- | contrib/ncurses/panel/p_win.c | 49 | ||||
-rw-r--r-- | contrib/ncurses/panel/panel.c | 308 | ||||
-rw-r--r-- | contrib/ncurses/panel/panel.h | 81 | ||||
-rw-r--r-- | contrib/ncurses/panel/panel.priv.h | 85 |
21 files changed, 1716 insertions, 0 deletions
diff --git a/contrib/ncurses/panel/Makefile.in b/contrib/ncurses/panel/Makefile.in new file mode 100644 index 0000000..3110f83 --- /dev/null +++ b/contrib/ncurses/panel/Makefile.in @@ -0,0 +1,143 @@ +# $Id: Makefile.in,v 1.28 1998/11/29 01:03:31 Rick.Ohnemus Exp $ +############################################################################## +# Copyright (c) 1998 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"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996,1997 +# +# Makefile for panels source code. +# +# This makes the following: +# libraries (normal/debug/profile/shared) +# +# The variable 'srcdir' refers to the source-distribution, and can be set with +# the configure script by "--srcdir=DIR". +# +# The rules are organized to produce the libraries for the configured models, + +# turn off _all_ suffix rules; we'll generate our own +.SUFFIXES: + +SHELL = /bin/sh +THIS = Makefile + +MODEL = @DFT_LWR_MODEL@ +INSTALL_PREFIX = @INSTALL_PREFIX@ +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +datadir = @datadir@ + +ticdir = $(datadir)/terminfo + +INSTALL = @INSTALL@ +INSTALL_LIB = @INSTALL@ @INSTALL_LIB@ +INSTALL_DATA = @INSTALL_DATA@ + +AR = @AR@ +AR_OPTS = @AR_OPTS@ +AWK = @AWK@ +LD = @LD@ +LN_S = @LN_S@ + +CC = @CC@ +CFLAGS = @CFLAGS@ + +CPPFLAGS = @CPPFLAGS@ \ + -DHAVE_CONFIG_H -DTERMINFO=\"$(ticdir)\" + +CCFLAGS = $(CPPFLAGS) $(CFLAGS) + +CFLAGS_NORMAL = $(CCFLAGS) +CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE +CFLAGS_PROFILE = $(CCFLAGS) -pg +CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ + +CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) + +LINK = $(CC) +LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@ + +SHLIB_DIRS = -L../lib -L$(libdir) +SHLIB_LIST = $(SHLIB_DIRS) -lncurses @SHLIB_LIST@ + +MK_SHARED_LIB = @MK_SHARED_LIB@ + +REL_VERSION = @cf_cv_rel_version@ +ABI_VERSION = @cf_cv_abi_version@ + +RANLIB = @RANLIB@ + +LIBRARIES = @LIBS_TO_MAKE@ + +LINT = @LINT@ +LINT_OPTS = @LINT_OPTS@ +LINT_LIBS = -lpanel -lncurses @LIBS@ + +AUTO_SRC = \ + ../include/panel.h + +################################################################################ +all install :: $(AUTO_SRC) $(LIBRARIES) + +sources: $(AUTO_SRC) + +$(INSTALL_PREFIX)$(libdir) : + $(srcdir)/../mkinstalldirs $@ + +# make a copy to simplify include-paths while still keeping panel's include +# file in this directory. +../include/panel.h : $(srcdir)/panel.h + -rm -f $@ + cp $(srcdir)/panel.h $@ + +PANEL_PRIV_H = \ + $(srcdir)/panel.priv.h \ + $(srcdir)/panel.h + +tags: + ctags *.[ch] + +TAGS: + etags *.[ch] + +mostlyclean :: + -rm -f core tags TAGS *~ *.ln *.atac trace + +clean :: mostlyclean + -rm -f $(AUTO_SRC) + +distclean :: clean + -rm -f Makefile + +realclean :: distclean + +############################################################################### +# The remainder of this file is automatically generated during configuration +############################################################################### diff --git a/contrib/ncurses/panel/headers b/contrib/ncurses/panel/headers new file mode 100644 index 0000000..fa0164c --- /dev/null +++ b/contrib/ncurses/panel/headers @@ -0,0 +1,31 @@ +############################################################################## +# Copyright (c) 1998 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"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1996 +# +$(srcdir)/panel.h diff --git a/contrib/ncurses/panel/llib-lpanel b/contrib/ncurses/panel/llib-lpanel new file mode 100644 index 0000000..ab75ffe --- /dev/null +++ b/contrib/ncurses/panel/llib-lpanel @@ -0,0 +1,167 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey <dickey@clark.net> 1997 * + ****************************************************************************/ +/* LINTLIBRARY */ + +/* ./panel.c */ + +#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 */ + +#undef panel_above +PANEL *panel_above( + const PANEL *pan) + { return(*(PANEL **)0); } + +/* ./p_below.c */ + +#undef panel_below +PANEL *panel_below( + const PANEL *pan) + { return(*(PANEL **)0); } + +/* ./p_bottom.c */ + +#undef bottom_panel +int bottom_panel( + PANEL *pan) + { return(*(int *)0); } + +/* ./p_delete.c */ + +#undef del_panel +int del_panel( + PANEL *pan) + { return(*(int *)0); } + +/* ./p_hide.c */ + +#undef hide_panel +int hide_panel( + PANEL *pan) + { return(*(int *)0); } + +/* ./p_hidden.c */ + +#undef panel_hidden +int panel_hidden( + const PANEL *pan) + { return(*(int *)0); } + +/* ./p_move.c */ + +#undef move_panel +int move_panel( + PANEL *pan, + int starty, + int startx) + { return(*(int *)0); } + +/* ./p_new.c */ + +#undef new_panel +PANEL *new_panel( + WINDOW *win) + { return(*(PANEL **)0); } + +/* ./p_replace.c */ + +#undef replace_panel +int replace_panel( + PANEL *pan, + WINDOW *win) + { return(*(int *)0); } + +/* ./p_show.c */ + +#undef show_panel +int show_panel( + PANEL *pan) + { return(*(int *)0); } + +/* ./p_top.c */ + +#undef top_panel +int top_panel( + PANEL *pan) + { return(*(int *)0); } + +/* ./p_update.c */ + +#undef update_panels +void update_panels(void) + { /* void */ } + +/* ./p_user.c */ + +#undef set_panel_userptr +int set_panel_userptr( + PANEL *pan, + void *uptr) + { return(*(int *)0); } + +#undef panel_userptr +void *panel_userptr( + const PANEL *pan) + { return(*(void **)0); } + +/* ./p_win.c */ + +#undef panel_window +WINDOW *panel_window( + const PANEL *pan) + { return(*(WINDOW **)0); } diff --git a/contrib/ncurses/panel/modules b/contrib/ncurses/panel/modules new file mode 100644 index 0000000..ed51d2c --- /dev/null +++ b/contrib/ncurses/panel/modules @@ -0,0 +1,49 @@ +############################################################################## +# Copyright (c) 1998 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"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey <dickey@clark.net> 1995,1997 +# + +@ base +# Library objects +panel lib $(srcdir) $(PANEL_PRIV_H) +p_above lib $(srcdir) $(PANEL_PRIV_H) +p_below lib $(srcdir) $(PANEL_PRIV_H) +p_bottom lib $(srcdir) $(PANEL_PRIV_H) +p_delete lib $(srcdir) $(PANEL_PRIV_H) +p_hide lib $(srcdir) $(PANEL_PRIV_H) +p_hidden lib $(srcdir) $(PANEL_PRIV_H) +p_move lib $(srcdir) $(PANEL_PRIV_H) +p_new lib $(srcdir) $(PANEL_PRIV_H) +p_replace lib $(srcdir) $(PANEL_PRIV_H) +p_show lib $(srcdir) $(PANEL_PRIV_H) +p_top lib $(srcdir) $(PANEL_PRIV_H) +p_update lib $(srcdir) $(PANEL_PRIV_H) +p_user lib $(srcdir) $(PANEL_PRIV_H) +p_win lib $(srcdir) $(PANEL_PRIV_H) + diff --git a/contrib/ncurses/panel/p_above.c b/contrib/ncurses/panel/p_above.c new file mode 100644 index 0000000..0c3d10f --- /dev/null +++ b/contrib/ncurses/panel/p_above.c @@ -0,0 +1,51 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_above.c + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_above.c,v 1.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_below.c b/contrib/ncurses/panel/p_below.c new file mode 100644 index 0000000..7e0f2b2 --- /dev/null +++ b/contrib/ncurses/panel/p_below.c @@ -0,0 +1,53 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_below.c + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_below.c,v 1.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_bottom.c b/contrib/ncurses/panel/p_bottom.c new file mode 100644 index 0000000..47abc69 --- /dev/null +++ b/contrib/ncurses/panel/p_bottom.c @@ -0,0 +1,53 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* 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.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_delete.c b/contrib/ncurses/panel/p_delete.c new file mode 100644 index 0000000..aabccdc --- /dev/null +++ b/contrib/ncurses/panel/p_delete.c @@ -0,0 +1,53 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* 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.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_hidden.c b/contrib/ncurses/panel/p_hidden.c new file mode 100644 index 0000000..4b90a61 --- /dev/null +++ b/contrib/ncurses/panel/p_hidden.c @@ -0,0 +1,47 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_hidden.c + * Test whether or not panel is hidden + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_hidden.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int +panel_hidden(const PANEL *pan) +{ + if(!pan) + return(ERR); + return(_nc_panel_is_linked(pan) ? TRUE : FALSE); +} diff --git a/contrib/ncurses/panel/p_hide.c b/contrib/ncurses/panel/p_hide.c new file mode 100644 index 0000000..bc7c192 --- /dev/null +++ b/contrib/ncurses/panel/p_hide.c @@ -0,0 +1,99 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_hide.c + * Remove a panel from the stack + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_hide.c,v 1.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_move.c b/contrib/ncurses/panel/p_move.c new file mode 100644 index 0000000..6bec36b --- /dev/null +++ b/contrib/ncurses/panel/p_move.c @@ -0,0 +1,59 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_move.c + * Move a panel to a new location + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_move.c,v 1.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_new.c b/contrib/ncurses/panel/p_new.c new file mode 100644 index 0000000..b4acc27 --- /dev/null +++ b/contrib/ncurses/panel/p_new.c @@ -0,0 +1,99 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_new.c + * Creation of a new panel + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_new.c,v 1.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_replace.c b/contrib/ncurses/panel/p_replace.c new file mode 100644 index 0000000..c34d51d --- /dev/null +++ b/contrib/ncurses/panel/p_replace.c @@ -0,0 +1,52 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_replace.c + * Replace a panels window. + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_replace.c,v 1.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_show.c b/contrib/ncurses/panel/p_show.c new file mode 100644 index 0000000..10781ef --- /dev/null +++ b/contrib/ncurses/panel/p_show.c @@ -0,0 +1,76 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* 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.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_top.c b/contrib/ncurses/panel/p_top.c new file mode 100644 index 0000000..2ce5bb3 --- /dev/null +++ b/contrib/ncurses/panel/p_top.c @@ -0,0 +1,45 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_top.c + * Place a panel on top of the stack. + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_top.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +int +top_panel(PANEL *pan) +{ + return(show_panel(pan)); +} diff --git a/contrib/ncurses/panel/p_update.c b/contrib/ncurses/panel/p_update.c new file mode 100644 index 0000000..e7e31ef --- /dev/null +++ b/contrib/ncurses/panel/p_update.c @@ -0,0 +1,61 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_update.c + * wnoutrefresh windows in an orderly fashion + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_update.c,v 1.2 1998/02/11 12:14:01 tom 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/contrib/ncurses/panel/p_user.c b/contrib/ncurses/panel/p_user.c new file mode 100644 index 0000000..28b6526 --- /dev/null +++ b/contrib/ncurses/panel/p_user.c @@ -0,0 +1,55 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_user.c + * Set/Get panels user pointer + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_user.c,v 1.3 1998/02/11 12:14:01 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/contrib/ncurses/panel/p_win.c b/contrib/ncurses/panel/p_win.c new file mode 100644 index 0000000..9c5a313 --- /dev/null +++ b/contrib/ncurses/panel/p_win.c @@ -0,0 +1,49 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* p_win.c + * Return a panels window. + */ +#include "panel.priv.h" + +MODULE_ID("$Id: p_win.c,v 1.2 1998/02/11 12:14:01 tom Exp $") + +WINDOW* +panel_window(const PANEL *pan) +{ + return(pan ? pan->win : (WINDOW *)0); +} + + + + diff --git a/contrib/ncurses/panel/panel.c b/contrib/ncurses/panel/panel.c new file mode 100644 index 0000000..7496643 --- /dev/null +++ b/contrib/ncurses/panel/panel.c @@ -0,0 +1,308 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* 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 $") + +#ifdef TRACE +#ifndef TRACE_TXT +const char *_nc_my_visbuf(const void *ptr) +{ + char temp[32]; + if (ptr != 0) + sprintf(temp, "ptr:%p", ptr); + else + strcpy(temp, "<null>"); + return _nc_visbuf(temp); +} +#endif +#endif + + +/*+------------------------------------------------------------------------- + dPanel(text,pan) +--------------------------------------------------------------------------*/ +#ifdef TRACE +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); +} +#endif + +/*+------------------------------------------------------------------------- + dStack(fmt,num,pan) +--------------------------------------------------------------------------*/ +#ifdef TRACE +void +_nc_dStack(const char *fmt, int num, const PANEL *pan) +{ + char s80[80]; + + sprintf(s80,fmt,num,pan); + _tracef("%s b=%s t=%s",s80, + (_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 = _nc_bottom_panel; + while(pan) + { + dPanel("stk",pan); + pan = pan->above; + } +} +#endif + +/*+------------------------------------------------------------------------- + Wnoutrefresh(pan) - debugging hook for wnoutrefresh +--------------------------------------------------------------------------*/ +#ifdef TRACE +void +_nc_Wnoutrefresh(const PANEL *pan) +{ + dPanel("wnoutrefresh",pan); + wnoutrefresh(pan->win); +} +#endif + +/*+------------------------------------------------------------------------- + Touchpan(pan) +--------------------------------------------------------------------------*/ +#ifdef TRACE +void +_nc_Touchpan(const PANEL *pan) +{ + dPanel("Touchpan",pan); + touchwin(pan->win); +} +#endif + +/*+------------------------------------------------------------------------- + Touchline(pan,start,count) +--------------------------------------------------------------------------*/ +#ifdef TRACE +void +_nc_Touchline(const PANEL *pan, int start, int count) +{ + char s80[80]; + sprintf(s80,"Touchline s=%d c=%d",start,count); + dPanel(s80,pan); + touchline(pan->win,start,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; +#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 new file mode 100644 index 0000000..2ebc329 --- /dev/null +++ b/contrib/ncurses/panel/panel.h @@ -0,0 +1,81 @@ +/**************************************************************************** + * Copyright (c) 1998 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"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 * + * and: Eric S. Raymond <esr@snark.thyrsus.com> * + ****************************************************************************/ + +/* panel.h -- interface file for panels library */ + +#ifndef _PANEL_H +#define _PANEL_H + +#include <curses.h> + +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; + +#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 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 *); + +#if defined(__cplusplus) +} +#endif + +#endif /* _PANEL_H */ + +/* end of panel.h */ diff --git a/contrib/ncurses/panel/panel.priv.h b/contrib/ncurses/panel/panel.priv.h new file mode 100644 index 0000000..80b1d8f --- /dev/null +++ b/contrib/ncurses/panel/panel.priv.h @@ -0,0 +1,85 @@ +/* $Id: panel.priv.h,v 1.8 1997/10/21 10:19:37 juergen Exp $ */ + +#ifndef _PANEL_PRIV_H +#define _PANEL_PRIV_H + +#if HAVE_CONFIG_H +# include <ncurses_cfg.h> +#endif + +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#if HAVE_LIBDMALLOC +# include <dmalloc.h> /* Gray Watson's library */ +#endif + +#if HAVE_LIBDBMALLOC +# 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 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 *); +# 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 */ |