CCPrintInfo Class Reference

To provide a custom Print Info class. More...

#include <prdlgctl.h>

List of all members.

Public Member Functions

 CCPrintInfo ()
 Default constructor.
 CCPrintInfo (Document *pDoc, CCamView *pCCamView)
 Main constructor.
 ~CCPrintInfo ()
 Default destructor.
BOOL StartPrinting ()
 This informs the print info object that you are about to do some printing.
BOOL MorePaper () const
 Call this to determin when to finish the print run of paper NB: You must call StartPrinting() before calling this func as part of your print loop.
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 GetNextPatch (PrintPatchInfo *pPatchInfo)
 If this call returns TRUE, then the given PrintPatchInfo has been set up with all the data needed to print the given patch.
BOOL ReprintPaper ()
 This allows you to print on the same piece of paper again.
BOOL EndPrinting ()
 This informs the print info object that you have finished printing. It also closes the print progress dialog (if there is one).
BOOL StartPlatePrinting (PrintView *pPrintView, UINT32 *const pErrID)
 Fast error checking connection functions to the PrintControl associated class functions. See the headers for these functions for details.
BOOL MorePlates ()
BOOL SetNextPlate (PrintView *pPrintView)
void EndPlatePrinting (PrintView *pPrintView)
void SetSliderSubRangeMax (INT32 Max)
 Defines the maximum value you will call SetSliderSubRange() with. The slider is split up into sub-ranges, each range represents a patch (or tile) that will be printed. The slider is automatically set to the start of a sub-range when GetNextPatch() is called.
void SetSliderSubRangePos (INT32 Pos)
 Sets the slider so that it represents this value within the current sub-range. Before Pos is used, it is brought into range such that 0 <= Pos <= MaxSubRange ('MaxSubRange' is set via SetSliderSubRangeMax()).
void SetAnalysing ()
 This tells the associated print progress dlg that we are not yet printing the doc, we are currently running some analysis on it. This will display "Analysing <doc name>" instead of "Printing <doc name>".
void SetPrinting ()
 This tells the associated print progress dlg that we have started printing the doc. This will display "Printing <doc name>" instead of "Analysing <doc name>".
INT32 SetAbortProc (CDC *pCDC)
 Calls pCDC->SetAbortProc() with the appropriate abort proc.
BOOL Abort ()
 Calls the print progress dlg's abort proc to see if the user has aborted the print job.
BOOL SetUpDocInfo (DOCINFO **pDocInfo)
 Creates and sets up a DOCINFO structure, ready for a call to StartDoc(). If printing to file, this func will ensure that the lpszOutput member points to a valid file name.
PrintControlGetPrintControl ()
void LockProgressUpdate (BOOL Locked)
 Locks/Unlocks the print progress dialogue (if any) to make sure it doesn't update the progress slider etc during some critical operation.
wxDC * MakeDCFromPrintData (wxPrintData *pPrintData)
 Generates a wxPostscriptDC even though the print dialog may not have wanted to give us one. Also fills in m_pNativePrintData with the necessary print data.
DocumentGetDocument ()
void SavePrintDialogData ()
BOOL OnPreparePrinting (BOOL bPrintSetupOnly=FALSE)
 Brings up a print dialog.
BOOL UpdatePrinterSettings (BOOL RedrawPrintBorders=TRUE)
 Updates the static members that represent the current printer settings Camelot is interested in, such a paper size, orientation, etc. It uses the DEVMODE structure returned by GetDevMode(), plus member funcs for driver, device and port names.
CCDCGetCCDC () const
CNativeDCGetDC () const
 Utility function to get to the underlying DC.

Static Public Member Functions

static CCPrintInfoGetCurrent ()
static BOOL HasPrintSetup ()

Public Attributes

wxPrintData * m_pNativePrintData
BOOL m_bContinuePrinting
wxRect m_rectDraw

Private Attributes

BOOL Initialised
BOOL Printing
CCPrintDialogpOurPD
wxPrintDialog * pOriginalPD
DocumentpDocument
String_256 DocTitle
PrintControlpPrCtrl
PrintProgressDlgpPrgDlg
CCDCpCCDC

Static Private Attributes

static CCPrintInfopCurrent = NULL
static wxPrintDialogData m_DefaultDialogData
static BOOL m_HaveSavedDefaultDialogData = FALSE


Detailed Description

To provide a custom Print Info class.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/3/95

Definition at line 135 of file prdlgctl.h.


Constructor & Destructor Documentation

CCPrintInfo::CCPrintInfo  ) 
 

Default constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/3/95
Parameters:
- [INPUTS]
Returns:
-
See also:
CCPrintInfo::CCPrintInfo(Document* pDoc)

Definition at line 1916 of file prdlgctl.cpp.

01917 {
01918     ERROR3("Default constructor called.  Use other constructor");
01919     pOurPD      = NULL;
01920     pOriginalPD = NULL;
01921     Initialised = FALSE;
01922     pDocument   = NULL;
01923     pCCDC = NULL;
01924     m_bContinuePrinting = TRUE;
01925     m_pNativePrintData = NULL;
01926 
01927     if (m_HaveSavedDefaultDialogData)
01928         *((wxPrintDialogData *)this) = m_DefaultDialogData;
01929 }

