prncamvw.cpp

Go to the documentation of this file.
00001 // $Id: prncamvw.cpp 1593 2006-07-29 11:22:30Z 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 
00099 // PrintCamView - subclass of CamView used for printing.
00100 
00101 /*
00102 */
00103 
00104 #include "camtypes.h"
00105 
00106 #include "prncamvw.h"
00107 
00108 #include "camdoc.h"
00109 //#include "document.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00110 #include "prntview.h"
00111 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00112 //#include "spread.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00113 //#include "printdlg.h"
00114 #include "prdlgctl.h"
00115 #include "princomp.h"
00116 #include "printctl.h"
00117 #include "psrndrgn.h"
00118 //#include "tim.h"
00119 #include "camelot.h"
00120 //#include "resource.h"
00121 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00122 #include "prnmks.h"
00123 #include "opbevel.h"
00124 
00125 DECLARE_SOURCE("$Revision: 1593 $");
00126 
00127 #define new CAM_DEBUG_NEW
00128 #define USERNAME "Mike"
00129 
00130 BOOL PrintMonitor::StartPrintJob(CNativeDC * PrintJobDC)
00131 {
00132     // Make sure we don't already have a print job going.
00133     if (CurrentPrintJob != NULL)
00134     {
00135 PORTNOTE("printing", "Don't call ::AbortDoc")
00136 #ifndef EXCLUDE_FROM_XARALX
00137         // Print job going already - must have been terminated early if the
00138         // user has initiated another print job, so clean it up first.
00139         if (::AbortDoc(CurrentPrintJob) <= 0)
00140         {
00141             // Could not abort print job.
00142             CurrentPrintJob = NULL;
00143             ERROR1(FALSE, _R(IDE_ALREADY_PRINTING));
00144         }
00145 #endif
00146     }
00147 
00148     // Ok, starting a print job - keep a record of it.
00149     CurrentPrintJob = PrintJobDC;
00150     return TRUE;
00151 }
00152 
00153 void PrintMonitor::EndPrintJob()
00154 {
00155     // Ok, throw away our reference to the print job.
00156     CurrentPrintJob = NULL;
00157 }
00158 
00159 BOOL PrintMonitor::IsPrintStatusOK()
00160 {
00161 PORTNOTE("printing", "Disabled IsPrintStatusOK()")
00162 #ifndef EXCLUDE_FROM_XARALX
00163     if (CCamApp::SeriousErrorCount == MySeriousErrorCount)
00164     {
00165         // We haven't had a serious error so any current print job will be
00166         // proceeding normally.
00167         return TRUE;
00168     }
00169 
00170     // Update our error count so we get back in sync.
00171     MySeriousErrorCount = CCamApp::SeriousErrorCount;
00172 
00173     BOOL Result = TRUE;
00174 
00175     // An error has occured - delete the print job if necessary.
00176     if (CurrentPrintJob != NULL)
00177     {
00178         // Use a semaphore structure here so we don't do this more than once.
00179         CNativeDC * PrintDC = CurrentPrintJob;
00180         CurrentPrintJob = NULL;
00181         ::AbortDoc(PrintDC);
00182 
00183         // Something's gone wrong - tell caller to remove all printing render regions.
00184         Result = FALSE;
00185     }
00186 //  WEBSTER-ranbirr-12/11/96
00187 #ifndef WEBSTER
00188     CCPrintInfo *pPrintInfo = CCPrintInfo::GetCurrent();
00189     if (pPrintInfo != NULL)
00190     {
00191         // Close down and delete this print info object (this will delete the print progress 
00192         // dialog etc.)
00193         pPrintInfo->EndPrinting();
00194         delete pPrintInfo;
00195 
00196         // Something's gone wrong - tell caller to remove all printing render regions.
00197         Result = FALSE;
00198     }
00199 #endif //webster
00200     // Re-enable print Operation, and return result to caller.
00201     SetPrintingActive(FALSE);
00202 #endif
00203     return TRUE;
00204 }
00205 
00206 void PrintMonitor::SetPrintingActive(BOOL Flag)
00207 {
00208     PrintingIsActive = Flag;
00209 }
00210 
00211 BOOL PrintMonitor::IsPrintingActive()
00212 {
00213     return (PrintingIsActive);
00214 }
00215 
00216 
00217 /********************************************************************************************
00218 
00219 >   BOOL PrintMonitor::IsPrintingNow()
00220 
00221     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
00222     Created:    3/8/95
00223     Returns:    TRUE if we are activly printing NOW, FALSE if not
00224     Purpose:    Allows you to determine if there is a currently active print happening. This
00225                 is used to disable screen redrawing, only during the print itself.
00226 
00227 ********************************************************************************************/
00228 
00229 BOOL PrintMonitor::IsPrintingNow()
00230 {
00231     // if there is no print job, then we are not printing
00232     if (CurrentPrintJob==NULL)
00233         return FALSE;
00234 
00235     // otherwise we are printing
00236     return TRUE;
00237 }
00238 
00239 
00240 
00241 /********************************************************************************************
00242 
00243 >   void PrintMonitor::WantFullRedraw(BOOL WantRedraw)
00244 
00245     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
00246     Created:    3/8/95
00247     Inputs:     WantRedraw - TRUE if we want to force a redraw, FALSE if not
00248     Purpose:    Use this function to tell the PrintMonitor that a Full Redraw will be needed
00249                 at the end of the print job. You can also use this function to tell it
00250                 that the Full Redraw has been done.
00251 
00252 ********************************************************************************************/
00253 
00254 void PrintMonitor::WantFullRedraw(BOOL WantRedraw)
00255 {
00256     FullRedrawNeeded = WantRedraw;
00257 }
00258 
00259 
00260 BOOL PrintMonitor::InitPrefs()
00261 {
00262     // Declare and load the .INI file settings.
00263     BOOL ok = Camelot.DeclareSection(TEXT("Printing"), 10) &&
00264               Camelot.DeclarePref(TEXT("Printing"), TEXT("PrintMaskType"),
00265                                   (INT32 *) &PrintMonitor::PrintMaskType, MASK_SIMPLE, MASK_OPTIMAL) &&
00266               Camelot.DeclarePref(TEXT("Printing"), TEXT("PrintWithDriverBands"),
00267                                   &PrintMonitor::PrintWithDriverBands, FALSE, TRUE);
00268               Camelot.DeclarePref(TEXT("Printing"), TEXT("DisableYield"),
00269                                   &PrintMonitor::s_YieldDisabled, FALSE, TRUE);
00270     return ok;
00271 }
00272 
00273 
00274 // No current print job.
00275 CNativeDC * PrintMonitor::CurrentPrintJob = NULL;
00276 BOOL PrintMonitor::PrintingIsActive = FALSE;
00277 BOOL PrintMonitor::FullRedrawNeeded = FALSE;
00278 
00279 // No errors as yet.
00280 INT32 PrintMonitor::MySeriousErrorCount = 0;
00281 
00282 // Default to printing without mask, but with bands.
00283 BOOL PrintMonitor::PrintWithDriverBands = TRUE;
00284 BOOL PrintMonitor::PrintWithMask = TRUE;
00285 BOOL PrintMonitor::s_YieldDisabled = FALSE;
00286 PrintMonitor::MaskType PrintMonitor::PrintMaskType = MASK_OPTIMAL;
00287 
00288 

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