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