Andreas Raab uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-ar.34.mcz==================== Summary ====================
Name: ToolBuilder-Morphic-ar.34
Author: ar
Time: 21 August 2009, 10:05:16 am
UUID: 1f9288c1-a14e-6b48-b37c-f5db1143cfd3
Ancestors: ToolBuilder-Morphic-ar.33
Small tweak to Morphic Toolbuilder's code pane construction. The styler should be set before the text to avoid retrieving, setting, and formatting it multiple times.
=============== Diff against ToolBuilder-Morphic-ar.33 ===============
Item was changed:
----- Method: MorphicToolBuilder>>buildPluggableCodePane: (in category 'pluggable widgets') -----
buildPluggableCodePane: aSpec
+ "Install the default styler for code panes.
+ Implementation note: We should just be doing something like, e.g.,
+ ^(self buildPluggableText: aSpec) useDefaultStyler
+ Unfortunately, this will retrieve and layout the initial text twice which
+ can make for a noticable performance difference when looking at some
+ larger piece of code. So instead we copy the implementation from
+ buildPlugggableText: here and insert #useDefaultStyler at the right point"
+ | widget |
+ widget := PluggableTextMorphPlus new.
+ widget useDefaultStyler.
+ widget on: aSpec model
+ text: aSpec getText
+ accept: aSpec setText
+ readSelection: aSpec selection
+ menu: aSpec menu.
+ widget font: Preferences standardCodeFont.
+ self register: widget id: aSpec name.
+ widget getColorSelector: aSpec color.
+ self setFrame: aSpec frame in: widget.
+ parent ifNotNil:[self add: widget to: parent].
+ widget borderColor: Color lightGray.
+ ^widget!
- "Install the default styler for code panes"
- | ptmp |
- ptmp := self buildPluggableText: aSpec.
- ptmp useDefaultStyler.
- ^ptmp!
Item was changed:
----- Method: PluggableTextMorphPlus>>setText: (in category 'styling') -----
setText: aText
self okToStyle ifFalse:[^super setText: aText].
super setText: (styler format: aText asText).
aText size < 4096
+ ifTrue:[styler style: textMorph contents]
- ifTrue:[ styler style: textMorph contents]
ifFalse:[styler styleInBackgroundProcess: textMorph contents]!