CCPrintInfo::CCPrintInfo Document pDoc,
CCamView pCCamVw
 

Main constructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/3/95
Parameters:
pDoc = ptr to doc associated with the print operation [INPUTS] pCCamVw = ptr to the cam view that's doing the print job
Returns:
-
This replaces the m_pPD ptr created by the base CPrintInfo class with a ptr to a CCPrintDialog

See also:
-

Definition at line 1950 of file prdlgctl.cpp.

01951 {
01952     CAM_USE(pCCamVw); // Unused parameter in wxOil - used in WinOil
01953 
01954     pOurPD      = NULL;
01955     pOriginalPD = NULL;
01956     Initialised = FALSE;
01957     Printing    = FALSE;
01958     pDocument   = pDoc;
01959     pPrCtrl     = NULL;
01960     pPrgDlg     = NULL;
01961     pCCDC       = NULL;
01962     m_bContinuePrinting = TRUE;
01963     m_pNativePrintData = NULL;
01964 
01965     if (m_HaveSavedDefaultDialogData)
01966         *((wxPrintDialogData *)this) = m_DefaultDialogData;
01967 
01968     EnableHelp(TRUE);
01969     EnablePageNumbers(FALSE); // Make this TRUE to enable multiple pages
01970     EnablePrintToFile(TRUE);
01971     EnableSelection(TRUE); // we should test here whether or not there is a selection
01972 
01973 PORTNOTE("printing", "Disabled creation of a print dialog inside a CCPrintInfo structure")
01974 #ifndef EXCLUDE_FROM_XARALX
01975     if (pDocument != NULL)
01976     {
01977         pOurPD = new CCPrintDialog(pDocument);
01978 
01979         if (pOurPD != NULL)
01980         {
01981             pOriginalPD = m_pPD;
01982             m_pPD = pOurPD;
01983             Initialised = TRUE;
01984         }
01985         else
01986         {   ERROR3("Unable to create a CCPrintDialog object"); }
01987     }
01988 #else
01989     Initialised = TRUE;
01990 #endif
01991 
01992     ERROR3IF(pDocument == NULL,"CCPrintInfo has NULL document ptr");
01993     
01994     ERROR3IF(CCPrintInfo::pCurrent != NULL,"Constructing a new CCPrintInfo before destructing the old one");
01995     CCPrintInfo::pCurrent = this;
01996 }

CCPrintInfo::~CCPrintInfo  ) 
 

Default destructor.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/3/95
Parameters:
- [INPUTS]
Returns:
-
This tidies up by restoring the m_pPD member back to how the base class constructed it and destroys the CCPrintDialog it made on initialisation

See also:
-

Definition at line 2015 of file prdlgctl.cpp.

02016 {
02017     ERROR3IF(!Initialised,"CCPrintInfo being destructed without successful construction");
02018 
02019     if (Initialised)
02020     {
02021 PORTNOTE("printing", "Disabled deletion of a print dialog inside printinfo structure")
02022 #ifndef EXCLUDE_FROM_XARALX
02023         // restore base classes original CPrintDialog ptr
02024         m_pPD = pOriginalPD;
02025 #endif
02026 
02027         // Delete our CCPrintDialog
02028         if (pOurPD != NULL)
02029             delete pOurPD;
02030 
02031         // Delete our print progress dialog
02032         if (pPrgDlg != NULL)
02033             pPrgDlg->Done(); // this deletes it
02034     }
02035 
02036     if (pCCDC)
02037     {
02038         delete pCCDC;
02039         pCCDC=NULL;
02040     }
02041 
02042     if (m_pNativePrintData)
02043         delete m_pNativePrintData;
02044 
02045     CCPrintInfo::pCurrent = NULL;
02046 }


Member Function Documentation

BOOL CCPrintInfo::Abort  ) 
 

Calls the print progress dlg's abort proc to see if the user has aborted the print job.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the user has aborted the print job, FALSE otherwise
NB: The return value is the reverse of the origin logic used in the first working print code
See also:
-

Definition at line 2773 of file prdlgctl.cpp.

02774 {
02775     return PrintProgressDlg::AbortProc();
02776 }

void CCPrintInfo::EndPlatePrinting PrintView pPrintView  ) 
 

Definition at line 2607 of file prdlgctl.cpp.

02608 {
02609     ERROR3IF(!Printing,"EndPlatePrinting() called before StartPrinting()");
02610     ERROR3IF(pPrCtrl == NULL,"Called with NULL PrintControl ptr.  Have you called StartPrinting()?");
02611     pPrCtrl->EndPlatePrinting(pPrintView);
02612 }

BOOL CCPrintInfo::EndPrinting  ) 
 

This informs the print info object that you have finished printing. It also closes the print progress dialog (if there is one).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/95
Parameters:
- [INPUTS]
Returns:
TRUE if all OK, FALSE otherwise
See also:
StartPrinting();

