[Scummvm-cvs-logs] SF.net SVN: scummvm:[48744] tools/branches/branch-1-1-0

criezy at users.sourceforge.net criezy at users.sourceforge.net
Tue Apr 20 13:24:35 CEST 2010


Revision: 48744
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48744&view=rev
Author:   criezy
Date:     2010-04-20 11:24:35 +0000 (Tue, 20 Apr 2010)

Log Message:
-----------
Backport fix for bug #2984217: TOOLS: The media directory is not installed

Modified Paths:
--------------
    tools/branches/branch-1-1-0/Makefile.common
    tools/branches/branch-1-1-0/configure
    tools/branches/branch-1-1-0/gui/main.cpp
    tools/branches/branch-1-1-0/gui/main.h

Modified: tools/branches/branch-1-1-0/Makefile.common
===================================================================
--- tools/branches/branch-1-1-0/Makefile.common	2010-04-20 11:22:56 UTC (rev 48743)
+++ tools/branches/branch-1-1-0/Makefile.common	2010-04-20 11:24:35 UTC (rev 48744)
@@ -99,7 +99,9 @@
 all: $(TARGETS)
 
 install: $(TARGETS)
-	for i in $^ ; do $(INSTALL) -p -m 0755 $$i $(DESTDIR) ; done
+	for i in $^ ; do $(INSTALL) -p -m 0755 $$i $(DESTDIR)$(BINDIR) ; done
+	$(INSTALL) -m 0755 -d $(DESTDIR)$(DATADIR)/scummvm-tools
+	$(INSTALL) -p -m 0644 $(srcdir)/gui/media/*.* $(DESTDIR)$(DATADIR)/scummvm-tools
 
 bundle_name = ScummVM\ Tools.app
 bundle: scummvm-tools$(EXEEXT)

Modified: tools/branches/branch-1-1-0/configure
===================================================================
--- tools/branches/branch-1-1-0/configure	2010-04-20 11:22:56 UTC (rev 48743)
+++ tools/branches/branch-1-1-0/configure	2010-04-20 11:24:35 UTC (rev 48744)
@@ -196,7 +196,7 @@
 				if test `basename $path_dir` = bin ; then
 					_wxpath=`dirname $path_dir`
 				fi
-				# break at first sdl-config found in path
+				# break at first wx-config found in path
 				break 2
 			fi
 		done
@@ -262,8 +262,9 @@
   -h, --help             display this help and exit
 
 Installation directories:
-  --prefix=DIR           use this prefix for installing the Tools [/usr/local]
+  --prefix=DIR           use this prefix for installing the ScummVM Tools [/usr/local]
   --bindir=DIR           directory to install the tool binaries in [PREFIX/bin]
+  --datadir=DIR          directory to install the GUI tool media files in [PREFIX/share]
   --mandir=DIR           directory to install the manpage in [PREFIX/share/man]
   --libdir=DIR           directory to install the plugins in [PREFIX/lib]
 
@@ -397,6 +398,9 @@
 	--bindir=*)
 		_bindir=`echo $ac_option | cut -d '=' -f 2`
 		;;
+	--datadir=*)
+		_datadir=`echo $ac_option | cut -d '=' -f 2`
+		;;
 	--mandir=*)
 		_mandir=`echo $ac_option | cut -d '=' -f 2`
 		;;
@@ -1081,9 +1085,11 @@
 # Figure out installation directories
 #
 test -z "$_bindir" && _bindir="$_prefix/bin"
+test -z "$_datadir" && _datadir="$_prefix/share"
 test -z "$_mandir" && _mandir="$_prefix/share/man"
 test -z "$_libdir" && _libdir="$_prefix/lib"
 
+_def_media_path='#define APP_MEDIA_PATH "'$_datadir'"'
 
 #
 # Do CXXFLAGS now we know the compiler version
@@ -1131,6 +1137,9 @@
 
 $_config_h_data
 
+/* paths */
+$_def_media_path
+
 /* Data types */
 typedef unsigned $type_1_byte byte;
 typedef unsigned int uint;
@@ -1176,6 +1185,7 @@
 
 PREFIX := $_prefix
 BINDIR := $_bindir
