WinPrinterContext.st
branchjv
changeset 3818 6219e6bc162a
parent 3808 339e33122c87
parent 3814 668e317f6672
child 4132 7e5528572373
equal deleted inserted replaced
3817:e15b5eca8c7a 3818:6219e6bc162a
  2271 	    i2 = __intVal(index2) - 1;
  2271 	    i2 = __intVal(index2) - 1;
  2272 	    if (i2 < i1) {
  2272 	    if (i2 < i1) {
  2273 		goto ret;
  2273 		goto ret;
  2274 	    }
  2274 	    }
  2275 
  2275 
  2276 	    cp = _stringVal(aString);
  2276 	    cp = __stringVal(aString);
  2277 	    l = i2 - i1 + 1;
  2277 	    l = i2 - i1 + 1;
  2278 
  2278 
  2279 	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
  2279 	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
  2280 		n = _stringSize(aString);
  2280 		n = __stringSize(aString);
  2281 		if (i2 < n) {
  2281 		if (i2 < n) {
  2282 		    cp += i1;
  2282 		    cp += i1;
  2283 		    DPRINTF(("string1: %s pos=%d/%d l=%d hDC=%x\n", cp, pX, pY,l,hDC));
  2283 		    DPRINTF(("string1: %s pos=%d/%d l=%d hDC=%x\n", cp, pX, pY,l,hDC));
  2284 
  2284 
  2285 		    if (l > 32767) {
  2285 		    if (l > 32767) {
  2374 	    i2 = __intVal(index2) - 1;
  2374 	    i2 = __intVal(index2) - 1;
  2375 	    if (i2 < i1) {
  2375 	    if (i2 < i1) {
  2376 		goto ret;
  2376 		goto ret;
  2377 	    }
  2377 	    }
  2378 
  2378 
  2379 	    cp = _stringVal(aString);
  2379 	    cp = __stringVal(aString);
  2380 	    l = i2 - i1 + 1;
  2380 	    l = i2 - i1 + 1;
  2381 
  2381 
  2382 	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
  2382 	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
  2383 		n = _stringSize(aString);
  2383 		n = __stringSize(aString);
  2384 		if (i2 < n) {
  2384 		if (i2 < n) {
  2385 		    cp += i1;
  2385 		    cp += i1;
  2386 		    DPRINTF(("string1: %s pos=%d/%d l=%d hDC=%x\n", cp, pX, pY,l,hDC));
  2386 		    DPRINTF(("string1: %s pos=%d/%d l=%d hDC=%x\n", cp, pX, pY,l,hDC));
  2387 
  2387 
  2388 		    if (l > 32767) {
  2388 		    if (l > 32767) {
  4797 	    i2 = __intVal(index2) - 1;
  4797 	    i2 = __intVal(index2) - 1;
  4798 	    if (i2 < i1) {
  4798 	    if (i2 < i1) {
  4799 		RETURN ( __MKSMALLINT( 0 ) );
  4799 		RETURN ( __MKSMALLINT( 0 ) );
  4800 	    }
  4800 	    }
  4801 
  4801 
  4802 	    cp = (char *) _stringVal(aString);
  4802 	    cp = (char *) __stringVal(aString);
  4803 	    l = i2 - i1 + 1;
  4803 	    l = i2 - i1 + 1;
  4804 
  4804 
  4805 	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
  4805 	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
  4806 		n = _stringSize(aString);
  4806 		n = __stringSize(aString);
  4807     commonWidthChars:
  4807     commonWidthChars:
  4808 		if (i2 < n) {
  4808 		if (i2 < n) {
  4809 		    cp += i1;
  4809 		    cp += i1;
  4810 
  4810 
  4811 #ifdef PRE_22_FEP_2007
  4811 #ifdef PRE_22_FEP_2007
  5625      one entry in the print queue."
  5625      one entry in the print queue."
  5626 
  5626 
  5627     |docInfoStruct nameAddress fileNameAddress|
  5627     |docInfoStruct nameAddress fileNameAddress|
  5628 
  5628 
  5629     self gcId isNil ifTrue:[
  5629     self gcId isNil ifTrue:[
  5630         self buildPrinter
  5630 	self buildPrinter
  5631     ].
  5631     ].
  5632     abort := false.
  5632     abort := false.
  5633     title := aString ? 'Smalltalk/X'.
  5633     title := aString ? 'Smalltalk/X'.
  5634     nameAddress := title asExternalBytes unprotectFromGC.
  5634     nameAddress := title asExternalBytes unprotectFromGC.
  5635     aFileName isNil ifFalse:[
  5635     aFileName isNil ifFalse:[
  5636         fileNameAddress := aFileName pathName asExternalBytes unprotectFromGC
  5636 	fileNameAddress := aFileName pathName asExternalBytes unprotectFromGC
  5637     ].
  5637     ].
  5638     docInfoStruct := Win32OperatingSystem::DocInfoStructure new.
  5638     docInfoStruct := Win32OperatingSystem::DocInfoStructure new.
  5639     docInfoStruct
  5639     docInfoStruct
  5640         cbSize:docInfoStruct sizeInBytes;
  5640 	cbSize:docInfoStruct sizeInBytes;
  5641         lpszDocName:nameAddress address.
  5641 	lpszDocName:nameAddress address.
  5642     fileNameAddress isNil ifFalse:[
  5642     fileNameAddress isNil ifFalse:[
  5643         docInfoStruct lpszOutput:fileNameAddress address
  5643 	docInfoStruct lpszOutput:fileNameAddress address
  5644     ].
  5644     ].
  5645     jobid := OperatingSystem startDoc:self gcId docInfo:docInfoStruct.
  5645     jobid := OperatingSystem startDoc:self gcId docInfo:docInfoStruct.
  5646     jobid > 0 ifFalse:[
  5646     jobid > 0 ifFalse:[
  5647         jobid = -1 ifTrue:[
  5647 	jobid = -1 ifTrue:[
  5648             abort := true.
  5648 	    abort := true.
  5649             ^ nil
  5649 	    ^ nil
  5650         ].
  5650 	].
  5651 "/        ^ self error
  5651 "/        ^ self error
  5652         OpenError raiseErrorString:'Cannot create printer job'.
  5652 	OpenError raiseErrorString:'Cannot create printer job'.
  5653     ].
  5653     ].
  5654     self startPage
  5654     self startPage
  5655 
  5655 
  5656     "Created: / 27-07-2006 / 18:19:31 / fm"
  5656     "Created: / 27-07-2006 / 18:19:31 / fm"
  5657     "Modified: / 03-08-2006 / 15:11:19 / fm"
  5657     "Modified: / 03-08-2006 / 15:11:19 / fm"
  5846     super scale:(fontScale * (aScale ? 1.0)).
  5846     super scale:(fontScale * (aScale ? 1.0)).
  5847 !
  5847 !
  5848 
  5848 
  5849 scale:scale translation:aPoint
  5849 scale:scale translation:aPoint
  5850     self
  5850     self
  5851         translation:aPoint;
  5851 	translation:aPoint;
  5852         scale:scale.
  5852 	scale:scale.
  5853 !
  5853 !
  5854 
  5854 
  5855 transformation
  5855 transformation
  5856     "answer the transformation excluding the fontScale factor"
  5856     "answer the transformation excluding the fontScale factor"
  5857 
  5857 
  6087     pageCounter    := 0.
  6087     pageCounter    := 0.
  6088     needsEndOfPage := false.
  6088     needsEndOfPage := false.
  6089     printPageNumbers := true.
  6089     printPageNumbers := true.
  6090 
  6090 
  6091     Language == #de ifTrue:[ pageNumberFormat := 'Seite %1' ]
  6091     Language == #de ifTrue:[ pageNumberFormat := 'Seite %1' ]
  6092                    ifFalse:[ pageNumberFormat := 'page %1'  ].
  6092 		   ifFalse:[ pageNumberFormat := 'page %1'  ].
  6093 ! !
  6093 ! !
  6094 
  6094 
  6095 !WinPrinterContext::WinPrinterGraphicContext methodsFor:'printing process'!
  6095 !WinPrinterContext::WinPrinterGraphicContext methodsFor:'printing process'!
  6096 
  6096 
  6097 displayTitleDo:aNoneArgAction
  6097 displayTitleDo:aNoneArgAction
  6119      if the current page is already closed by endPage, the request will be ignored"
  6119      if the current page is already closed by endPage, the request will be ignored"
  6120 
  6120 
  6121     |s|
  6121     |s|
  6122 
  6122 
  6123     needsEndOfPage ifFalse:[
  6123     needsEndOfPage ifFalse:[
  6124         ^ self
  6124 	^ self
  6125     ].
  6125     ].
  6126     needsEndOfPage := false.
  6126     needsEndOfPage := false.
  6127 
  6127 
  6128     printPageNumbers == true ifTrue:[
  6128     printPageNumbers == true ifTrue:[
  6129         self displayTitleDo:[
  6129 	self displayTitleDo:[
  6130             self displayString:title
  6130 	    self displayString:title
  6131                  x:(self extent x - (self font widthOf:title)) // 2
  6131                  x:(self extent x - (self font widthOf:title)) // 2
  6132                  y:(self extent y + (self font ascent)).
  6132                  y:(self extent y + (self font ascent)).
  6133 
  6133 
  6134             s := pageNumberFormat bindWith:pageCounter.
  6134 	    s := pageNumberFormat bindWith:pageCounter.
  6135             self displayString:s
  6135 	    self displayString:s
  6136 			     x:(self extent x - (self font widthOf:s))
  6136 			     x:(self extent x - (self font widthOf:s))
  6137 			     y:(self extent y + (self font ascent)).
  6137 			     y:(self extent y + (self font ascent)).
  6138         ]
  6138 	]
  6139     ].
  6139     ].
  6140     super endPage.
  6140     super endPage.
  6141 !
  6141 !
  6142 
  6142 
  6143 startPage
  6143 startPage
  6170 !
  6170 !
  6171 
  6171 
  6172 version_CVS
  6172 version_CVS
  6173     ^ '$Header$'
  6173     ^ '$Header$'
  6174 ! !
  6174 ! !
  6175