Definition at line 2412 of file prdlgctl.cpp.

02413 {
02414     ERROR2IF(!Printing,FALSE,"EndPrinting() called before StartPrinting()");
02415     Printing = FALSE;
02416 
02417     // End the print control structure
02418     ERROR2IF(pPrCtrl == NULL,FALSE,"Called with NULL PrintControl ptr.  Have you called StartPrinting()?");
02419     BOOL ok = pPrCtrl->EndPrinting();
02420     pPrCtrl = NULL;
02421 
02422     // End the print marks manager too
02423     PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
02424     if (pMarksMan)
02425         pMarksMan->EndPrinting();
02426 
02427     // now destroy the print dialogue
02428     if (pPrgDlg != NULL)
02429     {
02430         pPrgDlg->Done();
02431         pPrgDlg = NULL;
02432     }       
02433 
02434     return (ok);
02435 }

CCDC* CCPrintInfo::GetCCDC  )  const [inline]
 

Definition at line 200 of file prdlgctl.h.

00200 {return pCCDC;}

static CCPrintInfo* CCPrintInfo::GetCurrent  )  [inline, static]
 

Definition at line 167 of file prdlgctl.h.

00167 { return pCurrent; }

CNativeDC * CCPrintInfo::GetDC  )  const
 

Utility function to get to the underlying DC.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
22/6/2006
Parameters:
- [INPUTS]
Returns:
The CNativeDC
See also:
-

Definition at line 2063 of file prdlgctl.cpp.

02064 {
02065     return pCCDC?pCCDC->GetDC():NULL;
02066 }

Document* CCPrintInfo::GetDocument  )  [inline]
 

Definition at line 173 of file prdlgctl.h.

00173 {return pDocument;}

BOOL CCPrintInfo::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.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/95
Parameters:
- [INPUTS]
Returns:
TRUE if you should print on another piece of paper FALSE if the print job should end
See also:
StartPrinting();

Definition at line 2452 of file prdlgctl.cpp.

02453 {
02454     ERROR2IF(!Printing,FALSE,"GetNextPaper() called before StartPrinting()");
02455     ERROR2IF(pPrCtrl == NULL,FALSE,"Called with NULL PrintControl ptr.  Have you called StartPrinting()?");
02456     return (pPrCtrl->GetNextPaper());
02457 }

BOOL CCPrintInfo::GetNextPatch PrintPatchInfo pPatchInfo  ) 
 

If this call returns TRUE, then the given PrintPatchInfo has been set up with all the data needed to print the given patch.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/95
Parameters:
pPatchInfo = ptr to object to store patch info in [INPUTS]
- [OUTPUTS]
Returns:
TRUE if you should print another page on the paper FALSE if the piece of paper printed to is finished.
NB: You must call GetNextPaper() before calling this func as part of your print loop

It automatically updates any relevent fields within the print progress dialog, if there is one.

See also:
StartPrinting(), GetNextPaper()

Definition at line 2532 of file prdlgctl.cpp.

02533 {
02534     ERROR2IF(!Printing,FALSE,"GetNextPatch() called before StartPrinting()");
02535     ERROR2IF(pPrCtrl == NULL,FALSE,"Called with NULL PrintControl ptr.  Have you called StartPrinting()?");
02536 
02537     BOOL ok = pPrCtrl->GetNextPatch(pPatchInfo);
02538 
02539     if (ok && pPrgDlg != NULL)
02540     {
02541         // Determine how many printing plates we're doing, and which one we're up to...
02542         INT32 MaxPlates = 0;        // If doing a composite print, we pass in 0
02543         INT32 CurrentPlate = 1;
02544         String_128 PlateName(TEXT("-"));
02545 
02546         if (GetPrintControl() != NULL)
02547         {
02548             TypesetInfo *TSInfo = GetPrintControl()->GetTypesetInfo();
02549             if (TSInfo != NULL && TSInfo->AreSeparating())
02550             {
02551                 MaxPlates = (INT32) TSInfo->GetNumPrintPlates();
02552                 CurrentPlate = MaxPlates - TSInfo->NumPrintPlatesRemaining();
02553 
02554                 ColourPlate *ThisPlate = TSInfo->GetCurrentPrintPlate();
02555                 if (ThisPlate != NULL)
02556                     ThisPlate->GetDescription((StringBase *) &PlateName);
02557             }
02558         }
02559 
02560         // And set the page, plate, and tile numbers
02561         pPrgDlg->SetPageNumber( pPatchInfo->PaperNumber, pPatchInfo->MaxPaperNumber,
02562                                 CurrentPlate, MaxPlates, (TCHAR *) PlateName,
02563                                 pPatchInfo->PatchNumber, pPatchInfo->MaxPatchNumber);
02564 
02565     }
02566 
02567     return ok;
02568 }

PrintControl* CCPrintInfo::GetPrintControl  )  [inline]
 

Definition at line 165 of file prdlgctl.h.

