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

[XaraXtreme-commits] Commit Complete



Commit by  : gerry
Repository : xara
Revision   : 1114
Date       : Thu May 18 12:56:17 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/camview.cpp
   M /Trunk/XaraLX/wxOil/xpoilflt.cpp

Fixed issue with loaded files not rendering correctly when wxYield is called during the load and reenabled plugin filter HowCompatible function


Diff:
Index: Trunk/XaraLX/wxOil/xpoilflt.cpp
===================================================================
--- Trunk/XaraLX/wxOil/xpoilflt.cpp	(revision 1113)
+++ Trunk/XaraLX/wxOil/xpoilflt.cpp	(revision 1114)
@@ -346,9 +346,6 @@
 
 	// Check stderr for errors
 	// Get HowCompatible from stdout
-// This currently causes file loading to get upset due to problems with the view being 
-// initialised too early (during the wxExecute)
-#if FALSE
 	if (!m_CanImport.IsEmpty())
 	{
 		wxString sCommand(m_CanImport);
@@ -383,7 +380,7 @@
 			TRACE(_T("Command '%s' exited with code %d"), sCommand.c_str(), code);
 		}
 	}
-#endif
+
 	return(HowCompatible);
 }
 
Index: Trunk/XaraLX/wxOil/camview.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camview.cpp	(revision 1113)
+++ Trunk/XaraLX/wxOil/camview.cpp	(revision 1114)
@@ -396,8 +396,16 @@
     m_pFrame->SetSize(wxDefaultCoord, wxDefaultCoord, width, height);
 #endif
     m_pFrame->Show(true);
-    Activate(true);
 
