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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1216
Date       : Tue May 30 20:42:05 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/coldlog.cpp
   M /Trunk/XaraLX/Kernel/draginfo.h
   M /Trunk/XaraLX/Kernel/hittest.cpp
   M /Trunk/XaraLX/Kernel/main3.cpp
   M /Trunk/XaraLX/Scripts/build-resources.pl
   M /Trunk/XaraLX/wxOil/Makefile.am
   M /Trunk/XaraLX/wxOil/colpick.cpp
   M /Trunk/XaraLX/wxOil/colpick.h
   M /Trunk/XaraLX/wxOil/dragmgr.cpp
   A /Trunk/XaraLX/wxOil/dragpick.cpp
   A /Trunk/XaraLX/wxOil/dragpick.h
   M /Trunk/XaraLX/wxOil/xrc/EN/colordlg.xrc
   M /Trunk/XaraLX/wxOil/xrc/EN/ed-strings.xrc
   A /Trunk/XaraLX/wxOil/xrc/IDC_COLOURPICKERCURSORCOLBAR.cur
   A /Trunk/XaraLX/wxOil/xrc/IDC_COLOURPICKERCURSORDOC.cur

Work around Gentoo missing wxrc issue
First hack at colour picker / eye-dropper


Diff:
Index: Trunk/XaraLX/Kernel/coldlog.cpp
===================================================================
--- Trunk/XaraLX/Kernel/coldlog.cpp	(revision 1215)
+++ Trunk/XaraLX/Kernel/coldlog.cpp	(revision 1216)
@@ -131,6 +131,7 @@
 #include "docview.h"
 #include "dragcol.h"
 #include "dragmgr.h"
+#include "dragpick.h"
 #include "ensure.h"  
 #include "errors.h" 
 #include "helpuser.h"		// For HelpUser()
@@ -1143,24 +1144,7 @@
 
 	m_NeedsResize=FALSE;
 
-	CWindowID pPanel=DialogManager::GetGadget(WindowID, _R(IDC_EDIT_ADVANCEDPANEL));
-	if (pPanel)
-	{
-		pPanel->Layout();
-		pPanel->Fit();
-		pPanel->GetSizer()->SetSizeHints(pPanel);
-
-		static INT32 flag=0;
-		if (!flag)
-		{
-			flag++;
-			::wxYield();
-			flag--;
-		}
-	}
-	WindowID->Layout();
-	WindowID->Fit();
-	WindowID->GetSizer()->SetSizeHints(WindowID);
+	ColourPicker::RelayoutDialog(WindowID);
 }
 
 
@@ -3289,12 +3273,24 @@
 #ifndef EXCLUDE_FROM_XARALX
 			ControlHelper::BubbleHelpDisable();
 #endif
+			if (Msg->GadgetID == _R(IDC_COLOURPICKER))
+			{
+				ColourPickerDragInformation * DragCol = new ColourPickerDragInformation();
+				DragManagerOp::StartDrag(DragCol, GetReadWriteWindowID());
+				break;
+			}
 
 			// Drag methods all cope with shaded condition (EditingColour == NULL)
 			if (Msg->DlgMsgParam)
 			{
 				if (Msg->GadgetID == _R(IDC_EDIT_PICKER))
 				{
+					// This little wheeze is enough to remove hover
+					EnableGadget(_R(IDC_EDIT_PICKER), FALSE);
+					EnableGadget(_R(IDC_EDIT_PICKER), TRUE);
+					SetBoolGadgetSelected(_R(IDC_EDIT_PICKER), FALSE);
+					InvalidateGadget(_R(IDC_EDIT_PICKER));
+
 					StartDrag((ReDrawInfoType*) Msg->DlgMsgParam);
 					NoFillButtonDown = FALSE;
 				}
@@ -3335,6 +3331,7 @@
 */
 #endif
 			}
+			
 			break;
 
 		case DIM_MOUSE_DRAG:
Index: Trunk/XaraLX/Kernel/hittest.cpp
===================================================================
--- Trunk/XaraLX/Kernel/hittest.cpp	(revision 1215)
+++ Trunk/XaraLX/Kernel/hittest.cpp	(revision 1216)
@@ -118,7 +118,7 @@
 #include "nodeshad.h"
 #include "nodecont.h"
 //#include "ndcchbmp.h"
-//#include "grndclik.h"
+#include "grndclik.h"
 #include "nodeclip.h"	// for NodeClipView
 #include "ndclpcnt.h"	// for NodeClipViewController
 #include "brshattr.h"
