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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1231
Date       : Wed May 31 21:30:40 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/ccolbar.cpp
   M /Trunk/XaraLX/wxOil/dragmgr.cpp
   M /Trunk/XaraLX/wxOil/dragpick.cpp

Fix nasty crash on ink-dropper


Diff:
Index: Trunk/XaraLX/wxOil/ccolbar.cpp
===================================================================
--- Trunk/XaraLX/wxOil/ccolbar.cpp	(revision 1230)
+++ Trunk/XaraLX/wxOil/ccolbar.cpp	(revision 1231)
@@ -1246,7 +1246,7 @@
 
 BOOL CColourBar::IsColourPickerOverStripRect (wxWindow* colourPicker, wxPoint mousePt)
 {
-	return(StripRect.Inside(mousePt));
+	return((colourPicker == this) && StripRect.Inside(mousePt));
 
 #if FALSE
 	// firstly, lets check for obvious insanity
@@ -1291,17 +1291,8 @@
 
 BOOL CColourBar::DoColourPickerColour (wxWindow* colourPicker, wxPoint mousePt, IndexedColour **pTheCol/*=NULL*/)
 {
-#if FALSE
-	// firstly, lets check for obvious insanity
-	
-	String_256 ClassNameStr;  // The control type
-
-	// Find out the class type of the gadget
-	GetClassName (colourPicker, (TCHAR*) ClassNameStr, 255);
-	
-	if (ClassNameStr == String_8(TEXT("cc_colPicker")))
+	if (colourPicker == this)
 	{
-#endif
 		UINT32 ColourCell = WhereIsMouse (mousePt);
 		static UINT32 lastColourCell = (UINT32)-1;
 
@@ -1359,11 +1350,10 @@
 		{
 			return (TRUE);
 		}
-#if FALSE
 	}
 
-	ENSURE(FALSE, _T("DoColourPickerColour called for invalid colour picker control"));
-#endif
+	ENSURE(FALSE, "DoColourPickerColour called for invalid colour picker control");
+
 	return (FALSE);
 }
 
Index: Trunk/XaraLX/wxOil/dragpick.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dragpick.cpp	(revision 1230)
+++ Trunk/XaraLX/wxOil/dragpick.cpp	(revision 1231)
@@ -481,7 +481,7 @@
 			m_Status = NO_COLOUR;
 			break;
 		}
-		if (w->IsKindOf(CLASSINFO(CColourBar)));
+		if (w->IsKindOf(CLASSINFO(CColourBar)))
 		{
 			wxPoint cpoint = w->ScreenToClient(p);
 			if (((CColourBar*) w)->IsColourPickerOverStripRect (w, cpoint))
@@ -496,7 +496,12 @@
 					Temp.MakeRefToIndexedColour(pIndexedColour);
 					INT32 r, g, b;
 					Temp.GetRGBValue(&r, &g, &b);
-					col=DocColour(r,g,b);
+					ColourRGBT TheColourRGBT;
+					TheColourRGBT.Red = r;
+					TheColourRGBT.Green = g;
+					TheColourRGBT.Blue = b;
+					TheColourRGBT.Transparent = 0;
+					col = DOCCOLOUR_RGBT(&TheColourRGBT);
 				}
 				break;
 			}
@@ -504,30 +509,31 @@
 		w=w->GetParent();
 	}
 
-	
-	if (WinID != NULL)
-		pDocView=CCamView::GetDocViewFromWindowID(WinID);
-
-	if (pDocView != NULL)
-	{
-		OilCoord OilPos = WndPos.ToOil(pDocView, TRUE);
-		pSpread = pDocView->OilToSpreadCoord(OilPos, &DocPos);
-	}
-
+	Pixel32bpp Pix;
 	NodeRenderableInk* pNode = NULL;
 
-	Pixel32bpp Pix;
-
-	if (pDocView)		// were over an active (or inactive document)
+	if (m_Status == SCREEN_COLOUR)
 	{
-		if (pDocView==DocView::GetSelected())
+		if (WinID != NULL)
+			pDocView=CCamView::GetDocViewFromWindowID(WinID);
+	
+		if (pDocView != NULL)
 		{
-			pNode = NodeRenderableInk::FindSimpleAtPointForColourPicker (pSpread, DocPos, Pix);
-			m_Status = DOC_COLOUR;
+			OilCoord OilPos = WndPos.ToOil(pDocView, TRUE);
+			pSpread = pDocView->OilToSpreadCoord(OilPos, &DocPos);
 		}
-		else
-		{	
-			m_Status = SCREEN_COLOUR;
+	
+		if (pDocView)		// were over an active (or inactive document)
+		{
+			if (pDocView==DocView::GetSelected())
+			{
+				pNode = NodeRenderableInk::FindSimpleAtPointForColourPicker (pSpread, DocPos, Pix);
+				m_Status = DOC_COLOUR;
+			}
+			else
+			{	
+				m_Status = SCREEN_COLOUR;
+			}
 		}
 	}
 
@@ -551,7 +557,7 @@
 			col = DOCCOLOUR_RGBT(&TheColourRGBT);//DocColour (rValF24, gValF24, bValF24);
 		}
 
-		default:	// SCREEN_COLOUR:
+		case SCREEN_COLOUR:
 		{
 			wxColour c(*wxBLACK);
 			ScreenDC.GetPixel(p, &c);
@@ -565,6 +571,10 @@
 			col=DocColour(rValF24, gValF24, bValF24);
 		}
 
+		case COLOURBAR_COLOUR:
+		default:
+			break;
+
 	}
 
 	if ((OldStatus != m_Status ) || (col !=TheColour))
Index: Trunk/XaraLX/wxOil/dragmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 1230)
+++ Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 1231)
@@ -647,12 +647,12 @@
 		return;
 	}
 
-	if (!DragManagerOp::CurrentManager->RedrawInProgress)
+	if (DragManagerOp::CurrentManager && !DragManagerOp::CurrentManager->RedrawInProgress)
 	{
 		wxPoint point = event.GetPosition();
 		point = m_pWindow->ClientToScreen(point);
 
-		if (DragManagerOp::CurrentManager && DragManagerOp::CurrentManager->CurrentDragInfo)
+		if (DragManagerOp::CurrentManager->CurrentDragInfo)
 			DragManagerOp::CurrentManager->CurrentDragInfo->OnMouseMove(point);
 
 		DrawSolidDrag(point);


Xara