home *** CD-ROM | disk | FTP | other *** search
- /*
- * wintext.h
- *
- * Routines for font-independent window-text system, which allows
- * writing of text based on character positions.
- * Still being tweaked.
- *
- * MWS 3/92.
- */
-
- #include <exec/types.h>
- #include <graphics/gfxmacros.h>
- #include <intuition/intuition.h>
- #include <proto/graphics.h>
- #include <proto/intuition.h>
-
- #include <string.h>
-
- #include "wintext.h"
-
- BOOL InitWinTextInfo(WINTEXTINFO *wti) /* for Workbench screen at moment */
- {
- struct Screen screen;
- struct TextFont *tf;
-
- if (GetScreenData(&screen, sizeof(screen), WBENCHSCREEN, NULL))
- {
- if (tf = OpenFont(wti->tattr = screen.Font)) /* have a peek */
- {
- wti->font_x = tf->tf_XSize;
- wti->font_y = tf->tf_YSize;
- wti->font_baseline = tf->tf_Baseline;
- wti->toffset = screen.WBorTop + tf->tf_YSize + 1;
- wti->loffset = screen.WBorLeft+2;
- wti->roffset = screen.WBorRight+2;
- wti->boffset = screen.WBorBottom;
-
- CloseFont(tf); /* should be set to rastport of window */
- return TRUE;
- }
- }
- return FALSE;
- }
-
-
- void RenderWinTexts(WINTEXTINFO *info, WINTEXT *wt)
- {
- struct RastPort *rp;
-
- while (wt)
- {
- rp = info->window->RPort;
- SetAPen(rp, wt->pen);
- SetDrMd(rp, wt->mode);
- Move(rp, info->loffset + wt->lpos*info->font_x,
- info->toffset + wt->tpos*info->font_y + info->font_baseline);
- Text(rp, wt->text, strlen(wt->text));
- wt = wt->next;
- }
- }
-
- /****** UNUSED AT MOMENT
-
- void WinText(WINTEXTINFO *info, char *text,
- UWORD lpos, UWORD tpos, UWORD pen, UWORD mode)
- {
- struct RastPort *rp;
-
- rp = info->window->RPort;
- SetAPen(rp, pen);
- SetDrMd(rp, mode);
- Move(rp, info->loffset + lpos*info->font_x, info->toffset + (tpos+1)*info->font_y);
- Text(rp, text, strlen(text));
- }
-
- ******/
-