'From Squeak3.3alpha of 18 January 2002 [latest update: #4923] on 23 July 2002 at 4:29:21 pm'! "Change Set: findA-sw Date: 23 July 2002 Author: Scott Wallace Published to 3.3a as 4924findA-sw.cs. Consolidates the main work of six methods that service the various windows-menu 'find-a' requests (e.g. 'find a Transcript') into a single place. One of these six is the newly added 'find a fileList', with cmd-L as its desktop-cmd-key shortcut."! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 7/23/2002 13:47'! findAChangeSorter: evt "Locate a change sorter, open it, and bring it to the front. Create one if necessary" self findAWindowSatisfying: [:aWindow | (aWindow model isMemberOf: ChangeSorter) or: [aWindow model isKindOf: DualChangeSorter]] orMakeOneUsing: [DualChangeSorter new morphicWindow]! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 7/22/2002 08:56'! findAFileList: evt "Locate a file list, open it, and bring it to the front. Create one if necessary" self findAWindowSatisfying: [:aWindow | aWindow model isKindOf: FileList] orMakeOneUsing: [FileList openAsMorph]! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 7/23/2002 13:53'! findAMessageNamesWindow: evt "Locate a MessageNames tool, open it, and bring it to the front. Create one if necessary" self findAWindowSatisfying: [:aWindow | aWindow model isKindOf: MessageNames] orMakeOneUsing: [MessageNames new inMorphicWindowLabeled: 'Message Names']! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 7/23/2002 16:19'! findAPreferencesPanel: evt "Locate a Preferences Panel, open it, and bring it to the front. Create one if necessary" | aPanel | self findAWindowSatisfying: [:aWindow | aWindow model isKindOf: PreferencesPanel] orMakeOneUsing: [aPanel _ Preferences preferencesControlPanel. "Note -- we don't really want the openInHand -- but owing to some annoying difficulty, if we don't, we get the wrong width. Somebody please clean this up" ^ aPanel openInHand]! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 7/22/2002 08:54'! findATranscript: evt "Locate a transcript, open it, and bring it to the front. Create one if necessary" self findAWindowSatisfying: [:aWindow | aWindow model == Transcript] orMakeOneUsing: [Transcript openAsMorphLabel: 'Transcript']! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 7/22/2002 08:52'! findAWindowSatisfying: qualifyingBlock orMakeOneUsing: makeBlock "Locate a window satisfying a block, open it, and bring it to the front. Create one if necessary, by using the makeBlock" | aWindow | submorphs do: [:aMorph | (((aWindow _ aMorph renderedMorph) isKindOf: SystemWindow) and: [qualifyingBlock value: aWindow]) ifTrue: [aWindow isCollapsed ifTrue: [aWindow expand]. aWindow activateAndForceLabelToShow. ^ self]]. "None found, so create one" makeBlock value openInWorld! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 7/22/2002 08:58'! 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 wish to edit this method to suit your personal taste in interpreting cmd-keys issued to the desktop." | aChar isCmd | aChar _ evt keyCharacter. aChar asciiValue = 27 ifTrue: "escape key" [^ ActiveWorld putUpWorldMenuFromEscapeKey]. isCmd _ evt commandKeyPressed and: [Preferences cmdKeysInText]. (evt commandKeyPressed and: [Preferences eToyFriendly]) ifTrue: [(aChar == $W) ifTrue: [^ self putUpWorldMenu: evt]]. (isCmd and: [Preferences honorDesktopCmdKeys]) ifTrue: [(aChar == $o) ifTrue: [^ ActiveWorld activateObjectsTool]. (aChar == $F) ifTrue: [^ CurrentProjectRefactoring currentToggleFlapsSuppressed]. (aChar == $N) ifTrue: [Preferences classicNavigatorEnabled ifTrue: [^ Preferences togglePreference: #showProjectNavigator]]. (aChar == $r) ifTrue: [^ ActiveWorld restoreMorphicDisplay]. Preferences eToyFriendly ifFalse: [(aChar == $\) ifTrue: [^ SystemWindow sendTopWindowToBack]. (aChar == $b) ifTrue: [^ Browser openBrowser]. (aChar == $k) ifTrue: [^ Workspace open]. (aChar == $m) ifTrue: [^ TheWorldMenu new adaptToWorld: World; newMorph]. (aChar == $t) ifTrue: [^ self findATranscript: evt]. (aChar == $w) ifTrue: [^ SystemWindow closeTopWindow]. (aChar == $z) ifTrue: [^ self commandHistory undoOrRedoCommand]. (aChar == $C) ifTrue: [^ self findAChangeSorter: evt]. (aChar == $L) ifTrue: [^ self findAFileList: evt]. (aChar == $R) ifTrue: [^ self openRecentSubmissionsBrowser: evt]. (aChar == $P) ifTrue: [^ self findAPreferencesPanel: evt]. (aChar == $W) ifTrue: [^ self findAMessageNamesWindow: evt]]]! ! !PasteUpMorph methodsFor: 'world menu' stamp: 'sw 7/23/2002 14:01'! openRecentSubmissionsBrowser: evt "Locate a recent-submissions browser, open it, and bring it to the front. Create one if necessary. Only works in morphic" self findAWindowSatisfying: [:aWindow | aWindow model isKindOf: RecentMessageSet] orMakeOneUsing: [Utilities recentSubmissionsWindow] ! ! !Preferences class methodsFor: 'preferences panel' stamp: 'sw 7/23/2002 16:10'! preferencesControlPanel "Answer a Preferences control panel window" "Preferences preferencesControlPanel openInHand" | window playfield aPanel | aPanel _ PreferencesPanel new. playfield _ PasteUpMorph new width: 325. playfield dropEnabled: false. window _ (SystemWindow labelled: 'Preferences') model: aPanel. self initializePreferencePanel: aPanel in: playfield. window on: #keyStroke send: #keyStroke: to: aPanel. window bounds: (100 @ 100 - (0 @ window labelHeight + window borderWidth) extent: playfield extent + (2 * window borderWidth)). window addMorph: playfield frame: (0 @ 0 extent: 1 @ 1). window updatePaneColors. window setProperty: #minimumExtent toValue: playfield extent + (12@15). ^ window! ! !TheWorldMenu methodsFor: 'windows & flaps menu' stamp: 'sw 7/22/2002 08:59'! windowsMenu "Build the windows menu for the world." ^ self fillIn: (self menu: 'windows') from: { { 'find window' . { #myWorld . #findWindow: }. 'Presents a list of all windows; if you choose one from the list, it becomes the active window.'}. { 'find changed browsers...' . { #myWorld . #findDirtyBrowsers: }. 'Presents a list of browsers that have unsubmitted changes; if you choose one from the list, it becomes the active window.'}. { 'find changed windows...' . { #myWorld . #findDirtyWindows: }. 'Presents a list of all windows that have unsubmitted changes; if you choose one from the list, it becomes the active window.'}. nil. { 'find a transcript (t)' . { #myWorld . #findATranscript: }. 'Brings an open Transcript to the front, creating one if necessary, and makes it the active window'}. { 'find a fileList (L)' . { #myWorld . #findAFileList: }. 'Brings an open fileList to the front, creating one if necessary, and makes it the active window'}. { 'find a change sorter (C)' . { #myWorld . #findAChangeSorter: }. 'Brings an open change sorter to the front, creating one if necessary, and makes it the active window'}. { 'find message names (W)' . { #myWorld . #findAMessageNamesWindow: }. 'Brings an open MessageNames window to the front, creating one if necessary, and makes it the active window'}. nil. { #staggerPolicyString . { self . #toggleWindowPolicy }. 'stagger: new windows positioned so you can see a portion of each one. tile: new windows positioned so that they do not overlap others, if possible.'}. nil. { 'collapse all windows' . { #myWorld . #collapseAll }. 'Reduce all open windows to collapsed forms that only show titles.'}. { 'expand all windows' . { #myWorld . #expandAll }. 'Expand all collapsed windows back to their expanded forms.'}. { 'close top window (w)' . { SystemWindow . #closeTopWindow }. 'Close the topmost window if possible.'}. { 'send top window to back (\)' . { SystemWindow . #sendTopWindowToBack }. 'Make the topmost window become the backmost one, and activate the window just beneath it.'}. { 'move windows onscreen' . { #myWorld . #bringWindowsFullOnscreen }. 'Make all windows fully visible on the screen'}. nil. { 'delete unchanged windows' . { #myWorld . #closeUnchangedWindows }. 'Deletes all windows that do not have unsaved text edits.'}. { 'delete non-windows' . { #myWorld . #deleteNonWindows }. 'Deletes all non-window morphs lying on the world.'}. { 'delete both of the above' . { self . #cleanUpWorld }. 'deletes all unchanged windows and also all non-window morphs lying on the world, other than flaps.'}. }! !