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