home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 580a.lha / HDFView_v3.01 / source.LZH / source / src / gadgetScreen.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-03  |  2.0 KB  |  101 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3. #include <proto/intuition.h>
  4. #include <proto/graphics.h>
  5. #include <proto/exec.h>
  6.  
  7. #include "viewprotos.h"
  8.  
  9.  
  10. struct NewScreen ns = 
  11. {
  12.    0, 180,
  13.    640, 200,
  14.    2, 
  15.    -1, -1,
  16.    HIRES,
  17.    SCREENQUIET,
  18.    NULL,
  19.    NULL,
  20.    NULL,
  21. };
  22.  
  23. struct NewWindow nw =
  24. {
  25.    0,0,
  26.    640,200,
  27.    1, 0,
  28.    NULL,
  29.    SMART_REFRESH|BACKDROP|BORDERLESS|ACTIVATE|NOCAREREFRESH|RMBTRAP,
  30.    NULL,    /* first gadget */
  31.    NULL,
  32.    NULL,
  33.    NULL,
  34.    NULL,
  35.    640,200,
  36.    640,200,
  37.    CUSTOMSCREEN
  38. };
  39.  
  40. UWORD wbPens[] = {0,1,1,2,1,3,1,0,3,~0};
  41.    
  42. struct TagItem tag[] = {
  43.    {SA_Pens,(ULONG)wbPens},
  44.    {SA_DisplayID,(ULONG)HIRES_KEY},
  45.    {TAG_DONE,NULL}
  46. };      
  47.  
  48. struct TextAttr textAttr;
  49. struct TextFont *textFont=NULL, *oldFont;
  50.  
  51. extern struct Window *gWindow;
  52. extern struct Screen *gScreen;
  53. extern struct MsgPort *messagePort;
  54. extern struct Library *HameBase;
  55. extern struct Gadget hilaceGadget, main2Gadget;
  56.  
  57. VOID
  58. gadgetScreen(VOID)
  59. {
  60.    struct ViewPort *vp;
  61.    
  62.    gScreen = (struct Screen *)OpenScreenTagList(&ns,tag);
  63.    if(gScreen == NULL) myExit("Open Gadget Screen");
  64.    
  65.    nw.Screen = gScreen;
  66.    
  67.    gWindow = (struct Window *)OpenWindow(&nw);
  68.    if(gWindow == NULL) myExit("Open Gadget Window");
  69.    
  70.    ShowTitle(gScreen, FALSE);
  71.    
  72.    if(gWindow->UserPort) DeletePort(gWindow->UserPort);
  73.    gWindow->UserPort = messagePort;
  74.    ModifyIDCMP(gWindow,MOUSEBUTTONS|GADGETUP|GADGETDOWN);
  75.    
  76.    textAttr.ta_Name = "topaz.font";
  77.    textAttr.ta_YSize = 8;
  78.    textAttr.ta_Style = FS_NORMAL;
  79.    textAttr.ta_Flags = FPF_DESIGNED | FPF_ROMFONT;
  80.    
  81.    oldFont = gWindow->RPort->Font;
  82.    
  83.    textFont = OpenFont(&textAttr);
  84.    if(!textFont) myExit("Aaaak! Can't open Topaz Font");
  85.    
  86.    SetFont(gWindow->RPort, textFont);
  87.    
  88.    vp = ViewPortAddress(gWindow);
  89.    
  90.    SetRGB4(vp, 0, 0xa, 0xa, 0xa);
  91.    SetRGB4(vp, 1, 0x0, 0x0, 0x0);
  92.    SetRGB4(vp, 2, 0xf, 0xf, 0xf);
  93.    SetRGB4(vp, 3, 0x4, 0x5, 0x9);
  94.    
  95.    mainGadgets();
  96.    
  97.    if(HameBase==NULL) hilaceGadget.NextGadget=&main2Gadget;
  98.    
  99.    return;
  100. }
  101.