rbutil: Add nice Buttons (FS 7294, heavily modified). Buttons are from the gnome-icon-theme (GPL) and are in png format. In rbutil/icons there is bin2c.c which can convert those pngs to *.c and *.h. Call it with bin2c *.png (shell expansion). The Makefile (Linux/ Mac) needs updates to use this.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13690 a1c6a512-1295-4272-9138-f99709370657
|
@ -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 */
|
||||
|
||||
|
||||
/********************************
|
||||
|
|
172
rbutil/icons/bin2c.c
Normal file
|
@ -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;
|
||||
}
|
BIN
rbutil/icons/bootloader_btn.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
rbutil/icons/doom_btn.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
rbutil/icons/font_btn.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
rbutil/icons/rbinstall_btn.png
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
rbutil/icons/rembootloader_btn.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
rbutil/icons/remrb_btn.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
rbutil/icons/themes_btn.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
|
@ -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" />
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
#include "rbutil.h"
|
||||
#include "rbutilCtrls.h"
|
||||
|
||||
|
||||
|
||||
class rbutilFrm : public wxFrame
|
||||
{
|
||||
private:
|
||||
|
|