aboutsummaryrefslogtreecommitdiff
path: root/backends/PalmOS/Src
diff options
context:
space:
mode:
authorChris Apers2003-11-28 10:00:53 +0000
committerChris Apers2003-11-28 10:00:53 +0000
commit048e404cf12d067945f498b8480ec9a1a204774a (patch)
treef22e952a660c4ed324d32805c1ca080fd972cbc1 /backends/PalmOS/Src
parent461e8d19bf5ad917df239600c78a1d5bc82069b7 (diff)
downloadscummvm-rg350-048e404cf12d067945f498b8480ec9a1a204774a.tar.gz
scummvm-rg350-048e404cf12d067945f498b8480ec9a1a204774a.tar.bz2
scummvm-rg350-048e404cf12d067945f498b8480ec9a1a204774a.zip
New Misc Options form + stack pref option
svn-id: r11401
Diffstat (limited to 'backends/PalmOS/Src')
-rw-r--r--backends/PalmOS/Src/forms/formMisc.cpp138
1 files changed, 134 insertions, 4 deletions
diff --git a/backends/PalmOS/Src/forms/formMisc.cpp b/backends/PalmOS/Src/forms/formMisc.cpp
index f62ef88136..f376807030 100644
--- a/backends/PalmOS/Src/forms/formMisc.cpp
+++ b/backends/PalmOS/Src/forms/formMisc.cpp
@@ -15,6 +15,34 @@
*
*
***********************************************************************/
+static Boolean stackChanged = false;
+static UInt8 tabNum;
+
+#define TAB_START MiscOptionsTabPalmPushButton
+#define TAB_COUNT 2
+
+
+static UInt32 StackSize(UInt32 newSize) {
+ MemHandle pref = DmGetResource('pref',0);
+ UInt32 size = 0;
+
+ if (pref) {
+ SysAppPrefsType *data = (SysAppPrefsType *)MemHandleLock(pref);
+ size = data->stackSize;
+
+ if (newSize) {
+ SysAppPrefsType newData;
+ MemMove(&newData, data, sizeof(SysAppPrefsType));
+ newData.stackSize = newSize;
+ DmWrite(data, 0, &newData, sizeof(SysAppPrefsType));
+ }
+
+ MemPtrUnlock(data);
+ DmReleaseResource(pref);
+ }
+
+ return size;
+}
static void MiscOptionsFormSave() {
@@ -28,7 +56,7 @@ static void MiscOptionsFormSave() {
cck2P = (ControlType *)GetObjectPtr(MiscOptionsNoAutoOffCheckbox);
cck3P = (ControlType *)GetObjectPtr(MiscOptionsStdPaletteCheckbox);
cck4P = (ControlType *)GetObjectPtr(MiscOptionsDebugCheckbox);
- cck5P = (ControlType *)GetObjectPtr(MiscOptionsWriteIniCheckbox);
+ cck5P = (ControlType *)GetObjectPtr(MiscOptionsLargerStackCheckbox);
cck6P = (ControlType *)GetObjectPtr(MiscOptionsAutoResetCheckbox);
cck7P = (ControlType *)GetObjectPtr(MiscOptionsDemoCheckbox);
cck8P = (ControlType *)GetObjectPtr(MiscOptionsFullscreenCheckbox);
@@ -45,30 +73,100 @@ static void MiscOptionsFormSave() {
gPrefs->autoOff = !CtlGetValue(cck2P);
gPrefs->stdPalette = CtlGetValue(cck3P);
gPrefs->debug = CtlGetValue(cck4P);
- gPrefs->saveConfig = CtlGetValue(cck5P);
gPrefs->autoReset = CtlGetValue(cck6P);
gPrefs->demoMode = CtlGetValue(cck7P);
gPrefs->fullscreen = CtlGetValue(cck8P);
gPrefs->debugLevel = StrAToI(FldGetTextPtr(fld1P));
+
+ // Larger stack is a global data init at start up
+ StackSize(CtlGetValue(cck5P) ? STACK_LARGER : STACK_DEFAULT);
+ if (stackChanged)
+ FrmCustomAlert(FrmInfoAlert,"You need to restart ScummVM in order for changes to take effect.",0,0);
FrmReturnToMain();
}
+static void FrmSetTabSize(const FormPtr frmP, UInt16 objID, Coord newY, Coord newH) {
+ RectangleType r;
+ UInt16 index;
+
+ index = FrmGetObjectIndex (frmP, objID);
+ FrmGetObjectBounds(frmP, index, &r);
+ r.topLeft.y = newY;
+ r.extent.y = newH;
+ FrmSetObjectBounds(frmP, index, &r);
+}
+
+static Boolean FrmSelectTab(const FormPtr frmP, UInt16 objID) {
+ FrmSetControlValue(frmP, FrmGetObjectIndex(frmP, objID), 0);
+
+ if (tabNum != (objID - TAB_START)) {
+ UInt8 color;
+
+ FrmSetTabSize(frmP, (TAB_START + tabNum), 18, 10);
+ FrmSetTabSize(frmP, objID, 16, 12);
+
+ tabNum = objID - TAB_START;
+ WinScreenLock(winLockDontCare);
+ FrmDrawForm(frmP);
+ color = UIColorGetTableEntryIndex(UIObjectFrame);
+ WinSetForeColor(color);
+ WinDrawLine(1, 28, 154,28);
+ WinScreenUnlock();
+
+ return true;
+ }
+
+ return false;
+}
+
+static void FrmShowHide(const FormPtr frmP, UInt16 idStart, UInt16 idEnd, Boolean show) {
+ UInt16 item, index;
+ Coord y = 35;
+
+ for (item = idStart; item <= idEnd; item++) {
+ index = FrmGetObjectIndex (frmP, item);
+ FrmSetObjectPosition(frmP, index, 4, y);
+ y += 12;
+
+ if (show)
+ FrmShowObject(frmP, index);
+ else
+ FrmHideObject(frmP, index);
+ }
+}
+
+static void MiscOptionsShowPalmOS(const FormPtr frmP, Boolean show) {
+ FrmShowHide(frmP, MiscOptionsTabTitlePalmLabel, MiscOptionsLargerStackCheckbox, show);
+}
+
+static void MiscOptionsShowScummVM(const FormPtr frmP, Boolean show) {
+ FrmShowHide(frmP, MiscOptionsTabTitleScummLabel, MiscOptionsDemoCheckbox, show);
+
+ if (show)
+ FrmShowObject(frmP, FrmGetObjectIndex (frmP, MiscOptionsDebugLevelField));
+ else
+ FrmHideObject(frmP, FrmGetObjectIndex (frmP, MiscOptionsDebugLevelField));
+}
+
static void MiscOptionsFormInit() {
FieldType *fld1P;
FormPtr frmP;
+ UInt16 item;
+ UInt8 color;
Char *levelP;
MemHandle levelH;
+ CtlSetValue((ControlType *)GetObjectPtr(MiscOptionsLargerStackCheckbox), (StackSize(STACK_GET) == STACK_LARGER));
+
CtlSetValue((ControlType *)GetObjectPtr(MiscOptionsVibratorCheckbox), gPrefs->vibrator);
CtlSetValue((ControlType *)GetObjectPtr(MiscOptionsNoAutoOffCheckbox), !gPrefs->autoOff);
CtlSetValue((ControlType *)GetObjectPtr(MiscOptionsStdPaletteCheckbox), gPrefs->stdPalette);
CtlSetValue((ControlType *)GetObjectPtr(MiscOptionsAutoResetCheckbox), gPrefs->autoReset);
CtlSetValue((ControlType *)GetObjectPtr(MiscOptionsDebugCheckbox), gPrefs->debug);
- CtlSetValue((ControlType *)GetObjectPtr(MiscOptionsWriteIniCheckbox), gPrefs->saveConfig);
CtlSetValue((ControlType *)GetObjectPtr(MiscOptionsDemoCheckbox), gPrefs->demoMode);
CtlSetValue((ControlType *)GetObjectPtr(MiscOptionsFullscreenCheckbox), gPrefs->fullscreen);
@@ -80,11 +178,27 @@ static void MiscOptionsFormInit() {
MemHandleUnlock(levelH);
FldSetTextHandle(fld1P, levelH);
+
frmP = FrmGetActiveForm();
+ // set tab size
+ for (item = TAB_START; item < (TAB_START + TAB_COUNT); item++)
+ FrmSetTabSize(frmP, item, 18, 10);
+
+ tabNum = 0;
+ FrmSetTabSize(frmP, (TAB_START + tabNum), 16, 12);
+ MiscOptionsShowScummVM(frmP, false);
+ MiscOptionsShowPalmOS(frmP, true);
+ FrmSetObjectPosition(frmP, FrmGetObjectIndex (frmP, MiscOptionsDebugLevelField), 103, 35 + 12 * 2);
+
FrmDrawForm(frmP);
+
+ color = UIColorGetTableEntryIndex(UIObjectFrame);
+ WinSetForeColor(color);
+ WinDrawLine(1, 28, 154,28);
}
Boolean MiscOptionsFormHandleEvent(EventPtr eventP) {
+ FormPtr frmP = FrmGetActiveForm();
Boolean handled = false;
switch (eventP->eType) {
@@ -96,6 +210,22 @@ Boolean MiscOptionsFormHandleEvent(EventPtr eventP) {
case ctlSelectEvent:
switch (eventP->data.ctlSelect.controlID)
{
+ case MiscOptionsTabPalmPushButton:
+ if (FrmSelectTab(frmP, MiscOptionsTabPalmPushButton))
+ MiscOptionsShowScummVM(frmP, false);
+ MiscOptionsShowPalmOS(frmP, true);
+ break;
+
+ case MiscOptionsTabScummPushButton:
+ if (FrmSelectTab(frmP, MiscOptionsTabScummPushButton))
+ MiscOptionsShowPalmOS(frmP, false);
+ MiscOptionsShowScummVM(frmP, true);
+ break;
+
+ case MiscOptionsLargerStackCheckbox:
+ stackChanged = !stackChanged;
+ break;
+
case MiscOptionsOKButton:
MiscOptionsFormSave();
break;
@@ -112,4 +242,4 @@ Boolean MiscOptionsFormHandleEvent(EventPtr eventP) {
}
return handled;
-} \ No newline at end of file
+}