home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (c) 1994 Michael D. Bayne.
- * All rights reserved.
- *
- * Please see the documentation accompanying the distribution for distribution
- * and disclaimer information.
- */
-
- #include <libraries/gadtools.h>
-
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
-
- #include <string.h>
-
- #include "Executor.h"
- #include "Executor_rev.h"
- #include "/main.h"
- #include "//defs.h"
-
- struct ModulePrefs
- {
- BYTE StartString[128];
- BYTE StopString[128];
- };
-
- struct ModulePrefs nP;
- VOID *OldPrefs = 0L;
- STATIC const UBYTE VersTag[] = VERSTAG;
-
- int BT_SAVEClicked( VOID )
- {
- if( OldPrefs )
- {
- CopyMem( &nP, OldPrefs, sizeof( struct ModulePrefs ));
- SavePrefs( OldPrefs );
- OldPrefs = 0L;
- }
-
- return QUIT;
- }
-
- int BT_TESTClicked( VOID )
- {
- MessageServer( BM_SENDBLANK );
-
- return OK;
- }
-
- int BT_CANCELClicked( VOID )
- {
- OldPrefs = 0L;
-
- return QUIT;
- }
-
- int ST_STARTClicked( VOID )
- {
- strcpy( nP.StartString, GetString( ExecutorGadgets[GD_ST_START] ));
-
- return OK;
- }
-
- int ST_KILLClicked( VOID )
- {
- strcpy( nP.StopString, GetString( ExecutorGadgets[GD_ST_KILL] ));
-
- return OK;
- }
-
- #define BL_SetGadgetAttrs( Gad, Tag, Val ) GT_SetGadgetAttrs( ExecutorGadgets[Gad], ExecutorWnd, 0L, Tag, Val, TAG_END )
-
- int ExecutorVanillaKey( VOID )
- {
- switch( ExecutorMsg.Code ) {
- case 's':
- return BT_SAVEClicked();
- case 't':
- return BT_TESTClicked();
- case 'c':
- return QUIT;
- case 'a':
- ActivateGadget( ExecutorGadgets[GD_ST_START], ExecutorWnd, 0L );
- return OK;
- case 'k':
- ActivateGadget( ExecutorGadgets[GD_ST_KILL], ExecutorWnd, 0L );
- return OK;
- default:
- return OK;
- }
- }
-
- VOID DoPrefs( LONG command, VOID *Prefs )
- {
- switch( command )
- {
- case STARTUP:
- OldPrefs = Prefs;
- CopyMem( Prefs, &nP, sizeof( struct ModulePrefs ));
- if( !SetupScreen())
- {
- ExecutorLeft = ( Scr->Width - ComputeX( ExecutorWidth ))/2 - Scr->WBorRight;
- ExecutorTop = ( Scr->Height - ComputeY( ExecutorHeight ) - Font->ta_YSize )/2 - Scr->WBorBottom;
- if( !OpenExecutorWindow())
- {
- BL_SetGadgetAttrs( GD_ST_START, GTST_String, nP.StartString );
- BL_SetGadgetAttrs( GD_ST_KILL, GTST_String, nP.StopString );
- }
- CloseDownScreen();
- }
- break;
- case IDCMP:
- if( HandleExecutorIDCMP() != QUIT )
- break;
- case KILL:
- CloseExecutorWindow();
- break;
- }
- }
-
- LONG WndSignal( VOID )
- {
- return ExecutorWnd ? 1L << ExecutorWnd->UserPort->mp_SigBit : 0L;
- }
-
- VOID FillDefaults( VOID *Prefs )
- {
- struct ModulePrefs mPO;
-
- strcpy( mPO.StartString, "Blah Blah" );
- strcpy( mPO.StopString, "Teleblah" );
- CopyMem( &mPO, Prefs, sizeof( struct ModulePrefs ));
- }
-