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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1358
Date       : Sun Jun 25 13:51:38 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/cameleps.cpp
   M /Trunk/XaraLX/Kernel/layer.cpp
   M /Trunk/XaraLX/Kernel/main3.cpp
   M /Trunk/XaraLX/Kernel/nodebev.cpp
   M /Trunk/XaraLX/wxOil/Makefile.am
   M /Trunk/XaraLX/wxOil/prdlgctl.cpp
   M /Trunk/XaraLX/wxOil/printprg.cpp
   M /Trunk/XaraLX/wxOil/printprg.h
   M /Trunk/XaraLX/wxOil/xrc/EN/printdlg.xrc

More printing work


Diff:
Index: Trunk/XaraLX/Kernel/nodebev.cpp
===================================================================
--- Trunk/XaraLX/Kernel/nodebev.cpp	(revision 1357)
+++ Trunk/XaraLX/Kernel/nodebev.cpp	(revision 1358)
@@ -1837,7 +1837,6 @@
 	if(pRegion)
 		PixSize = pRegion->GetScaledPixelWidth();
 
-	PORTNOTETRACE("other","NodeBevel::CalculateBitmapSize - removed printing support");
 	if(Document::GetCurrent() && Document::GetCurrent()->GetFirstDocView()
 			 && !(pRegion && pRegion->IS_KIND_OF(PrintingMaskedRenderRegion))
 		)
Index: Trunk/XaraLX/Kernel/layer.cpp
===================================================================
--- Trunk/XaraLX/Kernel/layer.cpp	(revision 1357)
+++ Trunk/XaraLX/Kernel/layer.cpp	(revision 1358)
@@ -115,7 +115,7 @@
 //#include "rndrgn.h" - in camtypes.h [AUTOMATICALLY REMOVED]
 #include "nativeps.h"		// The old style EPS native filter, used in v1.1
 //#include "ben.h"
-//#include "prdlgctl.h"
+#include "prdlgctl.h"
 #include "printctl.h"
 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
 //#include "jason.h"
@@ -443,8 +443,6 @@
 		// Added this since we want to print what we see - might need looking at ?
 		return IsVisible() ? SUBTREE_ROOTANDCHILDREN : SUBTREE_NORENDER;
 
-PORTNOTE("printing","Layer::RenderSubtree - removed printing code  reference")
-#ifndef EXCLUDE_FROM_XARALX
 		// Otherwise, get the print control
 		
 		CCPrintInfo *pInfo = CCPrintInfo::GetCurrent();
@@ -465,7 +463,6 @@
 			// Print all foreground layers, regardless of visibility.
 			return SUBTREE_ROOTANDCHILDREN;
 		}
-#endif
 
 	}
 	else if (IS_A(pRender,CamelotEPSRenderRegion))
Index: Trunk/XaraLX/Kernel/main3.cpp
===================================================================
--- Trunk/XaraLX/Kernel/main3.cpp	(revision 1357)
+++ Trunk/XaraLX/Kernel/main3.cpp	(revision 1358)
@@ -159,6 +159,7 @@
 #include "viewcomp.h"
 #include "fontcomp.h"
 #include "prnmkcom.h"
+#include "printprg.h"
 #include "hlinkdlg.h"
 #include "strkcomp.h"
 #include "tmpltdlg.h"
@@ -245,6 +246,7 @@
 #endif			
 			CCamView::ReadViewPrefs() &&
 			PrintMonitor::InitPrefs() &&
+			PrintProgressDlg::Init() &&
 
 #ifndef EXCLUDE_FROM_XARALX
 			BaseBar::DeclarePreferences() &&
Index: Trunk/XaraLX/Kernel/cameleps.cpp
===================================================================
--- Trunk/XaraLX/Kernel/cameleps.cpp	(revision 1357)
+++ Trunk/XaraLX/Kernel/cameleps.cpp	(revision 1358)
@@ -141,7 +141,7 @@
 #include "nativeps.h"		// The old style EPS native filter, used in v1.1
 #include "psdc.h"
 #include "osrndrgn.h"
-//#include "prdlgctl.h"
+#include "prdlgctl.h"
 #include "progress.h"
 #include "textfuns.h"
 //#include "app.h" - in camtypes.h [AUTOMATICALLY REMOVED]
@@ -4410,8 +4410,6 @@
 		// Find destination device resolution (e.g. PostScript printer)
 		if (RenderDC!=NULL)
 			DestDpi = RenderDC->GetPPI().GetWidth();
