home *** CD-ROM | disk | FTP | other *** search
- property pAlertList, pAlertSizes, pSubStringTag, pLowMode, pCurMode, pOrigDepth, pLowestSetting
- global gDiagResult
-
- on new me, theFieldList
- set pAlertList to [:]
- set pAlertSizes to [:]
- repeat with fieldNum in theFieldList
- set dPropName to word 1 of the name of member fieldNum
- set dBoxSize to word 2 of the name of member fieldNum
- set dPropText to the text of member fieldNum
- addProp(pAlertList, symbol(dPropName), dPropText)
- addProp(pAlertSizes, symbol(dPropName), dBoxSize)
- end repeat
- set pSubStringTag to "$"
- set pLowMode to 0
- registerDisplayRes(me)
- if isPC() then
- set dPrevSettings to getPrevReset(me)
- set pCurMode to getAt(dPrevSettings, 1)
- set pOrigDepth to getAt(dPrevSettings, 2)
- else
- set pOrigDepth to getBitDepth(me)
- end if
- set pLowestSetting to getLowestSetting(me)
- initAlertFields(me, pLowestSetting)
- return me
- end
-
- on showAlldialogs me
- set dOKList to [8]
- repeat with i = 1 to count(pAlertList)
- set prop to getPropAt(pAlertList, i)
- if getPos(dOKList, i) then
- callBox(me, prop, 0, ["OK", "OK"])
- next repeat
- end if
- callBox(me, prop, 1, ["Yes", "No"])
- end repeat
- end
-
- on callBox me, theProp, theMode, theButtText
- set text to getProp(pAlertList, theProp)
- set size to getProp(pAlertSizes, theProp)
- setupSDialogue(text, size, theMode, theButtText)
- runSDialogue()
- end
-
- on registerDisplayRes me
- if not isPC() then
- exit
- end if
- Register(xtra("DisplayRes"), "dres7223-5423-8472-9236")
- end
-
- on InsertColorString me, theText, theSubString
- if not isPC() then
- exit
- end if
- set oldItemDelim to the itemDelimiter
- set the itemDelimiter to pSubStringTag
- set dNewText to EMPTY
- set dItemCount to the number of items in theText
- if dItemCount > 1 then
- set dNewText to item 1 of theText
- repeat with i = 2 to dItemCount
- set dNewText to dNewText & theSubString & item i of theText
- end repeat
- return dNewText
- else
- return theText
- end if
- set the itemDelimiter to oldItemDelim
- end
-
- on mDisableScreenSaver me
- if not isPC() then
- exit
- end if
- set pScreenSaverDisabled to 1
- set dResult to baDisableScreenSaver(pScreenSaverDisabled)
- end
-
- on mRestoreScreenSaver me
- if not isPC() then
- exit
- end if
- set pScreenSaverDisabled to 0
- set dResult to baDisableScreenSaver(pScreenSaverDisabled)
- end
-
- on initAlertFields me, theLowestSetting
- if not isPC() then
- exit
- end if
- case theLowestSetting of
- 8:
- set theString to "256"
- 16:
- set theString to "Thousands of"
- 24, 32:
- set theString to "Millions of"
- otherwise:
- set theString to "Lower than your current"
- end case
- repeat with i = 1 to count(pAlertList)
- set prop to getPropAt(pAlertList, i)
- setProp(pAlertList, prop, InsertColorString(me, getAt(pAlertList, i), theString))
- end repeat
- end
-
- on CheckMonitorDepth me
- if not isPC() then
- if getBitDepth(me) <> 8 then
- set the colorDepth to 8
- end if
- exit
- end if
- if pLowestSetting = getBitDepth(me) then
- case pCurMode of
- 0:
- set pCurMode to 0
- 1:
- set pCurMode to 3
- 4:
- set pCurMode to 6
- 7:
- set pCurMode to 8
- 9:
- set pCurMode to 10
- end case
- setPrevReset(me, pCurMode)
- exit
- else
- if getBitDepth(me) < 8 then
- set pLowMode to 1
- end if
- case pCurMode of
- 0:
- setPrevReset(me, 1)
- set the colorDepth to pLowestSetting
- CheckMonitorDepth(me)
- exit
- 1:
- set dRestartSetting to getRestartSetting(me, 8)
- if dRestartSetting contains "dynamic" then
- set dReStartVal to 4
- if pLowMode then
- callBox(me, #DynamicAlertTextLow, 1, ["Yes", "No"])
- else
- callBox(me, #DynamicAlertText, 1, ["Yes", "No"])
- end if
- else
- if dRestartSetting contains "restart" then
- set dReStartVal to 7
- if pLowMode then
- callBox(me, #RestartAlertTextLow, 1, ["Yes", "No"])
- else
- callBox(me, #RestartAlertText, 1, ["Yes", "No"])
- end if
- else
- end if
- end if
- case gDiagResult of
- 1:
- setPrevReset(me, dReStartVal)
- changeColorDepthWin(me, dRestartSetting)
- 2:
- setPrevReset(me, 0)
- if pLowMode then
- quit()
- end if
- exit
- end case
- CheckMonitorDepth(me)
- exit
- 4:
- callBox(me, #FailedDynamicChangeText, 1, ["Yes", "No"])
- case gDiagResult of
- 1:
- setPrevReset(me, 7)
- dresRestart()
- exit
- 2:
- setPrevReset(me, 0)
- if pLowMode then
- quit()
- end if
- exit
- end case
- 7:
- if pLowMode then
- callBox(me, #LowModeExit, 0, ["OK", "OK"])
- quit()
- end if
- callBox(me, #FailedRestartChangeText, 1, ["Yes", "No"])
- case gDiagResult of
- 1:
- setPrevReset(me, 9)
- quit()
- 2:
- setPrevReset(me, 0)
- exit
- end case
- 9:
- if pLowMode then
- callBox(me, #LowModeExit, 0, ["OK", "OK"])
- quit()
- end if
- callBox(me, #FailedManualChangeText, 1, ["Yes", "No"])
- case gDiagResult of
- 1:
- setPrevReset(me, 9)
- quit()
- 2:
- setPrevReset(me, 0)
- exit
- end case
- otherwise:
- setPrevReset(me, 0)
- CheckMonitorDepth(me)
- exit
- end case
- end if
- end
-
- on mRestoreMonitor me
- if the machineType <> 256 then
- if getBitDepth(me) <> pOrigDepth then
- set the colorDepth to pOrigDepth
- end if
- else
- mRestoreScreenSaver(me)
- case pCurMode of
- 3:
- set the colorDepth to pOrigDepth
- updateStage()
- if getBitDepth(me) <> pOrigDepth then
- setPrevReset(me, 11)
- mRestoreMonitor(me)
- exit
- end if
- 6, 8:
- setPrevReset(me, 0)
- set dRestartSetting to getRestartSetting(me, pOrigDepth)
- if dRestartSetting contains "dynamic" then
- callBox(me, #dynamicRestore, 1, ["Yes", "No"])
- else
- if dRestartSetting contains "restart" then
- callBox(me, #restartRestore, 1, ["Yes", "No"])
- end if
- end if
- case gDiagResult of
- 1:
- changeColorDepthWin(me, dRestartSetting)
- 2:
- exit
- end case
- exit
- 10:
- callBox(me, #ManualRestore, 0, ["Yes", "No"])
- 11:
- setPrevReset(me, 0)
- set dRestartSetting to getRestartSetting(me, pOrigDepth)
- if dRestartSetting contains "dynamic" then
- callBox(me, #dynamicRestore, 1, ["No", "Yes"])
- else
- if dRestartSetting contains "restart" then
- callBox(me, #restartRestore, 1, ["No", "Yes"])
- end if
- end if
- case gDiagResult of
- 1:
- exit
- 2:
- changeColorDepthWin(me, dRestartSetting)
- end case
- exit
- end case
- setPrevReset(me, 0)
- end if
- end
-
- on getPrevReset me
- if not isPC() then
- exit
- end if
- set prefFile to getOSDirectory() & "\spookydisplay.ini"
- set dReStartVal to integer(baReadIni("RestartSettings", "RestartVal", "0", prefFile))
- set dColorDepth to integer(baReadIni("RestartSettings", "Color", string(getBitDepth(me)), prefFile))
- return [dReStartVal, dColorDepth]
- end
-
- on setPrevReset me, theMode
- if not isPC() then
- exit
- end if
- set pCurMode to theMode
- set prefFile to getOSDirectory() & "\spookydisplay.ini"
- set dFileExists to FileExists(prefFile)
- if pCurMode then
- set dResult to baWriteIni("RestartSettings", "RestartVal", string(pCurMode), prefFile)
- set dResult to baWriteIni("RestartSettings", "Color", string(pOrigDepth), prefFile)
- else
- if not dFileExists and not pCurMode then
- set dResult to baDeleteFile(prefFile)
- end if
- end if
- end
-
- on changeColorDepthWin me, theChangeString
- if not isPC() then
- exit
- end if
- set lineNum to findSetting(me, theChangeString)
- if lineNum > 0 then
- if word 7 of theChangeString = "dynamic" then
- dresDynamicSetDisplay(lineNum)
- else
- if word 7 of theChangeString = "restart" then
- dresRestartSetDisplay(lineNum)
- dresRestart()
- end if
- end if
- end if
- quit()
- end
-
- on getRestartSetting me, theBitDepth
- if not isPC() then
- exit
- end if
- set theBitDepth to string(theBitDepth)
- set dCurSettings to dresGetCurrentDisplay()
- set dSettingsList to dresGetDisplaySettings()
- set dGoodSettingsList to []
- repeat with i = 1 to the number of lines in dSettingsList
- set dSetting to line i of dSettingsList
- if (word 1 of dCurSettings = word 1 of dSetting) and (word 3 of dSetting = theBitDepth) then
- add(dGoodSettingsList, dSetting)
- end if
- end repeat
- if count(dGoodSettingsList) then
- repeat with dGoodSetting in dGoodSettingsList
- if dGoodSetting contains "dynamic" then
- set dReturnSetting to dGoodSetting
- exit repeat
- end if
- end repeat
- if voidp(dReturnSetting) then
- set dReturnString to getAt(dGoodSettingsList, 1)
- end if
- else
- set dReturnString to EMPTY
- end if
- return dReturnString
- end
-
- on findSetting me, theLine
- if not isPC() then
- exit
- end if
- set foundLine to 0
- set allSettings to dresGetDisplaySettings()
- set numLines to the number of lines in allSettings
- repeat with X = 1 to numLines
- if line X of allSettings = theLine then
- set foundLine to X
- exit repeat
- end if
- end repeat
- return foundLine
- end
-
- on getBitDepth me
- if not isPC() then
- return the colorDepth
- else
- set dCurSettings to dresGetCurrentDisplay()
- set dBitDepth to word 3 of dCurSettings
- return integer(dBitDepth)
- end if
- end
-
- on getLowestSetting me
- if not isPC() then
- exit
- end if
- set dCurSettings to dresGetCurrentDisplay()
- set dSettingsList to dresGetDisplaySettings()
- set dGoodSettings to []
- repeat with i = 1 to the number of lines in dSettingsList
- set dSetting to line i of dSettingsList
- if word 1 of dCurSettings = word 1 of dSetting then
- set dBitDepth to integer(word 3 of dSetting)
- if integerp(dBitDepth) then
- if dBitDepth >= 8 then
- add(dGoodSettings, dBitDepth)
- end if
- end if
- end if
- end repeat
- return min(dGoodSettings)
- end
-