home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name wnselect -- Set window for future I/O.
- *
- * Synopsis presult = wnselect(pwin);
- *
- * BWINDOW *presult Pointer to newly-selected BWINDOW
- * structure, or NIL if failure.
- * BWINDOW *pwin Pointer to BWINDOW structure to
- * select.
- *
- * Description This function designates a window to be "current".
- * Subsequent C TOOLS PLUS window I/O requests will be
- * directed to this window. (Such I/O will not necessarily
- * have visible effects if the window is designated
- * "delayed" or is overlapped by another window.)
- *
- * The window need not be currently displayed, but if it
- * is, its device and page are made current (selected for C
- * TOOLS PLUS screen I/O).
- *
- * The window's cursor is not activated. Another window on
- * this display page may have been designated to have an
- * active cursor via WNCURSOR.
- *
- * An error occurs if pwin does not point to a valid window
- * structure.
- *
- * Returns presult Pointer to newly-selected BWINDOW
- * structure, or NIL if failure.
- * b_pcurwin Pointer to newly-displayed BWINDOW
- * structure, or unchanged if failure.
- * b_device Current video display device.
- * b_curpage Current display page on that device.
- * b_wnerr Possible values:
- * (No change) Success.
- * WN_BAD_WIN *pwin is invalid.
- * WN_NOT_SHOWN Internal error.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- **/
-
- #include <bwindow.h>
-
- BWINDOW *b_pcurwin = 0; /* Window selected for I/O. */
-
- BWINDOW *wnselect(pwin)
- BWINDOW *pwin;
- {
- int old_npage;
-
- if (wnvalwin(pwin) == NIL)
- {
- wnerror(WN_BAD_WIN);
- return NIL;
- }
-
- if ( pwin->where_shown.dev == MONO
- || pwin->where_shown.dev == COLOR)
- {
- /* Select and validate device, */
- /* page, and dimensions. */
- if (wnseldev(&pwin->where_shown,&pwin->img.dim,&old_npage))
- {
- wnerror(WN_NOT_SHOWN);
- return NIL;
- }
- }
-
- return b_pcurwin = pwin; /* Success. */
- }