-PORTNOTE("printing", "Exclude CCPrintInfo");
-#ifndef EXCLUDE_FROM_XARALX
 //	WEBSTER-ranbirr-12/11/96
 #ifndef WEBSTER
 		// If printing, then see if we should do level 2.
@@ -4430,7 +4428,6 @@
 			}
 		}
 #endif	//webster
-#endif
 	}
 
 	// Work out the ratio between to two
@@ -5219,8 +5216,6 @@
 		if (EPSFilter::XSEPSExportPSType == 2)
 			UseLevel2 = TRUE;
 	}
-PORTNOTE("printing", "Exclude CCPrintInfo");
-#ifndef EXCLUDE_FROM_XARALX
 //	WEBSTER-ranbirr-12/11/96
 #ifndef WEBSTER
 	else if (IsPrinting())
@@ -5241,7 +5236,6 @@
 	}
 
 #endif //webster
-#endif // EXCLUDE_FROM_XARALX
 
 	// Work out the coords of the destination rectangle
 //	INT32 DestX = 0;
Index: Trunk/XaraLX/wxOil/Makefile.am
===================================================================
--- Trunk/XaraLX/wxOil/Makefile.am	(revision 1357)
+++ Trunk/XaraLX/wxOil/Makefile.am	(revision 1358)
@@ -36,7 +36,7 @@
 	fontbase.cpp ftfonts.cpp textfuns.cpp dragbmp.cpp xpoilflt.cpp xmlutils.cpp \
 	camprocess.cpp dropdown.cpp coldrop.cpp fontdrop.cpp bfxalu.cpp bfxpixop.cpp \
 	binreloc.c exceptio.cpp colpick.cpp dragpick.cpp sgldrag.cpp cctime.cpp \
-	lddirect.cpp prncamvw.cpp prdlgctl.cpp psdc.cpp grndprnt.cpp \
+	lddirect.cpp prncamvw.cpp prdlgctl.cpp psdc.cpp grndprnt.cpp printprg.cpp \
 	resources.cpp
 
 # Keep resources.cpp on a separate line as it is odd
Index: Trunk/XaraLX/wxOil/prdlgctl.cpp
===================================================================
--- Trunk/XaraLX/wxOil/prdlgctl.cpp	(revision 1357)
+++ Trunk/XaraLX/wxOil/prdlgctl.cpp	(revision 1358)
@@ -105,7 +105,7 @@
 //#include "errors.h" - in camtypes.h [AUTOMATICALLY REMOVED]
 #include "prdlgctl.h"
 //#include "printdlg.h"
-//#include "printprg.h"
+#include "printprg.h"
 #include "princomp.h"
 #include "optsprin.h"
 //#include "fixmem.h" - in camtypes.h [AUTOMATICALLY REMOVED]
@@ -2487,12 +2487,9 @@
 		if (pOurPD != NULL)
 			delete pOurPD;
 
-PORTNOTE("printing", "Disabled print progress dialog")
-#ifndef EXCLUDE_FROM_XARALX
 		// Delete our print progress dialog
 		if (pPrgDlg != NULL)
-			delete pPrgDlg;
-#endif
+			pPrgDlg->Done(); // this deletes it
 	}
 
 	if (pCCDC)
@@ -2669,12 +2666,12 @@
 
 	ERROR3IF(pPrgDlg != NULL,"StartPrinting() called with non-NULL pPrgDlg. Did you call EndPrinting() last time?");
 
-PORTNOTE("printing", "Disabled print progress dialog")
-#ifndef EXCLUDE_FROM_XARALX
-	ControlHelper::InformModalDialogOpened();
 
+	OpDescriptor* pOpDesc = (OpDescriptor*)OpDescriptor::FindOpDescriptor( OPTOKEN_PRINT_PROGRESS );
+	if ( pOpDesc )
+		pOpDesc->Invoke();
 	// Create and initialise the print progress dialog
-	pPrgDlg = new PrintProgressDlg(pCCamView);
+	pPrgDlg = PrintProgressDlg::Get();
 	if (pPrgDlg == NULL)
 	{
 		pPrCtrl->EndPrinting();
@@ -2683,13 +2680,10 @@
 	}
 
 	//pPrgDlg->SetDocName(pDocument->GetTitle());
