home *** CD-ROM | disk | FTP | other *** search
- /*
- winscrol.c 10/30/88
-
- % functions scroll a window on the display.
-
- Consolidated from other files.
- Ted.
-
- OWL 1.1
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- */
- /* -------------------------------------------------------------------------- */
- #include "oakhead.h"
- #include "disppriv.h"
-
- /* -------------------------------------------------------------------------- */
-
- void win_ScrollPix(win, nx, ny)
- win_type win;
- opcoord nx;
- opcoord ny;
-
- /* Scrolls all unobscured parts of win. Scrolls win cursor position too. */
- {
- opoint tpn;
- boolean cursin;
- opbox cursbox;
- boolean wasshown;
- /*
- Update curspos first to ensure that painting portion can paint it in the
- right place. Hide it to make sure it will be shown or in case it's a text
- cursor that got scrolled out of the window, and show it in case it's a
- text cursor and was in the scrolled region.
- */
-
- /* If the cursor is in the window getting exposed, save and restore it */
- win_GetCursorPixBox(win, &cursbox);
- cursin = (win_clipbox(win, &cursbox) != 0);
-
- if (cursin) {
- disp_Cache();
- wasshown = win_HideCursor(win);
- }
- win_setcursx(win, win_GetCursx(win) - nx);
- win_setcursy(win, win_GetCursy(win) - ny);
- tpn.x = nx; tpn.y = ny;
- win_Expose(win, WINM_SCROLL, &tpn);
-
- if (cursin) {
- if (wasshown) win_ShowCursor(win);
- disp_Flush();
- }
- }
- /* -------------------------------------------------------------------------- */
-
- void win_ScrollPixBox(win, boxp, nx, ny)
- win_type win;
- opbox* boxp;
- opcoord nx;
- opcoord ny;
- /*
- Scrolls all unobscured parts of win in relbox.
- Does not scroll win cursor position.
- */
- {
- opoint tpn;
- boolean cursin;
- opbox cursbox;
- boolean wasshown;
-
- /* If the cursor is in the box getting exposed, save and restore it */
- win_GetCursorPixBox(win, &cursbox);
- cursin = (opbox_clipbox(boxp, &cursbox) != 0);
-
- if (cursin) {
- disp_Cache();
- wasshown = win_HideCursor(win);
- }
- tpn.x = nx; tpn.y = ny;
- win_ExposePixBox(win, boxp, WINM_SCROLL, &tpn);
-
- if (cursin) {
- if (wasshown) win_ShowCursor(win);
- disp_Flush();
- }
- }
- /* -------------------------------------------------------------------------- */
-
- void win_ScrollBox(win, cboxp, nrows, ncols)
- win_type win;
- ocbox *cboxp; /* Clipping coords relative to win */
- int nrows;
- int ncols;
- {
- opbox box; /* display coords */
-
- if (win == NULL) return;
-
- ocbox_pixcoords(cboxp, win_GetFont(win), &box);
-
- /* Quit if box is not in window */
- if (!win_clipbox(win, &box)) return;
-
- win_ScrollPixBox(win, &box, ncols * win_GetFontWidth(win),
- nrows * win_GetFontHeight(win));
- }
- /* -------------------------------------------------------------------------- */
-
-