@@ -633,8 +633,6 @@
 																	   Node* pHighNode,
 																	   Node** ppInterruptNode)
 {
-	PORTNOTETRACE("other","NodeRenderableInk::FindSimpleAtPointForColourPicker - do nothing");
-#ifndef EXCLUDE_FROM_XARALX
 	// Find the currently active DocView.
 	DocView* pDocView = DocView::GetSelected();
 	ENSURE(pDocView != 0, "Null current DocView in NodeRenderableInk::FindFirstAtPoint");
@@ -698,9 +696,6 @@
 
 	pDocView->SetForceDefaultColourContexts(bOldForce);
 	return pHitNode;
-#else
-	return NULL;
-#endif
 }
 
 
Index: Trunk/XaraLX/Kernel/draginfo.h
===================================================================
--- Trunk/XaraLX/Kernel/draginfo.h	(revision 1215)
+++ Trunk/XaraLX/Kernel/draginfo.h	(revision 1216)
@@ -156,8 +156,9 @@
 public:		// Special dropping functions called for drop-on-page (called by ViewDragTarget)
 	virtual BOOL CanDropOnPage()				{ return FALSE; }
 	virtual BOOL OnPageDrop(ViewDragTarget*)	{ return FALSE; }
+	virtual BOOL OnMouseMove(wxPoint p)			{ return FALSE; }
+	virtual BOOL OnButtonUp(wxPoint p)			{ return FALSE; }
 
-
 protected:	// Member variables
 	static Cursor	   *MyCursor;
 
Index: Trunk/XaraLX/Kernel/main3.cpp
===================================================================
--- Trunk/XaraLX/Kernel/main3.cpp	(revision 1215)
+++ Trunk/XaraLX/Kernel/main3.cpp	(revision 1216)
@@ -118,6 +118,7 @@
 #include "princomp.h"
 #include "nodebmp.h"
 #include "dragcol.h"
+#include "dragpick.h"
 #include "dragbmp.h"
 #include "convert.h"
 #include "diagnost.h"
@@ -235,6 +236,7 @@
 												// and thousands seperator characters from
 												// operating system .
 			ColourDragInformation::Init() &&
+			ColourPickerDragInformation::Init() &&
 			BitmapDragInformation::Init() &&
 PORTNOTE("other","Removed more initialization")
 #ifndef EXCLUDE_FROM_XARALX
Index: Trunk/XaraLX/Scripts/build-resources.pl
===================================================================
--- Trunk/XaraLX/Scripts/build-resources.pl	(revision 1215)
+++ Trunk/XaraLX/Scripts/build-resources.pl	(revision 1216)
@@ -84,6 +84,13 @@
 	    "xgettext|g=s" => \$xgettext,
 	    "help!" => \$help ) || usage ("Bad option");
 
+# workaround for Gentoo wxWidgets 2.6.3.2 missing wxrc
+if ($wxrc eq "echo")
+{
+    print STRDERR "Warning: wxrc seems to be missing. Not building internationalized resources
";
+    $international=0;
+}
+
 usage() if ($help);
 
 # check the output directory exists
Index: Trunk/XaraLX/wxOil/Makefile.am
===================================================================
--- Trunk/XaraLX/wxOil/Makefile.am	(revision 1215)
+++ Trunk/XaraLX/wxOil/Makefile.am	(revision 1216)
@@ -32,7 +32,7 @@
 	outptdib.cpp outptpng.cpp outptgif.cpp gpalopt.cpp bmpfiltr.cpp giffiltr.cpp \
 	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 \
+	binreloc.c exceptio.cpp colpick.cpp dragpick.cpp \
 	resources.cpp
 
 # Keep resources.cpp on a separate line as it is odd
@@ -40,6 +40,9 @@
 AM_CXXFLAGS = $(XARAFLAGS)
 
 XARALANGUAGE = @XARALANGUAGE@
-WXRC = @WXRC@
 
+# Ensure wxrc is set to something. If wxconfig can't find it, it becomes an empty string which will upset build-resources.pl
+WXRC := ${if @WXRC@,@WXRC@,echo}
+
 RESOURCEDUMMY := ${if ${strip ${shell $(TOPDIR)/Scripts/build-resources.pl -i -t $(TOPDIR) -o . --version $(VERSION) -x $(XARALANGUAGE) -u $(USER) --wxrc $(WXRC) } }, ,${error "Resource build failed"}}
