[Pkg] The Trunk: Graphics-nice.254.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Oct 6 21:43:43 UTC 2013


Nicolas Cellier uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-nice.254.mcz

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

Name: Graphics-nice.254
Author: nice
Time: 6 October 2013, 11:42:25.53 pm
UUID: 50c35c24-a1dd-4a24-af58-722e212b41ac
Ancestors: Graphics-nice.253

TextPrinter is designed for MVC, give it back to ST80.
Attempt to comment the CharacterScanner hierarchy in more details.
Move wantsColumnBreaks: where it belongs to: CompositionScanner.
** Note that I did not dare moving the instance variable, I'm a bit coward wrt MC experimentations.

=============== Diff against Graphics-nice.253 ===============

Item was changed:
  CharacterScanner subclass: #CharacterBlockScanner
  	instanceVariableNames: 'characterPoint characterIndex nextLeftMargin specialWidth lastCharacterWidth'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Graphics-Text'!
  
+ !CharacterBlockScanner commentStamp: 'nice 10/6/2013 22:04' prior: 0!
+ A CharacterScanner does scan text to compute the CharacterBlock for a character specified by its index in the text or its proximity to the cursor location. The CharacterBlock stores information both about character layout and character index in the text.
+ 
+ This class is essential for selecting text with the mouse or with arrow keys.
+ 
+ Instance Variables
+ 	characterIndex:		<Integer | nil>
+ 	characterPoint:		<Point>
+ 	lastCharacterWidth:		<Number | nil>
+ 	nextLeftMargin:		<Number>
+ 	specialWidth:		<Number | nil>
+ 
+ characterIndex
+ 	- the index of character for which the layout information is searched, or nil when the layout is searched by cursor location
+ 
+ characterPoint
+ 	- the cursor location for which nearest character index and layout are searched.
+ 
+ lastCharacterWidth
+ 	- a number indicating the width of last character being processed.
+ 	Note that this variable is left to nil during the inner scan loop, and only set on stopConditions.
+ 
+ nextLeftMargin
+ 	- a number specifying the distance between left of composition zone and left of first character for the next line.
+ 
+ specialWidth
+ 	- a number holding the width of an embedded object if any, or nil if none.
+ !
- !CharacterBlockScanner commentStamp: '<historical>' prior: 0!
- My instances are used to scan text to compute the CharacterBlock for a character specified by its index in the text or its proximity to the cursor location.!

Item was changed:
  Object subclass: #CharacterScanner
  	instanceVariableNames: 'destX lastIndex destY stopConditions text textStyle alignment leftMargin rightMargin font line runStopIndex spaceCount spaceWidth emphasisCode kern indentationLevel wantsColumnBreaks pendingKernX'
  	classVariableNames: 'ColumnBreakStopConditions CompositionStopConditions DefaultStopConditions MeasuringStopConditions PaddedSpaceCondition'
  	poolDictionaries: 'TextConstants'
  	category: 'Graphics-Text'!
  
