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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1359
Date       : Sun Jun 25 15:46:22 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/statline.cpp
   M /Trunk/XaraLX/wxOil/camview.cpp
   M /Trunk/XaraLX/wxOil/printprg.cpp
   M /Trunk/XaraLX/wxOil/rendwnd.cpp

Fix up print progress dialog


Diff:
Index: Trunk/XaraLX/Kernel/statline.cpp
===================================================================
--- Trunk/XaraLX/Kernel/statline.cpp	(revision 1358)
+++ Trunk/XaraLX/Kernel/statline.cpp	(revision 1359)
@@ -129,6 +129,7 @@
 #include "colormgr.h"
 #include "opimgset.h"
 #include "camview.h"
+#include "prncamvw.h"
 
 DECLARE_SOURCE("$Revision$");
 
@@ -272,6 +273,9 @@
 
 BOOL StatusLine::OnIdleEvent()
 {
+	if (PrintMonitor::IsPrintingNow())
+		return FALSE;
+
 	// Don't do any status line updates if the timer is running
 	if (!m_Timer.IsRunning())
 	{
Index: Trunk/XaraLX/wxOil/rendwnd.cpp
===================================================================
--- Trunk/XaraLX/wxOil/rendwnd.cpp	(revision 1358)
+++ Trunk/XaraLX/wxOil/rendwnd.cpp	(revision 1359)
@@ -106,7 +106,7 @@
 //#include "ensure.h" - in camtypes.h [AUTOMATICALLY REMOVED]
 //#include "palman.h"
 #include "ccdc.h"
-//#include "prncamvw.h"
+#include "prncamvw.h"
 //#include "docview.h" - in camtypes.h [AUTOMATICALLY REMOVED]
 #include "camview.h"
 #include "camframe.h"
@@ -322,12 +322,7 @@
 **********************************************************************************************/ 
 void CRenderWnd::OnPaint( wxPaintEvent &evnt )
 {
-#ifndef EXCLUDE_FROM_XARALX
 	if ((!CCamApp::IsDisabled()) && (!PrintMonitor::IsPrintingNow()))
-#else
-	// print monitor not present on standalone versions
-	if (!CCamApp::IsDisabled())
-#endif
 	{
 		CCPaintDC dc(this);
 //		wxPalette* OldPal = PaletteManager::StartPaintPalette(&dc);
@@ -339,37 +334,29 @@
 	}
 	else
 	{
-#ifndef EXCLUDE_FROM_XARALX
 		// if we were printing, we have to draw something - white will do
 		if (PrintMonitor::IsPrintingNow())
 		{
-/*				// Draw a white rectangle here
-			CPaintDC MyPaint(this);
+			// Draw a white rectangle here
+			wxPaintDC MyPaint(this);
 
 			// Lets have a white brush...
-			CBrush WhiteBrush;
-			WhiteBrush.CreateStockObject(WHITE_BRUSH);
-			CBrush* pOldBrush = MyPaint.SelectObject(&WhiteBrush);
+			MyPaint.SetBrush(wxBrush(wxColour(*wxWHITE)));
+			MyPaint.SetPen(*wxTRANSPARENT_PEN);
 
-			// and no pen please
-			CPen NoPen;
-			NoPen.CreateStockObject(NULL_PEN);
-			CPen* pOldPen = MyPaint.SelectObject(&NoPen);
-		
-			// Draw the rect.
-			CRect RedrawRect(&MyPaint.m_ps.rcPaint);
-			RedrawRect.InflateRect(2,2);
-			MyPaint.Rectangle(RedrawRect);
+			wxRegionIterator upd(GetUpdateRegion()); // get the update rect list
 
-			// Put the old brush and pen back
-			MyPaint.SelectObject(pOldPen);
-			MyPaint.SelectObject(pOldBrush);
-			
-			// ask for a full redraw at the end
-			PrintMonitor::WantFullRedraw(TRUE); */
+			while (upd)
+			{
+				wxRect rect(upd.GetRect());
+				MyPaint.DrawRectangle(rect);
+				upd++;
+			}
+
+  			// ask for a full redraw at the end
+			PrintMonitor::WantFullRedraw(TRUE);
 		}
 		else
-#endif
 		{
 			wxPaintDC dc( this );								// Clear paint condition 
 		}
Index: Trunk/XaraLX/wxOil/camview.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camview.cpp	(revision 1358)
+++ Trunk/XaraLX/wxOil/camview.cpp	(revision 1359)
@@ -901,7 +901,6 @@
 		return;
 	}
 
-
 	// Make sure the user can't get 2 print dialog boxes up
 	PrintMonitor::SetPrintingActive(TRUE);
 
@@ -914,6 +913,13 @@
 		return;
 	}
 
+	// Get some paints out of the way
+	::wxSafeYield(FALSE);
+
+	// Ensure the current documents remain the same
+	KernelDoc->SetCurrent();
+	pDocView->SetCurrent();
+
 	List CompoundNodeList;
 	NodeCompound * pCompound = NULL;
 	NodeListItem * pItem = NULL;
@@ -1378,6 +1384,9 @@
 		pPrintView = NULL;
 	}
 
+	// Deleting the print view appears to unset the current document, so fix it
+	KernelDoc->SetCurrent();
+	pDocView->SetCurrent();
 
 	if (pPrintInfo)
 	{
Index: Trunk/XaraLX/wxOil/printprg.cpp
===================================================================
--- Trunk/XaraLX/wxOil/printprg.cpp	(revision 1358)
+++ Trunk/XaraLX/wxOil/printprg.cpp	(revision 1359)
@@ -314,6 +314,8 @@
 		String_32 Percent;
 		Percent.MakeMsg(_R(IDS_PRINT_PROG_PERCENT), (INT32) p);
 		SetStringGadgetValue(_R(IDC_CURRENTPERCENTAGE), Percent);
+		PaintGadgetNow(_R(IDC_CURRENTPERCENTAGE));
+		PaintGadgetNow(_R(IDC_PRINTPROGSLIDER));
 	}
 }
 
