home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
-
- ShowScr.c
-
- This file should be linked together with a compiled version
- of Stolen.c, or whatever it's name may be. That file must
- contain the following:
- - A NewScreen structure: The Screen to be shown;
- - A list of NewWindows: The Windows to be opened on it;
- - A list of Menus: The Menu for the Window at the according index.
-
- Rick van Rein, October 2, 1990
-
- ****************************************************************************/
-
-
-
- #include <functions.h>
-
- #include <Intuition/Intuition.h>
-
-
- struct IntuitionBase *IntuitionBase;
- struct GfxBase *GfxBase;
-
- extern struct NewWindow *swin1 []; /* Ending in NULL */
- extern struct Menu *smen1 []; /* Congruent with latter, but NULL means "no MenuStrip" */
-
- extern struct NewScreen nscr1; /* The Screen itself */
- extern short cols1 []; /* The Screen's colours */
-
-
- /***** This routine opens a Window with a Close-Gadget in it: */
-
-
- #define BLUE_0 0
- #define WHITE_1 1
- #define BLACK_2 2
- #define ORANGE_3 3
-
-
- struct NewWindow closewin =
- {
- 30,30, /* LeftEdge,TopEdge */
- 360,10, /* Width,Height */
- BLUE_0,WHITE_1, /* DetailPen,BlockPen */
- CLOSEWINDOW, /* IDCMPFlags */
- WINDOWDRAG | WINDOWDEPTH | WINDOWCLOSE | SMART_REFRESH,
- /* Flags */
- NULL, /* FirstGadget */
- NULL, /* CheckMark */
- (UBYTE *) " <<< Click here to finish ShowScr ",
- /* Title */
- NULL, /* Screen */
- NULL, /* BitMap */
- -1,-1, /* MinWidth,MinHeight */
- -1,-1, /* MaxWidth,MaxHeight */
- WBENCHSCREEN /* Type */
- };
-
- void WaitForClick ()
- {
- struct Window *win;
-
- if (win=OpenWindow (&closewin))
- {
- WaitPort (win->UserPort);
- ReplyMsg (GetMsg (win->UserPort)); /* Our Gadget was Clicked */
- CloseWindow (win);
- }
- else
- puts ("\tShowScr: Can't open Window on Workbench Screen");
- }
-
-
- /***** The main routine of the showing mechanism: */
-
- main ()
- {
- struct Screen *scr;
- struct NewWindow **wp;
- struct Window *win,*next;
- struct Menu **mp;
- int ok;
-
- if (!(IntuitionBase=(struct IntuitionBase *) OpenLibrary ("intuition.library",0L)))
- {
- puts ("\tShowScr: Can't open intuition.library (?)");
- exit (0);
- }
- if (!(GfxBase=(void *) OpenLibrary ("graphics.library",0L)))
- {
- puts ("\tShowScr: Can't open graphics.library (?)");
- exit (0);
- }
-
- scr=OpenScreen (&nscr1);
- if (!scr)
- {
- puts ("\tShowScr: Can't open Screen as defined by scr1");
- exit (0);
- }
-
- LoadRGB4 (&scr->ViewPort,cols1,1L << nscr1.Depth);
-
- wp=swin1;
- mp=smen1;
- ok=1;
- while (ok && *wp)
- {
- (*wp)->Screen=scr;
- (*wp)->Type=CUSTOMSCREEN;
- win=OpenWindow (*wp);
- if ((ok=(win!=NULL)) && *mp)
- SetMenuStrip (win,*mp);
- wp++;
- mp++;
- }
-
- if (ok)
- WaitForClick ();
- else
- puts ("\tShowScr: Not all Windows as described in swin1 could be opened");
-
- win=scr->FirstWindow;
- while (win)
- {
- next=win->NextWindow;
- CloseWindow (win);
- win=next;
- }
- CloseScreen (scr);
-
- CloseLibrary (GfxBase);
- CloseLibrary (IntuitionBase);
- }
-