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