+ !CharacterScanner commentStamp: 'nice 10/6/2013 23:18' prior: 0!
+ A CharacterScanner holds the state associated with scanning text. Subclasses scan characters for specified purposes, such as computing a CharacterBlock or placing characters into Forms.
+ 
+ Instance Variables
+ 	alignment:		<Integer>
+ 	destX:		<Number>
+ 	destY:		<Number>
+ 	emphasisCode:		<Object>
+ 	font:		<AbstractFont>
+ 	indentationLevel:		<Integer>
+ 	kern:		<Number>
+ 	lastIndex:		<Integer>
+ 	leftMargin:		<Number>
+ 	line:		<TextLine>
+ 	pendingKernX:		<Number>
+ 	rightMargin:		<Number>
+ 	runStopIndex:		<Integer>
+ 	spaceCount:		<Integer>
+ 	spaceWidth:		<Number>
+ 	stopConditions:		<TextStopConditions>
+ 	text:		<Text>
+ 	textStyle:		<TextStyle>
+ 	wantsColumnBreaks:		<Boolean>
+ 
+ alignment
+ 	- an Integer encoding the alignment of text
+ 
+ destX
+ 	- horizontal position for next character (distance from left of composition area)
+ 
+ destY
+ 	- vertical position for next character (distance from top of composition area)
+ 
+ emphasisCode
+ 	- an Integer encoding the current text emphasis to use (bold, italic, ...)
+ 
+ font
+ 	- the current font used for measuring/composing/displaying characters
+ 
+ indentationLevel
+ 	- an Integer specifying a number of leading tabs to be inserted at beginning of new lines
+ 
+ kern
+ 	- a Number specifying additional horizontal spacing to place between characters (spacing is reduced when kern is negative)
+ 
+ lastIndex
+ 	- the Integer index of next character to be processed in the text
+ 
+ leftMargin
+ 	- a Number specifying the distance between left of composition zone and left of first character in the line.
+ 
+ line
+ 	- an object holding information about the line currently being displayed (like first and last index in text).
+ 	Note: this is either a TextLine in Morphic, or TextLineInterval for ST80 compatibility
+ 
+ pendingKernX
+ 	- a Number to be added to horizontal spacing of next char if ever it is in the same font than previous one.
+ 	The inner scan loop is interrupted by a change of text run.
+ 	But some changes won't change the font, so the kerning must be remembered and applied later.
+ 
+ rightMargin
+ 	- a Number specifying the distance between right of composition zone and right of last character in the line.
+ 
+ runStopIndex
+ 	- the Integer index of last character in current text run.
+ 
+ spaceCount
+ 	- the number of spaces encoutered so far in current line. This is useful for adjusting the spacing in cas of Justified alignment.
+ 
+ spaceWidth
+ 	- the width of space character in current font.
+ 
+ stopConditions
+ 	- an object holding a table of characters for which special actions are to be taken.
+ 	These are typically control characters like carriage return or horizontal tab.
+ 
+ text
+ 	- the text to be measured/composed/displayed
+ 
+ textStyle
+ 	- an object holding a context for the text style (which set of font to use, which margins, etc...)
+ 
+ wantsColumnBreaks
+ 	- a Boolean indicating whether some special handling for multiple columns is requested.
+ 	THIS ONLY MAKES SENSE IN CompositionScanner AND SHOULD BE MOVED TO THE SUBCLASS
+ 	
+ 
+ !
- !CharacterScanner commentStamp: '<historical>' prior: 0!
- My instances hold the state associated with scanning text. My subclasses scan characters for specified purposes, such as computing a CharacterBlock or placing characters into Forms.!

Item was removed:
- ----- Method: CharacterScanner>>wantsColumnBreaks: (in category 'initialize') -----
- wantsColumnBreaks: aBoolean
- 
- 	wantsColumnBreaks := aBoolean!

Item was changed:
  CharacterScanner subclass: #CompositionScanner
  	instanceVariableNames: 'spaceX spaceIndex lineHeight baseline lineHeightAtSpace baselineAtSpace lastBreakIsNotASpace nextIndexAfterLineBreak'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Graphics-Text'!
  