-	pPrgDlg->SetPrinterName(pOurPD->GetDeviceName());
-	pPrgDlg->SetPortName(pOurPD->GetPortName());
+	pPrgDlg->SetPrinterName(GetPrintData().GetPrinterName());
+	pPrgDlg->SetPortName(GetPrintData().GetPrinterCommand());
 	pPrgDlg->SetSliderPos(0);
 
-	pPrgDlg->Show();
-#endif
-
 	return TRUE;
 }
 
@@ -2722,19 +2716,13 @@
 	if (pMarksMan)
 		pMarksMan->EndPrinting();
 
-PORTNOTE("printing", "Disabled print progress dialog")
-#ifndef EXCLUDE_FROM_XARALX
 	// now destroy the print dialogue
 	if (pPrgDlg != NULL)
 	{
-		pPrgDlg->DestroyWindow();
-		delete pPrgDlg;
+		pPrgDlg->Done();
 		pPrgDlg = NULL;
 	}		
 
-	ControlHelper::InformModalDialogClosed();
-#endif
-
 	return (ok);
 }
 
@@ -2861,13 +2849,10 @@
 			}
 		}
 
-PORTNOTE("printing", "Disabled print progress dialog")
-#ifndef EXCLUDE_FROM_XARALX
 		// And set the page, plate, and tile numbers
 		pPrgDlg->SetPageNumber(	pPatchInfo->PaperNumber, pPatchInfo->MaxPaperNumber,
 								CurrentPlate, MaxPlates, (TCHAR *) PlateName,
 								pPatchInfo->PatchNumber, pPatchInfo->MaxPatchNumber);
-#endif
 
 	}
 
@@ -2949,11 +2934,8 @@
 
 void CCPrintInfo::SetSliderSubRangeMax(INT32 Max)
 {
-PORTNOTE("printing", "Disabled print progress dialog")
-#ifndef EXCLUDE_FROM_XARALX
 	if (pPrgDlg != NULL)
 		pPrgDlg->SetSliderSubRangeMax(Max);
-#endif
 }
 
 /********************************************************************************************
@@ -2979,11 +2961,8 @@
 
 void CCPrintInfo::SetSliderSubRangePos(INT32 Pos)
 {
-PORTNOTE("printing", "Disabled print progress dialog")
-#ifndef EXCLUDE_FROM_XARALX
 	if (pPrgDlg != NULL)
 		pPrgDlg->SetSliderSubRangePos(Pos);
-#endif
 }
 
 /********************************************************************************************
@@ -3005,15 +2984,12 @@
 
 void CCPrintInfo::SetAnalysing()
 {
-PORTNOTE("printing", "Disabled print progress dialog")
-#ifndef EXCLUDE_FROM_XARALX
 	if (pPrgDlg != NULL)
 	{
 		pPrgDlg->SetAnalysing();
 		if (pDocument != NULL)
 			pPrgDlg->SetDocName(pDocument->GetTitle());
 	}
-#endif
 }
 
 /********************************************************************************************
@@ -3034,15 +3010,12 @@
 
 void CCPrintInfo::SetPrinting()
 {
-PORTNOTE("printing", "Disabled print progress dialog")
-#ifndef EXCLUDE_FROM_XARALX
 	if (pPrgDlg != NULL)
 	{
 		pPrgDlg->SetPrinting();
 		if (pDocument != NULL)
 			pPrgDlg->SetDocName(pDocument->GetTitle());
 	}
-#endif
 }
 
 /********************************************************************************************
@@ -3061,7 +3034,7 @@
 
 INT32 CCPrintInfo::SetAbortProc(CDC* pCDC)
 {
-PORTNOTE("printing", "Disabled print progress dialog")
+PORTNOTE("printing", "Disabled SetAbortProc bits")
 #ifndef EXCLUDE_FROM_XARALX
 	ERROR2IF(pCDC == NULL,SP_ERROR,"Given NULL CDC ptr");
 
@@ -3091,12 +3064,7 @@
 
 BOOL CCPrintInfo::Abort()
 {
-PORTNOTE("printing", "Disabled print progress dialog")
-#ifndef EXCLUDE_FROM_XARALX
-	return (!PrintProgressDlg::AbortProc(0,0));
-#else
-	return FALSE;
-#endif
+	return PrintProgressDlg::AbortProc();
 }
 
 /********************************************************************************************
Index: Trunk/XaraLX/wxOil/printprg.h
===================================================================
--- Trunk/XaraLX/wxOil/printprg.h	(revision 1357)
+++ Trunk/XaraLX/wxOil/printprg.h	(revision 1358)
@@ -104,7 +104,7 @@
 #ifndef INC_PRINTPRG
 #define INC_PRINTPRG
 
-struct DOCINFO;
+#define OPTOKEN_PRINT_PROGRESS _T("PrintProgress")
 
 /********************************************************************************************
 
@@ -120,16 +120,25 @@
 
 ********************************************************************************************/
 
