home *** CD-ROM | disk | FTP | other *** search
- # include "TransSkel.h"
- # include "TransDisplay.h"
-
- # include "Concentration.h"
-
-
-
- static WindowPtr helpWind = nil;
-
-
- /* ---------------------------------------------------------------- */
- /* General Display Window Routines */
- /* ---------------------------------------------------------------- */
-
-
- static pascal void
- DWindActivate (Boolean active)
- {
- WindowPeek w;
-
- if (!active) /* deactivated - was it closed? */
- {
- GetPort ((GrafPtr *) &w);
- if (w->visible == 0)
- {
- SkelRmveWind ((WindowPtr) w); /* yes - remove it */
- if ((WindowPtr) w == helpWind)
- helpWind = nil;
- }
- }
- }
-
-
- /*
- * Build a display window. NewDWindow makes it the current output
- * window for display output.
- */
-
- static void
- DisplayWindow (StringPtr title, Boolean visible)
- {
- WindowPtr w;
- Rect r;
- static int i = 0;
- int h, v;
-
- if (i < 1)
- i = 1;
- h = i * 23 + 5;
- v = h + 65;
- SetRect (&r, h, v, h + 350, v + 200);
- SetDWindowNotify (nil, DWindActivate);
- w = NewDWindow (&r, title, visible, (WindowPtr) -1L, true, 0L);
- if (++i == 4)
- i = 0;
- }
-
-
- /* ---------------------------------------------------------------- */
- /* Help Window Routines */
- /* ---------------------------------------------------------------- */
-
-
- /*
- * Create help window, unless it already exists - in which case
- * simply pull it to the front.
- */
-
-
- void
- HelpWindow (void)
- {
- WindowPtr curDispWind;
- Rect r;
- Handle h;
-
- if (helpWind == nil)
- {
- curDispWind = GetDWindow (); /* get current display window */
- SetRect (&r, 40, 50, 450, 280);
- helpWind = NewDWindow (&r, "\pHelp Window", false, (WindowPtr) -1L, true, 0L);
- SetDWindowNotify (helpWind, DWindActivate);
- SetDWindowStyle (helpWind, 0, 0, 1, teJustLeft);
-
- h = GetResource ('TEXT', helpTextNum); /* read help text */
- HLock (h); /* lock it and write to window */
- DisplayText (*h, GetHandleSize (h));
- HUnlock (h);
- ReleaseResource (h); /* done with it, so goodbye */
- SetDWindowPos (helpWind, 0); /* scroll back to top */
- SetDWindow (curDispWind); /* restore previous help window */
- }
- if (helpWind != nil)
- {
- SelectWindow (helpWind);
- ShowWindow (helpWind);
- SkelDoEvents (updateEvt + activateEvt);
- }
- }
-