[squeak-dev] The Trunk: Tools-ct.1150.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu May 5 17:10:17 UTC 2022
Christoph Thiede uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-ct.1150.mcz
==================== Summary ====================
Name: Tools-ct.1150
Author: ct
Time: 5 May 2022, 7:10:03.409219 pm
UUID: 034e4f47-2ad0-d348-9c5d-734fc2e00f3c
Ancestors: Tools-ct.1149
Merges toolCodePane.3.cs:
Improves MVC compatibility for view accesses from model.
* Moves up #someTextPaneWithSelector: & friends from StringHolder to Model and improves documentation on the antiidiomatic pattern they represent.
* Renames #someTextPaneWithSelector: into #anyTextPaneWithSelector: and deprecates the former. (.3)
* Renames #searchPane into #searchTextMorph and #textPaneWithSelector: into #textMorphWithSelector:. (.3)
* Fixes 'run to selection' & 'tally it' button in MVC debugger.
* Improves MVC compatibility in Monticello save version dialog (still, showModally does not yet work, though.)"
See: http://lists.squeakfoundation.org/pipermail/squeak-dev/2022-April/219875.html
=============== Diff against Tools-ct.1149 ===============
Item was removed:
- ----- Method: CodeHolder>>searchPane (in category 'categories & search pane') -----
- searchPane
- "Answer the search pane associated with the receiver in its window, or nil if none. Morphic only"
-
- ^ self textPaneWithSelector: #lastSearchString!
Item was added:
+ ----- Method: CodeHolder>>searchTextMorph (in category 'categories & search pane') -----
+ searchTextMorph
+ "Answer the search pane associated with the receiver in its window, or nil if none. Morphic only"
+
+ | pane |
+ pane := self anyTextPaneWithSelector: #lastSearchString.
+ ^ pane isMorph ifTrue: [pane]!
Item was changed:
----- Method: Debugger>>codePaneSelectionInterval (in category 'code pane') -----
codePaneSelectionInterval
+ ^ self codeTextPane
- ^ self codeTextMorph
ifNotNil: [:cp | cp selectionInterval]
ifNil: [Interval from: 0 to: 0]!
Item was changed:
----- Method: Debugger>>getSelectedText (in category 'tally support') -----
getSelectedText
| m interval text |
+ m := self codeTextPane ifNil: [^ ''].
- m := self codeTextMorph ifNil: [^ ''].
interval := m selectionInterval.
text := m text.
^ text copyFrom: interval first to: interval last
!
Item was changed:
----- Method: Debugger>>tally (in category 'tally support') -----
tally
+ self codeTextPane ifNotNil: [:o | o tallyIt] ifNil: [Beeper beep]
- self codeTextMorph ifNotNil: [:o| o tallyIt] ifNil: [Beeper beep]
!
Item was added:
+ ----- Method: Model>>anyTextPaneWithSelector: (in category '*Tools') -----
+ anyTextPaneWithSelector: aSelector
+ "Try to find the text pane for aSelector in my dependents or my window. Note that this is a hack only and violates the original idea of the model-view pattern. Usually, the communication should come from the view instead, e.g., via a pluggable selector."
+
+ ^ (self dependentTextPaneWithSelector: aSelector)
+ ifNil: [self textMorphWithSelector: aSelector]!
Item was added:
+ ----- Method: Model>>dependentTextPaneWithSelector: (in category '*Tools-private') -----
+ dependentTextPaneWithSelector: selector
+
+ ^ self dependents
+ detect: [:dependent | dependent isTextView and:
+ [dependent getTextSelector == selector]]
+ ifNone: [nil]!
Item was added:
+ ----- Method: Model>>textMorphWithSelector: (in category '*Tools-private') -----
+ textMorphWithSelector: aSelector
+ "If, among my window's paneMorphs, there is a text pane defined with aSelector as its retriever, answer it, else answer nil. Morphic only."
+
+ | aWindow |
+ Smalltalk isMorphic ifFalse: [^ nil].
+ ^ (aWindow := self containingWindow) ifNotNil:
+ [aWindow paneMorphSatisfying:
+ [:aMorph | (aMorph isKindOf: PluggableTextMorph) and:
+ [aMorph getTextSelector == aSelector]]]!
Item was changed:
----- Method: StringHolder>>codeTextMorph (in category '*Tools') -----
codeTextMorph
+ "Find a Morphic text pane that displays the contents of the receiver. Note that this is a hack only and violates the original idea of the model-view pattern. Using this selector in your model will likely break compatibility with other UI frameworks such as MVC. Usually, the communication should come from the view instead, e.g., via a pluggable selector."
+
+ | textPane |
+ textPane := self codeTextPane.
+ ^ textPane isMorph ifTrue: [textPane]!
-
- ^ self someTextPaneWithSelector: #contents!
Item was added:
+ ----- Method: StringHolder>>codeTextPane (in category '*Tools') -----
+ codeTextPane
+ "Find a text pane that displays the contents of the receiver. Note that this is a hack only and violates the original idea of the model-view pattern. Usually, the communication should come from the view instead, e.g., via a pluggable selector."
+
+ ^ self anyTextPaneWithSelector: #contents!
Item was removed:
- ----- Method: StringHolder>>dependentTextPaneWithSelector: (in category '*Tools') -----
- dependentTextPaneWithSelector: aSelector
-
- ^ self dependents detect:
- [:aMorph | (aMorph isKindOf: PluggableTextMorph) and:
- [aMorph getTextSelector == aSelector]]
- ifNone: [nil]
- !
Item was removed:
- ----- Method: StringHolder>>someTextPaneWithSelector: (in category '*Tools') -----
- someTextPaneWithSelector: aSelector
- " Try to find the text pane for aSelector in my dependents or my window. Not beautiful tho"
- ^ (self dependentTextPaneWithSelector: aSelector)
- ifNil: [self textPaneWithSelector: aSelector]!
Item was removed:
- ----- Method: StringHolder>>textPaneWithSelector: (in category '*Tools') -----
- textPaneWithSelector: aSelector
- "If, among my window's paneMorphs, there is a text pane defined with aSelector as its retriever, answer it, else answer nil"
-
- | aWindow |
- Smalltalk isMorphic ifFalse: [^ nil].
- ^ (aWindow := self containingWindow) ifNotNil:
- [aWindow paneMorphSatisfying:
- [:aMorph | (aMorph isKindOf: PluggableTextMorph) and:
- [aMorph getTextSelector == aSelector]]]!
More information about the Squeak-dev
mailing list
|