summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rbutil/autodetection.h2
-rw-r--r--rbutil/icons/bin2c.c172
-rw-r--r--rbutil/icons/bootloader_btn.pngbin0 -> 3345 bytes
-rw-r--r--rbutil/icons/doom_btn.pngbin0 -> 3814 bytes
-rw-r--r--rbutil/icons/font_btn.pngbin0 -> 1926 bytes
-rw-r--r--rbutil/icons/rbinstall_btn.pngbin0 -> 3026 bytes
-rw-r--r--rbutil/icons/rembootloader_btn.pngbin0 -> 3693 bytes
-rw-r--r--rbutil/icons/remrb_btn.pngbin0 -> 3634 bytes
-rw-r--r--rbutil/icons/themes_btn.pngbin0 -> 2238 bytes
-rw-r--r--rbutil/rbutil.cbp29
-rw-r--r--rbutil/rbutil.cpp6
-rw-r--r--rbutil/rbutil.h4
-rw-r--r--rbutil/rbutilApp.cpp4
-rw-r--r--rbutil/rbutilFrm.cpp31
-rw-r--r--rbutil/rbutilFrm.h2
15 files changed, 233 insertions, 17 deletions
diff --git a/rbutil/autodetection.h b/rbutil/autodetection.h
index a69b9e4bca..cfd0dbab96 100644
--- a/rbutil/autodetection.h
+++ b/rbutil/autodetection.h
@@ -41,7 +41,7 @@ struct UsbDeviceInfo
bool detectDevices(UsbDeviceInfo* tempdevice);
-wxArrayString getPossibleMountPoints(); /* this funktion has to be implemented for every OS
+wxArrayString getPossibleMountPoints(); /* this funktion has to be implemented for every OS */
/********************************
diff --git a/rbutil/icons/bin2c.c b/rbutil/icons/bin2c.c
new file mode 100644
index 0000000000..de4bed8348
--- /dev/null
+++ b/rbutil/icons/bin2c.c
@@ -0,0 +1,172 @@
+ // bin2c.c
+ //
+ // convert a binary file into a C source vector
+ //
+ // put into the public domain by Sandro Sigala
+ //
+ // syntax: bin2c [-c] [-z] <input_file> <output_file>
+ //
+ // -c add the "const" keyword to definition
+ // -z terminate the array with a zero (useful for embedded C strings)
+ //
+ // examples:
+ // bin2c -c myimage.png myimage_png.cpp
+ // bin2c -z sometext.txt sometext_txt.cpp
+
+ #include <ctype.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+
+ #ifndef PATH_MAX
+ #define PATH_MAX 1024
+ #endif
+
+ int useconst = 0;
+ int zeroterminated = 0;
+
+ int myfgetc(FILE *f)
+ {
+ int c = fgetc(f);
+ if (c == EOF && zeroterminated) {
+ zeroterminated = 0;
+ return 0;
+ }
+ return c;
+ }
+
+
+ void process(const char *ifname, const char *ofname)
+ {
+ FILE *ifile, *ofile;
+ /* modified */
+ int counter=0;
+ char buf2[PATH_MAX];
+ char* cp2;
+ char* cp3;
+ if ((cp3 = strrchr(ofname, '/')) != NULL)
+ ++cp3;
+ else {
+ if ((cp3 = strrchr(ofname, '\\')) != NULL)
+ ++cp3;
+ else
+ cp3 = ofname;
+ }
+
+ strcpy(buf2, cp3);
+ cp2 = strrchr(buf2, '.');
+ *cp2 = '.';
+ cp2++;
+ *cp2 = 'h';
+ cp2++;
+ *cp2 ='\0';
+
+
+ ifile = fopen(ifname, "rb");
+ if (ifile == NULL) {
+ fprintf(stderr, "cannot open %s for reading\n", ifname);
+ exit(1);
+ }
+ ofile = fopen(ofname, "wb");
+ if (ofile == NULL) {
+ fprintf(stderr, "cannot open %s for writing\n", ofname);
+ exit(1);
+ }
+ char buf[PATH_MAX], *p;
+ const char *cp;
+ if ((cp = strrchr(ifname, '/')) != NULL)
+ ++cp;
+ else {
+ if ((cp = strrchr(ifname, '\\')) != NULL)
+ ++cp;
+ else
+ cp = ifname;
+ }
+ strcpy(buf, cp);
+ for (p = buf; *p != '\0'; ++p)
+ if (!isalnum(*p))
+ *p = '_';
+ fprintf(ofile,"#include \"%s\" \n\n",buf2);
+ fprintf(ofile, "%sunsigned char %s[] = {\n", useconst ? "const " : "", buf);
+ int c, col = 1;
+ while ((c = myfgetc(ifile)) != EOF) {
+ counter++;
+ if (col >= 78 - 6) {
+ fputc('\n', ofile);
+ col = 1;
+ }
+ fprintf(ofile, "0x%.2x, ", c);
+ col += 6;
+
+ }
+ fprintf(ofile, "\n};\n");
+
+ /* modified */
+ fprintf(ofile,"int %s_length = %i; \n",buf,counter);
+
+
+ FILE *o2file;
+ o2file = fopen(buf2, "wb");
+ if (o2file == NULL) {
+ fprintf(stderr, "cannot open %s for writing\n", buf2);
+ exit(1);
+ }
+
+ fprintf(o2file, "#ifndef __%s__ \n", buf);
+ fprintf(o2file, "#define __%s__ \n", buf);
+
+ fprintf(o2file, "extern %sunsigned char %s[]; \n\n", useconst ? "const " : "", buf);
+ fprintf(o2file, "extern int %s_length; \n\n", buf);
+
+ fprintf(o2file, "#endif \n");
+
+ fclose(ifile);
+ fclose(ofile);
+ fclose(o2file);
+ }
+
+ void usage(void)
+ {
+ fprintf(stderr, "usage: bin2c <input_files> \n");
+ exit(1);
+ }
+
+ int main(int argc, char **argv)
+ {
+ if (argc < 2) {
+ usage();
+ }
+ int i;
+ for(i = 1;i < argc ; i++)
+ {
+ char buf[PATH_MAX];
+ char* cp;
+ strcpy(buf, argv[i]);
+ cp = strrchr(buf, '.');
+ cp++;
+ strcpy(cp,"cpp");
+ process(argv[i], buf);
+ }
+
+
+ /*
+ while (argc > 3) {
+ if (!strcmp(argv[1], "-c")) {
+ useconst = 1;
+ --argc;
+ ++argv;
+ } else if (!strcmp(argv[1], "-z")) {
+ zeroterminated = 1;
+ --argc;
+ ++argv;
+ } else {
+ usage();
+ }
+ }
+ if (argc != 3) {
+ usage();
+ }
+ process(argv[1], argv[2]);
+ */
+ return 0;
+ }
diff --git a/rbutil/icons/bootloader_btn.png b/rbutil/icons/bootloader_btn.png
new file mode 100644
index 0000000000..3590c9c4b9
--- /dev/null
+++ b/rbutil/icons/bootloader_btn.png
Binary files differ
diff --git a/rbutil/icons/doom_btn.png b/rbutil/icons/doom_btn.png
new file mode 100644
index 0000000000..9a53a283e9
--- /dev/null
+++ b/rbutil/icons/doom_btn.png
Binary files differ
diff --git a/rbutil/icons/font_btn.png b/rbutil/icons/font_btn.png
new file mode 100644
index 0000000000..dd47a2912a
--- /dev/null
+++ b/rbutil/icons/font_btn.png
Binary files differ
diff --git a/rbutil/icons/rbinstall_btn.png b/rbutil/icons/rbinstall_btn.png
new file mode 100644
index 0000000000..c37ebec263
--- /dev/null
+++ b/rbutil/icons/rbinstall_btn.png
Binary files differ
diff --git a/rbutil/icons/rembootloader_btn.png b/rbutil/icons/rembootloader_btn.png
new file mode 100644
index 0000000000..8abf1da30e
--- /dev/null
+++ b/rbutil/icons/rembootloader_btn.png
Binary files differ
diff --git a/rbutil/icons/remrb_btn.png b/rbutil/icons/remrb_btn.png
new file mode 100644
index 0000000000..bd484b96c1
--- /dev/null
+++ b/rbutil/icons/remrb_btn.png
Binary files differ
diff --git a/rbutil/icons/themes_btn.png b/rbutil/icons/themes_btn.png
new file mode 100644
index 0000000000..264ba79460
--- /dev/null
+++ b/rbutil/icons/themes_btn.png
Binary files differ
diff --git a/rbutil/rbutil.cbp b/rbutil/rbutil.cbp
index 9351795977..ab819fbd61 100644
--- a/rbutil/rbutil.cbp
+++ b/rbutil/rbutil.cbp
@@ -91,6 +91,9 @@
<Add directory="$(#WX.lib)" />
<Add directory=".\" />
</Linker>
+ <ExtraCommands>
+ <Add before="cmd /c icons\bin2c.exe icons\*.png" />
+ </ExtraCommands>
<Unit filename="Makefile" />
<Unit filename="archos.ico" />
<Unit filename="autodetection.cpp" />
@@ -103,6 +106,32 @@
<Unit filename="h100sums.h" />
<Unit filename="h120sums.h" />
<Unit filename="h300sums.h" />
+ <Unit filename="icons\bin2c.c">
+ <Option compilerVar="CC" />
+ <Option compile="0" />
+ <Option link="0" />
+ </Unit>
+ <Unit filename="icons\bootloader_btn.cpp" />
+ <Unit filename="icons\bootloader_btn.h" />
+ <Unit filename="icons\bootloader_btn.png" />
+ <Unit filename="icons\doom_btn.cpp" />
+ <Unit filename="icons\doom_btn.h" />
+ <Unit filename="icons\doom_btn.png" />
+ <Unit filename="icons\font_btn.cpp" />
+ <Unit filename="icons\font_btn.h" />
+ <Unit filename="icons\font_btn.png" />
+ <Unit filename="icons\rbinstall_btn.cpp" />
+ <Unit filename="icons\rbinstall_btn.h" />
+ <Unit filename="icons\rbinstall_btn.png" />
+ <Unit filename="icons\rembootloader_btn.cpp" />
+ <Unit filename="icons\rembootloader_btn.h" />
+ <Unit filename="icons\rembootloader_btn.png" />
+ <Unit filename="icons\remrb_btn.cpp" />
+ <Unit filename="icons\remrb_btn.h" />
+ <Unit filename="icons\remrb_btn.png" />
+ <Unit filename="icons\themes_btn.cpp" />
+ <Unit filename="icons\themes_btn.h" />
+ <Unit filename="icons\themes_btn.png" />
<Unit filename="install_3d.xpm" />
<Unit filename="install_dialogs.cpp" />
<Unit filename="install_dialogs.h" />
diff --git a/rbutil/rbutil.cpp b/rbutil/rbutil.cpp
index d7ee3ed529..a36d1a0b94 100644
--- a/rbutil/rbutil.cpp
+++ b/rbutil/rbutil.cpp
@@ -21,6 +21,12 @@
#include "rbutil.h"
#include "installlog.h"
+/* this function gets a Bitmap from embedded memory */
+wxBitmap wxGetBitmapFromMemory(const unsigned char *data,int length)
+{
+ wxMemoryInputStream istream( data,length);
+ return wxBitmap(wxImage(istream, wxBITMAP_TYPE_ANY, -1), -1);
+}
// This class allows us to return directories as well as files to
// wxDir::Traverse
diff --git a/rbutil/rbutil.h b/rbutil/rbutil.h
index f8a88d4e8d..3c61bd0c4e 100644
--- a/rbutil/rbutil.h
+++ b/rbutil/rbutil.h
@@ -59,6 +59,7 @@
#include <wx/notebook.h>
#include <wx/html/htmlwin.h>
#include <wx/hyperlink.h>
+#include <wx/mstream.h>
#ifdef __WXMSW__
#define PATH_SEP "\\"
@@ -132,6 +133,7 @@ public:
extern GlobalVars* gv;
+
wxString wxFindAppPath(const wxString& argv0, const wxString& cwd,
const wxString& appVariableName);
int DownloadURL(wxString src, wxString dest);
@@ -143,6 +145,8 @@ bool checkZip(wxString zipname);
wxString stream_err_str(int errnum);
bool rm_rf(wxString file);
+wxBitmap wxGetBitmapFromMemory(const unsigned char *data,int length);
+
#define ERR_DIALOG(msg, title) \
wxLogError(wxT("%s: %s"), ((wxString) title).c_str(), ((wxString) msg).c_str())
diff --git a/rbutil/rbutilApp.cpp b/rbutil/rbutilApp.cpp
index a9101e2656..3bc5d59305 100644
--- a/rbutil/rbutilApp.cpp
+++ b/rbutil/rbutilApp.cpp
@@ -78,6 +78,8 @@ bool rbutilFrmApp::OnInit()
}
ReadUserConfig();
+ wxInitAllImageHandlers(); //init Image handlers
+
rbutilFrm *myFrame = new rbutilFrm(NULL);
SetTopWindow(myFrame);
@@ -86,8 +88,6 @@ bool rbutilFrmApp::OnInit()
initIpodpatcher(); // reserve mem for ipodpatcher
initSansaPatcher(); // reserve mem for sansapatcher
- wxInitAllImageHandlers(); //init Image handlers
-
wxLogVerbose(wxT("=== end rbUtilFrmApp::OnInit()"));
return TRUE;
}
diff --git a/rbutil/rbutilFrm.cpp b/rbutil/rbutilFrm.cpp
index 0dc85c09b0..2aa2b362ca 100644
--- a/rbutil/rbutilFrm.cpp
+++ b/rbutil/rbutilFrm.cpp
@@ -22,19 +22,21 @@
#include "credits.h"
#include "rbutilFrm_XPM.xpm"
-#include "install_3d.xpm"
-#include "uninstall_3d.xpm"
-#include "fonts_3d.xpm"
-#include "tools2_3d.xpm"
+#include "icons/rbinstall_btn.h"
+#include "icons/remrb_btn.h"
+#include "icons/font_btn.h"
+#include "icons/bootloader_btn.h"
+#include "icons/rembootloader_btn.h"
+#include "icons/themes_btn.h"
+#include "icons/doom_btn.h"
+
#include "rblogo.xpm"
-#include "untools2_3d.xpm"
-#include "themes_3d.xpm"
-#include "doom_3d.xpm"
#include "bootloaders.h"
#include "install_dialogs.h"
+
//----------------------------------------------------------------------------
// rbutilFrm
//----------------------------------------------------------------------------
@@ -125,7 +127,8 @@ void rbutilFrm::CreateGUIControls(void)
wxFlexGridSizer* WxFlexGridSizer1 = new wxFlexGridSizer(2,2,0,0);
WxStaticBoxSizer3->Add(WxFlexGridSizer1,0,wxGROW | wxALL,0);
- wxBitmap BootloaderInstallButton (tools2_3d_xpm);
+
+ wxBitmap BootloaderInstallButton (wxGetBitmapFromMemory(bootloader_btn_png,bootloader_btn_png_length));
WxBitmapButton4 = new wxBitmapButton(installpage, ID_BOOTLOADER_BTN,
BootloaderInstallButton, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,wxT("Bootloader Installation"));
@@ -141,7 +144,7 @@ void rbutilFrm::CreateGUIControls(void)
WxFlexGridSizer1->Add(WxStaticText5, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
- wxBitmap WxBitmapButton1_BITMAP (install_3d_xpm);
+ wxBitmap WxBitmapButton1_BITMAP (wxGetBitmapFromMemory(rbinstall_btn_png,rbinstall_btn_png_length));
WxBitmapButton1 = new wxBitmapButton(installpage, ID_INSTALL_BTN,
WxBitmapButton1_BITMAP, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
@@ -172,7 +175,7 @@ void rbutilFrm::CreateGUIControls(void)
wxFlexGridSizer* WxFlexGridSizer2 = new wxFlexGridSizer(2,2,0,0);
WxStaticBoxSizer4->Add(WxFlexGridSizer2,0,wxGROW | wxALL,0);
- wxBitmap FontInstallButton (fonts_3d_xpm);
+ wxBitmap FontInstallButton (wxGetBitmapFromMemory(font_btn_png,font_btn_png_length));
WxBitmapButton3 = new wxBitmapButton(themepage, ID_FONT_BTN,
FontInstallButton, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW,wxDefaultValidator, wxT("Font installation"));
@@ -189,7 +192,7 @@ void rbutilFrm::CreateGUIControls(void)
WxFlexGridSizer2->Add(WxStaticText4, 0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
- wxBitmap ThemesInstallButton (themes_3d_xpm);
+ wxBitmap ThemesInstallButton (wxGetBitmapFromMemory(themes_btn_png,themes_btn_png_length));
WxBitmapButton5 = new wxBitmapButton(themepage, ID_THEMES_BTN,
ThemesInstallButton, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW,wxDefaultValidator, wxT("Theme installation"));
@@ -203,7 +206,7 @@ void rbutilFrm::CreateGUIControls(void)
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
- wxBitmap DoomInstallButton (doom_3d_xpm);
+ wxBitmap DoomInstallButton (wxGetBitmapFromMemory(doom_btn_png,doom_btn_png_length));
WxBitmapButton6 = new wxBitmapButton(themepage, ID_DOOM_BTN,
DoomInstallButton, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW,wxDefaultValidator, wxT("Freedoom installation"));
@@ -233,7 +236,7 @@ void rbutilFrm::CreateGUIControls(void)
wxFlexGridSizer* WxFlexGridSizer3 = new wxFlexGridSizer(2,2,0,0);
WxStaticBoxSizer5->Add(WxFlexGridSizer3,0,wxGROW | wxALL,0);
- wxBitmap WxBitmapButton2_BITMAP (uninstall_3d_xpm);
+ wxBitmap WxBitmapButton2_BITMAP (wxGetBitmapFromMemory(remrb_btn_png,remrb_btn_png_length));
WxBitmapButton2 = new wxBitmapButton(uninstallpage, ID_REMOVE_BTN,
WxBitmapButton2_BITMAP, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW,wxDefaultValidator, wxT("Rockbox uninstallation"));
@@ -246,7 +249,7 @@ void rbutilFrm::CreateGUIControls(void)
WxFlexGridSizer3->Add(WxStaticText3,0,
wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL,5);
- wxBitmap WxBitmapButton4_BITMAP (untools2_3d_xpm);
+ wxBitmap WxBitmapButton4_BITMAP (wxGetBitmapFromMemory(rembootloader_btn_png,rembootloader_btn_png_length));
WxBitmapButton4 = new wxBitmapButton(uninstallpage, ID_BOOTLOADERREMOVE_BTN,
WxBitmapButton4_BITMAP, wxPoint(0,0), wxSize(64,54),
wxRAISED_BORDER | wxBU_AUTODRAW, wxDefaultValidator,
diff --git a/rbutil/rbutilFrm.h b/rbutil/rbutilFrm.h
index 0d3b2526e4..64afe97f7a 100644
--- a/rbutil/rbutilFrm.h
+++ b/rbutil/rbutilFrm.h
@@ -43,6 +43,8 @@
#include "rbutil.h"
#include "rbutilCtrls.h"
+
+
class rbutilFrm : public wxFrame
{
private: