Have caret>file>open start off by listing the current workarea's directory, if it...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 10 Feb 2008 20:38:46 +0000 (20:38 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Sun, 10 Feb 2008 20:38:46 +0000 (20:38 +0000)
git-svn-id: http://svn.voria.com/code@1658 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/app.cpp
synfig-studio/trunk/src/gtkmm/app.h
synfig-studio/trunk/src/gtkmm/canvasview.cpp
synfig-studio/trunk/src/gtkmm/instance.cpp
synfig-studio/trunk/src/gtkmm/instance.h
synfig-studio/trunk/src/gtkmm/toolbox.cpp

index 871ac9a..251e919 100644 (file)
@@ -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))
        {
index d49fae3..cc5aa20 100644 (file)
@@ -295,7 +295,7 @@ public:
 
        static void new_instance();
 
-       static void dialog_open();
+       static void dialog_open(std::string filename = "");
 
        static void dialog_about();
 
index ad2ab6b..3af3417 100644 (file)
@@ -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))
index c921c3f..1516eb0 100644 (file)
@@ -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()
 {
index d5aacfe..d07474a 100644 (file)
@@ -182,6 +182,8 @@ public:
        //! returns true if the save was successful
        bool dialog_save_as();
 
+       void open();
+
        Status save();
 
        void dialog_cvs_commit();
index 0318892..f65be46 100644 (file)
@@ -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));