The Trunk: ToolBuilder-Morphic-mt.149.mcz

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

The Trunk: ToolBuilder-Morphic-mt.149.mcz

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

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

Name: ToolBuilder-Morphic-mt.149
Author: mt
Time: 25 August 2015, 10:56:48.908 am
UUID: a99ffbe0-4d17-0240-92ab-4265cf26bc36
Ancestors: ToolBuilder-Morphic-topa.148

Adds support for drag-type selectors in models for lists and trees instead of hardcoding #dragTransferPlus.

Note that we might want to get rid of Object >> #dragTransferTypeForMorph: someday.... No one is implementing that anyway. Maybe also Object >> #dragPassengerFor:inMorph:. Using #dragItemSelector to let the model decide seems more appropriate.

=============== Diff against ToolBuilder-Morphic-topa.148 ===============

Item was changed:
  PluggableListMorph subclass: #PluggableListMorphPlus
+ instanceVariableNames: 'dragItemSelector dropItemSelector wantsDropSelector getHelpSelector dragTypeSelector'
- instanceVariableNames: 'dragItemSelector dropItemSelector wantsDropSelector getHelpSelector'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'ToolBuilder-Morphic'!
 
  !PluggableListMorphPlus commentStamp: 'ar 7/15/2005 11:10' prior: 0!
  Extensions for PluggableListMorph needed by ToolBuilder!

Item was added:
+ ----- Method: PluggableListMorphPlus>>dragTypeSelector (in category 'accessing') -----
+ dragTypeSelector
+ ^dragTypeSelector!

Item was added:
+ ----- Method: PluggableListMorphPlus>>dragTypeSelector: (in category 'accessing') -----
+ dragTypeSelector: aSymbol
+ dragTypeSelector := aSymbol.!

Item was changed:
  ----- Method: PluggableListMorphPlus>>startDrag: (in category 'drag and drop') -----
  startDrag: evt
 
  dragItemSelector ifNil:[^self].
  evt hand hasSubmorphs ifTrue: [^ self].
  [ | dragIndex draggedItem ddm |
  (self dragEnabled and: [model okToChange]) ifFalse: [^ self].
  dragIndex := self rowAtLocation: evt position.
  dragIndex = 0 ifTrue:[^self].
  draggedItem := model perform: dragItemSelector with: (self modelIndexFor: dragIndex).
  draggedItem ifNil:[^self].
  ddm := TransferMorph withPassenger: draggedItem from: self.
+ ddm dragTransferType: (self dragTypeSelector
+ ifNil: [#dragTransferPlus]
+ ifNotNil: [:s | self model perform: s with: (self modelIndexFor: dragIndex)]).
- ddm dragTransferType: #dragTransferPlus.
  evt hand grabMorph: ddm]
  ensure: [Cursor normal show.
  evt hand releaseMouseFocus: self]!

Item was changed:
  SimpleHierarchicalListMorph subclass: #PluggableTreeMorph
+ instanceVariableNames: 'rootWrappers selectedWrapper getRootsSelector getChildrenSelector hasChildrenSelector getLabelSelector getIconSelector getSelectedPathSelector setSelectedParentSelector getHelpSelector dropItemSelector wantsDropSelector dragItemSelector dragTypeSelector nodeClass lastKeystrokeTime lastKeystrokes'
- instanceVariableNames: 'rootWrappers selectedWrapper getRootsSelector getChildrenSelector hasChildrenSelector getLabelSelector getIconSelector getSelectedPathSelector setSelectedParentSelector getHelpSelector dropItemSelector wantsDropSelector dragItemSelector nodeClass lastKeystrokeTime lastKeystrokes'
  classVariableNames: 'FilterByLabelsOnly MaximumSearchDepth'
  poolDictionaries: ''
  category: 'ToolBuilder-Morphic'!
 
  !PluggableTreeMorph commentStamp: 'ar 2/12/2005 04:38' prior: 0!
  A pluggable tree morph.!

Item was added:
+ ----- Method: PluggableTreeMorph>>dragTypeSelector (in category 'accessing') -----
+ dragTypeSelector
+ ^dragTypeSelector!

Item was added:
+ ----- Method: PluggableTreeMorph>>dragTypeSelector: (in category 'accessing') -----
+ dragTypeSelector: aSymbol
+ dragTypeSelector := aSymbol.!

Item was changed:
  ----- Method: PluggableTreeMorph>>startDrag: (in category 'morphic') -----
  startDrag: evt
  | ddm itemMorph passenger |
  self dragEnabled
  ifTrue: [itemMorph := scroller submorphs
  detect: [:any | any highlightedForMouseDown]
  ifNone: []].
  (itemMorph isNil
  or: [evt hand hasSubmorphs])
  ifTrue: [^ self].
  itemMorph highlightForMouseDown: false.
  itemMorph ~= self selectedMorph
  ifTrue: [self setSelectedMorph: itemMorph].
  passenger := self model perform: dragItemSelector with: itemMorph withoutListWrapper.
  passenger
  ifNotNil: [ddm := TransferMorph withPassenger: passenger from: self.
+ ddm dragTransferType: (self dragTypeSelector
+ ifNil: [#dragTransferPlus]
+ ifNotNil: [:s | self model perform: s with: itemMorph withoutListWrapper]).
- ddm dragTransferType: #dragTransferPlus.
  Preferences dragNDropWithAnimation
  ifTrue: [self model dragAnimationFor: itemMorph transferMorph: ddm].
  evt hand grabMorph: ddm].
  evt hand releaseMouseFocus: self!