+
Index: Trunk/XaraLX/wxOil/dragpick.h
===================================================================
--- Trunk/XaraLX/wxOil/dragpick.h	(revision 0)
+++ Trunk/XaraLX/wxOil/dragpick.h	(revision 1216)
@@ -0,0 +1,174 @@
+// $Id: dragcol.h 751 2006-03-31 15:43:49Z alex $
+/* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
+================================XARAHEADERSTART===========================
+ 
+               Xara LX, a vector drawing and manipulation program.
+                    Copyright (C) 1993-2006 Xara Group Ltd.
+       Copyright on certain contributions may be held in joint with their
+              respective authors. See AUTHORS file for details.
+
+LICENSE TO USE AND MODIFY SOFTWARE
+----------------------------------
+
+This file is part of Xara LX.
+
+Xara LX is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as published
+by the Free Software Foundation.
+
+Xara LX and its component source files are distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with Xara LX (see the file GPL in the root directory of the
+distribution); if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+
+ADDITIONAL RIGHTS
+-----------------
+
+Conditional upon your continuing compliance with the GNU General Public
+License described above, Xara Group Ltd grants to you certain additional
+rights. 
+
+The additional rights are to use, modify, and distribute the software
+together with the wxWidgets library, the wxXtra library, and the "CDraw"
+library and any other such library that any version of Xara LX relased
+by Xara Group Ltd requires in order to compile and execute, including
+the static linking of that library to XaraLX. In the case of the
+"CDraw" library, you may satisfy obligation under the GNU General Public
+License to provide source code by providing a binary copy of the library
+concerned and a copy of the license accompanying it.
+
+Nothing in this section restricts any of the rights you have under
+the GNU General Public License.
+
+
+SCOPE OF LICENSE
+----------------
+
+This license applies to this program (XaraLX) and its constituent source
+files only, and does not necessarily apply to other Xara products which may
+in part share the same code base, and are subject to their own licensing
+terms.
+
+This license does not apply to files in the wxXtra directory, which
+are built into a separate library, and are subject to the wxWindows
+license contained within that directory in the file "WXXTRA-LICENSE".
+
+This license does not apply to the binary libraries (if any) within
+the "libs" directory, which are subject to a separate license contained
+within that directory in the file "LIBS-LICENSE".
+
+
+ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
+----------------------------------------------
+
+Subject to the terms of the GNU Public License (see above), you are
+free to do whatever you like with your modifications. However, you may
+(at your option) wish contribute them to Xara's source tree. You can
+find details of how to do this at:
+  http://www.xaraxtreme.org/developers/
+
+Prior to contributing your modifications, you will need to complete our
+contributor agreement. This can be found at:
+  http://www.xaraxtreme.org/developers/contribute/
+
+Please note that Xara will not accept modifications which modify any of
+the text between the start and end of this header (marked
+XARAHEADERSTART and XARAHEADEREND).
+
+
+MARKS
+-----
+
+Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
+designs are registered or unregistered trademarks, design-marks, and/or
+service marks of Xara Group Ltd. All rights in these marks are reserved.
+
+
+      Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
+                        http://www.xara.com/
+
+=================================XARAHEADEREND============================
+ */
+// DragCol.h - Colour DragInformation base class
+
+
+#ifndef INC_DRAGPICK
+#define INC_DRAGPICK
+
+#include "doccolor.h"
+#include "draginfo.h"
+#include "dragtrgt.h"
+
+class IndexedColour;
+
+
+
+/********************************************************************************************
+
+>	class ColourPickerDragInformation : public DragInformation
+
+	Author:		Chris_Snook (Xara Group Ltd) <camelotdev@xxxxxxxx> (upgraded by Jason)
+	Created:	05/05/94 (8/8/96)
+
+	Purpose:	Contains all information about a colour being dragged.
+
+********************************************************************************************/
+
+class ColourPickerDragInformation : public DragInformation
+{ 	
+CC_DECLARE_DYNCREATE(ColourPickerDragInformation)
+
+protected:
+	void InitObject(void);
+		// Shared construction code
+
+public:
+	ColourPickerDragInformation();
+		// Default constructor - DO NOT USE
+
+	static BOOL Init();
+		// static class initialisation
+
+
+public:		// Specialised interface
+
+public:		// Overridden interfaces
+	virtual UINT32 GetCursorID(DragTarget* pDragTarget);
+	virtual BOOL GetStatusLineText(String_256 *TheText, DragTarget* pDragTarget);
+
+	virtual UINT32 GetCursorID(void);
+ 	virtual BOOL GetStatusLineText(String_256 *TheText);
+
+	virtual BOOL OnDrawSolidDrag(wxPoint Origin, wxDC *TheDC);
+	
+	virtual INT32 GetDragTransparency();
+
+	virtual BOOL OnMouseMove(wxPoint p);
+
+protected:
+	static INT32		DragTransparency;
+
+	DocColour TheColour;	// Holds the colour definition (or references the document col)
+
+	enum Status
+	{
+		NO_COLOUR,
+		SCREEN_COLOUR,
+		DOC_COLOUR,
+		COLOURBAR_COLOUR
+	};
+
+	Status m_Status;
+
+	wxScreenDC ScreenDC;
+
+};
+
+#endif
+
Index: Trunk/XaraLX/wxOil/colpick.h
===================================================================
--- Trunk/XaraLX/wxOil/colpick.h	(revision 1215)
+++ Trunk/XaraLX/wxOil/colpick.h	(revision 1216)
@@ -247,6 +247,9 @@
 													ColourModel ModelToDisplay,
 													INT32 TextWidth[],
 													INT32 EditWidth[]);
