Fix bug: Change default bline width spin button without first focus a canvas window...
[synfig.git] / synfig-studio / src / gui / app.cpp
index 076b49e..1cb0819 100644 (file)
@@ -500,7 +500,7 @@ public:
        {
                try
                {
-                       SETTINGS_LOCALE_SAFE_AND_BACKUP
+                       synfig::ChangeLocale change_locale(LC_NUMERIC, "C");
                        if(key=="gamma")
                        {
                                value=strprintf("%f %f %f %f",
@@ -588,7 +588,6 @@ public:
                                value=strprintf("%s",App::predefined_fps.c_str());
                                return true;
                        }
-                       SETTINGS_LOCALE_RESTORE
                }
                catch(...)
                {
@@ -601,7 +600,7 @@ public:
        {
                try
                {
-                       SETTINGS_LOCALE_SAFE_AND_BACKUP
+                       synfig::ChangeLocale change_locale(LC_NUMERIC, "C");
                        if(key=="gamma")
                        {
                                float r,g,b,blk;
@@ -704,7 +703,6 @@ public:
                                App::predefined_fps=value;
                                return true;
                        }
-                       SETTINGS_LOCALE_RESTORE
                }
                catch(...)
                {
@@ -1324,6 +1322,13 @@ App::App(int *argc, char ***argv):
                studio_init_cb.task(_("Loading Settings..."));
                load_settings();
                device_tracker->load_preferences();
+               // If the default bline width is modified before focus a canvas
+               // window, the Distance widget doesn't understand the given value
+               // and produces this message:
+               // Distance::ident_system(): Unknown distance system ".00pt"
+               // setting the default bline width to 1 unit.
+               // This line fixes that.
+               synfigapp::Main::set_bline_width(synfigapp::Main::get_selected_input_device()->get_bline_width());
 
                studio_init_cb.task(_("Checking auto-recover..."));
 
@@ -1618,7 +1623,7 @@ App::save_settings()
 {
        try
        {
-               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               synfig::ChangeLocale change_locale(LC_NUMERIC, "C");
                {
                        std::string filename=get_config_file("accelrc");
                        Gtk::AccelMap::save(filename);
@@ -1658,7 +1663,7 @@ App::save_settings()
                }while(0);
                std::string filename=get_config_file("settings");
                synfigapp::Main::settings().save_to_file(filename);
-               SETTINGS_LOCALE_RESTORE
+
        }
        catch(...)
        {
@@ -1671,7 +1676,7 @@ App::load_settings()
 {
        try
        {
-               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               synfig::ChangeLocale change_locale(LC_NUMERIC, "C");
                {
                        std::string filename=get_config_file("accelrc");
                        Gtk::AccelMap::load(filename);
@@ -1727,7 +1732,7 @@ App::load_settings()
                                reset_initial_window_configuration();
                        }
                }
-       SETTINGS_LOCALE_RESTORE
+
        }
        catch(...)
        {