home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 5.ddi / C / WNSELECT.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  2.0 KB  |  73 lines

  1. /**
  2. *
  3. * Name        wnselect -- Set window for future I/O.
  4. *
  5. * Synopsis    presult = wnselect(pwin);
  6. *
  7. *        BWINDOW *presult  Pointer to newly-selected BWINDOW
  8. *                  structure, or NIL if failure.
  9. *        BWINDOW *pwin      Pointer to BWINDOW structure to
  10. *                  select.
  11. *
  12. * Description    This function designates a window to be "current".
  13. *        Subsequent C TOOLS PLUS window I/O requests will be
  14. *        directed to this window.  (Such I/O will not necessarily
  15. *        have visible effects if the window is designated
  16. *        "delayed" or is overlapped by another window.)
  17. *
  18. *        The window need not be currently displayed, but if it
  19. *        is, its device and page are made current (selected for C
  20. *        TOOLS PLUS screen I/O).
  21. *
  22. *        The window's cursor is not activated.  Another window on
  23. *        this display page may have been designated to have an
  24. *        active cursor via WNCURSOR.
  25. *
  26. *        An error occurs if pwin does not point to a valid window
  27. *        structure.
  28. *
  29. * Returns    presult       Pointer to newly-selected BWINDOW
  30. *                  structure, or NIL if failure.
  31. *        b_pcurwin      Pointer to newly-displayed BWINDOW
  32. *                  structure, or unchanged if failure.
  33. *        b_device      Current video display device.
  34. *        b_curpage      Current display page on that device.
  35. *        b_wnerr       Possible values:
  36. *                  (No change)       Success.
  37. *                  WN_BAD_WIN       *pwin is invalid.
  38. *                  WN_NOT_SHOWN       Internal error.
  39. *
  40. * Version    3.0  (C)Copyright Blaise Computing Inc. 1986
  41. *
  42. **/
  43.  
  44. #include <bwindow.h>
  45.  
  46. BWINDOW *b_pcurwin = 0;           /* Window selected for I/O.     */
  47.  
  48. BWINDOW *wnselect(pwin)
  49. BWINDOW *pwin;
  50. {
  51.     int old_npage;
  52.  
  53.     if (wnvalwin(pwin) == NIL)
  54.     {
  55.     wnerror(WN_BAD_WIN);
  56.     return NIL;
  57.     }
  58.  
  59.     if (   pwin->where_shown.dev == MONO
  60.     || pwin->where_shown.dev == COLOR)
  61.     {
  62.                       /* Select and validate device,  */
  63.                       /* page, and dimensions.          */
  64.     if (wnseldev(&pwin->where_shown,&pwin->img.dim,&old_npage))
  65.     {
  66.         wnerror(WN_NOT_SHOWN);
  67.         return NIL;
  68.     }
  69.     }
  70.  
  71.     return b_pcurwin = pwin;          /* Success.              */
  72. }
  73.