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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 1059
Date       : Mon May 15 19:03:48 BST 2006

Changed paths:
   M /Trunk/XaraLX/Kernel/statline.cpp
   M /Trunk/XaraLX/wxOil/camresource.cpp
   M /Trunk/XaraLX/wxOil/camresource.h
   M /Trunk/XaraLX/wxOil/camview.cpp
   M /Trunk/XaraLX/wxOil/camview.h
   M /Trunk/XaraLX/wxOil/dlgmgr.cpp
   M /Trunk/XaraLX/wxOil/dlgmgr.h
   M /Trunk/XaraLX/wxOil/stdwx.h

Some status line fixes, but still not displaying help right for various reasons


Diff:
Index: Trunk/XaraLX/Kernel/statline.cpp
===================================================================
--- Trunk/XaraLX/Kernel/statline.cpp	(revision 1058)
+++ Trunk/XaraLX/Kernel/statline.cpp	(revision 1059)
@@ -324,25 +324,19 @@
 	if (TextValid)
 		PrefixSelDesc=STATUSLINE_SELDESC_BARDRAG;
 
-//	CWindowID	WinID=NULL;
+	WinCoord	WndPos(0,0);
+	CWindowID	WinID=DialogManager::GetWindowUnderPointer(&WndPos);
 	DocView*	pDocView=NULL;
 	Spread*		pSpread=NULL;
-	WinCoord	WndPos(0,0);
 	DocCoord	DocPos(0,0);
 
 	// if no valid text so far (and valid current doc else something deep down goes BANG)
 	// get mouse pos (in DocCoords), handle of window it is over, DocView ptr, spread ptr