00165 { return pPrCtrl;  }

BOOL CCPrintInfo::HasPrintSetup  )  [static]
 

Author:
Alex Bligh <alex@alex.org.uk>
Date:
22/6/2006
Parameters:
- [INPUTS]
Returns:
TRUE if a print setup dialog can be brought up
See also:
-

Definition at line 2280 of file prdlgctl.cpp.

02281 {
02282     wxPrintFactory* factory = wxPrintFactory::GetFactory();
02283     return (factory->HasPrintSetupDialog());
02284 }

void CCPrintInfo::LockProgressUpdate BOOL  Locked  ) 
 

Locks/Unlocks the print progress dialogue (if any) to make sure it doesn't update the progress slider etc during some critical operation.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
22/6/2006
Parameters:
Locked - to lock the progress update [INPUTS]
Returns:
See also:
-

Definition at line 2301 of file prdlgctl.cpp.

02302 {
02303      if (pPrgDlg != NULL)
02304         pPrgDlg->LockProgressUpdate(Locked);
02305 }

wxDC * CCPrintInfo::MakeDCFromPrintData wxPrintData *  pPrintData  ) 
 

Generates a wxPostscriptDC even though the print dialog may not have wanted to give us one. Also fills in m_pNativePrintData with the necessary print data.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
22/6/2006
Parameters:
pPrintData - pointer to the dialog's print data [INPUTS]
Returns:
A DC suitable for printing to
See also:
-

Definition at line 2203 of file prdlgctl.cpp.

02204 {
02205     // Make a new wxPostscriptDC based on the print data
02206 
02207     if (m_pNativePrintData)
02208     {
02209         delete m_pNativePrintData;
02210         m_pNativePrintData = NULL;
02211     }
02212 
02213     // We don't use the copy constructor to copy things over here because this copies
02214     // wxPrintNativeData etc. which is print factory specific. We also have to switch
02215     // print factories around so we get a new print factory with the correct private
02216     // data in (what a bore).
02217 
02218 #if wxUSE_LIBGNOMEPRINT
02219     wxPrintFactory::SetPrintFactory(new wxNativePrintFactory);
02220 #endif
02221 
02222     wxPrintData * pNewData = new wxPrintData;
02223     if (!pNewData)
02224     {
02225 #if wxUSE_LIBGNOMEPRINT
02226         // restore the print factory
02227         wxPrintFactory::SetPrintFactory(new wxGnomePrintFactory);
02228 #endif
02229         ERROR2(NULL, "CCPrintInfo::OnPreparePrinting() could not get new print data");
02230     }
02231 
02232     // Now copy through the bits we care about
02233     pNewData->SetPrinterName(pPrintData->GetPrinterName());
02234     pNewData->SetNoCopies(pPrintData->GetNoCopies());
02235     pNewData->SetCollate(pPrintData->GetCollate());
02236     pNewData->SetOrientation(pPrintData->GetOrientation());
02237     pNewData->SetColour(pPrintData->GetColour());
02238     pNewData->SetDuplex(pPrintData->GetDuplex());
02239     pNewData->SetPaperId(pPrintData->GetPaperId());
02240     pNewData->SetPaperSize(pPrintData->GetPaperSize());
02241     pNewData->SetQuality(pPrintData->GetQuality());
02242     pNewData->SetBin(pPrintData->GetBin());
02243     pNewData->SetPrintMode(pPrintData->GetPrintMode());
02244     pNewData->SetFilename(pPrintData->GetFilename());
02245 
02246     wxDC * dc=new wxPostScriptDC(*pNewData);
02247 
02248     // this has been copied, so it can safely be deleted
02249     m_pNativePrintData =  pNewData;
02250 
02251 #if wxUSE_LIBGNOMEPRINT
02252     // restore the print factory
02253     wxPrintFactory::SetPrintFactory(new wxGnomePrintFactory);
02254 #endif
02255 
02256     if (!(dc->IsKindOf(CLASSINFO(wxPostScriptDC))))
02257     {
02258         delete dc;
02259         ERROR2(NULL, "Something is obstinately refusing to give us a wxPostScriptDC");
02260     }
02261 
02262     return dc;
02263 
02264 }

BOOL CCPrintInfo::MorePaper  )  const
 

Call this to determin when to finish the print run of paper NB: You must call StartPrinting() before calling this func as part of your print loop.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/6/96
Parameters:
- [INPUTS]
Returns:
TRUE if there is another piece of paper to come FALSE if the print job should end
See also:
StartPrinting();

Definition at line 2475 of file prdlgctl.cpp.

02476 {
02477     ERROR2IF(!Printing,FALSE,"MorePaper() called before StartPrinting()");
02478     ERROR2IF(pPrCtrl == NULL,FALSE,"Called with NULL PrintControl ptr.  Have you called StartPrinting()?");
02479     return (pPrCtrl->MorePaper());
02480 }

BOOL CCPrintInfo::MorePlates  ) 
 

Definition at line 2593 of file prdlgctl.cpp.

