diff --git a/lib/vfs/vfs.cc b/lib/vfs/vfs.cc index 8c61d547..32635f2b 100644 --- a/lib/vfs/vfs.cc +++ b/lib/vfs/vfs.cc @@ -115,6 +115,11 @@ void Filesystem::deleteFile(const Path& path) throw UnimplementedFilesystemException(); } +void Filesystem::moveFile(const Path& oldName, const Path& newName) +{ + throw UnimplementedFilesystemException(); +} + bool Filesystem::needsFlushing() { return _sectors->needsFlushing(); diff --git a/lib/vfs/vfs.h b/lib/vfs/vfs.h index 23782704..d1b8599a 100644 --- a/lib/vfs/vfs.h +++ b/lib/vfs/vfs.h @@ -125,6 +125,7 @@ public: OP_GETFSDATA = 0b0000000100000000, OP_PUTFSDATA = 0b0000001000000000, OP_PUTATTRS = 0b0000010000000000, + OP_MOVE = 0b0000100000000000, }; public: @@ -167,6 +168,9 @@ public: /* Deletes a file or non-empty directory. */ virtual void deleteFile(const Path& path); + /* Moves a file (including renaming it). */ + virtual void moveFile(const Path& oldName, const Path& newName); + /* Does this filesystem need flushing? */ bool needsFlushing(); diff --git a/src/gui/layout.cpp b/src/gui/layout.cpp index a33813b1..c16d4646 100644 --- a/src/gui/layout.cpp +++ b/src/gui/layout.cpp @@ -286,6 +286,8 @@ MainWindowGen::MainWindowGen( wxWindow* parent, wxWindowID id, const wxString& t browserNewDirectoryTool = browserToolbar->AddTool( wxID_ANY, wxT("New directory"), wxArtProvider::GetBitmap( wxART_NEW_DIR, wxART_TOOLBAR ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); + browserRenameTool = browserToolbar->AddTool( wxID_ANY, wxT("Rename"), wxArtProvider::GetBitmap( wxART_COPY, wxART_TOOLBAR ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); + browserDeleteTool = browserToolbar->AddTool( wxID_ANY, wxT("Delete"), wxArtProvider::GetBitmap( wxART_DELETE, wxART_TOOLBAR ), wxNullBitmap, wxITEM_NORMAL, wxEmptyString, wxEmptyString, NULL ); browserToolbar->AddSeparator(); diff --git a/src/gui/layout.fbp b/src/gui/layout.fbp index c0be4165..6052520a 100644 --- a/src/gui/layout.fbp +++ b/src/gui/layout.fbp @@ -47,7 +47,7 @@ MainWindowGen - 592,607 + 616,607 wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER ; ; forward_declare FluxEngine @@ -2375,6 +2375,17 @@ OnBrowserNewDirectoryButton + + Load From Art Provider; wxART_COPY; wxART_TOOLBAR + 0 + wxID_ANY + wxITEM_NORMAL + Rename + browserRenameTool + protected + + + Load From Art Provider; wxART_DELETE; wxART_TOOLBAR 0 diff --git a/src/gui/layout.h b/src/gui/layout.h index ae47c6f7..006e770b 100644 --- a/src/gui/layout.h +++ b/src/gui/layout.h @@ -90,6 +90,7 @@ class MainWindowGen : public wxFrame wxToolBarToolBase* browserSaveTool; wxToolBarToolBase* browserNewTool; wxToolBarToolBase* browserNewDirectoryTool; + wxToolBarToolBase* browserRenameTool; wxToolBarToolBase* browserDeleteTool; wxToolBarToolBase* browserFormatTool; wxDataViewCtrl* browserTree; @@ -129,7 +130,7 @@ class MainWindowGen : public wxFrame public: - MainWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("FluxEngine"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 592,607 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL ); + MainWindowGen( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("FluxEngine"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 616,607 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL ); ~MainWindowGen(); diff --git a/src/gui/mainwindow.cc b/src/gui/mainwindow.cc index be7d1742..6b15d070 100644 --- a/src/gui/mainwindow.cc +++ b/src/gui/mainwindow.cc @@ -928,6 +928,9 @@ public: browserToolbar->EnableTool(browserNewDirectoryTool->GetId(), (capabilities & Filesystem::OP_CREATEDIR) && (selection.size() <= 1)); + browserToolbar->EnableTool(browserRenameTool->GetId(), + (capabilities & Filesystem::OP_MOVE) && + (selection.size() == 1)); browserToolbar->EnableTool(browserDeleteTool->GetId(), (capabilities & Filesystem::OP_DELETE) && (selection.size() >= 1));