+
+	static void RelayoutDialog(CWindowID WindowID);
+
 };
 
 
Index: Trunk/XaraLX/wxOil/dragpick.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dragpick.cpp	(revision 0)
+++ Trunk/XaraLX/wxOil/dragpick.cpp	(revision 1216)
@@ -0,0 +1,602 @@
+// $Id: dragcol.cpp 1149 2006-05-22 08:50:00Z alex $
+/* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
+================================XARAHEADERSTART===========================
+ 
+               Xara LX, a vector drawing and manipulation program.
+                    Copyright (C) 1993-2006 Xara Group Ltd.
+       Copyright on certain contributions may be held in joint with their
+              respective authors. See AUTHORS file for details.
+
+LICENSE TO USE AND MODIFY SOFTWARE
+----------------------------------
+
+This file is part of Xara LX.
+
+Xara LX is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as published
+by the Free Software Foundation.
+
+Xara LX and its component source files are distributed in the hope
+that it will be useful, but WITHOUT ANY WARRANTY; without even the
+implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with Xara LX (see the file GPL in the root directory of the
+distribution); if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+
+ADDITIONAL RIGHTS
+-----------------
+
+Conditional upon your continuing compliance with the GNU General Public
+License described above, Xara Group Ltd grants to you certain additional
+rights. 
+
+The additional rights are to use, modify, and distribute the software
+together with the wxWidgets library, the wxXtra library, and the "CDraw"
+library and any other such library that any version of Xara LX relased
+by Xara Group Ltd requires in order to compile and execute, including
+the static linking of that library to XaraLX. In the case of the
+"CDraw" library, you may satisfy obligation under the GNU General Public
+License to provide source code by providing a binary copy of the library
+concerned and a copy of the license accompanying it.
+
+Nothing in this section restricts any of the rights you have under
+the GNU General Public License.
+
+
+SCOPE OF LICENSE
+----------------
+
+This license applies to this program (XaraLX) and its constituent source
+files only, and does not necessarily apply to other Xara products which may
+in part share the same code base, and are subject to their own licensing
+terms.
+
+This license does not apply to files in the wxXtra directory, which
+are built into a separate library, and are subject to the wxWindows
+license contained within that directory in the file "WXXTRA-LICENSE".
+
+This license does not apply to the binary libraries (if any) within
+the "libs" directory, which are subject to a separate license contained
+within that directory in the file "LIBS-LICENSE".
+
+
+ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
+----------------------------------------------
+
+Subject to the terms of the GNU Public License (see above), you are
+free to do whatever you like with your modifications. However, you may
+(at your option) wish contribute them to Xara's source tree. You can
+find details of how to do this at:
+  http://www.xaraxtreme.org/developers/
+
+Prior to contributing your modifications, you will need to complete our
+contributor agreement. This can be found at:
+  http://www.xaraxtreme.org/developers/contribute/
+
+Please note that Xara will not accept modifications which modify any of
+the text between the start and end of this header (marked
+XARAHEADERSTART and XARAHEADEREND).
+
+
+MARKS
+-----
+
+Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
+designs are registered or unregistered trademarks, design-marks, and/or
+service marks of Xara Group Ltd. All rights in these marks are reserved.
+
+
+      Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
+                        http://www.xara.com/
+
+=================================XARAHEADEREND============================
+ */
+// DragCol.cpp - Colour DragInformation base class
+
+/*
+*/
+
+
+#include "camtypes.h"
+
+#include "app.h"
+#include "ccolbar.h"
+#include "coldlog.h"
+#include "colourix.h"
+#include "colormgr.h"
+#include "devcolor.h"
+#include "docview.h"
+#include "dragpick.h"
+#include "dragmgr.h"
+#include "keypress.h"
+#include "camframe.h"
+//#include "resource.h"
+#include "sgcolour.h"
+#include "camview.h"
+#include "attrmgr.h"
+#include "fillattr.h"
+#include "ink.h"
+#include "lineattr.h"
+
+#include "palman.h"
+
+#include "backgrnd.h"	// OpBackground
+#include "keypress.h"	// KeyPress
+//#include "galstr.h"		// _R(IDS_DRAGCOL_DROP_SETPAGEBACKGROUND)
+
+CC_IMPLEMENT_DYNCREATE(ColourPickerDragInformation, DragInformation)
+
+
+
+const INT32 CellSize = 16;		// X/Y size of the solid-dragged colour square
+
+
+
+// Default to non-transparent dragging
+INT32 ColourPickerDragInformation::DragTransparency = 0;
+
+
+
+/********************************************************************************************
+
+>	void ColourPickerDragInformation::InitObject(void)
+	 
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	30/05/2006
+
+	Purpose:	Shared code for initialising the object - called by all constructors
+
+********************************************************************************************/
+
+void ColourPickerDragInformation::InitObject(void)
+{
+	// Init member variables
+	TheColour = DocColour(COLOUR_TRANS);
+	m_Status=NO_COLOUR;
+
+	// Set up a few things about this drag
+	DoesSolidDrag = TRUE;
+	
+	// offset of colour swatch from the pointer
+	SolidDragOffset.x = -14;
+	SolidDragOffset.y = 4;	   
+	
+	// size of the solid drag redraw
+	SolidDragSize.x = CellSize;
+	SolidDragSize.y = CellSize;
+}
+
+
+
+/********************************************************************************************
+
+>	void ColourPickerDragInformation::ColourPickerDragInformation() 
+	 
+	Author:		Chris_Snook (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	12/1/95		  
+
+	Purpose:	Constructor
+
+********************************************************************************************/
+
+ColourPickerDragInformation::ColourPickerDragInformation()
+{
+	InitObject();
+}
+
+
+/********************************************************************************************
+
+>	static BOOL ColourPickerDragInformation::Init()
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	30/05/2006
+	Returns:	-
+	Purpose:	Initialise any Colour Drag stuff. (eg. ini file preferences).
+	SeeAlso:	-
+
+********************************************************************************************/
+
+BOOL ColourPickerDragInformation::Init()
+{
+	// Setup preference for drag transparency
+	if (GetApplication()->DeclareSection(_T("Dragging"), 1))
+		GetApplication()->DeclarePref( NULL, _T("ColourPickerDragTransparency"), &DragTransparency, 0, 100);
+
+	return TRUE;
+}
+
+
+
+
+/********************************************************************************************
+
+>	void ColourPickerDragInformation::GetCursorID(DragTarget* pDragTarget)
+
+	Author:		Will_Cowling (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	25/3/95
+	Purpose:	Set cursor over this target
+
+
+********************************************************************************************/
+
+UINT32 ColourPickerDragInformation::GetCursorID(DragTarget* pDragTarget)
+{
+	return GetCursorID();
+}
+
+
+
+/********************************************************************************************
+
+>	virtual BOOL ColourPickerDragInformation::GetStatusLineText(String_256 * TheText, DragTarget* pDragTarget)
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	30/05/2006
+	Returns:	Whether String is valid
+	Purpose:	provide status line text for this target
+   
+********************************************************************************************/
+
+BOOL ColourPickerDragInformation::GetStatusLineText(String_256 * TheText, DragTarget* pDragTarget)
+{
+	return GetStatusLineText(TheText);
+}
+
+
+/********************************************************************************************
+
+>	virtual UINT32 ColourPickerDragInformation::GetCursorID()
+
+	Author:		Chris_Snook (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	15/1/95
+	Returns:	a cursor ID to set during this drag
+	Purpose:	Determines what cursor to display during a colour drag
+   
+********************************************************************************************/
+
+UINT32 ColourPickerDragInformation::GetCursorID()
+{
+	switch (m_Status)
+	{
+		case DOC_COLOUR:
+			return _R(IDC_COLOURPICKERCURSORDOC);
+		case SCREEN_COLOUR:
+			return _R(IDC_COLOURPICKERCURSOR);
+		case COLOURBAR_COLOUR:
+			return _R(IDC_COLOURPICKERCURSORCOLBAR);
+		default:
+			break;
+	}
+
+	return(_R(IDC_COLOURPICKERCURSORNOREAD));
+}
+
+
+
+/********************************************************************************************
+
+>	virtual BOOL ColourPickerDragInformation::GetStatusLineText(String_256 * TheText)
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	30/05/2006
+
+	Outputs:	TheText - If it returns TRUE, this is filled in with status line text
+	Returns:	Whether String is valid
+
+	Purpose:	provide status line text for this drag
+   
+********************************************************************************************/
+
+BOOL ColourPickerDragInformation::GetStatusLineText(String_256 *TheText)
+{
+	ResourceID r;
+	switch (m_Status)
+	{
+		case DOC_COLOUR:
+			r = _R(IDS_DRAGGINGCOLOURPICKERTOOLDOCRC);
+			break;
+		case SCREEN_COLOUR:
+			r = _R(IDS_DRAGGINGCOLOURPICKERTOOLRS);
+			break;
+		case COLOURBAR_COLOUR:
+			r = _R(IDS_DRAGGINGCOLOURPICKERTOOLCOLOURBARRC);
+			break;
+		default:
+			r = _R(IDS_DRAGGINGCOLOURPICKERTOOLNOREAD);
+	}
+
+	*TheText=String_256(r);
+	return TRUE;
+}
+
+
+
+
+/********************************************************************************************
+
+>	void ColourPickerDragInformation::OnDrawSolidDrag(CRect DragRect,CDC * TheDC) 
+	 
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	30/05/2006
+	Inputs:		TheDC - pointer to a DC ready to draw into.
+	Outputs:	-
+	Returns:	-
+	Purpose:	allows the drag to draw into a Device Context - DragManager will look after
+				painting the background	etc.
+	Errors:		-
+	SeeAlso:	-
+
+********************************************************************************************/
+
+BOOL ColourPickerDragInformation::OnDrawSolidDrag(wxPoint Origin, wxDC *TheDC)
+{
+	if (m_Status == NO_COLOUR)
+		return FALSE;	
+
+	// set up gbrush
+//	CPalette * OldPal = NULL;
+//	if (PaletteManager::UsePalette())
+//	{
+//		OldPal = PaletteManager::StartPaintPalette( TheDC );
+//	}
+
+	GBrush GDrawBrush;
+	GDrawBrush.Init(TheDC);
+	GDrawBrush.Start();
+
+	// get a gbrush brush
+	Document *ScopeDoc = Document::GetSelected();
+	ERROR2IF(ScopeDoc == NULL, FALSE, "No Selected Doc !");
+
+	wxBrush* pDragBrush = new wxBrush;
+	
+	BOOL BrushCreate = TRUE;
+
+	if (pDragBrush != NULL )
+	{
+		if (TheColour.IsTransparent())
+		{
+//			TheDC->SetBkColor(RGB(255,255,255));		// ensure white background
+			pDragBrush->SetStyle(wxCROSSDIAG_HATCH);
+			pDragBrush->SetColour(wxColour(0,0,0));		// Fill with black/white cross hatch
+		}
+		else
+		{
+			DWORD ScreenWord;
+
+			ColourContextRGBT *CCrgbt = (ColourContextRGBT *)
+						ColourManager::GetColourContext(COLOURMODEL_RGBT, DocView::GetSelected());
+			ScreenWord = ConvertColourToScreenWord(CCrgbt, &TheColour);
+
+			// create the Brush and	Pen
+			if (GDrawBrush.Available())
+			{
+				GDrawBrush.GetLogBrush((COLORREF)ScreenWord, pDragBrush);
+			}
+			else
+				pDragBrush->SetColour((COLORREF)ScreenWord);
+		}
+
+		wxPen MyPen(wxColour(0,0,0));
+
+		// Set the brush origin so the dither (or Hatch) patterns
+		// don't move around as you drag.
+//		TheDC->SetBrushOrg(Origin.x, Origin.y);
+		
+		//the rectangle to draw into
+		wxRect DrawRect(Origin.x, Origin.y, SolidDragSize.x-1, SolidDragSize.y-1);
+
+		// select brushes and pens ..
+		TheDC->SetBrush(*pDragBrush);
+		TheDC->SetPen(MyPen);
+
+		// draw the thingy. In this case, it's a colour patch, circular for a spot colour, else a square
+#ifndef WEBSTER // don't distinguish spots in Webster Martin 15/07/97
+		if (!TheColour.IsTransparent() && TheColour.GetSpotParent() != NULL)
+ 			TheDC->DrawEllipse(DrawRect);
+ 		else
+#endif // WEBSTER
+ 			TheDC->DrawRectangle(DrawRect);
+		    						
+    	// clean up the dc
+    	TheDC->SetBrush(wxNullBrush);
+		TheDC->SetPen(wxNullPen);
+
+    	// delete the objects
+		delete pDragBrush;
+	}
+	else
+		BrushCreate = FALSE;
+	
+	// Finish with GBrush
+	GDrawBrush.Stop();
+//	if (OldPal)
+//		PaletteManager::StopPaintPalette(TheDC, OldPal);
+	
+	// problems !!!
+	ERROR2IF(!BrushCreate, FALSE, "Failed to make a solid drag brush!");
+
+	return TRUE;
+}
+
+
+
+/********************************************************************************************
+
+>	virtual INT32 ColourPickerDragInformation::GetDragTransparency()
+ 
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	30/05/2006
+	Returns:	-
+	Purpose:	Specifies how transparent a drag should be.
+				A value of 0, will cause a normal solid blit.
+				Any other value (between 0 and 100), will cause a masked blit.
+	SeeAlso:	-
+
+********************************************************************************************/
+
+INT32 ColourPickerDragInformation::GetDragTransparency()
+{
+	return ColourPickerDragInformation::DragTransparency;
+}
+
+
+/********************************************************************************************
+
+>	virtual BOOL ColourPickerDragInformation::OnMouseMove(wxPoint p)
+ 
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	30/05/2006
+	Returns:	-
+	Purpose:	Called on a mouse move. Find the doc colour under point p
+	SeeAlso:	-
+
+********************************************************************************************/
+
+BOOL ColourPickerDragInformation::OnMouseMove(wxPoint p)
+{
+	Status OldStatus = m_Status;
+	m_Status = SCREEN_COLOUR;
+
+	CWindowID	WinID=::wxChildWindowFromPoint(p, FALSE, -1);
+	DocView*	pDocView=NULL;
+	Spread*		pSpread=NULL;
+	WinCoord	WndPos(0,0);
+	DocCoord	DocPos(0,0);
+	
+	if (WinID != NULL)
+		pDocView=CCamView::GetDocViewFromWindowID(WinID);
+
+	if (pDocView != NULL)
+	{
+		OilCoord OilPos = WndPos.ToOil(pDocView, TRUE);
+		pSpread = pDocView->OilToSpreadCoord(OilPos, &DocPos);
+	}
+
+	NodeRenderableInk* pNode = NULL;
+
+	Pixel32bpp Pix;
+
+	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;
+		}
+	}
+#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:
+		{
+			const double conversion = 1.0/255.0;
+							
+			FIXED24 rValF24 = Pix.Red * conversion;
+			FIXED24 gValF24 = Pix.Green * conversion;
+			FIXED24 bValF24 = Pix.Blue * conversion;
+			FIXED24 tValF24 = Pix.Alpha * conversion;
+			
+			//DocColour* TheColour = new DocColour (rValF24, gValF24, bValF24);
+			ColourRGBT TheColourRGBT;
+			TheColourRGBT.Red = rValF24;
+			TheColourRGBT.Green = gValF24;
+			TheColourRGBT.Blue = bValF24;
+			TheColourRGBT.Transparent = tValF24;
+			col = DOCCOLOUR_RGBT(&TheColourRGBT);//DocColour (rValF24, gValF24, bValF24);
+		}
+
+		default:	// SCREEN_COLOUR:
+		{
+			wxColour c(*wxBLACK);
+			ScreenDC.GetPixel(p, &c);
+
+			const double conversion = 1.0/255.0;
+
+			FIXED24 rValF24 = c.Red() * conversion;
+			FIXED24 gValF24 = c.Green() * conversion;
+			FIXED24 bValF24 = c.Blue() * conversion;
+
+			col=DocColour(rValF24, gValF24, bValF24);
+		}
+
+	}
+
+	if ((OldStatus != m_Status ) || (col !=TheColour))
+	{
+		TheColour = col;
+
+		if (m_Status != NO_COLOUR)
+		{
+			IndexedColour* theIndexedColour = ColourManager::GenerateNewUnnamedColour (ColourManager::GetColourList(), &TheColour);
+	
+			// Tell the colour edit dlg about the node that this colour came
+			// from so it can block attribute application if its the same node
+			if (pColourEditDlg && theIndexedColour)
+				pColourEditDlg->SetEditingColour (theIndexedColour, pNode);
+			//pColourEditDlg->SetEditingColour (theIndexedColour);
+		}
+
+	}
+
+	return TRUE;
+}
Index: Trunk/XaraLX/wxOil/colpick.cpp
===================================================================
--- Trunk/XaraLX/wxOil/colpick.cpp	(revision 1215)
+++ Trunk/XaraLX/wxOil/colpick.cpp	(revision 1216)
@@ -2825,5 +2825,36 @@
 }
 
 
