mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
You can save files off disk now.
This commit is contained in:
@@ -382,7 +382,7 @@ MainWindowGen::MainWindowGen( wxWindow* parent, wxWindowID id, const wxString& t
|
||||
imagerGoAgainButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainWindowGen::OnImagerGoAgainButton ), NULL, this );
|
||||
this->Connect( browserBackTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBackButton ) );
|
||||
this->Connect( browserInfoTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserInfoButton ) );
|
||||
this->Connect( browserViewTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserOpenButton ) );
|
||||
this->Connect( browserViewTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserViewButton ) );
|
||||
this->Connect( browserSaveTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserSaveButton ) );
|
||||
this->Connect( browserAddTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserAddButton ) );
|
||||
browserAddMenu->Bind(wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindowGen::OnBrowserNewDirectoryButton ), this, browserNewDirectoryMenuItem->GetId());
|
||||
@@ -416,7 +416,7 @@ MainWindowGen::~MainWindowGen()
|
||||
imagerGoAgainButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( MainWindowGen::OnImagerGoAgainButton ), NULL, this );
|
||||
this->Disconnect( browserBackTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBackButton ) );
|
||||
this->Disconnect( browserInfoTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserInfoButton ) );
|
||||
this->Disconnect( browserViewTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserOpenButton ) );
|
||||
this->Disconnect( browserViewTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserViewButton ) );
|
||||
this->Disconnect( browserSaveTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserSaveButton ) );
|
||||
this->Disconnect( browserAddTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserAddButton ) );
|
||||
this->Disconnect( browserFormatTool->GetId(), wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( MainWindowGen::OnBrowserFormatButton ) );
|
||||
|
||||
@@ -2376,7 +2376,7 @@
|
||||
<property name="permission">protected</property>
|
||||
<property name="statusbar"></property>
|
||||
<property name="tooltip"></property>
|
||||
<event name="OnToolClicked">OnBrowserOpenButton</event>
|
||||
<event name="OnToolClicked">OnBrowserViewButton</event>
|
||||
</object>
|
||||
<object class="tool" expanded="1">
|
||||
<property name="bitmap">Load From Art Provider; wxART_FILE_SAVE; wxART_TOOLBAR</property>
|
||||
|
||||
@@ -120,7 +120,7 @@ class MainWindowGen : public wxFrame
|
||||
virtual void OnSaveFluxButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnImagerGoAgainButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnBrowserInfoButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnBrowserOpenButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnBrowserViewButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnBrowserSaveButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnBrowserAddButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnBrowserNewDirectoryButton( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
@@ -445,7 +445,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void OnBrowserInfoButton(wxCommandEvent&)
|
||||
void OnBrowserInfoButton(wxCommandEvent&) override
|
||||
{
|
||||
auto item = browserTree->GetSelection();
|
||||
auto dc = (DirentContainer*)_filesystemModel->GetItemData(item);
|
||||
@@ -454,7 +454,7 @@ public:
|
||||
FSOP_GETFILEINFO, dc->dirent->path));
|
||||
}
|
||||
|
||||
void OnBrowserOpenButton(wxCommandEvent&)
|
||||
void OnBrowserViewButton(wxCommandEvent&) override
|
||||
{
|
||||
auto item = browserTree->GetSelection();
|
||||
auto dc = (DirentContainer*)_filesystemModel->GetItemData(item);
|
||||
@@ -463,6 +463,25 @@ public:
|
||||
std::make_unique<FilesystemOperation>(FSOP_OPEN, dc->dirent->path));
|
||||
}
|
||||
|
||||
void OnBrowserSaveButton(wxCommandEvent&) override
|
||||
{
|
||||
auto item = browserTree->GetSelection();
|
||||
auto dc = (DirentContainer*)_filesystemModel->GetItemData(item);
|
||||
|
||||
auto localFilename =
|
||||
wxFileSelector("Choose the name of the file to save",
|
||||
/* default_path= */ wxEmptyString,
|
||||
/* default_filename= */ dc->dirent->filename,
|
||||
/* default_extension= */ wxEmptyString,
|
||||
/* wildcard= */ wxEmptyString,
|
||||
/* flags= */ wxFD_SAVE | wxFD_OVERWRITE_PROMPT);
|
||||
if (localFilename.empty())
|
||||
return;
|
||||
|
||||
QueueBrowserOperation(std::make_unique<FilesystemOperation>(
|
||||
FSOP_GETFILE, dc->dirent->path, localFilename));
|
||||
}
|
||||
|
||||
void QueueBrowserOperation(std::unique_ptr<FilesystemOperation> op)
|
||||
{
|
||||
_filesystemQueue.push_back(std::move(op));
|
||||
@@ -552,6 +571,13 @@ public:
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case FSOP_GETFILE:
|
||||
{
|
||||
auto bytes = _filesystem->getFile(op->path);
|
||||
bytes.writeToFile(op->local);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1008,6 +1034,7 @@ private:
|
||||
FSOP_LIST,
|
||||
FSOP_GETFILEINFO,
|
||||
FSOP_OPEN,
|
||||
FSOP_GETFILE,
|
||||
};
|
||||
|
||||
class FilesystemOperation
|
||||
@@ -1027,11 +1054,27 @@ private:
|
||||
{
|
||||
}
|
||||
|
||||
FilesystemOperation(
|
||||
int operation, const Path& path, const std::string& local):
|
||||
operation(operation),
|
||||
path(path),
|
||||
local(local)
|
||||
{
|
||||
}
|
||||
|
||||
FilesystemOperation(int operation, const Path& path, wxString& local):
|
||||
operation(operation),
|
||||
path(path),
|
||||
local(local)
|
||||
{
|
||||
}
|
||||
|
||||
FilesystemOperation(int operation): operation(operation) {}
|
||||
|
||||
int operation;
|
||||
Path path;
|
||||
wxDataViewItem item;
|
||||
std::string local;
|
||||
};
|
||||
|
||||
wxConfig _config;
|
||||
|
||||
Reference in New Issue
Block a user