prdlgctl.h

Go to the documentation of this file.
00001 // $Id: prdlgctl.h 1742 2006-09-05 17:25:58Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // The Print Dialog Class
00099 
00100 #ifndef INC_PRDLGCTL
00101 #define INC_PRDLGCTL
00102 
00103 #include "printctl.h"   // Defines PrintControl
00104 //#include "printprg.h" // The print progress dialogue
00105 
00106 class Document;
00107 //  WEBSTER-ranbirr-12/11/96
00108 #ifndef WEBSTER
00109 class CCPrintDialog;
00110 #endif //webster
00111 class PrintPatchInfo;
00112 //  WEBSTER-ranbirr-12/11/96
00113 #ifndef WEBSTER
00114 class PrintProgressDlg;
00115 #endif //webster
00116 class CDC;
00117 class CCamView;
00118 
00119 
00120 struct DOCINFO;
00121 struct DEVMODE;
00122 
00123 /********************************************************************************************
00124 
00125 >   class CCPrintInfo : public wxPrintDialogData
00126 
00127     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00128     Created:    29/3/95
00129     Purpose:    To provide a custom Print Info class
00130 
00131 ********************************************************************************************/
00132 //  WEBSTER-ranbirr-12/11/96
00133 #ifndef WEBSTER
00134 
00135 class CCPrintInfo : public wxPrintDialogData
00136 {
00137 public:
00138     CCPrintInfo();  // Does nothing - do not use this constuctor
00139     CCPrintInfo(Document* pDoc,CCamView* pCCamView);
00140 
00141     ~CCPrintInfo();
00142 
00143     BOOL StartPrinting();
00144     BOOL MorePaper() const;
00145     BOOL GetNextPaper();
00146     BOOL GetNextPatch(PrintPatchInfo* pPatchInfo);
00147     BOOL ReprintPaper();
00148     BOOL EndPrinting();
00149 
00150     BOOL StartPlatePrinting(PrintView *pPrintView, UINT32 *const pErrID);
00151     BOOL MorePlates();
00152     BOOL SetNextPlate(PrintView *pPrintView);
00153     void EndPlatePrinting(PrintView *pPrintView);
00154 
00155     void SetSliderSubRangeMax(INT32 Max);
00156     void SetSliderSubRangePos(INT32 Pos);
00157 
00158     void SetAnalysing();
00159     void SetPrinting();
00160 
00161     INT32  SetAbortProc(CDC* pCDC);         // Calls pCDC->SetAbortProc() with the appropriate abort proc
00162     BOOL Abort();                           // TRUE if user has aborted the print job, FALSE otherwise
00163     BOOL SetUpDocInfo(DOCINFO** pDocInfo);  // Sets up the DOCINFO ready for a call to CDC::StartDoc()
00164 
00165     PrintControl *GetPrintControl()     { return pPrCtrl;  }
00166 
00167     static CCPrintInfo* GetCurrent()    { return pCurrent; }
00168 
00169     void LockProgressUpdate(BOOL Locked);
00170 
00171     wxDC * MakeDCFromPrintData(wxPrintData * pPrintData);
00172     wxPrintData * m_pNativePrintData;
00173     Document * GetDocument() {return pDocument;}
00174 
00175     void SavePrintDialogData() {m_DefaultDialogData = *(wxPrintDialogData *)this; m_HaveSavedDefaultDialogData = TRUE;}
00176 
00177 private:
00178     BOOL            Initialised;    // TRUE if Init() has been successfully called
00179     BOOL            Printing;       // TRUE after StartPrinting() called - FALSE after EndPrinting()
00180     CCPrintDialog*  pOurPD;         // Ptr to one of our own print dialogs (derived from CPrintDialog)
00181     wxPrintDialog*  pOriginalPD;    // Original dlg created by base class constructor
00182     Document*       pDocument;      // Ptr to associated document
00183     String_256      DocTitle;       // The title of the assciated document
00184     PrintControl*   pPrCtrl;        // Ptr to print control that will control print layout
00185     PrintProgressDlg* pPrgDlg;      // Ptr to the print progress dlg, created by StartPrinting()
00186 
00187     CCDC *          pCCDC;          // Ptr to ourx CCDC
00188 
00189     static CCPrintInfo* pCurrent;   // Ptr to the last constructed CCPrintInfo
00190     static wxPrintDialogData m_DefaultDialogData;
00191     static BOOL m_HaveSavedDefaultDialogData;
00192 
00193 // New methods for XaraLX
00194 
00195 public:
00196     BOOL OnPreparePrinting(BOOL bPrintSetupOnly = FALSE);
00197     BOOL UpdatePrinterSettings(BOOL RedrawPrintBorders = TRUE);
00198     static BOOL HasPrintSetup();
00199 
00200     CCDC *  GetCCDC() const {return pCCDC;}
00201     CNativeDC * GetDC() const;
00202 
00203     BOOL    m_bContinuePrinting;
00204 
00205     wxRect  m_rectDraw;
00206 };
00207 
00208 #endif //webster
00209 
00210 /********************************************************************************************
00211 
00212 >   class CCPrintDialog : public wxPrintDialog
00213 
00214     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00215     Created:    29/3/95
00216     Purpose:    To provide a custom Print Dialog
00217 
00218 ********************************************************************************************/
00219 //  WEBSTER-ranbirr-12/11/96
00220 #ifndef WEBSTER
00221 
00222 class CCPrintDialog : public wxPrintDialog
00223 {
00224 // There is no memory stuff (Declare_Memdump etc) as this is an MFC derived class
00225 public:
00226     CCPrintDialog(CCPrintInfo * pDialogData=NULL, Document* pDoc=NULL, BOOL PrintSetUpOnly = FALSE);
00227     ~CCPrintDialog();
00228 
00229     // Functions for retrieving info on the default printer
00230     static BOOL GetPaperSize(wxSize* pPaperSize, BOOL RedrawPrintBorders = TRUE);
00231     static BOOL GetPrintableArea(DocRect* pPrintableArea);
00232     static BOOL GetPrintMargins(INT32* pLeft = NULL,INT32* pTop = NULL,INT32* pRight = NULL,INT32* pBottom = NULL);
00233     static BOOL GetResolution(INT32* pDPI,INT32* pXDPI = NULL,INT32* pYDPI = NULL);
00234     static BOOL GetScale(INT32* pScale);
00235     static BOOL CanMultiCopy(BOOL* pState);
00236     static BOOL IsPostscript();
00237 
00238     // Funcs to call when the printer settings change
00239     static BOOL UpdatePrinterSettings(wxPrintData * pPrintData, wxDC * pDC, Document* pDocument, BOOL RedrawPrintBorders);
00240 
00241     // Creates a DC using given global memory handles for DEVNAMES and DEVMODE structures
00242 //  static HDC CreatePrinterDC(HGLOBAL hDevNames,HGLOBAL hDevMode);
00243 
00244     // Func that retrieves the print control func associated with attached doc
00245     PrintControl* GetPrintControl();
00246 
00247     // This group of functions are used to cope with the selected printer disappearing
00248     // For example, when the user closes a connection, or renames a printer via the printer manager
00249     static void     ResetToDefaultPrinter();
00250     static void     ClosePrintDialogs();
00251     static void     InformResetToDefaultPrinter(BOOL ClosingDlgs);
00252     static BOOL     IgnorePrintData()       { return IgnorePrntData; }
00253     static void     ResetIgnorePrintData()  { IgnorePrntData = FALSE; }
00254     static void     GetSelectedPrinterName(LPTSTR pName,INT32 BufferSize);
00255 
00256 private:
00257     BOOL InitCustomDlg();   // Initialises the dlg to use our custom dlg. Called from DoModal()
00258 
00259     void            Enable(UINT32 GadgetID,BOOL State); // Func for enabling/disabling dlg controls
00260     BOOL            ShowDetails();                      // General func for showing print details in the dlg
00261     void            GetDetails(PrintControl *TargetPC); // General func for getting print detail settings from the dlg
00262 
00263     Document*       pDocument;              // The doc this dlg is associated with
00264     PrintControl    LocalPrintControl;      // Local print control settings, committed to doc if user clicks OK
00265 
00266     // Functions for collecting printer settings
00267     static BOOL GetPrinterSettings(BOOL RedrawPrintBorders = TRUE);
00268     static BOOL LookUpPaperSize(UINT32 PaperSizeID,wxSize * pPaperSize);
00269 
00270     // Current printer setting
00271     // All dimensions (paper size, margins, etc) are in MILLIPOINTS
00272     static BOOL     GotPrinterSettings;         // TRUE when we have a set of valid printer settings
00273     static wxSize   PrPaperSize;                // Size (in MILLIPOINTS) of the printer's paper
00274     static BOOL     PrPortrait;                 // TRUE when the printer is set for portrait, FALSE for landscape
00275     static INT32        PrScale;                    // Printer scale factor percentage (i.e. 100 = 100%)
00276     static BOOL     PrMultiCopies;              // TRUE when printer can do multiple copies itself
00277     static INT32        PrResolutionX;              // Printer X resolution
00278     static INT32        PrResolutionY;              // Printer Y resolution
00279     static INT32        PrResolution;               // Printer resolution (can be -ve) (min(xres,yres))
00280     static INT32        PrLeftMargin;               // Left margin of printable area
00281     static INT32        PrTopMargin;                // Top margin of printable area
00282     static INT32        PrRightMargin;              // Right margin of printable area
00283     static INT32        PrBottomMargin;             // Bottom margin of printable area
00284     static BOOL     PrPostscript;               // TRUE if the printer is a Postscript printer
00285 
00286 //  static DEVMODE* GetSystemDevMode();
00287 //  static DEVMODE* GetSystemDevMode(HWND hWnd,LPCTSTR pDriverName,LPCTSTR pDeviceName,LPCTSTR pPortName);
00288 
00289     BOOL PrintPrefsOpen;
00290     BOOL PrintPrefsChanged;
00291 
00292     static void DumpLastError(char* pStr1,char* pStr2);     // Dumps the last error returned by GetLastError()
00293 
00294     static BOOL ReopenMainDlg;
00295 
00296     static wxPrintDialog*  pDlgSetup;
00297     static CCPrintDialog* pCurrentCCPrintDialog;
00298     static BOOL InformPrinterReset;
00299     static BOOL IgnorePrntData;
00300 
00301 protected:
00302     //{{AFX_MSG(CCPrintDialog)
00303 //  afx_msg BOOL OnCommand(UINT32 GadgetID);
00304 //  afx_msg void OnPrintSetup();                // Called when user clicks on the Setup... button
00305     //}}AFX_MSG
00306 //  DECLARE_MESSAGE_MAP()
00307 
00308 private:
00309     DECLARE_DYNAMIC_CLASS(CCPrintDialog)
00310 };
00311 #endif //webster
00312 
00313 PORTNOTE("printing", "Disabled CCPrintToFileDialog")
00314 #ifndef EXCLUDE_FROM_XARALX
00315 /********************************************************************************************
00316 
00317 >   class CCPrintToFileDialog : public CFileDialog
00318 
00319     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00320     Created:    11/5/95
00321     Purpose:    To provide a custom PrintToFile Dialog
00322 
00323 ********************************************************************************************/
00324 
00325 #define FILENAMEBUFSIZE 256
00326 
00327 class CCPrintToFileDialog : public wxFileDialog
00328 {
00329 // There is no memory stuff (Declare_Memdump etc) as this is an MFC derived class
00330 public:
00331     CCPrintToFileDialog(TCHAR *DefExt, TCHAR *FilterString);
00332     ~CCPrintToFileDialog();
00333 
00334     virtual INT32 DoModal();
00335     LPSTR GetFullPathNamePtr();
00336 
00337 private:
00338     static TCHAR FileName[FILENAMEBUFSIZE];
00339     String_64 Title;
00340 };
00341 #endif //EXCLUDE_FROM_XARALX
00342 
00343 #endif  // INC_PRDLGCTL
00344 
00345 

Generated on Sat Nov 10 03:48:48 2007 for Camelot by  doxygen 1.4.4