Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The Trunk: http://source.squeak.org/trunk/ToolBuilder-Morphic-mt.333.mcz
==================== Summary ====================
Name: ToolBuilder-Morphic-mt.333 Author: mt Time: 30 January 2023, 2:33:48.497867 pm UUID: 9219e0aa-4436-2c44-8dba-a4d8a5b176e9 Ancestors: ToolBuilder-Morphic-mt.332
In tree widgets, narrow down filter column via [TAB] just like in multi-column list widgets. Also affects tree search via [CMD]+[F] (and [CMD]+[G]).
Remove the now obsolete preference #filterByLabelsOnly. You can hit [TAB] for that now.
=============== Diff against ToolBuilder-Morphic-mt.332 ===============
Item was changed: SimpleHierarchicalListMorph subclass: #PluggableTreeMorph + instanceVariableNames: 'rootWrappers selectedWrapper getRootsSelector getChildrenSelector hasChildrenSelector getLabelSelector getIconSelector getSelectedPathSelector setSelectedPathSelector setSelectedParentSelector getHelpSelector dropItemSelector wantsDropSelector dragItemSelector dragTypeSelector nodeClass lastKeystrokeTime lastKeystrokes dragStartedSelector doubleClickSelector findText findQueue filterColumnIndex' - instanceVariableNames: 'rootWrappers selectedWrapper getRootsSelector getChildrenSelector hasChildrenSelector getLabelSelector getIconSelector getSelectedPathSelector setSelectedPathSelector setSelectedParentSelector getHelpSelector dropItemSelector wantsDropSelector dragItemSelector dragTypeSelector nodeClass lastKeystrokeTime lastKeystrokes dragStartedSelector doubleClickSelector findText findQueue' classVariableNames: 'FilterByLabelsOnly MaximumSearchDepth' poolDictionaries: '' category: 'ToolBuilder-Morphic'!
!PluggableTreeMorph commentStamp: 'ar 2/12/2005 04:38' prior: 0! A pluggable tree morph.!
Item was removed: - ----- Method: PluggableTreeMorph class>>filterByLabelsOnly (in category 'preferences') ----- - filterByLabelsOnly - <preference: 'Filterable Trees by labels only' - category: 'scrolling' - description: 'When using the Filterable Lists option, set this to only match the labels, not the contents, of hierarchical lists. Otherwise, search both labels and contents will be matched.' - type: #Boolean> - ^ FilterByLabelsOnly ifNil: [ false ]!
Item was removed: - ----- Method: PluggableTreeMorph class>>filterByLabelsOnly: (in category 'preferences') ----- - filterByLabelsOnly: aBoolean - FilterByLabelsOnly := aBoolean!
Item was added: + ----- Method: PluggableTreeMorph>>drawBackgroundOn: (in category 'drawing') ----- + drawBackgroundOn: aCanvas + "Overwritten to indicate current filter column." + + | leftOffset colWidth | + filterColumnIndex ifNil: [^ self]. + columns ifNil: [^ self]. + + leftOffset := scroller left. + 1 to: filterColumnIndex - 1 do: [:col | + leftOffset := leftOffset + (self widthOfColumn: col)]. + + "For #spaceFill columns, just use the remaining space to the right for the highlight." + colWidth := (self widthOfColumn: filterColumnIndex) ifNil: [scroller right - leftOffset]. + aCanvas + fillRectangle: (leftOffset @ scroller top extent: colWidth @ scroller height) + color: IndentingListItemMorph filterBackgroundColor.!
Item was added: + ----- Method: PluggableTreeMorph>>filterColumnIndex (in category 'filtering') ----- + filterColumnIndex!
Item was changed: ----- Method: PluggableTreeMorph>>filterTreeNow (in category 'filtering') ----- filterTreeNow
| any | self hasFilter ifFalse: [^ self removeFilter]. "Show all current items again before filtering them out." scroller submorphsDo: [:m | m removeFilter]. "Filter the children of the current parent. Do not filter the parent." any := false. self selectedParentMorph ifNil: [self roots do: [:each | + (each applyFilter: lastKeystrokes column: filterColumnIndex) ifTrue: [any := true]]] - (each applyFilter: lastKeystrokes) ifTrue: [any := true]]] ifNotNil: [:pm | pm childrenDo: [:each | + (each applyFilter: lastKeystrokes column: filterColumnIndex) ifTrue: [any := true]]]. - (each applyFilter: lastKeystrokes) ifTrue: [any := true]]]. any ifFalse: [ "Remove the last character and try filtering again." lastKeystrokes := lastKeystrokes allButLast: 1. ^ self filterTreeNow].
self adjustSubmorphPositions!
Item was changed: ----- Method: PluggableTreeMorph>>findAgainNow (in category 'searching') ----- findAgainNow
| currentPath | (findQueue isNil or: [findQueue isEmpty]) ifTrue: [^ self flash]. self flag: #todo. "mt: Ask model about breadth-first or depth-first, indicate search progress in UI, allow find-again-backwards, ..." Cursor wait showWhile: [ [findQueue notEmpty] whileTrue: [ | currentItem | currentPath := findQueue removeFirst. currentItem := currentPath last. currentItem hasContents ifTrue: [ findQueue addAll: (currentItem contents collect: [:nextItem | currentPath copyWith: nextItem])]. (self matches: findText in: currentItem) ifTrue: [ "Search used model data. View might already be outdated. Collapse parent now to get up-to-date children." self selectedMorph isExpanded ifTrue: [ self toggleExpandedState: self selectedMorph]. "Match!! Stop search for now. Select the match." self selectPath: (currentPath collect: [:ea | ea item]). + self selectedMorph ifNil: [ + ^ self inform: 'Could not find path. View up to date?' translated]. "Revert a side-effect from #selectPath:." self selectedMorph isExpanded ifTrue: [ self toggleExpandedState: self selectedMorph]. "Mimic filter function to highlight (and filter) search results." lastKeystrokes := findText. self filterTree. self scrollSelectionAndExtraIntoView. ^ self]]]. self inform: 'Nothing found.' translated.!
Item was added: + ----- Method: PluggableTreeMorph>>highlightNextColumn (in category 'filtering') ----- + highlightNextColumn + + columns ifNil: [^ self]. + columns size = 1 ifTrue: [^ self]. + + filterColumnIndex + ifNil: [filterColumnIndex := 1] + ifNotNil: [:i | filterColumnIndex := filterColumnIndex \ columns size + 1]. + + self filterTree.!
Item was added: + ----- Method: PluggableTreeMorph>>highlightNoColumn (in category 'filtering') ----- + highlightNoColumn + + filterColumnIndex := nil. + self removeFilter.!
Item was changed: ----- Method: PluggableTreeMorph>>matches:in: (in category 'searching') ----- matches: pattern in: wrapper
+ ^ filterColumnIndex + ifNil: [self matchesPattern: pattern contents: wrapper asStringOrText] + ifNotNil: [self matchesPattern: pattern contents: wrapper asStringOrText column: filterColumnIndex]! - ^ ((PluggableTreeMorph filterByLabelsOnly - ifTrue: [ wrapper itemName ] - ifFalse: [ wrapper asStringOrText ]) - findString: findText - startingAt: 1 - caseSensitive: false) > 0!
Item was added: + ----- Method: PluggableTreeMorph>>matchesPattern:contents: (in category 'searching') ----- + matchesPattern: pattern contents: contents + + ^ (contents + findString: pattern + startingAt: 1 + caseSensitive: false) > 0!
Item was added: + ----- Method: PluggableTreeMorph>>matchesPattern:contents:column: (in category 'searching') ----- + matchesPattern: pattern contents: contents column: index + + | columnScanner data | + "self assert: [columns notNil]." + columnScanner := ReadStream on: contents asString. + + index - 1 timesRepeat: [columnScanner upTo: Character tab]. + data := index = columns size + ifTrue: [columnScanner upToEnd "Fix trailing tab issue"] + ifFalse: [columnScanner upTo: Character tab]. + ^ (data + findString: pattern + startingAt: 1 + caseSensitive: false) > 0!
Item was added: + ----- Method: PluggableTreeMorph>>shouldFilterColumnIndex: (in category 'filtering') ----- + shouldFilterColumnIndex: anIndex + + ^ filterColumnIndex isNil or: [filterColumnIndex = anIndex]!
Item was changed: ----- Method: PluggableTreeMorph>>specialKeyPressed: (in category 'event handling') ----- specialKeyPressed: asciiValue
(super specialKeyPressed: asciiValue) ifTrue: [^ true]. + + asciiValue = Character tab asciiValue ifTrue: [ + self highlightNextColumn. + ^ true]. + - (#(8 13) includes: asciiValue) ifTrue: [ "backspace key" + self highlightNoColumn. "i.e., remove filter" - self removeFilter. ^ true].
^ false!
packages@lists.squeakfoundation.org