Added copyright lines for files I've edited this year.
[synfig.git] / synfig-studio / trunk / src / gtkmm / dialog_setup.cpp
index 7a8a6f0..27c018a 100644 (file)
@@ -2,10 +2,11 @@
 /*!    \file dialog_setup.cpp
 **     \brief Template File
 **
-**     $Id: dialog_setup.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
+**     $Id$
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007, 2008 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
 #include <gtkmm/notebook.h>
 #include <gtkmm/spinbutton.h>
 #include "widget_enum.h"
+#include "autorecover.h"
 
 #include <ETL/stringf>
 #include <ETL/misc>
+#include "general.h"
+
 #endif
 
 /* === U S I N G =========================================================== */
@@ -58,13 +62,15 @@ using namespace studio;
 /* === M E T H O D S ======================================================= */
 
 Dialog_Setup::Dialog_Setup():
-       Dialog(_("SYNFIG Studio Setup"),false,true),
+       Dialog(_("Synfig Studio Setup"),false,true),
        adj_gamma_r(2.2,0.1,3.0,0.025,0.025,0.025),
        adj_gamma_g(2.2,0.1,3.0,0.025,0.025,0.025),
        adj_gamma_b(2.2,0.1,3.0,0.025,0.025,0.025),
        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"))
+       toggle_use_colorspace_gamma(_("Visually Linear Color Selection")),
+       toggle_single_threaded(_("Use Only a Single Thread")),
+       toggle_restrict_radius_ducks(_("Restrict Real-Valued Ducks to Top Right Quadrant"))
 {
        // Setup the buttons
 
@@ -179,6 +185,16 @@ Dialog_Setup::Dialog_Setup():
        // 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 - single_threaded
+       misc_table->attach(toggle_single_threaded, 0, 2, 4, 5, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
+
+       // 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);
+
+       // 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);
+
        show_all_children();
 }
 
@@ -206,8 +222,17 @@ Dialog_Setup::on_apply_pressed()
        // Set the use_colorspace_gamma flag
        App::use_colorspace_gamma=toggle_use_colorspace_gamma.get_active();
 
+       // Set the single_threaded flag
+       App::single_threaded=toggle_single_threaded.get_active();
+
+       // Set the auto backup interval
+       App::auto_recover->set_timeout(auto_backup_interval.get_value() * 1000);
+
        App::distance_system=Distance::System(widget_enum->get_value());
 
+       // Set the restrict_radius_ducks flag
+       App::restrict_radius_ducks=toggle_restrict_radius_ducks.get_active();
+
        App::save_settings();
 }
 
@@ -255,18 +280,20 @@ Dialog_Setup::on_red_blue_level_change()
 void
 Dialog_Setup::refresh()
 {
+       // Refresh the temporary gamma; do this before adjusting the sliders,
+       // or variables will be used before their initialization.
+       gamma_pattern.set_gamma_r(App::gamma.get_gamma_r());
+       gamma_pattern.set_gamma_g(App::gamma.get_gamma_g());
+       gamma_pattern.set_gamma_b(App::gamma.get_gamma_b());
+       gamma_pattern.set_black_level(App::gamma.get_black_level());
+       gamma_pattern.set_red_blue_level(App::gamma.get_red_blue_level());
+
        adj_gamma_r.set_value(1.0/App::gamma.get_gamma_r());
        adj_gamma_g.set_value(1.0/App::gamma.get_gamma_g());
        adj_gamma_b.set_value(1.0/App::gamma.get_gamma_b());
        black_level_selector.set_value(App::gamma.get_black_level());
        red_blue_level_selector.set_value(App::gamma.get_red_blue_level());
 
-       // Refresh the temporary gamma
-       gamma_pattern.set_gamma_r(1.0/adj_gamma_r.get_value());
-       gamma_pattern.set_gamma_g(1.0/adj_gamma_g.get_value());
-       gamma_pattern.set_gamma_b(1.0/adj_gamma_b.get_value());
-       gamma_pattern.set_black_level(black_level_selector.get_value());
-       gamma_pattern.set_red_blue_level(red_blue_level_selector.get_value());
        gamma_pattern.refresh();
 
        adj_recent_files.set_value(App::get_max_recent_files());
@@ -279,6 +306,14 @@ Dialog_Setup::refresh()
        // Refresh the status of the use_colorspace_gamma flag
        toggle_use_colorspace_gamma.set_active(App::use_colorspace_gamma);
 
+       // Refresh the status of the single_threaded flag
+       toggle_single_threaded.set_active(App::single_threaded);
+
+       // 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);
 }
 
 GammaPattern::GammaPattern():
@@ -337,7 +372,7 @@ GammaPattern::refresh()
 }
 
 bool
-GammaPattern::redraw(GdkEventExpose*bleh)
+GammaPattern::redraw(GdkEventExpose */*bleh*/)
 {
        static const char hlines[] = { 3, 0 };
 
@@ -410,7 +445,7 @@ BlackLevelSelector::~BlackLevelSelector()
 }
 
 bool
-BlackLevelSelector::redraw(GdkEventExpose*bleh)
+BlackLevelSelector::redraw(GdkEventExpose */*bleh*/)
 {
        const int w(get_width()),h(get_height());
 
@@ -487,7 +522,7 @@ BlackLevelSelector::on_event(GdkEvent *event)
 
 
 void
-Dialog_Setup::set_time_format(Time::Format x)
+Dialog_Setup::set_time_format(synfig::Time::Format x)
 {
        time_format=x;
        if(x<=Time::FORMAT_VIDEO)
@@ -535,7 +570,7 @@ RedBlueLevelSelector::~RedBlueLevelSelector()
 }
 
 bool
-RedBlueLevelSelector::redraw(GdkEventExpose*bleh)
+RedBlueLevelSelector::redraw(GdkEventExpose */*bleh*/)
 {
        const int w(get_width()),h(get_height());