+/********************************************************************************************
 
+>	void ColourPicker::RelayoutDialog(CWindowID WindowID)
 
+	Author:		Alex Bligh
+	Created:	30/5/2005
+	Inputs:		-
+	Purpose:	Ensure the dialog is a sensible size
+	Scope:		Protected
+
+********************************************************************************************/
+
+void ColourPicker::RelayoutDialog(CWindowID WindowID)
+{
+	CWindowID pPanel=DialogManager::GetGadget(WindowID, _R(IDC_EDIT_ADVANCEDPANEL));
+	if (pPanel)
+	{
+		pPanel->Layout();
+		pPanel->Fit();
+		pPanel->GetSizer()->SetSizeHints(pPanel);
+
+		static INT32 flag=0;
+		if (!flag)
+		{
+			flag++;
+			::wxYield();
+			flag--;
+		}
+	}
+	WindowID->Layout();
+	WindowID->Fit();
+	WindowID->GetSizer()->SetSizeHints(WindowID);
+}
Index: Trunk/XaraLX/wxOil/xrc/EN/colordlg.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/colordlg.xrc	(revision 1215)
+++ Trunk/XaraLX/wxOil/xrc/EN/colordlg.xrc	(revision 1216)
@@ -44,7 +44,7 @@
                         <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
                         <border>1</border>
                         <object class="wxCamArtControl" name="IDC_COLOURPICKER">
