| 1 |
#include "FractalViewerPrefs.h" |
| 2 |
|
| 3 |
enum { // Preferences Dialog Items |
| 4 |
iPrefsOK = 1, |
| 5 |
iPrefsCancel, |
| 6 |
iPrefsBW, |
| 7 |
iPrefsJuliaX = iPrefsBW + 3, |
| 8 |
iPrefsJuliaY = iPrefsJuliaX + 2 |
| 9 |
}; |
| 10 |
|
| 11 |
FractalViewerPrefs GlobalPrefs; |
| 12 |
|
| 13 |
/***** |
| 14 |
* HandlePrefs(void) |
| 15 |
* |
| 16 |
* Handle the preferences dialog |
| 17 |
* |
| 18 |
*****/ |
| 19 |
|
| 20 |
void HandlePrefs(void) |
| 21 |
{ |
| 22 |
Boolean dlgDone = false; |
| 23 |
short itemHit, itemType; |
| 24 |
Handle itemHandle; |
| 25 |
Rect itemRect; |
| 26 |
|
| 27 |
DialogPtr dlgPrefs = GetNewDialog(128, nil, (WindowPtr)-1L); |
| 28 |
SetDialogDefaultItem(dlgPrefs, iPrefsOK); |
| 29 |
SetDialogCancelItem(dlgPrefs, iPrefsCancel); |
| 30 |
ShowWindow(dlgPrefs); |
| 31 |
|
| 32 |
while (!dlgDone) { |
| 33 |
ModalDialog(nil, &itemHit); |
| 34 |
|
| 35 |
switch (itemHit) { |
| 36 |
case iPrefsOK: |
| 37 |
case iPrefsCancel: |
| 38 |
dlgDone = true; |
| 39 |
break; |
| 40 |
case iPrefsBW: |
| 41 |
GetDItem(dlgPrefs, itemHit, &itemType, &itemHandle, &itemRect); |
| 42 |
SetCtlValue((ControlHandle)itemHandle, !GetCtlValue((ControlHandle)itemHandle)); |
| 43 |
break; |
| 44 |
default: |
| 45 |
SysBeep(5); |
| 46 |
break; |
| 47 |
} |
| 48 |
|
| 49 |
} |
| 50 |
|
| 51 |
DisposeDialog(dlgPrefs); |
| 52 |
} |