#include <printctl.h>
Public Member Functions | |
| PrintControl () | |
| Default constructor. | |
| ~PrintControl () | |
| Default deconstructor. | |
| BOOL | SetUp (Spread *pSpread, BOOL RedrawPrintBorders=TRUE) |
| This function sets up the print control to print the given spread. | |
| String_256 | BuildPrintInfoStr () |
| This uses the print control's settings to build the string displayed in the print info field of a print dlg. | |
| String_256 | BuildPaperSizeStr () |
| This uses the printer settings to build the string displayed in the paper size field of a print options tab. | |
| BOOL | IsWholeSpread () |
| void | SetWholeSpread (BOOL State) |
| Sets the WholeSpread state, altering dependants automatically (unless importing). | |
| BOOL | IsDoublePageSpread () |
| void | SetDoublePageSpread (BOOL State) |
| FIXED16 | GetScale () |
| void | SetScale (FIXED16 NewScale) |
| Sets the scale percentage, altering dependants automatically (unless importing) Dependants are: ScaledWidth ScaledHeight. | |
| PrintOrient | GetPrintOrient () |
| void | SetPrintOrient (PrintOrient NewOrient) |
| Sets the print orientatio, altering dependants automatically (unless importing). | |
| PrintFitType | GetFitType () |
| void | SetFitType (PrintFitType NewFitType) |
| Sets the fit type, altering dependants automatically (unless importing). | |
| TypesetInfo * | GetTypesetInfo () |
| INT32 | GetTopMargin () |
| void | SetTopMargin (INT32 NewVal) |
| INT32 | GetLeftMargin () |
| void | SetLeftMargin (INT32 NewVal) |
| INT32 | GetWidth () |
| void | SetWidth (INT32 NewVal) |
| Sets the page width, altering dependants automatically (unless importing) Dependants are: Scale ScaledHeight. | |
| INT32 | GetHeight () |
| void | SetHeight (INT32 NewVal) |
| Sets the page height, altering dependants automatically (unless importing) Dependants are: Scale ScaledWidth. | |
| INT32 | GetRows () |
| BOOL | SetRows (INT32 NewVal) |
| Adjust the printing variables to allow for typesetting marks to be positioned What happens here is that we adjust the X,Y translations so that we ensure a patch is moved into a position where we can get the crop marks between the patch and the papers edges.Sets the number of pages in each printed column, altering dependants automatically (unless importing) Dependants are: Scale ScaledWidth ScaledHeight Columns. | |
| INT32 | GetColumns () |
| BOOL | SetColumns (INT32 NewVal) |
| Sets the number of pages in each printed column, altering dependants automatically (unless importing) Dependants are: Scale ScaledWidth ScaledHeight Rows. | |
| INT32 | GetGutter () |
| BOOL | SetGutter (INT32 NewVal) |
| Sets the gutter measurement, altering dependants automatically (unless importing). | |
| PrintLayers | GetPrintLayers () |
| void | SetPrintLayers (PrintLayers NewVal) |
| PSLevel | GetPSLevel () |
| void | SetPSLevel (PSLevel NewVal) |
| PrintMethodType | GetPrintMethod () |
| Returns the app's print method. This is stored in the global var AppPrintMethod. | |
| void | SetPrintMethod (PrintMethodType NewVal) |
| Sets the app's print method to be NewVal This is stored in the global var AppPrintMethod. | |
| BitmapResMethod | GetBitmapResMethod () |
| void | SetBitmapResMethod (BitmapResMethod BRM) |
| INT32 | GetDotsPerInch () |
| If the bitmap res setting is manual then the value the user entered is returned. If the bitmap res setting is automatic, then base the DPI on the printer's DPI. | |
| void | SetDotsPerInch (INT32 NewVal) |
| Ensures the NewVal is not < MINBITMAPDPI. | |
| PrintFillQuality | GetFillQuality () |
| void | SetFillQuality (PrintFillQuality Qual) |
| PrintTextOptions | GetTextOptions () |
| void | SetTextOptions (PrintTextOptions pto) |
| BOOL | IsCollated () |
| void | SetCollated (BOOL NewVal) |
| INT32 | GetNumCopies () |
| void | SetNumCopies (INT32 NewVal) |
| BOOL | GetPrintToFile () |
| void | SetPrintToFile (BOOL NewVal) |
| PrintRangeObj | GetObjPrintRange () |
| Find out the object range the user wants to print to. | |
| void | SetObjPrintRange (PrintRangeObj NewVal) |
| PrintRangeDPS | GetDPSPrintRange () |
| void | SetDPSPrintRange (PrintRangeDPS NewVal) |
| INT32 | GetNumPrintablePages () |
| This tells you how many individual pages are printable, given the current settings. | |
| PrintControl & | operator= (PrintControl &other) |
| The assignment operator for PrintControl. | |
| BOOL | StartPrinting () |
| This informs the print info object that you are about to do some printing. | |
| BOOL | MorePaper () |
| Call this for each piece of paper to be printed to. | |
| BOOL | GetNextPaper () |
| Call this for each piece of paper to be printed to. NB: You must call StartPrinting() before calling this func as part of your print loop. | |
| BOOL | ReprintPaper () |
| This allows you to print on the same piece of paper again. | |
| BOOL | GetNextPatch (PrintPatchInfo *pPatchInfo) |
| Each time this func returns TRUE, print the page using the data set up by this call. | |
| BOOL | EndPrinting () |
| This informs the print info object that you have finished printing. | |
| BOOL | StartPlatePrinting (PrintView *pPrintView, UINT32 *const errID) |
| This function makes sure the plate printing loop is initialised for the next set of pages on a single sheet of paper to pass through the driver. It sets up an appropriate ColourPlate and ColourCOntextCMYK for the given PrintView. | |
| BOOL | MorePlates () |
| Call this to determin whether there are more plates to print during this separation. | |
| BOOL | SetNextPlate (PrintView *pPrintView) |
| Call this to set up the view related data ready for the next plate rendering. | |
| void | EndPlatePrinting (PrintView *pPrintView) |
| This function makes sure the plate printing loop is shut down correctly. We need to make sure that the last plate is detached from the colour context inside the print view, otherwise when the print view is destroyed the plate in the colour context in the print view will be destroyed. As our printer dialogue keeps this in its list, we need to make sure it only gets deleted once during that lists destruction. | |
| void | StartImport () |
| Tells the object that it's data is being imported. | |
| void | EndImport () |
| Tells the object that it's data is no longer being imported. | |
| void | RenderPrintBorder (RenderRegion *pRRegion) |
| Renders the printable area on the spread according to the current print layout method. | |
Static Public Member Functions | |
| static BOOL | RedrawPrintableArea (DocView *pDocView) |
| This func can be passed as a param to Document::ForceRedraw() and hence can control which views get redraw. This func ensures that only views that are showing print borders get redrawn. | |
Static Public Attributes | |
| static PrintMethodType | AppPrintMethod = PRINTMETHOD_NORMAL |
Private Member Functions | |
| BOOL | CalcNumPaper () |
| This works out how many pieces of paper we will print to. NB: This can be different to the number of pieces of paper that comes out of the printer when the printer can do multiple copies and we are in a position to exploit this. | |
| void | SetScaleFactor (double ScaleFactor) |
| Sets the scale percentage using the given scale factor This alters dependants automatically (unless importing) Dependants are: ScaledWidth ScaledHeight. | |
| BOOL | CalcPrintAreaVars (BOOL RedrawPrintBorders=TRUE) |
| This function calcs member vars dependant on the total print area. The print area can be set up using SetUp(). | |
| BOOL | CalcFit () |
| Recalcs the scale factor needed to fit the current page in the specified orientation, using the currently set fit type. | |
| void | CalcMultipleFit (INT32 NumRows, INT32 NumColumns, INT32 GutterVal, INT32 Wd, INT32 Ht, INT32 Extra) |
| Recalcs the scale factor required for each page to fit the specified number of rows and columns, and gutter distance, to the paper. | |
| INT32 | GetCropAdjust () const |
| Return the size of the extra area we need to take into account when fitting pages onto the printable paper. Currently the bleed size and crop area size is used. | |
| double | CalcPatchWidth (INT32 PaperWidth, INT32 NumColumns, INT32 GutterVal) |
| The patch width = (width of the paper / num columns) - gutter. | |
| double | CalcPatchHeight (INT32 PaperHeight, INT32 NumRows, INT32 GutterVal) |
| The patch Height = (Height of the paper / num rows) - gutter. | |
| INT32 | CalcMaxRows (INT32 GutterVal) |
| Dynamically calcs the max num rows possible, given the current paper width and gutter setting. | |
| INT32 | CalcMaxColumns (INT32 GutterVal) |
| Dynamically calcs the max num columns possible, given the current paper height and gutter setting. | |
| INT32 | CalcMaxGutter (INT32 NumRows, INT32 NumColumns) |
| Dynamically calcs the max gutter value based on the given number of rows and columns, and the current paper size. | |
| void | RenderRect (RenderRegion *pRRegion, DocRect Rect, BOOL Fill) |
| Renders the rect given. | |
Private Attributes | |
| BOOL | Printing |
| BOOL | SelectionPresent |
| DocRect | PatchClipRect |
| INT32 | NumPrintablePages |
| INT32 | NumPaper |
| INT32 | PaperNumber |
| INT32 | MaxPaperNumber |
| BOOL | Reprint |
| INT32 | NumPatches |
| INT32 | PatchNumber |
| INT32 | MaxPatchNumber |
| INT32 | PatchRow |
| INT32 | PatchColumn |
| MILLIPOINT | SectionWidth |
| MILLIPOINT | SectionHeight |
| BOOL | PrintAreaSetUp |
| BOOL | SetUpFailed |
| Spread * | pSpread |
| DocRect | TotalPrintArea |
| DocRect | PrintableArea |
| INT32 | PALeftMargin |
| INT32 | PATopMargin |
| DocCoord | Origin |
| INT32 | PageWidth |
| INT32 | PageHeight |
| INT32 | PaperWidth |
| INT32 | PaperHeight |
| INT32 | OrigPageWidth |
| INT32 | OrigPageHeight |
| BOOL | DPS |
| MILLIPOINT | Bleed |
| MILLIPOINT | CropArea |
| BOOL | WholeSpread |
| FIXED16 | Scale |
| PrintOrient | Orient |
| PrintFitType | FitType |
| INT32 | TopMargin |
| INT32 | LeftMargin |
| INT32 | ScaledWidth |
| INT32 | ScaledHeight |
| INT32 | CropTopMargin |
| INT32 | CropLeftMargin |
| INT32 | Rows |
| INT32 | Columns |
| INT32 | Gutter |
| TypesetInfo | Typesetting |
| PrintLayers | Layers |
| PSLevel | PSLangLevel |
| BitmapResMethod | BitmapResolutionMethod |
| INT32 | DotsPerInch |
| PrintFillQuality | FillQuality |
| PrintTextOptions | TextOptions |
| BOOL | Collated |
| INT32 | NumCopies |
| BOOL | PrintToFile |
| PrintRangeObj | ObjPrintRange |
| PrintRangeDPS | DPSPrintRange |
| BOOL | UpdateDependants |
Definition at line 309 of file printctl.h.
|
|
Default constructor.
Definition at line 179 of file printctl.cpp. 00180 { 00181 PrintAreaSetUp = FALSE; // We haven't set the control up with a print area yet 00182 SetUpFailed = FALSE; // We haven't called SetUp yet, so we haven't failed yet 00183 pSpread = NULL; 00184 00185 TotalPrintArea = DocRect(0,0,A4_WIDTH,A4_HEIGHT); 00186 PrintableArea = TotalPrintArea; 00187 PALeftMargin = 0; 00188 PATopMargin = 0; 00189 00190 Origin = DocCoord(0,A4_HEIGHT); 00191 00192 PageWidth = A4_WIDTH; 00193 PageHeight = A4_HEIGHT; 00194 PaperWidth = A4_WIDTH; 00195 PaperHeight = A4_HEIGHT; 00196 00197 DPS = FALSE; 00198 Bleed = 0; 00199 CropArea = CROPAREA_SIZE+OUTSIDEBLEEDWIDTH; 00200 CropTopMargin = 0; 00201 CropLeftMargin = 0; 00202 00203 // Print layout vars 00204 WholeSpread = FALSE; 00205 00206 Scale = FIXED16(100); 00207 Orient = PRINTORIENTATION_UPRIGHT; 00208 00209 FitType = PRINTFIT_BESTPAPER; 00210 00211 TopMargin = 0; 00212 LeftMargin = 0; 00213 ScaledWidth = A4_WIDTH; 00214 ScaledHeight= A4_HEIGHT; 00215 00216 Rows = 1; 00217 Columns = 1; 00218 Gutter = 0; 00219 00220 // Print output vars 00221 Layers = PRINTLAYERS_VISIBLEFOREGROUND; 00222 // Job 10463: remove PS Level bits - default to Level 2 00223 PSLangLevel = PSLEVEL_2; 00224 // PrintMethod = CurrentPrintMethod; 00225 BitmapResolutionMethod = BITMAPRES_AUTO; 00226 DotsPerInch = 150; 00227 FillQuality = PRINTFILLQUALITY_MEDIUM; 00228 TextOptions = PRINTTEXTOPTIONS_NORMAL; 00229 00230 // General print vars 00231 Collated = FALSE; 00232 NumCopies = 1; 00233 PrintToFile = FALSE; 00234 ObjPrintRange = PRINTRANGEOBJ_ALL; 00235 DPSPrintRange = PRINTRANGEDPS_BOTH; 00236 00237 // Misc 00238 UpdateDependants = TRUE; 00239 00240 // Print layout var initialisation 00241 Printing = FALSE; 00242 };
|
|
|
Default deconstructor.
Definition at line 259 of file printctl.cpp.
|
|
|
This uses the printer settings to build the string displayed in the paper size field of a print options tab.
Definition at line 415 of file printctl.cpp. 00416 { 00417 String_256 Str = TEXT(""); 00418 String_256 TempStr = TEXT(""); 00419 00420 // If no print area set up, then assume we have no printer connected 00421 if (!PrintAreaSetUp) 00422 return Str; 00423 00424 DimScale* pDimScale = NULL; 00425 if (pSpread != NULL) 00426 pDimScale = DimScale::GetPtrDimScale(pSpread); 00427 00428 if (pDimScale != NULL) 00429 { 00430 BOOL ActiveState = pDimScale->IsActive(); 00431 pDimScale->SetActiveState(FALSE); 00432 00433 pDimScale->ConvertToUnits(PaperWidth,&TempStr); 00434 Str += TempStr; 00435 00436 Str += String_32(_R(IDS_NUM_BY_NUM)); 00437 00438 pDimScale->ConvertToUnits(PaperHeight,&TempStr); 00439 Str += TempStr; 00440 // WEBSTER-ranbirr-13/11/96 00441 #ifndef WEBSTER 00442 INT32 PrScale; 00443 if (CCPrintDialog::GetScale(&PrScale)) 00444 { 00445 if (PrScale != 100) 00446 { 00447 Str += String_256(_R(IDS_PRINT_PRINTERSCALING)); 00448 00449 TCHAR s[100]; 00450 String_32 jcf(_R(IDS_PERCENT_FORMAT)); 00451 camSprintf(s, jcf, (INT32) PrScale); 00452 Str += s; 00453 } 00454 } 00455 #endif //webster 00456 pDimScale->SetActiveState(ActiveState); 00457 } 00458 00459 return Str; 00460 }
|
|
|
This uses the print control's settings to build the string displayed in the print info field of a print dlg.
Definition at line 280 of file printctl.cpp. 00281 { 00282 String_256 Str; 00283 00284 switch (FitType) 00285 { 00286 case PRINTFIT_BEST: Str = String_256(_R(IDS_PRINT_BESTFIT)); break; 00287 case PRINTFIT_CUSTOM: Str = String_256(_R(IDS_PRINT_CUSTOMFIT)); break; 00288 case PRINTFIT_MULTIPLE: Str = String_256(_R(IDS_PRINT_MULTIPLEFIT));break; 00289 case PRINTFIT_BESTPAPER:Str = String_256(_R(IDS_PRINT_BESTFITPAPER)); break; 00290 default: ERROR3_PF(("Unknown fit type (%d)",FitType)); break; 00291 } 00292 00293 TCHAR* format = _T("%.2lf%%"); 00294 double fScale = Scale.MakeDouble(); 00295 INT32 n = INT32((fScale*100)+0.5); 00296 00297 if (n % 100 == 0) 00298 format = _T("%.0lf%%"); 00299 else if (n % 10 == 0) 00300 format = _T("%.1lf%%"); 00301 00302 TCHAR s[100]; 00303 camSprintf(s,format,fScale); 00304 Str += s; 00305 00306 switch (Orient) 00307 { 00308 case PRINTORIENTATION_UPRIGHT: Str += String_256(_R(IDS_PRINT_UPRIGHT)); break; 00309 case PRINTORIENTATION_SIDEWAYS: Str += String_256(_R(IDS_PRINT_SIDEWAYS)); break; 00310 default: ERROR3_PF(("Unknown orientation (%d)",Orient)); break; 00311 } 00312 00313 // If no print area set up, then assume we have no printer connected 00314 if (!PrintAreaSetUp) 00315 { 00316 Str += String_256(_R(IDS_PRINT_NOPRINTER)); 00317 return Str; 00318 } 00319 00320 // Work out how many pages will get completely printed 00321 UINT32 NumPages = 1; 00322 UINT32 IDSPlural = _R(IDS_PRINT_PAGES); 00323 UINT32 IDSSingular = _R(IDS_PRINT_PAGE); 00324 00325 switch (FitType) 00326 { 00327 case PRINTFIT_BEST: 00328 case PRINTFIT_BESTPAPER: 00329 NumPages = 1; 00330 break; 00331 00332 case PRINTFIT_MULTIPLE: 00333 NumPages = 0; 00334 if (StartPrinting()) 00335 { 00336 GetNextPaper(); 00337 00338 PrintPatchInfo PatchInfo; 00339 while (GetNextPatch(&PatchInfo)) 00340 { 00341 DocRect Rect = PatchInfo.GetClipRect(FALSE,FALSE); 00342 double ScaleFactor = PatchInfo.Scale.MakeDouble() / 100; 00343 00344 INT32 w = Rect.Width(); 00345 INT32 h = Rect.Height(); 00346 00347 if (PatchInfo.Rotate) 00348 { INT32 t = w; w = h; h = t; } 00349 00350 Rect.lo.x = PatchInfo.XTrans; 00351 Rect.lo.y = PatchInfo.YTrans; 00352 00353 Rect.hi.x = Rect.lo.x + (INT32((double(w) * ScaleFactor)+0.5)); 00354 Rect.hi.y = Rect.lo.y + (INT32((double(h) * ScaleFactor)+0.5)); 00355 00356 if (PrintableArea.ContainsRect(Rect)) 00357 NumPages++; 00358 } 00359 00360 EndPrinting(); 00361 } 00362 IDSPlural = _R(IDS_PRINT_TILES); 00363 IDSSingular = _R(IDS_PRINT_TILE); 00364 break; 00365 00366 case PRINTFIT_CUSTOM: 00367 { 00368 DocRect Rect(0,PaperHeight-ScaledHeight,ScaledWidth,PaperHeight); 00369 00370 INT32 CropAdj = GetCropAdjust(); 00371 INT32 TransX = LeftMargin + CropAdj; 00372 INT32 TransY = TopMargin + CropAdj; 00373 00374 Rect.Translate(TransX,-TransY); 00375 if (PrintableArea.ContainsRect(Rect)) 00376 NumPages = 1; 00377 else 00378 NumPages = 0; 00379 } 00380 break; 00381 } 00382 00383 if (NumPages >= 1) 00384 { 00385 camSprintf(s, TEXT("%ld") ,NumPages); 00386 Str += s; 00387 00388 if (NumPages == 1) 00389 Str += String_256(IDSSingular); 00390 else 00391 Str += String_256(IDSPlural); 00392 } 00393 else 00394 Str += String_256(_R(IDS_PRINT_NOPAGESFIT)); 00395 00396 return Str; 00397 }
|
|
|
Recalcs the scale factor needed to fit the current page in the specified orientation, using the currently set fit type.
Definition at line 1126 of file printctl.cpp. 01127 { 01128 static BOOL IgnoreCall = FALSE; 01129 01130 if (!UpdateDependants) 01131 return FALSE; 01132 01133 if (IgnoreCall) // Stop re-entrant calls to this function 01134 return TRUE; 01135 01136 IgnoreCall = TRUE; 01137 01138 // Set these value to absolutely ziltch 01139 CropTopMargin=0; 01140 CropLeftMargin=0; 01141 01142 switch (FitType) 01143 { 01144 case PRINTFIT_MULTIPLE: 01145 { 01146 INT32 PAWidth = PaperWidth; 01147 INT32 PAHeight = PaperHeight; 01148 01149 INT32 CropAdjust = GetCropAdjust(); 01150 01151 PAWidth -= (CropAdjust<<1); 01152 PAHeight -= (CropAdjust<<1); 01153 01154 CalcMultipleFit(Rows,Columns,Gutter,PAWidth,PAHeight,0); 01155 01156 // these settings just show to the user whats happening in the dialogue 01157 // they do not get used explicitly to position the pages. 01158 if ((Rows==1) && (Columns==1)) 01159 { 01160 LeftMargin = (PaperWidth -ScaledWidth) /2; 01161 TopMargin = (PaperHeight-ScaledHeight)/2; 01162 } 01163 } 01164 break; 01165 01166 case PRINTFIT_BEST: 01167 { 01168 INT32 PAWidth = PrintableArea.Width(); 01169 INT32 PAHeight = PrintableArea.Height(); 01170 01171 INT32 CropAdjust = GetCropAdjust(); 01172 01173 PAWidth -= (CropAdjust<<1); 01174 PAHeight -= (CropAdjust<<1); 01175 01176 BOOL PAOrient = ((double(PAWidth) / double(PAHeight)) <= 1.0); 01177 BOOL PageOrient = ((double(OrigPageWidth) / double(OrigPageHeight ))<= 1.0); 01178 01179 PrintOrient NewOrient; 01180 01181 if (PAOrient == PageOrient) 01182 NewOrient = PRINTORIENTATION_UPRIGHT; 01183 else 01184 NewOrient = PRINTORIENTATION_SIDEWAYS; 01185 01186 if (NewOrient != Orient) 01187 SetPrintOrient(NewOrient); 01188 01189 CalcMultipleFit(1,1,0,PAWidth,PAHeight,0); 01190 01191 PAWidth += (CropAdjust<<1); 01192 PAHeight += (CropAdjust<<1); 01193 01194 LeftMargin = PALeftMargin+((PAWidth -ScaledWidth) /2); 01195 TopMargin = PATopMargin +((PAHeight-ScaledHeight)/2); 01196 } 01197 break; 01198 01199 case PRINTFIT_CUSTOM: 01200 { 01201 INT32 CropAdjust = GetCropAdjust(); 01202 CropLeftMargin = CropAdjust; 01203 CropTopMargin = CropAdjust; 01204 SetScale(Scale); 01205 } 01206 break; 01207 01208 case PRINTFIT_BESTPAPER: 01209 // Best fit the document paper size onto the printed page 01210 // without scaling, distortion or clipping 01211 { 01212 INT32 PAWidth = PaperWidth; 01213 INT32 PAHeight = PaperHeight; 01214 01215 INT32 CropAdjust = GetCropAdjust(); 01216 01217 PAWidth -= (CropAdjust<<1); 01218 PAHeight -= (CropAdjust<<1); 01219 01220 // Compute aspect of document and aspect of printed page 01221 // TRUE means rect is portrait orientation, taller than it is wide... 01222 BOOL PAOrient = (double(PAWidth) <= double(PAHeight)); 01223 BOOL PageOrient = (double(OrigPageWidth) <= double(OrigPageHeight)); 01224 01225 PrintOrient NewOrient; 01226 01227 if (PAOrient == PageOrient) 01228 NewOrient = PRINTORIENTATION_UPRIGHT; 01229 else 01230 NewOrient = PRINTORIENTATION_SIDEWAYS; 01231 01232 if (NewOrient != Orient) 01233 SetPrintOrient(NewOrient); 01234 01235 CropLeftMargin = CropAdjust; 01236 CropTopMargin = CropAdjust; 01237 SetScale(100.0); 01238 01239 // PAWidth += (CropAdjust<<1); 01240 // PAHeight += (CropAdjust<<1); 01241 01242 // Centre document page within printed page 01243 LeftMargin = (PAWidth - ScaledWidth) / 2; 01244 TopMargin = (PAHeight - ScaledHeight) / 2; 01245 } 01246 break; 01247 01248 default: 01249 ERROR3_PF(("Unknown fit type (%d)",FitType)); 01250 IgnoreCall = FALSE; 01251 return FALSE; 01252 } 01253 01254 IgnoreCall = FALSE; 01255 01256 return TRUE; 01257 }
|
|
|
Dynamically calcs the max num columns possible, given the current paper height and gutter setting.
Definition at line 995 of file printctl.cpp. 00996 { 00997 INT32 MaxColumns = 0; 00998 double MinScaleFactor = double(MinPrintScale)/100; 00999 double PatchWidth,ScaleFactor; 01000 01001 do 01002 { 01003 MaxColumns += 1; 01004 PatchWidth = CalcPatchWidth(PaperWidth,MaxColumns,GutterVal); 01005 ScaleFactor = PatchWidth / PageWidth; 01006 } while (ScaleFactor >= MinScaleFactor); 01007 01008 if (MaxColumns > 1) 01009 MaxColumns -= 1; 01010 01011 return MaxColumns; 01012 }
|
|
||||||||||||
|
Dynamically calcs the max gutter value based on the given number of rows and columns, and the current paper size.
Definition at line 1029 of file printctl.cpp. 01030 { 01031 double MinScaleFactor = double(MinPrintScale)/100; 01032 01033 double PatchWidth = CalcPatchWidth(PaperWidth,NumColumns,0); 01034 double PatchHeight = CalcPatchHeight(PaperHeight,NumRows,0); 01035 01036 INT32 MaxGutterWidth = INT32((PatchWidth - (double(PageWidth) *MinScaleFactor))+0.5); 01037 INT32 MaxGutterHeight = INT32((PatchHeight - (double(PageHeight)*MinScaleFactor))+0.5); 01038 01039 if (MaxGutterWidth < MaxGutterHeight) 01040 return MaxGutterWidth; 01041 else 01042 return MaxGutterHeight; 01043 }
|
|
|
Dynamically calcs the max num rows possible, given the current paper width and gutter setting.
Definition at line 960 of file printctl.cpp. 00961 { 00962 INT32 MaxRows = 0; 00963 double MinScaleFactor = double(MinPrintScale)/100; 00964 double PatchHeight,ScaleFactor; 00965 00966 do 00967 { 00968 MaxRows += 1; 00969 PatchHeight = CalcPatchHeight(PaperHeight,MaxRows,GutterVal); 00970 ScaleFactor = PatchHeight / PageHeight; 00971 } while (ScaleFactor >= MinScaleFactor); 00972 00973 if (MaxRows > 1) 00974 MaxRows -= 1; 00975 00976 return MaxRows; 00977 }
|
|
||||||||||||||||||||||||||||
|
Recalcs the scale factor required for each page to fit the specified number of rows and columns, and gutter distance, to the paper.
Definition at line 1070 of file printctl.cpp. 01071 { 01072 // Calc the width and height of each patch on the page, taking into account the given gutter value 01073 double PatchWidth = CalcPatchWidth(Wd,NumColumns,GutterVal); 01074 double PatchHeight = CalcPatchHeight(Ht,NumRows,GutterVal); 01075 01076 // Work out the scale factor required to get the width of the page into this patch 01077 double ScaleFactor = PatchWidth / double(PageWidth+Extra); 01078 01079 // Calc the new width and height of each page by applying the scale factor 01080 double NewWidth = PageWidth * ScaleFactor; 01081 double NewHeight= PageHeight * ScaleFactor; 01082 01083 // If the scale factor made using the page width and patch width means that the page does NOT entirely 01084 // fit into a multiple-fit patch, then use the scale factor generated using the patch height and page height 01085 // 01086 // (NB: We add 1.0 to these values so that the '>' comparisons don't fail due to insignificant floating point errors). 01087 // 01088 if ((NewWidth > (PatchWidth+1.0)) || (NewHeight > (PatchHeight+1.0))) 01089 ScaleFactor = PatchHeight / double(PageHeight+Extra); 01090 01091 #ifdef _DEBUG 01092 { 01093 // In theory, when the scale factor is applied to the page width and height, the page will fit 01094 // entirely into a patch. However, we still better check this is true when in debug builds 01095 01096 NewWidth = PageWidth * ScaleFactor; 01097 NewHeight= PageHeight * ScaleFactor; 01098 01099 if ((NewWidth > (PatchWidth+1.0)) || (NewHeight > (PatchHeight+1.0))) 01100 { 01101 ERROR3("Multiple fit scale factor does not fit page into patch"); 01102 } 01103 } 01104 #endif 01105 01106 SetScaleFactor(ScaleFactor); // Use SetScaleFactor() to recalc ScaledWidth and ScaledHeight 01107 }
|
|
|
This works out how many pieces of paper we will print to. NB: This can be different to the number of pieces of paper that comes out of the printer when the printer can do multiple copies and we are in a position to exploit this.
The number of pieces of paper that the printer will produce at the end of the print job = number of printable pages * num copies If the output is colla
Definition at line 1753 of file printctl.cpp. 01754 { 01755 BOOL CanMultiCopy=TRUE; 01756 // WEBSTER-ranbirr-13/11/96 01757 #ifndef WEBSTER 01758 // Can the printer do multiple copies? 01759 if (!CCPrintDialog::CanMultiCopy(&CanMultiCopy)) 01760 return FALSE; 01761 #endif //webster 01762 INT32 NumActualPiecesOfPaper = NumPrintablePages * NumCopies; // Num pieces of paper that will come out of printer 01763 01764 // NumPaper will be the number of pieces of paper we will print to 01765 // Default to the number printable of pages 01766 NumPaper = NumPrintablePages; 01767 01768 if (NumPrintablePages == 1) 01769 { 01770 // If the printer can't cope with multiple copies, we'll have to do them all 01771 if (!CanMultiCopy) 01772 NumPaper = NumActualPiecesOfPaper; 01773 } 01774 else 01775 { 01776 // If the printer can't cope with multiple copies OR we need to collate the output 01777 // we'll have to do them all 01778 if (Collated || !CanMultiCopy) 01779 NumPaper = NumActualPiecesOfPaper; 01780 } 01781 01782 return TRUE; 01783 }
|
|
||||||||||||||||
|
The patch Height = (Height of the paper / num rows) - gutter.
Definition at line 939 of file printctl.cpp.
|
|
||||||||||||||||
|
The patch width = (width of the paper / num columns) - gutter.
Definition at line 919 of file printctl.cpp.
|
|
|
This function calcs member vars dependant on the total print area. The print area can be set up using SetUp().
It takes into account orientation, and whether its a double page spread (DPS). If it's a DPS, it also takes the WholeSpread setting into account NOTE: This func also finds out the width and height of the printer's paper using CCPrintDialog::GetPaperSize(), and calcs the paper's area too
Definition at line 619 of file printctl.cpp. 00620 { 00621 // Calc the print area origin 00622 Origin.x = TotalPrintArea.lo.x; 00623 Origin.y = TotalPrintArea.hi.y; 00624 00625 //------------------------- 00626 // Find out the dimensions of the printer's paper (in MILLIPOINTS) 00627 wxSize PaperSize; 00628 // WEBSTER-ranbirr-13/11/96 00629 #ifndef WEBSTER 00630 if (!CCPrintDialog::GetPaperSize(&PaperSize, RedrawPrintBorders)) 00631 return FALSE; 00632 #endif //webster 00633 PaperWidth = PaperSize.GetWidth(); 00634 PaperHeight = PaperSize.GetHeight(); 00635 00636 // ------------------------ 00637 // Get the printable area on the paper (defined relative to a origin at the bottom left of paper) 00638 // and the top & left margins of the printable area 00639 // WEBSTER-ranbirr-13/11/96 00640 #ifndef WEBSTER 00641 if (!CCPrintDialog::GetPrintableArea(&PrintableArea)) 00642 return FALSE; 00643 if (!CCPrintDialog::GetPrintMargins(&PALeftMargin,&PATopMargin)) 00644 return FALSE; 00645 #endif //webster 00646 //------------------------- 00647 // Calc the width and height of the print area 00648 PageWidth = TotalPrintArea.hi.x - TotalPrintArea.lo.x; 00649 PageHeight = TotalPrintArea.hi.y - TotalPrintArea.lo.y; 00650 00651 // If double page spread AND printing single pages, half the width for each page printed 00652 if (DPS && !WholeSpread) 00653 (PageWidth) /= 2; 00654 00655 // Save the orig values in case PageWidth & PageHeight need to be swapped due to sideways orientation 00656 OrigPageWidth = PageWidth; 00657 OrigPageHeight = PageHeight; 00658 00659 // If printing sideways, the width and height of the printed page should be swapped 00660 if (Orient == PRINTORIENTATION_SIDEWAYS) 00661 Swap(PageWidth,PageHeight); 00662 00663 return TRUE; 00664 }
|
|
|
Tells the object that it's data is no longer being imported.
|