17 poolDictionaries:'' |
17 poolDictionaries:'' |
18 category:'Interface-Printing' |
18 category:'Interface-Printing' |
19 ! |
19 ! |
20 |
20 |
21 WinPrinterContext subclass:#WinPrinterGraphicContext |
21 WinPrinterContext subclass:#WinPrinterGraphicContext |
22 instanceVariableNames:'fontScale pageCounter needsEndOfPage' |
22 instanceVariableNames:'fontScale printPageNumbers pageNumberFormat pageCounter |
|
23 needsEndOfPage titleFont' |
23 classVariableNames:'' |
24 classVariableNames:'' |
24 poolDictionaries:'' |
25 poolDictionaries:'' |
25 privateIn:WinPrinterContext |
26 privateIn:WinPrinterContext |
26 ! |
27 ! |
27 |
28 |
5570 "return the papers top margin measured in pixels" |
5571 "return the papers top margin measured in pixels" |
5571 |
5572 |
5572 ^ 50 |
5573 ^ 50 |
5573 ! ! |
5574 ! ! |
5574 |
5575 |
|
5576 !WinPrinterContext::WinPrinterGraphicContext methodsFor:'accessing-hooks'! |
|
5577 |
|
5578 pageNumberFormat:aFormatString |
|
5579 "set the pageNumber format - the default is 'page %1'" |
|
5580 |
|
5581 pageNumberFormat := aFormatString ? '' |
|
5582 ! |
|
5583 |
|
5584 printPageNumbers:aBoolean |
|
5585 "enable/disable printing of page numbers - the default is on" |
|
5586 |
|
5587 printPageNumbers := aBoolean. |
|
5588 ! ! |
|
5589 |
5575 !WinPrinterContext::WinPrinterGraphicContext methodsFor:'accessing-transformation'! |
5590 !WinPrinterContext::WinPrinterGraphicContext methodsFor:'accessing-transformation'! |
5576 |
5591 |
5577 clippingRectangle:aRectangle |
5592 clippingRectangle:aRectangle |
5578 |tranlate extent lft rgt top bot| |
5593 |tranlate extent lft rgt top bot| |
5579 |
5594 |
5770 ^ super getFontWithFoundry:foundry family:family weight:weight |
5785 ^ super getFontWithFoundry:foundry family:family weight:weight |
5771 slant:slant spacing:spc pixelSize:psize size:pointSize |
5786 slant:slant spacing:spc pixelSize:psize size:pointSize |
5772 registry:registry encoding:encoding |
5787 registry:registry encoding:encoding |
5773 ! |
5788 ! |
5774 |
5789 |
|
5790 titleFont |
|
5791 titleFont isNil ifTrue:[ |
|
5792 titleFont := Font family:'helvetica' face:'medium' style:'roman' size:10. |
|
5793 titleFont := titleFont onDevice:(self device). |
|
5794 ]. |
|
5795 ^ titleFont |
|
5796 ! |
|
5797 |
5775 widthOf:aString from:index1 to:index2 inFont:aFontId |
5798 widthOf:aString from:index1 to:index2 inFont:aFontId |
5776 "after retrieving the width, we have to scale the width" |
5799 "after retrieving the width, we have to scale the width" |
5777 |
5800 |
5778 |w| |
5801 |w| |
5779 |
5802 |
5818 initialize |
5841 initialize |
5819 super initialize. |
5842 super initialize. |
5820 |
5843 |
5821 pageCounter := 0. |
5844 pageCounter := 0. |
5822 needsEndOfPage := false. |
5845 needsEndOfPage := false. |
|
5846 printPageNumbers := true. |
|
5847 |
|
5848 Language == #de ifTrue:[ pageNumberFormat := 'Seite %1' ] |
|
5849 ifFalse:[ pageNumberFormat := 'page %1' ]. |
5823 ! ! |
5850 ! ! |
5824 |
5851 |
5825 !WinPrinterContext::WinPrinterGraphicContext methodsFor:'printing process'! |
5852 !WinPrinterContext::WinPrinterGraphicContext methodsFor:'printing process'! |
|
5853 |
|
5854 displayTitleDo:aNoneArgAction |
|
5855 |
|
5856 |oldClip oldTrans oldFont| |
|
5857 |
|
5858 oldClip := clipRect. |
|
5859 oldTrans := self translation. |
|
5860 oldFont := font. |
|
5861 |
|
5862 self font:(self titleFont). |
|
5863 self translation:0. |
|
5864 super clippingRectangle:nil. |
|
5865 |
|
5866 aNoneArgAction value. |
|
5867 |
|
5868 self translation:oldTrans. |
|
5869 super clippingRectangle:oldClip. |
|
5870 oldFont notNil ifTrue:[ self font:oldFont ]. |
|
5871 ! |
5826 |
5872 |
5827 endPage |
5873 endPage |
5828 "ends the current page |
5874 "ends the current page |
5829 if the current page is already closed by endPage, the request will be ignored" |
5875 if the current page is already closed by endPage, the request will be ignored" |
5830 |
5876 |
5831 needsEndOfPage ifFalse:[^ self]. |
5877 |s| |
5832 |
5878 |
|
5879 needsEndOfPage ifFalse:[ |
|
5880 ^ self |
|
5881 ]. |
5833 needsEndOfPage := false. |
5882 needsEndOfPage := false. |
|
5883 |
|
5884 printPageNumbers == true ifTrue:[ |
|
5885 self displayTitleDo:[ |
|
5886 s := pageNumberFormat bindWith:pageCounter. |
|
5887 |
|
5888 self displayString:s |
|
5889 x:(self extent x - (font widthOf:s)) |
|
5890 y:(self extent y + (font ascent)). |
|
5891 ] |
|
5892 ]. |
5834 super endPage. |
5893 super endPage. |
5835 ! |
5894 ! |
5836 |
5895 |
5837 startPage |
5896 startPage |
5838 "starts a new page |
5897 "starts a new page |