blob: 97bebca9c0694094f46a8c5753729b39582115c7 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301/****************************************************************************
Steve Kondikae271bc2015-11-15 02:50:53 +01002 * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc. *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05303 * *
4 * Permission is hereby granted, free of charge, to any person obtaining a *
5 * copy of this software and associated documentation files (the *
6 * "Software"), to deal in the Software without restriction, including *
7 * without limitation the rights to use, copy, modify, merge, publish, *
8 * distribute, distribute with modifications, sublicense, and/or sell *
9 * copies of the Software, and to permit persons to whom the Software is *
10 * furnished to do so, subject to the following conditions: *
11 * *
12 * The above copyright notice and this permission notice shall be included *
13 * in all copies or substantial portions of the Software. *
14 * *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22 * *
23 * Except as contained in this notice, the name(s) of the above copyright *
24 * holders shall not be used in advertising or otherwise to promote the *
25 * sale, use or other dealings in this Software without prior written *
26 * authorization. *
27 ****************************************************************************/
28
29/****************************************************************************
30 * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
31 * and: Eric S. Raymond <esr@snark.thyrsus.com> *
Steve Kondikae271bc2015-11-15 02:50:53 +010032 * and: Juergen Pfeifer 1996-1999,2008 *
33 * and: Thomas E. Dickey *
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053034 ****************************************************************************/
35
36/* panel.c -- implementation of panels library, some core routines */
37#include "panel.priv.h"
38
Steve Kondikae271bc2015-11-15 02:50:53 +010039MODULE_ID("$Id: panel.c,v 1.26 2012/02/23 10:02:15 tom Exp $")
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053040
41/*+-------------------------------------------------------------------------
42 _nc_retrace_panel (pan)
43--------------------------------------------------------------------------*/
44#ifdef TRACE
45NCURSES_EXPORT(PANEL *)
46_nc_retrace_panel(PANEL * pan)
47{
Steve Kondikae271bc2015-11-15 02:50:53 +010048 T((T_RETURN("%p"), (void *)pan));
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053049 return pan;
50}
51#endif
52
53/*+-------------------------------------------------------------------------
54 _nc_my_visbuf(ptr)
55--------------------------------------------------------------------------*/
56#ifdef TRACE
57#ifndef TRACE_TXT
58NCURSES_EXPORT(const char *)
59_nc_my_visbuf(const void *ptr)
60{
61 char temp[32];
62
63 if (ptr != 0)
Steve Kondikae271bc2015-11-15 02:50:53 +010064 _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "ptr:%p", ptr);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053065 else
Steve Kondikae271bc2015-11-15 02:50:53 +010066 _nc_STRCPY(temp, "<null>", sizeof(temp));
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053067 return _nc_visbuf(temp);
68}
69#endif
70#endif
71
72/*+-------------------------------------------------------------------------
73 dPanel(text,pan)
74--------------------------------------------------------------------------*/
75#ifdef TRACE
76NCURSES_EXPORT(void)
77_nc_dPanel(const char *text, const PANEL * pan)
78{
79 _tracef("%s id=%s b=%s a=%s y=%d x=%d",
80 text, USER_PTR(pan->user),
81 (pan->below) ? USER_PTR(pan->below->user) : "--",
82 (pan->above) ? USER_PTR(pan->above->user) : "--",
83 PSTARTY(pan), PSTARTX(pan));
84}
85#endif
86
87/*+-------------------------------------------------------------------------
88 dStack(fmt,num,pan)
89--------------------------------------------------------------------------*/
90#ifdef TRACE
91NCURSES_EXPORT(void)
92_nc_dStack(const char *fmt, int num, const PANEL * pan)
93{
94 char s80[80];
95
Steve Kondikae271bc2015-11-15 02:50:53 +010096 GetPanelHook(pan);
97
98 _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) fmt, num, pan);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053099 _tracef("%s b=%s t=%s", s80,
100 (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--",
101 (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--");
102 if (pan)
103 _tracef("pan id=%s", USER_PTR(pan->user));
104 pan = _nc_bottom_panel;
105 while (pan)
106 {
107 dPanel("stk", pan);
108 pan = pan->above;
109 }
110}
111#endif
112
113/*+-------------------------------------------------------------------------
114 Wnoutrefresh(pan) - debugging hook for wnoutrefresh
115--------------------------------------------------------------------------*/
116#ifdef TRACE
117NCURSES_EXPORT(void)
118_nc_Wnoutrefresh(const PANEL * pan)
119{
120 dPanel("wnoutrefresh", pan);
121 wnoutrefresh(pan->win);
122}
123#endif
124
125/*+-------------------------------------------------------------------------
126 Touchpan(pan)
127--------------------------------------------------------------------------*/
128#ifdef TRACE
129NCURSES_EXPORT(void)
130_nc_Touchpan(const PANEL * pan)
131{
132 dPanel("Touchpan", pan);
133 touchwin(pan->win);
134}
135#endif
136
137/*+-------------------------------------------------------------------------
138 Touchline(pan,start,count)
139--------------------------------------------------------------------------*/
140#ifdef TRACE
141NCURSES_EXPORT(void)
142_nc_Touchline(const PANEL * pan, int start, int count)
143{
144 char s80[80];
145
Steve Kondikae271bc2015-11-15 02:50:53 +0100146 _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) "Touchline s=%d c=%d", start, count);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530147 dPanel(s80, pan);
148 touchline(pan->win, start, count);
149}
150#endif
151
152#ifndef TRACE
153# ifndef __GNUC__
154 /* Some C compilers need something defined in a source file */
155extern void _nc_dummy_panel(void);
156void
157_nc_dummy_panel(void)
158{
159}
160# endif
161#endif