home *** CD-ROM | disk | FTP | other *** search
- #include <libraries/gadtools.h>
-
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
-
- #include "/Garshnelib/Garshnelib_protos.h"
- #include "/Garshnelib/Garshnelib_pragmas.h"
-
- #include "Dragon.h"
- #include "Dragon_rev.h"
- #include "/main.h"
- #include "//defs.h"
-
- struct ModulePrefs
- {
- LONG Mode;
- LONG Depth;
- };
-
- 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_SCREENClicked( VOID )
- {
- ScreenModeRequest( DragonWnd, &nP.Mode, &nP.Depth );
-
- return OK;
- }
-
- int BT_CANCELClicked( VOID )
- {
- OldPrefs = 0L;
-
- return QUIT;
- }
-
- #define BL_SetGadgetAttrs( Gad, Tag, Val ) GT_SetGadgetAttrs( DragonGadgets[Gad], DragonWnd, 0L, Tag, Val, TAG_END )
-
- int DragonVanillaKey( VOID )
- {
- switch( DragonMsg.Code ) {
- case 's':
- return BT_SAVEClicked();
- case 't':
- return BT_TESTClicked();
- case 'd':
- return BT_SCREENClicked();
- case 'c':
- return QUIT;
- default:
- return OK;
- }
- }
-
- VOID DoPrefs( LONG command, VOID *Prefs )
- {
- switch( command )
- {
- case STARTUP:
- OldPrefs = Prefs;
- CopyMem( Prefs, &nP, sizeof( struct ModulePrefs ));
- if( !SetupScreen())
- {
- DragonLeft = ( Scr->Width - ComputeX( DragonWidth ))/2 - Scr->WBorRight;
- DragonTop = ( Scr->Height - ComputeY( DragonHeight ) - Font->ta_YSize )/2 - Scr->WBorBottom;
- OpenDragonWindow();
- CloseDownScreen();
- }
- break;
- case IDCMP:
- if( HandleDragonIDCMP() != QUIT )
- break;
- case KILL:
- CloseDragonWindow();
- break;
- }
- }
-
- LONG WndSignal( VOID )
- {
- return DragonWnd ? 1L << DragonWnd->UserPort->mp_SigBit : 0L;
- }
-
- VOID FillDefaults( VOID *Prefs )
- {
- struct ModulePrefs mPO = { 0L, 2L };
-
- mPO.Mode = getTopScreenMode();
- CopyMem( &mPO, Prefs, sizeof( struct ModulePrefs ));
- }
-