1 /**************************************************************************** 2 * Copyright (c) 1998,2000 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 37 MODULE_ID("$Id: panel.c,v 1.20 2001/02/24 23:17:26 tom Exp $") 38 39 #ifdef TRACE 40 #ifndef TRACE_TXT 41 NCURSES_EXPORT(const char *) 42 _nc_my_visbuf (const void *ptr) 43 { 44 char temp[32]; 45 if (ptr != 0) 46 sprintf(temp, "ptr:%p", ptr); 47 else 48 strcpy(temp, "<null>"); 49 return _nc_visbuf(temp); 50 } 51 #endif 52 #endif 53 54 55 /*+------------------------------------------------------------------------- 56 dPanel(text,pan) 57 --------------------------------------------------------------------------*/ 58 #ifdef TRACE 59 NCURSES_EXPORT(void) 60 _nc_dPanel 61 (const char *text, const PANEL *pan) 62 { 63 _tracef("%s id=%s b=%s a=%s y=%d x=%d", 64 text, USER_PTR(pan->user), 65 (pan->below) ? USER_PTR(pan->below->user) : "--", 66 (pan->above) ? USER_PTR(pan->above->user) : "--", 67 PSTARTY(pan), PSTARTX(pan)); 68 } 69 #endif 70 71 /*+------------------------------------------------------------------------- 72 dStack(fmt,num,pan) 73 --------------------------------------------------------------------------*/ 74 #ifdef TRACE 75 NCURSES_EXPORT(void) 76 _nc_dStack 77 (const char *fmt, int num, const PANEL *pan) 78 { 79 char s80[80]; 80 81 sprintf(s80,fmt,num,pan); 82 _tracef("%s b=%s t=%s",s80, 83 (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--", 84 (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--"); 85 if(pan) 86 _tracef("pan id=%s", USER_PTR(pan->user)); 87 pan = _nc_bottom_panel; 88 while(pan) 89 { 90 dPanel("stk",pan); 91 pan = pan->above; 92 } 93 } 94 #endif 95 96 /*+------------------------------------------------------------------------- 97 Wnoutrefresh(pan) - debugging hook for wnoutrefresh 98 --------------------------------------------------------------------------*/ 99 #ifdef TRACE 100 NCURSES_EXPORT(void) 101 _nc_Wnoutrefresh (const PANEL *pan) 102 { 103 dPanel("wnoutrefresh",pan); 104 wnoutrefresh(pan->win); 105 } 106 #endif 107 108 /*+------------------------------------------------------------------------- 109 Touchpan(pan) 110 --------------------------------------------------------------------------*/ 111 #ifdef TRACE 112 NCURSES_EXPORT(void) 113 _nc_Touchpan (const PANEL *pan) 114 { 115 dPanel("Touchpan",pan); 116 touchwin(pan->win); 117 } 118 #endif 119 120 /*+------------------------------------------------------------------------- 121 Touchline(pan,start,count) 122 --------------------------------------------------------------------------*/ 123 #ifdef TRACE 124 NCURSES_EXPORT(void) 125 _nc_Touchline 126 (const PANEL *pan, int start, int count) 127 { 128 char s80[80]; 129 sprintf(s80,"Touchline s=%d c=%d",start,count); 130 dPanel(s80,pan); 131 touchline(pan->win,start,count); 132 } 133 #endif 134 135 #ifndef TRACE 136 # ifndef __GNUC__ 137 /* Some C compilers need something defined in a source file */ 138 void _nc_dummy_panel(void) { } 139 # endif 140 #endif 141