home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 2
/
goldfish_vol2_cd1.bin
/
files
/
util
/
blank
/
gblanker
/
source
/
blankers
/
plasma
/
prefs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-04
|
3KB
|
148 lines
#include <exec/types.h>
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <intuition/screens.h>
#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 "Plasma.h"
#include "Plasma_rev.h"
#include "/main.h"
#include "//defs.h"
struct fPrefObject
{
LONG Mode;
LONG Depth;
LONG LimDimen;
LONG ExtendPal;
};
struct fPrefObject nP;
VOID *OldPrefs = 0L;
STATIC const UBYTE VersTag[] = VERSTAG;
int BT_SAVEClicked( VOID )
{
if( OldPrefs )
{
CopyMem( &nP, OldPrefs, sizeof( struct fPrefObject ));
SavePrefs( OldPrefs );
OldPrefs = 0L;
}
return QUIT;
}
int BT_TESTClicked( VOID )
{
MessageServer( BM_SENDBLANK );
return OK;
}
int BT_SCREENClicked( VOID )
{
ScreenModeRequest( PlasmaWnd, &nP.Mode, &nP.Depth );
return OK;
}
int BT_CANCELClicked( VOID )
{
OldPrefs = 0L;
return QUIT;
}
int CY_DIMENClicked( VOID )
{
nP.LimDimen = PlasmaMsg.Code;
return OK;
}
int SL_EXTPALClicked( VOID )
{
nP.ExtendPal = PlasmaMsg.Code;
return OK;
}
#define BL_SetGadgetAttrs( Gad, Tag, Val ) GT_SetGadgetAttrs( PlasmaGadgets[Gad], PlasmaWnd, 0L, Tag, Val, TAG_END )
int PlasmaVanillaKey( VOID )
{
switch( PlasmaMsg.Code ) {
case 's':
return BT_SAVEClicked();
case 't':
return BT_TESTClicked();
case 'c':
return QUIT;
case 'l':
BL_SetGadgetAttrs( GD_CY_DIMEN, GTCY_Active, 1 - nP.LimDimen );
return OK;
case 'L':
BL_SetGadgetAttrs( GD_CY_DIMEN, GTCY_Active, 1 - nP.LimDimen );
return OK;
case 'p':
BL_SetGadgetAttrs( GD_SL_EXTPAL, GTSL_Level, Inc( nP.ExtendPal, 1, 4 ));
return OK;
case 'P':
BL_SetGadgetAttrs( GD_SL_EXTPAL, GTSL_Level, Dec( nP.ExtendPal, 1, 0 ));
return OK;
default:
return OK;
}
}
VOID DoPrefs( LONG command, VOID *Prefs )
{
switch( command )
{
case STARTUP:
OldPrefs = Prefs;
CopyMem( Prefs, &nP, sizeof( struct fPrefObject ));
if( !SetupScreen())
{
PlasmaLeft = ( Scr->Width - ComputeX( PlasmaWidth ))/2 - Scr->WBorRight;
PlasmaTop = ( Scr->Height - ComputeY( PlasmaHeight ) - Font->ta_YSize )/2 - Scr->WBorBottom;
if( !OpenPlasmaWindow())
{
BL_SetGadgetAttrs( GD_CY_DIMEN, GTCY_Active, nP.LimDimen );
BL_SetGadgetAttrs( GD_SL_EXTPAL, GTSL_Level, nP.ExtendPal );
}
CloseDownScreen();
}
break;
case IDCMP:
if( HandlePlasmaIDCMP() != QUIT )
break;
case KILL:
ClosePlasmaWindow();
break;
}
}
LONG WndSignal( VOID )
{
return PlasmaWnd ? 1L << PlasmaWnd->UserPort->mp_SigBit : 0L;
}
VOID FillDefaults( VOID *Prefs )
{
struct fPrefObject fPO = { 0L, 4L, 0L, 2L };
fPO.Mode = getTopScreenMode();
CopyMem( &fPO, Prefs, sizeof( struct fPrefObject ));
}