The Trunk: Morphic-cmm.976.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-cmm.976.mcz

commits-2
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 ]!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.976.mcz

marcel.taeumel
In the future, we should cleary improve keyboard navigation and how workspaces are used. This scratchpad is a symptom of something inconvenient hidden in the Squeak UI. It compares to global state because we can only have one while we can have multiple, independent workspaces.

How do you trigger the search in the scratch pad?

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-cmm.976.mcz

Chris Muller-3
> In the future, we should cleary improve keyboard navigation and how
> workspaces are used.

Sure, but that has nothing to do with this.

> This scratchpad is a symptom of something inconvenient
> hidden in the Squeak UI. It compares to global state

It is global state but it does not compare to global state in the
negative way you are trying to portray.

> because we can only
> have one

Which is exactly how it needs to be for this feature.  If you need
more than one you should open a workspace.  That's not what this is
for..

> while we can have multiple, independent workspaces.

And, you still can.  But those are for totally different use-cases
than this, but you already know that from our private discussion.

> How do you trigger the search in the scratch pad?

Again, this is not a use-case for the scratch pad.  Nevertheless, you
could type and/or highlight your search term, press Command+H followed
by Command+G.