The Trunk: Morphic-cmm.1104.mcz

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

The Trunk: Morphic-cmm.1104.mcz

commits-2
Chris Muller uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-cmm.1104.mcz

==================== Summary ====================

Name: Morphic-cmm.1104
Author: cmm
Time: 7 April 2016, 4:14:29.108974 pm
UUID: 3fa0654e-9d15-4a86-94c5-9982def7e94f
Ancestors: Morphic-ul.1103

- Put the new 'Wrapped Navigation' feature onto a Preference, so that the ability to easily navigate trees with just one hand on the arrow keys is restored.
- It also restores navigation keys [Home], [End], [Pg Up] and [Pg Down] to ONLY navigate, and not cause tree expansions.

=============== Diff against Morphic-ul.1103 ===============

Item was changed:
  ScrollPane subclass: #SimpleHierarchicalListMorph
  instanceVariableNames: 'selectedMorph hoveredMorph getListSelector keystrokeActionSelector autoDeselect columns sortingSelector getSelectionSelector setSelectionSelector potentialDropMorph lineColor'
+ classVariableNames: 'WrappedNavigation'
- classVariableNames: ''
  poolDictionaries: ''
  category: 'Morphic-Explorer'!
  SimpleHierarchicalListMorph class
  instanceVariableNames: 'expandedForm notExpandedForm'!
 
  !SimpleHierarchicalListMorph commentStamp: 'ls 3/1/2004 12:15' prior: 0!
  Display a hierarchical list of items.  Each item should be wrapped with a ListItemWrapper.
 
  For a simple example, look at submorphsExample.  For beefier examples, look at ObjectExplorer or FileList2.!
  SimpleHierarchicalListMorph class
  instanceVariableNames: 'expandedForm notExpandedForm'!

Item was added:
+ ----- Method: SimpleHierarchicalListMorph class>>wrappedNavigation (in category 'preferences') -----
+ wrappedNavigation
+ <preference: 'Wrapped Tree Navigation'
+ category: 'Morphic'
+ description: 'When enabled, use of the arrow keys at the top or bottom of a hierarchical list will wrap to the opposite side of the list.'
+ type: #Boolean>
+ ^ WrappedNavigation ifNil: [ false ]!

Item was added:
+ ----- Method: SimpleHierarchicalListMorph class>>wrappedNavigation: (in category 'preferences') -----
+ wrappedNavigation: aBoolean
+ WrappedNavigation := aBoolean!

Item was changed:
  ----- Method: SimpleHierarchicalListMorph>>arrowKey: (in category 'keyboard navigation') -----
  arrowKey: asciiValue
  "Handle a keyboard navigation character. Answer true if handled, false if not."
+ | keyEvent max oldSelection nextSelection howManyItemsShowing keyHandled |
+ keyHandled := false.
- | keyEvent max oldSelection nextSelection howManyItemsShowing |
  keyEvent := asciiValue.
  max := self maximumSelection.
  nextSelection := oldSelection := self getSelectionIndex.
       keyEvent = 31 ifTrue:["down"
+ keyHandled := true.
  nextSelection :=oldSelection + 1.
+ nextSelection > max ifTrue: [nextSelection := (self class wrappedNavigation ifTrue: [1] ifFalse: [max])]].
- nextSelection > max ifTrue: [nextSelection := 1]].
       keyEvent = 30 ifTrue:["up"
+ keyHandled := true.
  nextSelection := oldSelection - 1.
+ nextSelection < 1 ifTrue: [nextSelection := self class wrappedNavigation ifTrue: [max] ifFalse: [1]]].
- nextSelection < 1 ifTrue: [nextSelection := max]].
       keyEvent = 1  ifTrue: ["home"
+ keyHandled := true.
  nextSelection := 1].
       keyEvent = 4  ifTrue: ["end"
+ keyHandled := true.
  nextSelection := max].
  howManyItemsShowing := self numSelectionsInView.
        keyEvent = 11 ifTrue: ["page up"
+ keyHandled := true.
  nextSelection := 1 max: oldSelection - howManyItemsShowing].
       keyEvent = 12  ifTrue: ["page down"
+ keyHandled := true.
  nextSelection := oldSelection + howManyItemsShowing min: max].
 
+ (nextSelection ~= oldSelection or: [ keyHandled and: [ self class wrappedNavigation not ]]) ifTrue: [
- nextSelection = oldSelection ifFalse: [
  self setSelectionIndex: nextSelection.
  ^ true].
 
  keyEvent = 29 ifTrue:["right"
  selectedMorph ifNotNil:[
  (selectedMorph canExpand and:[selectedMorph isExpanded not])
  ifTrue:[self toggleExpandedState: selectedMorph]
  ifFalse:[self setSelectionIndex: self getSelectionIndex+1].
  ].
  ^true].
  keyEvent = 28 ifTrue:["left"
  selectedMorph ifNotNil:[
  (selectedMorph isExpanded)
  ifTrue:[self toggleExpandedState: selectedMorph]
  ifFalse:[self setSelectionIndex: (self getSelectionIndex-1 max: 1)].
  ].
  ^true].
  ^false!