From bab4b964c7a2bbbefd799dacecd3ab9b6504fb7f Mon Sep 17 00:00:00 2001 From: genete Date: Tue, 2 Sep 2008 20:23:52 +0000 Subject: [PATCH] Apply [ 2087747 ] Save preferred X and Y canvas dimensions for new files git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2036 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/app.cpp | 34 +++++++++++++++++++++--- synfig-studio/trunk/src/gtkmm/app.h | 3 ++- synfig-studio/trunk/src/gtkmm/dialog_setup.cpp | 36 ++++++++++++++++++++++---- synfig-studio/trunk/src/gtkmm/dialog_setup.h | 2 ++ 4 files changed, 65 insertions(+), 10 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/app.cpp b/synfig-studio/trunk/src/gtkmm/app.cpp index 217174e..09a2875 100644 --- a/synfig-studio/trunk/src/gtkmm/app.cpp +++ b/synfig-studio/trunk/src/gtkmm/app.cpp @@ -274,6 +274,8 @@ bool studio::App::use_colorspace_gamma=true; bool studio::App::single_threaded=false; #endif bool studio::App::restrict_radius_ducks=false; +int studio::App::preferred_x_size=480; +int studio::App::preferred_y_size=270; #ifdef USE_OPEN_FOR_URLS String studio::App::browser_command("open"); // MacOS only #else @@ -511,7 +513,16 @@ public: value=App::browser_command; return true; } - + if(key=="preferred_x_size") + { + value=strprintf("%i",App::preferred_x_size); + return true; + } + if(key=="preferred_y_size") + { + value=strprintf("%i",App::preferred_y_size); + return true; + } return synfigapp::Settings::get_value(key,value); } @@ -580,7 +591,18 @@ public: App::browser_command=value; return true; } - + if(key=="preferred_x_size") + { + int i(atoi(value.c_str())); + App::preferred_x_size=i; + return true; + } + if(key=="preferred_y_size") + { + int i(atoi(value.c_str())); + App::preferred_y_size=i; + return true; + } return synfigapp::Settings::set_value(key,value); } @@ -598,6 +620,8 @@ public: ret.push_back("auto_recover_backup_interval"); ret.push_back("restrict_radius_ducks"); ret.push_back("browser_command"); + ret.push_back("preferred_x_size"); + ret.push_back("preferred_y_size"); return ret; } }; @@ -1679,6 +1703,8 @@ App::reset_initial_window_configuration() synfigapp::Main::settings().set_value("pref.single_threaded","0"); #endif synfigapp::Main::settings().set_value("pref.restrict_radius_ducks","0"); + synfigapp::Main::settings().set_value("pref.preferred_x_size","480"); + synfigapp::Main::settings().set_value("pref.preferred_y_size","270"); synfigapp::Main::settings().set_value("window.toolbox.pos","4 4"); } @@ -2347,8 +2373,8 @@ App::new_instance() canvas->rend_desc().set_y_res(DPI2DPM(72.0f)); canvas->rend_desc().set_tl(Vector(-4,2.25)); canvas->rend_desc().set_br(Vector(4,-2.25)); - canvas->rend_desc().set_w(480); - canvas->rend_desc().set_h(270); + canvas->rend_desc().set_w(preferred_x_size); + canvas->rend_desc().set_h(preferred_y_size); canvas->rend_desc().set_antialias(1); canvas->rend_desc().set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN); canvas->set_file_name(file_name); diff --git a/synfig-studio/trunk/src/gtkmm/app.h b/synfig-studio/trunk/src/gtkmm/app.h index cc04a06..5dc1fef 100644 --- a/synfig-studio/trunk/src/gtkmm/app.h +++ b/synfig-studio/trunk/src/gtkmm/app.h @@ -198,7 +198,8 @@ public: static bool restrict_radius_ducks; static synfig::String browser_command; - + static int preferred_x_size; + static int preferred_y_size; /* -- ** -- S I G N A L S ------------------------------------------------------- */ diff --git a/synfig-studio/trunk/src/gtkmm/dialog_setup.cpp b/synfig-studio/trunk/src/gtkmm/dialog_setup.cpp index 7e42acb..71bd9de 100644 --- a/synfig-studio/trunk/src/gtkmm/dialog_setup.cpp +++ b/synfig-studio/trunk/src/gtkmm/dialog_setup.cpp @@ -80,8 +80,11 @@ Dialog_Setup::Dialog_Setup(): #ifdef SINGLE_THREADED toggle_single_threaded(_("Use Only a Single Thread")), #endif - toggle_restrict_radius_ducks(_("Restrict Real-Valued Ducks to Top Right Quadrant")) -{ + toggle_restrict_radius_ducks(_("Restrict Real-Valued Ducks to Top Right Quadrant")), + adj_pref_x_size(480,1,10000,1,10,10), + adj_pref_y_size(270,1,10000,1,10,10) + + { // Setup the buttons Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok")))); @@ -192,11 +195,11 @@ Dialog_Setup::Dialog_Setup(): misc_table->attach(*recent_files_spinbutton, 1, 2, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); // Misc - use_colorspace_gamma - misc_table->attach(toggle_use_colorspace_gamma, 0, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + misc_table->attach(toggle_use_colorspace_gamma, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); #ifdef SINGLE_THREADED // Misc - single_threaded - misc_table->attach(toggle_single_threaded, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + misc_table->attach(toggle_single_threaded, 0, 2, 9, 10, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); #endif // Misc - auto backup interval @@ -204,12 +207,22 @@ Dialog_Setup::Dialog_Setup(): misc_table->attach(auto_backup_interval, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); // Misc - restrict_radius_ducks - misc_table->attach(toggle_restrict_radius_ducks, 0, 2, 6, 7, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + misc_table->attach(toggle_restrict_radius_ducks, 0, 2, 8, 9, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); // Misc - browser_command attach_label(misc_table, _("Browser Command"), 4, xpadding, ypadding); misc_table->attach(textbox_browser_command, 1, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + // Misc - Preferred x size + Gtk::SpinButton* pref_x_size_spinbutton(manage(new Gtk::SpinButton(adj_pref_x_size,1,0))); + attach_label(misc_table,_("Preferred Canvas X size"),5, xpadding, ypadding); + misc_table->attach(*pref_x_size_spinbutton, 1, 2, 5, 6,Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + + // Misc - Preferred y size + Gtk::SpinButton* pref_y_size_spinbutton(manage(new Gtk::SpinButton(adj_pref_y_size,1,0))); + attach_label(misc_table,_("Preferred Canvas Y size"),6, xpadding, ypadding); + misc_table->attach(*pref_y_size_spinbutton, 1, 2, 6, 7,Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding); + show_all_children(); } @@ -253,6 +266,12 @@ Dialog_Setup::on_apply_pressed() // Set the browser_command textbox App::browser_command=textbox_browser_command.get_text(); + // Set the preferred new canvas x dimension + App::preferred_x_size=int(adj_pref_x_size.get_value()); + + // Set the preferred new canvas y dimension + App::preferred_y_size=int(adj_pref_y_size.get_value()); + App::save_settings(); } @@ -339,6 +358,13 @@ Dialog_Setup::refresh() // Refresh the browser_command textbox textbox_browser_command.set_text(App::browser_command); + + // Refresh the preferred new canvas y dimension + adj_pref_x_size.set_value(App::preferred_x_size); + + // Refresh the preferred new canvas y dimension + adj_pref_y_size.set_value(App::preferred_y_size); + } GammaPattern::GammaPattern(): diff --git a/synfig-studio/trunk/src/gtkmm/dialog_setup.h b/synfig-studio/trunk/src/gtkmm/dialog_setup.h index 22dd512..68acae1 100644 --- a/synfig-studio/trunk/src/gtkmm/dialog_setup.h +++ b/synfig-studio/trunk/src/gtkmm/dialog_setup.h @@ -178,6 +178,8 @@ class Dialog_Setup : public Gtk::Dialog Gtk::CheckButton toggle_restrict_radius_ducks; Gtk::Entry textbox_browser_command; + Gtk::Adjustment adj_pref_x_size; + Gtk::Adjustment adj_pref_y_size; public: void set_time_format(synfig::Time::Format time_format); -- 2.7.4