+ !CompositionScanner commentStamp: 'nice 10/6/2013 23:24' prior: 0!
+ A CompositionScanner measures text and determines where line breaks.
+ Given a rectangular zone on input, it is used to split text in horizontal lines, and produce information about those lines on output (at which index a line starts/stops, which vertical space does the line require, which horizontal space if left for adjusting inter-word spacing, etc...)
+ 
+ Instance Variables
+ 	baseline:		<Number>
+ 	baselineAtSpace:		<Number>
+ 	lastBreakIsNotASpace:		<Boolean>
+ 	lineHeight:		<Number>
+ 	lineHeightAtSpace:		<Number>
+ 	nextIndexAfterLineBreak:		<Integer>
+ 	spaceIndex:		<Integer>
+ 	spaceX:		<Number>
+ 
+ baseline
+ 	- the distance between top of line and the base line (that is the bottom of latin characters abcdehiklmnorstuvwx in most fonts)
+ 
+ baselineAtSpace
+ 	- memorize the baseline at last encountered space or other breakable character.
+ 	This is necessary because the CompositionScanner wants to break line at a breakable character.
+ 	If a word layout overflows the right margin, the scanner has to roll back and restore the line state to last encountered breakable character.
+ 
+ lastBreakIsNotASpace
+ 	- indicates that the last breakable character was not a space.
+ 	This is necessary because handling a line break at a space differs from non space.
+ 	If line break occurs on space, the space won't be displayed in next line.
+ 	If it's another breakable character, it has to be displayed on next line.
+ 
+ lineHeight
+ 	- the total line height from top to bottom, including inter-line spacing.
+ 
+ lineHeightAtSpace
+ 	- the line height at last encountered space or other breakable character.
+ 	See baselineAtSpace for explanation.
+ 
+ nextIndexAfterLineBreak
+ 	- the index of character after the last line break that was encountered.
+ 
+ spaceIndex
+ 	- the index of last space or other breakable character that was encountered
+ 
+ spaceX
+ 	- the distance from left of composition zone to left of last encountered space or other breakable character 
+ 	See baselineAtSpace for explanation.
+ 
+ Note: if a line breaks on a space, a linefeed or a carriage return, then the space, linefeed or carriage return is integrated in the line.
+ If there is a carriage return - linefeed pair, the pair is integrated to the line as if it were a single line break for compatibility with legacy software.!
- !CompositionScanner commentStamp: '<historical>' prior: 0!
- CompositionScanners are used to measure text and determine where line breaks and space padding should occur.!

Item was added:
+ ----- Method: CompositionScanner>>initialize (in category 'initialize') -----
+ initialize
+ 	wantsColumnBreaks := false.
+ 	super initialize!

Item was changed:
  ----- Method: CompositionScanner>>space (in category 'stop conditions') -----
  space
  	"Record left x and character index of the space character just encountered. 
  	Used for wrap-around. Answer whether the character has crossed the 
  	right edge of the composition rectangle of the paragraph."
  
- 	pendingKernX := 0.
  	spaceX := destX.
  	spaceIndex := lastIndex.
  	lineHeightAtSpace := lineHeight.
  	baselineAtSpace := baseline.
  	spaceCount := spaceCount + 1.
  	lastBreakIsNotASpace := false.
  	destX + spaceWidth > rightMargin ifTrue:[^self crossedX].
  	destX := spaceX + spaceWidth + kern.
  	lastIndex := lastIndex + 1.
  	^false
  !

Item was added:
+ ----- Method: CompositionScanner>>wantsColumnBreaks: (in category 'initialize') -----
+ wantsColumnBreaks: aBoolean
+ 
+ 	wantsColumnBreaks := aBoolean!

Item was changed:
  CharacterScanner subclass: #DisplayScanner
  	instanceVariableNames: 'bitBlt lineY foregroundColor backgroundColor fillBlt lineHeight paragraphColor morphicOffset ignoreColorChanges'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'Graphics-Text'!
  
