From 8928a6e56263c3472a851432c9bab0434f951b56 Mon Sep 17 00:00:00 2001 From: Chris Apers Date: Sat, 5 Nov 2005 10:50:43 +0000 Subject: - Added new tab - Moved lightspeed to new tab - Added GoLCD api support - Added tylus click option - Changed const name svn-id: r19443 --- backends/PalmOS/Src/forms/formMisc.cpp | 172 ++++++++++++++++++--------------- 1 file changed, 94 insertions(+), 78 deletions(-) diff --git a/backends/PalmOS/Src/forms/formMisc.cpp b/backends/PalmOS/Src/forms/formMisc.cpp index d720d7bc11..cdf2759093 100644 --- a/backends/PalmOS/Src/forms/formMisc.cpp +++ b/backends/PalmOS/Src/forms/formMisc.cpp @@ -5,9 +5,6 @@ #include "forms.h" #include "globals.h" -#ifndef DISABLE_LIGHTSPEED -#include "lightspeed_public.h" -#endif /*********************************************************************** * * FUNCTION: MiscOptionsFormSave @@ -28,17 +25,17 @@ static Boolean ScummVMTabSave() { ControlType *cckP[11]; FormPtr frmP; - fld1P = (FieldType *)GetObjectPtr(TabScummVMDebugLevelField); - - cckP[3] = (ControlType *)GetObjectPtr(TabScummVMDebugCheckbox); - cckP[6] = (ControlType *)GetObjectPtr(TabScummVMDemoCheckbox); - cckP[9] = (ControlType *)GetObjectPtr(TabScummVMCopyProtectionCheckbox); - cckP[10]= (ControlType *)GetObjectPtr(TabScummVMAltIntroCheckbox); + fld1P = (FieldType *)GetObjectPtr(TabMiscScummVMDebugLevelField); + + cckP[3] = (ControlType *)GetObjectPtr(TabMiscScummVMDebugCheckbox); + cckP[6] = (ControlType *)GetObjectPtr(TabMiscScummVMDemoCheckbox); + cckP[9] = (ControlType *)GetObjectPtr(TabMiscScummVMCopyProtectionCheckbox); + cckP[10]= (ControlType *)GetObjectPtr(TabMiscScummVMAltIntroCheckbox); frmP = FrmGetActiveForm(); if (FldGetTextLength(fld1P) == 0 && CtlGetValue(cckP[3]) == 1) { TabSetActive(frmP, myTabP, 1); - FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabScummVMDebugLevelField)); + FrmSetFocus(frmP, FrmGetObjectIndex(frmP, TabMiscScummVMDebugLevelField)); FrmCustomAlert(FrmWarnAlert,"You must specified a debug level.",0,0); return false; } @@ -49,38 +46,47 @@ static Boolean ScummVMTabSave() { gPrefs->altIntro = CtlGetValue(cckP[10]); gPrefs->debugLevel = StrAToI(FldGetTextPtr(fld1P)); - + return true; } static void PalmOSTabSave() { ControlType *cckP[11]; - cckP[0] = (ControlType *)GetObjectPtr(TabPalmOSVibratorCheckbox); - cckP[1] = (ControlType *)GetObjectPtr(TabPalmOSNoAutoOffCheckbox); - cckP[2] = (ControlType *)GetObjectPtr(TabPalmOSStdPaletteCheckbox); - cckP[3] = (ControlType *)GetObjectPtr(TabPalmOSLightspeedCheckbox); - cckP[4] = (ControlType *)GetObjectPtr(TabPalmOSLargerStackCheckbox); - cckP[5] = (ControlType *)GetObjectPtr(TabPalmOSExitLauncherCheckbox); - cckP[10]= (ControlType *)GetObjectPtr(TabPalmOSARMCheckbox); + if (OPTIONS_TST(kOptDeviceARM)) { + cckP[10]= (ControlType *)GetObjectPtr(TabMiscPalmOSARMCheckbox); + gPrefs->arm = CtlGetValue(cckP[10]); + } + + cckP[0] = (ControlType *)GetObjectPtr(TabMiscPalmOSVibratorCheckbox); + cckP[1] = (ControlType *)GetObjectPtr(TabMiscPalmOSNoAutoOffCheckbox); + cckP[2] = (ControlType *)GetObjectPtr(TabMiscPalmOSStdPaletteCheckbox); + cckP[4] = (ControlType *)GetObjectPtr(TabMiscPalmOSLargerStackCheckbox); + cckP[5] = (ControlType *)GetObjectPtr(TabMiscPalmOSExitLauncherCheckbox); + cckP[6] = (ControlType *)GetObjectPtr(TabMiscPalmOSStylusClickCheckbox); gPrefs->vibrator = CtlGetValue(cckP[0]); gPrefs->autoOff = !CtlGetValue(cckP[1]); gPrefs->stdPalette = CtlGetValue(cckP[2]); - gPrefs->lightspeed.enable = CtlGetValue(cckP[3]); gPrefs->setStack = CtlGetValue(cckP[4]); gPrefs->exitLauncher = CtlGetValue(cckP[5]); - gPrefs->arm = CtlGetValue(cckP[10]); + gPrefs->stylusClick = !CtlGetValue(cckP[6]); +} + +static void ExtsTabSave() { + ControlType *cckP[2]; -#ifndef DISABLE_LIGHTSPEED - if (LS_Installed()) { - ListType *list1P = (ListType *)GetObjectPtr(TabPalmOSLightspeedList); - cckP[6] = (ControlType *)GetObjectPtr(TabPalmOSLightspeedCheckbox); + if (OPTIONS_TST(kOptLightspeedAPI)) { + ListType *list1P = (ListType *)GetObjectPtr(TabMiscExtsLightspeedList); + cckP[0] = (ControlType *)GetObjectPtr(TabMiscExtsLightspeedCheckbox); - gPrefs->lightspeed.enable = CtlGetValue(cckP[6]); + gPrefs->lightspeed.enable = CtlGetValue(cckP[0]); gPrefs->lightspeed.mode = LstGetSelection(list1P); } -#endif + if (OPTIONS_TST(kOptGoLcdAPI)) { + cckP[1] = (ControlType *)GetObjectPtr(TabMiscExtsGolcdCheckbox); + gPrefs->goLCD = CtlGetValue(cckP[1]); + } } static void ScummVMTabInit() { @@ -88,12 +94,12 @@ static void ScummVMTabInit() { Char *levelP; MemHandle levelH; - CtlSetValue((ControlType *)GetObjectPtr(TabScummVMDebugCheckbox), gPrefs->debug); - CtlSetValue((ControlType *)GetObjectPtr(TabScummVMDemoCheckbox), gPrefs->demoMode); - CtlSetValue((ControlType *)GetObjectPtr(TabScummVMCopyProtectionCheckbox), gPrefs->copyProtection); - CtlSetValue((ControlType *)GetObjectPtr(TabScummVMAltIntroCheckbox), gPrefs->altIntro); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMDebugCheckbox), gPrefs->debug); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMDemoCheckbox), gPrefs->demoMode); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMCopyProtectionCheckbox), gPrefs->copyProtection); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscScummVMAltIntroCheckbox), gPrefs->altIntro); - fld1P = (FieldType *)GetObjectPtr(TabScummVMDebugLevelField); + fld1P = (FieldType *)GetObjectPtr(TabMiscScummVMDebugLevelField); levelH = MemHandleNew(FldGetMaxChars(fld1P)+1); levelP = (Char *)MemHandleLock(levelH); @@ -104,28 +110,34 @@ static void ScummVMTabInit() { } static void PalmOSTabInit() { -#ifndef DISABLE_LIGHTSPEED - if (LS_Installed()) { - ListType *list1P = (ListType *)GetObjectPtr(TabPalmOSLightspeedList); + if (OPTIONS_TST(kOptDeviceARM)) + CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSARMCheckbox), gPrefs->arm); + + CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSExitLauncherCheckbox), gPrefs->exitLauncher); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSLargerStackCheckbox), gPrefs->setStack); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSVibratorCheckbox), gPrefs->vibrator); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSNoAutoOffCheckbox), !gPrefs->autoOff); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSStdPaletteCheckbox), gPrefs->stdPalette); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscPalmOSStylusClickCheckbox), !gPrefs->stylusClick); +} + +static void ExtsTabInit() { + if (OPTIONS_TST(kOptLightspeedAPI)) { + ListType *list1P = (ListType *)GetObjectPtr(TabMiscExtsLightspeedList); LstSetSelection(list1P, gPrefs->lightspeed.mode); - CtlSetLabel((ControlType *)GetObjectPtr(TabPalmOSLightspeedPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); + CtlSetLabel((ControlType *)GetObjectPtr(TabMiscExtsLightspeedPopTrigger), LstGetSelectionText(list1P, LstGetSelection(list1P))); + CtlSetValue((ControlType *)GetObjectPtr(TabMiscExtsLightspeedCheckbox), gPrefs->lightspeed.enable); } -#endif - - CtlSetValue((ControlType *)GetObjectPtr(TabPalmOSExitLauncherCheckbox), gPrefs->lightspeed.enable); - CtlSetValue((ControlType *)GetObjectPtr(TabPalmOSExitLauncherCheckbox), gPrefs->exitLauncher); - CtlSetValue((ControlType *)GetObjectPtr(TabPalmOSLargerStackCheckbox), gPrefs->setStack); - CtlSetValue((ControlType *)GetObjectPtr(TabPalmOSVibratorCheckbox), gPrefs->vibrator); - CtlSetValue((ControlType *)GetObjectPtr(TabPalmOSNoAutoOffCheckbox), !gPrefs->autoOff); - CtlSetValue((ControlType *)GetObjectPtr(TabPalmOSStdPaletteCheckbox), gPrefs->stdPalette); - CtlSetValue((ControlType *)GetObjectPtr(TabPalmOSARMCheckbox), gPrefs->arm); - CtlSetValue((ControlType *)GetObjectPtr(TabPalmOSLightspeedCheckbox), gPrefs->lightspeed.enable); + + if (OPTIONS_TST(kOptGoLcdAPI)) + CtlSetValue((ControlType *)GetObjectPtr(TabMiscExtsGolcdCheckbox), gPrefs->goLCD); } static void MiscFormSave() { - PalmOSTabSave(); if (!ScummVMTabSave()) return; - + PalmOSTabSave(); + ExtsTabSave(); + TabDeleteTabs(myTabP); FrmReturnToMain(); } @@ -133,29 +145,44 @@ static void MiscFormSave() { static void MiscFormInit() { TabType *tabP; FormType *frmP = FrmGetActiveForm(); + UInt8 extsCnt = 2; + + tabP = TabNewTabs(3); + TabAddContent(&frmP, tabP, "PalmOS", TabMiscPalmOSForm); + TabAddContent(&frmP, tabP, "ScummVM", TabMiscScummVMForm); + TabAddContent(&frmP, tabP, "More ...", TabMiscExtsForm); - tabP = TabNewTabs(2); - TabAddContent(&frmP, tabP, "PalmOS", TabPalmOSForm); - TabAddContent(&frmP, tabP, "ScummVM", TabScummVMForm); + if (!OPTIONS_TST(kOptDeviceARM)) { + FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscPalmOSARMCheckbox)); + } + if (!OPTIONS_TST(kOptGoLcdAPI)) { + FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsGolcdCheckbox)); + // move lightspeed + TabMoveUpObject(frmP, TabMiscExtsLightspeedCheckbox, 12); + TabMoveUpObject(frmP, TabMiscExtsLightspeedPopTrigger, 12); + TabMoveUpObject(frmP, TabMiscExtsLightspeedList, 12); + TabMoveUpObject(frmP, TabMiscExtsNothingLabel, 12); + extsCnt--; + } + + if (!OPTIONS_TST(kOptLightspeedAPI)) { + FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedCheckbox)); +// FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedList)); // cannot remove this ? + FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedPopTrigger)); + TabMoveUpObject(frmP, TabMiscExtsNothingLabel, 12); + extsCnt--; + } + + if (extsCnt) + FrmRemoveObject(&frmP, FrmGetObjectIndex(frmP, TabMiscExtsNothingLabel)); PalmOSTabInit(); ScummVMTabInit(); + ExtsTabInit(); FrmDrawForm(frmP); TabSetActive(frmP, tabP, lastTab); -#ifndef DISABLE_LIGHTSPEED - if (!LS_Installed()) -#endif - { - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabPalmOSLightspeedCheckbox)); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabPalmOSLightspeedPopTrigger)); - } -#ifndef DISABLE_ARM - if (!OPTIONS_TST(kOptDeviceARM)) -#endif - { FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabPalmOSARMCheckbox)); } - myTabP = tabP; } @@ -174,25 +201,14 @@ Boolean MiscFormHandleEvent(EventPtr eventP) { { case (MiscForm + 1) : case (MiscForm + 2) : + case (MiscForm + 3) : lastTab = (eventP->data.ctlSelect.controlID - MiscForm - 1); TabSetActive(frmP, myTabP, lastTab); - -#ifndef DISABLE_LIGHTSPEED - if (!LS_Installed()) -#endif - { - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabPalmOSLightspeedCheckbox)); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabPalmOSLightspeedPopTrigger)); - } -#ifndef DISABLE_ARM - if (!OPTIONS_TST(kOptDeviceARM)) -#endif - { FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabPalmOSARMCheckbox)); } break; - case TabPalmOSLightspeedPopTrigger: - FrmList(eventP, TabPalmOSLightspeedList); - FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabPalmOSLightspeedList)); + case TabMiscExtsLightspeedPopTrigger: + FrmList(eventP, TabMiscExtsLightspeedList); + FrmHideObject(frmP, FrmGetObjectIndex(frmP, TabMiscExtsLightspeedList)); break; case MiscOKButton: @@ -210,6 +226,6 @@ Boolean MiscFormHandleEvent(EventPtr eventP) { default: break; } - + return handled; } -- cgit v1.2.3