aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/MachinaGUI.cpp43
-rw-r--r--src/gui/MachinaGUI.hpp2
2 files changed, 20 insertions, 25 deletions
diff --git a/src/gui/MachinaGUI.cpp b/src/gui/MachinaGUI.cpp
index 59c035e..77dcbc5 100644
--- a/src/gui/MachinaGUI.cpp
+++ b/src/gui/MachinaGUI.cpp
@@ -359,31 +359,29 @@ MachinaGUI::menu_file_open()
void
MachinaGUI::menu_file_save()
{
- cerr << "save\n";
-
+ if (_save_filename == "") {
+ menu_file_save_as();
+ } else {
+ Raul::RDFWriter writer;
+ writer.start_to_filename(_save_filename);
+ machine()->write_state(writer);
+ writer.finish();
+ }
+}
+
+
+void
+MachinaGUI::menu_file_save_as()
+{
Gtk::FileChooserDialog dialog(*_main_window, "Save Machine", Gtk::FILE_CHOOSER_ACTION_SAVE);
- /*Gtk::VBox* box = dialog.get_vbox();
- Gtk::Label warning("Warning: Recursively saving will overwrite any subpatch files \
- without confirmation.");
- box->pack_start(warning, false, false, 2);
- Gtk::CheckButton recursive_checkbutton("Recursively save all subpatches");
- box->pack_start(recursive_checkbutton, false, false, 0);
- recursive_checkbutton.show();
- */
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
- // Set current folder to most sensible default
- /*const string& current_filename = _patch->filename();
- if (current_filename.length() > 0)
- dialog.set_filename(current_filename);
- else if (App::instance().configuration()->patch_folder().length() > 0)
- dialog.set_current_folder(App::instance().configuration()->patch_folder());
- */
+ if (_save_filename.length() > 0)
+ dialog.set_filename(_save_filename);
- int result = dialog.run();
- //bool recursive = recursive_checkbutton.get_active();
+ const int result = dialog.run();
assert(result == Gtk::RESPONSE_OK || result == Gtk::RESPONSE_CANCEL || result == Gtk::RESPONSE_NONE);
@@ -414,18 +412,13 @@ MachinaGUI::menu_file_save()
writer.start_to_filename(filename);
machine()->write_state(writer);
writer.finish();
+ _save_filename = filename;
}
}
}
void
-MachinaGUI::menu_file_save_as()
-{
-}
-
-
-void
MachinaGUI::on_pane_position_changed()
{
// avoid infinite recursion...
diff --git a/src/gui/MachinaGUI.hpp b/src/gui/MachinaGUI.hpp
index 46d4884..47142b0 100644
--- a/src/gui/MachinaGUI.hpp
+++ b/src/gui/MachinaGUI.hpp
@@ -81,6 +81,8 @@ protected:
bool _refresh;
+ string _save_filename;
+
boost::shared_ptr<MachinaCanvas> _canvas;
boost::shared_ptr<Machina::Engine> _engine;