+ !DisplayScanner commentStamp: 'nice 10/6/2013 23:26' prior: 0!
+ A DisplayScanner displays characters on Screen or other Form with help of a BitBlt.
+ 
+ Instance Variables
+ 	backgroundColor:		<Color>
+ 	bitBlt:		<BitBlt>
+ 	fillBlt:		<BitBlt>
+ 	foregroundColor:		<Color>
+ 	ignoreColorChanges:		<Boolean>
+ 	lineHeight:		<Number>
+ 	lineY:		<Number>
+ 	morphicOffset:		<Point>
+ 	paragraphColor:		<Color>
+ 
+ backgroundColor
+ 	- the background color for displaying text.
+ 	Note that this can be set to Color transparent, in which case no background is displayed.
+ 
+ bitBlt
+ 	- the object which knows how to copy bits from one Form (the font glyph data) to another (the destination Form)
+ 
+ fillBlt
+ 	- another object for copying form bits, initialized for displaying the background.
+ 
+ foregroundColor
+ 	- the foreground color for displaying text
+ 
+ ignoreColorChanges
+ 	- indicates that any change of color specified in text attributes shall be ignored.
+ 	This is used for displaying text in a shadow mode, when dragging text for example.
+ 
+ lineHeight
+ 	- the total line height from top to bottom, including inter-line spacing
+ 
+ lineY
+ 	- the distance between destination form top and current line top
+ 
+ morphicOffset
+ 	- an offset for positionning the embedded morphs.
+ 	THE EXACT SPECIFICATION YET REMAINS TO BE WRITTEN
+ 
+ paragraphColor
+ 	- the default foreground color for displaying text in absence of other text attributes specification 
+ !
- !DisplayScanner commentStamp: '<historical>' prior: 0!
- My instances are used to scan text and display it on the screen or in a hidden form.!

Item was changed:
  CompositionScanner subclass: #SegmentScanner
  	instanceVariableNames: ''
  	classVariableNames: ''
  	poolDictionaries: 'TextConstants'
  	category: 'Graphics-Text'!
+ 
+ !SegmentScanner commentStamp: 'nice 10/6/2013 22:39' prior: 0!
+ A SegmentScanner is a CompositionScanner specialized for composing TextOnCurve.
+ !

Item was removed:
- Object subclass: #TextPrinter
- 	instanceVariableNames: 'form para paperSize landscape resolution depth offset columns docTitle noHeader noFooter'
- 	classVariableNames: 'DefaultPaperSize DefaultTextPrinter'
- 	poolDictionaries: ''
- 	category: 'Graphics-Text'!

Item was removed:
- ----- Method: TextPrinter class>>defaultPaperSize (in category 'accessing') -----
- defaultPaperSize
- 	^DefaultPaperSize!

Item was removed:
- ----- Method: TextPrinter class>>defaultPaperSize: (in category 'accessing') -----
- defaultPaperSize: aPoint
- 	DefaultPaperSize := aPoint!

Item was removed:
- ----- Method: TextPrinter class>>defaultTextPrinter (in category 'accessing') -----
- defaultTextPrinter
- 	"This is the global default TextPrinter instance."
- 	DefaultTextPrinter isNil ifTrue: [DefaultTextPrinter := self new].
- 	^DefaultTextPrinter!

Item was removed:
- ----- Method: TextPrinter class>>initialize (in category 'class initialization') -----
- initialize
- 	"TextPrinter initialize"
- 	self defaultPaperSize: self paperSizeA4.!

Item was removed:
- ----- Method: TextPrinter class>>mm2in: (in category 'paper sizes') -----
- mm2in: aPoint
- 	"Convert aPoint from millimeters to inches"
- 	^aPoint / 25.4!