+	// This has been removed as it causes the problem where loaded documents
+	// don't render correctly if a wxYield happens before the document has 
+	// finished loading.  It may be possible to rewrite the handling in this 
+	// class so that the order of activation and OnInitialUpdate is not important 
+	// but efforts so far have been in vain.
+	// The view seems to be activated correctly in any case so hopefully it 
+	// should not be necessary
+//	Activate(true);
+
 	TRACEUSER("Gerry", _T("Leaving CCamView::OnCreate at 0x%08x
"), this);
 
     return true;
@@ -775,45 +783,6 @@
 
 			upd ++ ;
 		}
-
-#if FALSE
-		// Find out from the display context the rectangle bounding the invalid
-		// region.  If we can, try to use lists of rectangles.
-		wxRect		   *lpRect;
-		UINT32			count = CCDC::GetRectangleList( pDC, &lpRect );
-
-		TRACEUSER("Gerry", _T("CCamView::OnDraw called with %d regions
"), count);
-
-		// If there's more than one rectangle then iterate through them all...
-		if (count > 1)
-		{
-			while (count--)
-			{
-				clip.x		= lpRect->x;
-				clip.x		= lpRect->y;
-				clip.width  = lpRect->width;
-				clip.height = lpRect->height;
-
-				DumpRect( pDC, &clip, "camrect1" );
-
-				pDocView->OnDraw( pDC, clip.ToOil(pDocView) );
-				lpRect++;
-			}
-		}
-		else
-		{
-			//TRACE( _T("CCamView::OnDraw doing simple rectangle stuff"));
-			
-			// . . . else handle the simple <2 rectangle code
-			pDC->GetClippingBox( clip );
-			if( !clip.IsEmpty() )
-			{
-				// Pass the drawing parameters on to the associated DocView object.
-				DumpRect( pDC, &clip, "camrect2" );
-				pDocView->OnDraw( pDC, clip.ToOil(pDocView) );
-			}
-		}
-#endif
 	}
 
 //	TRACEUSER("Gerry", _T("Leaving CCamView::OnDraw
"));
@@ -1264,6 +1233,7 @@
 
 void CCamView::OnUpdate(wxView* sender, wxObject* hint)
 {
+	TRACEUSER("Gerry", _T("CCamView::OnUpdate
"));
 	if ( sender==NULL && !fInitialUpdate )
 	{
 		OnInitialUpdate();
@@ -1279,6 +1249,7 @@
 //
 void CCamView::OnInitialUpdate()
 {
+	TRACEUSER("Gerry", _T("CCamView::OnInitialUpdate
"));
 	// Set up current etc.
 	SetCurrentStates();
 
@@ -1287,6 +1258,8 @@
 	// this view according to that.
 	if (pReadyMadeViewState != NULL)
 	{
+		TRACEUSER("Gerry", _T("Got pReadyMadeViewState
"));
+
 		// Set the flags saved in temp. storage in the ViewState in the corresponding
 		// DocView.
 		DocView* pdv = GetDocViewPtr();
@@ -1396,9 +1369,9 @@
 #endif
 #endif
 
-	// Make sure the render window is repainted and inform the kernel that something
+	// Make sure the render window gets repainted and inform the kernel that something
 	// has happened.
-//	InvalidateView();
+	GetRenderWindow()->Refresh(false);
 	pDocView->ViewStateChanged();
 
 	// Indicate that we have set the position, size, focus etc so OnActivateView is safe
@@ -1534,6 +1507,8 @@
 
 void CCamView::SetViewStateFromThis() const
 {
+	TRACEUSER("Gerry", _T("SetViewStateFromThis
"));
+
 	// Set the current docview.
 	pDocView->SetCurrent();
 
@@ -1582,7 +1557,9 @@
 
 void CCamView::SetThisFromViewState()
 {
-	PORTNOTETRACE("other","CCamView::SetThisFromViewState - do nothing");
+	TRACEUSER("Gerry", _T("SetThisFromViewState
"));
+
+	PORTNOTE("other","CCamView::SetThisFromViewState - do nothing");
 #ifndef EXCLUDE_FROM_XARALX
 	// Get a pointer to this view's frame window.
 	wxMDIChildFrame	   *pframewnd = (wxMDIChildFrame *)GetParentFrame();
@@ -1617,11 +1594,14 @@
 
 	Coord2POINT(Status->IconPoint, &wp.ptMinPosition);
 	Rect2RECT(Status->ViewRect, &wp.rcNormalPosition);
-	
+
 	//RALPH
 	if(pframewnd)
 		pframewnd->SetWindowPlacement(&wp);
-	
+#endif
+
+	// Needs to set the window position and size
+
 	// Set the scroll offset.
 	OldOffset = Status->GetScrollPos();
 	SetScrollOffset(OldOffset);
@@ -1629,6 +1609,8 @@
     // Set the scale factor.
 	pDocView->SetViewScale(Status->ViewScale);
 
+	PORTNOTE("other","CCamView::SetThisFromViewState - do nothing");
+#ifndef EXCLUDE_FROM_XARALX
 	// If the view was "always on top" then fake a user selection of the appropriate
 	// menu option.
 	// RALPH
@@ -1656,8 +1638,10 @@
 
 void CCamView::UpdateViewPosition() const
 {
-//	TRACEUSER("Gerry", _T("CCamView::UpdateViewPosition
"));
+	TRACEUSER("Gerry", _T("CCamView::UpdateViewPosition
"));
 
+	ENSURE(Status != NULL, "No ViewState object in CCamView::UpdateViewPosition!");
+
 	wxRect rc;
 	wxFrame* pFrame = GetParentFrame();
 	if(pFrame)
@@ -1677,7 +1661,9 @@
 	// stored as it always fills the whole MDI client area of its parent.
 	wxRect2Rect(rc, &Status->ViewRect);
 
-	PORTNOTETRACE("other","CCamView::UpdateViewPosition - do nothing");
+	Status->IsMinimised = Status->IsMaximised = FALSE;
+
+	PORTNOTE("other","CCamView::UpdateViewPosition - removed GetWindowPlacement");
 #ifndef EXCLUDE_FROM_XARALX
 	ENSURE(Status != NULL, "No ViewState object in CCamView::UpdateViewPosition!");
 
@@ -1759,8 +1745,11 @@
 
 	// call OnSize directly to force new layout	
 	wxSize Size;
-	m_pFrame->GetClientSize(&Size.x, &Size.y);
+	m_pFrame->GetSize(&Size.x, &Size.y);
 	TRACEUSER("Gerry", _T("Force an OnSize here (%d, %d)
"), Size.x, Size.y);
+
+	wxSizeEvent evSize(Size, 0);
+	OnSize(evSize);
 }
 
 
@@ -2761,7 +2750,7 @@
 
 void CCamView::OnSize( wxSizeEvent &event )
 {
-//	TRACEUSER("Gerry", _T("CCamView::OnSize(%d, %d)
"), event.m_size.x, event.m_size.y);
+	TRACEUSER("Gerry", _T("CCamView::OnSize(%d, %d)
"), event.m_size.x, event.m_size.y);
 
 	// This is called early, so if pDocView is null do nothing
 	if( NULL == pDocView )
@@ -2874,6 +2863,7 @@
 	// that have been reloaded.
 	if (fSetupDone)
 	{
+		TRACEUSER("Gerry", _T("fSetupDone so setting scroll offsets
"));
 		WorkCoord CurrScrollPos;
 		GetScrollOffset(&CurrScrollPos);
 		SetScrollOffset(CurrScrollPos, TRUE);


Xara