[Pkg] The Trunk: Tools-topa.554.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Mar 16 22:34:37 UTC 2015


Tobias Pape uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-topa.554.mcz

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

Name: Tools-topa.554
Author: topa
Time: 16 March 2015, 11:34:16.536 pm
UUID: 08589814-1c33-4bf7-afde-abf466afbbfe
Ancestors: Tools-mt.553

Finding Morphs from Tools: Unify two hacks and lose a third.

Certain tools _have to_ access the morphs representing them,
especially the one representing the code pane of them. Hacks
where in place, including duplicated code. This code is
now centralized. (pattern is: find a dependent (!) that is a
a (e.g.) PluggableTextMorph with a certain getTextSelector).

Even more, the debugger relied on the exact layout of the call
stack for its "run to here" feature. This now uses the same hack 
as above.

=============== Diff against Tools-mt.553 ===============

Item was removed:
- ----- Method: Browser>>codeTextMorph (in category 'drag and drop') -----
- codeTextMorph
- 	^ self dependents
- 		detect: [:dep | (dep isKindOf: PluggableTextMorph)
- 				and: [dep getTextSelector == #contents]]
- 		ifNone: []!

Item was changed:
  ----- Method: CodeHolder>>installTextualCodingPane (in category 'diffs') -----
  installTextualCodingPane
  	"Install text into the code pane"
  
  	| aWindow codePane aPane boundsToUse |
  	(aWindow := self containingWindow) ifNil: [self error: 'where''s that window?'].
+ 	codePane := self codeTextMorph ifNil: [self error: 'no code pane'].
- 	codePane := aWindow findDeepSubmorphThat:   
- 		[:m | ((m isKindOf: PluggableTextMorph) and: [m getTextSelector == #contents])]
- 			ifAbsent: [self error: 'no code pane'].
  	aPane := self buildMorphicCodePaneWith: nil.
  	boundsToUse := (codePane bounds origin- (1 at 1)) corner: (codePane owner bounds corner " (1 at 1").
  	aWindow replacePane: codePane with: aPane.
  	aPane vResizing: #spaceFill; hResizing: #spaceFill; borderWidth: 0.
  	aPane bounds: boundsToUse.
  	aPane owner clipSubmorphs: false.
  
  	self contentsChanged!

Item was removed:
- ----- Method: CodeHolder>>textPaneWithSelector: (in category 'categories & search pane') -----
- 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 |
- 	^ (aWindow := self containingWindow) ifNotNil:
- 		[aWindow paneMorphSatisfying:
- 			[:aMorph | (aMorph isKindOf: PluggableTextMorph) and:
- 				[aMorph getTextSelector == aSelector]]]!

Item was changed:
  ----- Method: Debugger>>codePaneMenu:shifted: (in category 'code pane menu') -----
  codePaneMenu: aMenu shifted: shifted
  	aMenu
+ 		add: 'run to here' target: self selector: #runToSelection: argument: self codePaneSelectionInterval;
- 		add: 'run to here' target: self selector: #runToSelection: argument: thisContext sender receiver selectionInterval;
  		add: 'run until...' target: self selector: #runUntil;
  		addLine.
  	super codePaneMenu: aMenu shifted: shifted.
+ 	^aMenu.
+ !
- 	^aMenu.!

Item was added:
+ ----- Method: Debugger>>codePaneSelectionInterval (in category 'code pane') -----
+ codePaneSelectionInterval
+ 
+ 	^ 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 codeTextMorph ifNil: [^ ''].
- 	m := self getTextMorphWithSelection.
  	interval := m selectionInterval.
  	text := m text.
  	^ text copyFrom: interval first to: interval last
  	!

Item was removed:
- ----- Method: Debugger>>getTextMorphWithSelection (in category 'tally support') -----
- getTextMorphWithSelection
- 	"This is extremely ugly... We I need to get a reference of the code pane, which is not easily accessible"
- 	^self dependents
- 		detect: [:m| (m isKindOf: PluggableTextMorph)
- 			and: [m selectionInterval first > 1]]
- 		ifNone: [nil]!

Item was changed:
  ----- Method: Debugger>>tally (in category 'tally support') -----
  tally
  
+ 	self codeTextMorph ifNotNil: [:o| o tallyIt] ifNil: [Beeper beep]
- 	self getTextMorphWithSelection ifNotNil: [:o| o tallyIt] ifNil: [Beeper beep]
  !

Item was changed:
  ----- Method: FileList>>availableGraphicsExtent (in category 'private') -----
  availableGraphicsExtent
+ 
+ 	^ self codeTextMorph ifNotNil: [:m | m innerBounds extent - (6 at 22)]
+ !
- 	self dependents do: [:each |
- 		((each isKindOf: PluggableTextMorph) and: [each getTextSelector == #contents]) ifTrue: [^each innerBounds extent - (6 at 22)]].
- 	^nil!

Item was changed:
  ----- Method: StringHolder>>codeTextMorph (in category '*Tools') -----
  codeTextMorph
+ 	
+ 	^ self someTextPaneWithSelector: #contents!
- 	^ self dependents
- 		detect: [:dep | (dep isKindOf: PluggableTextMorph)
- 				and: [dep getTextSelector == #contents]]
- 		ifNone: []!

Item was added:
+ ----- Method: StringHolder>>dependentTextPaneWithSelector: (in category '*Tools') -----
+ dependentTextPaneWithSelector: aSelector
+ 
+ 	^ self dependents detect:
+ 		[:aMorph | (aMorph isKindOf: PluggableTextMorph) and:
+ 			[aMorph getTextSelector == aSelector]]
+ 		ifNone: [nil]
+ !

Item was added:
+ ----- 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 added:
+ ----- 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 |
+ 	^ (aWindow := self containingWindow) ifNotNil:
+ 		[aWindow paneMorphSatisfying:
+ 			[:aMorph | (aMorph isKindOf: PluggableTextMorph) and:
+ 				[aMorph getTextSelector == aSelector]]]!



More information about the Packages mailing list