Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.272.mcz ==================== Summary ==================== Name: Graphics-nice.272 Author: nice Time: 19 October 2013, 4:45:57.136 pm UUID: 7f684de6-d8f6-4506-a9e7-3e46a574e5f8 Ancestors: Graphics-nice.271 Align embedded objetcs bottom on baseline rather than top on line top. Rename displayAnchoredMorph:->displayEmbeddedForm: because it is used for the case when embedded object is not a Morph. Don't let plainTab increment destX, let this responsibility to its senders. Use plainTab in CharacterBlockScanner>>tab in order to factor mode code. =============== Diff against Graphics-nice.271 =============== Item was removed: - ----- Method: BitBltDisplayScanner>>displayAnchoredMorph: (in category 'displaying') ----- - displayAnchoredMorph: aMorph - aMorph - displayOn: bitBlt destForm - at: destX @ destY - clippingBox: bitBlt clipRect! Item was added: + ----- Method: BitBltDisplayScanner>>displayEmbeddedForm: (in category 'displaying') ----- + displayEmbeddedForm: aForm + aForm + displayOn: bitBlt destForm + at: destX @ (lineY + line baseline - aForm height) + clippingBox: bitBlt clipRect! Item was changed: ----- Method: BitBltDisplayScanner>>plainTab (in category 'stop conditions') ----- plainTab + | nextDestX | + nextDestX := super plainTab. - | oldX | - oldX := destX. - super plainTab. fillBlt == nil ifFalse: + [fillBlt destX: destX destY: destY width: nextDestX - destX height: font height; copyBits]. + ^nextDestX! - [fillBlt destX: oldX destY: destY width: destX - oldX height: font height; copyBits]! Item was changed: ----- Method: CharacterBlockScanner>>tab (in category 'stop conditions') ----- tab + | nextDestX | + nextDestX := self plainTab. + lastCharacterWidth := nextDestX - destX max: 0. + nextDestX >= characterPoint x - | currentX | - currentX := (alignment = Justified and: [self leadingTab not]) - ifTrue: "imbedded tabs in justified text are weird" - [destX + (textStyle tabWidth - (line justifiedTabDeltaFor: spaceCount)) max: destX] - ifFalse: - [textStyle - nextTabXFrom: destX - leftMargin: leftMargin - rightMargin: rightMargin]. - lastCharacterWidth := currentX - destX max: 0. - currentX >= characterPoint x ifTrue: [^ self crossedX]. + destX := nextDestX. - destX := currentX. lastIndex := lastIndex + 1. ^false! Item was changed: ----- Method: CharacterScanner>>handleIndentation (in category 'private') ----- handleIndentation self indentationLevel timesRepeat: [ + destX := self plainTab]! - self plainTab]! Item was changed: ----- Method: CharacterScanner>>plainTab (in category 'private') ----- plainTab + "This is the basic method of adjusting destX for a tab. + Answer the next destX" + pendingKernX := 0. + ^(alignment = Justified and: [self leadingTab not]) - "This is the basic method of adjusting destX for a tab." - destX := (alignment = Justified and: [self leadingTab not]) ifTrue: "embedded tabs in justified text are weird" [destX + (textStyle tabWidth - (line justifiedTabDeltaFor: spaceCount)) max: destX] ifFalse: [textStyle nextTabXFrom: destX leftMargin: leftMargin + rightMargin: rightMargin].! - rightMargin: rightMargin]. - pendingKernX := 0.! Item was removed: - ----- Method: DisplayScanner>>displayAnchoredMorph: (in category 'displaying') ----- - displayAnchoredMorph: aMorph - self subclassResponsibility! Item was added: + ----- Method: DisplayScanner>>displayEmbeddedForm: (in category 'displaying') ----- + displayEmbeddedForm: aForm + self subclassResponsibility! Item was changed: ----- Method: DisplayScanner>>placeEmbeddedObject: (in category 'private') ----- + placeEmbeddedObject: anchoredMorphOrForm + anchoredMorphOrForm relativeTextAnchorPosition ifNotNil:[:relativeTextAnchorPosition | + anchoredMorphOrForm position: + relativeTextAnchorPosition + + (anchoredMorphOrForm owner textBounds origin x @ (lineY - morphicOffset y)). - placeEmbeddedObject: anchoredMorph - anchoredMorph relativeTextAnchorPosition ifNotNil:[ - anchoredMorph position: - anchoredMorph relativeTextAnchorPosition + - (anchoredMorph owner textBounds origin x @ 0) - - (0@morphicOffset y) + (0@lineY). ^true ]. + (anchoredMorphOrForm isMorph or: [anchoredMorphOrForm isPrimitiveCostume]) ifTrue: [ + anchoredMorphOrForm position: (destX@(lineY + line baseline - anchoredMorphOrForm height)) - morphicOffset - anchoredMorph relativeTextAnchorPosition ifNotNil:[^true]. - (anchoredMorph isMorph or: [anchoredMorph isPrimitiveCostume]) ifTrue: [ - anchoredMorph position: (destX@lineY) - morphicOffset ] ifFalse: [ + self displayEmbeddedForm: anchoredMorphOrForm - destY := lineY. - self displayAnchoredMorph: anchoredMorph. ]. + destX := destX + anchoredMorphOrForm width + kern. - destX := destX + anchoredMorph width + kern. ^ true! Item was changed: ----- Method: DisplayScanner>>tab (in category 'stop conditions') ----- tab lastDisplayableIndex := lastIndex - 1. + destX := self plainTab. - self plainTab. lastIndex := lastIndex + 1. ^ false! |
Free forum by Nabble | Edit this page |