1999-08-24 01:06:48 +00:00
|
|
|
/****************************************************************************
|
2020-02-19 16:58:06 +00:00
|
|
|
* Copyright 2020 Thomas E. Dickey *
|
|
|
|
* Copyright 1998-2010,2012 Free Software Foundation, Inc. *
|
1999-08-24 01:06:48 +00:00
|
|
|
* *
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a *
|
|
|
|
* copy of this software and associated documentation files (the *
|
|
|
|
* "Software"), to deal in the Software without restriction, including *
|
|
|
|
* without limitation the rights to use, copy, modify, merge, publish, *
|
|
|
|
* distribute, distribute with modifications, sublicense, and/or sell *
|
|
|
|
* copies of the Software, and to permit persons to whom the Software is *
|
|
|
|
* furnished to do so, subject to the following conditions: *
|
|
|
|
* *
|
|
|
|
* The above copyright notice and this permission notice shall be included *
|
|
|
|
* in all copies or substantial portions of the Software. *
|
|
|
|
* *
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
|
|
|
* IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
|
|
|
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
|
|
|
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
|
|
|
* THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
|
|
|
* *
|
|
|
|
* Except as contained in this notice, the name(s) of the above copyright *
|
|
|
|
* holders shall not be used in advertising or otherwise to promote the *
|
|
|
|
* sale, use or other dealings in this Software without prior written *
|
|
|
|
* authorization. *
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
|
|
|
|
* and: Eric S. Raymond <esr@snark.thyrsus.com> *
|
2014-02-28 19:18:07 +00:00
|
|
|
* and: Juergen Pfeifer 1996-1999,2008 *
|
|
|
|
* and: Thomas E. Dickey *
|
1999-08-24 01:06:48 +00:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/* panel.c -- implementation of panels library, some core routines */
|
|
|
|
#include "panel.priv.h"
|
|
|
|
|
2021-02-25 17:22:00 +00:00
|
|
|
MODULE_ID("$Id: panel.c,v 1.30 2020/09/26 18:05:17 tom Exp $")
|
1999-08-24 01:06:48 +00:00
|
|
|
|
2007-01-20 07:32:02 +00:00
|
|
|
/*+-------------------------------------------------------------------------
|
|
|
|
_nc_retrace_panel (pan)
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
#ifdef TRACE
|
2021-02-25 17:22:00 +00:00
|
|
|
PANEL_EXPORT(PANEL *)
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_retrace_panel(PANEL * pan)
|
|
|
|
{
|
2014-02-28 19:18:07 +00:00
|
|
|
T((T_RETURN("%p"), (void *)pan));
|
2007-01-20 07:32:02 +00:00
|
|
|
return pan;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*+-------------------------------------------------------------------------
|
|
|
|
_nc_my_visbuf(ptr)
|
|
|
|
--------------------------------------------------------------------------*/
|
1999-08-24 01:06:48 +00:00
|
|
|
#ifdef TRACE
|
|
|
|
#ifndef TRACE_TXT
|
2021-02-25 17:22:00 +00:00
|
|
|
PANEL_EXPORT(const char *)
|
|
|
|
_nc_my_visbuf(const void *ptr, int n)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
char temp[32];
|
|
|
|
|
|
|
|
if (ptr != 0)
|
2021-02-25 17:22:00 +00:00
|
|
|
_nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%p", ptr);
|
2007-01-20 07:32:02 +00:00
|
|
|
else
|
2014-03-01 00:40:26 +00:00
|
|
|
_nc_STRCPY(temp, "<null>", sizeof(temp));
|
2021-02-25 17:22:00 +00:00
|
|
|
return _nc_visbuf2(n, temp);
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*+-------------------------------------------------------------------------
|
|
|
|
dPanel(text,pan)
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
#ifdef TRACE
|
2021-02-25 17:22:00 +00:00
|
|
|
PANEL_EXPORT(void)
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_dPanel(const char *text, const PANEL * pan)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
_tracef("%s id=%s b=%s a=%s y=%d x=%d",
|
2021-02-25 17:22:00 +00:00
|
|
|
text, USER_PTR(pan->user, 1),
|
|
|
|
(pan->below) ? USER_PTR(pan->below->user, 2) : "--",
|
|
|
|
(pan->above) ? USER_PTR(pan->above->user, 3) : "--",
|
2007-01-20 07:32:02 +00:00
|
|
|
PSTARTY(pan), PSTARTX(pan));
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*+-------------------------------------------------------------------------
|
|
|
|
dStack(fmt,num,pan)
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
#ifdef TRACE
|
2021-02-25 17:22:00 +00:00
|
|
|
PANEL_EXPORT(void)
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_dStack(const char *fmt, int num, const PANEL * pan)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
|
|
|
char s80[80];
|
|
|
|
|
2014-02-28 19:18:07 +00:00
|
|
|
GetPanelHook(pan);
|
|
|
|
|
2014-03-01 00:40:26 +00:00
|
|
|
_nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) fmt, num, pan);
|
2007-01-20 07:32:02 +00:00
|
|
|
_tracef("%s b=%s t=%s", s80,
|
2021-02-25 17:22:00 +00:00
|
|
|
(_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user, 1) : "--",
|
|
|
|
(_nc_top_panel) ? USER_PTR(_nc_top_panel->user, 2) : "--");
|
2007-01-20 07:32:02 +00:00
|
|
|
if (pan)
|
2021-02-25 17:22:00 +00:00
|
|
|
_tracef("pan id=%s", USER_PTR(pan->user, 1));
|
1999-08-24 01:06:48 +00:00
|
|
|
pan = _nc_bottom_panel;
|
2007-01-20 07:32:02 +00:00
|
|
|
while (pan)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
dPanel("stk", pan);
|
1999-08-24 01:06:48 +00:00
|
|
|
pan = pan->above;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*+-------------------------------------------------------------------------
|
|
|
|
Wnoutrefresh(pan) - debugging hook for wnoutrefresh
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
#ifdef TRACE
|
2021-02-25 17:22:00 +00:00
|
|
|
PANEL_EXPORT(void)
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_Wnoutrefresh(const PANEL * pan)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
dPanel("wnoutrefresh", pan);
|
1999-08-24 01:06:48 +00:00
|
|
|
wnoutrefresh(pan->win);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*+-------------------------------------------------------------------------
|
|
|
|
Touchpan(pan)
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
#ifdef TRACE
|
2021-02-25 17:22:00 +00:00
|
|
|
PANEL_EXPORT(void)
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_Touchpan(const PANEL * pan)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
2007-01-20 07:32:02 +00:00
|
|
|
dPanel("Touchpan", pan);
|
1999-08-24 01:06:48 +00:00
|
|
|
touchwin(pan->win);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*+-------------------------------------------------------------------------
|
|
|
|
Touchline(pan,start,count)
|
|
|
|
--------------------------------------------------------------------------*/
|
|
|
|
#ifdef TRACE
|
2021-02-25 17:22:00 +00:00
|
|
|
PANEL_EXPORT(void)
|
2007-01-20 07:32:02 +00:00
|
|
|
_nc_Touchline(const PANEL * pan, int start, int count)
|
1999-08-24 01:06:48 +00:00
|
|
|
{
|
|
|
|
char s80[80];
|
2007-01-20 07:32:02 +00:00
|
|
|
|
2014-03-01 00:40:26 +00:00
|
|
|
_nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) "Touchline s=%d c=%d", start, count);
|
2007-01-20 07:32:02 +00:00
|
|
|
dPanel(s80, pan);
|
|
|
|
touchline(pan->win, start, count);
|
1999-08-24 01:06:48 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2000-01-26 16:43:25 +00:00
|
|
|
#ifndef TRACE
|
|
|
|
# ifndef __GNUC__
|
|
|
|
/* Some C compilers need something defined in a source file */
|
2007-01-20 07:32:02 +00:00
|
|
|
extern void _nc_dummy_panel(void);
|
|
|
|
void
|
|
|
|
_nc_dummy_panel(void)
|
|
|
|
{
|
|
|
|
}
|
2000-01-26 16:43:25 +00:00
|
|
|
# endif
|
1999-08-24 01:06:48 +00:00
|
|
|
#endif
|