home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d8xx / d826 / memsnap.lha / MemSnap / source / wintext.c < prev    next >
C/C++ Source or Header  |  2001-02-25  |  2KB  |  81 lines

  1. /*
  2. *    wintext.h
  3. *
  4. *    Routines for font-independent window-text system, which allows
  5. *    writing of text based on character positions.
  6. *    Still being tweaked.
  7. *
  8. *    MWS 3/92.
  9. */
  10.  
  11. #include <exec/types.h>
  12. #include <graphics/gfxmacros.h>
  13. #include <intuition/intuition.h>
  14. #include <proto/diskfont.h>
  15. #include <proto/graphics.h>
  16. #include <proto/intuition.h>
  17.  
  18. #include <string.h>
  19.  
  20. #include "wintext.h"
  21. #include "icon.h"
  22.  
  23. BOOL InitWinTextInfo(WINTEXTINFO *wti)    /* for Workbench screen at moment */
  24. {
  25.     struct Screen screen;
  26.  
  27.     if (GetScreenData(&screen, sizeof(screen), WBENCHSCREEN, NULL))
  28.     {
  29.         wti->tattr.ta_Name = TTString("FONTNAME", "topaz.font");
  30.         wti->tattr.ta_YSize = TTInt("FONTHEIGHT", 8);
  31.  
  32.         if (wti->tf = OpenDiskFont(&wti->tattr))
  33.         {
  34.             wti->font_x = wti->tf->tf_XSize;
  35.             wti->font_y = wti->tf->tf_YSize;
  36.             wti->font_baseline = wti->tf->tf_Baseline;
  37.             wti->toffset = screen.WBorTop;
  38.             wti->loffset = screen.WBorLeft+1;
  39.             wti->roffset = screen.WBorRight+1;
  40.             wti->boffset = screen.WBorBottom;
  41.  
  42.             return TRUE;
  43.         }
  44.     }
  45.     return FALSE;
  46. }    
  47.  
  48.  
  49. void RenderWinTexts(WINTEXTINFO *info, WINTEXT *wt)
  50. {
  51.     struct RastPort *rp;
  52.  
  53.     while (wt)
  54.     {
  55.         rp = info->window->RPort;
  56.         SetAPen(rp, wt->pen);
  57.         SetBPen(rp, wt->bg);
  58.         SetDrMd(rp, wt->mode);
  59.         Move(rp, info->loffset + wt->lpos*info->font_x, 
  60.              info->toffset + wt->tpos*info->font_y + info->font_baseline);
  61.         Text(rp, wt->text, strlen(wt->text));
  62.         wt = wt->next;
  63.     }
  64. }
  65.  
  66. /****** UNUSED AT MOMENT 
  67.  
  68. void WinText(WINTEXTINFO *info, char *text,
  69.          UWORD lpos, UWORD tpos, UWORD pen, UWORD mode)
  70. {
  71.     struct RastPort *rp;
  72.  
  73.     rp = info->window->RPort;
  74.     SetAPen(rp, pen);
  75.     SetDrMd(rp, mode);
  76.     Move(rp, info->loffset + lpos*info->font_x, info->toffset + (tpos+1)*info->font_y);
  77.     Text(rp, text, strlen(text));
  78. }
  79.  
  80. ******/
  81.