-class PrintProgressDlg : public Dialog
+class PrintProgressDlg : public DialogOp
 {
+	CC_DECLARE_DYNCREATE( PrintProgressDlg )  
 public:
-	PrintProgressDlg::PrintProgressDlg(CWnd* pParent);
+	PrintProgressDlg::PrintProgressDlg();
 	virtual ~PrintProgressDlg() { pPrintProgressDlg = NULL; }
 
+	MsgResult Message( Msg* Message );  
+	void Do(OpDescriptor*);		// "Do" function        
+	static BOOL Init();
+	static OpState GetState(String_256*, OpDescriptor*);	
 
+	static const UINT32 IDD;
+	static const CDlgMode Mode;
+	static BOOL Aborted;
+
 public:
-	virtual BOOL OnInitDialog();
-	virtual void OnCancel();
+//	virtual BOOL OnInitDialog();
+//	virtual void OnCancel();
 
 	void SetSliderMax(INT32 max);
 	void SetSliderPos(INT32 pos);
@@ -139,7 +148,6 @@
 
 
 public:
-	void Show();
 	void SetDocName(LPCTSTR pDocName);
 	void SetPrinterName(LPCTSTR pPrinterName);
 	void SetPortName(LPCTSTR pPortName);
@@ -150,6 +158,8 @@
 	// While the dlg is Locked, calls to SetPageNumber functions will be ignored
 	void LockProgressUpdate(BOOL Locked) { IgnoreUpdates = Locked; }
 
+	void Done() {Close(); End();}
+
 public:
 	void SetAnalysing()	{ Printing = FALSE; }
 	void SetPrinting()  { Printing = TRUE;  }
@@ -169,10 +179,13 @@
 
 public:
 	// The call back function for the print dialog.
-	static BOOL CALLBACK AbortProc(HDC, INT32);
+	static BOOL AbortProc();
 
 private:
 	static PrintProgressDlg* pPrintProgressDlg;		// Ptr to dlg used by AbortProc()
+
+public:
+	static PrintProgressDlg * Get() {return pPrintProgressDlg;}
 };
 
 
Index: Trunk/XaraLX/wxOil/xrc/EN/printdlg.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/printdlg.xrc	(revision 1357)
+++ Trunk/XaraLX/wxOil/xrc/EN/printdlg.xrc	(revision 1358)
@@ -222,9 +222,9 @@
 			<label>0%</label>
 			<style>wxALIGN_CENTRE</style>
 		</object>
-		<object class="wxSlider" name="IDC_PRINTPROGSLIDER">
+		<object class="wxGauge" name="IDC_PRINTPROGSLIDER">
 			 <pos>6,58d</pos> <size>146,10d</size>
-			<style>wxSL_HORIZONTAL</style>
+			<style>wxGA_HORIZONTAL</style>
 		</object>
 		<object class="wxStaticBox" name="IDC_STATIC">
 			 <pos>24,200d</pos> <size>100,0d</size>
Index: Trunk/XaraLX/wxOil/printprg.cpp
===================================================================
--- Trunk/XaraLX/wxOil/printprg.cpp	(revision 1357)
+++ Trunk/XaraLX/wxOil/printprg.cpp	(revision 1358)
@@ -109,7 +109,7 @@
 #include "printprg.h"
 //#include "printdlg.h"
 //#include "errors.h" - in camtypes.h [AUTOMATICALLY REMOVED]
-#include "custmsg.h"
+//#include "custmsg.h"
 //#include "markn.h"
 //#include "simon.h"
 //#include "andy.h"
@@ -119,80 +119,165 @@
 
 DECLARE_SOURCE("$Revision$");
 
+CC_IMPLEMENT_DYNCREATE(PrintProgressDlg, DialogOp)
+
 #define new CAM_DEBUG_NEW
 
