home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name wnredraw -- Redisplay all windows currently shown
- * on a display page and restore cursor.
- *
- * Synopsis result = wnredraw(dev,page);
- *
- * int result Error code, or WN_NO_ERROR if ok.
- * int dev Video display device (COLOR or MONO).
- * int page Video display page.
- *
- * Description This function redisplays all windows currently shown on
- * a video display page as they are currently recorded in
- * internal data structures. If one of the displayed
- * windows is designated to have an active cursor, then its
- * cursor is restored. Hidden windows retain their borders
- * and positions but are not displayed.
- *
- * The designated device and page are made current.
- *
- * As removable windows are redisplayed, their recorded
- * copies of the previous screen contents are NOT changed.
- *
- * An error occurs if dev or page refers to an unavailable
- * video device or display page.
- *
- * Returns result Possible values:
- * WN_NO_ERROR Success.
- * WN_BAD_DEV Invalid dev.
- * WN_BAD_PAGE Invalid page.
- * WN_BAD_NODE Internal error.
- * WN_BAD_WIN Internal error.
- * WN_COVERED Internal error.
- * WN_NOT_SHOWN Internal error.
- * WN_ILL_DIM Internal error.
- * WN_NULL_PTR Internal error.
- *
- * b_wnerr Possible values:
- * (No change) Success.
- * WN_BAD_DEV Invalid dev.
- * WN_BAD_PAGE Invalid page.
- * WN_BAD_NODE Internal error.
- * WN_BAD_WIN Internal error.
- * WN_COVERED Internal error.
- * WN_NOT_SHOWN Internal error.
- * WN_ILL_DIM Internal error.
- * WN_NULL_PTR Internal error.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- **/
-
- #include <bwindow.h>
-
- int redraw(WIN_NODE *); /* Internal function (see below)*/
-
- int wnredraw(dev,page)
- int dev,page;
- {
- int result;
- WIN_NODE *pnode;
-
- if (dev < 0 || dev > MAX_DEVICES) /* Make sure dev & page */
- return wnerror(WN_BAD_DEV); /* are at least within range */
- if (page < 0 || page > MAX_PAGES) /* for table lookups. */
- return wnerror(WN_BAD_PAGE);
-
- result = WN_NO_ERROR;
-
- /* If this page has windows, */
- if (NIL != (pnode = b_wnlist[dev][page]))
- {
- /* then redraw the windows. */
- result = redraw(pnode);
- /* If that was successful */
- if (WN_NO_ERROR == result
- /* and if a window has an */
- /* active cursor, */
- && NIL != (pnode = b_pactnode[dev][page]))
- {
- /* then activate the correct */
- /* cursor. */
- if (NIL == wncursor(pnode->pwin))
- result = b_wnerr;
- }
- }
-
- return result;
- }
-
- /**
- *
- * Name redraw -- Redisplay all windows currently shown
- * on a display page at or below a given
- * window.
- *
- * Synopsis result = redraw(pnode);
- *
- * int result Error code, or WN_NO_ERROR if ok.
- * WIN_NODE *pnode Node of uppermost window to redisplay.
- *
- * Description This function redisplays a window currently shown on a
- * video display page (and all windows below it) as they
- * are currently recorded in internal data structures.
- * Hidden windows retain their borders and positions but
- * are not displayed.
- *
- * The device and page corresponding to this node are made
- * current.
- *
- * As removable windows are redisplayed, their recorded
- * copies of the previous screen contents are NOT changed.
- *
- * Returns result Possible values:
- * WN_NO_ERROR Success.
- * WN_BAD_DEV Internal error.
- * WN_BAD_PAGE Internal error.
- * WN_BAD_NODE Internal error.
- * WN_BAD_WIN Internal error.
- * WN_COVERED Internal error.
- * WN_NOT_SHOWN Internal error.
- * WN_ILL_DIM Internal error.
- * WN_NULL_PTR Internal error.
- *
- * b_wnerr Possible values:
- * (No change) Success.
- * (Same as "result" if internal error.)
- *
- **/
-
- static int redraw(pnode)
- WIN_NODE *pnode;
- {
- int result;
- BWINDOW *pwin;
-
- if (wnvalnod(pnode) == NIL)
- return wnerror(WN_BAD_NODE);
-
- pwin = pnode->pwin;
- if (wnvalwin(pwin) == NIL)
- return wnerror(WN_BAD_WIN);
-
- pwin->internals.temp_hid = 0; /* Clean up temp. flag. */
-
- /* Redraw lower windows before */
- /* handling this one. */
- if (pnode->below != NIL)
- if (WN_NO_ERROR != (result = redraw(pnode->below)))
- return result; /* Propagate error back upward. */
-
- if (!pwin->options.hidden)
- {
- /* Write border. */
- wnputbor(&pwin->img.dim,
- &pwin->bord,
- &pwin->where_shown);
-
- /* Write data. */
- if (NIL == wnputimg(&pwin->img,
- &pwin->where_shown))
- return b_wnerr;
- }
-
- pwin->internals.dirty = 0; /* Output is now up-to-date. */
-
- return WN_NO_ERROR;
- }