Replace "Gradient" checkbutton with "Create Gradient BLine", etc., like in the other...
[synfig.git] / synfig-studio / trunk / src / gtkmm / dialog_setup.cpp
index 27c018a..7e42acb 100644 (file)
@@ -61,6 +61,14 @@ using namespace studio;
 
 /* === M E T H O D S ======================================================= */
 
+static void
+attach_label(Gtk::Table *table, String str, guint col, guint xpadding, guint ypadding)
+{
+       Gtk::Label* label(manage(new Gtk::Label((str + ":").c_str())));
+       label->set_alignment(Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
+       table->attach(*label, 0, 1, col, col+1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
+}
+
 Dialog_Setup::Dialog_Setup():
        Dialog(_("Synfig Studio Setup"),false,true),
        adj_gamma_r(2.2,0.1,3.0,0.025,0.025,0.025),
@@ -69,7 +77,9 @@ Dialog_Setup::Dialog_Setup():
        adj_recent_files(15,1,50,1,1,1),
        adj_undo_depth(100,10,5000,1,1,1),
        toggle_use_colorspace_gamma(_("Visually Linear Color Selection")),
+#ifdef SINGLE_THREADED
        toggle_single_threaded(_("Use Only a Single Thread")),
+#endif
        toggle_restrict_radius_ducks(_("Restrict Real-Valued Ducks to Top Right Quadrant"))
 {
        // Setup the buttons
@@ -130,29 +140,28 @@ Dialog_Setup::Dialog_Setup():
        Gtk::Table *misc_table=manage(new Gtk::Table(2,2,false));
        notebook->append_page(*misc_table,_("Misc."));
 
+       int xpadding(8), ypadding(8);
+
        // Misc - Timestamp
        timestamp_menu=manage(new class Gtk::Menu());
-       misc_table->attach(*manage(new Gtk::Label(_("Timestamp"))), 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
-       misc_table->attach(timestamp_optionmenu, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
-
-#define ADD_TIMESTAMP(desc,x)  \
-       timestamp_menu->items().push_back(      \
-               Gtk::Menu_Helpers::MenuElem(    \
-                       desc,   \
-                       sigc::bind(     \
-                               sigc::mem_fun(  \
-                                       *this,  \
-                                       &studio::Dialog_Setup::set_time_format  \
-                               ),      \
-                               x       \
-                       )       \
-               )       \
-       );
-       ADD_TIMESTAMP("HH:MM:SS.FF",Time::FORMAT_VIDEO);
-       ADD_TIMESTAMP("(HHh MMm SSs) FFf",Time::FORMAT_NORMAL);
-       ADD_TIMESTAMP("(HHhMMmSSs)FFf",Time::FORMAT_NORMAL|Time::FORMAT_NOSPACES);
-       ADD_TIMESTAMP("HHh MMm SSs FFf",Time::FORMAT_NORMAL|Time::FORMAT_FULL);
-       ADD_TIMESTAMP("HHhMMmSSsFFf",Time::FORMAT_NORMAL|Time::FORMAT_NOSPACES|Time::FORMAT_FULL);
+       attach_label(misc_table, _("Timestamp"), 0, xpadding, ypadding);
+       misc_table->attach(timestamp_optionmenu, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
+
+#define ADD_TIMESTAMP(desc,x)                                                                  \
+       timestamp_menu->items().push_back(                                                      \
+               Gtk::Menu_Helpers::MenuElem(                                                    \
+                       desc,                                                                                           \
+                       sigc::bind(                                                                                     \
+                               sigc::mem_fun(                                                                  \
+                                       *this,                                                                          \
+                                       &studio::Dialog_Setup::set_time_format),        \
+                               x)));
+       ADD_TIMESTAMP("HH:MM:SS.FF",            Time::FORMAT_VIDEO      );
+       ADD_TIMESTAMP("(HHh MMm SSs) FFf",      Time::FORMAT_NORMAL     );
+       ADD_TIMESTAMP("(HHhMMmSSs)FFf",         Time::FORMAT_NORMAL     | Time::FORMAT_NOSPACES );
+       ADD_TIMESTAMP("HHh MMm SSs FFf",        Time::FORMAT_NORMAL     | Time::FORMAT_FULL             );
+       ADD_TIMESTAMP("HHhMMmSSsFFf",           Time::FORMAT_NORMAL     | Time::FORMAT_NOSPACES | Time::FORMAT_FULL);
+       ADD_TIMESTAMP("FFf",                            Time::FORMAT_FRAMES );
 
        timestamp_optionmenu.set_menu(*timestamp_menu);
 
@@ -173,27 +182,33 @@ Dialog_Setup::Dialog_Setup():
                widget_enum=manage(new Widget_Enum());
                widget_enum->set_param_desc(param_desc);
 
-               misc_table->attach(*manage(new Gtk::Label(_("Unit System"))), 0, 1, 3, 4, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
-               misc_table->attach(*widget_enum, 1, 2, 3, 4, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
+               attach_label(misc_table, _("Unit System"), 1, xpadding, ypadding);
+               misc_table->attach(*widget_enum, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
        }
 
        // Misc - recent files
        Gtk::SpinButton* recent_files_spinbutton(manage(new Gtk::SpinButton(adj_recent_files,1,0)));
-       misc_table->attach(*manage(new Gtk::Label(_("Recent Files"))), 0, 1, 1, 2, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
-       misc_table->attach(*recent_files_spinbutton, 1, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
+       attach_label(misc_table, _("Recent Files"), 2, xpadding, ypadding);
+       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, 2, 3, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
+       misc_table->attach(toggle_use_colorspace_gamma, 0, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
 
+#ifdef SINGLE_THREADED
        // Misc - single_threaded
-       misc_table->attach(toggle_single_threaded, 0, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
+       misc_table->attach(toggle_single_threaded, 0, 2, 7, 8, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, xpadding, ypadding);
+#endif
 
        // Misc - auto backup interval
-       misc_table->attach(*manage(new Gtk::Label(_("Auto Backup Interval (0 to disable)"))), 0, 1, 5, 6, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
-       misc_table->attach(auto_backup_interval, 1, 2, 5, 6, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
+       attach_label(misc_table, _("Auto Backup Interval (0 to disable)"), 3, xpadding, ypadding);
+       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, 0, 0);
+       misc_table->attach(toggle_restrict_radius_ducks, 0, 2, 6, 7, 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);
 
        show_all_children();
 }
@@ -222,8 +237,10 @@ Dialog_Setup::on_apply_pressed()
        // Set the use_colorspace_gamma flag
        App::use_colorspace_gamma=toggle_use_colorspace_gamma.get_active();
 
+#ifdef SINGLE_THREADED
        // Set the single_threaded flag
        App::single_threaded=toggle_single_threaded.get_active();
+#endif
 
        // Set the auto backup interval
        App::auto_recover->set_timeout(auto_backup_interval.get_value() * 1000);
@@ -233,6 +250,9 @@ Dialog_Setup::on_apply_pressed()
        // Set the restrict_radius_ducks flag
        App::restrict_radius_ducks=toggle_restrict_radius_ducks.get_active();
 
+       // Set the browser_command textbox
+       App::browser_command=textbox_browser_command.get_text();
+
        App::save_settings();
 }
 
@@ -306,14 +326,19 @@ Dialog_Setup::refresh()
        // Refresh the status of the use_colorspace_gamma flag
        toggle_use_colorspace_gamma.set_active(App::use_colorspace_gamma);
 
+#ifdef SINGLE_THREADED
        // Refresh the status of the single_threaded flag
        toggle_single_threaded.set_active(App::single_threaded);
+#endif
 
        // Refresh the value of the auto backup interval
        auto_backup_interval.set_value(App::auto_recover->get_timeout() / 1000);
 
        // Refresh the status of the restrict_radius_ducks flag
        toggle_restrict_radius_ducks.set_active(App::restrict_radius_ducks);
+
+       // Refresh the browser_command textbox
+       textbox_browser_command.set_text(App::browser_command);
 }
 
 GammaPattern::GammaPattern():
@@ -525,19 +550,20 @@ void
 Dialog_Setup::set_time_format(synfig::Time::Format x)
 {
        time_format=x;
-       if(x<=Time::FORMAT_VIDEO)
+       if (x <= Time::FORMAT_VIDEO)
                timestamp_optionmenu.set_history(0);
+       else if (x == (Time::FORMAT_NORMAL))
+               timestamp_optionmenu.set_history(1);
+       else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES))
+               timestamp_optionmenu.set_history(2);
+       else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_FULL))
+               timestamp_optionmenu.set_history(3);
+       else if (x == (Time::FORMAT_NORMAL | Time::FORMAT_NOSPACES | Time::FORMAT_FULL))
+               timestamp_optionmenu.set_history(4);
+       else if (x == (Time::FORMAT_FRAMES))
+               timestamp_optionmenu.set_history(5);
        else
-       {
-               if(x==(Time::FORMAT_NOSPACES|Time::FORMAT_FULL))
-                       timestamp_optionmenu.set_history(4);
-               else if(x==(Time::FORMAT_FULL))
-                       timestamp_optionmenu.set_history(3);
-               else if(x==(Time::FORMAT_NOSPACES))
-                       timestamp_optionmenu.set_history(2);
-               else
-                       timestamp_optionmenu.set_history(1);
-       }
+               timestamp_optionmenu.set_history(1);
 }