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

[XaraXtreme-commits] Commit Complete



Commit by  : alex
Repository : xara
Revision   : 968
Date       : Sun May  7 12:22:19 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/Makefile.am
   M /Trunk/XaraLX/wxOil/camelot.cpp
   A /Trunk/XaraLX/wxOil/camplatform.cpp
   A /Trunk/XaraLX/wxOil/camplatform.h
   M /Trunk/XaraLX/wxOil/dlgmgr.cpp
   M /Trunk/XaraLX/wxOil/dlgmgr.h
   M /Trunk/XaraLX/wxXtra/platform.cpp
   M /Trunk/XaraLX/wxXtra/platform.h

Tidied up and abtracted platform-dependent stuff
Set GTK names to resource-ID names


Diff:
Index: Trunk/XaraLX/wxXtra/platform.cpp
===================================================================
--- Trunk/XaraLX/wxXtra/platform.cpp	(revision 967)
+++ Trunk/XaraLX/wxXtra/platform.cpp	(revision 968)
@@ -8,31 +8,52 @@
 
 #include "platform.h"
 
+wxPlatformDependent * wxPlatformDependent::s_PlatformDependent = NULL;
+IMPLEMENT_DYNAMIC_CLASS(wxPlatformDependent, wxObject);
+
 #if defined( __WXGTK__ )
-
 #include <gtk/gtk.h>
+#endif
 
 // Platform specific Init code
