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

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

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

Name: ToolBuilder-Morphic-mt.249
Author: mt
Time: 15 November 2019, 3:30:45.29033 pm
UUID: 6b6d260a-1c67-0f45-95bf-92b28407acf2
Ancestors: ToolBuilder-Morphic-mt.248

Fixes missing initial selection in tree widgets.

(Makes inbox commit ToolBuilder-Morphic-ct.244 obsolete.)

=============== Diff against ToolBuilder-Morphic-mt.248 ===============

Item was changed:
  ----- Method: MorphicToolBuilder>>buildPluggableTree: (in category 'widgets required') -----
  buildPluggableTree: aSpec
  | widget |
  widget := self treeClass new.
  self register: widget id: aSpec name.
+
  widget model: aSpec model.
+ widget nodeClass: aSpec nodeClass.
+
+ widget getRootsSelector: aSpec roots.
+ widget getChildrenSelector: aSpec getChildren.
+ widget hasChildrenSelector: aSpec hasChildren.
+
+ widget getSelectedSelector: aSpec getSelected.
+ widget setSelectedSelector: aSpec setSelected.
  widget getSelectedPathSelector: aSpec getSelectedPath.
  widget setSelectedPathSelector: aSpec setSelectedPath.
+
- widget setSelectedSelector: aSpec setSelected.
- widget getSelectedSelector: aSpec getSelected.
  widget setSelectedParentSelector: aSpec setSelectedParent.
+
- widget getChildrenSelector: aSpec getChildren.
- widget hasChildrenSelector: aSpec hasChildren.
  widget getLabelSelector: aSpec label.
  widget getIconSelector: aSpec icon.
  widget getHelpSelector: aSpec help.
  widget getMenuSelector: aSpec menu.
+
  widget keystrokeActionSelector: aSpec keyPress.
- widget nodeClass: aSpec nodeClass.
- widget getRootsSelector: aSpec roots.
  widget autoDeselect: aSpec autoDeselect.
  widget doubleClickSelector: aSpec doubleClick.
 
  widget dropItemSelector: aSpec dropItem.
  widget wantsDropSelector: aSpec dropAccept.
  widget dragItemSelector: aSpec dragItem.
  widget dragStartedSelector: aSpec dragStarted.
 
  widget columns: aSpec columns.
 
  "Override default scroll bar policies if needed. Widget will use preference values otherwise."
  aSpec hScrollBarPolicy ifNotNil: [:policy |
  policy caseOf: {
  [#always] -> [widget alwaysShowHScrollBar].
  [#never] -> [widget hideHScrollBarIndefinitely].
  [#whenNeeded] -> [widget showHScrollBarOnlyWhenNeeded]. } ].
  aSpec vScrollBarPolicy ifNotNil: [:policy |
  policy caseOf: {
  [#always] -> [widget alwaysShowVScrollBar].
  [#never] -> [widget hideVScrollBarIndefinitely].
  [#whenNeeded] -> [widget showVScrollBarOnlyWhenNeeded]. } ].
 
  self setFrame: aSpec frame in: widget.
  self setLayoutHintsFor: widget spec: aSpec.
 
  parent ifNotNil:[self add: widget to: parent].
  " panes ifNotNil:[
  aSpec roots ifNotNil:[panes add: aSpec roots].
  ]. "
  ^widget!

Item was added:
+ ----- Method: PluggableTreeMorph>>getSelectedPath (in category 'selection') -----
+ getSelectedPath
+
+ ^ self getSelectedPathSelector ifNotNil: [:sel | model perform: sel]!

Item was changed:
  ----- Method: PluggableTreeMorph>>getSelectedPathSelector: (in category 'accessing') -----
  getSelectedPathSelector: aSymbol
+ getSelectedPathSelector := aSymbol.
+ self update: getSelectedPathSelector.!
- getSelectedPathSelector := aSymbol.!

Item was changed:
  ----- Method: PluggableTreeMorph>>getSelectedSelector: (in category 'accessing') -----
  getSelectedSelector: aSymbol
+ getSelectionSelector := aSymbol.
+ self update: getSelectionSelector.!
- getSelectionSelector := aSymbol.!

Item was added:
+ ----- Method: PluggableTreeMorph>>selectPath: (in category 'selection') -----
+ selectPath: path
+
+ self
+ selectPath: path
+ in: (scroller submorphs at: 1 ifAbsent: [^self]).!

Item was changed:
  ----- Method: PluggableTreeMorph>>selectPath:in: (in category 'selection') -----
  selectPath: path in: listItem
+ path ifNil: [^self].
  path isEmpty ifTrue: [^self setSelectedMorph: nil].
  listItem withSiblingsDo: [:each |
  (each complexContents item = path first) ifTrue: [
  each isExpanded ifFalse: [
  each toggleExpandedState.
  self adjustSubmorphPositions.
  ].
  each changed.
  path size = 1 ifTrue: [
  ^self setSelectedMorph: each
  ].
  each firstChild ifNil: [^self setSelectedMorph: nil].
  ^self selectPath: path allButFirst in: each firstChild
  ].
  ].
  ^self setSelectedMorph: nil
 
  !

Item was changed:
  ----- Method: PluggableTreeMorph>>update: (in category 'updating') -----
  update: what
  what ifNil:[^self].
  what == getRootsSelector ifTrue:[
  self wrapRoots: (model perform: getRootsSelector).
  ^ self].
 
  what == getSelectedPathSelector ifTrue:[
+ self selectPath: self getSelectedPath.
- self
- selectPath: (model perform: getSelectedPathSelector)
- in: (scroller submorphs at: 1 ifAbsent: [^self]).
  ^ self].
 
  what == #expandRootsRequested ifTrue: [
  self expandRoots.
  ^ self].
 
  super update: what.
  !