home *** CD-ROM | disk | FTP | other *** search
- /*
- bordout.c 5/20/89
-
- % Border Outline draw routines
- By JMD
-
- OWL 1.1
- Copyright (c) 1989, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 5/23/89 jmd added "border features"
- 7/06/89 ted Got rid of compiler warnings in EraseOutline.
- 7/06/89 ted Fixed char-grid rounding.
- 8/26/89 jmd Made bord_out routines public
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- #include "bordobj.h"
-
- OSTATIC void OWLPRIV outline_round(_arg3(opbox *rectboxp, win_type win, ocbox *cboxp));
- /* -------------------------------------------------------------------------- */
-
- #define OUTER_BOX "\332\304\277\263\331\304\300\263"
-
- void bord_DrawOutline(win, rectboxp)
- win_type win;
- opbox *rectboxp;
- /*
- Draws a box directly to the display
- Used for moving windows.
- */
- {
- ptd_struct ptds;
- opbox relbox;
- ocbox cbox;
-
- /* Create our own ptd, as big as the display */
- ptds.win = disp_GetDispWin();
- ptds.emsgdata = NULL;
- ptds.relboxp = &relbox;
-
- win_GetPixBox(ptds.win, ptds.relboxp);
-
- /* Draw the outline */
- outline_round(rectboxp, win, &cbox);
-
- disp_HideMouse();
- ptd_DrawCharBox(&ptds, OUTER_BOX, &cbox, win_GetAttr(win));
- disp_ShowMouse();
- }
- /* -------------------------------------------------------------------------- */
-
- void bord_EraseOutline(win, rectboxp)
- win_type win;
- opbox *rectboxp;
- /*
- Erases a border outline.
- Used for moving windows.
- */
- {
- opbox pbox, dbox;
- ocbox cbox;
- int fw, fh;
-
- /* round rectbox to character grid by converting from pix to char coords */
- /* and back again (into pbox). */
- outline_round(rectboxp, win, &cbox);
- ocbox_pixcoords(&cbox, win_GetFont(win), &pbox);
-
- /* repaint afflicted area */
-
- fw = win_GetFontWidth(win);
- fh = win_GetFontHeight(win);
-
- /* restore four strips */
- wmgr_PaintPixBox((curr_dmgr)->wmgr.bot_sys_win,
- opbox_set(&dbox, pbox.xmin, pbox.ymin, pbox.xmax, pbox.ymin + fh));
-
- wmgr_PaintPixBox((curr_dmgr)->wmgr.bot_sys_win,
- opbox_set(&dbox, pbox.xmin, pbox.ymax - fh, pbox.xmax, pbox.ymax));
-
- pbox.ymin += fh;
- pbox.ymax -= fh;
-
- wmgr_PaintPixBox((curr_dmgr)->wmgr.bot_sys_win,
- opbox_set(&dbox, pbox.xmin, pbox.ymin, pbox.xmin + fw, pbox.ymax));
-
- wmgr_PaintPixBox((curr_dmgr)->wmgr.bot_sys_win,
- opbox_set(&dbox, pbox.xmax - fw, pbox.ymin, pbox.xmax, pbox.ymax));
- }
- /* -------------------------------------------------------------------------- */
-
- static void OWLPRIV outline_round(rectboxp, win, cboxp)
- opbox *rectboxp;
- win_type win;
- ocbox *cboxp;
- /*
- Round the coordinates for a character-width border to the right positions.
- */
- {
- opbox rbox;
-
- rbox.xmin = rectboxp->xmin;
- rbox.ymin = rectboxp->ymin;
- rbox.xmax = opbox_GetWidth(rectboxp);
- rbox.ymax = opbox_GetHeight(rectboxp);
-
- if (!disp_TextFree()) {
- opcoord_GridRound(&rbox.xmin, &rbox.ymin, win_GetFont(win));
- }
- if (!disp_TextFree() || win_IsCharSize(win)) {
- rbox.xmax += win_GetFontWidth(win) - 1; /* Round up instead of down */
- rbox.ymax += win_GetFontHeight(win) - 1;
- opcoord_GridRound(&rbox.xmax, &rbox.ymax, win_GetFont(win));
- }
- rbox.xmax += rbox.xmin;
- rbox.ymax += rbox.ymin;
- opbox_charcoords(&rbox, win_GetFont(win), cboxp);
- }
- /* -------------------------------------------------------------------------- */
-
-