02594 {
02595     ERROR2IF(!Printing,FALSE,"MorePlates() called before StartPrinting()");
02596     ERROR2IF(pPrCtrl == NULL,FALSE,"Called with NULL PrintControl ptr.  Have you called StartPrinting()?");
02597     return (pPrCtrl->MorePlates());
02598 }

BOOL CCPrintInfo::OnPreparePrinting BOOL  bPrintSetupOnly = FALSE  ) 
 

Brings up a print dialog.

Author:
Alex Bligh <alex@alex.org.uk>
Date:
22/6/2006
Parameters:
bPrintSetupOnly - true to just bring up the print setup dialog [INPUTS]
Returns:
TRUE to print, FALSE to not print
See also:
-

Definition at line 2082 of file prdlgctl.cpp.

02083 {
02084     wxPostScriptDC::SetResolution(600); // temporary bodge
02085 
02086     // Zap any existing print dialog
02087     if (pOurPD)
02088     {
02089         delete pOurPD;
02090         pOurPD = NULL;
02091     }
02092 
02093     EnablePrintToFile(true);
02094     EnableSelection(true);
02095     EnablePageNumbers(false);
02096     pOurPD = new CCPrintDialog(this, pDocument);
02097     if (!pOurPD)
02098     {
02099         return FALSE;
02100     }
02101     
02102     // Get rid of any existing CCDC
02103     if (!pCCDC)
02104         delete pCCDC;
02105 
02106     pCCDC = NULL;
02107 
02108     // Bring up a native print setup dialog if possible
02109     wxPrintFactory* factory = wxPrintFactory::GetFactory();
02110 
02111     // Use the print dialog if we can
02112     if (bPrintSetupOnly && factory->HasPrintSetupDialog())
02113     {
02114         // The print setup dialog should change the
02115         // print data in-place if not cancelled.
02116 
02117         wxDialog *dialog = factory->CreatePrintSetupDialog( NULL, &(pOurPD->GetPrintDialogData().GetPrintData()) );
02118         if (dialog->ShowModal() == wxID_OK)
02119         {
02120             *((wxPrintDialogData *)this)=pOurPD->GetPrintDialogData();
02121             SavePrintDialogData();
02122             UpdatePrinterSettings(TRUE);
02123         }
02124 
02125         // If we are to ignore the printer data (because the selected printer has been deleted, renamed, etc)
02126         // then we must reset the global memory handles that hold the data, as the settings they contain
02127         // no longer refer to a printer known by the host system
02128         if (CCPrintDialog::IgnorePrintData())
02129         {
02130 PORTNOTE("printing", "don't do FreeGlobalHandle")
02131 #ifndef EXCLUDE_FROM_XARALX
02132             CCPrintDialog::FreeGlobalHandle(&m_hDevMode);
02133             CCPrintDialog::FreeGlobalHandle(&m_hDevNames);
02134 #endif
02135             CCPrintDialog::ResetIgnorePrintData();
02136         }
02137 
02138         dialog->Destroy();
02139 
02140         delete pOurPD;
02141         pOurPD = NULL;
02142         return FALSE;
02143     }
02144 
02145     ResourceID ret = pOurPD->ShowModal();
02146     if ( (ret == wxID_CANCEL) || !pOurPD->GetPrintDialogData().Ok())
02147     {
02148         delete pOurPD;
02149         pOurPD = NULL;
02150         return FALSE;
02151     }
02152 
02153     // They pressed print
02154     wxDC * dc = pOurPD->GetPrintDC(); // we now own the DC.
02155     if (dc) delete dc; // ignore your nasty dc, which may be a non-wxPostScript DC  
02156 
02157     // Overwrite our own settings
02158     *((wxPrintDialogData *)this)=pOurPD->GetPrintDialogData();
02159     SavePrintDialogData();
02160     UpdatePrinterSettings(TRUE);
02161 
02162     pCCDC = NULL;
02163 
02164     dc = MakeDCFromPrintData(&(pOurPD->GetPrintDialogData().GetPrintData()));
02165 
02166     if (!dc)
02167     {
02168         delete pOurPD;
02169         pOurPD = NULL;
02170         ERROR2(FALSE, "CCPrintInfo::OnPreparePrinting() could not get a wxPostScriptDC");
02171     }
02172 
02173     pCCDC = new PSPrintDC(dc);
02174     if (!pCCDC)
02175     {
02176         delete dc;
02177         delete pOurPD;
02178         pOurPD = NULL;
02179         return FALSE;
02180     }
02181 
02182     pCCDC->SetDC(dc, TRUE); // now deleting the CCDC will delete the DC too
02183 
02184     return TRUE;
02185 }

BOOL CCPrintInfo::ReprintPaper  ) 
 

This allows you to print on the same piece of paper again.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/4/95
Parameters:
- [INPUTS]
Returns:
TRUE if all OK, FALSE otherwise
If you call this func after a call to GetNextPaper(), then the next time you call GetNextPaper() you will actually be starting the print on the same piece of paper.

See also:
GetNextPaper()