-                            <camartstyle>wxCACS_PUSHBUTTON|wxCACS_ALLOWHOVER</camartstyle>
+                            <camartstyle>wxCACS_PUSHBUTTON|wxCACS_ALLOWHOVER|wxCACS_NOAUTOREPEAT</camartstyle>
                             <label>-</label>
                         </object>
                     </object>
Index: Trunk/XaraLX/wxOil/xrc/EN/ed-strings.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/ed-strings.xrc	(revision 1215)
+++ Trunk/XaraLX/wxOil/xrc/EN/ed-strings.xrc	(revision 1216)
@@ -31,13 +31,13 @@
 			<object class="sizeritem">
 				<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
 				<object class="wxStaticText" name="IDS_DRAGGINGCOLOURPICKERTOOLDOCRC">
-					<label>Release mouse button to capture documents 24-bit screen colour</label>
+					<label>Release mouse button to capture document's 24-bit screen colour</label>
 				</object>
 			</object>
 			<object class="sizeritem">
 				<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
 				<object class="wxStaticText" name="IDS_DRAGGINGCOLOURPICKERTOOLDOCRS">
-					<label>Release mouse button to capture documents screen colour</label>
+					<label>Release mouse button to capture document's screen colour</label>
 				</object>
 			</object>
 			<object class="sizeritem">
