2008-09-17 05:57:43 +00:00
|
|
|
// Copyright (C) 2003-2008 Dolphin Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official SVN repository and contact information can be found at
|
|
|
|
// http://code.google.com/p/dolphin-emu/
|
|
|
|
|
|
|
|
#include "Globals.h"
|
|
|
|
|
2008-10-09 05:33:24 +00:00
|
|
|
#include "ISOFile.h"
|
2008-09-18 03:18:19 +00:00
|
|
|
#include "VolumeCreator.h"
|
|
|
|
#include "Filesystem.h"
|
2008-09-17 05:57:43 +00:00
|
|
|
#include "FilesystemViewer.h"
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(CFilesystemViewer, wxDialog)
|
|
|
|
EVT_CLOSE(CFilesystemViewer::OnClose)
|
|
|
|
EVT_RIGHT_DOWN(CFilesystemViewer::OnRightClick)
|
|
|
|
EVT_TREE_ITEM_RIGHT_CLICK(ID_TREECTRL,CFilesystemViewer::OnRightClickOnTree)
|
|
|
|
EVT_BUTTON(ID_CLOSE,CFilesystemViewer::OnCloseClick)
|
|
|
|
EVT_BUTTON(ID_SAVEBNR,CFilesystemViewer::OnSaveBNRClick)
|
|
|
|
EVT_MENU(IDM_BNRSAVEAS, CFilesystemViewer::OnBannerImageSave)
|
|
|
|
EVT_MENU(IDM_EXTRACTFILE, CFilesystemViewer::OnExtractFile)
|
|
|
|
EVT_MENU(IDM_REPLACEFILE, CFilesystemViewer::OnReplaceFile)
|
|
|
|
EVT_MENU(IDM_RENAMEFILE, CFilesystemViewer::OnRenameFile)
|
|
|
|
END_EVENT_TABLE()
|
2008-10-09 05:33:24 +00:00
|
|
|
|
|
|
|
DiscIO::IVolume *OpenISO = NULL;
|
|
|
|
DiscIO::IFileSystem *pFileSystem = NULL;
|
2008-09-17 05:57:43 +00:00
|
|
|
|
|
|
|
CFilesystemViewer::CFilesystemViewer(const std::string fileName, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
|
|
|
|
: wxDialog(parent, id, title, position, size, style)
|
|
|
|
{
|
2008-09-22 20:35:44 +00:00
|
|
|
std::vector<const DiscIO::SFileInfo *> Our_Files;
|
2008-09-21 14:51:40 +00:00
|
|
|
|
2008-10-09 05:33:24 +00:00
|
|
|
OpenISO = DiscIO::CreateVolumeFromFilename(fileName);
|
|
|
|
pFileSystem = DiscIO::CreateFileSystem(OpenISO);
|
2008-09-20 19:27:23 +00:00
|
|
|
pFileSystem->GetFileList(Our_Files);
|
2008-10-09 05:33:24 +00:00
|
|
|
|
|
|
|
GameListItem OpenISO_(fileName);
|
|
|
|
|
2008-09-17 05:57:43 +00:00
|
|
|
CreateGUIControls();
|
2008-10-09 05:33:24 +00:00
|
|
|
|
|
|
|
wxTreeItemId dirId = NULL;
|
2008-10-10 14:08:16 +00:00
|
|
|
fileIter beginning = Our_Files.begin(), end = Our_Files.end(),
|
|
|
|
pos = Our_Files.begin();
|
2008-10-10 13:23:10 +00:00
|
|
|
|
2008-10-10 14:08:16 +00:00
|
|
|
CreateDirectoryTree(RootId, beginning, end, pos, "\\");
|
2008-10-09 05:33:24 +00:00
|
|
|
|
|
|
|
m_Treectrl->Expand(RootId);
|
|
|
|
|
|
|
|
// Disk header and apploader
|
|
|
|
m_Name->SetValue(wxString(OpenISO->GetName().c_str(), wxConvUTF8));
|
|
|
|
m_Serial->SetValue(wxString(OpenISO->GetUniqueID().c_str(), wxConvUTF8));
|
|
|
|
switch (OpenISO->GetCountry())
|
|
|
|
{
|
2008-10-09 08:51:57 +00:00
|
|
|
case DiscIO::IVolume::COUNTRY_EUROPE:
|
|
|
|
case DiscIO::IVolume::COUNTRY_FRANCE:
|
2008-10-09 05:33:24 +00:00
|
|
|
m_Country->SetValue(wxString::FromAscii("EUR"));
|
|
|
|
break;
|
2008-10-09 08:51:57 +00:00
|
|
|
case DiscIO::IVolume::COUNTRY_USA:
|
2008-10-09 05:33:24 +00:00
|
|
|
m_Country->SetValue(wxString::FromAscii("USA"));
|
|
|
|
break;
|
2008-10-09 08:51:57 +00:00
|
|
|
case DiscIO::IVolume::COUNTRY_JAP:
|
2008-10-09 05:33:24 +00:00
|
|
|
m_Country->SetValue(wxString::FromAscii("JAP"));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
m_Country->SetValue(wxString::FromAscii("UNKNOWN"));
|
|
|
|
break;
|
|
|
|
}
|
2008-10-10 16:20:13 +00:00
|
|
|
|
|
|
|
wxString temp;
|
|
|
|
temp = _T("0x") + wxString::FromAscii(OpenISO->GetMakerID().c_str());
|
|
|
|
m_MakerID->SetValue(temp);
|
2008-10-09 05:33:24 +00:00
|
|
|
m_Date->SetValue(wxString(OpenISO->GetApploaderDate().c_str(), wxConvUTF8));
|
2008-10-09 08:51:57 +00:00
|
|
|
m_TOC->SetValue(wxString::Format(_T("%u"), OpenISO->GetFSTSize()));
|
2008-10-09 05:33:24 +00:00
|
|
|
|
|
|
|
// Banner
|
|
|
|
// ...all the BannerLoader functions are bool...gross
|
|
|
|
//m_Version;
|
|
|
|
m_ShortName->SetValue(wxString(OpenISO_.GetName().c_str(), wxConvUTF8));
|
|
|
|
//m_LongName->SetValue(wxString(OpenISO_.GetLongName().c_str(), wxConvUTF8));
|
|
|
|
m_Maker->SetValue(wxString(OpenISO_.GetCompany().c_str(), wxConvUTF8));//dev too
|
|
|
|
m_Comment->SetValue(wxString(OpenISO_.GetDescription().c_str(), wxConvUTF8));
|
2008-09-17 05:57:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CFilesystemViewer::~CFilesystemViewer()
|
|
|
|
{
|
2008-09-18 03:18:19 +00:00
|
|
|
delete pFileSystem;
|
2008-10-09 05:33:24 +00:00
|
|
|
delete OpenISO;
|
2008-09-17 05:57:43 +00:00
|
|
|
}
|
|
|
|
|
2008-10-10 13:23:10 +00:00
|
|
|
void CFilesystemViewer::CreateDirectoryTree(wxTreeItemId& parent,
|
|
|
|
fileIter& begin,
|
2008-10-10 14:08:16 +00:00
|
|
|
fileIter& end,
|
2008-10-10 13:23:10 +00:00
|
|
|
fileIter& iterPos,
|
|
|
|
char *directory)
|
|
|
|
{
|
2008-10-10 14:08:16 +00:00
|
|
|
bool bRoot = true;
|
2008-10-10 14:29:28 +00:00
|
|
|
|
2008-10-10 13:23:10 +00:00
|
|
|
if(iterPos == begin)
|
|
|
|
++iterPos;
|
2008-10-10 14:08:16 +00:00
|
|
|
else
|
|
|
|
bRoot = false;
|
2008-10-10 13:23:10 +00:00
|
|
|
|
|
|
|
char *name = (char *)((*iterPos)->m_FullPath);
|
|
|
|
|
2008-10-10 14:08:16 +00:00
|
|
|
if(iterPos == end)
|
|
|
|
return;
|
|
|
|
|
2008-10-10 13:23:10 +00:00
|
|
|
do
|
|
|
|
{
|
|
|
|
if((*iterPos)->IsDirectory()) {
|
|
|
|
char *dirName;
|
|
|
|
name[strlen(name) - 1] = '\0';
|
|
|
|
dirName = strrchr(name, '\\');
|
|
|
|
if(!dirName)
|
|
|
|
dirName = name;
|
|
|
|
else
|
|
|
|
dirName++;
|
2008-10-10 14:08:16 +00:00
|
|
|
|
2008-10-10 16:20:13 +00:00
|
|
|
wxTreeItemId item = m_Treectrl->AppendItem(parent, wxString::FromAscii(dirName));
|
2008-10-10 14:08:16 +00:00
|
|
|
CreateDirectoryTree(item, begin, end, ++iterPos, name);
|
2008-10-10 13:23:10 +00:00
|
|
|
} else {
|
2008-10-10 14:08:16 +00:00
|
|
|
char *fileName = strrchr(name, '\\');
|
|
|
|
if(!fileName)
|
|
|
|
fileName = name;
|
|
|
|
else
|
|
|
|
fileName++;
|
2008-10-10 13:23:10 +00:00
|
|
|
|
2008-10-10 16:20:13 +00:00
|
|
|
m_Treectrl->AppendItem(parent, wxString::FromAscii(fileName));
|
2008-10-10 14:08:16 +00:00
|
|
|
++iterPos;
|
2008-10-10 13:23:10 +00:00
|
|
|
}
|
2008-10-10 14:08:16 +00:00
|
|
|
|
|
|
|
if(iterPos == end)
|
|
|
|
break;
|
|
|
|
|
2008-10-10 13:23:10 +00:00
|
|
|
name = (char *)((*iterPos)->m_FullPath);
|
2008-10-10 14:08:16 +00:00
|
|
|
|
|
|
|
} while(bRoot || strstr(name, directory));
|
2008-10-10 13:23:10 +00:00
|
|
|
}
|
|
|
|
|
2008-09-17 05:57:43 +00:00
|
|
|
void CFilesystemViewer::CreateGUIControls()
|
|
|
|
{
|
|
|
|
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
|
|
|
|
|
|
|
// ISO Details
|
|
|
|
sbISODetails = new wxStaticBoxSizer(wxVERTICAL, this, wxT("ISO Details:"));
|
|
|
|
sISODetails = new wxGridBagSizer(0, 0);
|
2008-10-10 15:32:23 +00:00
|
|
|
sISODetails->AddGrowableCol(1);
|
2008-09-17 05:57:43 +00:00
|
|
|
m_NameText = new wxStaticText(this, ID_NAME_TEXT, wxT("Name:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_Name = new wxTextCtrl(this, ID_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
|
|
|
m_SerialText = new wxStaticText(this, ID_SERIAL_TEXT, wxT("Serial:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_Serial = new wxTextCtrl(this, ID_SERIAL, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
|
|
|
m_CountryText = new wxStaticText(this, ID_COUNTRY_TEXT, wxT("Country:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_Country = new wxTextCtrl(this, ID_COUNTRY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
|
|
|
m_MakerIDText = new wxStaticText(this, ID_MAKERID_TEXT, wxT("Maker ID:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_MakerID = new wxTextCtrl(this, ID_MAKERID, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
|
|
|
m_DateText = new wxStaticText(this, ID_DATE_TEXT, wxT("Date:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_Date = new wxTextCtrl(this, ID_DATE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
|
|
|
m_TOCText = new wxStaticText(this, ID_TOC_TEXT, wxT("TOC Size:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_TOC = new wxTextCtrl(this, ID_TOC, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
|
|
|
|
2008-10-09 05:33:24 +00:00
|
|
|
sISODetails->Add(m_NameText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-10-10 15:32:23 +00:00
|
|
|
sISODetails->Add(m_Name, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
sISODetails->Add(m_SerialText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sISODetails->Add(m_Serial, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
sISODetails->Add(m_CountryText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sISODetails->Add(m_Country, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
sISODetails->Add(m_MakerIDText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sISODetails->Add(m_MakerID, wxGBPosition(3, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
sISODetails->Add(m_DateText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sISODetails->Add(m_Date, wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
sISODetails->Add(m_TOCText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sISODetails->Add(m_TOC, wxGBPosition(5, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
|
|
|
|
2008-10-10 15:32:23 +00:00
|
|
|
sbISODetails->Add(sISODetails, 0, wxEXPAND, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
|
|
|
|
// Banner Details
|
|
|
|
wxArrayString arrayStringFor_Lang;
|
|
|
|
sbBannerDetails = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Banner Details:"));
|
|
|
|
sBannerDetails = new wxGridBagSizer(0, 0);
|
|
|
|
m_VersionText = new wxStaticText(this, ID_VERSION_TEXT, wxT("Version:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_Version = new wxTextCtrl(this, ID_VERSION, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY);
|
|
|
|
m_LangText = new wxStaticText(this, ID_LANG_TEXT, wxT("Show Language:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_Lang = new wxChoice(this, ID_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_Lang, 0, wxDefaultValidator);
|
|
|
|
m_ShortText = new wxStaticText(this, ID_SHORTNAME_TEXT, wxT("Short Name:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_ShortName = new wxTextCtrl(this, ID_SHORTNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_LongText = new wxStaticText(this, ID_LONGNAME_TEXT, wxT("Long Name:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_LongName = new wxTextCtrl(this, ID_LONGNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_MakerText = new wxStaticText(this, ID_MAKER_TEXT, wxT("Maker:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_Maker = new wxTextCtrl(this, ID_MAKER, wxEmptyString, wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_CommentText = new wxStaticText(this, ID_COMMENT_TEXT, wxT("Comment:"), wxDefaultPosition, wxDefaultSize);
|
|
|
|
m_Comment = new wxTextCtrl(this, ID_COMMENT, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
|
|
|
|
m_BannerText = new wxStaticText(this, ID_BANNER_TEXT, wxT("Banner:"), wxDefaultPosition, wxDefaultSize);
|
2008-10-09 05:33:24 +00:00
|
|
|
// Needs to be image:
|
2008-09-17 05:57:43 +00:00
|
|
|
m_Banner = new wxTextCtrl(this, ID_BANNER, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
|
|
|
|
m_SaveBNR = new wxButton(this, ID_SAVEBNR, wxT("Save Changes to BNR"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
|
|
|
m_SaveBNR->Disable();
|
|
|
|
|
2008-10-09 05:33:24 +00:00
|
|
|
sBannerDetails->Add(m_VersionText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sBannerDetails->Add(m_Version, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
sBannerDetails->Add(m_LangText, wxGBPosition(0, 2), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sBannerDetails->Add(m_Lang, wxGBPosition(0, 3), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
sBannerDetails->Add(m_ShortText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sBannerDetails->Add(m_ShortName, wxGBPosition(1, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
sBannerDetails->Add(m_LongText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sBannerDetails->Add(m_LongName, wxGBPosition(2, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
sBannerDetails->Add(m_MakerText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
2008-09-17 05:57:43 +00:00
|
|
|
sBannerDetails->Add(m_Maker, wxGBPosition(3, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
|
|
|
|
sBannerDetails->Add(m_CommentText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALL, 5);
|
|
|
|
sBannerDetails->Add(m_Comment, wxGBPosition(4, 1), wxGBSpan(1, 3), wxEXPAND|wxALL, 5);
|
|
|
|
sBannerDetails->Add(m_BannerText, wxGBPosition(5, 0), wxGBSpan(1, 1), wxALL, 5);
|
|
|
|
sBannerDetails->Add(m_Banner, wxGBPosition(5, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
|
|
|
sBannerDetails->Add(m_SaveBNR, wxGBPosition(5, 2), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
|
|
|
|
|
|
|
|
sbBannerDetails->Add(sBannerDetails, 0, wxEXPAND, 0);
|
|
|
|
|
|
|
|
// Filesystem tree
|
|
|
|
sbTreectrl = new wxStaticBoxSizer(wxVERTICAL, this, wxT("Filesytem:"));
|
|
|
|
m_Treectrl = new wxTreeCtrl(this, ID_TREECTRL, wxDefaultPosition, wxSize(350, 450)/*wxDefaultSize*/, wxTR_DEFAULT_STYLE, wxDefaultValidator);
|
|
|
|
sbTreectrl->Add(m_Treectrl, 1, wxEXPAND);
|
|
|
|
|
2008-09-18 03:18:19 +00:00
|
|
|
RootId = m_Treectrl->AddRoot(wxT("Root"), -1, -1, 0);
|
2008-10-09 05:33:24 +00:00
|
|
|
|
2008-09-17 05:57:43 +00:00
|
|
|
wxGridBagSizer* sMain;
|
|
|
|
sMain = new wxGridBagSizer(0, 0);
|
|
|
|
sMain->Add(sbISODetails, wxGBPosition(0, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
|
|
|
sMain->Add(sbBannerDetails, wxGBPosition(1, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
|
|
|
sMain->Add(sbTreectrl, wxGBPosition(0, 1), wxGBSpan(2, 1), wxALL, 5);
|
|
|
|
sMain->Add(m_Close, wxGBPosition(2, 1), wxGBSpan(1, 1), wxALL|wxALIGN_RIGHT, 5);
|
2008-10-09 05:33:24 +00:00
|
|
|
|
2008-09-17 05:57:43 +00:00
|
|
|
this->SetSizer(sMain);
|
|
|
|
this->Layout();
|
|
|
|
Fit();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFilesystemViewer::OnClose(wxCloseEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFilesystemViewer::OnCloseClick(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFilesystemViewer::OnRightClick(wxMouseEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
//check for right click on banner image
|
|
|
|
//if(event.GetId() == ID_SAVEBNR)
|
|
|
|
//{
|
|
|
|
// //on banner then save as.
|
|
|
|
// wxMenu popupMenu;
|
|
|
|
// popupMenu.Append(IDM_BNRSAVEAS, wxString::FromAscii("Save as..."));
|
|
|
|
// PopupMenu(&popupMenu);
|
|
|
|
//}
|
|
|
|
//event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFilesystemViewer::OnRightClickOnTree(wxTreeEvent& event)
|
|
|
|
{
|
2008-10-10 15:32:23 +00:00
|
|
|
m_Treectrl->SelectItem(event.GetItem());
|
|
|
|
|
2008-09-17 05:57:43 +00:00
|
|
|
wxMenu popupMenu;
|
|
|
|
popupMenu.Append(IDM_EXTRACTFILE, wxString::FromAscii("Extract File..."));
|
|
|
|
popupMenu.Append(IDM_REPLACEFILE, wxString::FromAscii("Replace File..."));
|
|
|
|
popupMenu.Append(IDM_RENAMEFILE, wxString::FromAscii("Rename File..."));
|
|
|
|
PopupMenu(&popupMenu);
|
|
|
|
|
|
|
|
event.Skip();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFilesystemViewer::OnSaveBNRClick(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFilesystemViewer::OnBannerImageSave(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CFilesystemViewer::OnExtractFile(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2008-09-18 03:18:19 +00:00
|
|
|
wxString Path;
|
|
|
|
wxString File;
|
2008-10-10 15:32:23 +00:00
|
|
|
|
|
|
|
File = m_Treectrl->GetItemText(m_Treectrl->GetSelection());
|
|
|
|
|
2008-09-18 03:18:19 +00:00
|
|
|
Path = wxFileSelector(
|
|
|
|
_T("Export File"),
|
2008-10-10 15:32:23 +00:00
|
|
|
wxEmptyString, File, wxEmptyString,
|
2008-09-18 03:18:19 +00:00
|
|
|
wxString::Format
|
|
|
|
(
|
|
|
|
_T("All files (%s)|%s"),
|
|
|
|
wxFileSelectorDefaultWildcardStr
|
|
|
|
),
|
|
|
|
wxFD_SAVE,
|
|
|
|
this);
|
2008-10-10 15:32:23 +00:00
|
|
|
|
2008-09-18 03:18:19 +00:00
|
|
|
if (!Path || !File)
|
|
|
|
return;
|
2008-10-10 15:32:23 +00:00
|
|
|
|
|
|
|
while (m_Treectrl->GetItemParent(m_Treectrl->GetSelection()) != m_Treectrl->GetRootItem())
|
|
|
|
{
|
|
|
|
wxString temp;
|
|
|
|
temp = m_Treectrl->GetItemText(m_Treectrl->GetItemParent(m_Treectrl->GetSelection()));
|
2008-10-10 16:20:13 +00:00
|
|
|
File = temp + _T("\\") + File;
|
2008-10-10 15:32:23 +00:00
|
|
|
|
|
|
|
m_Treectrl->SelectItem(m_Treectrl->GetItemParent(m_Treectrl->GetSelection()));
|
|
|
|
}
|
|
|
|
|
2008-09-18 03:18:19 +00:00
|
|
|
pFileSystem->ExportFile(File.mb_str(), Path.mb_str());
|
2008-09-17 05:57:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFilesystemViewer::OnReplaceFile(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2008-10-10 15:32:23 +00:00
|
|
|
wxMessageBox(_T("Not implemented yet."), _T("Sorry"), wxOK, this);
|
2008-09-17 05:57:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CFilesystemViewer::OnRenameFile(wxCommandEvent& WXUNUSED (event))
|
|
|
|
{
|
2008-10-10 15:32:23 +00:00
|
|
|
wxMessageBox(_T("Not implemented yet."), _T("Sorry"), wxOK, this);
|
2008-09-17 05:57:43 +00:00
|
|
|
}
|