Definition at line 2501 of file prdlgctl.cpp.

02502 {
02503     ERROR2IF(!Printing,FALSE,"ReprintPaper() called before StartPrinting()");
02504     ERROR2IF(pPrCtrl == NULL,FALSE,"Called with NULL PrintControl ptr.  Have you called StartPrinting()?");
02505     return (pPrCtrl->ReprintPaper());
02506 }

void CCPrintInfo::SavePrintDialogData  )  [inline]
 

Definition at line 175 of file prdlgctl.h.

00175 {m_DefaultDialogData = *(wxPrintDialogData *)this; m_HaveSavedDefaultDialogData = TRUE;}

INT32 CCPrintInfo::SetAbortProc CDC pCDC  ) 
 

Calls pCDC->SetAbortProc() with the appropriate abort proc.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/95
Parameters:
pCDC = ptr to CDC used for printing [INPUTS]
- [OUTPUTS]
Returns:
0 means OK, non-zero means ERROR
See also:
CDC::SetAbortProc()

Definition at line 2743 of file prdlgctl.cpp.

02744 {
02745 PORTNOTE("printing", "Disabled SetAbortProc bits")
02746 #ifndef EXCLUDE_FROM_XARALX
02747     ERROR2IF(pCDC == NULL,SP_ERROR,"Given NULL CDC ptr");
02748 
02749     return (pCDC->SetAbortProc(PrintProgressDlg::AbortProc));
02750 #else
02751     return 0;
02752 #endif
02753 }

void CCPrintInfo::SetAnalysing  ) 
 

This tells the associated print progress dlg that we are not yet printing the doc, we are currently running some analysis on it. This will display "Analysing <doc name>" instead of "Printing <doc name>".

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 2693 of file prdlgctl.cpp.

02694 {
02695     if (pPrgDlg != NULL)
02696     {
02697         pPrgDlg->SetAnalysing();
02698         if (pDocument != NULL)
02699             pPrgDlg->SetDocName(pDocument->GetTitle());
02700     }
02701 }

BOOL CCPrintInfo::SetNextPlate PrintView pPrintView  ) 
 

Definition at line 2600 of file prdlgctl.cpp.

02601 {
02602     ERROR2IF(!Printing,FALSE,"SetNextPlate() called before StartPrinting()");
02603     ERROR2IF(pPrCtrl == NULL,FALSE,"Called with NULL PrintControl ptr.  Have you called StartPrinting()?");
02604     return (pPrCtrl->SetNextPlate(pPrintView));
02605 }

void CCPrintInfo::SetPrinting  ) 
 

This tells the associated print progress dlg that we have started printing the doc. This will display "Printing <doc name>" instead of "Analysing <doc name>".

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 2719 of file prdlgctl.cpp.

02720 {
02721     if (pPrgDlg != NULL)
02722     {
02723         pPrgDlg->SetPrinting();
02724         if (pDocument != NULL)
02725             pPrgDlg->SetDocName(pDocument->GetTitle());
02726     }
02727 }

void CCPrintInfo::SetSliderSubRangeMax INT32  Max  ) 
 

Defines the maximum value you will call SetSliderSubRange() with. The slider is split up into sub-ranges, each range represents a patch (or tile) that will be printed. The slider is automatically set to the start of a sub-range when GetNextPatch() is called.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/95
Parameters:
Max = The maximum value the sub-range will reach [INPUTS]
- [OUTPUTS]
Returns:
-
After GetNextPatch() is called, call this func to define the range of values for the slider sub-range to represent. Then call SetSliderSubRanngePos() each time the progress of the patch changes.

This will only have an effect if StartPrinting() has been successfully called. If there isn't a progress bar (for what ever reason) this function does nothing (not even error).

See also:
StartPrinting(), SetSliderSubRangePos()

Definition at line 2643 of file prdlgctl.cpp.

02644 {
02645     if (pPrgDlg != NULL)
02646         pPrgDlg->SetSliderSubRangeMax(Max);
02647 }

void CCPrintInfo::SetSliderSubRangePos INT32  Pos  ) 
 

Sets the slider so that it represents this value within the current sub-range. Before Pos is used, it is brought into range such that 0 <= Pos <= MaxSubRange ('MaxSubRange' is set via SetSliderSubRangeMax()).

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/95
Parameters:
Pos = value for the current sub-range [INPUTS]
- [OUTPUTS]
Returns:
-
This will only have an effect if StartPrinting() has been successfully called. If there isn't a progress bar (for what ever reason) this function does nothing (not even error).

See also:
StartPrinting(), SetSliderSubRangeMax()

Definition at line 2670 of file prdlgctl.cpp.

02671 {
02672     if (pPrgDlg != NULL)
02673         pPrgDlg->SetSliderSubRangePos(Pos);
02674 }

BOOL CCPrintInfo::SetUpDocInfo DOCINFO **  ppDocInfo  ) 
 