Index: Trunk/XaraLX/wxOil/xrc/IDC_COLOURPICKERCURSORCOLBAR.cur
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: Trunk/XaraLX/wxOil/xrc/IDC_COLOURPICKERCURSORCOLBAR.cur
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: Trunk/XaraLX/wxOil/xrc/IDC_COLOURPICKERCURSORDOC.cur
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: Trunk/XaraLX/wxOil/xrc/IDC_COLOURPICKERCURSORDOC.cur
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Index: Trunk/XaraLX/wxOil/dragmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 1215)
+++ Trunk/XaraLX/wxOil/dragmgr.cpp	(revision 1216)
@@ -255,9 +255,20 @@
 ********************************************************************************************/
 void CaptureHandler::OnLButtonUp(wxMouseEvent& event)
 {
+	if (m_pWindow)
+	{
+		wxPoint point = event.GetPosition();
+		point = m_pWindow->ClientToScreen(point);
+
+		if (DragManagerOp::CurrentManager && DragManagerOp::CurrentManager->CurrentDragInfo)
+		{
+			DragManagerOp::CurrentManager->CurrentDragInfo->OnMouseMove(point);
+			DragManagerOp::CurrentManager->CurrentDragInfo->OnButtonUp(point);
+		}
+	}
+
 	TRACEUSER("Gerry", _T("CaptureHandler::OnLButtonUp"));
 	DragManagerOp::EndDrag(1);// 1 == left click for now
-
 	// Don't call Skip as the window wont be expecting the button up
 //	event.Skip();
 }
