[squeak-dev] The Trunk: Morphic-cmm.976.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun May 10 22:03:14 UTC 2015
Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.976.mcz
==================== Summary ====================
Name: Morphic-cmm.976
Author: cmm
Time: 10 May 2015, 5:02:21.338 pm
UUID: f38aa89b-6570-4bc3-9113-b2bf193475ca
Ancestors: Morphic-mt.975
Added preference to let Command+0 jump straight to the new results balloon of the search bar, where pressing ESCape returns keyboard focus to the originating window.
=============== Diff against Morphic-mt.975 ===============
Item was changed:
Model subclass: #SearchBar
+ instanceVariableNames: 'originatingWidget searchTerm selection resultsWidget workspace scratchPad'
+ classVariableNames: 'UseScratchPad'
- instanceVariableNames: 'searchTerm selection resultsWidget workspace'
- classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Menus-DockingBar'!
Item was added:
+ ----- Method: SearchBar class>>useScratchPad (in category 'preferences') -----
+ useScratchPad
+ <preference: 'Command+0 invokes the scratch pad'
+ category: 'docking bars'
+ description: 'When enabled, pressing Command+0 will go straight to the Search Bar''s scratch pad instead of the Search Bar, where pressing ESCape will return keyboard focus to the originating window.'
+ type: #Boolean>
+ ^ UseScratchPad ifNil: [ false ]!
Item was added:
+ ----- Method: SearchBar class>>useScratchPad: (in category 'preferences') -----
+ useScratchPad: aBoolean
+ UseScratchPad := aBoolean!
Item was changed:
----- Method: SearchBar>>activate:in: (in category 'accessing') -----
+ activate: event in: morph
+ UseScratchPad
+ ifTrue:
+ [ event hand keyboardFocus = self scratchPad ifFalse: [ originatingWidget := event hand keyboardFocus ].
+ self scratchPad selectAll; openInWorld.
+ event hand newKeyboardFocus: self scratchPad ]
+ ifFalse:
+ [ self selection: (1 to: self searchTerm size).
+ event hand newKeyboardFocus: morph textMorph ]!
- activate: event in: morph
-
- self selection: (1 to: self searchTerm size).
- event hand newKeyboardFocus: morph textMorph.!
Item was added:
+ ----- Method: SearchBar>>handleScratchPadKey: (in category 'private') -----
+ handleScratchPadKey: aKeyboardEvent
+ (aKeyboardEvent keyValue = Character escape asciiValue and: [ originatingWidget notNil ]) ifTrue:
+ [ aKeyboardEvent hand newKeyboardFocus: originatingWidget.
+ self removeScratchPad ]!
Item was added:
+ ----- Method: SearchBar>>removeScratchPad (in category 'accessing') -----
+ removeScratchPad
+ scratchPad ifNotNil: [ scratchPad delete ]!
Item was added:
+ ----- Method: SearchBar>>scratchPad (in category 'accessing') -----
+ scratchPad
+ ^ scratchPad ifNil:
+ [ | pos width |
+ World mainDockingBars do:
+ [ : each | each searchBarMorph ifNotNil:
+ [ : searchBar | pos := searchBar bottomLeft. width:=searchBar width ] ].
+ width ifNil: [ width:=250. pos := World topRight - (width @ 5) ].
+ scratchPad := TextMorph new.
+ scratchPad
+ on: #keyboardFocusChange send: #removeScratchPad to: self ;
+ on: #mouseLeave send: #removeScratchPad to: self ;
+ on: #keyStroke send: #handleScratchPadKey: to: self ;
+ backgroundColor: (BalloonMorph balloonColor alpha: 1.0) ;
+ width: width ;
+ autoFit: true ;
+ wrapFlag: true ;
+ newContents: '--scratch area--' ;
+ yourself.
+ scratchPad position: pos.
+ Preferences menuAppearance3d ifTrue: [ scratchPad addDropShadow ].
+ scratchPad ]!
More information about the Squeak-dev
mailing list
|