1 /****************************************************************************
2 * Copyright 2020 Thomas E. Dickey *
3 * Copyright 1998-2010,2012 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 /****************************************************************************
31 * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
32 * and: Eric S. Raymond <esr@snark.thyrsus.com> *
33 * and: Juergen Pfeifer 1996-1999,2008 *
34 * and: Thomas E. Dickey *
35 ****************************************************************************/
37 /* panel.c -- implementation of panels library, some core routines */
38 #include "panel.priv.h"
40 MODULE_ID("$Id: panel.c,v 1.30 2020/09/26 18:05:17 tom Exp $")
42 /*+-------------------------------------------------------------------------
43 _nc_retrace_panel (pan)
44 --------------------------------------------------------------------------*/
47 _nc_retrace_panel(PANEL * pan)
49 T((T_RETURN("%p"), (void *)pan));
54 /*+-------------------------------------------------------------------------
56 --------------------------------------------------------------------------*/
59 PANEL_EXPORT(const char *)
60 _nc_my_visbuf(const void *ptr, int n)
65 _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%p", ptr);
67 _nc_STRCPY(temp, "<null>", sizeof(temp));
68 return _nc_visbuf2(n, temp);
73 /*+-------------------------------------------------------------------------
75 --------------------------------------------------------------------------*/
78 _nc_dPanel(const char *text, const PANEL * pan)
80 _tracef("%s id=%s b=%s a=%s y=%d x=%d",
81 text, USER_PTR(pan->user, 1),
82 (pan->below) ? USER_PTR(pan->below->user, 2) : "--",
83 (pan->above) ? USER_PTR(pan->above->user, 3) : "--",
84 PSTARTY(pan), PSTARTX(pan));
88 /*+-------------------------------------------------------------------------
90 --------------------------------------------------------------------------*/
93 _nc_dStack(const char *fmt, int num, const PANEL * pan)
99 _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) fmt, num, pan);
100 _tracef("%s b=%s t=%s", s80,
101 (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user, 1) : "--",
102 (_nc_top_panel) ? USER_PTR(_nc_top_panel->user, 2) : "--");
104 _tracef("pan id=%s", USER_PTR(pan->user, 1));
105 pan = _nc_bottom_panel;
114 /*+-------------------------------------------------------------------------
115 Wnoutrefresh(pan) - debugging hook for wnoutrefresh
116 --------------------------------------------------------------------------*/
119 _nc_Wnoutrefresh(const PANEL * pan)
121 dPanel("wnoutrefresh", pan);
122 wnoutrefresh(pan->win);
126 /*+-------------------------------------------------------------------------
128 --------------------------------------------------------------------------*/
131 _nc_Touchpan(const PANEL * pan)
133 dPanel("Touchpan", pan);
138 /*+-------------------------------------------------------------------------
139 Touchline(pan,start,count)
140 --------------------------------------------------------------------------*/
143 _nc_Touchline(const PANEL * pan, int start, int count)
147 _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) "Touchline s=%d c=%d", start, count);
149 touchline(pan->win, start, count);
155 /* Some C compilers need something defined in a source file */
156 extern void _nc_dummy_panel(void);
158 _nc_dummy_panel(void)