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

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

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

Name: Morphic-mt.809
Author: mt
Time: 2 April 2015, 10:21:50.789 am
UUID: 39d28574-7b19-7a4f-8a50-b8c828f1b5b2
Ancestors: Morphic-mt.808

Fix selection in lists or trees for context menus. By default, models rely on the current selection for the menu. This can be confusing if the user invokes that menu on a different item.

=============== Diff against Morphic-mt.808 ===============

Item was changed:
  ----- Method: PluggableListMorph>>mouseDown: (in category 'events') -----
  mouseDown: evt
  | selectors row |
- evt yellowButtonPressed  "First check for option (menu) click"
- ifTrue: [^ self yellowButtonActivity: evt shiftPressed].
  row := self rowAtLocation: evt position.
+
+ evt yellowButtonPressed  "First check for option (menu) click"
+ ifTrue: [
+ "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: [
+ 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].
- evt yellowButtonPressed  "First check for option (menu) click"
- ifTrue: [^ self yellowButtonActivity: evt shiftPressed].
  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".!