home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 332_01 / options.c < prev    next >
C/C++ Source or Header  |  1990-01-06  |  5KB  |  138 lines

  1. /****************************************************************/
  2. /* Idlok(), clearok(), leaveok(), scrollok(), nodelay(), key-    */
  3. /* pad(), meta(), cursoff() and curson() routines of the    */
  4. /* PCcurses package.                        */
  5. /*                                */
  6. /****************************************************************/
  7. /* This version of curses is based on ncurses, a curses version    */
  8. /* originally written by Pavel Curtis at Cornell University.    */
  9. /* I have made substantial changes to make it run on IBM PC's,    */
  10. /* and therefore consider myself free to make it public domain.    */
  11. /*                Bjorn Larsson (bl@infovox.se)    */
  12. /****************************************************************/
  13. /* 1.4:  Use of short wherever possible. Portability        */
  14. /*     improvements:                    900114    */
  15. /* 1.3:     MSC -W3, Turbo'C' -w -w-pro checkes:        881005    */
  16. /* 1.2:     Rcsid[] string for maintenance:        881002    */
  17. /* 1.0:     Release:                    870515    */
  18. /****************************************************************/
  19.  
  20. #include <curses.h>
  21. #include <curspriv.h>
  22.  
  23. char _curses_options_rcsid[] = "@(#)option.c     v.1.4  - 900114";
  24.  
  25. static bool    hasold = FALSE;        /* for remembering old cursor type */
  26. static int    oldmode;
  27.  
  28. /****************************************************************/
  29. /* Idlok() is used to set  flag for using the terminal insert/    */
  30. /* delete line capabilities. This is not relevant for the PC    */
  31. /* version of curses, and thus nothing is done.            */
  32. /****************************************************************/
  33.  
  34. void idlok()
  35.   {
  36.   } /* idlok */
  37.  
  38. /****************************************************************/
  39. /* Clearok() marks window 'win' to cause screen clearing and    */
  40. /* redraw the next time a refresh is done.            */
  41. /****************************************************************/
  42.  
  43. void clearok(win, flag)
  44.   WINDOW    *win;
  45.   bool         flag;
  46.   {
  47.   if (win == curscr)
  48.     _cursvar.tmpwin->_clear = flag;
  49.   else
  50.     win->_clear = flag;
  51.   } /* clearok */
  52.  
  53. /****************************************************************/
  54. /* Leaveok() marks window 'win' to allow the update routines    */
  55. /* to leave the hardware cursor where it happens to be at the    */
  56. /* end of update. Usually used in combination with cursoff().    */
  57. /****************************************************************/
  58.  
  59. void leaveok(win, flag)
  60.   WINDOW    *win;
  61.   bool         flag;
  62.   {
  63.   win->_leave = flag;
  64.   } /* leaveok */
  65.  
  66. /****************************************************************/
  67. /* Scrollok() marks window 'win' to allow the scrolling region    */
  68. /* of it to actually scroll.                    */
  69. /****************************************************************/
  70.  
  71. void scrollok(win, flag)
  72.   WINDOW    *win;
  73.   bool         flag;
  74.   {
  75.   win->_scroll = flag;
  76.   } /* scrollok */
  77.  
  78. /****************************************************************/
  79. /* Nodelay() marks the window to make character input non-    */
  80. /* waiting, i.e. if there is no character to get, -1 will be    */
  81. /* returned.                            */
  82. /****************************************************************/
  83.  
  84. void nodelay(win, flag)
  85.   WINDOW    *win;
  86.   bool         flag;
  87.   {
  88.   win->_nodelay = flag;
  89.   } /* nodelay */
  90.  
  91. /****************************************************************/
  92. /* Keypad() marks window 'win' to use the special keypad mode.    */
  93. /****************************************************************/
  94.  
  95. void keypad(win, flag)
  96.   WINDOW    *win;
  97.   bool         flag;
  98.   {
  99.   win->_keypad = flag;
  100.   } /* keypad */
  101.  
  102. /****************************************************************/
  103. /* Meta() allows use of any alternate character set allowed by    */
  104. /* the terminal. We always allow this on the PC, so this one    */
  105. /* does nothing.                        */
  106. /****************************************************************/
  107.  
  108. void meta()
  109.   {
  110.   } /* meta */
  111.  
  112. /****************************************************************/
  113. /* Cursoff() turns off the hardware cursor.            */
  114. /****************************************************************/
  115.  
  116. void cursoff()
  117.   {
  118.   if (!hasold)
  119.     {
  120.     oldmode = _cursesgcmode();        /* get old cursor type */
  121.     hasold = TRUE;
  122.     }
  123.   _cursescmode(31,30);            /* turn it off */
  124.   } /* cursoff */
  125.  
  126. /****************************************************************/
  127. /* Curson() turns on the hardware cursor.            */
  128. /****************************************************************/
  129.  
  130. void curson()
  131.   {
  132.   if (hasold)
  133.     {
  134.     _cursescmode(oldmode >> 8,oldmode);
  135.     hasold = FALSE;
  136.     }
  137.   } /* curson */
  138.