# HG changeset patch # User Stefan Vogel # Date 1469548697 -7200 # Node ID a36b0c184dcba0601d88a72a545579db6e2673fb # Parent 48a298ce3ce71193722e1fb2a8795e74330316f9 #UI_ENHANCEMENT by stefan class: WinPrinterContext class definition comment/format in: #startPrintJob:fileName: remember title to be printed on page footer diff -r 48a298ce3ce7 -r a36b0c184dcb WinPrinterContext.st --- a/WinPrinterContext.st Wed Jul 20 18:28:58 2016 +0200 +++ b/WinPrinterContext.st Tue Jul 26 17:58:17 2016 +0200 @@ -9,14 +9,12 @@ other person. No title to or ownership of the software is hereby transferred. " -'From Smalltalk/X, Version:7.1.0.0 on 18-07-2016 at 13:47:02' ! - "{ Package: 'stx:libview2' }" "{ NameSpace: Smalltalk }" PrinterContext subclass:#WinPrinterContext - instanceVariableNames:'deviceFonts hatch supportsColor' + instanceVariableNames:'deviceFonts hatch supportsColor title' classVariableNames:'PostScriptBlackWhite' poolDictionaries:'' category:'Interface-Printing' @@ -5559,32 +5557,32 @@ drawn between startPrintJob and endPrintJob will become one entry in the print queue." - |docInfoStruct nameAddress title fileNameAddress| + |docInfoStruct nameAddress fileNameAddress| gcId isNil ifTrue:[ - self buildPrinter + self buildPrinter ]. abort := false. title := aString ? 'Smalltalk/X'. nameAddress := title asExternalBytes unprotectFromGC. aFileName isNil ifFalse:[ - fileNameAddress := aFileName pathName asExternalBytes unprotectFromGC + fileNameAddress := aFileName pathName asExternalBytes unprotectFromGC ]. docInfoStruct := Win32OperatingSystem::DocInfoStructure new. docInfoStruct - cbSize:docInfoStruct sizeInBytes; - lpszDocName:nameAddress address. + cbSize:docInfoStruct sizeInBytes; + lpszDocName:nameAddress address. fileNameAddress isNil ifFalse:[ - docInfoStruct lpszOutput:fileNameAddress address + docInfoStruct lpszOutput:fileNameAddress address ]. jobid := OperatingSystem startDoc:gcId docInfo:docInfoStruct. jobid > 0 ifFalse:[ - jobid = -1 ifTrue:[ - abort := true. - ^ nil - ]. + jobid = -1 ifTrue:[ + abort := true. + ^ nil + ]. "/ ^ self error - OpenError raiseErrorString:'Cannot create printer job'. + OpenError raiseErrorString:'Cannot create printer job'. ]. self startPage @@ -5776,6 +5774,12 @@ super scale:(fontScale * (aScale ? 1.0)). ! +scale:scale translation:aPoint + self + translation:aPoint; + scale:scale. +! + transformation "answer the transformation excluding the fontScale factor" @@ -6006,12 +6010,14 @@ initialize super initialize. + device := nil. "super initialize did set it to Screen current" + pageCounter := 0. needsEndOfPage := false. printPageNumbers := true. Language == #de ifTrue:[ pageNumberFormat := 'Seite %1' ] - ifFalse:[ pageNumberFormat := 'page %1' ]. + ifFalse:[ pageNumberFormat := 'page %1' ]. ! ! !WinPrinterContext::WinPrinterGraphicContext methodsFor:'printing process'! @@ -6021,7 +6027,7 @@ |oldClip oldTrans oldFont| oldClip := clipRect. - oldClip notNil ifTrue:[ self deviceClippingRectangle:nil ]. + oldClip notNil ifTrue:[ self deviceClippingBounds:nil ]. oldTrans := self translation. oldFont := font. @@ -6033,7 +6039,7 @@ self translation:oldTrans. oldFont notNil ifTrue:[ self font:oldFont ]. - oldClip notNil ifTrue:[ self deviceClippingRectangle:oldClip ]. + oldClip notNil ifTrue:[ self deviceClippingBounds:oldClip ]. ! endPage @@ -6043,18 +6049,21 @@ |s| needsEndOfPage ifFalse:[ - ^ self + ^ self ]. needsEndOfPage := false. printPageNumbers == true ifTrue:[ - self displayTitleDo:[ - s := pageNumberFormat bindWith:pageCounter. - - self displayString:s - x:(self extent x - (font widthOf:s)) - y:(self extent y + (font ascent)). - ] + self displayTitleDo:[ + self displayString:title + x:(self extent x - (font widthOf:title)) // 2 + y:(self extent y + (font ascent)). + + s := pageNumberFormat bindWith:pageCounter. + self displayString:s + x:(self extent x - (font widthOf:s)) + y:(self extent y + (font ascent)). + ] ]. super endPage. !