-	if (TextValid!=TRUE && Document::GetCurrent()!=NULL)
+	if (!TextValid && Document::GetCurrent()!=NULL)
 	{
-PORTNOTE("Statline", "Removed use of GetMousePosAndWindowID to abort snap processing")
-#if !defined(EXCLUDE_FROM_XARALX)
-		BOOL MouseOK=CCamApp::GetMousePosAndWindowID(&WinID,&WndPos);
-		if (!MouseOK)
-			return FALSE;
 
 		if (WinID != NULL)
-			pDocView=ScreenView::GetDocViewFromWindowID(WinID);
-#endif
+			pDocView=CCamView::GetDocViewFromWindowID(WinID);
 
 		if (pDocView != NULL)
 		{
@@ -402,6 +396,9 @@
 			if (TextValid)
 				PrefixSelDesc=STATUSLINE_SELDESC_BUTTONS;
 #endif
+			TextValid=DialogManager::GetStatusLineText(&text,NULL);
+			if (TextValid)
+				PrefixSelDesc=STATUSLINE_SELDESC_BUTTONS;
 
 #ifndef STANDALONE
 			if (!TextValid)
Index: Trunk/XaraLX/wxOil/camresource.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camresource.cpp	(revision 1058)
+++ Trunk/XaraLX/wxOil/camresource.cpp	(revision 1059)
@@ -125,6 +125,7 @@
 CamResourceRemember * CamResource::pFirstRemember=NULL;
 BOOL CamResource::HaveCheckedResourcePath = FALSE;
 wxLocale * CamResource::m_pLocale = NULL;
+wxHelpProvider * CamResource::m_pHelpProvider = NULL;
 
 ResourceStringToBitmap * CamResource::pBitmapHash = NULL;
 
@@ -133,6 +134,7 @@
 
 wxArrayString CamResource::BitmapExtensions;
 
+#if 0
 #if !defined(EXCLUDE_FROM_XARLIB)
 // Bodge for the toolbar bitmap
 wxImage					imageBevelTool;
@@ -155,6 +157,7 @@
 wxImage					imageTransTool;
 wxImage					imageZoomTool;
 #endif
+#endif
 
 /********************************************************************************************
 
@@ -1504,6 +1507,7 @@
 
 	wxYield(); // yield again to allow repaint
 
+#if 0
 	LoadwxImage(imageBevelTool, _T("lbeveltool32.png") );
 	LoadwxImage(imageBezTool, _T("lbeztool32.png") );
 	LoadwxImage(imageBlendTool, _T("lblendtool32.png") );
@@ -1527,7 +1531,13 @@
 	TRACET(_T("CamResource::Init() Added images"));
 
 	wxYield(); // yield again to allow repaint
+#endif
 
+	m_pHelpProvider = new wxHelpControllerHelpProvider;
+	if (!m_pHelpProvider)	
+		return FALSE;
+	wxHelpProvider::Set(m_pHelpProvider);
+
 	if (!wxXmlResource::Get()->Load(GetResourceFilePath(_T("dialogs.xrc"))))
 	{
 		TRACE(_T("Could not load dialogs.xrc"));
@@ -1601,6 +1611,12 @@
 
 BOOL CamResource::DeInit()
 {
+	if (m_pHelpProvider)
+	{
+		delete m_pHelpProvider;
+		m_pHelpProvider = NULL;
+	}
+
 	if (pwxFileSystem)
 	{
 		delete (pwxFileSystem);
Index: Trunk/XaraLX/wxOil/camresource.h
===================================================================
--- Trunk/XaraLX/wxOil/camresource.h	(revision 1058)
+++ Trunk/XaraLX/wxOil/camresource.h	(revision 1059)
@@ -114,6 +114,7 @@
 class wxFSFile;
 class wxBimtap;
 class wxSplashScreen;
+class wxHelpProvider;
 
 typedef UINT32 ResourceID;
 
@@ -212,6 +213,7 @@
 	wxFSFile * pwxFSFile;
 	static wxFileSystem * pwxFileSystem;
 	static wxLocale * m_pLocale;
+	static wxHelpProvider * m_pHelpProvider;
 
 public:
 	CCLexFile * Open ( ResourceID ID, BOOL ErrorReporting=TRUE, BOOL ExceptionThrowing=FALSE);
Index: Trunk/XaraLX/wxOil/camview.h
===================================================================
--- Trunk/XaraLX/wxOil/camview.h	(revision 1058)
+++ Trunk/XaraLX/wxOil/camview.h	(revision 1059)
@@ -418,6 +418,8 @@
     static void wxRect2Rect(const wxRect& rect, Rect* pkrect);
 	static void Rect2wxRect(const Rect& krect, wxRect* prect);
 
+public:
+	static DocView *CCamView::GetDocViewFromWindowID( CWindowID WindowID );
 
 // Static variables
 protected:
Index: Trunk/XaraLX/wxOil/camview.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camview.cpp	(revision 1058)
+++ Trunk/XaraLX/wxOil/camview.cpp	(revision 1059)
@@ -4137,7 +4137,46 @@
 }
 
 
+/********************************************************************************************
+>	static DocView* ScreenView::GetDocViewFromHwnd(CWindowID WindowID)
 
+	Author:		Justin_Flude (Xara Group Ltd) <camelotdev@xxxxxxxx>
+	Created:	28/7/94
+	Inputs:		The handle of the render window to find.
+	Outputs:	-
+	Returns:	A pointer to the DocView associated with a render window, or NULL if
+				there isn't one.
+	Purpose:	Given a window handle of a ScreenView render window, this function will
+				return a pointer to the kernel DocView object that renders into that
+				window, or NULL if there isn't one.
+	Errors:		-
+	SeeAlso:	-
+********************************************************************************************/
+
+DocView *CCamView::GetDocViewFromWindowID( CWindowID WindowID )
+{
+	// For all kernel documents in existence . . .
+	List* pDocList = &(GetApplication()->Documents);
+	for (Document* pKernelDoc = (Document*) pDocList->GetHead();
+		 pKernelDoc != NULL;
+		 pKernelDoc = (Document*) pDocList->GetNext(pKernelDoc))
+	{
+
+		DocView * pDocView = pKernelDoc->GetFirstDocView();
+		
+		while (pDocView)
+		{
+			if ( pDocView->GetRenderWindow() == WindowID )
+				return pDocView;
+			pDocView = pKernelDoc->GetNextDocView(pDocView);
+		}
+	} 
+
+	// Couldn't find the handle, so return nothing.
+	return NULL;
+}	
+
+
 /********************************************************************************************
 
 >	void ViewDragTarget::ViewDragTarget() 
Index: Trunk/XaraLX/wxOil/dlgmgr.h
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.h	(revision 1058)
+++ Trunk/XaraLX/wxOil/dlgmgr.h	(revision 1059)
@@ -725,6 +725,10 @@
 	// adds the control to the dialog helper class
 	static BOOL AddDialogControlToHelper(CWindowID WindowID, CGadgetID Gadget);
 	static BOOL RemoveDialogControlFromHelper(CWindowID, CGadgetID);
+
+	static BOOL GetStatusLineText(String_256* ptext, CWindowID window);
+	static CWindowID GetWindowUnderPointer(WinCoord * wc = NULL);
+
 public:
 PORTNOTE("dialog","Removed HWND and timer usage")
 #ifndef EXCLUDE_FROM_XARALX
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 1058)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 1059)
@@ -7368,9 +7368,91 @@
 
 
 
+/********************************************************************************************
 
+>	static BOOL DialogManager::GetStatusLineText(String_256* ptext, CWindowID window)
 
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	15/05/2006
+	Inputs:		window - the window ID, or NULL for the current mouse position
+	Outputs:	pText - pointer to the text to fill in
+	Returns:	TRUE on success else FALSE
+	Purpose:	Fills in the status line text from the help text if over a control
+	Scope:		Public
+	Errors:		-
+	SeeAlso:	-
 
+********************************************************************************************/
+
+BOOL DialogManager::GetStatusLineText(String_256* ptext, CWindowID window)
+{
+	if (!ptext)
+		return FALSE;
+	wxPoint pt; // Unused
+	if (!window)
+		window=::wxFindWindowAtPointer(pt);
+	if (!window)
+		return FALSE;
+
+	wxHelpProvider * hp = wxHelpProvider::Get();
+
+	// Now some controls contain other controls, so we look down the heirarch if we can't find one
+	// immediately
+	wxString help;
+	do
+	{
+		if (!window->IsKindOf(CLASSINFO(wxControl)))
+			return FALSE;
+
+		if (hp)
+			help = hp->GetHelp(window);
+		else
+			help = ((wxControl *)window)->GetHelpText();
+
+		if (help.IsEmpty())
+		{
+			wxToolTip* pTip = window->GetToolTip();
+			if (pTip) help=pTip->GetTip();
+		}
+
+		window=window->GetParent();
+	} while (window && help.IsEmpty());
+
+	if (help.IsEmpty())
+		return FALSE;
+
+	*ptext = help;
+	return TRUE;
+}
+
+/********************************************************************************************
+
+>	static CWindowID DialogManager::GetWindowUnderPointer(WinCoord * wc=NULL)
+
+	Author:		Alex Bligh <alex@xxxxxxxxxxx>
+	Created:	15/05/2006
+	Inputs:		-
+	Outputs:	wc - if non-NULL, filled in with the pointer coords
+	Returns:	the window ID under the pointer or NULL for none
+	Purpose:	Fills in the status line text from the help text if over a control
+	Scope:		Public
+	Errors:		-
+	SeeAlso:	-
+
+********************************************************************************************/
+
+CWindowID DialogManager::GetWindowUnderPointer(WinCoord * wc /*=NULL*/)
+{
+	wxPoint pt(0,0);
+	wxWindow * w=::wxFindWindowAtPointer(pt);
+	if (wc)
+	{
+		wc->x=pt.x;
+		wc->y=pt.y;
+	}
+	return w;
+}
+
 // Old windows routine follows
 #if 0
 /********************************************************************************************
Index: Trunk/XaraLX/wxOil/stdwx.h
===================================================================
--- Trunk/XaraLX/wxOil/stdwx.h	(revision 1058)
+++ Trunk/XaraLX/wxOil/stdwx.h	(revision 1059)
@@ -104,6 +104,7 @@
 #include <wx/cmdline.h>
 #include <wx/cmdproc.h>
 #include <wx/config.h>
+#include <wx/cshelp.h>
 #include <wx/dcbuffer.h>
 #include <wx/display.h>
 #include <wx/dir.h>


Xara