home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / util / wb / startwindow / source / startwindows.c < prev    next >
C/C++ Source or Header  |  1994-11-02  |  18KB  |  630 lines

  1. /*
  2.  *  Source machine generated by GadToolsBox V2.0b
  3.  *  which is (c) Copyright 1991-1993 Jaba Development
  4.  *
  5.  *  GUI Designed by : -- Heinz Reinert --
  6.  */
  7. #include <exec/types.h>
  8. #include <string.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 <proto/intuition.h>
  23. #include <proto/graphics.h>
  24. #include <proto/exec.h>
  25. #include <proto/dos.h>
  26. #include <proto/gadtools.h>
  27. #include <exec/memory.h>
  28.  
  29. /**********************************************/
  30. #define GetString( g )      ((( struct StringInfo * )g->SpecialInfo )->Buffer  )
  31. #define GetNumber( g )      ((( struct StringInfo * )g->SpecialInfo )->LongInt )
  32.  
  33. #define GD_list                                0
  34. #define GD_gadtxt                              1
  35. #define GD_command                             2
  36. #define GD_command2                            3
  37. #define GD_new                                 4
  38. #define GD_del                                 5
  39. #define GD_start                               6
  40. #define GD_save                                7
  41.  
  42. #define GDX_list                               0
  43. #define GDX_gadtxt                             1
  44. #define GDX_command                            2
  45. #define GDX_command2                           3
  46. #define GDX_new                                4
  47. #define GDX_del                                5
  48. #define GDX_start                              6
  49. #define GDX_save                               7
  50.  
  51. #define Project0_CNT 8
  52. UBYTE *vers = "\0$VER: StartWindow 2";
  53.  
  54. extern struct IntuitionBase *IntuitionBase;
  55. extern struct Library       *GadToolsBase;
  56.  
  57. extern struct Screen        *Scr;
  58. extern UBYTE                 *PubScreenName;
  59. extern APTR                  VisualInfo;
  60. extern struct Window        *Project0Wnd;
  61. extern struct Gadget        *Project0GList;
  62. extern struct Gadget        *Project0Gadgets[8];
  63. extern UWORD                 Project0Left;
  64. extern UWORD                 Project0Top;
  65. extern UWORD                 Project0Width;
  66. extern UWORD                 Project0Height;
  67. extern UBYTE                *Project0Wdt;
  68. extern struct TextAttr       topaz8;
  69. extern UWORD                 Project0GTypes[];
  70. extern struct NewGadget      Project0NGad[];
  71. extern ULONG                 Project0GTags[];
  72.  
  73.  
  74. extern int SetupScreen( void );
  75. extern void CloseDownScreen( void );
  76. extern int OpenProject0Window( void );
  77. extern void CloseProject0Window( void );
  78.  
  79. /**********************************************/
  80.  
  81. struct Screen         *Scr = NULL;
  82. UBYTE                 *PubScreenName = NULL;
  83. APTR                   VisualInfo = NULL;
  84. struct Window         *Project0Wnd = NULL;
  85. struct Gadget         *Project0GList = NULL;
  86. struct Gadget         *Project0Gadgets[8];
  87. UWORD                  Project0Left = 440;
  88. UWORD                  Project0Top = 10;
  89. UWORD                  Project0Width = 190;
  90. UWORD                  Project0Height = 0;
  91. UBYTE                 *Project0Wdt = (UBYTE *)"StartWindow2";
  92.  
  93. struct TextAttr topaz8 = {
  94.         ( STRPTR )"topaz.font", 8, 0x00, 0x01 };
  95.  
  96. UWORD Project0GTypes[] = {
  97.         LISTVIEW_KIND,
  98.         STRING_KIND,
  99.         STRING_KIND,
  100.         STRING_KIND,
  101.         BUTTON_KIND,
  102.         BUTTON_KIND,
  103.         BUTTON_KIND,
  104.         BUTTON_KIND
  105. };
  106.  
  107. struct NewGadget Project0NGad[] = {
  108.         4, 2, 160, 88, NULL, NULL, GD_list, 0, NULL, NULL,
  109.         4, 86, 161, 12, NULL, NULL, GD_gadtxt, 0, NULL, NULL,
  110.         4, 98, 161, 12, NULL, NULL, GD_command, 0, NULL, NULL,
  111.         4, 110, 161, 12, NULL, NULL, GD_command2, 0, NULL, NULL,
  112.         4, 122, 54, 11, (UBYTE *)"NEW", NULL, GD_new, PLACETEXT_IN, NULL, NULL,
  113.         114, 122, 51, 11, (UBYTE *)"DEL", NULL, GD_del, PLACETEXT_IN, NULL, NULL,
  114.         4, 133, 161, 13, (UBYTE *)"RUN", NULL, GD_start, PLACETEXT_IN, NULL, NULL,
  115.         59, 122, 54, 11, (UBYTE *)"SAVE", NULL, GD_save, PLACETEXT_IN, NULL, NULL
  116. };
  117.  
  118. ULONG Project0GTags[] = {
  119.         (TAG_DONE),
  120.         (GTST_MaxChars), 256, (TAG_DONE),
  121.         (GTST_MaxChars), 256, (TAG_DONE),
  122.         (GTST_MaxChars), 256, (TAG_DONE),
  123.         (TAG_DONE),
  124.         (TAG_DONE),
  125.         (TAG_DONE),
  126.         (TAG_DONE)
  127. };
  128.  
  129. int SetupScreen( void )
  130. {
  131.         if ( ! ( Scr = LockPubScreen( PubScreenName )))
  132.                 return( 1L );
  133.  
  134.         if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
  135.                 return( 2L );
  136.  
  137.         return( 0L );
  138. }
  139.  
  140. void CloseDownScreen( void )
  141. {
  142.         if ( VisualInfo ) {
  143.                 FreeVisualInfo( VisualInfo );
  144.                 VisualInfo = NULL;
  145.         }
  146.  
  147.         if ( Scr        ) {
  148.                 UnlockPubScreen( NULL, Scr );
  149.                 Scr = NULL;
  150.         }
  151. }
  152.  
  153. int OpenProject0Window( void )
  154. {
  155.         struct NewGadget        ng;
  156.         struct Gadget   *g;
  157.         UWORD           lc, tc;
  158.         UWORD           offx = Scr->WBorLeft, offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
  159.  
  160.         if ( ! ( g = CreateContext( &Project0GList )))
  161.                 return( 1L );
  162.  
  163.         for( lc = 0, tc = 0; lc < Project0_CNT; lc++ ) {
  164.  
  165.                 CopyMem((char * )&Project0NGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
  166.  
  167.                 ng.ng_VisualInfo = VisualInfo;
  168.                 ng.ng_TextAttr   = &topaz8;
  169.                 ng.ng_LeftEdge  += offx;
  170.                 ng.ng_TopEdge   += offy;
  171.  
  172.                 Project0Gadgets[ lc ] = g = CreateGadgetA((ULONG)Project0GTypes[ lc ], g, &ng, ( struct TagItem * )&Project0GTags[ tc ] );
  173.  
  174.                 while( Project0GTags[ tc ] ) tc += 2;
  175.                 tc++;
  176.  
  177.                 if ( NOT g )
  178.                         return( 2L );
  179.         }
  180.  
  181.         if ( ! ( Project0Wnd = OpenWindowTags( NULL,
  182.                                 WA_Left,        Project0Left,
  183.                                 WA_Top,         Project0Top,
  184.                                 WA_Width,       Project0Width,
  185.                                 WA_Height,      Project0Height + offy,
  186.                                 WA_IDCMP,       LISTVIEWIDCMP|
  187.                                                 BUTTONIDCMP|
  188.                                                 STRINGIDCMP|
  189.                                                 IDCMP_NEWSIZE|
  190.                                                 IDCMP_MENUPICK|
  191.                                                 IDCMP_CLOSEWINDOW|
  192.                                                 IDCMP_CHANGEWINDOW|
  193.                                                 IDCMP_INTUITICKS |
  194.                                                 IDCMP_MOUSEBUTTONS|
  195.                                                 IDCMP_REFRESHWINDOW,
  196.                                 WA_Flags,       WFLG_SIZEGADGET|
  197.                                                 WFLG_DRAGBAR|
  198.                                                 WFLG_DEPTHGADGET|
  199.                                                 WFLG_CLOSEGADGET|
  200.                                                 WFLG_SMART_REFRESH,
  201.                                 WA_Gadgets,     Project0GList,
  202.                                 WA_Title,       Project0Wdt,
  203.                                 WA_ScreenTitle, "StartWindow2 Heinz Reinert 1994 ",
  204.                                 WA_PubScreen,   Scr,
  205.                                 WA_MinWidth,    190,
  206.                                 WA_MinHeight,   160,
  207.                                 WA_MaxWidth,    190,
  208.                                 WA_MaxHeight,   160,
  209.                                 TAG_DONE )))
  210.         return( 4L );
  211.  
  212.         GT_RefreshWindow( Project0Wnd, NULL );
  213.  
  214.         return( 0L );
  215. }
  216.  
  217. void CloseProject0Window( void )
  218. {
  219.         if ( Project0Wnd        ) {
  220.                 CloseWindow( Project0Wnd );
  221.                 Project0Wnd = NULL;
  222.         }
  223.  
  224.         if ( Project0GList      ) {
  225.                 FreeGadgets( Project0GList );
  226.                 Project0GList = NULL;
  227.         }
  228. }
  229. /*********************************************/
  230.  
  231. /* Main Program Part */
  232.  
  233. /* Structur for Data-Entries */
  234.  
  235. struct PRJ {
  236.  
  237.     char    Name[