home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
new
/
util
/
wb
/
startwindow
/
source
/
startwindow.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-02
|
17KB
|
602 lines
/*
* Source machine generated by GadToolsBox V2.0b
* which is (c) Copyright 1991-1993 Jaba Development
*
* GUI Designed by : -- Heinz Reinert --
*/
#include <exec/types.h>
#include <string.h>
#include <intuition/intuition.h>
#include <intuition/classes.h>
#include <intuition/classusr.h>
#include <intuition/imageclass.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <graphics/displayinfo.h>
#include <graphics/GfxBase.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/utility_protos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/gadtools.h>
#include <exec/memory.h>
/***************************************/
#define GetString( g ) ((( struct StringInfo * )g->SpecialInfo )->Buffer )
#define GetNumber( g ) ((( struct StringInfo * )g->SpecialInfo )->LongInt )
#define GD_list 0
#define GD_gadtxt 1
#define GD_command 2
#define GD_command2 3
#define GD_new 4
#define GD_del 5
#define GD_start 6
#define GD_save 7
#define GD_req 8
#define GDX_list 0
#define GDX_gadtxt 1
#define GDX_command 2
#define GDX_command2 3
#define GDX_new 4
#define GDX_del 5
#define GDX_start 6
#define GDX_save 7
#define GDX_req 8
#define Project0_CNT 9
UBYTE *vers = "\0$VER: StartWindow 2";
extern struct IntuitionBase *IntuitionBase;
extern struct Library *GadToolsBase;
extern struct Screen *Scr;
extern UBYTE *PubScreenName;
extern APTR VisualInfo;
extern struct Window *Project0Wnd;
extern struct Gadget *Project0GList;
extern struct Gadget *Project0Gadgets[9];
extern UWORD Project0Left;
extern UWORD Project0Top;
extern UWORD Project0Width;
extern UWORD Project0Height;
extern UBYTE *Project0Wdt;
extern struct TextAttr topaz8;
extern UWORD Project0GTypes[];
extern struct NewGadget Project0NGad[];
extern ULONG Project0GTags[];
extern int SetupScreen( void );
extern void CloseDownScreen( void );
extern int OpenProject0Window( void );
extern void CloseProject0Window( void );
/***************************************/
struct Screen *Scr = NULL;
UBYTE *PubScreenName = NULL;
APTR VisualInfo = NULL;
struct Window *Project0Wnd = NULL;
struct Gadget *Project0GList = NULL;
struct Gadget *Project0Gadgets[9];
UWORD Project0Left = 440;
UWORD Project0Top = 10;
UWORD Project0Width = 190;
UWORD Project0Height = 0;
UBYTE *Project0Wdt = (UBYTE *)"StartWindow2";
struct TextAttr topaz8 = {
( STRPTR )"topaz.font", 8, 0x00, 0x01 };
UWORD Project0GTypes[] = {
LISTVIEW_KIND,
STRING_KIND,
STRING_KIND,
STRING_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND
};
struct NewGadget Project0NGad[] = {
4, 2, 161, 88, NULL, NULL, GD_list, 0, NULL, NULL,
4, 86, 138, 12, NULL, NULL, GD_gadtxt, 0, NULL, NULL,
4, 98, 161, 12, NULL, NULL, GD_command, 0, NULL, NULL,
4, 110, 161, 12, NULL, NULL, GD_command2, 0, NULL, NULL,
4, 122, 54, 11, (UBYTE *)"NEW", NULL, GD_new, PLACETEXT_IN, NULL, NULL,
114, 122, 51, 11, (UBYTE *)"DEL", NULL, GD_del, PLACETEXT_IN, NULL, NULL,
4, 133, 161, 13, (UBYTE *)"RUN", NULL, GD_start, PLACETEXT_IN, NULL, NULL,
59, 122, 54, 11, (UBYTE *)"SAVE", NULL, GD_save, PLACETEXT_IN, NULL, NULL,
142, 86, 23, 12, (UBYTE *)"R", NULL, GD_req, PLACETEXT_IN, NULL, NULL
};
ULONG Project0GTags[] = {
(TAG_DONE),
(GTST_MaxChars), 256, (TAG_DONE),
(GTST_MaxChars), 256, (TAG_DONE),
(GTST_MaxChars), 256, (TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE)
};
int SetupScreen( void )
{
if ( ! ( Scr = LockPubScreen( PubScreenName )))
return( 1L );
if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
return( 2L );
return( 0L );
}
void CloseDownScreen( void )
{
if ( VisualInfo ) {
FreeVisualInfo( VisualInfo );
VisualInfo = NULL;
}
if ( Scr ) {
UnlockPubScreen( NULL, Scr );
Scr = NULL;
}
}
int OpenProject0Window( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD offx = Scr->WBorLeft, offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
if ( ! ( g = CreateContext( &Project0GList )))
return( 1L );
for( lc = 0, tc = 0; lc < Project0_CNT; lc++ ) {
CopyMem((char * )&Project0NGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = &topaz8;
ng.ng_LeftEdge += offx;
ng.ng_TopEdge += offy;
Project0Gadgets[ lc ] = g = CreateGadgetA((ULONG)Project0GTypes[ lc ], g, &ng, ( struct TagItem * )&Project0GTags[ tc ] );
while( Project0GTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
if ( ! ( Project0Wnd = OpenWindowTags( NULL,
WA_Left, Project0Left,
WA_Top, Project0Top,
WA_Width, Project0Width,
WA_Height, Project0Height + offy,
WA_IDCMP, LISTVIEWIDCMP|STRINGIDCMP|BUTTONIDCMP|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH,
WA_Gadgets, Project0GList,
WA_Title, Project0Wdt,
WA_ScreenTitle, "StartWindow2 Heinz Reinert 1994",
WA_PubScreen, Scr,
WA_MinWidth, 190,
WA_MinHeight, 160,
WA_MaxWidth, 190,
WA_MaxHeight, 160,
TAG_DONE )))
return( 4L );
GT_RefreshWindow( Project0Wnd, NULL );
return( 0L );
}
void CloseProject0Window( void )
{
if ( Project0Wnd ) {
CloseWindow( Project0Wnd );
Project0Wnd = NULL;
}
if ( Project0GList ) {
FreeGadgets( Project0GList );
Project0GList = NULL;
}
}
/*********************************************/
/* Main Program Part */
/* Structur for Data-Entries */
struct PRJ {
char Name[0];
char gadtxt[20];
char command[75];
char command2[75];
USHORT new;
USHORT del;
USHORT save;
USHORT req;
USHORT start;
};
struct PRJnode {
struct Node n;
struct PRJ d;
};
/* PRJ-Nodes are in this List */
struct List prjlist;
/* The actual Entry */
struct PRJnode *currentprj;
/* String-Gadgets */
void gt_SetString( struct Gadget *gad,
struct Window *w,
char