Item was removed:
- ----- Method: TextPrinter class>>paperSize10x14 (in category 'paper sizes') -----
- paperSize10x14
- 	^10.0 at 14.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSize11x17 (in category 'paper sizes') -----
- paperSize11x17
- 	^11.0 at 17.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeA3 (in category 'paper sizes') -----
- paperSizeA3
- 	^self mm2in: 297 at 420!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeA4 (in category 'paper sizes') -----
- paperSizeA4
- 	^self mm2in: 210 at 297!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeA5 (in category 'paper sizes') -----
- paperSizeA5
- 	^self mm2in: 148 at 210!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeB4 (in category 'paper sizes') -----
- paperSizeB4
- 	^self mm2in: 250 at 354!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeB5 (in category 'paper sizes') -----
- paperSizeB5
- 	^self mm2in: 182 at 257!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeCSheet (in category 'paper sizes') -----
- paperSizeCSheet
- 	^17.0 at 22.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeDSheet (in category 'paper sizes') -----
- paperSizeDSheet
- 	^22.0 at 34.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeESheet (in category 'paper sizes') -----
- paperSizeESheet
- 	^34.0 at 44.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelope10 (in category 'paper sizes') -----
- paperSizeEnvelope10
- 	^4.125 at 9.5
- !

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelope11 (in category 'paper sizes') -----
- paperSizeEnvelope11
- 	^4.5 at 10.375!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelope12 (in category 'paper sizes') -----
- paperSizeEnvelope12
- 	^4.75 at 11!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelope14 (in category 'paper sizes') -----
- paperSizeEnvelope14
- 	^5.0 at 11.5!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelope9 (in category 'paper sizes') -----
- paperSizeEnvelope9
- 	^3.875 at 8.875!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelopeB4 (in category 'paper sizes') -----
- paperSizeEnvelopeB4
- 	^self mm2in: 250 at 353!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelopeB5 (in category 'paper sizes') -----
- paperSizeEnvelopeB5
- 	^self mm2in: 176 at 250!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelopeB6 (in category 'paper sizes') -----
- paperSizeEnvelopeB6
- 	^self mm2in: 176 at 125!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelopeC3 (in category 'paper sizes') -----
- paperSizeEnvelopeC3
- 	^self mm2in: 324 at 458!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelopeC4 (in category 'paper sizes') -----
- paperSizeEnvelopeC4
- 	^self mm2in: 229 at 324!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelopeC5 (in category 'paper sizes') -----
- paperSizeEnvelopeC5
- 	^self mm2in: 162 at 229!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelopeC6 (in category 'paper sizes') -----
- paperSizeEnvelopeC6
- 	^self mm2in: 114 at 162!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeEnvelopeC65 (in category 'paper sizes') -----
- paperSizeEnvelopeC65
- 	^self mm2in: 114 at 229!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeFanfoldGerman (in category 'paper sizes') -----
- paperSizeFanfoldGerman
- 	"German standard fanfold"
- 	^8.5 at 12.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeFanfoldLegalGerman (in category 'paper sizes') -----
- paperSizeFanfoldLegalGerman
- 	"German legal fanfold"
- 	^8.5 at 13.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeFanfoldUS (in category 'paper sizes') -----
- paperSizeFanfoldUS
- 	"US standard fanfold"
- 	^14.875 at 11.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeFolio (in category 'paper sizes') -----
- paperSizeFolio
- 	^8.5 at 13.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeLegal (in category 'paper sizes') -----
- paperSizeLegal
- 	^8.5 at 14.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeLetter (in category 'paper sizes') -----
- paperSizeLetter
- 	^8.5 at 11.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeNote (in category 'paper sizes') -----
- paperSizeNote
- 	^8.5 at 11.0!

Item was removed:
- ----- Method: TextPrinter class>>paperSizeTabloid (in category 'paper sizes') -----
- paperSizeTabloid
- 	^11.0 at 17.0!

Item was removed:
- ----- Method: TextPrinter>>bestColor (in category 'accessing') -----
- bestColor
- 	"Set the reproduction quality to true color"
- 	depth := 32.!

Item was removed:
- ----- Method: TextPrinter>>blackAndWhite (in category 'accessing') -----
- blackAndWhite
- 	"Set the reproduction quality to black and white"
- 	depth := 1.!

Item was removed:
- ----- Method: TextPrinter>>columnRect: (in category 'formatting') -----
- columnRect: n
- 	"Return a rectangle describing the n-th column"
- 	| area left right |
- 	area := self textArea.
- 	left := area left + ((n-1) * self columnWidth).
- 	left := left + ((n-1) * self columnSkip).
- 	right := left + self columnWidth.
- 	^(self in2pix: left @ area top) corner: 
- 		(self in2pix: right @ area bottom)!

Item was removed:
- ----- Method: TextPrinter>>columnSkip (in category 'formatting') -----
- columnSkip
- 	"Return the separating space between two columns in inches"
- 	^0.2!

