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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1218
Date       : Tue May 30 21:26:18 BST 2006

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

Colour picker picks up colour bar colours


Diff:
Index: Trunk/XaraLX/wxOil/ccolbar.cpp
===================================================================
--- Trunk/XaraLX/wxOil/ccolbar.cpp	(revision 1217)
+++ Trunk/XaraLX/wxOil/ccolbar.cpp	(revision 1218)
@@ -1276,7 +1276,7 @@
 
 /********************************************************************************************
 
->	BOOL DoColourPickerColour (wxWindow* colourPicker, wxPoint mousePt)
+>	BOOL DoColourPickerColour (wxWindow* colourPicker, wxPoint mousePt, IndexedColour ** pTheCol=NULL)
 
 	Author:		Chris_Snook (Xara Group Ltd) <camelotdev@xxxxxxxx>
 	Created:	22/10/99
@@ -1289,7 +1289,7 @@
 
 ********************************************************************************************/
 
-BOOL CColourBar::DoColourPickerColour (wxWindow* colourPicker, wxPoint mousePt)
+BOOL CColourBar::DoColourPickerColour (wxWindow* colourPicker, wxPoint mousePt, IndexedColour **pTheCol/*=NULL*/)
 {
 #if FALSE
 	// firstly, lets check for obvious insanity
@@ -1347,6 +1347,8 @@
 				ASSERT (pColourEditDlg);
 
 				pColourEditDlg->SetEditingColour (TheColour);
+				if (pTheCol)
+					*pTheCol = TheColour;
 			}
 			
 			lastColourCell = ColourCell;
Index: Trunk/XaraLX/wxOil/dragpick.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dragpick.cpp	(revision 1217)
+++ Trunk/XaraLX/wxOil/dragpick.cpp	(revision 1218)
@@ -462,12 +462,48 @@
 {
 	Status OldStatus = m_Status;
 	m_Status = SCREEN_COLOUR;
+	DocColour col(COLOUR_TRANS);
 
 	CWindowID	WinID=::wxChildWindowFromPoint(p, FALSE, -1);
 	DocView*	pDocView=NULL;
 	Spread*		pSpread=NULL;
 	WinCoord	WndPos(0,0);
 	DocCoord	DocPos(0,0);
+
+	ColourEditDlg* pColourEditDlg = ColourEditDlg::GetColourEditDlg ();
+	// Check we can't pick from the colour picker
+	wxWindow * w = WinID;
+	while (w)
+	{
+		if (pColourEditDlg && (w==pColourEditDlg->WindowID))
+		{
+			// No picking colours from the colour editor
+			m_Status = NO_COLOUR;
+			break;
+		}
+		if (w->IsKindOf(CLASSINFO(CColourBar)));
+		{
+			wxPoint cpoint = w->ScreenToClient(p);
+			if (((CColourBar*) w)->IsColourPickerOverStripRect (w, cpoint))
+			{
+				IndexedColour * pIndexedColour = NULL;
+				m_Status = COLOURBAR_COLOUR;
+				((CColourBar*) w)->DoColourPickerColour (w, cpoint, &pIndexedColour);
+				if (pIndexedColour)
+				{
+					// Disassociate from indexed colour
+					DocColour Temp;
+					Temp.MakeRefToIndexedColour(pIndexedColour);
+					INT32 r, g, b;
+					Temp.GetRGBValue(&r, &g, &b);
+					col=DocColour(r,g,b);
+				}
+				break;
+			}
+		}
+		w=w->GetParent();
+	}
+
 	
 	if (WinID != NULL)
 		pDocView=CCamView::GetDocViewFromWindowID(WinID);
@@ -494,57 +530,7 @@
 			m_Status = SCREEN_COLOUR;
 		}
 	}
-#if 0
-	else
-	{
-		GetWindowRect (GetParent (GetMainFrame ()->m_hWndMDIClient), &mainFrameWindowRect);
-		
-			if (PtInRect (&colourBarWindowRect, mousePt))
-			{
-				POINT mousePt2 = mousePt;
-				ScreenToClient (colourBarWnd, &mousePt2);
-				CPoint cMousePt (mousePt2);		// for consistent interface to CColourBar stuff
-				
-				if (pCColourBar->IsColourPickerOverStripRect (hwnd, cMousePt) == TRUE)
-				{
-					validGrabLocation = TRUE;
-					grabColourBarColour = TRUE;
 
-				}
-				else
-				{
-					SetCursor (noreadToolCursor);
-					//SetProp (hwnd, "oldCursor", (HANDLE) oldCursor);
-				}
-			}
-			else
-			{
-				SetCursor (noreadToolCursor);
-
-				pStatusLine->UpdateTextForColourPicker (&(String_256 (TEXT (IDS_DRAGGINGCOLOURPICKERTOOLNOREAD))), FALSE);
-			}
-		}
-	}
-#endif
-
-	ColourEditDlg* pColourEditDlg = ColourEditDlg::GetColourEditDlg ();
-	// Check we can't pick from the colour picker
-	if ((m_Status == SCREEN_COLOUR) && pColourEditDlg)
-	{
-		wxWindow * w = WinID;
-		while (w)
-		{
-			if (w==pColourEditDlg->WindowID)
-			{
-				m_Status = NO_COLOUR;
-				break;
-			}
-			w=w->GetParent();
-		}
-	}
-
-	DocColour col(COLOUR_TRANS);
-
 	switch (m_Status)
 	{
 		case DOC_COLOUR:
@@ -585,7 +571,8 @@
 	{
 		TheColour = col;
 
-		if (m_Status != NO_COLOUR)
+		// COLOURBAR_COLOUR has already updated the colour picker
+		if ((m_Status != NO_COLOUR) && (m_Status != COLOURBAR_COLOUR))
 		{
 			IndexedColour* theIndexedColour = ColourManager::GenerateNewUnnamedColour (ColourManager::GetColourList(), &TheColour);
 	
Index: Trunk/XaraLX/wxOil/ccolbar.h
===================================================================
--- Trunk/XaraLX/wxOil/ccolbar.h	(revision 1217)
+++ Trunk/XaraLX/wxOil/ccolbar.h	(revision 1218)
@@ -372,7 +372,7 @@
 	// colour picker custom control interface functions ....
 	
 	BOOL IsColourPickerOverStripRect (wxWindow* colourPicker, wxPoint mousePt);
-	BOOL DoColourPickerColour (wxWindow* colourPicker, wxPoint mousePt);
+	BOOL DoColourPickerColour (wxWindow* colourPicker, wxPoint mousePt, IndexedColour ** pTheCol=NULL);
 
 protected:			// Internal subroutine functions
 	BOOL HasNoScrollBar(INT32 DisplayedColours, INT32 MaxColours, wxRect *pStripRect = NULL);


Xara