home *** CD-ROM | disk | FTP | other *** search
- /*
- oboxdecl.h 5/15/88
-
- % driver functions and other things that need attending to
-
- By Ted.
-
- OWL 1.2
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 8/24/88 jmd added ocbox_FindDist
- 10/19/88 ted split out ocolmap stuff to ocmapdecl.h
- 5/09/89 ted renamed old set's to copy's, added new set's.
- 5/09/89 ted Made _point_copy a macro.
- 8/21/89 ted Changed ofont and opsize widths and heights to 'odims'.
- 8/21/89 ted Added ofontdesc_struct, font 'real' and 'req' elements.
- 9/10/89 ted Removed ofontdesc 'seriph' element.
- 10/09/89 ted Added 'scalable' flag to ofontdesc_struct.
- 2/14/90 ted Added aspect font struct element.
- 3/28/90 jmd ansi-fied
- */
- /* -------------------------------------------------------------------------- */
- /* data types */
-
- typedef int opcoord; /* signed pixel coordinate */
- typedef unsigned odim; /* unsigned pixel dimension/distance (coord-coord) */
- typedef unsigned short oangle; /* angle measurement; units of 2pi/(USHRT_MAX+1) */
-
- typedef struct _fontdesc {
- opcoord width;
- opcoord height;
- short style; /* An arbitrary indicator of increasing floweriness */
- unsigned bold:1;
- unsigned underline:1;
- unsigned outline:1;
- oangle slant; /* Font angle measured clockwise from straight up */
- unsigned scalable:1;
- } fontdesc_struct;
-
- typedef struct ofont_struct {
- short fontid;
- fontdesc_struct real; /* actual font description */
- fontdesc_struct req; /* requested font description */
- unsigned short aspect; /* work var. for font aspect ratio when scaling */
- } *ofont_type;
-
- typedef struct _ocbox {
- int leftcol;
- int rightcol;
- int toprow;
- int botrow;
- } ocbox; /* box in char coords; width = xmax-xmin + 1 */
-
- typedef struct _ocsize {
- int height;
- int width;
- } ocsize_struct;
-
- /* Character position struct */
- typedef struct _ocpos {
- int row;
- int col;
- } ocpos_struct;
-
- typedef struct _opbox {
- opcoord xmin;
- opcoord xmax;
- opcoord ymin;
- opcoord ymax;
- } opbox; /* box in pixel coords; width = xmax-xmin */
-
- typedef struct _opsize {
- odim height;
- odim width;
- } opsize_struct;
-
- typedef struct _opoint {
- opcoord x;
- opcoord y;
- } opoint; /* point in pixel coords; */
- /* -------------------------------------------------------------------------- */
-
- /* OPBOX.C */
- extern void opbox_charcoords(opbox *boxp, ofont_type font, ocbox *cboxp);
- extern void opbox_uncover(opbox *winboxp, opbox *boxp);
- extern boolean opbox_empty(opbox *boxp);
- extern boolean opbox_ScrollVtIn(opbox *boxp, int n);
- extern boolean opbox_ScrollHzIn(opbox *boxp, int n);
- extern odim _box_GetWidth(opbox *boxp);
- extern odim _box_GetHeight(opbox *boxp);
- extern opbox *_box_copy(opbox *dboxp, opbox *sboxp);
- extern opbox *_box_trans(opbox *boxp, opcoord xdisp, opcoord ydisp);
- extern boolean _box_equal(opbox *boxp1, opbox *boxp2);
-
- /* OCBOX.C */
- extern void ocbox_pixcoords(ocbox *cboxp, ofont_type font, opbox *boxp);
- extern int opcoord_GetYRow(opcoord y, ofont_type font);
- extern int opcoord_GetXCol(opcoord x, ofont_type font);
- extern void opcoord_GridRound(opcoord *xp, opcoord *yp, ofont_type font);
- extern boolean ocbox_ScrollVtIn(ocbox *cboxp, int n);
- extern boolean ocbox_ScrollHzIn(ocbox *cboxp, int n);
-
- /* OBOXCLIP.C */
- extern unsigned opbox_clipbox(opbox *clipboxp, opbox *boxp);
- extern unsigned opbox_clippoint(opbox *clipboxp, opcoord *xp, opcoord *yp);
- extern unsigned ocbox_clippos(ocbox *clipcboxp, int *rowp, int *colp);
- extern unsigned opwh_clipbox(odim width, odim height, opbox *boxp);
- extern unsigned opwh_clippoint(odim width, odim height, opcoord *xp, opcoord *yp);
-
- /* OBOXDIST.C */
- extern int ocbox_FindDist(ocbox *box1, ocbox *box2, int dir);
-
- /* OPCLIPSO.C */
- extern int opbox_clipstrout(opbox *clipboxp, opcoord *xp, opcoord *yp, int *slenp, ofont_type font);
-
- /* OPCLIPST.C */
- extern int opbox_clipstring(opbox *clipboxp, opcoord *xp, opcoord *yp, int *slenp, ofont_type font);
-
- /* -------------------------------------------------------------------------- */
-
- #define ofont_GetWidth(font) ((font)->real.width)
- #define ofont_GetHeight(font) ((font)->real.height)
-
- #define opbox_GetWidth(boxp) _box_GetWidth(boxp)
- #define opbox_GetHeight(boxp) _box_GetHeight(boxp)
- #define opbox_copy(dboxp, sboxp) _box_copy(dboxp, sboxp)
- #define opbox_trans(boxp, xdisp, ydisp) _box_trans(boxp, xdisp, ydisp)
- #define opbox_equal(boxp1, boxp2) _box_equal(boxp1, boxp2)
- #define opbox_set(boxp, xm, ym, xx, yx) \
- ((boxp)->xmin = xm, (boxp)->xmax = xx, \
- (boxp)->ymin = ym, (boxp)->ymax = yx, (boxp))
- #define opoint_copy(pd, ps) ((pd)->x = (ps)->x,(pd)->y = (ps)->y, (pd))
-
- #define ocbox_GetWidth(cboxp) ((int)(_box_GetWidth((opbox *)cboxp) + 1))
- #define ocbox_GetHeight(cboxp) ((int)(_box_GetHeight((opbox *)cboxp) + 1))
- #define ocbox_copy(dcboxp, scboxp) \
- _box_copy((opbox *)(dcboxp), (opbox *)(scboxp))
- #define ocbox_trans(cboxp, rowd, cold) \
- _box_trans((opbox *)(cboxp), (opcoord)cold, (opcoord)rowd)
- #define ocbox_equal(cboxp1, cboxp2) _box_equal((opbox *)(cboxp1), (opbox *)(cboxp2))
- #define ocbox_set(boxp, tr, lc, br, rc) \
- ((boxp)->leftcol = lc, (boxp)->rightcol = rc, \
- (boxp)->toprow = tr, (boxp)->botrow = br, (boxp))
- /* -------------------------------------------------------------------------- */
-
-