home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Elysian Archive
/
AmigaElysianArchive.iso
/
prog
/
c
/
dicepj11.lha
/
diceproject
/
project.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-12
|
32KB
|
1,129 lines
/*
* Source machine generated by GadToolsBox V1.4
* which is (c) Copyright 1991,92 Jaba Development
*/
#include <exec/types.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/dos_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/utility_protos.h>
#include <clib/diskfont_protos.h>
#include <string.h>
#include <stdlib.h>
#include "project.h"
UWORD ProjectLeft = 0;
UWORD ProjectTop = 409;
UWORD ProjectWidth = 728;
UWORD ProjectHeight = 144;
UWORD CompilerOptLeft = 111;
UWORD CompilerOptTop = 190;
UWORD CompilerOptWidth = 411;
UWORD CompilerOptHeight = 203;
UWORD MessLeft = 0;
UWORD MessTop = 426;
UWORD MessWidth = 728;
UWORD MessHeight = 127;
struct Screen *Scr = NULL;
APTR VisualInfo = NULL;
struct Window *ProjectWnd = NULL;
struct Window *MessWnd = NULL;
struct Window *CListeWnd = NULL;
struct Window *DirSetWnd = NULL;
struct Window *CompileWnd = NULL;
struct Window *CompilerOptWnd = NULL;
struct Gadget *ProjectGList = NULL;
struct Gadget *MessGList = NULL;
struct Gadget *CListeGList = NULL;
struct Gadget *DirSetGList = NULL;
struct Gadget *CompileGList = NULL;
struct Gadget *CompilerOptGList = NULL;
struct Menu *ProjectMenus = NULL;
struct IntuiMessage ProjectMsg;
struct IntuiMessage MessMsg;
struct IntuiMessage DirSetMsg;
struct IntuiMessage CompileMsg;
struct IntuiMessage CompilerOptMsg;
struct TextFont *NFont = NULL;
struct Gadget *ProjectGadgets[1];
struct Gadget *MessGadgets[1];
struct Gadget *CListeGadgets[1];
struct Gadget *DirSetGadgets[12];
struct Gadget *CompileGadgets[2];
struct Gadget *CompilerOptGadgets[13];
UBYTE *ProjectWdt = (UBYTE *)"DICE Project Handler : No Name";
UBYTE *DirSetWdt = (UBYTE *)"Directory current settings :";
UBYTE *CompilerOptWdt = (UBYTE *)"Project Handler : Compiler Options";
struct TextAttr *Font, Attr;
UWORD FontX, FontY;
UWORD OffX, OffY;
UBYTE *CPU4Labels[] = {
(UBYTE *)"680_00/010",
(UBYTE *)"680_20",
(UBYTE *)"680_30",
NULL };
UBYTE *FPU4Labels[] = {
(UBYTE *)"None",
(UBYTE *)"6888_1",
(UBYTE *)"_68882",
NULL };
UBYTE *Data4Labels[] = {
(UBYTE *)"Sm_all",
(UBYTE *)"Larg_e",
NULL };
UBYTE *Code4Labels[] = {
(UBYTE *)"S_mall",
(UBYTE *)"Lar_ge",
NULL };
UBYTE *Calls4Labels[] = {
(UBYTE *)"Registeri_zed",
(UBYTE *)"_Trough Stack",
NULL };
UBYTE *Hunk4Labels[] = {
(UBYTE *)"_Only constant objects",
(UBYTE *)"_Both Constant and String ",
(UBYTE *)"Const, String and _PC-Relative",
NULL };
struct TextAttr times13 = {
( STRPTR )"times.font", 13, 0x00, 0x20 };
struct IntuiText ProjectIText[] = {
1, 0, JAM1,121, 9, ×13, (UBYTE *)"Source Object C Module Name", NULL };
#define Project_TNUM 1
struct IntuiText CompileIText[] = {
1, 0, JAM2,148, 0, ×13, NULL, NULL,
2, 0, JAM1,147, 65535, ×13, NULL, NULL };
#define Compile_TNUM 2
struct IntuiText CompilerOptIText[] = {
2, 0, JAM2,124, 119, ×13, (UBYTE *)" Strange Options ", &CompilerOptIText[1],
2, 0, JAM2,44, 3, ×13, (UBYTE *)" Code Generation ", &CompilerOptIText[2],
2, 0, JAM2,14, 70, ×13, (UBYTE *)" Data Models ", &CompilerOptIText[3],
2, 0, JAM2,104, 70, ×13, (UBYTE *)" Code Models ", &CompilerOptIText[4],
2, 0, JAM2,245, 70, ×13, (UBYTE *)" Procedure Calls ", &CompilerOptIText[5],
2, 0, JAM2,234, 3, ×13, (UBYTE *)" Constant Hunk Code ", NULL
};
struct NewMenu ProjectNewMenu[] = {
NM_TITLE, (STRPTR)MENU_PROJECT, NULL, 0, NULL, NULL,
NM_ITEM, (STRPTR)MENU_NEW, (STRPTR)"N", 0, 0L, (APTR)ProjectNew,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)MENU_OPEN, (STRPTR)"O", 0, 0L, (APTR)ProjectOpen,
NM_ITEM, (STRPTR)MENU_SAVE, (STRPTR)"S", 0, 0L, (APTR)ProjectSave,
NM_ITEM, (STRPTR)MENU_SAVEAS, NULL, 0, 0L, (APTR)ProjectSaveas,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)MENU_ICONIFY, (STRPTR)"I", NM_ITEMDISABLED, 0L, (APTR)ProjectIcon,
NM_ITEM, (STRPTR)MENU_ABOUT, NULL, 0, 0L, (APTR)ProjectAbout,
NM_ITEM, (STRPTR)MENU_QUIT, (STRPTR)"Q", 0, 0L, (APTR)ProjectQuit,
NM_TITLE, (STRPTR)MENU_MODULE, NULL, 0, NULL, NULL,
NM_ITEM, (STRPTR)MENU_EDIT, (STRPTR)"E", 0, 0L, (APTR)ProjectEdit,
NM_ITEM, (STRPTR)MENU_INCLUDEFILE, NULL, 0, 0L, (APTR)ProjectInclude,
NM_ITEM, (STRPTR)MENU_COMMENT, NULL , 0 , 0L , NULL,
NM_SUB , (STRPTR)MENU_COMMENT_VIEW,NULL , 0 , 0L , (APTR)ProjectComment,
NM_SUB , (STRPTR)MENU_COMMENT_KILL,NULL , 0 , 0L , (APTR)ProjectCommentKill,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)MENU_ADDMODULE, (STRPTR)"A", 0, 0L, (APTR)ProjectAdd,
NM_ITEM, (STRPTR)MENU_REMMODULE, (STRPTR)"R", 0, 0L, (APTR)ProjectRem,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)MENU_OPENEXT, NULL, 0, 0L, (APTR)ProjectOther,
NM_TITLE, (STRPTR)MENU_CODE, NULL, 0, NULL, NULL,
NM_ITEM, (STRPTR)MENU_GENERATE, (STRPTR)"G", 0, 0L, (APTR)ProjectGenerate,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)MENU_MAKEPRG , (STRPTR)"P" , 0 , 0L , (APTR)ProjectMake,
NM_ITEM, (STRPTR)MENU_MAKELIB , (STRPTR)"L", 0 , 0L , (APTR)ProjectLibrary,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)MENU_COMPILE, NULL, 0, 0L, (APTR)ProjectCompile,
NM_ITEM, (STRPTR)MENU_LINK, NULL, 0, 0L, (APTR)ProjectLink,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)MENU_LAUNCH , NULL , 0 , 0L , NULL ,
NM_SUB ,(STRPTR)MENU_LAUNCH_CLI , NULL , 0 , 0L , (APTR)ProjectLaunch,
NM_SUB, (STRPTR)MENU_LAUNCH_WB , NULL , NM_ITEMDISABLED , 0L , (APTR)ProjectLaunchWB,
NM_ITEM, (STRPTR)MENU_INFOCODE, NULL, 0, 0L, (APTR)ProjectCodeInfo,
NM_TITLE, (STRPTR)MENU_OPTIONS, NULL, 0, NULL, NULL,
NM_ITEM, (STRPTR)MENU_COMPILER_OPT, NULL, 0, 0L, (APTR)ProjectCompilerOpt,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)MENU_DIR_OPT, NULL, 0, 0L, (APTR)ProjectDirectory,
NM_ITEM, (STRPTR)NM_BARLABEL, NULL, 0, 0L, NULL,
NM_ITEM, (STRPTR)MENU_SCREEN_OPT, NULL, 0, 0L, (APTR)ProjectScreenOpt,
NM_ITEM, (STRPTR)MENU_SAVE_OPT , NULL,0,0L,(APTR)SavePrefs,
NM_END, NULL, NULL, 0, 0L, NULL };
UWORD ProjectGTypes[] = {
LISTVIEW_KIND
};
UWORD MessGTypes[] = {
LISTVIEW_KIND
};
UWORD CListeGTypes[] = {
LISTVIEW_KIND
};
UWORD DirSetGTypes[] = {
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND,
TEXT_KIND,
TEXT_KIND,
TEXT_KIND,
TEXT_KIND,
TEXT_KIND,
TEXT_KIND
};
UWORD CompileGTypes[] = {
TEXT_KIND,
BUTTON_KIND
};
UWORD CompilerOptGTypes[] = {
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
MX_KIND,
MX_KIND,
MX_KIND,
MX_KIND,
MX_KIND,
CHECKBOX_KIND,
MX_KIND
};
struct NewGadget ProjectNGad[] = {
3, 15, -6, -25, NULL, NULL, GD_ModuleList, 0, NULL, (APTR)ModuleListClicked
};
struct NewGadget MessNGad[] = {
3, 3, -6, -14, NULL, NULL, GD_ModuleList, 0, NULL, (APTR)MessListClicked
};
struct NewGadget CListeNGad[] = {
3, 3, 267, 160, NULL, NULL, GD_ScreenList, 0, NULL, NULL
};
struct NewGadget DirSetNGad[] = {
5, 4, 101, 15, (UBYTE *)"_Source", NULL, GD_Source, PLACETEXT_IN, NULL, (APTR)SourceClicked,
5, 26, 101, 15, (UBYTE *)"D_estination", NULL, GD_Dest, PLACETEXT_IN, NULL, (APTR)DestClicked,
5, 48, 101, 15, (UBYTE *)"_Includes", NULL, GD_Include, PLACETEXT_IN, NULL, (APTR)IncludeClicked,
5, 70, 101, 15, (UBYTE *)"_Libraries", NULL, GD_Lib, PLACETEXT_IN, NULL, (APTR)LibClicked,
5, 92, 101, 15, (UBYTE *)"_Objects", NULL, GD_Obj, PLACETEXT_IN, NULL, (APTR)ObjClicked,
5, 114, 101, 15, (UBYTE *)"_DICE", NULL, GD_Prg, PLACETEXT_IN, NULL, (APTR)PrgClicked,
113, 4, 206, 15, NULL, NULL, GD_SourceString, 0, NULL, NULL,
113, 26, 206, 15, NULL, NULL, GD_DestString, 0, NULL, NULL,
113, 48, 206, 15, NULL, NULL, GD_IncludeString, 0, NULL, NULL,
113, 70, 206, 15, NULL, NULL, GD_LibString, 0, NULL, NULL,
113, 92, 206, 15, NULL, NULL, GD_ObjString, 0, NULL, NULL
113, 114, 206, 15, NULL, NULL, GD_PrgString, 0, NULL, NULL
};
struct NewGadget CompileNGad[] = {
5, 7, 284, 12, NULL, NULL, GD_CompileName, 0, NULL, NULL,
63, 25, 164, 12, (UBYTE *)TXT_ABORT_PROCESS, NULL, GD_Gadget13, PLACETEXT_IN, NULL, NULL
};
struct NewGadget CompilerOptNGad[] = {
218, 135, 26, 11, (UBYTE *)"Relocation _Hunks", NULL, GD_Reloc, PLACETEXT_RIGHT, NULL, (APTR)RelocClicked,
17, 135, 26, 11, (UBYTE *)"Executable _Residentable", NULL, GD_Resident, PLACETEXT_RIGHT, NULL, (APTR)ResidentClicked,
218, 156, 26, 11, (UBYTE *)"Include _Debug Information", NULL, GD_DInfo, PLACETEXT_RIGHT, NULL, (APTR)DInfoClicked,
218, 177, 26, 11, (UBYTE *)"Debug _Level 1", NULL, GD_DLevel, PLACETEXT_RIGHT, NULL, (APTR)DLevelClicked,
17, 156, 26, 11, (UBYTE *)"Generate Dynamic _Stack", NULL, GD_Stack, PLACETEXT_RIGHT, NULL, (APTR)StackClicked,
17, 177, 26, 11, (UBYTE *)"Force code in _Chip", NULL, GD_Chip, PLACETEXT_RIGHT, NULL, (APTR)ChipClicked,
21, 20, 17, 9, NULL, NULL, GD_CPU, PLACETEXT_RIGHT, NULL, (APTR)CPUClicked,
115, 20, 17, 9, NULL, NULL, GD_FPU, PLACETEXT_RIGHT, NULL, (APTR)FPUClicked,
19, 86, 17, 9, NULL, NULL, GD_Data, PLACETEXT_RIGHT, NULL, (APTR)DataClicked,
112, 86, 17, 9, NULL, NULL, GD_Code, PLACETEXT_RIGHT, NULL, (APTR)CodeClicked,
199, 86, 17, 9, NULL, NULL, GD_Calls, PLACETEXT_RIGHT, NULL, (APTR)CallsClicked,
366, 92, 26, 11, (UBYTE *)"_Inline Calls", NULL, GD_Inline, PLACETEXT_LEFT, NULL, (APTR)InlineClicked,
205, 20, 17, 9, NULL, NULL, GD_Hunk, PLACETEXT_RIGHT, NULL, (APTR)HunkClicked
};
ULONG ProjectGTags[] = {
(GTLV_ShowSelected), NULL, (TAG_DONE)
};
ULONG MessGTags[] = {
(TAG_DONE)
};
ULONG CListeGTags[] = {
(TAG_DONE)
};
ULONG DirSetGTags[] = {
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GTTX_Border), TRUE, (TAG_DONE),
(GTTX_Border), TRUE, (TAG_DONE),
(GTTX_Border), TRUE, (TAG_DONE),
(GTTX_Border), TRUE, (TAG_DONE),
(GTTX_Border), TRUE, (TAG_DONE),
(GTTX_Border), TRUE, (TAG_DONE)
};
ULONG CompileGTags[] = {
(GTTX_Border), TRUE, (TAG_DONE),
(TAG_DONE)
};
ULONG CompilerOptGTags[] = {
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (GTMX_Labels), (ULONG)&CPU4Labels[ 0 ], (GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (GTMX_Labels), (ULONG)&FPU4Labels[ 0 ], (GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (GTMX_Labels), (ULONG)&Data4Labels[ 0 ], (GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (GTMX_Labels), (ULONG)&Code4Labels[ 0 ], (GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (GTMX_Labels), (ULONG)&Calls4Labels[ 0 ], (GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (GTMX_Labels), (ULONG)&Hunk4Labels[ 0 ], (GT_Underscore), '_', (TAG_DONE)
};
struct ColorSpec ScreenColors[] = {
0, 0x0C, 0x0B, 0x09,
1, 0x00, 0x00, 0x00,
2, 0x0F, 0x0F, 0x0F,
3, 0x08, 0x06, 0x05,
4, 0x00, 0x00, 0x0F,
5, 0x0F, 0x00, 0x00,
6, 0x00, 0x0F, 0x00,
7, 0x0F, 0x0F, 0x00,
8, 0x06, 0x02, 0x00,
9, 0x0A, 0x06, 0x04,
10, 0x0E, 0x0A, 0x08,
11, 0x00, 0x0A, 0x00,
12, 0x08, 0x0F, 0x0A,
13, 0x08, 0x08, 0x08,
14, 0x06, 0x06, 0x06,
15, 0x0C, 0x0C, 0x0C,
~0, 0x00, 0x00, 0x00 };
UWORD DriPens[] = {
0,1,1,2,1,3,1,0,2,~0 };
static UWORD ComputeX( UWORD value )
{
return(( UWORD )((( FontX * value ) + 4 ) / 8 ));
}
static UWORD ComputeY( UWORD value )
{
return(( UWORD )((( FontY * value ) + 4 ) / 8 ));
}
static UWORD IComputeX( UWORD value )
{
return(( UWORD )((( 8 * value ) - 4 ) / FontX ));
}
static UWORD IComputeY( UWORD value )
{
return(( UWORD )((( 8 * value ) - 4 ) / FontY ));
}
static void ComputeFont( UWORD width, UWORD height )
{
Font = &Attr;
Font->ta_Name = (STRPTR)GfxBase->DefaultFont->tf_Message.mn_Node.ln_Name;
Font->ta_YSize = FontY = GfxBase->DefaultFont->tf_YSize;
FontX = GfxBase->DefaultFont->tf_XSize;
OffX = Scr->WBorLeft;
OffY = Scr->RastPort.TxHeight + Scr->WBorTop + 1;
if ( width && height ) {
if (( ComputeX( width ) + OffX + Scr->WBorRight ) > Scr->Width )
goto UseTopaz;
if (( ComputeY( height ) + OffY + Scr->WBorBottom ) > Scr->Height )
goto UseTopaz;
}
return;
UseTopaz:
Font->ta_Name = (STRPTR)"topaz.font";
FontX = FontY = Font->ta_YSize = 8;
}
char PubName[20] = "DICE_Project";
int SetupScreen( void )
{
LONG PubNum = 1;
ULONG ErrorCode=OSERR_PUBNOTUNIQUE;
if ( ! ( NFont = OpenDiskFont( ×13 )))
return( 5L );
while( ErrorCode == OSERR_PUBNOTUNIQUE || ErrorCode == OSERR_NOMONITOR ) {
ErrorCode = 0;
Scr = OpenScreenTags( NULL, SA_Left, 0,
SA_Top, 0,
SA_Width, STDSCREENWIDTH,
SA_Height, STDSCREENHEIGHT,
SA_Depth, 2,
SA_Colors, &ScreenColors[0],
SA_Type, PUBLICSCREEN,
SA_DisplayID, DisplayScreen,
SA_Pens, &DriPens[0],
SA_Title, "DICE Project Handler Screen v1.1 by Cedric Counotte",
SA_PubName, PubName,
SA_SysFont, 1,
SA_ErrorCode , &ErrorCode,
TAG_DONE );
if ( ErrorCode == OSERR_PUBNOTUNIQUE ) {
strcpy( PubName , "DICE_Project." );
ltoa( &PubName[13] , PubNum++ );
}
if ( ErrorCode == OSERR_NOMONITOR )
DisplayScreen = HIRESLACE_KEY;
}
ComputeFont( 0, 0 );
if ( ! ( VisualInfo = GetVisualInfoA( Scr, 0 )))
return( 2L );
PubScreenStatus( Scr , ~PSNF_PRIVATE );
SetPubScreenModes( SHANGHAI|POPPUBSCREEN );
return( 0L );
}
int CloseDownScreen( void )
{
struct EasyStruct es = {
sizeof(struct EasyStruct),
0,
"Project request",
"Please close every window on the screen !",
"Continue",
};
struct Window *wnd;
if ( VisualInfo ) {
FreeVisualInfo( VisualInfo );
VisualInfo = NULL;
}
if ( Scr ) {
while ( Scr->FirstWindow ) {
wnd = BuildEasyRequestArgs( ProjectWnd , &es , NULL , NULL );
while( Scr->FirstWindow != wnd || Scr->FirstWindow->NextWindow );
FreeSysRequest( wnd );
}
CloseScreen( Scr );
}
if ( NFont ) {
CloseFont( NFont );
NFont = NULL;
}
}
void ProjectRender( void )
{
struct IntuiText it;
UWORD cnt;
ComputeFont( ProjectWidth, ProjectHeight );
for ( cnt = 0; cnt < Project_TNUM; cnt++ ) {
CopyMem(( char * )&ProjectIText[ cnt ], ( char * )&it, (long)sizeof( struct IntuiText ));
it.ITextFont = Font;
it.LeftEdge = OffX + ComputeX( it.LeftEdge ) - ( IntuiTextLength( &it ) >> 1 );
it.TopEdge = OffY + ComputeY( it.TopEdge ) - ( Font->ta_YSize >> 1 );
PrintIText( ProjectWnd->RPort, &it, 0, 0 );
}
}
int HandleProjectIDCMP( void )
{
struct IntuiMessage *m;
struct MenuItem *n;
int (*func)(void);
BOOL running = TRUE;
while( m = GT_GetIMsg( ProjectWnd->UserPort )) {
CopyMem(( char * )m, ( char * )&ProjectMsg, (long)sizeof( struct IntuiMessage ));
GT_ReplyIMsg( m );
switch ( ProjectMsg.Class ) {
case IDCMP_REFRESHWINDOW:
GT_BeginRefresh( ProjectWnd );
GT_EndRefresh( ProjectWnd, TRUE );
break;
case IDCMP_CLOSEWINDOW:
return( ProjectCloseWindow() );
break;
case IDCMP_NEWSIZE:
running = ProjectNewSize();
break;
case IDCMP_GADGETUP:
func = ( void * )(( struct Gadget * )ProjectMsg.IAddress )->UserData;
running = func();
break;
case IDCMP_MENUPICK:
while( ProjectMsg.Code != MENUNULL ) {
n = ItemAddress( ProjectMenus, ProjectMsg.Code );
func = (void *)(GTMENUITEM_USERDATA( n ));
running = func();
if ( (APTR)func == (APTR)&ProjectScreenOpt ||
(APTR)func == (APTR)&ProjectNewSize ||
(APTR)func == (APTR)&ProjectOpen )
break;
ProjectMsg.Code = n->NextSelect;
}
break;
}
}
return( running );
}
int OpenProjectWindow( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD wleft = ProjectLeft, wtop = ProjectTop, ww, wh;
struct TagItem menut[] = { GTMN_TextAttr, ×13, TAG_DONE };
ComputeFont( ProjectWidth, ProjectHeight );
ww = ComputeX( ProjectWidth );
wh = ComputeY( ProjectHeight );
if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;
if (( wleft + ww ) > Scr->Width ) ww = Scr->Width - OffX - Scr->WBorRight;
if (( wtop + wh ) > Scr->Height ) wh = Scr->Height - OffY - Scr->WBorBottom ;
if ( ! ( g = CreateContext( &ProjectGList )))
return( 1L );
for( lc = 0, tc = 0; lc < Project_CNT; lc++ ) {
CopyMem((char * )&ProjectNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = Font;
ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
ng.ng_Width = IComputeX( ww ) + ng.ng_Width;
ng.ng_Height = IComputeY( wh ) + ng.ng_Height;
ng.ng_Width = ComputeX( ng.ng_Width );
ng.ng_Height = ComputeY( ng.ng_Height);
ProjectGadgets[ lc ] = g = CreateGadgetA((ULONG)ProjectGTypes[ lc ], g, &ng, ( struct TagItem * )&ProjectGTags[ tc ] );
while( ProjectGTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
if ( ! ( ProjectMenus = CreateMenusA( ProjectNewMenu, 0L )))
return( 3L );
LayoutMenusA( ProjectMenus, VisualInfo, menut );
if ( ! ( ProjectWnd = OpenWindowTags( NULL,
WA_Left, wleft,
WA_Top, wtop,
WA_Width, ww + OffX + Scr->WBorRight,
WA_Height, wh + OffY + Scr->WBorBottom,
WA_IDCMP, IDCMP_NEWSIZE|LISTVIEWIDCMP|IDCMP_MENUPICK|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SIZEBBOTTOM|WFLG_SMART_REFRESH,
WA_Gadgets, ProjectGList,
WA_Title, ProjectWdt,
WA_CustomScreen, Scr,
WA_Activate , TRUE,
WA_MinWidth, 360,
WA_MinHeight, 100,
WA_MaxWidth, ~0,
WA_MaxHeight, ~0,
TAG_DONE )))
return( 4L );
SetMenuStrip( ProjectWnd, ProjectMenus );
GT_RefreshWindow( ProjectWnd, NULL );
ProjectRender();
return( 0L );
}
void CloseProjectWindow( void )
{
ComputeFont( ProjectWidth, ProjectHeight );
ProjectTop = ProjectWnd->TopEdge;
ProjectLeft = ProjectWnd->LeftEdge;
ProjectWidth = IComputeX( ProjectWnd->Width - OffX - Scr->WBorRight + 1 );
ProjectHeight = IComputeY( ProjectWnd->Height - OffY - Scr->WBorBottom + 1 );
if ( ProjectMenus ) {
ClearMenuStrip( ProjectWnd );
FreeMenus( ProjectMenus );
ProjectMenus = NULL; }
if ( ProjectWnd ) {
CloseWindow( ProjectWnd );
ProjectWnd = NULL;
}
if ( ProjectGList ) {
FreeGadgets( ProjectGList );
ProjectGList = NULL;
}
}
int HandleMessIDCMP( void )
{
struct IntuiMessage *m;
struct MenuItem *n;
int (*func)(void);
BOOL running = TRUE;
while( m = GT_GetIMsg( MessWnd->UserPort )) {
CopyMem(( char * )m, ( char * )&MessMsg, (long)sizeof( struct IntuiMessage ));
GT_ReplyIMsg( m );
switch ( MessMsg.Class ) {
case IDCMP_REFRESHWINDOW:
GT_BeginRefresh( MessWnd );
GT_EndRefresh( MessWnd, TRUE );
break;
case IDCMP_CLOSEWINDOW:
running = MessCloseWindow();
return( running );
break;
case IDCMP_NEWSIZE:
running = MessNewSize();
break;
case IDCMP_GADGETUP:
func = ( void * )(( struct Gadget * )MessMsg.IAddress )->UserData;
running = func();
break;
case IDCMP_MENUPICK:
while( MessMsg.Code != MENUNULL ) {
n = ItemAddress( ProjectMenus, MessMsg.Code );
func = (void *)(GTMENUITEM_USERDATA( n ));
running = func();
MessMsg.Code = n->NextSelect;
}
break;
}
}
return( running );
}
int OpenMessWindow( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD wleft = MessLeft, wtop = MessTop, ww, wh;
ComputeFont( MessWidth, MessHeight );
ww = ComputeX( MessWidth );
wh = ComputeY( MessHeight );
if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;
if ( ! ( g = CreateContext( &MessGList )))
return( 1L );
for( lc = 0, tc = 0; lc < Project_CNT; lc++ ) {
CopyMem((char * )&MessNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = Font;
ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
ng.ng_Width = ComputeX( MessWidth + ng.ng_Width );
ng.ng_Height = ComputeY( MessHeight + ng.ng_Height);
MessGadgets[ lc ] = g = CreateGadgetA((ULONG)MessGTypes[ lc ], g, &ng, ( struct TagItem * )&MessGTags[ tc ] );
while( MessGTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
if ( ! ( MessWnd = OpenWindowTags( NULL,
WA_Left, wleft,
WA_Top, wtop,
WA_Width, ww + OffX + Scr->WBorRight,
WA_Height, wh + OffY + Scr->WBorBottom,
WA_IDCMP, IDCMP_NEWSIZE|LISTVIEWIDCMP|IDCMP_MENUPICK|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SIZEBBOTTOM|WFLG_SMART_REFRESH,
WA_Gadgets, MessGList,
WA_Title, "Project Handler : Messages",
WA_CustomScreen, Scr,
WA_MinWidth, 360,
WA_MinHeight, 70,
WA_MaxWidth, ~0,
WA_MaxHeight, ~0,
TAG_DONE )))
return( 4L );
SetMenuStrip( MessWnd, ProjectMenus );
GT_RefreshWindow( MessWnd, NULL );
return( 0L );
}
void CloseMessWindow( void )
{
ComputeFont( MessWidth, MessHeight );
MessTop = MessWnd->TopEdge;
MessLeft = MessWnd->LeftEdge;
MessWidth = IComputeX( MessWnd->Width - OffX - Scr->WBorRight + 1 );
MessHeight = IComputeY( MessWnd->Height - OffY - Scr->WBorBottom + 1);
if ( ProjectMenus )
ClearMenuStrip( MessWnd );
if ( MessWnd ) {
CloseWindow( MessWnd );
MessWnd = NULL;
}
if ( MessGList ) {
FreeGadgets( MessGList );
MessGList = NULL;
}
}
int OpenCListeWindow( char *title )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD wleft = 205, wtop = 140, ww, wh;
ComputeFont( 274, 165 );
ww = ComputeX( 274 );
wh = ComputeY( 165 );
if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;
if ( ! ( g = CreateContext( &CListeGList )))
return( 1L );
for( lc = 0, tc = 0; lc < Scr_CNT; lc++ ) {
CopyMem((char * )&CListeNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = ×13;
ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
ng.ng_Width = ComputeX( ng.ng_Width );
ng.ng_Height = ComputeY( ng.ng_Height);
CListeGadgets[ lc ] = g = CreateGadgetA((ULONG)CListeGTypes[ lc ], g, &ng, ( struct TagItem * )&CListeGTags[ tc ] );
while( CListeGTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
if ( ! ( CListeWnd = OpenWindowTags( NULL,
WA_Left, wleft,
WA_Top, wtop,
WA_Width, ww + OffX + Scr->WBorRight,
WA_Height, wh + OffY + Scr->WBorBottom,
WA_IDCMP, LISTVIEWIDCMP|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH,
WA_Gadgets, CListeGList,
WA_Title, title,
WA_CustomScreen, Scr,
TAG_DONE )))
return( 4L );
GT_RefreshWindow( CListeWnd, NULL );
return( 0L );
}
void CloseCListeWindow( void )
{
if ( CListeWnd ) {
CloseWindow( CListeWnd );
CListeWnd = NULL;
}
if ( CListeGList ) {
FreeGadgets( CListeGList );
CListeGList = NULL;
}
}
int HandleDirSetIDCMP( void )
{
struct IntuiMessage *m;
int (*func)(void);
BOOL running = TRUE;
while( m = GT_GetIMsg( DirSetWnd->UserPort )) {
CopyMem(( char * )m, ( char * )&DirSetMsg, (long)sizeof( struct IntuiMessage ));
GT_ReplyIMsg( m );
switch ( DirSetMsg.Class ) {
case IDCMP_CLOSEWINDOW:
running = DirSetCloseWindow();
break;
case IDCMP_GADGETUP:
func = ( void * )(( struct Gadget * )DirSetMsg.IAddress )->UserData;
running = func();
break;
break;
}
}
return( running );
}
int OpenDirSetWindow( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD wleft = 182, wtop = 200, ww, wh;
ComputeFont( 325, 135 );
ww = ComputeX( 325 );
wh = ComputeY( 135 );
if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;
if ( ! ( g = CreateContext( &DirSetGList )))
return( 1L );
for( lc = 0, tc = 0; lc < DirSet_CNT; lc++ ) {
CopyMem((char * )&DirSetNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = ×13;
ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
ng.ng_Width = ComputeX( ng.ng_Width );
ng.ng_Height = ComputeY( ng.ng_Height);
DirSetGadgets[ lc ] = g = CreateGadgetA((ULONG)DirSetGTypes[ lc ], g, &ng, ( struct TagItem * )&DirSetGTags[ tc ] );
while( DirSetGTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
if ( ! ( DirSetWnd = OpenWindowTags( NULL,
WA_Left, wleft,
WA_Top, wtop,
WA_Width, ww + OffX + Scr->WBorRight,
WA_Height, wh + OffY + Scr->WBorBottom,
WA_IDCMP, BUTTONIDCMP|TEXTIDCMP|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_RMBTRAP,
WA_Gadgets, DirSetGList,
WA_Title, DirSetWdt,
WA_Activate , TRUE,
WA_CustomScreen, Scr,
TAG_DONE )))
return( 4L );
GT_RefreshWindow( DirSetWnd, NULL );
return( 0L );
}
void CloseDirSetWindow( void )
{
if ( DirSetWnd ) {
CloseWindow( DirSetWnd );
DirSetWnd = NULL;
}
if ( DirSetGList ) {
FreeGadgets( DirSetGList );
DirSetGList = NULL;
}
}
void CompileRender( char *title )
{
struct IntuiText it;
UWORD cnt;
ComputeFont( 293,44 );
SetAPen( CompileWnd->RPort , 0 );
RectFill( CompileWnd->RPort , 5 , 5 , ComputeX( 288 ) , Font->ta_YSize + 5 );
for ( cnt = 0; cnt < Compile_TNUM; cnt++ ) {
CopyMem(( char * )&CompileIText[ cnt ], ( char * )&it, (long)sizeof( struct IntuiText ));
it.IText = title;
it.ITextFont = Font;
it.LeftEdge = OffX + ComputeX( it.LeftEdge ) - ( IntuiTextLength( &it ) >> 1 );
it.TopEdge = OffY + ComputeY( it.TopEdge ) - ( Font->ta_YSize >> 1 );
PrintIText( CompileWnd->RPort, &it, 0, 0 );
}
}
int OpenCompileWindow( char *title )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD wleft = ProjectWnd->LeftEdge + (ProjectWnd->Width>>1) - 146, wtop = ProjectWnd->TopEdge + (ProjectWnd->Height>>1) - 22, ww, wh;
ComputeFont( 293, 44 );
ww = ComputeX( 293 );
wh = ComputeY( 44 );
if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;
if ( ! ( g = CreateContext( &CompileGList )))
return( 1L );
for( lc = 0, tc = 0; lc < Compile_CNT; lc++ ) {
CopyMem((char * )&CompileNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = Font;
ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
ng.ng_Width = ComputeX( ng.ng_Width );
ng.ng_Height = ComputeY( ng.ng_Height);
CompileGadgets[ lc ] = g = CreateGadgetA((ULONG)CompileGTypes[ lc ], g, &ng, ( struct TagItem * )&CompileGTags[ tc ] );
while( CompileGTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
if ( ! ( CompileWnd = OpenWindowTags( NULL,
WA_Left, wleft,
WA_Top, wtop,
WA_Width, ww + OffX + Scr->WBorRight,
WA_Height, wh + OffY + Scr->WBorBottom,
WA_IDCMP, TEXTIDCMP|BUTTONIDCMP|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_SMART_REFRESH,
WA_Gadgets, CompileGList,
WA_CustomScreen, Scr,
TAG_DONE )))
return( 4L );
GT_RefreshWindow( CompileWnd, NULL );
CompileRender( title );
return( 0L );
}
void CloseCompileWindow( void )
{
if ( CompileWnd ) {
CloseWindow( CompileWnd );
CompileWnd = NULL;
}
if ( CompileGList ) {
FreeGadgets( CompileGList );
CompileGList = NULL;
}
}
void CompilerOptRender( void )
{
UWORD offx, offy;
struct TagItem bevelt[] = { GT_VisualInfo , VisualInfo , TAG_DONE };
offx = CompilerOptWnd->BorderLeft;
offy = CompilerOptWnd->BorderTop;
DrawBevelBoxA( CompilerOptWnd->RPort, offx + 97, offy + 76, 91, 41, bevelt );
DrawBevelBoxA( CompilerOptWnd->RPort, offx + 4, offy + 76, 91, 41, bevelt );
DrawBevelBoxA( CompilerOptWnd->RPort, offx + 191, offy + 76, 209, 41, bevelt );
DrawBevelBoxA( CompilerOptWnd->RPort, offx + 3, offy + 9, 185, 59, bevelt );
DrawBevelBoxA( CompilerOptWnd->RPort, offx + 191, offy + 9, 209, 59, bevelt );
DrawBevelBoxA( CompilerOptWnd->RPort, offx + 4, offy + 125, 396, 73, bevelt );
PrintIText( CompilerOptWnd->RPort, CompilerOptIText, offx, offy );
}
int HandleCompilerOptIDCMP( void )
{
struct IntuiMessage *m;
int (*func)(void);
BOOL running = TRUE;
while( m = GT_GetIMsg( CompilerOptWnd->UserPort )) {
CopyMem(( char * )m, ( char * )&CompilerOptMsg, (long)sizeof( struct IntuiMessage ));
GT_ReplyIMsg( m );
switch ( CompilerOptMsg.Class ) {
case IDCMP_REFRESHWINDOW:
GT_BeginRefresh( CompilerOptWnd );
CompilerOptRender();
GT_EndRefresh( CompilerOptWnd, TRUE );
break;
case IDCMP_CLOSEWINDOW:
running = CompilerOptCloseWindow();
break;
case IDCMP_GADGETUP:
case IDCMP_GADGETDOWN:
func = ( void * )(( struct Gadget * )CompilerOptMsg.IAddress )->UserData;
running = func();
break;
break;
}
}
return( running );
}
int OpenCompilerOptWindow( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD offx = Scr->WBorLeft, offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
if ( ! ( g = CreateContext( &CompilerOptGList )))
return( 1L );
for( lc = 0, tc = 0; lc < CompilerOpt_CNT; lc++ ) {
CopyMem((char * )&CompilerOptNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = ×13;
ng.ng_LeftEdge += offx;
ng.ng_TopEdge += offy;
CompilerOptGadgets[ lc ] = g = CreateGadgetA((ULONG)CompilerOptGTypes[ lc ], g, &ng, ( struct TagItem * )&CompilerOptGTags[ tc ] );
while( CompilerOptGTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
if ( ! ( CompilerOptWnd = OpenWindowTags( NULL,
WA_Left, CompilerOptLeft,
WA_Top, CompilerOptTop,
WA_Width, CompilerOptWidth,
WA_Height, CompilerOptHeight + offy,
WA_IDCMP, CHECKBOXIDCMP|MXIDCMP|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH,
WA_Gadgets, CompilerOptGList,
WA_Title, CompilerOptWdt,
WA_CustomScreen, Scr,
TAG_DONE )))
return( 4L );
GT_RefreshWindow( CompilerOptWnd, NULL );
CompilerOptRender();
return( 0L );
}
void CloseCompilerOptWindow( void )
{
if ( CompilerOptWnd ) {
CloseWindow( CompilerOptWnd );
CompilerOptWnd = NULL;
}
if ( CompilerOptGList ) {
FreeGadgets( CompilerOptGList );
CompilerOptGList = NULL;
}
}