The Trunk: Tools-mt.565.mcz

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

The Trunk: Tools-mt.565.mcz

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

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

Name: Tools-mt.565
Author: mt
Time: 29 March 2015, 2:44:29.709 pm
UUID: f8216267-8713-0449-bef6-35fecc620960
Ancestors: Tools-topa.564

Refactored toggle/expand code in IndentingListItemMorph.

=============== Diff against Tools-topa.564 ===============

Item was changed:
+ ----- Method: IndentingListItemMorph>>addChildrenForList:addingTo:withExpandedItems: (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>addChildrenForList:addingTo:withExpandedItems: (in category 'private-container protocol') -----
  addChildrenForList: hostList addingTo: morphList withExpandedItems: expandedItems
 
  firstChild ifNotNil: [
  firstChild withSiblingsDo: [ :aNode | aNode delete].
  ].
  firstChild := nil.
  complexContents hasContents ifFalse: [^self].
  firstChild := hostList
  addMorphsTo: morphList
  from: complexContents contents
  allowSorting: true
  withExpandedItems: expandedItems
  atLevel: indentLevel + 1.
  !

Item was changed:
+ ----- Method: IndentingListItemMorph>>canExpand (in category 'testing') -----
- ----- Method: IndentingListItemMorph>>canExpand (in category 'accessing') -----
  canExpand
 
  ^complexContents hasContents!

Item was added:
+ ----- Method: IndentingListItemMorph>>collapse (in category 'container protocol') -----
+ collapse
+
+ self isExpanded ifFalse: [^ self].
+
+ self isExpanded: false.
+
+ firstChild ifNotNil: [:collapsingNode |
+ | toDelete |
+ toDelete := OrderedCollection new.
+ collapsingNode withSiblingsDo: [:aNode | aNode recursiveAddTo: toDelete].
+ container noteRemovalOfAll: toDelete].
+
+ self changed.!

Item was changed:
+ ----- Method: IndentingListItemMorph>>complexContents (in category 'accessing') -----
- ----- Method: IndentingListItemMorph>>complexContents (in category 'private-container protocol') -----
  complexContents
 
  ^complexContents!

Item was added:
+ ----- Method: IndentingListItemMorph>>expand (in category 'container protocol') -----
+ expand
+
+   | newChildren c |
+
+ (self isExpanded or: [self canExpand not])
+ ifTrue: [^ self].
+
+ (c := self getChildren) ifEmpty: [
+ "Due to the guessing in #canExpand, it may still fail here."
+ ^ self].
+
+ self isExpanded: true.
+
+ newChildren := container
+ addSubmorphsAfter: self
+ fromCollection: c
+ allowSorting: true.
+
+ firstChild := newChildren first.!

Item was changed:
+ ----- Method: IndentingListItemMorph>>hasIcon (in category 'testing') -----
- ----- Method: IndentingListItemMorph>>hasIcon (in category 'accessing') -----
  hasIcon
  "Answer whether the receiver has an icon."
  ^ icon notNil!

Item was changed:
+ ----- Method: IndentingListItemMorph>>highlight (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>highlight (in category 'private-container protocol') -----
  highlight
 
  (self valueOfProperty: #wasRefreshed ifAbsent: [false])
  ifFalse: [self color: complexContents highlightingColor]
  ifTrue: [self color: self color negated].
 
  self changed.
 
  !

Item was changed:
+ ----- Method: IndentingListItemMorph>>isFirstItem (in category 'testing') -----
- ----- Method: IndentingListItemMorph>>isFirstItem (in category 'accessing') -----
  isFirstItem
  ^owner submorphs first == self!

Item was changed:
+ ----- Method: IndentingListItemMorph>>isSoleItem (in category 'testing') -----
- ----- Method: IndentingListItemMorph>>isSoleItem (in category 'accessing') -----
  isSoleItem
  ^self isFirstItem and: [ owner submorphs size = 1 ]!

Item was changed:
+ ----- Method: IndentingListItemMorph>>openPath: (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>openPath: (in category 'private-container protocol') -----
  openPath: anArray
  | found |
  anArray isEmpty
  ifTrue: [^ container setSelectedMorph: nil].
  found := nil.
  self
  withSiblingsDo: [:each | found
  ifNil: [(each complexContents asString = anArray first
  or: [anArray first isNil])
  ifTrue: [found := each]]].
  found
  ifNil: ["try again with no case sensitivity"
  self
  withSiblingsDo: [:each | found
  ifNil: [(each complexContents asString sameAs: anArray first)
  ifTrue: [found := each]]]].
  found
  ifNotNil: [found isExpanded
  ifFalse: [found toggleExpandedState.
  container adjustSubmorphPositions].
  found changed.
  anArray size = 1
  ifTrue: [^ container setSelectedMorph: found].
  ^ found firstChild
  ifNil: [container setSelectedMorph: nil]
  ifNotNil: [found firstChild openPath: anArray allButFirst]].
  ^ container setSelectedMorph: nil!

Item was changed:
+ ----- Method: IndentingListItemMorph>>recursiveAddTo: (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>recursiveAddTo: (in category 'private-container protocol') -----
  recursiveAddTo: aCollection
 
  firstChild ifNotNil: [
  firstChild withSiblingsDo: [ :aNode | aNode recursiveAddTo: aCollection].
  ].
  aCollection add: self
  !

Item was changed:
+ ----- Method: IndentingListItemMorph>>recursiveDelete (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>recursiveDelete (in category 'private-container protocol') -----
  recursiveDelete
 
  firstChild ifNotNil: [
  firstChild withSiblingsDo: [ :aNode | aNode recursiveDelete].
  ].
  self delete
  !

Item was changed:
+ ----- Method: IndentingListItemMorph>>toggleExpandedState (in category 'container protocol') -----
- ----- Method: IndentingListItemMorph>>toggleExpandedState (in category 'private-container protocol') -----
  toggleExpandedState
 
+ self isExpanded
+ ifTrue: [self collapse]
+ ifFalse: [self expand].!
-   | newChildren toDelete c |
-
- isExpanded := isExpanded not.
- toDelete := OrderedCollection new.
- firstChild ifNotNil: [
- firstChild withSiblingsDo: [ :aNode | aNode recursiveAddTo: toDelete].
- ].
- container noteRemovalOfAll: toDelete.
- (isExpanded and: [complexContents hasContents]) ifFalse: [
- ^self changed
- ].
- (c := self getChildren) isEmpty ifTrue: [^self changed].
- newChildren := container
- addSubmorphsAfter: self
- fromCollection: c
- allowSorting: true.
- firstChild := newChildren first.
- !


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-mt.565.mcz

Eliot Miranda-2
Hi Marcel,

    this may have broken the FileList. At least after the latest update the FileList no longer opens up the tree of directories in the left-hand pane to the current directory.

On Sun, Mar 29, 2015 at 5:44 AM, <[hidden email]> wrote:
Marcel Taeumel uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-mt.565.mcz

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

Name: Tools-mt.565
Author: mt
Time: 29 March 2015, 2:44:29.709 pm
UUID: f8216267-8713-0449-bef6-35fecc620960
Ancestors: Tools-topa.564

Refactored toggle/expand code in IndentingListItemMorph.

=============== Diff against Tools-topa.564 ===============

Item was changed:
+ ----- Method: IndentingListItemMorph>>addChildrenForList:addingTo:withExpandedItems: (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>addChildrenForList:addingTo:withExpandedItems: (in category 'private-container protocol') -----
  addChildrenForList: hostList addingTo: morphList withExpandedItems: expandedItems

        firstChild ifNotNil: [
                firstChild withSiblingsDo: [ :aNode | aNode delete].
        ].
        firstChild := nil.
        complexContents hasContents ifFalse: [^self].
        firstChild := hostList
                addMorphsTo: morphList
                from: complexContents contents
                allowSorting: true
                withExpandedItems: expandedItems
                atLevel: indentLevel + 1.
        !

Item was changed:
+ ----- Method: IndentingListItemMorph>>canExpand (in category 'testing') -----
- ----- Method: IndentingListItemMorph>>canExpand (in category 'accessing') -----
  canExpand

        ^complexContents hasContents!

Item was added:
+ ----- Method: IndentingListItemMorph>>collapse (in category 'container protocol') -----
+ collapse
+
+       self isExpanded ifFalse: [^ self].
+
+       self isExpanded: false.
+
+       firstChild ifNotNil: [:collapsingNode |
+               | toDelete |
+               toDelete := OrderedCollection new.
+               collapsingNode withSiblingsDo: [:aNode | aNode recursiveAddTo: toDelete].
+               container noteRemovalOfAll: toDelete].
+
+       self changed.!

Item was changed:
+ ----- Method: IndentingListItemMorph>>complexContents (in category 'accessing') -----
- ----- Method: IndentingListItemMorph>>complexContents (in category 'private-container protocol') -----
  complexContents

        ^complexContents!

Item was added:
+ ----- Method: IndentingListItemMorph>>expand (in category 'container protocol') -----
+ expand
+
+       | newChildren c |
+
+       (self isExpanded or: [self canExpand not])
+               ifTrue: [^ self].
+
+       (c := self getChildren) ifEmpty: [
+               "Due to the guessing in #canExpand, it may still fail here."
+               ^ self].
+
+       self isExpanded: true.
+
+       newChildren := container
+               addSubmorphsAfter: self
+               fromCollection: c
+               allowSorting: true.
+
+       firstChild := newChildren first.!

Item was changed:
+ ----- Method: IndentingListItemMorph>>hasIcon (in category 'testing') -----
- ----- Method: IndentingListItemMorph>>hasIcon (in category 'accessing') -----
  hasIcon
        "Answer whether the receiver has an icon."
        ^ icon notNil!

Item was changed:
+ ----- Method: IndentingListItemMorph>>highlight (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>highlight (in category 'private-container protocol') -----
  highlight

        (self valueOfProperty: #wasRefreshed ifAbsent: [false])
                ifFalse: [self color: complexContents highlightingColor]
                ifTrue: [self color: self color negated].

        self changed.

  !

Item was changed:
+ ----- Method: IndentingListItemMorph>>isFirstItem (in category 'testing') -----
- ----- Method: IndentingListItemMorph>>isFirstItem (in category 'accessing') -----
  isFirstItem
        ^owner submorphs first == self!

Item was changed:
+ ----- Method: IndentingListItemMorph>>isSoleItem (in category 'testing') -----
- ----- Method: IndentingListItemMorph>>isSoleItem (in category 'accessing') -----
  isSoleItem
        ^self isFirstItem and: [ owner submorphs size = 1 ]!

Item was changed:
+ ----- Method: IndentingListItemMorph>>openPath: (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>openPath: (in category 'private-container protocol') -----
  openPath: anArray
        | found |
        anArray isEmpty
                ifTrue: [^ container setSelectedMorph: nil].
        found := nil.
        self
                withSiblingsDo: [:each | found
                                ifNil: [(each complexContents asString = anArray first
                                                        or: [anArray first isNil])
                                                ifTrue: [found := each]]].
        found
                ifNil: ["try again with no case sensitivity"
                        self
                                withSiblingsDo: [:each | found
                                                ifNil: [(each complexContents asString sameAs: anArray first)
                                                                ifTrue: [found := each]]]].
        found
                ifNotNil: [found isExpanded
                                ifFalse: [found toggleExpandedState.
                                        container adjustSubmorphPositions].
                        found changed.
                        anArray size = 1
                                ifTrue: [^ container setSelectedMorph: found].
                        ^ found firstChild
                                ifNil: [container setSelectedMorph: nil]
                                ifNotNil: [found firstChild openPath: anArray allButFirst]].
        ^ container setSelectedMorph: nil!

Item was changed:
+ ----- Method: IndentingListItemMorph>>recursiveAddTo: (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>recursiveAddTo: (in category 'private-container protocol') -----
  recursiveAddTo: aCollection

        firstChild ifNotNil: [
                firstChild withSiblingsDo: [ :aNode | aNode recursiveAddTo: aCollection].
        ].
        aCollection add: self
        !

Item was changed:
+ ----- Method: IndentingListItemMorph>>recursiveDelete (in category 'container protocol - private') -----
- ----- Method: IndentingListItemMorph>>recursiveDelete (in category 'private-container protocol') -----
  recursiveDelete

        firstChild ifNotNil: [
                firstChild withSiblingsDo: [ :aNode | aNode recursiveDelete].
        ].
        self delete
        !

Item was changed:
+ ----- Method: IndentingListItemMorph>>toggleExpandedState (in category 'container protocol') -----
- ----- Method: IndentingListItemMorph>>toggleExpandedState (in category 'private-container protocol') -----
  toggleExpandedState

+       self isExpanded
+               ifTrue: [self collapse]
+               ifFalse: [self expand].!
-       | newChildren toDelete c |
-
-       isExpanded := isExpanded not.
-       toDelete := OrderedCollection new.
-       firstChild ifNotNil: [
-               firstChild withSiblingsDo: [ :aNode | aNode recursiveAddTo: toDelete].
-       ].
-       container noteRemovalOfAll: toDelete.
-       (isExpanded and: [complexContents hasContents]) ifFalse: [
-               ^self changed
-       ].
-       (c := self getChildren) isEmpty ifTrue: [^self changed].
-       newChildren := container
-               addSubmorphsAfter: self
-               fromCollection: c
-               allowSorting: true.
-       firstChild := newChildren first.
- !





--
best,
Eliot


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-mt.565.mcz

marcel.taeumel (old)
Thank you, I will take a look at it.

Best,
Marcel
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Tools-mt.565.mcz

marcel.taeumel (old)
Should be fixed in:

The Trunk: Tools-mt.569.mcz
The Trunk: ToolBuilder-Morphic-mt.109.mcz

Best,
Marcel