Creates and sets up a DOCINFO structure, ready for a call to StartDoc(). If printing to file, this func will ensure that the lpszOutput member points to a valid file name.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/5/95
Parameters:
ppDocInfo = ptr to place to put a ptr to a DOCINFO structure [INPUTS]
ppDocInfo = contains ptr to an initialised DOCINFO struct. [OUTPUTS]
Returns:
TRUE if ok, FALSE otherwise
pDocInfo contains the ptr to the DOCINFO on exit. It is up to the caller to delete this object when no longer needed

See also:
-

Definition at line 2799 of file prdlgctl.cpp.

02800 {
02801     ERROR2IF(ppDocInfo == NULL,FALSE,"ppDocInfo param is NULL");
02802     ERROR2IF(pDocument == NULL,FALSE,"pDocument is NULL");
02803 
02804     // Create a new DOCINFO struct so that we are compatible across all OSs
02805     NEW_DOCINFO* pNewDocInfo = new NEW_DOCINFO;
02806 
02807     BOOL ok = (pNewDocInfo != NULL);
02808 
02809     if (ok)
02810     {
02811         // Zero all struct members
02812         memset(pNewDocInfo,0,sizeof(NEW_DOCINFO));
02813         pNewDocInfo->cbSize = sizeof(NEW_DOCINFO);
02814 
02815         // set up document title
02816         DocTitle = pDocument->GetTitle();
02817 
02818         pNewDocInfo->lpszDocName = DocTitle;
02819         pNewDocInfo->lpszOutput = NULL;
02820 
02821         ERROR2IF(pOurPD == NULL,FALSE,"NULL CCPrintDialog ptr");
02822 
02823         // Get ptr to the PrintControl object
02824         if (pPrCtrl == NULL)
02825             pPrCtrl = pOurPD->GetPrintControl();
02826 
02827         ERROR3IF(pPrCtrl == NULL,"Unable to get ptr to the PrintControl object");
02828 
02829 PORTNOTE("printing", "Disabled print to file")
02830 #ifndef EXCLUDE_FROM_XARALX
02831         if (pPrCtrl != NULL && pPrCtrl->GetPrintToFile())
02832         {
02833             // Keep Control Helper system informed
02834             ControlHelper::InformModalDialogOpened();
02835 
02836             String_256 Filt(_R(IDS_PRDLGCTL_PRINT_FILES_FILT_DLG));
02837 
02838             CCPrintToFileDialog PrintToFileDlg("prn", (TCHAR *)Filt);
02839             if (PrintToFileDlg.DoModal() == IDOK)
02840                 pNewDocInfo->lpszOutput = PrintToFileDlg.GetFullPathNamePtr();
02841             else
02842                 ok = FALSE;     // Abort printing if Cancel is clicked
02843 
02844             // Keep Control Helper system informed
02845             ControlHelper::InformModalDialogClosed();
02846         }
02847 #endif
02848     }
02849 
02850     if (!ok && pNewDocInfo != NULL)
02851     {
02852         delete pNewDocInfo;
02853         pNewDocInfo = NULL;
02854     }
02855 
02856     ERROR2IF(ok && pNewDocInfo == NULL,FALSE,"Returning TRUE but we have a NULL DOCINFO ptr");
02857 
02858     *ppDocInfo = (DOCINFO*)pNewDocInfo;
02859 
02860     return ok;
02861 }

BOOL CCPrintInfo::StartPlatePrinting PrintView pPrintView,
UINT32 *const   pErrID
 

Fast error checking connection functions to the PrintControl associated class functions. See the headers for these functions for details.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/6/96
Parameters:
- [INPUTS]
Returns:
-

Definition at line 2586 of file prdlgctl.cpp.

02587 {
02588     ERROR2IF(!Printing,FALSE,"StartPlatePrinting() called before StartPrinting()");
02589     ERROR2IF(pPrCtrl == NULL,FALSE,"Called with NULL PrintControl ptr.  Have you called StartPrinting()?");
02590     return (pPrCtrl->StartPlatePrinting(pPrintView, pErrID));
02591 }

BOOL CCPrintInfo::StartPrinting  ) 
 

This informs the print info object that you are about to do some printing.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
25/4/95
Parameters:
- [INPUTS]
Returns:
TRUE if all OK, FALSE otherwise
It also creates and displays the print progress dialog.

This is purely to set up the print layout mechanism. It will work out how many pieces of paper will be printed to, and how many times the page will be printed on each piece of of paper (for multiple fit printing).

CCPrintInfo just provides easy access to the functions provided by the PrintControl class. It means you don't have to worry about getting hold of the right PrintControl object from the right document - this is all taken care of for you.

The mechanism works like this:

if (StartPrinting()) { while (GetNextPaper()) { while (GetNextPatch()) { Use access funcs to get hold of data set up by GetNextPath(), e.g. scale, translation, etc

if (SelectedOnly) print all selected objects that lie within the ClipRect area in the spread else print all objects that lie within the ClipRect area in the spread } }

EndPrinting() }

See also:
GetNextPaper(), GetNextPath()

Definition at line 2351 of file prdlgctl.cpp.