-void InitPlatform()
+bool wxPlatformDependent::Init(wxClassInfo * pClassInfo)
 {
-    gtk_rc_parse_string("
"
-                        "       style \"gtk-scale-blip-style\"
"
-                        "       {
"
-                        "               GtkScale::slider-length=13
"
-                        "       }
"
-                        "
"
-                        "       widget_class \"*.GtkHScale\" style \"gtk-scale-blip-style\"
"
-                        "       widget_class \"*.GtkVScale\" style \"gtk-scale-blip-style\"
"
-                        "
");
+    if (!pClassInfo)
+        pClassInfo = CLASSINFO(wxPlatformDependent);
+	wxASSERT(pClassInfo != NULL);
+	wxASSERT(pClassInfo->IsKindOf(CLASSINFO(wxPlatformDependent)));
+    wxASSERT(s_PlatformDependent == NULL);
+    s_PlatformDependent = (wxPlatformDependent *) pClassInfo->CreateObject();
+    wxASSERT(s_PlatformDependent != NULL);
+    if (!s_PlatformDependent) return false;
 
-	return;
+    Get()->Initialise();
+	return true;
 }
 
-#else
+// Deinit static function
+void wxPlatformDependent::DeInit()
+{
+    wxASSERT(s_PlatformDependent != NULL);
+    Get()->Deinitialise();
+    delete (s_PlatformDependent);
+    s_PlatformDependent = NULL;
+}
 
-void InitPlaform()
+// Platform dependent stuff starts here
+
+#if defined( __WXGTK__ )
+void wxPlatformDependent::ParseGtkRcString(char * rcstring)
 {
+    gtk_rc_parse_string(rcstring);
 	return;
 }
 
-#endif
\ No newline at end of file
+void wxPlatformDependent::SetGtkWidgetName(wxWindow * pwxWindow, char * name)
+{
+    gtk_widget_set_name(pwxWindow->m_widget, name);
+    return;
+}
+
+#endif
+
Index: Trunk/XaraLX/wxXtra/platform.h
===================================================================
--- Trunk/XaraLX/wxXtra/platform.h	(revision 967)
+++ Trunk/XaraLX/wxXtra/platform.h	(revision 968)
@@ -11,6 +11,35 @@
 
 #include <wx/wx.h>
 
-void InitPlatform();
+// This is an interface class which allows use of platform dependent functions
+// without the user having to include any platform dependent includes.
 
+class wxPlatformDependent : public wxObject
+{
+public:
+    static bool Init(wxClassInfo * pClassInfo = NULL);
+
+    static void DeInit();
+
+private:
+    static wxPlatformDependent * s_PlatformDependent;
+
+public:
+    static wxPlatformDependent * Get() {return s_PlatformDependent;}
+
+protected:
+    virtual void Initialise() {} // To override
+    virtual void Deinitialise() {} // To override
+
+public:
+    virtual void InitWindow(wxWindow * pwxWindow) {} // To override
+
+#if defined( __WXGTK__ )
+    virtual void ParseGtkRcString(char * rcstring);
+    virtual void SetGtkWidgetName(wxWindow * pwxWindow, char * name);
+#endif
+
+	DECLARE_DYNAMIC_CLASS(wxPlatformDependent);
+};
+
 #endif // __WXXTRA_PLATFORM_H
Index: Trunk/XaraLX/wxOil/camplatform.h
===================================================================
--- Trunk/XaraLX/wxOil/camplatform.h	(revision 0)
+++ Trunk/XaraLX/wxOil/camplatform.h	(revision 968)
@@ -0,0 +1,128 @@
+// $Id: camplatform.h 957 2006-05-05 09:03:18Z luke $
+/* @@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============================
+ */
+
+#ifndef INC_CAMPLATFORM
+#define	INC_CAMPLATFORM
+
+
+/*******************************************************************************************
+
+>	class CamPlatformDependent : public wxPlatformDependent
+
+	Author:		Alex_Bligh <alex@xxxxxxxxxxx>
+	Created:	7/05/2006
+	Purpose:	A derived clas for implementing wx-platform depedent Oil activity
+	Notes:		In the OIL
+	See Also:	
+
+********************************************************************************************/
+
+class CamPlatformDependent : public wxPlatformDependent
+{
+protected:
+	virtual void Initialise();
+
+public:
+	virtual void InitWindow(wxWindow * pwxWindow);
+
+DECLARE_DYNAMIC_CLASS(wxPlatformDependent);
+
+};
+
+#endif
+
Index: Trunk/XaraLX/wxOil/Makefile.am
===================================================================
--- Trunk/XaraLX/wxOil/Makefile.am	(revision 967)
+++ Trunk/XaraLX/wxOil/Makefile.am	(revision 968)
@@ -40,7 +40,7 @@
 	dlgevt.cpp cartprov.cpp cartctl.cpp colourmat.cpp menucmds.cpp menupref.cpp \
 	rendwnd.cpp scroller.cpp helpuser.cpp oilprefs.cpp dragtrgt.cpp \
 	ctrllist.cpp dlgcol.cpp thumb.cpp dragmgr.cpp ccolbar.cpp dragcol.cpp \
-	drawctl.cpp filedlgs.cpp fileutil.cpp ktimer.cpp \
+	drawctl.cpp filedlgs.cpp fileutil.cpp ktimer.cpp camplatform.cpp \
 	outptdib.cpp outptpng.cpp outptgif.cpp gpalopt.cpp bmpfiltr.cpp giffiltr.cpp \
 	fontbase.cpp ftfonts.cpp textfuns.cpp dragbmp.cpp xpoilflt.cpp \
 	resources.cpp
Index: Trunk/XaraLX/wxOil/camplatform.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camplatform.cpp	(revision 0)
+++ Trunk/XaraLX/wxOil/camplatform.cpp	(revision 968)
@@ -0,0 +1,164 @@
+// $Id: camplatform.cpp 957 2006-05-05 09:03:18Z luke $
+/* @@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============================
+ */
+
+
+#include "camtypes.h"
+
+#include "camplatform.h"
+
+IMPLEMENT_DYNAMIC_CLASS(CamPlatformDependent, wxPlatformDependent);
+
+/********************************************************************************************
+
+>	void CamPlatformDependent::Initialise()
+
+
+	Author:		Alex_Bligh <alex@xxxxxxxxxxx>
+	Created:	07/06/2005
+	Inputs:		None
+	Outputs:	None
+	Returns:	TRUE if succeeded, FALSE if fails
+	Purpose:	Initialize platform dependent stuff
+	Errors:		-
+	SeeAlso:	-
+
+********************************************************************************************/
+
+void CamPlatformDependent::Initialise()
+{
+#if defined( __WXGTK__ )
+	ParseGtkRcString("
"
+                     "       style \"gtk-scale-blip-style\"
"
+                     "       {
"
+                     "               GtkScale::slider-length=13
"
+                     "       }
"
+                     "
"
+                     "       widget_class \"*.GtkHScale\" style \"gtk-scale-blip-style\"
"
+                     "       widget_class \"*.GtkVScale\" style \"gtk-scale-blip-style\"
"
+                     "
");
+#endif
+}
+
+/********************************************************************************************
+
+>	void CamPlatformDependent::InitWindow(wxWindow * pwxWindow)
+
+
+	Author:		Alex_Bligh <alex@xxxxxxxxxxx>
+	Created:	07/06/2005
+	Inputs:		None
+	Outputs:	None
+	Returns:	TRUE if succeeded, FALSE if fails
+	Purpose:	Set up a wxWindow
+	Errors:		-
+	SeeAlso:	-
+
+********************************************************************************************/
+
+void CamPlatformDependent::InitWindow(wxWindow * pwxWindow)
+{
+#if defined( __WXGTK__ )
+	// Set the GTK Widget name to the object name
+	const TCHAR * ObjectName = CamResource::GetObjectNameFail(pwxWindow->GetId());
+	if (ObjectName)
+	{
+		wxString WindowIDName(ObjectName);
+		SetGtkWidgetName(pwxWindow, (char *)(const char *)(WindowIDName.mb_str(wxConvUTF8)));
+	}
+#endif
+}
Index: Trunk/XaraLX/wxOil/camelot.cpp
===================================================================
--- Trunk/XaraLX/wxOil/camelot.cpp	(revision 967)
+++ Trunk/XaraLX/wxOil/camelot.cpp	(revision 968)
@@ -125,6 +125,7 @@
 #include "cartprov.h"
 #include "ctrllist.h"
 #include "cartctl.h"
+#include "camplatform.h"
 //
 // Define FILELIST for recent file list on file menu.
 // Note that this currently seems to be rather unreliable.
@@ -327,11 +328,10 @@
 
 	TRACET(_T("CCamApp::OnInit first available time to trace"));
 
-	InitPlatform();
-
 	// Initialize resources system
 	if (!CamResource::Init()) return FALSE;
 	// Initialize the art provider - needed for dialogs
+	wxPlatformDependent::Init(CLASSINFO(CamPlatformDependent));
 	if (!CamArtProvider::Init()) return FALSE;
 	// We need this pretty early so we can handle ERROR boxes etc
 	if (!DialogEventHandler::Init()) return FALSE;
@@ -601,6 +601,7 @@
 	DialogEventHandler::DeInit();
 	// Kill of art provider
 	CamArtProvider::DeInit();
+	wxPlatformDependent::DeInit();
 	// Kill of resources
 	CamResource::DeInit();
 
Index: Trunk/XaraLX/wxOil/dlgmgr.h
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.h	(revision 967)
+++ Trunk/XaraLX/wxOil/dlgmgr.h	(revision 968)
@@ -339,6 +339,9 @@
 					 /*HINSTANCE SubInstance, */ CDlgResID SubDlgID, 
 						CDlgMode Mode = MODELESS, INT32 OpeningPage = -1, CWindowID ParentWnd = NULL);
 private:
+
+	static void CreateRecursor(wxWindow * pwxWindow);
+
 	// Creates a DialogBarOp
 	static BOOL CreateBar(DialogBarOp* DlgOp);
 	static wxWindow* CreateTabbedDialog(DialogTabOp* pTabDlgOp, CDlgMode Mode, INT32 OpeningPage);
Index: Trunk/XaraLX/wxOil/dlgmgr.cpp
===================================================================
--- Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 967)
+++ Trunk/XaraLX/wxOil/dlgmgr.cpp	(revision 968)
@@ -295,6 +295,8 @@
 			pDialogWnd = wxXmlResource::Get()->LoadDialog((wxWindow *)ParentWnd, pDialogName);
 	}
 
