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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1220
Date       : Wed May 31 12:11:17 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/coldlog.cpp
   M /Trunk/XaraLX/Kernel/statline.cpp
   M /Trunk/XaraLX/wxOil/colpick.cpp
   M /Trunk/XaraLX/wxOil/colpick.h
   M /Trunk/XaraLX/wxOil/xrc/EN/jason-strings.xrc

Added bubble help to colour editor


Diff:
Index: Trunk/XaraLX/Kernel/coldlog.cpp
===================================================================
--- Trunk/XaraLX/Kernel/coldlog.cpp	(revision 1219)
+++ Trunk/XaraLX/Kernel/coldlog.cpp	(revision 1220)
@@ -1144,6 +1144,11 @@
 
 	m_NeedsResize=FALSE;
 
+	// Set up bubble help
+	ColourPicker::SetBubbleHelp(TintGadgetIDs);
+	ColourPicker::SetBubbleHelp(LinkGadgetIDs);
+	ColourPicker::SetBubbleHelp(OtherGadgetIDs);
+
 	ColourPicker::RelayoutDialog(WindowID);
 }
 
Index: Trunk/XaraLX/Kernel/statline.cpp
===================================================================
--- Trunk/XaraLX/Kernel/statline.cpp	(revision 1219)
+++ Trunk/XaraLX/Kernel/statline.cpp	(revision 1220)
@@ -116,7 +116,7 @@
 #include "ccolbar.h"
 #include "document.h"
 #include "basebar.h"
-//#include "colpick.h"
+#include "colpick.h"
 //#include "rulers.h"
 #include "spread.h"
 
@@ -490,15 +490,12 @@
 				PrefixSelDesc=STATUSLINE_SELDESC_COLBAR;
 		}
 
-PORTNOTE("StatusLine", "Removed use of ColourPicker")
-#ifndef EXCLUDE_FROM_XARALX
 		if (!TextValid)
 		{
 			TextValid=ColourPicker::GetStatusLineText(&text);					// try Colour Editor
 			if (TextValid)
 				PrefixSelDesc=STATUSLINE_SELDESC_COLBAR;
 		}
-#endif
 
 #endif //STANDALONE
 
Index: Trunk/XaraLX/wxOil/colpick.h
===================================================================
--- Trunk/XaraLX/wxOil/colpick.h	(revision 1219)
+++ Trunk/XaraLX/wxOil/colpick.h	(revision 1220)
@@ -160,6 +160,8 @@
 				// Update bubble help and mouse pointer shape (call on MouseMoves)
 	static void UpdateBubbleHelpAndPointer(void);
 
+	static void SetBubbleHelp(CGadgetID * GadgetList);
+
 protected:
 				// Internal variant of the above
 	static BOOL GetStatusLineText(ColourEditDlg *Editor, UINT32 GadgetID, String_256 *Result);