Item was removed:
- ----- Method: TextPrinter>>columnWidth (in category 'formatting') -----
- columnWidth
- 	^(self textWidth - ((self columns-1) * self columnSkip)) / self columns!

Item was removed:
- ----- Method: TextPrinter>>columns (in category 'accessing') -----
- columns
- 	^columns!

Item was removed:
- ----- Method: TextPrinter>>columns: (in category 'accessing') -----
- columns: aNumber
- 	columns := aNumber asInteger max: 1.!

Item was removed:
- ----- Method: TextPrinter>>defaultPaperSize (in category 'initialize') -----
- defaultPaperSize
- 	"Return the default paper size (inches) for printing"
- 	^self class defaultPaperSize!

Item was removed:
- ----- Method: TextPrinter>>defaultResolution (in category 'initialize') -----
- defaultResolution
- 	"Return the default resolution (DPI) for printing"
- 	^TextStyle pixelsPerInch asPoint!

Item was removed:
- ----- Method: TextPrinter>>documentTitle (in category 'accessing') -----
- documentTitle
- 	^docTitle!

Item was removed:
- ----- Method: TextPrinter>>documentTitle: (in category 'accessing') -----
- documentTitle: aString
- 	docTitle := aString!

Item was removed:
- ----- Method: TextPrinter>>flushPage (in category 'printing') -----
- flushPage
- 	"The current page has been set up. Send it to the printer."
- 	form primPrintHScale: self resolution x vScale: self resolution y landscape: self landscape.
- 	"Uncomment the following for testing"
- 	"form displayOn: Display. (Delay forSeconds: 5) wait."
- !

Item was removed:
- ----- Method: TextPrinter>>footerHeight (in category 'footer') -----
- footerHeight
- 	"Return the (additional) height of the footer in inches."
- 	self noFooter ifTrue:[^0.0].
- 	^(self pix2in: 0 at TextStyle default lineGrid) y * 2!

Item was removed:
- ----- Method: TextPrinter>>footerParagraph (in category 'footer') -----
- footerParagraph
- 	"Return a paragraph for the footer"
- 	| fPara rect paragraphClass |
- 	paragraphClass := Smalltalk at: #Paragraph
- 				ifAbsent: [^ self notify: 'MVC class Paragraph not present'].
- 	fPara := paragraphClass new.
- 	fPara destinationForm: form.
- 	rect := (self in2pix: self textArea bottomLeft) corner: 
- 				(self in2pix: self textArea bottomRight + (0.0 at self footerHeight)).
- 	fPara clippingRectangle: rect.
- 	fPara compositionRectangle: rect.
- 	^fPara!

Item was removed:
- ----- Method: TextPrinter>>formatColumn:startingWith: (in category 'formatting') -----
- formatColumn: columnNum startingWith: anIndex
- 	"Format a new column starting at the given string index. Return the string index indicating the start of the next column or nil if no more columns need printing."
- 	| colRect blk |
- 	colRect := self columnRect: columnNum.
- 	anIndex > 1 ifTrue:[para text: (para text copyFrom: anIndex to: para text size)].
- 	para compositionRectangle: colRect.
- 	para clippingRectangle: colRect.
- 	para composeAll.
- 	para displayOn: form.
- 	para visibleRectangle corner y <= colRect extent y ifTrue:[^nil].
- 	"More columns -- find the character block of the last line and adjust clip rect"
- 	blk := para characterBlockAtPoint: para visibleRectangle bottomLeft.
- 	para clearVisibleRectangle. "Make sure that the background is clean"
- 	para clippingRectangle: (colRect topLeft corner: colRect right at blk top).
- 	para displayOn: form.
- 	^blk stringIndex.!

Item was removed:
- ----- Method: TextPrinter>>formatPage:startingWith: (in category 'formatting') -----
- formatPage: pageNum startingWith: anIndex
- 	"Format a new page starting at the given string index. Return the string index indicating the start of the next page or nil if no more pages need printing."
- 	| nextIndex |
- 	nextIndex := anIndex.
- 	1 to: self columns do:[:i|
- 		nextIndex := self formatColumn: i startingWith: nextIndex.
- 		nextIndex isNil ifTrue:[^nil].
- 	].
- 	^nextIndex!

