1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
#include "wx_pch.h"
#include "BlobToolGUIMain.h"
#include <wx/msgdlg.h>
//(*InternalHeaders(BlobToolGUIFrame)
#include <wx/settings.h>
#include <wx/font.h>
#include <wx/intl.h>
#include <wx/string.h>
//*)
//helper functions
enum wxbuildinfoformat
{
short_f, long_f
};
wxString wxbuildinfo(wxbuildinfoformat format)
{
wxString wxbuild(wxVERSION_STRING);
if (format == long_f )
{
#if defined(__WXMSW__)
wxbuild << _T("-Windows");
#elif defined(__UNIX__)
wxbuild << _T("-Linux");
#endif
#if wxUSE_UNICODE
wxbuild << _T("-Unicode build");
#else
wxbuild << _T("-ANSI build");
#endif // wxUSE_UNICODE
}
return wxbuild;
}
//(*IdInit(BlobToolGUIFrame)
const long BlobToolGUIFrame::ID_TEXTCTRL1 = wxNewId();
const long BlobToolGUIFrame::ID_STATICTEXT2 = wxNewId();
const long BlobToolGUIFrame::ID_TEXTCTRL2 = wxNewId();
const long BlobToolGUIFrame::ID_TEXTCTRL3 = wxNewId();
const long BlobToolGUIFrame::ID_TEXTCTRL4 = wxNewId();
const long BlobToolGUIFrame::ID_TEXTCTRL5 = wxNewId();
const long BlobToolGUIFrame::ID_STATICTEXT1 = wxNewId();
const long BlobToolGUIFrame::ID_STATICTEXT3 = wxNewId();
const long BlobToolGUIFrame::ID_STATICLINE1 = wxNewId();
const long BlobToolGUIFrame::ID_STATICTEXT4 = wxNewId();
const long BlobToolGUIFrame::ID_STATICTEXT5 = wxNewId();
const long BlobToolGUIFrame::ID_STATICTEXT6 = wxNewId();
const long BlobToolGUIFrame::ID_STATICTEXT7 = wxNewId();
const long BlobToolGUIFrame::ID_BUTTON2 = wxNewId();
const long BlobToolGUIFrame::ID_BUTTON1 = wxNewId();
const long BlobToolGUIFrame::ID_MENUITEM1 = wxNewId();
const long BlobToolGUIFrame::idMenuAbout = wxNewId();
const long BlobToolGUIFrame::ID_STATUSBAR1 = wxNewId();
//*)
BEGIN_EVENT_TABLE(BlobToolGUIFrame,wxFrame)
//(*EventTable(BlobToolGUIFrame)
//*)
END_EVENT_TABLE()
BlobToolGUIFrame::BlobToolGUIFrame(wxWindow* parent,wxWindowID id)
{
//(*Initialize(BlobToolGUIFrame)
wxMenuItem* MenuItem2;
wxMenuItem* MenuItem1;
wxMenu* Menu1;
wxMenuBar* MenuBar1;
wxMenu* Menu2;
Create(parent, wxID_ANY, _("BlobToolsGUI"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
SetClientSize(wxSize(388,446));
SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
wxFont thisFont(10,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Arial"),wxFONTENCODING_DEFAULT);
SetFont(thisFont);
name = new wxTextCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxPoint(120,64), wxSize(232,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("Blob file name:"), wxPoint(8,64), wxSize(112,16), 0, _T("ID_STATICTEXT2"));
recovery = new wxTextCtrl(this, ID_TEXTCTRL2, wxEmptyString, wxPoint(120,296), wxSize(232,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
boot = new wxTextCtrl(this, ID_TEXTCTRL3, wxEmptyString, wxPoint(120,264), wxSize(232,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL3"));
outfile = new wxTextCtrl(this, ID_TEXTCTRL4, wxEmptyString, wxPoint(120,232), wxSize(232,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL4"));
header = new wxTextCtrl(this, ID_TEXTCTRL5, wxEmptyString, wxPoint(120,200), wxSize(232,24), 0, wxDefaultValidator, _T("ID_TEXTCTRL5"));
StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Blob Header file:"), wxPoint(8,200), wxSize(104,16), 0, _T("ID_STATICTEXT1"));
wxFont StaticText1Font(10,wxSWISS,wxFONTSTYLE_NORMAL,wxNORMAL,false,_T("Arial"),wxFONTENCODING_DEFAULT);
StaticText1->SetFont(StaticText1Font);
StaticText3 = new wxStaticText(this, ID_STATICTEXT3, _("Output filename:"), wxPoint(8,232), wxSize(104,16), 0, _T("ID_STATICTEXT3"));
StaticLine1 = new wxStaticLine(this, ID_STATICLINE1, wxPoint(0,160), wxSize(400,2), wxLI_HORIZONTAL, _T("ID_STATICLINE1"));
StaticText4 = new wxStaticText(this, ID_STATICTEXT4, _(" Blob Packer"), wxPoint(184,168), wxSize(104,18), 0, _T("ID_STATICTEXT4"));
wxFont StaticText4Font(10,wxSWISS,wxFONTSTYLE_NORMAL,wxBOLD,false,_T("Arial Black"),wxFONTENCODING_DEFAULT);
StaticText4->SetFont(StaticText4Font);
StaticText5 = new wxStaticText(this, ID_STATICTEXT5, _("Blob Unpacker"), wxPoint(160,16), wxSize(184,24), 0, _T("ID_STATICTEXT5"));
wxFont StaticText5Font(10,wxSWISS,wxFONTSTYLE_NORMAL,wxBOLD,false,_T("Arial Black"),wxFONTENCODING_DEFAULT);
StaticText5->SetFont(StaticText5Font);
StaticText6 = new wxStaticText(this, ID_STATICTEXT6, _("Boot Image:"), wxPoint(32,264), wxSize(72,16), 0, _T("ID_STATICTEXT6"));
StaticText7 = new wxStaticText(this, ID_STATICTEXT7, _("Recovery Image:"), wxPoint(16,296), wxSize(104,16), 0, _T("ID_STATICTEXT7"));
Button2 = new wxButton(this, ID_BUTTON2, _("Unpack"), wxPoint(80,112), wxSize(264,42), 0, wxDefaultValidator, _T("ID_BUTTON2"));
Button1 = new wxButton(this, ID_BUTTON1, _("Repack"), wxPoint(32,376), wxSize(336,40), 0, wxDefaultValidator, _T("ID_BUTTON1"));
MenuBar1 = new wxMenuBar();
Menu1 = new wxMenu();
MenuItem1 = new wxMenuItem(Menu1, ID_MENUITEM1, _("Quit\tAlt-F4"), _("Quit the application"), wxITEM_NORMAL);
Menu1->Append(MenuItem1);
MenuBar1->Append(Menu1, _("&File"));
Menu2 = new wxMenu();
MenuItem2 = new wxMenuItem(Menu2, idMenuAbout, _("About\tF1"), _("How to use"), wxITEM_NORMAL);
Menu2->Append(MenuItem2);
MenuBar1->Append(Menu2, _("Help"));
SetMenuBar(MenuBar1);
StatusBar1 = new wxStatusBar(this, ID_STATUSBAR1, 0, _T("ID_STATUSBAR1"));
int __wxStatusBarWidths_1[1] = { -1 };
int __wxStatusBarStyles_1[1] = { wxSB_NORMAL };
StatusBar1->SetFieldsCount(1,__wxStatusBarWidths_1);
StatusBar1->SetStatusStyles(1,__wxStatusBarStyles_1);
SetStatusBar(StatusBar1);
Center();
Connect(ID_TEXTCTRL2,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&BlobToolGUIFrame::OnTextCtrl2Text);
Connect(ID_TEXTCTRL3,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&BlobToolGUIFrame::OnTextCtrl3Text);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&BlobToolGUIFrame::OnButton2Click1);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&BlobToolGUIFrame::OnButton1Click);
Connect(ID_MENUITEM1,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&BlobToolGUIFrame::OnQuit);
Connect(idMenuAbout,wxEVT_COMMAND_MENU_SELECTED,(wxObjectEventFunction)&BlobToolGUIFrame::OnAbout);
Connect(wxID_ANY,wxEVT_CLOSE_WINDOW,(wxObjectEventFunction)&BlobToolGUIFrame::OnClose);
//*)
}
BlobToolGUIFrame::~BlobToolGUIFrame()
{
//(*Destroy(BlobToolGUIFrame)
//*)
}
void BlobToolGUIFrame::OnQuit(wxCommandEvent& event)
{
Close();
}
void BlobToolGUIFrame::OnAbout(wxCommandEvent& event)
{
wxString msg = wxbuildinfo(long_f);
wxMessageBox(msg, _("This tool will allow you unpack blob files."));
}
void BlobToolGUIFrame::OnTextCtrl1Text(wxCommandEvent& event)
{
}
void BlobToolGUIFrame::OnButton2Click(wxCommandEvent& event)
{
wxString n = ("blobpack.exe ");
n = n + header + (".HEADER ") + name + (" LNX ") + boot + (".img ") + (" SOS ") + recovery + (".img");
wxExecute(n.c_str());
}
void BlobToolGUIFrame::OnButton1Click(wxCommandEvent& event)
{
wxString m= ("blobunpack.exe ");
m = m + name;
wxExecute(m.c_str());
}
|