+const CDlgMode PrintProgressDlg::Mode = MODELESS ;// Mode of the dialog
+const UINT32 PrintProgressDlg::IDD = _R(IDD_PRINTPROGRESS);
+BOOL PrintProgressDlg::Aborted = FALSE;
 PrintProgressDlg* PrintProgressDlg::pPrintProgressDlg = NULL;
 
 const INT32 SLIDER_MAX = 0x08000000;
 
-// Fix for MFC4 - names are missing or slightly changed so we replace them as for MFC3.
-#ifndef AfxGetWinState
-#define AfxGetWinState() _afxWinState
-#define AFX_WIN_STATE _AFX_WIN_STATE
-#endif
+/********************************************************************************************
 
+>	PrintProgressDlg::PrintProgressDlg()
 
-//--------------------------------------------
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	14/06/2006
+	Inputs:		-
+	Returns:	-
+	Purpose:	Constructs the dlg.
+	SeeAlso:	-
 
-PrintProgressDlg::PrintProgressDlg(CWnd* pParent)
+********************************************************************************************/
+
+
+PrintProgressDlg::PrintProgressDlg(): DialogOp(PrintProgressDlg::IDD, PrintProgressDlg::Mode)
 {
-	// Init variables to semi-sensible defaults
+	if (pPrintProgressDlg)
+	{
+		pPrintProgressDlg->Done();
+		pPrintProgressDlg = NULL;
+	}
+
 	SliderMax = SLIDER_MAX;
 	SliderCurPercent = -1;
 	SliderSubRangeMax = SLIDER_MAX;
 	SliderSubRangeBase = 0;
 	SliderSubRangeStep = 1;
 
-
-	Create(_R(IDD_PRINTPROGRESS), pParent);      // modeless !
-#ifndef RALPH
-	AfxGetWinState()->m_bUserAbort = FALSE;
-#endif
-
-	ERROR3IF(pPrintProgressDlg != NULL,"Static pPrintProgressDlg is NOT NULL");
 	pPrintProgressDlg = this;
 
-	SetSliderMax(SLIDER_MAX);
-	SetSliderPos(0);
 	Printing = FALSE;
 	IgnoreUpdates = FALSE;
+	Aborted = FALSE;
 }
 
-//--------------------------------------------
 
-BOOL PrintProgressDlg::OnInitDialog()
+/********************************************************************************************
+
+>	BOOL PrintProgressDlg::Do(OpDescriptor*)
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	14/06/2006
+	Inputs:		-
+	Returns:	TRUE if OK, FALSE otherwise
+	Purpose:	Inits the dialog's controls, and calls the base classes OnInitDialog() function
+	SeeAlso:	-
+
+********************************************************************************************/
+
+void PrintProgressDlg::Do(OpDescriptor*)
 {
-//	SetWindowText(AfxGetAppName());		-- no, "Printing" is a better title than "Camelot", thanks... 
-	CenterWindow();
-	IgnoreUpdates = FALSE;
-	return CDialog::OnInitDialog();
+	Create();
+	Open();
 }
 
-//--------------------------------------------
+/********************************************************************************************
 
-void PrintProgressDlg::OnCancel()
+>	BOOL PrintProgressDlg::GetState(String_256*, OpDescriptor*)
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	14/06/2006
+	Inputs:		-
+	Returns:	TRUE if OK, FALSE otherwise
+	Purpose:	Inits the dialog's controls, and calls the base classes OnInitDialog() function
+	SeeAlso:	-
+
+********************************************************************************************/
+
+OpState	PrintProgressDlg::GetState(String_256*, OpDescriptor*)
 {
-	if (CCamApp::DisableSys)
-		return;
+	OpState OpSt;
+	return(OpSt);
+}
 
