'From Squeak3.1alpha of 6 February 2001 [latest update: #3541] on 7 February 2001 at 5:17:55 pm'! "Change Set: findPrefPanel-sw Date: 7 February 2001 Author: Scott Wallace Makes the standard way of getting a Preferences panel (in morphic anyway) be to find and reuse any existing such panel, rather than always launching a new one. Adds cmd-shift-P as a desktop keyboard shortcut for finding and opening a Preferences panel. If there are users who intentionally *want* to have multiple Preference Panels open on the same screen, there is still a protocol to do that (Preferences openNewPreferencesPanel) but the standard buttons and controls in the image use the new paradigm."! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 2/7/2001 14:48'! findAPreferencesPanel: evt "Locate a Preferences Panel, open it, and bring it to the front. Create one if necessary" | aWindow | submorphs do: [:aMorph | (((aWindow _ aMorph renderedMorph) isKindOf: SystemWindow) and: [aWindow model isKindOf: PreferencesPanel]) ifTrue: [aWindow isCollapsed ifTrue: [aWindow expand]. aWindow activateAndForceLabelToShow. ^ self]]. "None found, so create one" Preferences openFactoredPanelWithWidth: 370! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 2/7/2001 14:55'! keystrokeInWorld: evt "A keystroke was hit when no keyboard focus was in set, so it is sent here to the world instead. This current implementation is regrettably hard-coded; until someone cleans this up, you may be tempted to edit this method to suit your personal taste in interpreting cmd-keys issued to the desktop." | aChar isCmd | aChar _ evt keyCharacter. isCmd _ evt commandKeyPressed and: [Preferences cmdKeysInText]. isCmd ifTrue: [(aChar == $z) ifTrue: [^ self commandHistory undoOrRedoCommand]. (aChar == $w) ifTrue: [^ SystemWindow closeTopWindow]. (aChar == $\) ifTrue: [^ SystemWindow sendTopWindowToBack]. (aChar == $t) ifTrue: [^ self findATranscript: evt]. (aChar == $b) ifTrue: [^ Browser openBrowser]. (aChar == $k) ifTrue: [^ Workspace open]. (aChar == $m) ifTrue: [^ TheWorldMenu new adaptToWorld: World; newMorph]. (aChar == $C) ifTrue: [^ self findAChangeSorter: evt]. (aChar == $R) ifTrue: [^ self openRecentSubmissionsBrowser: evt]. (aChar == $P) ifTrue: [^ self findAPreferencesPanel: evt]. (aChar == $r) ifTrue: [^ Display restoreMorphicDisplay]. (aChar == $W) ifTrue: [^ self invokeWorldMenu: evt]] "This last item is a weirdo feature requested by the Open School in Fall of 2000 as a keyhole to the world menu in systems that normally do not offer a world menu"! ! !Preferences class methodsFor: 'factored pref panel' stamp: 'sw 2/7/2001 15:02'! openFactoredPanel "Open up a tabbed Preferences panel. In mvc, a new one is launched on each request; in Morphic, any existing one is opened, and a new one launched only if no existing one can be found." Smalltalk isMorphic ifTrue: "reuse an existing one if one is found, else create a fresh one" [self currentWorld findAPreferencesPanel: nil] ifFalse: "in mvc, always opens a new one for now" [self openNewPreferencesPanel] "Preferences openFactoredPanel" ! ! !Preferences class methodsFor: 'factored pref panel' stamp: 'sw 2/7/2001 15:01'! openNewPreferencesPanel "Create and open a new Preferences Panel" self openFactoredPanelWithWidth: 370! !