@@ -277,6 +288,18 @@
 ********************************************************************************************/
 void CaptureHandler::OnRButtonUp(wxMouseEvent& event)
 {
+	if (m_pWindow)
+	{
+		wxPoint point = event.GetPosition();
+		point = m_pWindow->ClientToScreen(point);
+
+		if (DragManagerOp::CurrentManager && DragManagerOp::CurrentManager->CurrentDragInfo)
+		{
+			DragManagerOp::CurrentManager->CurrentDragInfo->OnMouseMove(point);
+			DragManagerOp::CurrentManager->CurrentDragInfo->OnButtonUp(point);
+		}
+	}
+
 	TRACEUSER("Gerry", _T("CaptureHandler::OnRButtonUp"));
 	DragManagerOp::EndDrag(-1);//	-1 == Right click for now
 
@@ -628,6 +651,10 @@
 	{
 		wxPoint point = event.GetPosition();
 		point = m_pWindow->ClientToScreen(point);
+
+		if (DragManagerOp::CurrentManager && DragManagerOp::CurrentManager->CurrentDragInfo)
+			DragManagerOp::CurrentManager->CurrentDragInfo->OnMouseMove(point);
+
 		DrawSolidDrag(point);
 	}
 }
@@ -1111,11 +1138,15 @@
 			// App->Document->View... 
 			GetApplication()->CreateDragTargets(Descriptor);
 
-				// Send an Initialise event to all registered targets
+			// Send an Initialise event to all registered targets
+
+			// Forget this - drags with no targets are perfectly legal - see colour picker
+#if 0
 #ifdef _DEBUG
 			if (pNewManager->Targets.IsEmpty())
 				TRACE( _T("DragManagerOp::StartDrag - No drag targets specified for this drag!"));
 #endif
+#endif
 			pNewManager->ProcessEvent(DRAGEVENT_INITIALISE);		
 
 			// Start the mouse capture


Xara