The Trunk: ST80-nice.154.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: ST80-nice.154.mcz

commits-2
Nicolas Cellier uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-nice.154.mcz

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

Name: ST80-nice.154
Author: nice
Time: 4 October 2013, 10:17:32.034 pm
UUID: 4522e1f4-5ea4-41f9-b2bf-9cc06ab5a07a
Ancestors: ST80-nice.153

Move TextLineInterval from Graphics to ST80-Support

=============== Diff against ST80-nice.153 ===============

Item was added:
+ Interval subclass: #TextLineInterval
+ instanceVariableNames: 'internalSpaces paddingWidth lineHeight baseline'
+ classVariableNames: ''
+ poolDictionaries: 'TextConstants'
+ category: 'ST80-Support'!
+
+ !TextLineInterval commentStamp: '<historical>' prior: 0!
+ My instances specify the starting and stopping points in a String of a composed line. The step is always 1.!

Item was added:
+ ----- Method: TextLineInterval class>>start:stop:internalSpaces:paddingWidth: (in category 'instance creation') -----
+ start: startInteger stop: stopInteger internalSpaces: spacesInteger paddingWidth: padWidthInteger
+ "Answer an instance of me with the arguments as the start, stop points,
+ number of spaces in the line, and width of the padding."
+ | newSelf |
+ newSelf := super from: startInteger to: stopInteger by: 1.
+ ^newSelf internalSpaces: spacesInteger paddingWidth: padWidthInteger!

Item was added:
+ ----- Method: TextLineInterval>>= (in category 'comparing') -----
+ = line
+
+ self species = line species
+ ifTrue: [^((start = line first and: [stop = line last])
+ and: [internalSpaces = line internalSpaces])
+ and: [paddingWidth = line paddingWidth]]
+ ifFalse: [^false]!

Item was added:
+ ----- Method: TextLineInterval>>baseline (in category 'accessing') -----
+ baseline
+ ^ baseline!

Item was added:
+ ----- Method: TextLineInterval>>internalSpaces (in category 'accessing') -----
+ internalSpaces
+ "Answer the number of spaces in the line."
+
+ ^internalSpaces!

Item was added:
+ ----- Method: TextLineInterval>>internalSpaces: (in category 'accessing') -----
+ internalSpaces: spacesInteger
+ "Set the number of spaces in the line to be spacesInteger."
+
+ internalSpaces := spacesInteger!

Item was added:
+ ----- Method: TextLineInterval>>internalSpaces:paddingWidth: (in category 'private') -----
+ internalSpaces: spacesInteger paddingWidth: padWidthInteger
+
+ internalSpaces := spacesInteger.
+ paddingWidth := padWidthInteger!

Item was added:
+ ----- Method: TextLineInterval>>justifiedPadFor: (in category 'scanning') -----
+ justifiedPadFor: spaceIndex
+ "Compute the width of pad for a given space in a line of justified text."
+
+ | pad |
+ internalSpaces = 0 ifTrue: [^0].
+ pad := paddingWidth // internalSpaces.
+ spaceIndex <= (paddingWidth \\ internalSpaces)
+ ifTrue: [^pad + 1]
+ ifFalse: [^pad]!

Item was added:
+ ----- Method: TextLineInterval>>justifiedPadFor:font: (in category 'scanning') -----
+ justifiedPadFor: spaceIndex font: aFont
+ "Compute the width of pad for a given space in a line of justified text."
+
+ | pad |
+ internalSpaces = 0 ifTrue: [^0].
+ ^(aFont notNil and:[aFont isSubPixelPositioned])
+ ifTrue:[paddingWidth * 1.0 / internalSpaces]
+ ifFalse:[
+ pad := paddingWidth // internalSpaces.
+ spaceIndex <= (paddingWidth \\ internalSpaces)
+ ifTrue: [pad + 1]
+ ifFalse: [pad]]!

Item was added:
+ ----- Method: TextLineInterval>>justifiedTabDeltaFor: (in category 'scanning') -----
+ justifiedTabDeltaFor: spaceIndex
+ "Compute the delta for a tab in a line of justified text, so tab falls
+ somewhere plausible when line is justified."
+
+ | pad extraPad |
+ internalSpaces = 0 ifTrue: [^0].
+ pad := paddingWidth // internalSpaces.
+ extraPad := paddingWidth \\ internalSpaces.
+ spaceIndex <= extraPad
+ ifTrue: [^spaceIndex * (pad + 1)]
+ ifFalse: [^extraPad * (pad + 1) + (spaceIndex - extraPad * pad)]!

Item was added:
+ ----- Method: TextLineInterval>>lineHeight (in category 'accessing') -----
+ lineHeight
+ ^ lineHeight!

Item was added:
+ ----- Method: TextLineInterval>>lineHeight:baseline: (in category 'private') -----
+ lineHeight: height baseline: ascent
+
+ lineHeight := height.
+ baseline := ascent!

Item was added:
+ ----- Method: TextLineInterval>>paddingWidth (in category 'accessing') -----
+ paddingWidth
+ "Answer the amount of space to be added to the font."
+
+ ^paddingWidth!

Item was added:
+ ----- Method: TextLineInterval>>paddingWidth: (in category 'accessing') -----
+ paddingWidth: padWidthInteger
+ "Set the amount of space to be added to the font to be padWidthInteger."
+
+ paddingWidth := padWidthInteger!

Item was added:
+ ----- Method: TextLineInterval>>slide: (in category 'updating') -----
+ slide: delta
+ "Change the starting and stopping points of the line by delta."
+
+ start := start + delta.
+ stop := stop + delta!

Item was added:
+ ----- Method: TextLineInterval>>stop: (in category 'accessing') -----
+ stop: stopInteger
+ "Set the stopping point in the string of the line to be stopInteger."
+
+ stop := stopInteger!