'From Squeak3.1alpha [latest update: #''Squeak3.1alpha'' of 28 February 2001 update 3929] on 17 April 2001 at night'! "Change Set: prefJuntaPhaseOne-sw Date: 17 April 2001 Author: Scott Wallace Phase One of a series of updates that overhaul Preferences. Here we do a few preparations. If manually loading updates one at a time, you would be well advised to load all three of these updates together. This update remembers existing pref values, then restores all pref to their default values so that those default values can be feed into the new preference objects. Also, all existing Preferences panels are removed. Thanks to Bob Arning for the code that hunts down and deletes all preferences panels present in mvc projects. CAUTION: hand-jimmied."! !ControlManager methodsFor: 'accessing' stamp: 'sw 4/17/2001 18:59'! controllersSatisfying: aBlock "Return a list of scheduled controllers satisfying aBlock. " ^ (scheduledControllers ifNil: [^ #()]) select: [:aController | (aBlock value: aController) == true]! ! !Preferences class methodsFor: 'initialization' stamp: 'sw 4/15/2001 02:38'! stashPrevailingFlagDictionary "Stash the current list of Preference into the parameter #Prevailing" self flag: #toRemove. self setParameter: #Prevailing to: FlagDictionary deepCopy. Project current projectParameterAt: #PrevailingProjectFlags put: Project current projectPreferenceFlagDictionary deepCopy "Preferences stashPrevailingFlagDictionary"! ! !PreferencesPanel class methodsFor: 'cleanup' stamp: 'sw 4/14/2001 14:33'! deleteAllPreferencesPanels "Called manually to clobber all existing preferences panels" "PreferencesPanel deleteAllPreferencesPanels" | aWindow | self allInstancesDo: [:aPanel | (aWindow _ aPanel containingWindow) isMorph ifTrue: [aWindow delete]]. self killExistingMVCViews. UpdatingThreePhaseButtonMorph allInstancesDo: "clobber old stand-alone prefs buttons" [:m | (m actionSelector == #togglePreference:) ifTrue: [(m owner isKindOf: AlignmentMorph) ifTrue: [m owner delete]]]! ! !PreferencesPanel class methodsFor: 'cleanup' stamp: 'RAA 4/14/2001 11:04'! isAPreferenceViewToKill: aSystemView "Answer whether the given StandardSystemView is one affiliated with a PreferencesPanel" | m target subView | aSystemView subViews size = 1 ifFalse: [^ false]. subView _ aSystemView subViews first. (subView isKindOf: MorphWorldView) ifFalse: [^ false]. ((m _ subView model) isKindOf: MVCWiWPasteUpMorph) ifFalse: [^ false]. m submorphs size = 1 ifFalse: [^ false]. m firstSubmorph submorphs size = 1 ifFalse: [^ false]. target _ m firstSubmorph firstSubmorph. (target isKindOf: TabbedPalette) ifFalse: [^ false]. ^ #(browsing debug fileout general halos) allSatisfy: [:s | (target tabNamed: s) notNil]! ! !PreferencesPanel class methodsFor: 'cleanup' stamp: 'RAA 4/14/2001 11:03'! killExistingMVCViews "Kill all existing preferences views in mvc" " PreferencesPanel killExistingMVCViews " | byebye | ControlManager allInstances do: [ :cm | byebye _ cm controllersSatisfying: [ :eachC | self isAPreferenceViewToKill: eachC view]. byebye do: [ :each | each status: #closed. each view release. cm unschedule: each]]! ! !Preferences class methodsFor: 'preferences dictionary' stamp: 'sw 4/16/2001 12:04'! noteThatFlag: prefSymbol justChangedTo: aBoolean "Provides a hook so that a user's toggling of a preference might precipitate some immediate action" | keep | true ifTrue: [^ self]. "Temporarily disabled during prefs junta; eventually gets removed" prefSymbol == #useGlobalFlaps ifTrue: [aBoolean ifFalse: "Turning off use of flaps" [keep _ self confirm: 'Do you want to preserve the existing global flaps for future use?'. Utilities globalFlapTabsIfAny do: [:aFlapTab | Utilities removeFlapTab: aFlapTab keepInList: keep. aFlapTab isInWorld ifTrue: [self error: 'Flap problem']]. keep ifFalse: [Utilities clobberFlapTabList]] ifTrue: "Turning on use of flaps" [Smalltalk isMorphic ifTrue: [self currentWorld enableGlobalFlaps]]]. prefSymbol == #roundedWindowCorners ifTrue: [World fullRepaintNeeded]. prefSymbol == #optionalButtons ifTrue: [Utilities replacePartSatisfying: [:el | (el isKindOf: MorphThumbnail) and: [(el morphRepresented isKindOf: SystemWindow) and: [el morphRepresented model isKindOf: FileList]]] inGlobalFlapSatisfying: [:f1 | f1 wording = 'Tools'] with: FileList openAsMorph applyModelExtent]. (prefSymbol == #optionalButtons or: [prefSymbol == #annotationPanes]) ifTrue: [Utilities replaceBrowserInToolsFlap]. (prefSymbol == #smartUpdating) ifTrue: [SystemWindow allSubInstancesDo: [:aWindow | aWindow amendSteppingStatus]]. (prefSymbol == #eToyFriendly) ifTrue: [ScriptingSystem customizeForEToyUsers: aBoolean]. ((prefSymbol == #infiniteUndo) and: [aBoolean not]) ifTrue: [CommandHistory resetAllHistory]. (prefSymbol == #showProjectNavigator) ifTrue: [Project current assureNavigatorPresenceMatchesPreference]. (prefSymbol == #largeTiles) ifTrue: [^ self largeTilesSettingToggled]. prefSymbol == #universalTiles ifTrue: [^ self universalTilesSettingToggled]! ! "Postscript:" Preferences stashPrevailingFlagDictionary. Preferences chooseInitialSettings.!