[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1363
Date       : Sun Jun 25 20:00:00 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/printing.cpp
   M /Trunk/XaraLX/wxOil/camelot.cpp
   M /Trunk/XaraLX/wxOil/camelot.h
   M /Trunk/XaraLX/wxOil/menucmds.cpp
   M /Trunk/XaraLX/wxOil/prdlgctl.cpp
   M /Trunk/XaraLX/wxOil/prdlgctl.h

Make a print setup dialog appear if the wind is blowing from the right direction.


Diff:
Index: Trunk/XaraLX/Kernel/printing.cpp
===================================================================
--- Trunk/XaraLX/Kernel/printing.cpp	(revision 1362)
+++ Trunk/XaraLX/Kernel/printing.cpp	(revision 1363)
@@ -113,6 +113,7 @@
 #include "helpids.h"
 #include "bubbleid.h"
 #include "prncamvw.h"
+#include "prdlgctl.h"
 //#include "barsdlgs.h"
 //#include "nev.h"		// _R(IDS_FILE_PRINT_ONE)
 
@@ -154,10 +155,13 @@
 
 ********************************************************************************************/
 
-OpState OpPrint::GetState(String_256*, OpDescriptor*)
+OpState OpPrint::GetState(String_256*, OpDescriptor* WhichOp)
 {
+	BOOL ForceGreyed = FALSE;
+	if ((WhichOp->Token) == (String(OPTOKEN_PRINT_SETUP)))
+		ForceGreyed=!CCPrintInfo::HasPrintSetup();
 	// not ticked, greyed only if already printing (or the print dialog is open).
-	return OpState( FALSE, PrintMonitor::IsPrintingActive() );
+	return OpState( FALSE, PrintMonitor::IsPrintingActive() || ForceGreyed);
 }
 
 
Index: Trunk/XaraLX/wxOil/menucmds.cpp
===================================================================
--- Trunk/XaraLX/wxOil/menucmds.cpp	(revision 1362)
+++ Trunk/XaraLX/wxOil/menucmds.cpp	(revision 1363)
@@ -531,10 +531,7 @@
 #ifndef WEBSTER
 void PrintSetupAction() 
 {               
-PORTNOTETRACE("other", "PrintSetupAction does nothing");
-#if !defined(EXCLUDE_FROM_XARALX)
-	((CCamApp*) AfxGetApp()).OnFilePrintSetup();
-#endif
+	AfxGetApp().OnFilePrintSetup();
 }
 #endif //webster
 /********************************************************************************************
Index: Trunk/XaraLX/wxOil/prdlgctl.h
===================================================================
--- Trunk/XaraLX/wxOil/prdlgctl.h	(revision 1362)
+++ Trunk/XaraLX/wxOil/prdlgctl.h	(revision 1363)
@@ -166,14 +166,7 @@
 
 	static CCPrintInfo* GetCurrent()	{ return pCurrent; }
 
-	// Locks/Unlocks the print progress dialogue (if any) to make sure it doesn't update
-	// the progress slider etc during some critical operation.
-	void LockProgressUpdate(BOOL Locked) {
-PORTNOTE("printing", "Disabled Print Progress Dialog")
-#ifndef EXCLUDE_FROM_XARALX
-		 if (pPrgDlg != NULL) pPrgDlg->LockProgressUpdate(Locked);
-#endif
-	 }
+	void LockProgressUpdate(BOOL Locked);
 
 private:
 	BOOL 			Initialised;	// TRUE if Init() has been successfully called
@@ -193,7 +186,8 @@
 // New methods for XaraLX
 
 public:
-	BOOL OnPreparePrinting();
+	BOOL OnPreparePrinting(BOOL bPrintSetupOnly = FALSE);
+	static BOOL HasPrintSetup();
 
 	CCDC *	GetCCDC() const {return pCCDC;}
 	CNativeDC * GetDC() const;
@@ -207,7 +201,7 @@
 
 /********************************************************************************************
 
->	class CCPrintDialog : public CPrintDialog
+>	class CCPrintDialog : public wxPrintDialog
 
 	Author:		Mark_Neves (Xara Group Ltd) <camelotdev@xxxxxxxx>
 	Created:	29/3/95
Index: Trunk/XaraLX/wxOil/camelot.h
===================================================================
--- Trunk/XaraLX/wxOil/camelot.h	(revision 1362)
+++ Trunk/XaraLX/wxOil/camelot.h	(revision 1363)
@@ -148,6 +148,8 @@
 
 	void OnFatalException();
 
+	void OnFilePrintSetup();
+
 	static BOOL LaunchWebBrowser(const wxString& strUrl);
 
 private:
Index: Trunk/XaraLX/wxOil/prdlgctl.cpp
===================================================================
--- Trunk/XaraLX/wxOil/prdlgctl.cpp	(revision 1362)
+++ Trunk/XaraLX/wxOil/prdlgctl.cpp	(revision 1363)
@@ -877,6 +877,8 @@
 	}
 }
 
+#endif
+
 /********************************************************************************************
 
 >	static void CCPrintDialog::InformResetToDefaultPrinter(BOOL ClosingDlgs)
@@ -913,6 +915,8 @@
 	}
 }
 
+#ifndef EXCLUDE_FROM_XARALX
+
 /********************************************************************************************
 
 >	static void CCPrintDialog::GetSelectedPrinterName(LPTSTR pName,INT32 BufferSize)
@@ -2523,11 +2527,11 @@
 
 /********************************************************************************************
 
->	BOOL CCPrintInfo::OnPreparePrinting()
+>	BOOL CCPrintInfo::OnPreparePrinting(BOOL bPrintSetupOnly)
 
 	Author:		Alex Bligh <alex@xxxxxxxxxxx>
 	Created:	22/6/2006
-	Inputs:		-
+	Inputs:		bPrintSetupOnly - true to just bring up the print setup dialog
 	Returns:	TRUE to print, FALSE to not print
 	Purpose:	Brings up a print dialog
 
@@ -2535,7 +2539,7 @@
 
 ********************************************************************************************/
 
-BOOL CCPrintInfo::OnPreparePrinting()
+BOOL CCPrintInfo::OnPreparePrinting(BOOL bPrintSetupOnly /*=FALSE*/)
 {
 	// Zap any existing print dialog
 	if (pOurPD)
@@ -2556,6 +2560,45 @@
 
 	pCCDC = NULL;
 
+	// Bring up a native print setup dialog if possible
+	wxPrintFactory* factory = wxPrintFactory::GetFactory();
+
+	// Use the print dialog if we can
+	if (bPrintSetupOnly && factory->HasPrintSetupDialog())
+	{
+		// The print setup dialog should change the
+		// print data in-place if not cancelled.
+
+		wxDialog *dialog = factory->CreatePrintSetupDialog( NULL,
+															 &(pOurPD->GetPrintDialogData().GetPrintData()) );
+		if (dialog->ShowModal() == wxID_OK)
+		{
+PORTNOTE("printing", "don't do UpdatePrinterSettings")
+#ifndef EXCLUDE_FROM_XARALX
+			CCPrintDialog::UpdatePrinterSettings(pOurPD);
+#endif
+		}
+
+		// If we are to ignore the printer data (because the selected printer has been deleted, renamed, etc)
+		// then we must reset the global memory handles that hold the data, as the settings they contain
+		// no longer refer to a printer known by the host system
+		if (CCPrintDialog::IgnorePrintData())
+		{
+PORTNOTE("printing", "don't do FreeGlobalHandle")
+#ifndef EXCLUDE_FROM_XARALX
+			CCPrintDialog::FreeGlobalHandle(&m_hDevMode);
+			CCPrintDialog::FreeGlobalHandle(&m_hDevNames);
+#endif
+			CCPrintDialog::ResetIgnorePrintData();
+		}
+
+		dialog->Destroy();
+
+		delete pOurPD;
+		pOurPD = NULL;
+		return FALSE;
+	}
+
 	ResourceID ret = pOurPD->ShowModal();
 	if ( (ret == wxID_CANCEL) || !pOurPD->GetPrintDialogData().Ok())
 	{
@@ -2594,9 +2637,49 @@
 	return TRUE;
 }
 
+/********************************************************************************************
 
+>	BOOL CCPrintInfo::HasPrintSetup()
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	22/6/2006
+	Inputs:		-
+	Returns:	TRUE if a print setup dialog can be brought up
+	Purpose:	
+
+	SeeAlso:	-
+
+********************************************************************************************/
+
+BOOL CCPrintInfo::HasPrintSetup()
+{
+	wxPrintFactory* factory = wxPrintFactory::GetFactory();
+	return (factory->HasPrintSetupDialog());
+}
+
 /********************************************************************************************
 
+>	BOOL CCPrintInfo::LockProgressUpdate(BOOL Locked)
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	22/6/2006
+	Inputs:		Locked - to lock the progress update
+	Returns:	
+	Purpose:	Locks/Unlocks the print progress dialogue (if any) to make sure it doesn't
+				update the progress slider etc during some critical operation.
+
+	SeeAlso:	-
+
+********************************************************************************************/
+
+void CCPrintInfo::LockProgressUpdate(BOOL Locked)
+{
+	 if (pPrgDlg != NULL)
+		pPrgDlg->LockProgressUpdate(Locked);
+}
+
+/********************************************************************************************
+
 >	BOOL CCPrintInfo::StartPrinting()
 
 	Author:		Mark_Neves (Xara Group Ltd) <camelotdev@xxxxxxxx>
Index: Trunk/XaraLX/wxOil/camelot.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camelot.cpp	(revision 1362)
+++ Trunk/XaraLX/wxOil/camelot.cpp	(revision 1363)
@@ -130,6 +130,7 @@
 #include "camplatform.h"
 #include "filedlgs.h"
 #include "progress.h"
+#include "prdlgctl.h"
 #include "gbrush.h"
 
 #include "camprocess.h"
@@ -845,7 +846,33 @@
 	return wxApp::OnExit();
 }
 
+//  WEBSTER-ranbirr-12/11/96
+#ifndef WEBSTER
+void CCamApp::OnFilePrintSetup()
+{
+#ifndef STANDALONE
+	Document *pDoc = Document::GetSelected();
+	DocView *pDocView = DocView::GetSelected();
 
+	if (pDoc && pDocView && pDocView->GetConnectionToOilView())
+	{
+		// Inform the user if we have switched to using the default printer on the system
+		// before opening the print setup dlg.
+		CCPrintDialog::InformResetToDefaultPrinter(FALSE);
+	
+		// This no longer calls the base class OnFilePrint() function.
+		// Instead, we involke the print dlg ourselves so that we can update our
+		// printer settings when the dlg is closed via the user clicking on OK
+		// (7/4/95 - Markn)
+
+		CCPrintInfo printinfo(pDoc, pDocView->GetConnectionToOilView());
+		printinfo.OnPreparePrinting(TRUE);			
+	}
+	
+#endif
+}
+#endif
+
 void CCamApp::OnAppExit()
 {
 PORTNOTE("other","Removed multi-instance flag stuff")
@@ -1720,6 +1747,9 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 
+
+
+
 /*********************************************************************************************
 >	void CCamApp::OnFatalException()
 


Xara