Finished new Filesystem tree viewer
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@827 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
15c3ea50fc
commit
e6bc65318c
|
@ -52,9 +52,10 @@ CFilesystemViewer::CFilesystemViewer(const std::string fileName, wxWindow* paren
|
||||||
|
|
||||||
// shuffle2: things only appear in the tree for me when using debug build; why? :<
|
// shuffle2: things only appear in the tree for me when using debug build; why? :<
|
||||||
wxTreeItemId dirId = NULL;
|
wxTreeItemId dirId = NULL;
|
||||||
fileIter beginning = Our_Files.begin(), pos = Our_Files.begin();
|
fileIter beginning = Our_Files.begin(), end = Our_Files.end(),
|
||||||
|
pos = Our_Files.begin();
|
||||||
|
|
||||||
CreateDirectoryTree(RootId, beginning, pos, "\\");
|
CreateDirectoryTree(RootId, beginning, end, pos, "\\");
|
||||||
|
|
||||||
m_Treectrl->Expand(RootId);
|
m_Treectrl->Expand(RootId);
|
||||||
|
|
||||||
|
@ -98,15 +99,22 @@ CFilesystemViewer::~CFilesystemViewer()
|
||||||
|
|
||||||
void CFilesystemViewer::CreateDirectoryTree(wxTreeItemId& parent,
|
void CFilesystemViewer::CreateDirectoryTree(wxTreeItemId& parent,
|
||||||
fileIter& begin,
|
fileIter& begin,
|
||||||
|
fileIter& end,
|
||||||
fileIter& iterPos,
|
fileIter& iterPos,
|
||||||
char *directory)
|
char *directory)
|
||||||
{
|
{
|
||||||
|
bool bRoot = true;
|
||||||
//TODO(XK): Fix more than one folder/file not appearing in the root
|
//TODO(XK): Fix more than one folder/file not appearing in the root
|
||||||
if(iterPos == begin)
|
if(iterPos == begin)
|
||||||
++iterPos;
|
++iterPos;
|
||||||
|
else
|
||||||
|
bRoot = false;
|
||||||
|
|
||||||
char *name = (char *)((*iterPos)->m_FullPath);
|
char *name = (char *)((*iterPos)->m_FullPath);
|
||||||
|
|
||||||
|
if(iterPos == end)
|
||||||
|
return;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if((*iterPos)->IsDirectory()) {
|
if((*iterPos)->IsDirectory()) {
|
||||||
|
@ -117,17 +125,26 @@ void CFilesystemViewer::CreateDirectoryTree(wxTreeItemId& parent,
|
||||||
dirName = name;
|
dirName = name;
|
||||||
else
|
else
|
||||||
dirName++;
|
dirName++;
|
||||||
//filename = strrchr(name, '\\'); ++filename;
|
|
||||||
wxTreeItemId item = m_Treectrl->AppendItem(parent, wxT(dirName));
|
|
||||||
CreateDirectoryTree(item, begin, ++iterPos, name);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
//filename = strrchr(name, '\\'); ++filename;
|
wxTreeItemId item = m_Treectrl->AppendItem(parent, wxT(dirName));
|
||||||
m_Treectrl->AppendItem(parent, wxT(strrchr(name, '\\') + 1));
|
CreateDirectoryTree(item, begin, end, ++iterPos, name);
|
||||||
|
} else {
|
||||||
|
char *fileName = strrchr(name, '\\');
|
||||||
|
if(!fileName)
|
||||||
|
fileName = name;
|
||||||
|
else
|
||||||
|
fileName++;
|
||||||
|
|
||||||
|
m_Treectrl->AppendItem(parent, wxT(fileName));
|
||||||
|
++iterPos;
|
||||||
}
|
}
|
||||||
++iterPos;
|
|
||||||
|
if(iterPos == end)
|
||||||
|
break;
|
||||||
|
|
||||||
name = (char *)((*iterPos)->m_FullPath);
|
name = (char *)((*iterPos)->m_FullPath);
|
||||||
} while(strstr(name, directory));
|
|
||||||
|
} while(bRoot || strstr(name, directory));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFilesystemViewer::CreateGUIControls()
|
void CFilesystemViewer::CreateGUIControls()
|
||||||
|
|
|
@ -138,6 +138,7 @@ class CFilesystemViewer : public wxDialog
|
||||||
typedef std::vector<const DiscIO::SFileInfo *>::iterator fileIter;
|
typedef std::vector<const DiscIO::SFileInfo *>::iterator fileIter;
|
||||||
|
|
||||||
void CreateDirectoryTree(wxTreeItemId& parent,fileIter& begin,
|
void CreateDirectoryTree(wxTreeItemId& parent,fileIter& begin,
|
||||||
|
fileIter& end,
|
||||||
fileIter& iterPos, char *directory);
|
fileIter& iterPos, char *directory);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue