home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / util / blank / gblanker / source / blankers / fractal / prefs.c < prev    next >
C/C++ Source or Header  |  1994-10-03  |  2KB  |  112 lines

  1. #include <libraries/gadtools.h>
  2.  
  3. #include <clib/exec_protos.h>
  4. #include <clib/intuition_protos.h>
  5. #include <clib/gadtools_protos.h>
  6.  
  7. #include "/Garshnelib/Garshnelib_protos.h"
  8. #include "/Garshnelib/Garshnelib_pragmas.h"
  9.  
  10. #include "Fractal.h"
  11. #include "Fractal_rev.h"
  12. #include "/main.h"
  13. #include "//defs.h"
  14.  
  15. struct ModulePrefs
  16. {
  17.     LONG Mode;
  18.     LONG Depth;
  19. };
  20.  
  21. struct ModulePrefs nP;
  22. VOID *OldPrefs = 0L;
  23. STATIC const UBYTE VersTag[] = VERSTAG;
  24.  
  25. int BT_SAVEClicked( VOID )
  26. {
  27.     if( OldPrefs )
  28.     {
  29.         CopyMem( &nP, OldPrefs, sizeof( struct ModulePrefs ));
  30.         SavePrefs( OldPrefs );
  31.         OldPrefs = 0L;
  32.     }
  33.     
  34.     return QUIT;
  35. }
  36.  
  37. int BT_TESTClicked( VOID )
  38. {
  39.     MessageServer( BM_SENDBLANK );
  40.  
  41.     return OK;
  42. }
  43.  
  44. int BT_SCREENClicked( VOID )
  45. {
  46.     ScreenModeRequest( FractalWnd, &nP.Mode, &nP.Depth );
  47.  
  48.     return OK;
  49. }
  50.  
  51. int BT_CANCELClicked( VOID )
  52. {
  53.     OldPrefs = 0L;
  54.     
  55.     return QUIT;
  56. }
  57.  
  58. #define BL_SetGadgetAttrs( Gad, Tag, Val ) GT_SetGadgetAttrs( FractalGadgets[Gad], FractalWnd, 0L, Tag, Val, TAG_END )
  59.  
  60. int FractalVanillaKey( VOID )
  61. {
  62.     switch( FractalMsg.Code ) {
  63.     case 's':
  64.         return BT_SAVEClicked();
  65.     case 't':
  66.         return BT_TESTClicked();
  67.     case 'd':
  68.         return BT_SCREENClicked();
  69.     case 'c':
  70.         return QUIT;
  71.     default:
  72.         return OK;
  73.     }
  74. }
  75.  
  76. VOID DoPrefs( LONG command, VOID *Prefs )
  77. {
  78.     switch( command )
  79.     {
  80.     case STARTUP:
  81.         OldPrefs = Prefs;
  82.         CopyMem( Prefs, &nP, sizeof( struct ModulePrefs ));
  83.         if( !SetupScreen())
  84.         {
  85.             FractalLeft = ( Scr->Width - ComputeX( FractalWidth ))/2 - Scr->WBorRight;
  86.             FractalTop = ( Scr->Height - ComputeY( FractalHeight ) - Font->ta_YSize )/2 - Scr->WBorBottom;
  87.             OpenFractalWindow();
  88.             CloseDownScreen();
  89.         }
  90.         break;
  91.     case IDCMP:
  92.         if( HandleFractalIDCMP() != QUIT )
  93.             break;
  94.     case KILL:
  95.         CloseFractalWindow();
  96.         break;
  97.     }
  98. }
  99.  
  100. LONG WndSignal( VOID )
  101. {
  102.     return FractalWnd ? 1L << FractalWnd->UserPort->mp_SigBit : 0L;
  103. }
  104.  
  105. VOID FillDefaults( VOID *Prefs )
  106. {
  107.     struct ModulePrefs mPO = { 0L, 4L };
  108.  
  109.     mPO.Mode = getTopScreenMode();
  110.     CopyMem( &mPO, Prefs, sizeof( struct ModulePrefs ));
  111. }
  112.