Item was removed:
- ----- Method: TextPrinter>>goodColor (in category 'accessing') -----
- goodColor
- 	"Set the reproduction quality to 8 bit color depth"
- 	depth := 8.!

Item was removed:
- ----- Method: TextPrinter>>headerHeight (in category 'header') -----
- headerHeight
- 	"Return the (additional) height of the header in inches."
- 	self noHeader ifTrue:[^0.0].
- 	^(self pix2in: 0 at TextStyle default lineGrid) y * 2!

Item was removed:
- ----- Method: TextPrinter>>headerParagraph (in category 'header') -----
- headerParagraph
- 	"Return a paragraph for the footer"
- 	| hPara rect paragraphClass |
- 	paragraphClass := Smalltalk at: #Paragraph
- 				ifAbsent: [^ self notify: 'MVC class Paragraph not present'].
- 	hPara := paragraphClass new.
- 	hPara destinationForm: form.
- 	rect := (self in2pix: self textArea topLeft - (0.0 at self headerHeight)) corner: 
- 				(self in2pix: self textArea topRight).
- 	hPara clippingRectangle: rect.
- 	hPara compositionRectangle: rect.
- 	^hPara!

Item was removed:
- ----- Method: TextPrinter>>in2mm: (in category 'other') -----
- in2mm: aPoint
- 	"Convert aPoint from millimeters to inches"
- 	^aPoint * 25.4!

Item was removed:
- ----- Method: TextPrinter>>in2pix: (in category 'other') -----
- in2pix: aPoint
- 	"Convert aPoint from inches to actual pixels"
- 	^(aPoint * self resolution) rounded!

Item was removed:
- ----- Method: TextPrinter>>initialize (in category 'initialize') -----
- initialize
- 	self paperSize: self defaultPaperSize.
- 	self resolution: self defaultResolution.
- 	self blackAndWhite.
- 	self landscape: false.
- 	self offsetRect: (1.0 at 1.0 corner: 1.0 at 1.0).
- 	self columns: 1.
- 	self noHeader: false.
- 	self noFooter: false.
- 	self documentTitle: 'Squeak Document (from ', Date today printString,')'.!

Item was removed:
- ----- Method: TextPrinter>>landscape (in category 'accessing') -----
- landscape
- 	^landscape!

Item was removed:
- ----- Method: TextPrinter>>landscape: (in category 'accessing') -----
- landscape: aBoolean
- 	landscape := aBoolean!

Item was removed:
- ----- Method: TextPrinter>>mm2in: (in category 'other') -----
- mm2in: aPoint
- 	"Convert aPoint from millimeters to inches"
- 	^aPoint / 25.4!

Item was removed:
- ----- Method: TextPrinter>>mm2pix: (in category 'other') -----
- mm2pix: aPoint
- 	"Convert aPoint from millimeters to actual pixels"
- 	^self in2pix: (self mm2in: aPoint)!

Item was removed:
- ----- Method: TextPrinter>>noFooter (in category 'accessing') -----
- noFooter
- 	^noFooter!

Item was removed:
- ----- Method: TextPrinter>>noFooter: (in category 'accessing') -----
- noFooter: aBoolean
- 	"Turn off footer printing"
- 	noFooter := aBoolean.!

Item was removed:
- ----- Method: TextPrinter>>noHeader (in category 'accessing') -----
- noHeader
- 	^noHeader!

Item was removed:
- ----- Method: TextPrinter>>noHeader: (in category 'accessing') -----
- noHeader: aBoolean
- 	"Turn off header printing"
- 	noHeader := aBoolean.!

Item was removed:
- ----- Method: TextPrinter>>offsetRect (in category 'accessing') -----
- offsetRect
- 	^offset!