-#ifndef RALPH
-	if (!AfxGetWinState()->m_bUserAbort)
+/********************************************************************************************
+
+>	BOOL PrintProgressDlg::PrintProgressDlg::Init()
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	14/06/2006
+	Inputs:		-
+	Returns:	TRUE if OK, FALSE otherwise
+	Purpose:	Inits the dialog's controls, and calls the base classes OnInitDialog() function
+	SeeAlso:	-
+
+********************************************************************************************/
+
+BOOL PrintProgressDlg::Init()
+{
+	return (RegisterOpDescriptor(
+									0,
+									_R(IDD_PRINTPROGRESS),
+									CC_RUNTIME_CLASS(PrintProgressDlg),
+									OPTOKEN_PRINT_PROGRESS,
+									PrintProgressDlg::GetState,
+									0,	/* help ID */
+									0, 	/* bubble help*/
+									0	/* bitmap ID */
+									));
+}
+
+/********************************************************************************************
+
+>	MsgResult PrintProgressDlg::Message( Msg* Message)
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	14/06/2006
+	Inputs:		-
+	Returns:	-
+	Purpose:	Overrides the default OnOK() func so that we can check the values set by the user.
+				If dodgy values have been put in, the user is warned.
+	SeeAlso:	-
+
+********************************************************************************************/
+
+MsgResult PrintProgressDlg::Message( Msg* Message)
+{
+	if (IS_OUR_DIALOG_MSG(Message))
 	{
-		INT32 b = InformWarning(_R(IDS_PRINT_SUSPEND),_R(IDS_ABORT),_R(IDS_CONTINUE));
-
-		if (b == 1)
+		DialogMsg* Msg = (DialogMsg*)Message;
+		// Handle ok button
+		if (Msg->DlgMsg == DIM_CREATE)
 		{
-			AfxGetWinState()->m_bUserAbort = TRUE;  // flag that user aborted print
-			CDialog::OnCancel();
+			SetSliderMax(SLIDER_MAX);
+			SetSliderPos(0);
+			IgnoreUpdates = FALSE;
 		}
+		else if (Msg->DlgMsg == DIM_CANCEL)
+		{
+			if (CCamApp::IsDisabled())
+				return OK;
+
+			INT32 b = InformWarning(_R(IDS_PRINT_SUSPEND),_R(IDS_ABORT),_R(IDS_CONTINUE));
+	
+			if (b == 1)
+			{
+				Aborted = TRUE;
+			}
+			return OK; // Do not pass to the base class as this will destroy the dialog - we do that elsewhere
+		}
 	}
-	else
-#endif
-	{
-		CDialog::OnCancel();
-	}
+	return DialogOp::Message(Message);
 }
 
+
+
+
+
 //--------------------------------------------
 
 void PrintProgressDlg::SetSliderMax(INT32 max)
@@ -200,13 +285,7 @@
 	SliderMax 	  	 = max;
 	SliderCurPercent = -1;
 
-	CWnd* pGadget = GetDlgItem(_R(IDC_PRINTPROGSLIDER));
-	
-	if (pGadget != NULL)
-	{
-		::SendMessage(pGadget->GetSafeHwnd(),WM_SET_MIN,0,LPARAM(0));
-		::SendMessage(pGadget->GetSafeHwnd(),WM_SET_MAX,0,LPARAM(max));
-	}
+	SetGadgetRange(_R(IDC_PRINTPROGSLIDER), 0, max);
 }
 
 //--------------------------------------------
@@ -230,17 +309,11 @@
 	{
 		SliderCurPercent = p;
 
-		CWnd* pGadget = GetDlgItem(_R(IDC_PRINTPROGSLIDER));
+		SetLongGadgetValue(_R(IDC_PRINTPROGSLIDER), (INT32)pos);
 	
-		if (pGadget != NULL)
-		{
-			::SendMessage(pGadget->GetSafeHwnd(),WM_SET_POSITION,0,LPARAM(pos));
-			::SendMessage(pGadget->GetSafeHwnd(),WM_PAINT,0,0);
-		}
-
 		String_32 Percent;
 		Percent.MakeMsg(_R(IDS_PRINT_PROG_PERCENT), (INT32) p);
-		SetDlgItemText(_R(IDC_CURRENTPERCENTAGE), (TCHAR *)Percent);
+		SetStringGadgetValue(_R(IDC_CURRENTPERCENTAGE), Percent);
 	}
 }
 
@@ -266,18 +339,10 @@
 
 //--------------------------------------------
 
-void PrintProgressDlg::Show()
-{
-	ShowWindow(SW_SHOW);
-	UpdateWindow();
-}
-
-//--------------------------------------------
-
 void PrintProgressDlg::SetDocName(LPCTSTR pDocName)
 {
 	if (pDocName != NULL)
-		SetDlgItemText(_R(IDC_DOCNAME),  (TCHAR*)pDocName);
+		SetStringGadgetValue(_R(IDC_DOCNAME), String_256(pDocName));
 }
 
 //--------------------------------------------
@@ -285,7 +350,7 @@
 void PrintProgressDlg::SetPrinterName(LPCTSTR pPrinterName)
 {
 	if (pPrinterName != NULL)
-		SetDlgItemText(_R(IDC_PRINTERNAME), pPrinterName);
+		SetStringGadgetValue(_R(IDC_PRINTERNAME), String_256(pPrinterName));
 }
 
 //--------------------------------------------
