panel.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /****************************************************************************
  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. * Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1995 *
  30. * and: Eric S. Raymond <esr@snark.thyrsus.com> *
  31. ****************************************************************************/
  32. /* panel.c -- implementation of panels library, some core routines */
  33. #include "panel.priv.h"
  34. MODULE_ID("$Id: panel.c,v 1.23 2005/02/19 18:04:31 tom Exp $")
  35. /*+-------------------------------------------------------------------------
  36. _nc_retrace_panel (pan)
  37. --------------------------------------------------------------------------*/
  38. #ifdef TRACE
  39. NCURSES_EXPORT(PANEL *)
  40. _nc_retrace_panel(PANEL * pan)
  41. {
  42. T((T_RETURN("%p"), pan));
  43. return pan;
  44. }
  45. #endif
  46. /*+-------------------------------------------------------------------------
  47. _nc_my_visbuf(ptr)
  48. --------------------------------------------------------------------------*/
  49. #ifdef TRACE
  50. #ifndef TRACE_TXT
  51. NCURSES_EXPORT(const char *)
  52. _nc_my_visbuf(const void *ptr)
  53. {
  54. char temp[32];
  55. if (ptr != 0)
  56. sprintf(temp, "ptr:%p", ptr);
  57. else
  58. strcpy(temp, "<null>");
  59. return _nc_visbuf(temp);
  60. }
  61. #endif
  62. #endif
  63. /*+-------------------------------------------------------------------------
  64. dPanel(text,pan)
  65. --------------------------------------------------------------------------*/
  66. #ifdef TRACE
  67. NCURSES_EXPORT(void)
  68. _nc_dPanel(const char *text, const PANEL * pan)
  69. {
  70. _tracef("%s id=%s b=%s a=%s y=%d x=%d",
  71. text, USER_PTR(pan->user),
  72. (pan->below) ? USER_PTR(pan->below->user) : "--",
  73. (pan->above) ? USER_PTR(pan->above->user) : "--",
  74. PSTARTY(pan), PSTARTX(pan));
  75. }
  76. #endif
  77. /*+-------------------------------------------------------------------------
  78. dStack(fmt,num,pan)
  79. --------------------------------------------------------------------------*/
  80. #ifdef TRACE
  81. NCURSES_EXPORT(void)
  82. _nc_dStack(const char *fmt, int num, const PANEL * pan)
  83. {
  84. char s80[80];
  85. sprintf(s80, fmt, num, pan);
  86. _tracef("%s b=%s t=%s", s80,
  87. (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--",
  88. (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--");
  89. if (pan)
  90. _tracef("pan id=%s", USER_PTR(pan->user));
  91. pan = _nc_bottom_panel;
  92. while (pan)
  93. {
  94. dPanel("stk", pan);
  95. pan = pan->above;
  96. }
  97. }
  98. #endif
  99. /*+-------------------------------------------------------------------------
  100. Wnoutrefresh(pan) - debugging hook for wnoutrefresh
  101. --------------------------------------------------------------------------*/
  102. #ifdef TRACE
  103. NCURSES_EXPORT(void)
  104. _nc_Wnoutrefresh(const PANEL * pan)
  105. {
  106. dPanel("wnoutrefresh", pan);
  107. wnoutrefresh(pan->win);
  108. }
  109. #endif
  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. Touchline(pan,start,count)
  123. --------------------------------------------------------------------------*/
  124. #ifdef TRACE
  125. NCURSES_EXPORT(void)
  126. _nc_Touchline(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. #ifndef TRACE
  135. # ifndef __GNUC__
  136. /* Some C compilers need something defined in a source file */
  137. extern void _nc_dummy_panel(void);
  138. void
  139. _nc_dummy_panel(void)
  140. {
  141. }
  142. # endif
  143. #endif