Index: Trunk/XaraLX/wxOil/colpick.cpp
===================================================================
--- Trunk/XaraLX/wxOil/colpick.cpp	(revision 1219)
+++ Trunk/XaraLX/wxOil/colpick.cpp	(revision 1220)
@@ -648,8 +648,6 @@
 
 BOOL ColourPicker::GetStatusLineText(String_256 *Result)
 {
-PORTNOTE("other", "Disabled ColourPicker::GetStatusLineText()")
-#ifndef EXCLUDE_FROM_XARALX
 #ifndef STANDALONE
 
 	ERROR3IF(Result == NULL, "Illegal NULL param");
@@ -663,44 +661,14 @@
 	if (TheWindow == NULL)
 		return(FALSE);
 
-	// Get the cursor position in screen coords
-	POINT TempPos;
-	if (!::GetCursorPos(&TempPos))
-		return(FALSE);
+	wxPoint mousepos = ::wxGetMousePosition();
+	wxWindow * window=::wxChildWindowFromPoint(TheWindow, mousepos, FALSE, -1);
+	if ((!window) || (window!=::wxChildWindowFromPoint(mousepos, FALSE, -1))) // second check to ensure it is not obscured
+		return FALSE;
 
-	// Convert to client coords in the main window
-	ScreenToClient(TheWindow, &TempPos);
-
-	// See if this is over the main window or any child thereof, getting it's CWindowID
-	CPoint Pos(TempPos);	
-	CWindowID WindowUnderPointer = ::ChildWindowFromPoint(TheWindow, Pos);
-	if (WindowUnderPointer == NULL)
-		return(FALSE);
-
-	// Make sure that hidden windows do not provide status help!
-	INT32 WindowStyle = ::GetWindowLong(WindowUnderPointer, GWL_STYLE);
-	if ((WindowStyle & WS_VISIBLE) == 0)
-		return(FALSE);
-
-	// If the pointer is over main window background, return standard help
-	if (WindowUnderPointer == TheWindow)
-		return(GetStatusLineText(Editor, 0, Result));
-
-	// Otherwise, see if we can find help for the specific gadget
-	CWindowID hGadget;
-	INT32 i = 0;
-	while (GadgetList[i])
-	{
-		hGadget = DialogManager::GetGadget(TheWindow, GadgetList[i]);
-		if (WindowUnderPointer == hGadget && GetStatusLineText(Editor, GadgetList[i], Result))
-			return(TRUE);
-		i++;
-	}
-
-#endif
+	return GetStatusLineText(Editor, window->GetId(), Result);
+#else
 	return(TRUE);
-#else
-	return FALSE;
 #endif
 }
 
@@ -841,6 +809,11 @@
 		HelpStringStore = String_256(_R(IDS_EDITBH_NAME));
 		ReturnVal = TRUE;
 	}
+	else if (Item == _R(IDC_EDIT_WEBHEX))
+	{
+		HelpStringStore = String_256(_R(IDS_EDITBH_WEBHEX));
+		ReturnVal = TRUE;
+	}
 	else if (Item == _R(IDC_EDIT_COLTYPE))
 	{
 		HelpStringStore = String_256(_R(IDS_EDITBH_COLTYPE));
@@ -931,7 +904,51 @@
 	return(NULL);
 }
 
+/********************************************************************************************
 
+>	void ColourPicker::SetBubbleHelp(CGadgetID * GadgetList)
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	31/5/2006
+
+	Inputs:		GadgetList - NULL terminated list of gadgets
+
+	Returns:	-
+
+	Purpose:	Set all the bubble help up for the colour picker
+
+	SeeAlso:	-
+
+********************************************************************************************/
+
+void ColourPicker::SetBubbleHelp(CGadgetID * GadgetList)
+{
+	ColourEditDlg *Editor = ColourEditDlg::TheEditor;
+	if (Editor == NULL)
+		return;
+
+	CGadgetID i;
+	while ((i=*(GadgetList++))) // assignment
+	{
+		wxWindow * pGadget = DialogManager::GetGadget(Editor->WindowID, i);
+		wxString s;
+		if (pGadget)
+		{
+			if (pGadget->IsEnabled() && pGadget->IsShown())
+			{
+				// This is OK because HelpCallbackHandler uses a disgusting static. Not my doing
+				TCHAR * pHelp = HelpCallbackHandler(Editor->WindowID, i, NULL);
+				if (pHelp)
+					s=wxString(pHelp);
+			}
+			if (!s.IsEmpty())
+				pGadget->SetToolTip(s);
+			else
+				pGadget->SetToolTip(NULL);
+		}
+	}
+}
+
 /********************************************************************************************
 
 >	BOOL ColourPicker::GetComponentHelp(ColourContext* const pSourceContext, 
Index: Trunk/XaraLX/wxOil/xrc/EN/jason-strings.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/jason-strings.xrc	(revision 1219)
+++ Trunk/XaraLX/wxOil/xrc/EN/jason-strings.xrc	(revision 1220)
@@ -690,6 +690,12 @@
 			</object>
 			<object class="sizeritem">
 				<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+				<object class="wxStaticText" name="IDS_EDITBH_WEBHEX">
+					<label>Web colour (hexadecimal)</label>
+				</object>
+			</object>
+			<object class="sizeritem">
+				<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
 				<object class="wxStaticText" name="IDS_EDITBH_PARENTCOL">
 					<label>Parent colour</label>
 				</object>


Xara