@@ -296,7 +361,7 @@
 // really very useful info, so we've removed it to simplify the dialog
 //
 //	if (pPortName != NULL)
-//		SetDlgItemText(_R(IDC_PORTNAME), pPortName);
+//		SetStringGadgetValue(_R(IDC_PORTNAME), String_256(pPortName));
 }
 
 //--------------------------------------------
@@ -337,7 +402,7 @@
 
 	// Set the page info
 	Str.MakeMsg(_R(IDS_PRINT_PROG_PAGE), PageNumber, MaxPageNumber);
-	SetDlgItemText(_R(IDC_PAGENUMBER), (TCHAR*)Str);
+	SetStringGadgetValue(_R(IDC_PAGENUMBER), Str);
 
 
 	// Set the plate info
@@ -346,23 +411,18 @@
 	else
 		Str.MakeMsg(_R(IDS_PRINT_PROG_COMPOSITE));
 
-	SetDlgItemText(_R(IDC_PLATENUMBER), (TCHAR *)Str);
+	SetStringGadgetValue(_R(IDC_PLATENUMBER), Str);
 
 
 	// Set the tile info
 	if (MaxTileNumber > 1)
 	{
 		Str.MakeMsg(_R(IDS_PRINT_PROG_TILE), TileNumber, MaxTileNumber);
-		SetDlgItemText(_R(IDC_TILENUMBER), (TCHAR *)Str);
+		SetStringGadgetValue(_R(IDC_TILENUMBER), Str);
 	}
 
-	// If there is no tile info, we hide both the tile gadgets
-	CWnd *Gadget = GetDlgItem(_R(IDC_TILETITLE));
-	if (Gadget)
-		Gadget->ShowWindow((MaxTileNumber <= 1) ? SW_HIDE : SW_SHOWNORMAL);
-	Gadget = GetDlgItem(_R(IDC_TILENUMBER));
-	if (Gadget)
-		Gadget->ShowWindow((MaxTileNumber <= 1) ? SW_HIDE : SW_SHOWNORMAL);
+	HideGadget(_R(IDC_TILETITLE), (MaxTileNumber <= 1));
+	HideGadget(_R(IDC_TILENUMBER), (MaxTileNumber <= 1));
 
 	// Make sure we don't get a div by zero or a nasty negative in the calculations below
 	if (MaxPageNumber < 1)		MaxPageNumber = 1;
@@ -387,53 +447,18 @@
 }
 
 
-
 //--------------------------------------------
 //--------------------------------------------
 
-BOOL CALLBACK PrintProgressDlg::AbortProc(HDC,INT32 code)
+BOOL PrintProgressDlg::AbortProc()
 {
-	if (CCamApp::DisableSys)
+	if (CCamApp::IsDisabled() || !pPrintProgressDlg)
 		// Ignore
 		return TRUE;
 
-#ifndef RALPH
-	AFX_WIN_STATE* pWinState = AfxGetWinState();
-	MSG msg;
+	::wxSafeYield(pPrintProgressDlg->WindowID, TRUE);
+	return Aborted;
+}
 
-   	while (!pWinState->m_bUserAbort &&
-   		::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 
-   	{
-		// Do we have a printing dialog?
-		if (pPrintProgressDlg != NULL)
-		{
-	        // Yes - process any messages for the Cancel dialog box.
-	        if (!pPrintProgressDlg->IsDialogMessage(&msg)) 
-    	    {
-        	    TranslateMessage((LPMSG) &msg);
-            	DispatchMessage((LPMSG) &msg);
-	        }
-		}
-		else
-		{
-			TranslateMessage((LPMSG) &msg);
-			DispatchMessage((LPMSG) &msg);
-		}
-    }
 
-	// If the code is 0, there's no error, otherwise an error has occurred.
-	// The error could be a SP_USERABORT generated from the print manager
-	if (code != NULL && !pWinState->m_bUserAbort)
-	{
-		pWinState->m_bUserAbort = TRUE;
-		if (pPrintProgressDlg != NULL)
-			pPrintProgressDlg->EndDialog(IDCANCEL);
-	}		
-
-	return !pWinState->m_bUserAbort;
-#else
-	return TRUE;
-#endif
-}
-
 #endif //webster


Xara