The Trunk: Morphic-mt.813.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-mt.813.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.813.mcz

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

Name: Morphic-mt.813
Author: mt
Time: 3 April 2015, 9:12:20.355 am
UUID: 539e0985-e659-1743-b998-928c707d759d
Ancestors: Morphic-mt.812

Added preference for updating the current selection on option/menu click to compensate misplaced mouse cursors.

=============== Diff against Morphic-mt.812 ===============

Item was changed:
  ScrollPane subclass: #PluggableListMorph
  instanceVariableNames: 'list getListSelector getListSizeSelector getListElementSelector getIndexSelector setIndexSelector keystrokeActionSelector autoDeselect lastKeystrokeTime lastKeystrokes lastClickTime doubleClickSelector handlesBasicKeys potentialDropRow hoverRow listMorph hScrollRangeCache keystrokePreviewSelector priorSelection getIconSelector'
+ classVariableNames: 'ClearFilterAutomatically FilterableLists HighlightHoveredRow MenuRequestUpdatesSelection'
- classVariableNames: 'ClearFilterAutomatically FilterableLists HighlightHoveredRow'
  poolDictionaries: ''
  category: 'Morphic-Pluggable Widgets'!
 
  !PluggableListMorph commentStamp: 'cmm 8/21/2011 23:37' prior: 0!
  When a PluggableListMorph is in focus, type in a letter (or several letters quickly) to go to the next item that begins with that letter (if FilterableLists is false).
 
  Special keys (up, down, home, etc.) are also supported.!

Item was added:
+ ----- Method: PluggableListMorph class>>menuRequestUpdatesSelection (in category 'preferences') -----
+ menuRequestUpdatesSelection
+
+ <preference: 'Menu request updates list/tree selection'
+ category: #Morphic
+ description: 'When invoking a menu, this will for the current selection by default. If the mouse cursor it at a different location, however, this preference will update the selection before showing the menu if enabled.'
+ type: #Boolean>
+ ^ MenuRequestUpdatesSelection ifNil: [ false ]!

Item was added:
+ ----- Method: PluggableListMorph class>>menuRequestUpdatesSelection: (in category 'preferences') -----
+ menuRequestUpdatesSelection: aBoolean
+
+ MenuRequestUpdatesSelection := aBoolean.!

Item was changed:
  ----- Method: PluggableListMorph>>mouseDown: (in category 'events') -----
  mouseDown: evt
  | selectors row |
  row := self rowAtLocation: evt position.
 
  evt yellowButtonPressed  "First check for option (menu) click"
  ifTrue: [
+ self class menuRequestUpdatesSelection ifTrue: [
+ "Models depend on the correct selection:"
+ self selectionIndex = (self modelIndexFor: row)
+ ifFalse: [self changeModelSelection: (self modelIndexFor: row)]].
+
- "Models depend on the correct selection:"
- self selectionIndex = (self modelIndexFor: row)
- ifFalse: [self changeModelSelection: (self modelIndexFor: row)].
-
  ^ self yellowButtonActivity: evt shiftPressed].
  row = 0  ifTrue: [^super mouseDown: evt].
  "self dragEnabled ifTrue: [aMorph highlightForMouseDown]."
  selectors := Array
  with: #click:
  with: (doubleClickSelector ifNotNil:[#doubleClick:])
  with: nil
  with: (self dragEnabled ifTrue:[#startDrag:] ifFalse:[nil]).
  evt hand waitForClicksOrDrag: self event: evt selectors: selectors threshold: HandMorph dragThreshold "pixels".!

Item was changed:
  ----- Method: SimpleHierarchicalListMorph>>mouseDown: (in category 'event handling') -----
  mouseDown: evt
  | aMorph selectors |
  aMorph := self itemFromPoint: evt position.
  evt yellowButtonPressed  "First check for option (menu) click"
  ifTrue: [
+ PluggableListMorph menuRequestUpdatesSelection ifTrue: [
+ aMorph == selectedMorph
+ ifFalse: [self setSelectedMorph: aMorph]].
- aMorph == selectedMorph
- ifFalse: [self setSelectedMorph: aMorph].
  ^ self yellowButtonActivity: evt shiftPressed].
  (aMorph notNil and:[aMorph inToggleArea: (aMorph point: evt position from: self)])
  ifTrue:[^self toggleExpandedState: aMorph event: evt].
  aMorph ifNil:[^super mouseDown: evt].
  aMorph highlightForMouseDown.
  selectors := Array
  with: #click:
  with: nil
  with: nil
  with: (self dragEnabled ifTrue:[#startDrag:] ifFalse:[nil]).
  evt hand waitForClicksOrDrag: self event: evt selectors: selectors threshold: HandMorph dragThreshold "pixels".!