diff options
author | David Robillard <d@drobilla.net> | 2007-02-24 21:24:36 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-02-24 21:24:36 +0000 |
commit | 2f3580a8d7b743811e1bc78487e56210d564e4aa (patch) | |
tree | 11fd2bb1627ac67d7a11756aad144712c05a043a /src | |
parent | 833a8e0679c810fc6fc5b1e783ee28a580bcae79 (diff) | |
download | machina-2f3580a8d7b743811e1bc78487e56210d564e4aa.tar.gz machina-2f3580a8d7b743811e1bc78487e56210d564e4aa.tar.bz2 machina-2f3580a8d7b743811e1bc78487e56210d564e4aa.zip |
Fixed save/save as dialog behavior.
git-svn-id: http://svn.drobilla.net/lad/machina@337 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/MachinaGUI.cpp | 43 | ||||
-rw-r--r-- | src/gui/MachinaGUI.hpp | 2 |
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; |