summaryrefslogtreecommitdiff
path: root/library/resources.cpp
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 16:55:48 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 16:55:48 +0200
commitdaea231de0ae28fc8343f29f09d0457cc0591461 (patch)
treea1d572442d2c903e40741a859ad47c8b0d740969 /library/resources.cpp
parent1.13 (diff)
downloadFreeFileSync-daea231de0ae28fc8343f29f09d0457cc0591461.tar.gz
FreeFileSync-daea231de0ae28fc8343f29f09d0457cc0591461.tar.bz2
FreeFileSync-daea231de0ae28fc8343f29f09d0457cc0591461.zip
1.14
Diffstat (limited to 'library/resources.cpp')
-rw-r--r--library/resources.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/library/resources.cpp b/library/resources.cpp
index 68eeb4d6..9169bf85 100644
--- a/library/resources.cpp
+++ b/library/resources.cpp
@@ -3,6 +3,7 @@
#include <wx/zipstrm.h>
#include <wx/image.h>
#include <wx/icon.h>
+#include <wx/mstream.h>
#include "globalFunctions.h"
#ifdef FFS_WIN
@@ -111,6 +112,24 @@ GlobalResources::~GlobalResources()
}
+void loadAnimFromZip(wxZipInputStream& zipInput, wxAnimation* animation)
+{
+ //Workaround for wxWidgets:
+ //construct seekable input stream (zip-input stream is non-seekable) for wxAnimation::Load()
+ //luckily this method call is very fast: below measurement precision!
+ vector<unsigned char> data;
+ data.reserve(10000);
+
+ int newValue = 0;
+ while ((newValue = zipInput.GetC()) != wxEOF)
+ data.push_back(newValue);
+
+ wxMemoryInputStream seekAbleStream(&data.front(), data.size()); //stream does not take ownership of data
+
+ animation->Load(seekAbleStream, wxANIMATION_TYPE_GIF);
+}
+
+
void GlobalResources::load()
{
wxFileInputStream input(wxT("Resources.dat"));
@@ -121,21 +140,22 @@ void GlobalResources::load()
wxZipInputStream resourceFile(input);
- wxZipEntry* entry;
+ wxZipEntry* entry = NULL;
map<wxString, wxBitmap*>::iterator bmp;
while ((entry = resourceFile.GetNextEntry()))
{
wxString name = entry->GetName();
- //just to be sure: search if entry is available in map
+ //search if entry is available in map
if ((bmp = bitmapResource.find(name)) != bitmapResource.end())
*(bmp->second) = wxBitmap(wxImage(resourceFile, wxBITMAP_TYPE_PNG));
+ else if (name == wxT("money.gif"))
+ loadAnimFromZip(resourceFile, animationMoney);
+ else if (name == wxT("working.gif"))
+ loadAnimFromZip(resourceFile, animationSync);
}
}
- animationMoney->LoadFile(wxT("Resources.a01"));
- animationSync->LoadFile(wxT("Resources.a02"));
-
#ifdef FFS_WIN
programIcon = new wxIcon(wxT("ffsIcon1"));
#else
bgstack15