@@ -342,7 +344,10 @@
 void PrintProgressDlg::SetDocName(LPCTSTR pDocName)
 {
 	if (pDocName != NULL)
+	{
 		SetStringGadgetValue(_R(IDC_DOCNAME), String_256(pDocName));
+		PaintGadgetNow(_R(IDC_DOCNAME));
+	}
 }
 
 //--------------------------------------------
@@ -350,7 +355,10 @@
 void PrintProgressDlg::SetPrinterName(LPCTSTR pPrinterName)
 {
 	if (pPrinterName != NULL)
+	{
 		SetStringGadgetValue(_R(IDC_PRINTERNAME), String_256(pPrinterName));
+		PaintGadgetNow(_R(IDC_PRINTERNAME));
+	}
 }
 
 //--------------------------------------------
@@ -361,7 +369,11 @@
 // really very useful info, so we've removed it to simplify the dialog
 //
 //	if (pPortName != NULL)
+//	{
 //		SetStringGadgetValue(_R(IDC_PORTNAME), String_256(pPortName));
+//		PaintGadgetNow(_R(IDC_PORTNAME));
+//	}
+
 }
 
 //--------------------------------------------
@@ -403,8 +415,8 @@
 	// Set the page info
 	Str.MakeMsg(_R(IDS_PRINT_PROG_PAGE), PageNumber, MaxPageNumber);
 	SetStringGadgetValue(_R(IDC_PAGENUMBER), Str);
+	PaintGadgetNow(_R(IDC_PORTNAME));
 
-
 	// Set the plate info
 	if (MaxPlateNumber > 0 && pPlateName != NULL)
 		Str.MakeMsg(_R(IDS_PRINT_PROG_PLATE), PlateNumber, MaxPlateNumber, pPlateName);
@@ -412,8 +424,8 @@
 		Str.MakeMsg(_R(IDS_PRINT_PROG_COMPOSITE));
 
 	SetStringGadgetValue(_R(IDC_PLATENUMBER), Str);
+	PaintGadgetNow(_R(IDC_PLATENUMBER));
 
-
 	// Set the tile info
 	if (MaxTileNumber > 1)
 	{
@@ -423,6 +435,8 @@
 
 	HideGadget(_R(IDC_TILETITLE), (MaxTileNumber <= 1));
 	HideGadget(_R(IDC_TILENUMBER), (MaxTileNumber <= 1));
+	PaintGadgetNow(_R(IDC_TILETITLE));
+	PaintGadgetNow(_R(IDC_TILENUMBER));
 
 	// Make sure we don't get a div by zero or a nasty negative in the calculations below
 	if (MaxPageNumber < 1)		MaxPageNumber = 1;
@@ -456,7 +470,15 @@
 		// Ignore
 		return TRUE;
 
+	pPrintProgressDlg->PaintGadgetNow(0);
+
+	// Save current doc view etc. around yield as paint can destroy them.
+	DocView * pCurrentDocView = DocView::GetCurrent();
+	Document * pCurrentDocument = Document::GetCurrent();
 	::wxSafeYield(pPrintProgressDlg->WindowID, TRUE);
+	pCurrentDocument->SetCurrent();
+	pCurrentDocView->SetCurrent();
+
 	return Aborted;
 }
 


Xara