More workingness, now accepts locally-stored resources!

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1158 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
coppro
2008-08-21 04:06:50 +00:00
parent d13b721b41
commit ec63e3b18b
9 changed files with 155 additions and 33 deletions
+11 -2
View File
@@ -98,7 +98,14 @@ Image load_resource_image(const String& name) {
else if (wxFileExists(file + _(".bmp"))) resource.LoadFile(file + _(".bmp"));
else if (wxFileExists(file + _(".ico"))) resource.LoadFile(file + _(".ico"));
else if (wxFileExists(file + _(".cur"))) resource.LoadFile(file + _(".cur"));
if (!resource.Ok()) handle_error(InternalError(String(_("Cannot find resource file at ")) + file));
if (resource.Ok()) return resource;
static String local_path = wxStandardPaths::Get().GetUserDataDir() + _("/resource/");
file = local_path + name;
if (wxFileExists(file + _(".png"))) resource.LoadFile(file + _(".png"));
else if (wxFileExists(file + _(".bmp"))) resource.LoadFile(file + _(".bmp"));
else if (wxFileExists(file + _(".ico"))) resource.LoadFile(file + _(".ico"));
else if (wxFileExists(file + _(".cur"))) resource.LoadFile(file + _(".cur"));
if (!resource.Ok()) handle_error(InternalError(String(_("Cannot find resource file at ")) + path + name + _(" or ") + file));
return resource;
#else
#error Handling of resource loading needs to be declared.
@@ -118,7 +125,9 @@ wxIcon load_resource_icon(const String& name) {
return wxIcon(_("icon/") + name);
#else
static String path = wxStandardPaths::Get().GetDataDir() + _("/resource/icon/");
return wxIcon(path + name + _(".ico"), wxBITMAP_TYPE_ICO);
static String local_path = wxStandardPaths::Get().GetUserDataDir() + _("/resource/icon/");
if (wxFileExists(path + name + _(".ico"))) return wxIcon(path + name + _(".ico"), wxBITMAP_TYPE_ICO);
else return wxIcon(local_path + name + _(".ico"), wxBITMAP_TYPE_ICO);
#endif
}