+	CreateRecursor(pDialogWnd);
+
 	ERROR1IF(pDialogWnd == NULL, FALSE, _R(IDE_CANNOT_CREATE_DIALOG));
 	pDialogWnd->Hide();
 	CamArtProvider::Get()->EnsureChildBitmapsLoaded(pDialogWnd);
@@ -392,7 +394,38 @@
 	return ok;
 }
 
+/********************************************************************************************
 
+>	static void DialogManager::CreateRecursor(wxWindow * pwxWindow)
+
+
+	Author:		Alex_Bligh <alex@xxxxxxxxxxx>
+	Created:	02/12/2005
+	Inputs:		pWindow - pointer to window to process
+	Outputs:	None
+	Returns:	None
+	Purpose:	Initialize platform dependent resources
+	Errors:		-
+	SeeAlso:	-
+
+********************************************************************************************/
+
+void DialogManager::CreateRecursor(wxWindow * pwxWindow)
+{
+	// Process this one
+	wxPlatformDependent::Get()->InitWindow(pwxWindow);
+
+	// Now process children if any
+	wxWindowList::Node * pNode = pwxWindow->GetChildren().GetFirst();
+	while (pNode)
+	{
+		CreateRecursor(pNode->GetData());
+		pNode = pNode->GetNext();
+	}
+	return;
+}
+
+
 /********************************************************************************************
 
 >	BOOL DialogManager::PostCreate(DialogOp * pDialogOp);


Xara