[Pkg] The Trunk: Morphic-mt.788.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Mar 30 06:53:54 UTC 2015
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.788.mcz
==================== Summary ====================
Name: Morphic-mt.788
Author: mt
Time: 30 March 2015, 8:53:20.655 am
UUID: 7c0e8d59-6df5-4142-a51f-3d9afe605a7f
Ancestors: Morphic-mt.787, Morphic-dtl.787
Text morphs and pluggable text morphs behave more selection-preserving on setting new contents now. Avoids jerky scrolling behavior when updating contents while scrolling them.
=============== Diff against Morphic-mt.787 ===============
Item was changed:
----- Method: PluggableTextMorph>>setText: (in category 'model access') -----
setText: aText
- scrollBar setValue: 0.0.
textMorph
ifNil: [textMorph := self textMorphClass new
contents: aText wrappedTo: self innerBounds width-6.
textMorph setEditView: self.
scroller addMorph: textMorph]
ifNotNil: [textMorph newContents: aText].
self hasUnacceptedEdits: false.
self setScrollDeltas.!
Item was changed:
----- Method: PluggableTextMorph>>update: (in category 'updating') -----
update: aSymbol
aSymbol ifNil: [^self].
aSymbol == #flash ifTrue: [^self flash].
+ aSymbol == getTextSelector
+ ifTrue: [
+ self setText: self getText.
+ getSelectionSelector
+ ifNotNil: [self setSelection: self getSelection].
+ ^ self].
- aSymbol == getTextSelector
- ifTrue:
- [self setText: self getText.
- ^self setSelection: self getSelection].
aSymbol == getSelectionSelector
ifTrue: [^self setSelection: self getSelection].
(aSymbol == #autoSelect and: [getSelectionSelector notNil])
ifTrue:
[self handleEdit:
[(textMorph editor)
abandonChangeText; "no replacement!!"
setSearch: model autoSelectString;
againOrSame: true]].
aSymbol == #clearUserEdits ifTrue: [^self hasUnacceptedEdits: false].
aSymbol == #wantToChange
ifTrue:
[self canDiscardEdits ifFalse: [^self promptForCancel].
^self].
aSymbol == #appendEntry
ifTrue:
[self handleEdit: [self appendEntry].
^self refreshWorld].
aSymbol == #clearText
ifTrue:
[self handleEdit: [self changeText: Text new].
^self refreshWorld].
aSymbol == #bs
ifTrue:
[self handleEdit: [self bsText].
^self refreshWorld].
aSymbol == #codeChangedElsewhere
ifTrue:
[self hasEditingConflicts: true.
^self changed].
aSymbol == #saveContents
ifTrue:
[^self saveContentsInFile]!
Item was changed:
----- Method: TextMorph>>newContents: (in category 'accessing') -----
newContents: stringOrText
"Accept new text contents."
+ | newText embeddedMorphs oldSelection |
- | newText embeddedMorphs |
"If my text is all the same font, use the font for my new contents"
newText := stringOrText isString ifTrue: [ | textSize |
(text notNil
and: [ (textSize := text size) > 0
and: [ (text runLengthFor: 1) = textSize ]]) ifTrue: [ | attribs |
attribs := text attributesAt: 1 forStyle: textStyle.
Text string: stringOrText copy attributes: attribs.
]
ifFalse: [ Text fromString: stringOrText copy ]
]
ifFalse: [ stringOrText copy asText. "should be veryDeepCopy?" ].
(text = newText and: [text runs = newText runs]) ifTrue: [^ self]. "No substantive change"
text ifNotNil: [(embeddedMorphs := text embeddedMorphs)
ifNotNil:
[self removeAllMorphsIn: embeddedMorphs.
embeddedMorphs do: [:m | m delete]]].
+ oldSelection := editor ifNotNil: [:ed | ed selectionInterval].
text := newText.
"add all morphs off the visible region; they'll be moved into the right
place when they become visible. (this can make the scrollable area too
large, though)"
newText embeddedMorphs do:
[:m |
self addMorph: m.
m position: -1000 @ 0].
self releaseParagraph.
"update the paragraph cache"
self paragraph.
+ oldSelection ifNotNil: [:sel | self selectFrom: sel first to: sel last].
"re-instantiate to set bounds"
self world ifNotNil: [self world startSteppingSubmorphsOf: self]!
Item was changed:
----- Method: UserDialogBoxMorph class>>confirm:orCancel:at: (in category 'utilities') -----
confirm: aString orCancel: cancelBlock at: aPointOrNil
+ ^self
+ confirm: aString
+ orCancel: cancelBlock
+ title: 'Please confirm:'
+ at: aPointOrNil!
-
- ^(self new
- title: 'Please confirm:';
- label: aString;
- addSelectedButton: ' Yes ' translated value: true;
- addButton: ' No ' translated value: false;
- addCancelButton: ' Cancel ' translated value: nil;
- runModalIn: ActiveWorld forHand: ActiveHand at: aPointOrNil)
- ifNil: [ cancelBlock value ]!
Item was added:
+ ----- Method: UserDialogBoxMorph class>>confirm:orCancel:title:at: (in category 'utilities') -----
+ confirm: aString orCancel: cancelBlock title: titleString at: aPointOrNil
+
+ ^(self new
+ title: titleString;
+ label: aString;
+ addSelectedButton: ' Yes ' translated value: true;
+ addButton: ' No ' translated value: false;
+ addCancelButton: ' Cancel ' translated value: nil;
+ runModalIn: ActiveWorld forHand: ActiveHand at: aPointOrNil)
+ ifNil: [ cancelBlock value ]!
More information about the Packages
mailing list