[Pkg] The Trunk: ST80-topa.186.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Sep 1 12:40:36 UTC 2015
Tobias Pape uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-topa.186.mcz
==================== Summary ====================
Name: ST80-topa.186
Author: topa
Time: 1 September 2015, 2:40:17.113 pm
UUID: b35ea863-0a29-4a97-ac34-dd6d1e2bf1d8
Ancestors: ST80-mt.185
Move TextPrinter from ST80 to Graphics, as Morphic now also uses it.
TextPrinter uses ST80's Paragraph but already guardes around it if not present.
=============== Diff against ST80-mt.185 ===============
Item was removed:
- Object subclass: #TextPrinter
- instanceVariableNames: 'form para paperSize landscape resolution depth offset columns docTitle noHeader noFooter'
- classVariableNames: 'DefaultPaperSize DefaultTextPrinter'
- poolDictionaries: ''
- category: 'ST80-Support'!
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