home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name wnforget -- Detach window from screen location
- * without cleaning screen up.
- *
- * Synopsis presult = wnforget(pwin);
- *
- * BWINDOW *presult Pointer to newly-removed BWINDOW
- * structure, or NIL if failure.
- * BWINDOW *pwin Pointer to BWINDOW structure to
- * remove.
- *
- * Description This function "removes" a window from the video display
- * page where it is displayed without actually modifying
- * any displayed characters. That is, the previous screen
- * data is not replaced (even in the case of a removable
- * window).
- *
- * An error occurs if pwin does not point to a valid window
- * structure or if the window is not currently displayed.
- *
- * Use WNREMOVE to gracefully clean up the screen as the
- * window is detached from it. Use WNDSTROY (with or
- * without WNFORGET) to discard the entire window structure
- * as well.
- *
- * Returns presult Pointer to newly-removed BWINDOW
- * structure, or NIL if failure.
- * *pwin Several fields altered.
- * b_pactnode[][] Window node with active cursor.
- * b_wnerr Possible values:
- * (No change) Success.
- * WN_BAD_WIN *pwin is invalid.
- * WN_NOT_SHOWN Not currently shown.
- * WN_BAD_NODE Internal error.
- * WN_BAD_PAGE Internal error.
- * WN_BAD_DEV Internal error.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- * Version 3.02 March 20, 1987
- * Corrected value of presult in case when WNPGREM succeeds.
- *
- **/
-
- #include <bwindow.h>
-
- BWINDOW *wnforget(pwin)
- BWINDOW *pwin;
- {
- int dev,page;
- BWINDOW *presult;
-
- if (wnvalwin(pwin) == NIL) /* Validate window pointer. */
- {
- wnerror(WN_BAD_WIN);
- return NIL;
- }
-
- dev = pwin->where_shown.dev;
- if (dev != MONO && dev != COLOR) /* Ensure it's showing. */
- {
- wnerror(WN_NOT_SHOWN);
- return NIL;
- }
-
- if (b_pcurwin == pwin) /* If this window is current, */
- b_pcurwin = NIL; /* mark no window as current. */
-
- page = pwin->where_shown.page;
- if (b_pactnode[dev][page]->pwin == pwin)
- { /* Then this window is the one */
- /* whose cursor is active. */
- b_pactnode[dev][page] = NIL;
- /* Now no window has an active */
- /* cursor. */
- /* (But don't touch the visible */
- /* cursor.) */
- }
- pwin->internals.cur_frozen = 1;
-
- presult = wnpgrem(pwin); /* Remove from linked list. */
-
- if (presult != NIL)
- { /* Mark as not shown. */
- pwin->where_shown.dev =
- pwin->where_prev.dev = ABSENT;
- pwin->internals.dirty =
- pwin->options.hidden = 0;
- }
-
- pwin->internals.temp_hid = 0; /* Correct internal flag in */
- /* case it remains set. */
-
- return presult; /* Success. */
- }