Item was removed:
- ----- Method: TextPrinter>>offsetRect: (in category 'accessing') -----
- offsetRect: aRectangle
- 	"Set the offset rectangle"
- 	offset := aRectangle!

Item was removed:
- ----- Method: TextPrinter>>paperSize (in category 'accessing') -----
- paperSize
- 	^paperSize!

Item was removed:
- ----- Method: TextPrinter>>paperSize: (in category 'accessing') -----
- paperSize: aPoint
- 	paperSize := aPoint!

Item was removed:
- ----- Method: TextPrinter>>pix2in: (in category 'other') -----
- pix2in: aPoint
- 	"Convert aPoint from a pixel value to inches"
- 	^aPoint / self resolution!

Item was removed:
- ----- Method: TextPrinter>>pix2mm: (in category 'other') -----
- pix2mm: aPoint
- 	"Convert aPoint from a pixel value to millimeters"
- 	^self in2mm: (self pix2in: aPoint)!

Item was removed:
- ----- Method: TextPrinter>>pixelSize (in category 'private') -----
- pixelSize
- 	"Return the size of the page in pixels"
- 	^self in2pix: (self realPaperSize)!

Item was removed:
- ----- Method: TextPrinter>>printFooter: (in category 'footer') -----
- printFooter: pageNumber
- 	"Print the footer for the given page number"
- 	| fPara |
- 	self noFooter ifTrue:[^self].
- 	fPara := self footerParagraph.
- 	fPara centered.
- 	fPara text: ('Page ', pageNumber printString) asText.
- 	fPara displayOn: form.!

Item was removed:
- ----- Method: TextPrinter>>printHeader: (in category 'header') -----
- printHeader: pageNumber
- 	"Print the header for the given page number"
- 	| fPara |
- 	self noHeader ifTrue:[^self].
- 	fPara := self headerParagraph.
- 	fPara centered.
- 	fPara text: self documentTitle asText.
- 	fPara displayOn: form.!

Item was removed:
- ----- Method: TextPrinter>>printParagraph (in category 'printing') -----
- printParagraph
- 	| pageNum nextIndex |
- 	para destinationForm: form.
- 	pageNum := 1.
- 	nextIndex := 1.
- 	[form fillColor: Color white.
- 	self printHeader: pageNum.
- 	self printFooter: pageNum.
- 	nextIndex := self formatPage: pageNum startingWith: nextIndex.
- 	self flushPage.
- 	nextIndex isNil] whileFalse:[pageNum := pageNum + 1].!

Item was removed:
- ----- Method: TextPrinter>>printText: (in category 'printing') -----
- printText: aText
- 	"Print aText"
- 	| paragraphClass |
- 	form isNil ifTrue:[
- 		form := Form extent: self pixelSize depth: depth.
- 	].
- 	paragraphClass := Smalltalk at: #Paragraph
- 				ifAbsent: [^ self notify: 'MVC class Paragraph not present'].
- 	para := paragraphClass withText: aText asText.
- 	Cursor wait showWhile:[
- 		self printParagraph.
- 	].!

Item was removed:
- ----- Method: TextPrinter>>realPaperSize (in category 'private') -----
- realPaperSize
- 	^self landscape
- 		ifTrue:[self paperSize y @ self paperSize x]
- 		ifFalse:[self paperSize]!

Item was removed:
- ----- Method: TextPrinter>>resolution (in category 'accessing') -----
- resolution
- 	^resolution!

Item was removed:
- ----- Method: TextPrinter>>resolution: (in category 'accessing') -----
- resolution: aPoint
- 	resolution := aPoint!

Item was removed:
- ----- Method: TextPrinter>>textArea (in category 'formatting') -----
- textArea
- 	^(self offsetRect origin + (0.0 at self headerHeight)) corner:
- 		(self realPaperSize - self offsetRect corner - (0.0 at self footerHeight))!

Item was removed:
- ----- Method: TextPrinter>>textWidth (in category 'formatting') -----
- textWidth
- 	^self textArea extent x!



More information about the Packages mailing list