home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 2
/
goldfish_vol2_cd1.bin
/
files
/
util
/
blank
/
gblanker
/
source
/
blankers
/
species
/
prefs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-08
|
2KB
|
135 lines
/*
* 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 "/Garshnelib/Garshnelib_protos.h"
#include "/Garshnelib/Garshnelib_pragmas.h"
#include "Species.h"
#include "Species_rev.h"
#include "/main.h"
#include "//defs.h"
struct ModulePrefs
{
LONG Mode;
LONG Size;
};
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( SpeciesWnd, &nP.Mode, 0L );
return OK;
}
int BT_CANCELClicked( VOID )
{
OldPrefs = 0L;
return QUIT;
}
int SL_SIZEClicked( VOID )
{
nP.Size = SpeciesMsg.Code;
return OK;
}
#define BL_SetGadgetAttrs( Gad, Tag, Val ) GT_SetGadgetAttrs( SpeciesGadgets[Gad], SpeciesWnd, 0L, Tag, Val, TAG_END )
int SpeciesVanillaKey( VOID )
{
switch( SpeciesMsg.Code ) {
case 's':
return BT_SAVEClicked();
case 't':
return BT_TESTClicked();
case 'd':
return BT_SCREENClicked();
case 'c':
return QUIT;
case 'i':
BL_SetGadgetAttrs( GD_SL_SIZE, GTSL_Level, Inc( nP.Size, 1, 10 ));
return OK;
case 'I':
BL_SetGadgetAttrs( GD_SL_SIZE, GTSL_Level, Dec( nP.Size, 1, 3 ));
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())
{
SpeciesLeft = ( Scr->Width - ComputeX( SpeciesWidth ))/2 - Scr->WBorRight;
SpeciesTop = ( Scr->Height - ComputeY( SpeciesHeight ) - Font->ta_YSize )/2 -
Scr->WBorBottom;
if( !OpenSpeciesWindow())
BL_SetGadgetAttrs( GD_SL_SIZE, GTSL_Level, nP.Size );
CloseDownScreen();
}
break;
case IDCMP:
if( HandleSpeciesIDCMP() != QUIT )
break;
case KILL:
CloseSpeciesWindow();
break;
}
}
LONG WndSignal( VOID )
{
return SpeciesWnd ? 1L << SpeciesWnd->UserPort->mp_SigBit : 0L;
}
VOID FillDefaults( VOID *Prefs )
{
struct ModulePrefs mPO = { 0L, 5L };
mPO.Mode = getTopScreenMode();
CopyMem( &mPO, Prefs, sizeof( struct ModulePrefs ));
}