home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 2 / FFMCD02.bin / new / misc / sci / cp / source / plotgui.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-21  |  15.8 KB  |  510 lines

  1. /*
  2.  *  Source machine generated by GadToolsBox V2.0
  3.  *  which is (c) Copyright 1991-1993 Jaba Development
  4.  *
  5.  *  GUI Designed by : Chris Conger
  6.  */
  7.  
  8. #include <exec/types.h>
  9. #include <intuition/intuition.h>
  10. #include <intuition/classes.h>
  11. #include <intuition/classusr.h>
  12. #include <intuition/imageclass.h>
  13. #include <intuition/gadgetclass.h>
  14. #include <libraries/gadtools.h>
  15. #include <graphics/displayinfo.h>
  16. #include <graphics/gfxbase.h>
  17. #include <clib/exec_protos.h>
  18. #include <clib/intuition_protos.h>
  19. #include <clib/gadtools_protos.h>
  20. #include <clib/graphics_protos.h>
  21. #include <clib/utility_protos.h>
  22. #include <string.h>
  23.  
  24. #include "plotgui.h"
  25. #include "cp.h"
  26.  
  27. extern UBYTE *version_string;
  28.  
  29. struct Screen         *Scr = NULL;
  30. APTR                   VisualInfo = NULL;
  31. struct Window         *PlotWindowWnd = NULL;
  32. struct Window         *delwinWnd = NULL;
  33. struct Gadget         *PlotWindowGList = NULL;
  34. struct Gadget         *delwinGList = NULL;
  35. struct Menu           *PlotWindowMenus = NULL;
  36. struct IntuiMessage    PlotWindowMsg;
  37. struct IntuiMessage    delwinMsg;
  38. struct Gadget         *PlotWindowGadgets[6];
  39. struct Gadget         *delwinGadgets[3];
  40. UWORD                  SWIDTH = STDSCREENWIDTH;
  41. UWORD                  SHEIGHT = STDSCREENHEIGHT;
  42. UWORD                  delwinLeft = 80;
  43. UWORD                  delwinTop = 40;
  44. UWORD                  delwinWidth = 200;
  45. UWORD                  delwinHeight = 140;
  46. UBYTE                 *PlotWindowWdt = (UBYTE *)"PWin";
  47. UBYTE                 *delwinWdt = (UBYTE *)"Delete Trace";
  48.  
  49. WORD GADHEIGHT;
  50. WORD GADWIDTH;
  51.  
  52. /*struct TextAttr cPFont = {
  53.      ( STRPTR )"topaz.font", 8, 0x00, 0x00 };
  54. */
  55.  
  56. struct NewMenu PlotWindowNewMenu[] = {
  57.      NM_TITLE, (STRPTR)"Project", NULL, 0, NULL, NULL,
  58.      NM_ITEM, (STRPTR)"Open File", (STRPTR)"O", 0, 0L, (APTR)newfile,
  59.      NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  60.      NM_ITEM, (STRPTR)"Add File", (STRPTR)"A", 0, 0L, (APTR)addClicked,
  61.      NM_ITEM, (STRPTR)"Delete Set", (STRPTR)"D", 0, 0L, (APTR)deleteClicked,
  62.      NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  63.      NM_ITEM, (STRPTR)"About", NULL, 0, 0L, (APTR)PlotWindowItem0,
  64.      NM_ITEM, (STRPTR)"Die", (STRPTR)"Q", 0, 0L, (APTR)PlotWindowItem1,
  65.      NM_TITLE, (STRPTR)"Axis", NULL, 0, NULL, NULL,
  66.      NM_ITEM, (STRPTR)"XAxis", NULL, 0, NULL, NULL,
  67.      NM_SUB, (STRPTR)"Lin", NULL, 0, 0L, (APTR)PlotWindowItem2,
  68.      NM_SUB, (STRPTR)"Log", NULL, 0, 0L, (APTR)PlotWindowItem3,
  69.      NM_ITEM, (STRPTR)"YAxis", NULL, 0, NULL, NULL,
  70.      NM_SUB, (STRPTR)"Lin", NULL, 0, 0L, (APTR)PlotWindowItem4,
  71.      NM_SUB, (STRPTR)"Log", NULL, 0, 0L, (APTR)PlotWindowItem5,
  72.      NM_TITLE, (STRPTR)"Display", NULL, 0, NULL, NULL,
  73.      NM_ITEM, (STRPTR)"Full View", (STRPTR)"F", 0L, 0L, (APTR)fullClicked,
  74.      NM_ITEM, (STRPTR)"Grid", (STRPTR)"G", 0L, 0L, (APTR)gridClicked,
  75.      NM_ITEM, (STRPTR)"Symbols", (STRPTR)"Y", 0L, 0L, (APTR)PlotWindowItem6,
  76.      NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
  77.      NM_ITEM, (STRPTR)"Control Panel", (STRPTR)"C", 0L, 0L, (APTR)PlotWindowItem7,
  78.      NM_END, NULL, NULL, 0, 0L, NULL };
  79.  
  80.  
  81. UWORD PlotWindowGTypes[] = {
  82.      BUTTON_KIND,
  83.      BUTTON_KIND,
  84.      BUTTON_KIND,
  85.      BUTTON_KIND,
  86.      BUTTON_KIND,
  87.      BUTTON_KIND
  88. };
  89.  
  90. UWORD delwinGTypes[] = {
  91.      LISTVIEW_KIND,
  92.      BUTTON_KIND,
  93.      BUTTON_KIND
  94. };
  95.  
  96. struct NewGadget PlotWindowNGad[] = {
  97.      NULL, NULL, NULL, NULL, (UBYTE *)"_Add", NULL, GD_add, PLACETEXT_IN, NULL, (APTR)addClicked,
  98.      NULL, NULL, NULL, NULL, (UBYTE *)"_Kill", NULL, GD_delete, PLACETEXT_IN, NULL, (APTR)deleteClicked,
  99.      NULL, NULL, NULL, NULL, (UBYTE *)"_Full", NULL, GD_full, PLACETEXT_IN, NULL, (APTR)fullClicked,
  100.      NULL, NULL, NULL, NULL, (UBYTE *)"_Zoom", NULL, GD_zoom, PLACETEXT_IN, NULL, (APTR)zoomClicked,
  101.      NULL, NULL, NULL, NULL, (UBYTE *)"_Grid", NULL, GD_grid, PLACETEXT_IN, NULL, (APTR)gridClicked,
  102.      NULL, NULL, NULL, NULL, (UBYTE *)"_Quit", NULL, GD_quit, PLACETEXT_IN, NULL, (APTR)quitClicked
  103. };
  104.  
  105. struct NewGadget delwinNGad[] = {
  106.      20, 20, 150, 75, NULL, NULL, GD_dellist, NULL, NULL, (APTR)dellistClicked,
  107.      25, 100, 65, 25, (UBYTE *)"_Delete", NULL, GD_delset, PLACETEXT_IN, NULL, (APTR)delsetClicked,
  108.      100, 100, 65, 25, (UBYTE *)"_Redraw", NULL, GD_canlist, PLACETEXT_IN, NULL, (APTR)canlistClicked
  109. };
  110.  
  111. ULONG PlotWindowGTags[] = {
  112.      (GT_Underscore), '_', (TAG_DONE),
  113.      (GT_Underscore), '_', (TAG_DONE),
  114.      (GT_Underscore), '_', (TAG_DONE),
  115.      (GT_Underscore), '_', (TAG_DONE),
  116.      (GT_Underscore), '_', (TAG_DONE),
  117.      (GT_Underscore), '_', (TAG_DONE)
  118. };
  119.  
  120. ULONG delwinGTags[] = {
  121.      (GTLV_ShowSelected), NULL, (TAG_DONE),
  122.      (GT_Underscore), '_', (TAG_DONE),
  123.      (GT_Underscore), '_', (TAG_DONE)
  124. };
  125.  
  126.  
  127. struct ColorSpec MonoColors[] = {
  128.       0, 0x00, 0x00, 0x00,
  129.       1, 0x0F, 0x0E, 0x0D,
  130.      ~0, 0x00, 0x00, 0x00 };
  131.  
  132. struct ColorSpec FourColors[] = {
  133.       0, 0x07, 0x06, 0x06,
  134.       1, 0x0B, 0x0A, 0x0A,
  135.       2, 0x03, 0x01, 0x03,
  136.       3, 0x0F, 0x00, 0x05,
  137.      ~0, 0x00, 0x00, 0x00 };
  138.  
  139. struct ColorSpec EightColors[] = {
  140.       0, 0x08, 0x06, 0x06,
  141.       1, 0x00, 0x00, 0x00,
  142.       2, 0x0C, 0x0C, 0x0F,
  143.       3, 0x09, 0x07, 0x08,
  144.       4, 0x0A, 0x09, 0x0F,
  145.       5, 0x0F, 0x0E, 0x08,
  146.       6, 0x05, 0x04, 0x05,
  147.       7, 0x0F, 0x0F, 0x0F,
  148.      ~0, 0x00, 0x00, 0x00 };
  149.  
  150. struct ColorSpec SixteenColors[] = {
  151.       0, 0x08, 0x06, 0x06,
  152.       1, 0x00, 0x00, 0x00,
  153.       2, 0x0C, 0x0C, 0x0F,
  154.       3, 0x09, 0x07, 0x08,
  155.       4, 0x0A, 0x09, 0x0F,
  156.       5, 0x0F, 0x0E, 0x08,
  157.       6, 0x0F, 0x05, 0x06,
  158.       7, 0x00, 0x0F, 0x09,
  159.       8, 0x0D, 0x07, 0x0D,
  160.       9, 0x03, 0x06, 0x0C,
  161.      10, 0x0F, 0x09, 0x08,
  162.      11, 0x0B, 0x02, 0x0F,
  163.      12, 0x01, 0x0F, 0x0D,
  164.      13, 0x0F, 0x00, 0x08,
  165.      14, 0x05, 0x04, 0x05,
  166.      15, 0x0F, 0x0F, 0x0F,
  167.      ~0, 0x00, 0x00, 0x00 };
  168.  
  169. UWORD DriPens[] = {
  170.      0,1,2,2,1,3,2,0,2,~0 };
  171.  
  172. UWORD TwoPens[] = {
  173.      0,1,2,1,2,3,2,0,2,~0 };
  174.  
  175.  
  176. int SetupScreen( void )
  177. {
  178. UBYTE PubNum[4];
  179. struct List    *publist;
  180. struct PubScreenNode *psnode;
  181. WORD  s=0,t;
  182. WORD len;
  183. struct ColorSpec *ScreenColors;
  184. UBYTE PubName[8];
  185.  
  186.     strcpy(PubName,"cP");
  187.     len = (WORD) strlen( PubName );
  188.  
  189.     publist = LockPubScreenList();                /* Lock the public screen list     */
  190.  
  191.     for (psnode = (struct PubScreenNode *) publist->lh_Head; psnode->psn_Node.ln_Succ; psnode = (struct PubScreenNode *) psnode->psn_Node.ln_Succ)
  192.       {
  193.           if ( ! Strnicmp( psnode-> psn_Node.ln_Name, PubName, len))
  194.             {
  195.                t = 0;
  196.                sscanf( &psnode-> psn_Node.ln_Name [len],"%hd", &t);
  197.                s = max(s,t);
  198.             }
  199.       }
  200.  
  201.      UnlockPubScreenList ();
  202.  
  203.      sprintf( PubNum,"%hd", s+1 );
  204.      strcpy ( PubName,"cP");
  205.      strcat ( PubName, PubNum);         /* Add #s of other cP screens to name */
  206.  
  207.      if ( depth == 1 ) ScreenColors = &MonoColors[0];
  208.      if ( depth == 2 ) ScreenColors = &FourColors[0];
  209.      if ( depth == 3 ) ScreenColors = &EightColors[0];
  210.      if ( depth == 4 ) ScreenColors = &SixteenColors[0];
  211.  
  212.      if ( depth == 1 )
  213.        {
  214.           DriPens[0] = ~0;
  215.        }
  216.  
  217.      if ( ! ( Scr = OpenScreenTags( NULL, SA_Left,     0,
  218.                          SA_Top,        0,
  219.                          SA_Width,      SWIDTH,
  220.                          SA_Height,     SHEIGHT,
  221.                          SA_Depth,      depth,
  222.                          SA_Colors,     ScreenColors,
  223.                          SA_Font,       cPFont,
  224.                          SA_Type,       PUBLICSCREEN,
  225.                          SA_PubName,    PubName,
  226.                          SA_DisplayID,  DEFAULT_MONITOR_ID | Disp,
  227.                          SA_Overscan,   OSCAN_TEXT,
  228.                          SA_AutoScroll, TRUE,
  229.                          SA_Pens,       (depth == 2 ? &TwoPens[0] : &DriPens[0]),
  230.                          SA_Title,      &version_string[5],
  231.                          TAG_DONE )))
  232.           return( 1L );
  233.  
  234.      if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
  235.           return( 2L );
  236.  
  237.      PubScreenStatus( Scr, NULL );      /* make screen public */
  238.      if ( DEFS ) SetDefaultPubScreen( PubName );  /* make screen default pub if DEFS True */
  239.  
  240.      return( 0L );
  241. }
  242.  
  243. void CloseDownScreen( void )
  244. {
  245. struct EasyStruct myezreq = {
  246.        sizeof (struct EasyStruct), 0,
  247.        "Close Public Screen",
  248.        "Please Close All Windows on this Screen",
  249.        "OK"
  250.   };
  251.  
  252.      if ( VisualInfo ) {
  253.           FreeVisualInfo( VisualInfo );
  254.           VisualInfo = NULL;
  255.      }
  256.      if ( Scr ) {
  257.  
  258.           PubScreenStatus( Scr, PSNF_PRIVATE );   /* make the screen unavailable */
  259.  
  260.           while( ! CloseScreen( Scr ))
  261.             {
  262.                Forbid();
  263.                EasyRequestArgs( Scr-> FirstWindow, &myezreq, NULL, NULL );
  264.                Permit();
  265.             }
  266.  
  267.      }
  268.      Scr = NULL;
  269. }
  270.  
  271. int HandlePlotWindowIDCMP( void )
  272. {
  273.      struct IntuiMessage *m;
  274.      struct MenuItem          *n;
  275.      int            (*func)();
  276.      BOOL           running = TRUE;
  277.  
  278.      while( m = GT_GetIMsg( PlotWindowWnd->UserPort )) {
  279.  
  280.           CopyMem(( char * )m, ( char * )&PlotWindowMsg, (long)sizeof( struct IntuiMessage ));
  281.  
  282.           GT_ReplyIMsg( m );
  283.  
  284.           switch ( PlotWindowMsg.Class ) {
  285.  
  286.                case IDCMP_REFRESHWINDOW:
  287.                     GT_BeginRefresh( PlotWindowWnd );
  288.                     GT_EndRefresh( PlotWindowWnd, TRUE );
  289.                     break;
  290.  
  291.                case IDCMP_VANILLAKEY:
  292.                     running = PlotWindowVanillaKey();
  293.                     break;
  294.  
  295.                case IDCMP_MOUSEBUTTONS:
  296.                     if (PlotWindowMsg.Code == SELECTDOWN)
  297.                          Identify(PlotWindowMsg.MouseX, PlotWindowMsg.MouseY, TRUE);
  298.                     else if (PlotWindowMsg.Code == SELECTUP)
  299.                          Identify(PlotWindowMsg.MouseX, PlotWindowMsg.MouseY, FALSE);
  300.                     break;
  301.  
  302.                case IDCMP_GADGETUP:
  303.                     func = ( void * )(( struct Gadget * )PlotWindowMsg.IAddress )->UserData;
  304.                     running = func();
  305.                     break;
  306.  
  307.                case IDCMP_MENUPICK:
  308.                     while( PlotWindowMsg.Code != MENUNULL ) {
  309.                          n = ItemAddress( PlotWindowMenus, PlotWindowMsg.Code );
  310.                          func = (void *)(GTMENUITEM_USERDATA( n ));
  311.                          running = func();
  312.                          PlotWindowMsg.Code = n->NextSelect;
  313.                     }
  314.                     break;
  315.           }
  316.      }
  317.      return( running );
  318. }
  319.  
  320. int OpenPlotWindowWindow( void )
  321. {
  322.      struct NewGadget    ng;
  323.      struct Gadget  *g;
  324.      UWORD          lc, tc;
  325.      WORD   GadTop;
  326.  
  327.      if ( ! ( g = CreateContext( &PlotWindowGList )))
  328.           return( 1L );
  329.  
  330.      GADWIDTH  = ( Scr-> Width - 2 * cPFont->ta_YSize ) / PlotWindow_CNT;
  331.      GADHEIGHT = cPFont->ta_YSize * 2;
  332.  
  333.      GadTop = Scr-> Height - Scr-> BarHeight - cPFont->ta_YSize * 3;
  334.  
  335.      for( lc = 0, tc = 0; lc < PlotWindow_CNT; lc++ ) {
  336.  
  337.           PlotWindowNGad[ lc ] . ng_LeftEdge = GADWIDTH * lc + cPFont->ta_YSize;
  338.           PlotWindowNGad[ lc ] . ng_Width    = GADWIDTH;
  339.           PlotWindowNGad[ lc ] . ng_TopEdge  = GadTop;
  340.           PlotWindowNGad[ lc ] . ng_Height   = GADHEIGHT;
  341.  
  342.           CopyMem((char * )&PlotWindowNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
  343.  
  344.           ng.ng_VisualInfo = VisualInfo;
  345.           ng.ng_TextAttr   = cPFont;
  346.  
  347.           PlotWindowGadgets[ lc ] = g = CreateGadgetA((ULONG)PlotWindowGTypes[ lc ], g, &ng, ( struct TagItem * )&PlotWindowGTags[ tc ] );
  348.  
  349.           while( PlotWindowGTags[ tc ] ) tc += 2;
  350.           tc++;
  351.  
  352.           if ( NOT g )
  353.                return( 2L );
  354.      }
  355.  
  356.      if ( ! ( PlotWindowMenus = CreateMenus( PlotWindowNewMenu, GTMN_FrontPen, 0L, TAG_DONE )))
  357.           return( 3L );
  358.  
  359.      LayoutMenus( PlotWindowMenus, VisualInfo, GTMN_TextAttr, cPFont, TAG_DONE );
  360.  
  361.      if ( ! ( PlotWindowWnd = OpenWindowTags( NULL,
  362.                     WA_Left,  0,
  363.                     WA_Top,        Scr-> BarHeight,
  364.                     WA_Width, Scr-> Width,
  365.                     WA_Height,     Scr-> Height - Scr-> BarHeight,
  366.                     WA_IDCMP, BUTTONIDCMP|IDCMP_MOUSEMOVE|IDCMP_MOUSEBUTTONS|IDCMP_MENUPICK|IDCMP_VANILLAKEY,
  367.                     WA_Flags, WFLG_SMART_REFRESH|WFLG_BACKDROP|WFLG_BORDERLESS|WFLG_ACTIVATE,
  368.                     WA_Gadgets,    ( CPANEL ? PlotWindowGList : NULL),
  369.                     WA_ScreenTitle,     &version_string[5],
  370.                     WA_AutoAdjust, TRUE,
  371.                     WA_PubScreen,  Scr,
  372.                     TAG_DONE )))
  373.      return( 4L );
  374.  
  375.      SetMenuStrip( PlotWindowWnd, PlotWindowMenus );
  376.      GT_RefreshWindow( PlotWindowWnd, NULL );
  377.  
  378.      return( 0L );
  379. }
  380.  
  381. void ClosePlotWindowWindow( void )
  382. {
  383.      if ( PlotWindowMenus      ) {
  384.           ClearMenuStrip( PlotWindowWnd );
  385.           FreeMenus( PlotWindowMenus );
  386.           PlotWindowMenus = NULL;  }
  387.  
  388.      if ( PlotWindowWnd        ) {
  389.           CloseWindow( PlotWindowWnd );
  390.           PlotWindowWnd = NULL;
  391.      }
  392.  
  393.      if ( PlotWindowGList      ) {
  394.           FreeGadgets( PlotWindowGList );
  395.           PlotWindowGList = NULL;
  396.      }
  397. }
  398.  
  399. void delwinRender( void )
  400. {
  401.      UWORD          offx, offy;
  402.  
  403.      offx = delwinWnd->BorderLeft;
  404.      offy = delwinWnd->BorderTop;
  405.  
  406.  
  407.      DrawBevelBox( delwinWnd->RPort, offx + 10, offy + 10, 170, 120 , GT_VisualInfo, VisualInfo, GTBB_Recessed, TRUE, TAG_DONE );
  408. }
  409.  
  410. int HandledelwinIDCMP( void )
  411. {
  412.      struct IntuiMessage *m;
  413.      int            (*func)();
  414.      BOOL           running = TRUE;
  415.  
  416.      while( m = GT_GetIMsg( delwinWnd->UserPort )) {
  417.  
  418.           CopyMem(( char * )m, ( char * )&delwinMsg, (long)sizeof( struct IntuiMessage ));
  419.  
  420.           GT_ReplyIMsg( m );
  421.  
  422.           switch ( delwinMsg.Class ) {
  423.  
  424.                case IDCMP_REFRESHWINDOW:
  425.                     GT_BeginRefresh( delwinWnd );
  426.                     delwinRender();
  427.                     GT_EndRefresh( delwinWnd, TRUE );
  428.                     break;
  429.  
  430.                case IDCMP_CLOSEWINDOW:
  431.                     running = delwinCloseWindow();
  432.                     break;
  433.  
  434.                case IDCMP_VANILLAKEY:
  435.                     running = delwinVanillaKey();
  436.                     break;
  437.  
  438.                case IDCMP_GADGETUP:
  439.                case IDCMP_GADGETDOWN:
  440.                     func = ( void * )(( struct Gadget * )delwinMsg.IAddress )->UserData;
  441.                     running = func();
  442.                     break;
  443.           }
  444.      }
  445.      return( running );
  446. }
  447.  
  448. int OpendelwinWindow( void )
  449. {
  450.      struct NewGadget    ng;
  451.      struct Gadget  *g;
  452.      UWORD          lc, tc;
  453.      UWORD          offx = Scr->WBorLeft, offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
  454.  
  455.      if ( ! ( g = CreateContext( &delwinGList )))
  456.           return( 1L );
  457.  
  458.      for( lc = 0, tc = 0; lc < delwin_CNT; lc++ ) {
  459.  
  460.           CopyMem((char * )&delwinNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
  461.  
  462.           ng.ng_VisualInfo = VisualInfo;
  463.           ng.ng_TextAttr   = cPFont;
  464.           ng.ng_LeftEdge  += offx;
  465.           ng.ng_TopEdge   += offy;
  466.  
  467.           delwinGadgets[ lc ] = g = CreateGadgetA((ULONG)delwinGTypes[ lc ], g, &ng, ( struct TagItem * )&delwinGTags[ tc ] );
  468.  
  469.           while( delwinGTags[ tc ] ) tc += 2;
  470.           tc++;
  471.  
  472.           if ( NOT g )
  473.                return( 2L );
  474.      }
  475.  
  476.      if ( ! ( delwinWnd = OpenWindowTags( NULL,
  477.                     WA_Left,  delwinLeft,
  478.                     WA_Top,        delwinTop,
  479.                     WA_Width, delwinWidth,
  480.                     WA_Height,     delwinHeight + offy,
  481.                     WA_IDCMP, LISTVIEWIDCMP|BUTTONIDCMP|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY,
  482.                     WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE,
  483.                     WA_Gadgets,    delwinGList,
  484.                     WA_Title, delwinWdt,
  485.                     WA_ScreenTitle,     "Kill",
  486.                     WA_PubScreen,  Scr,
  487.                     TAG_DONE )))
  488.      return( 4L );
  489.  
  490.      GT_RefreshWindow( delwinWnd, NULL );
  491.  
  492.      delwinRender();
  493.  
  494.      return( 0L );
  495. }
  496.  
  497. void ClosedelwinWindow( void )
  498. {
  499.      if ( delwinWnd        ) {
  500.           CloseWindow( delwinWnd );
  501.           delwinWnd = NULL;
  502.      }
  503.  
  504.      if ( delwinGList      ) {
  505.           FreeGadgets( delwinGList );
  506.           delwinGList = NULL;
  507.      }
  508. }
  509.  
  510.