+DATADIR := $_datadir
 MANDIR := $_mandir
 LIBDIR := $_libdir
 

Modified: tools/branches/branch-1-1-0/gui/main.cpp
===================================================================
--- tools/branches/branch-1-1-0/gui/main.cpp	2010-04-20 11:22:56 UTC (rev 48743)
+++ tools/branches/branch-1-1-0/gui/main.cpp	2010-04-20 11:24:35 UTC (rev 48744)
@@ -36,6 +36,10 @@
 #include <wx/hyperlink.h>
 #include <wx/notebook.h>
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
 #include "main.h"
 
 #include "pages.h"
@@ -521,15 +525,8 @@
 		wxImage::AddHandler(new wxGIFHandler);
 
 	// Load image files
-#ifdef __WXMSW__
-	// Windows likes subfolders for media files
-	_logo.LoadFile(wxT("media/") + logo, wxBITMAP_TYPE_JPEG);
-	_tile.LoadFile(wxT("media/") + tile, wxBITMAP_TYPE_GIF);
-#else
-	// On other platforms, files are more scattered, and we use the standard resource dir
-	_logo.LoadFile(wxStandardPaths::Get().GetResourcesDir() + wxT("/") + logo, wxBITMAP_TYPE_JPEG);
-	_tile.LoadFile(wxStandardPaths::Get().GetResourcesDir() + wxT("/") + tile, wxBITMAP_TYPE_GIF);
-#endif
+	_logo = loadBitmapFile(logo, wxBITMAP_TYPE_JPEG);
+	_tile = loadBitmapFile(tile, wxBITMAP_TYPE_GIF);
 
 	// Load font
 	_font = wxFont(10, wxFONTFAMILY_SWISS, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false);
@@ -569,6 +566,32 @@
 	dc.DrawText(_title, 290, 70);
 }
 
+wxBitmap Header::loadBitmapFile(const wxString& file, wxBitmapType type) {
+	wxBitmap bitmap;
+
+	// Tries the following locations (in that order):
+	// - wxStandardPaths::Get().GetResourcesDir()
+	//   On all platfforms. It should be the default place where the files are located.
+	// - APP_MEDIA_PATH/scummvm-tools
+	//   When APP_MEDIA_PATH is defined (i.e. on platform where configure is used).
+	//   With wxWidgets 2.8 wxStandardPaths::Get().GetResourcesDir() does not always return the expected path.
+	// - CURRENT_DIR/media
+	//   On all platforms. This is a fallback if the above fails.
+	// - CURRENT_DIR/gui/media
+	//   On all platforms. This in last resort and is needed when running from the source tree.
+	bitmap.LoadFile(wxStandardPaths::Get().GetResourcesDir() + wxT("/") + file, type);
+#ifdef APP_MEDIA_PATH
+	if (!bitmap.IsOk())
+		bitmap.LoadFile(wxString(wxT(APP_MEDIA_PATH)) + wxT("/scummvm-tools/") + file, type);
+#endif
+	if (!bitmap.IsOk())
+		bitmap.LoadFile(wxT("media/") + file, type);
+	if (!bitmap.IsOk())
+		bitmap.LoadFile(wxT("gui/media/") + file, type);
+
+	return bitmap;
+}
+
 AdvancedSettingsDialog::AdvancedSettingsDialog(wxWindow *parent, Configuration &defaults) :
 	wxDialog(parent, wxID_ANY, wxT("Default Settings"), wxDefaultPosition, wxDefaultSize),
 	_defaults(defaults)

Modified: tools/branches/branch-1-1-0/gui/main.h
===================================================================
--- tools/branches/branch-1-1-0/gui/main.h	2010-04-20 11:22:56 UTC (rev 48743)
+++ tools/branches/branch-1-1-0/gui/main.h	2010-04-20 11:24:35 UTC (rev 48744)
@@ -235,6 +235,8 @@
 
 	void onPaint(wxPaintEvent &evt);
 protected:
+	wxBitmap loadBitmapFile(const wxString&, wxBitmapType);
+
 	wxFont _font;
 	wxBitmap _logo;
 	wxBitmap _tile;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list