02352 {
02353     ERROR2IF(Printing,FALSE,"StartPrinting() called before EndPrinting()");
02354     Printing = TRUE;
02355 
02356     // If not initialised properly, don't start printing
02357     ERROR2IF(!Initialised,FALSE,"Not initialised");
02358     ERROR2IF(pOurPD == NULL,FALSE,"NULL CCPrintDialog ptr");
02359     ERROR2IF(pDocument == NULL,FALSE,"Document ptr is NULL");
02360 
02361     // Get ptr to the PrintControl object
02362     pPrCtrl = pOurPD->GetPrintControl();
02363     ERROR2IF(pPrCtrl == NULL,FALSE,"The print dialog can't find attached print control object");
02364     if (!pPrCtrl->StartPrinting())
02365     {
02366         pPrCtrl = NULL;
02367         return FALSE;
02368     }
02369 
02370     // Start up the print marks manager too
02371     PrintMarksMan* pMarksMan = GetApplication()->GetMarksManager();
02372     if (pMarksMan)
02373         pMarksMan->StartPrinting();
02374 
02375     ERROR3IF(pPrgDlg != NULL,"StartPrinting() called with non-NULL pPrgDlg. Did you call EndPrinting() last time?");
02376 
02377 
02378     OpDescriptor* pOpDesc = (OpDescriptor*)OpDescriptor::FindOpDescriptor( OPTOKEN_PRINT_PROGRESS );
02379     if ( pOpDesc )
02380         pOpDesc->Invoke();
02381     // Create and initialise the print progress dialog
02382     pPrgDlg = PrintProgressDlg::Get();
02383     if (pPrgDlg == NULL)
02384     {
02385         pPrCtrl->EndPrinting();
02386         pPrCtrl = NULL;
02387         return FALSE;
02388     }
02389 
02390     //pPrgDlg->SetDocName(pDocument->GetTitle());
02391     pPrgDlg->SetPrinterName(GetPrintData().GetPrinterName());
02392 //  pPrgDlg->SetPortName(GetPrintData().GetPrinterCommand());
02393     pPrgDlg->SetSliderPos(0);
02394 
02395     return TRUE;
02396 }

BOOL CCPrintInfo::UpdatePrinterSettings BOOL  RedrawPrintBorders = TRUE  ) 
 

Updates the static members that represent the current printer settings Camelot is interested in, such a paper size, orientation, etc. It uses the DEVMODE structure returned by GetDevMode(), plus member funcs for driver, device and port names.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/4/95
Parameters:
RedrawPrintBorders = TRUE if you want any visible print borders redrawing [INPUTS]
Returns:
TRUE if ok, FALSE otherwise
This sets the static member GotPrinterSettings to TRUE if successful

See also:
static BOOL UpdatePrinterSettings()

Definition at line 780 of file prdlgctl.cpp.

00781 {
00782     wxDC * dc = MakeDCFromPrintData(&GetPrintData());
00783     BOOL ret=CCPrintDialog::UpdatePrinterSettings(m_pNativePrintData,dc,pDocument,RedrawPrintBorders);
00784     delete dc;
00785     return ret;
00786 }


Member Data Documentation

String_256 CCPrintInfo::DocTitle [private]
 

Definition at line 183 of file prdlgctl.h.

BOOL CCPrintInfo::Initialised [private]
 

Definition at line 178 of file prdlgctl.h.

BOOL CCPrintInfo::m_bContinuePrinting
 

Definition at line 203 of file prdlgctl.h.

wxPrintDialogData CCPrintInfo::m_DefaultDialogData [static, private]
 

Definition at line 190 of file prdlgctl.h.

BOOL CCPrintInfo::m_HaveSavedDefaultDialogData = FALSE [static, private]
 

Definition at line 191 of file prdlgctl.h.

wxPrintData* CCPrintInfo::m_pNativePrintData
 

Definition at line 172 of file prdlgctl.h.

wxRect CCPrintInfo::m_rectDraw
 

Definition at line 205 of file prdlgctl.h.

CCDC* CCPrintInfo::pCCDC [private]
 

Definition at line 187 of file prdlgctl.h.

CCPrintInfo * CCPrintInfo::pCurrent = NULL [static, private]
 

Definition at line 189 of file prdlgctl.h.

Document* CCPrintInfo::pDocument [private]
 

Definition at line 182 of file prdlgctl.h.

wxPrintDialog* CCPrintInfo::pOriginalPD [private]
 

Definition at line 181 of file prdlgctl.h.

CCPrintDialog* CCPrintInfo::pOurPD [private]
 

Definition at line 180 of file prdlgctl.h.

PrintControl* CCPrintInfo::pPrCtrl [private]
 

Definition at line 184 of file prdlgctl.h.

PrintProgressDlg* CCPrintInfo::pPrgDlg [private]
 

Definition at line 185 of file prdlgctl.h.

BOOL CCPrintInfo::Printing [private]
 

Definition at line 179 of file prdlgctl.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:52:11 2007 for Camelot by  doxygen 1.4.4