From: dooglus Date: Sun, 10 Feb 2008 20:38:46 +0000 (+0000) Subject: Have caret>file>open start off by listing the current workarea's directory, if it... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0701c9f1b64c96d5ed536c110dfd6cff531cca61;p=synfig.git Have caret>file>open start off by listing the current workarea's directory, if it has one. git-svn-id: http://svn.voria.com/code@1658 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/app.cpp b/synfig-studio/trunk/src/gtkmm/app.cpp index 871ac9a..251e919 100644 --- a/synfig-studio/trunk/src/gtkmm/app.cpp +++ b/synfig-studio/trunk/src/gtkmm/app.cpp @@ -2006,9 +2006,10 @@ App::new_instance() } void -App::dialog_open() +App::dialog_open(string filename) { - string filename="*.sif"; + if (filename.empty()) + filename="*.sif"; while(dialog_open_file("Open", filename, ANIMATION_DIR_PREFERENCE)) { diff --git a/synfig-studio/trunk/src/gtkmm/app.h b/synfig-studio/trunk/src/gtkmm/app.h index d49fae3..cc5aa20 100644 --- a/synfig-studio/trunk/src/gtkmm/app.h +++ b/synfig-studio/trunk/src/gtkmm/app.h @@ -295,7 +295,7 @@ public: static void new_instance(); - static void dialog_open(); + static void dialog_open(std::string filename = ""); static void dialog_about(); diff --git a/synfig-studio/trunk/src/gtkmm/canvasview.cpp b/synfig-studio/trunk/src/gtkmm/canvasview.cpp index ad2ab6b..3af3417 100644 --- a/synfig-studio/trunk/src/gtkmm/canvasview.cpp +++ b/synfig-studio/trunk/src/gtkmm/canvasview.cpp @@ -1203,7 +1203,7 @@ CanvasView::init_menus() sigc::hide_return(sigc::ptr_fun(&studio::App::new_instance)) ); action_group->add( Gtk::Action::create("open", Gtk::Stock::OPEN), - sigc::hide_return(sigc::ptr_fun(&studio::App::dialog_open)) + sigc::hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::open)) ); action_group->add( Gtk::Action::create("save", Gtk::Stock::SAVE), hide_return(sigc::mem_fun(*get_instance().get(), &studio::Instance::save)) diff --git a/synfig-studio/trunk/src/gtkmm/instance.cpp b/synfig-studio/trunk/src/gtkmm/instance.cpp index c921c3f..1516eb0 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.cpp +++ b/synfig-studio/trunk/src/gtkmm/instance.cpp @@ -205,6 +205,12 @@ studio::Instance::save_as(const synfig::String &file_name) return false; } +void +studio::Instance::open() +{ + App::dialog_open(get_file_name()); +} + Instance::Status studio::Instance::save() { diff --git a/synfig-studio/trunk/src/gtkmm/instance.h b/synfig-studio/trunk/src/gtkmm/instance.h index d5aacfe..d07474a 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.h +++ b/synfig-studio/trunk/src/gtkmm/instance.h @@ -182,6 +182,8 @@ public: //! returns true if the save was successful bool dialog_save_as(); + void open(); + Status save(); void dialog_cvs_commit(); diff --git a/synfig-studio/trunk/src/gtkmm/toolbox.cpp b/synfig-studio/trunk/src/gtkmm/toolbox.cpp index 0318892..f65be46 100644 --- a/synfig-studio/trunk/src/gtkmm/toolbox.cpp +++ b/synfig-studio/trunk/src/gtkmm/toolbox.cpp @@ -227,7 +227,7 @@ Toolbox::Toolbox(): filemenu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::NEW, sigc::ptr_fun(&studio::App::new_instance))); filemenu->items().push_back(Gtk::Menu_Helpers::StockMenuElem(Gtk::Stock::OPEN, - sigc::ptr_fun(&studio::App::dialog_open))); + sigc::bind(sigc::ptr_fun(&studio::App::dialog_open), ""))); filemenu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("Open Recent"),*recent_files_menu)); @@ -284,7 +284,7 @@ Toolbox::Toolbox(): button_about->signal_clicked().connect(sigc::ptr_fun(studio::App::dialog_about)); button_new->signal_clicked().connect(sigc::ptr_fun(studio::App::new_instance)); - button_open->signal_clicked().connect(sigc::ptr_fun(studio::App::dialog_open)); + button_open->signal_clicked().connect(sigc::bind(sigc::ptr_fun(studio::App::dialog_open), "")); button_save->signal_clicked().connect(sigc::ptr_fun(save_selected_instance)); button_saveas->signal_clicked().connect(sigc::ptr_fun(save_as_selected_instance)); button_save_all->signal_clicked().connect(sigc::ptr_fun(save_all));