X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fapp.cpp;h=3099c4403f3776dd440de09d53d0d6973ce68a9b;hb=1e706e54c01cd6baae01b1199c8997c48345ed8c;hp=64f0f324209c3eb8ff646ebcacce16e6f584221a;hpb=d58be04cc06d8bcf0a18f7830026b3ace4da7316;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/app.cpp b/synfig-studio/trunk/src/gtkmm/app.cpp index 64f0f32..3099c44 100644 --- a/synfig-studio/trunk/src/gtkmm/app.cpp +++ b/synfig-studio/trunk/src/gtkmm/app.cpp @@ -322,6 +322,34 @@ class GlobalUIInterface : public synfigapp::UIInterface { public: + virtual Response confirmation(const std::string &title, + const std::string &primaryText, + const std::string &secondaryText, + const std::string &confirmPhrase, + const std::string &cancelPhrase, + Response defaultResponse) + { + Gtk::MessageDialog dialog( + primaryText, // Message + false, // Markup + Gtk::MESSAGE_WARNING, // Type + Gtk::BUTTONS_NONE, // Buttons + true // Modal + ); + + if (! title.empty()) + dialog.set_title(title); + if (! secondaryText.empty()) + dialog.set_secondary_text(secondaryText); + + dialog.add_button(cancelPhrase, RESPONSE_CANCEL); + dialog.add_button(confirmPhrase, RESPONSE_OK); + dialog.set_default_response(defaultResponse); + + dialog.show_all(); + return (Response) dialog.run(); + } + virtual Response yes_no(const std::string &title, const std::string &message,Response dflt=RESPONSE_YES) { Gtk::Dialog dialog( @@ -542,7 +570,7 @@ public: value=strprintf("%s",App::predefined_size.c_str()); return true; } - + return synfigapp::Settings::get_value(key,value); } @@ -660,7 +688,7 @@ public: ret.push_back("custom_filename_prefix"); ret.push_back("preferred_x_size"); ret.push_back("preferred_y_size"); - ret.push_back("predefined_size"); + ret.push_back("predefined_size"); return ret; } }; @@ -1058,7 +1086,7 @@ init_ui_manager() ACCEL("0", "//quality-10" ); ACCEL("z", "//undo" ); ACCEL("r", "//redo" ); - ACCEL("Delete", "//action-LayerRemove" ); + ACCEL2(Gtk::AccelKey(GDK_Delete,Gdk::CONTROL_MASK, "//action-LayerRemove" )); ACCEL2(Gtk::AccelKey('(',Gdk::CONTROL_MASK, "//decrease-low-res-pixel-size" )); ACCEL2(Gtk::AccelKey(')',Gdk::CONTROL_MASK, "//increase-low-res-pixel-size" )); ACCEL2(Gtk::AccelKey('(',Gdk::MOD1_MASK|Gdk::CONTROL_MASK, "//amount-dec" )); @@ -1073,7 +1101,7 @@ init_ui_manager() ACCEL2(Gtk::AccelKey(',',Gdk::CONTROL_MASK, "//seek-prev-frame" )); ACCEL2(Gtk::AccelKey('>',Gdk::CONTROL_MASK, "//seek-next-second" )); ACCEL2(Gtk::AccelKey('<',Gdk::CONTROL_MASK, "//seek-prev-second" )); - ACCEL2(Gtk::AccelKey('o',Gdk::MOD1_MASK, "//toggle-onion-skin" )); + ACCEL("o", "//toggle-onion-skin" ); ACCEL("z", "//canvas-zoom-fit" ); ACCEL("p", "//play" ); ACCEL("Home", "//seek-begin" ); @@ -1272,7 +1300,7 @@ App::App(int *argc, char ***argv): studio_init_cb.task(_("Init Input Dialog...")); dialog_input=new Gtk::InputDialog(); dialog_input->get_close_button()->signal_clicked().connect( sigc::mem_fun( *dialog_input, &Gtk::InputDialog::hide ) ); - dialog_input->get_save_button()->signal_clicked().connect( sigc::ptr_fun(studio::App::dialog_not_implemented) ); + dialog_input->get_save_button()->signal_clicked().connect( sigc::mem_fun( *device_tracker, &DeviceTracker::save_preferences) ); studio_init_cb.task(_("Init auto recovery...")); auto_recover=new AutoRecover(); @@ -1280,6 +1308,8 @@ App::App(int *argc, char ***argv): studio_init_cb.amount_complete(9250,10000); studio_init_cb.task(_("Loading Settings...")); load_settings(); + device_tracker->load_preferences(); + studio_init_cb.task(_("Checking auto-recover...")); studio_init_cb.amount_complete(9900,10000); @@ -1288,12 +1318,13 @@ App::App(int *argc, char ***argv): if(auto_recover->recovery_needed()) { splash_screen.hide(); - if (get_ui_interface()->yes_no(_("Auto Recovery"), - _("Synfig Studio seems to have crashed\n" - "before you could save all your files.\n" - "Would you like to re-open those files\n" - "and recover your unsaved changes?")) == - synfigapp::UIInterface::RESPONSE_YES) + if (get_ui_interface()->confirmation("Crash Recovery", + _("Auto recovery file found"), + _("Synfig Studio seems to have crashed\n" + "before you could save all your files.\n" + "Recover unsaved changes?"), + _("Recover"), _("Ignore")) + == synfigapp::UIInterface::RESPONSE_OK) { int number_recovered; if(!auto_recover->recover(number_recovered)) @@ -1368,7 +1399,7 @@ App::~App() delete auto_recover; delete about; - + toolbox->hide(); // studio::App::iteration(false); @@ -2221,7 +2252,7 @@ try_open_url(const std::string &url) try { Glib::spawn_async(".", command_line, Glib::SPAWN_SEARCH_PATH); } // Failed, move on to the next one catch(Glib::SpawnError& exception){ continue; } - return true; // No exception means we succeeded! + return true; // No exception means we succeeded! } } @@ -2361,7 +2392,7 @@ App::open_as(std::string filename,std::string as) if (warnings != "") dialog_warning_blocking(_("Warnings"), strprintf("%s:\n\n%s", _("Warnings"), warnings.c_str())); - + if (as.find(custom_filename_prefix.c_str()) != 0) add_recent_file(as);