Started Work on File System Viewer. It isn't very pretty yet

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@570 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1
2008-09-18 03:18:19 +00:00
parent 07421b08eb
commit 28cd7e220c
7 changed files with 57 additions and 21 deletions

View File

@ -17,8 +17,8 @@
#include "Globals.h"
//#include "VolumeCreator.h"
//#include "Filesystem.h"
#include "VolumeCreator.h"
#include "Filesystem.h"
//#include "BannerLoader.h"
#include "FilesystemViewer.h"
@ -33,18 +33,26 @@ BEGIN_EVENT_TABLE(CFilesystemViewer, wxDialog)
EVT_MENU(IDM_REPLACEFILE, CFilesystemViewer::OnReplaceFile)
EVT_MENU(IDM_RENAMEFILE, CFilesystemViewer::OnRenameFile)
END_EVENT_TABLE()
DiscIO::IVolume* OpenIso = NULL;
DiscIO::IFileSystem* pFileSystem = NULL;
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)
{
/*DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(fileName);
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(*pVolume);
pFileSystem->*/
OpenIso = DiscIO::CreateVolumeFromFilename(fileName);
pFileSystem = DiscIO::CreateFileSystem(*OpenIso);
std::vector<SFileInfo> Our_Files;
pFileSystem->GetFileList(&Our_Files);
CreateGUIControls();
for(int a = 0;a < Our_Files.size();++a)
m_Treectrl->AppendItem(RootId, wxString::FromAscii(Our_Files[a].m_FullPath));//printf("%d dir? %s '%s'\n", a, Our_Files[a].IsDirectory() ? "True" : "False", Our_Files[a].m_FullPath);
}
CFilesystemViewer::~CFilesystemViewer()
{
delete pFileSystem;
delete OpenIso;
}
void CFilesystemViewer::CreateGUIControls()
@ -127,7 +135,7 @@ void CFilesystemViewer::CreateGUIControls()
m_Treectrl = new wxTreeCtrl(this, ID_TREECTRL, wxDefaultPosition, wxSize(350, 450)/*wxDefaultSize*/, wxTR_DEFAULT_STYLE, wxDefaultValidator);
sbTreectrl->Add(m_Treectrl, 1, wxEXPAND);
m_Treectrl->AddRoot(wxT("Root"), -1, -1, 0);
RootId = m_Treectrl->AddRoot(wxT("Root"), -1, -1, 0);
/////////////
wxGridBagSizer* sMain;
@ -188,7 +196,23 @@ void CFilesystemViewer::OnBannerImageSave(wxCommandEvent& WXUNUSED (event))
void CFilesystemViewer::OnExtractFile(wxCommandEvent& WXUNUSED (event))
{
wxString Path;
wxString File;
Path = wxFileSelector(
_T("Export File"),
wxEmptyString, wxEmptyString, wxEmptyString,
wxString::Format
(
_T("All files (%s)|%s"),
wxFileSelectorDefaultWildcardStr
),
wxFD_SAVE,
this);
File = m_Treectrl->GetItemText(m_Treectrl->GetSelection());
if (!Path || !File)
return;
pFileSystem->ExportFile(File.mb_str(), Path.mb_str());
}
void CFilesystemViewer::OnReplaceFile(wxCommandEvent& WXUNUSED (event))

View File

@ -76,6 +76,7 @@ class CFilesystemViewer : public wxDialog
wxTextCtrl *m_Maker;
wxTextCtrl *m_Comment;
wxTextCtrl *m_Banner;
wxTreeItemId RootId;
wxChoice *m_Lang;
wxButton *m_SaveBNR;

View File

@ -472,7 +472,7 @@ void CGameListCtrl::OnRightClick(wxMouseEvent& event)
popupMenu.Append(IDM_EDITPATCHFILE, wxString::FromAscii(menu_text.c_str())); //Pretty much everything in wxwidgets is a wxString, try to convert to those first!
popupMenu.Append(IDM_OPENCONTAININGFOLDER, wxString::FromAscii("Open &containing folder"));
popupMenu.Append(IDM_SETDEFAULTGCM, wxString::FromAscii("Set as &default ISO"));
//popupMenu.Append(IDM_FILESYSTEMVIEWER, wxString::FromAscii("Open in ISO viewer/dumper"));
popupMenu.Append(IDM_FILESYSTEMVIEWER, wxString::FromAscii("Open in ISO viewer/dumper"));
// F|RES: compression doesn't work and will be rewritten ... if it is fixed the gui is ready :D
if (selected_iso->IsCompressed())