blob: 16a8083d64b2a524044a134daff17edaa6eb0202 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301/****************************************************************************
2 * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
3 * *
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> *
32 ****************************************************************************/
33
34/* panel.c -- implementation of panels library, some core routines */
35#include "panel.priv.h"
36
37MODULE_ID("$Id: panel.c,v 1.23 2005/02/19 18:04:31 tom Exp $")
38
39/*+-------------------------------------------------------------------------
40 _nc_retrace_panel (pan)
41--------------------------------------------------------------------------*/
42#ifdef TRACE
43NCURSES_EXPORT(PANEL *)
44_nc_retrace_panel(PANEL * pan)
45{
46 T((T_RETURN("%p"), pan));
47 return pan;
48}
49#endif
50
51/*+-------------------------------------------------------------------------
52 _nc_my_visbuf(ptr)
53--------------------------------------------------------------------------*/
54#ifdef TRACE
55#ifndef TRACE_TXT
56NCURSES_EXPORT(const char *)
57_nc_my_visbuf(const void *ptr)
58{
59 char temp[32];
60
61 if (ptr != 0)
62 sprintf(temp, "ptr:%p", ptr);
63 else
64 strcpy(temp, "<null>");
65 return _nc_visbuf(temp);
66}
67#endif
68#endif
69
70/*+-------------------------------------------------------------------------
71 dPanel(text,pan)
72--------------------------------------------------------------------------*/
73#ifdef TRACE
74NCURSES_EXPORT(void)
75_nc_dPanel(const char *text, const PANEL * pan)
76{
77 _tracef("%s id=%s b=%s a=%s y=%d x=%d",
78 text, USER_PTR(pan->user),
79 (pan->below) ? USER_PTR(pan->below->user) : "--",
80 (pan->above) ? USER_PTR(pan->above->user) : "--",
81 PSTARTY(pan), PSTARTX(pan));
82}
83#endif
84
85/*+-------------------------------------------------------------------------
86 dStack(fmt,num,pan)
87--------------------------------------------------------------------------*/
88#ifdef TRACE
89NCURSES_EXPORT(void)
90_nc_dStack(const char *fmt, int num, const PANEL * pan)
91{
92 char s80[80];
93
94 sprintf(s80, fmt, num, pan);
95 _tracef("%s b=%s t=%s", s80,
96 (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--",
97 (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--");
98 if (pan)
99 _tracef("pan id=%s", USER_PTR(pan->user));
100 pan = _nc_bottom_panel;
101 while (pan)
102 {
103 dPanel("stk", pan);
104 pan = pan->above;
105 }
106}
107#endif
108
109/*+-------------------------------------------------------------------------
110 Wnoutrefresh(pan) - debugging hook for wnoutrefresh
111--------------------------------------------------------------------------*/
112#ifdef TRACE
113NCURSES_EXPORT(void)
114_nc_Wnoutrefresh(const PANEL * pan)
115{
116 dPanel("wnoutrefresh", pan);
117 wnoutrefresh(pan->win);
118}
119#endif
120
121/*+-------------------------------------------------------------------------
122 Touchpan(pan)
123--------------------------------------------------------------------------*/
124#ifdef TRACE
125NCURSES_EXPORT(void)
126_nc_Touchpan(const PANEL * pan)
127{
128 dPanel("Touchpan", pan);
129 touchwin(pan->win);
130}
131#endif
132
133/*+-------------------------------------------------------------------------
134 Touchline(pan,start,count)
135--------------------------------------------------------------------------*/
136#ifdef TRACE
137NCURSES_EXPORT(void)
138_nc_Touchline(const PANEL * pan, int start, int count)
139{
140 char s80[80];
141
142 sprintf(s80, "Touchline s=%d c=%d", start, count);
143 dPanel(s80, pan);
144 touchline(pan->win, start, count);
145}
146#endif
147
148#ifndef TRACE
149# ifndef __GNUC__
150 /* Some C compilers need something defined in a source file */
151extern void _nc_dummy_panel(void);
152void
153_nc_dummy_panel(void)
154{
155}
156# endif
157#endif