Patrick Rein uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-pre.1193.mcz ==================== Summary ==================== Name: Morphic-pre.1193 Author: pre Time: 21 July 2016, 8:01:01.282686 am UUID: a5a927f6-7084-0a4d-be19-dc32eeeb31e8 Ancestors: Morphic-pre.1192 Fixing the comment of TextMorph>>#newContents: and while being on it improving code readability of some methods. =============== Diff against Morphic-pre.1192 =============== Item was changed: ----- Method: TextMorph>>fixUponLoad:seg: (in category 'objects from disk') ----- fixUponLoad: aProject seg: anImageSegment + "We are in an old project that is being loaded from disk. Fix up conventions that have changed." - "We are in an old project that is being loaded from disk. - Fix up conventions that have changed." | substituteFont | + substituteFont := aProject projectParameters at: #substitutedFont ifAbsent: [#none]. + (substituteFont ~~ #none and: [self textStyle fontArray includes: substituteFont]) - substituteFont := aProject projectParameters at: - #substitutedFont ifAbsent: [#none]. - (substituteFont ~~ #none and: [self textStyle fontArray - includes: substituteFont]) ifTrue: [ self fit ]. ^ super fixUponLoad: aProject seg: anImageSegment! Item was changed: ----- Method: TextMorph>>getAllButFirstCharacter (in category 'scripting access') ----- getAllButFirstCharacter "Obtain all but the first character from the receiver; if that would be empty, return a black dot" | aString | + ^ (aString := text string) size > 1 + ifTrue: [aString copyFrom: 2 to: aString size] + ifFalse: ['·']! - ^ (aString := text string) size > 1 ifTrue: [aString copyFrom: 2 to: aString size] ifFalse: ['·']! Item was changed: ----- Method: TextMorph>>getLastCharacter (in category 'accessing') ----- getLastCharacter "obtain the last character from the receiver if it is empty, return a black dot" | aString | + ^ (aString := text string) size > 0 + ifTrue: [aString last asString] + ifFalse: ['·']! - ^ (aString := text string) size > 0 ifTrue: [aString last asString] ifFalse: ['·']! Item was changed: ----- Method: TextMorph>>getMenu: (in category 'event handling') ----- getMenu: shiftKeyState + ^ (shiftKeyState not or: [Preferences noviceMode]) - ^ (shiftKeyState not - or: [Preferences noviceMode]) ifTrue: [TextEditor yellowButtonMenu] ifFalse: [TextEditor shiftedYellowButtonMenu]! Item was changed: ----- Method: TextMorph>>hasTranslucentColor (in category 'accessing') ----- hasTranslucentColor "Overridden from BorderedMorph to test backgroundColor instead of (text) color." + ^ backgroundColor isNil + or: [backgroundColor isColor and: [backgroundColor isTranslucentColor]] + or: [borderColor isColor and: [borderColor isTranslucentColor]]! - backgroundColor ifNil: [^ true]. - (backgroundColor isColor and: [backgroundColor isTranslucentColor]) ifTrue: [^ true]. - (borderColor isColor and: [borderColor isTranslucentColor]) ifTrue: [^ true]. - ^ false - ! Item was changed: ----- Method: TextMorph>>newContents: (in category 'accessing') ----- newContents: stringOrText "Accept new text contents." | newText embeddedMorphs oldSelection | - "If my text is all the same font, use the font for my new contents" newText := stringOrText isString ifTrue: [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: TextMorph>>predecessorChanged (in category 'private') ----- predecessorChanged | newStart oldStart | (self hasProperty: #CreatingParagraph) ifTrue: [^self]. newStart := predecessor isNil ifTrue: [1] ifFalse: [predecessor lastCharacterIndex + 1]. (self paragraph adjustedFirstCharacterIndex ~= newStart or: [newStart >= text size]) ifTrue: [paragraph composeAllStartingAt: newStart. self fit] ifFalse: ["If the offset to end of text has not changed, just slide" - oldStart := self firstCharacterIndex. self withSuccessorsDo: [:m | m adjustLineIndicesBy: newStart - oldStart]]! Item was changed: ----- Method: TextMorph>>recognizerArena (in category 'containment') ----- recognizerArena "Answer the rectangular area, in world coordinates, that the character recognizer should regard as its tablet" | outer | ^ (outer := self ownerThatIsA: PluggableTextMorph) + ifNotNil: [outer boundsInWorld] + ifNil: [self boundsInWorld]! - ifNotNil: - [outer boundsInWorld] - ifNil: - [self boundsInWorld]! Item was changed: ----- Method: TextMorph>>resetBlinkCursor (in category 'blinking') ----- resetBlinkCursor "Reset the blinking cursor" | para | self blinkStart: Time millisecondClockValue + 500. para := paragraph ifNil: [^self]. para showCaret = para focused ifFalse:[ para caretRect ifNotNil: [ :r | self invalidRect: r]. + para showCaret: para focused.]. - para showCaret: para focused. - ]. ! |
Free forum by Nabble | Edit this page |