Fix Bug: Saved settings should be locale independent - ID: 3111032
authorCarlos Lopez <genetita@gmail.com>
Sat, 27 Nov 2010 10:50:55 +0000 (11:50 +0100)
committerCarlos Lopez <genetita@gmail.com>
Sat, 27 Nov 2010 10:50:55 +0000 (11:50 +0100)
15 files changed:
synfig-studio/src/gui/app.cpp
synfig-studio/src/gui/states/state_bline.cpp
synfig-studio/src/gui/states/state_circle.cpp
synfig-studio/src/gui/states/state_draw.cpp
synfig-studio/src/gui/states/state_gradient.cpp
synfig-studio/src/gui/states/state_polygon.cpp
synfig-studio/src/gui/states/state_rectangle.cpp
synfig-studio/src/gui/states/state_rotate.cpp
synfig-studio/src/gui/states/state_scale.cpp
synfig-studio/src/gui/states/state_smoothmove.cpp
synfig-studio/src/gui/states/state_star.cpp
synfig-studio/src/gui/states/state_text.cpp
synfig-studio/src/gui/states/state_width.cpp
synfig-studio/src/synfigapp/inputdevice.cpp
synfig-studio/src/synfigapp/settings.h

index 19b287c..076b49e 100644 (file)
@@ -498,202 +498,218 @@ class Preferences : public synfigapp::Settings
 public:
        virtual bool get_value(const synfig::String& key, synfig::String& value)const
        {
-               if(key=="gamma")
+               try
                {
-                       value=strprintf("%f %f %f %f",
-                               App::gamma.get_gamma_r(),
-                               App::gamma.get_gamma_g(),
-                               App::gamma.get_gamma_b(),
-                               App::gamma.get_black_level()
-                       );
-                       return true;
-               }
-               if(key=="time_format")
-               {
-                       value=strprintf("%i",App::get_time_format());
-                       return true;
-               }
-               if(key=="file_history.size")
-               {
-                       value=strprintf("%i",App::get_max_recent_files());
-                       return true;
-               }
-               if(key=="use_colorspace_gamma")
-               {
-                       value=strprintf("%i",(int)App::use_colorspace_gamma);
-                       return true;
-               }
-               if(key=="distance_system")
-               {
-                       value=strprintf("%s",Distance::system_name(App::distance_system).c_str());
-                       return true;
-               }
+                       SETTINGS_LOCALE_SAFE_AND_BACKUP
+                       if(key=="gamma")
+                       {
+                               value=strprintf("%f %f %f %f",
+                                       App::gamma.get_gamma_r(),
+                                       App::gamma.get_gamma_g(),
+                                       App::gamma.get_gamma_b(),
+                                       App::gamma.get_black_level()
+                               );
+                               return true;
+                       }
+                       if(key=="time_format")
+                       {
+                               value=strprintf("%i",App::get_time_format());
+                               return true;
+                       }
+                       if(key=="file_history.size")
+                       {
+                               value=strprintf("%i",App::get_max_recent_files());
+                               return true;
+                       }
+                       if(key=="use_colorspace_gamma")
+                       {
+                               value=strprintf("%i",(int)App::use_colorspace_gamma);
+                               return true;
+                       }
+                       if(key=="distance_system")
+                       {
+                               value=strprintf("%s",Distance::system_name(App::distance_system).c_str());
+                               return true;
+                       }
 #ifdef SINGLE_THREADED
-               if(key=="single_threaded")
-               {
-                       value=strprintf("%i",(int)App::single_threaded);
-                       return true;
-               }
+                       if(key=="single_threaded")
+                       {
+                               value=strprintf("%i",(int)App::single_threaded);
+                               return true;
+                       }
 #endif
-               if(key=="auto_recover_backup_interval")
-               {
-                       value=strprintf("%i",App::auto_recover->get_timeout());
-                       return true;
-               }
-               if(key=="restrict_radius_ducks")
-               {
-                       value=strprintf("%i",(int)App::restrict_radius_ducks);
-                       return true;
-               }
-               if(key=="resize_imported_images")
-               {
-                       value=strprintf("%i",(int)App::resize_imported_images);
-                       return true;
-               }
-               if(key=="browser_command")
-               {
-                       value=App::browser_command;
-                       return true;
-               }
-               if(key=="custom_filename_prefix")
-               {
-                       value=App::custom_filename_prefix;
-                       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;
-               }
-               if(key=="predefined_size")
-               {
-                       value=strprintf("%s",App::predefined_size.c_str());
-                       return true;
-               }
-               if(key=="preferred_fps")
-               {
-                       value=strprintf("%f",App::preferred_fps);
-                       return true;
+                       if(key=="auto_recover_backup_interval")
+                       {
+                               value=strprintf("%i",App::auto_recover->get_timeout());
+                               return true;
+                       }
+                       if(key=="restrict_radius_ducks")
+                       {
+                               value=strprintf("%i",(int)App::restrict_radius_ducks);
+                               return true;
+                       }
+                       if(key=="resize_imported_images")
+                       {
+                               value=strprintf("%i",(int)App::resize_imported_images);
+                               return true;
+                       }
+                       if(key=="browser_command")
+                       {
+                               value=App::browser_command;
+                               return true;
+                       }
+                       if(key=="custom_filename_prefix")
+                       {
+                               value=App::custom_filename_prefix;
+                               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;
+                       }
+                       if(key=="predefined_size")
+                       {
+                               value=strprintf("%s",App::predefined_size.c_str());
+                               return true;
+                       }
+                       if(key=="preferred_fps")
+                       {
+                               value=strprintf("%f",App::preferred_fps);
+                               return true;
+                       }
+                       if(key=="predefined_fps")
+                       {
+                               value=strprintf("%s",App::predefined_fps.c_str());
+                               return true;
+                       }
+                       SETTINGS_LOCALE_RESTORE
                }
-               if(key=="predefined_fps")
+               catch(...)
                {
-                       value=strprintf("%s",App::predefined_fps.c_str());
-                       return true;
+                       synfig::warning("Preferences: Caught exception when attempting to get value.");
                }
-
                return synfigapp::Settings::get_value(key,value);
        }
 
        virtual bool set_value(const synfig::String& key,const synfig::String& value)
        {
-               if(key=="gamma")
+               try
                {
-                       float r,g,b,blk;
+                       SETTINGS_LOCALE_SAFE_AND_BACKUP
+                       if(key=="gamma")
+                       {
+                               float r,g,b,blk;
 
-                       strscanf(value,"%f %f %f %f",
-                               &r,
-                               &g,
-                               &b,
-                               &blk
-                       );
+                               strscanf(value,"%f %f %f %f",
+                                       &r,
+                                       &g,
+                                       &b,
+                                       &blk
+                               );
 
-                       App::gamma.set_all(r,g,b,blk);
+                               App::gamma.set_all(r,g,b,blk);
 
-                       return true;
-               }
-               if(key=="time_format")
-               {
-                       int i(atoi(value.c_str()));
-                       App::set_time_format(static_cast<synfig::Time::Format>(i));
-                       return true;
-               }
-               if(key=="auto_recover_backup_interval")
-               {
-                       int i(atoi(value.c_str()));
-                       App::auto_recover->set_timeout(i);
-                       return true;
-               }
-               if(key=="file_history.size")
-               {
-                       int i(atoi(value.c_str()));
-                       App::set_max_recent_files(i);
-                       return true;
-               }
-               if(key=="use_colorspace_gamma")
-               {
-                       int i(atoi(value.c_str()));
-                       App::use_colorspace_gamma=i;
-                       return true;
-               }
-               if(key=="distance_system")
-               {
-                       App::distance_system=Distance::ident_system(value);;
-                       return true;
-               }
+                               return true;
+                       }
+                       if(key=="time_format")
+                       {
+                               int i(atoi(value.c_str()));
+                               App::set_time_format(static_cast<synfig::Time::Format>(i));
+                               return true;
+                       }
+                       if(key=="auto_recover_backup_interval")
+                       {
+                               int i(atoi(value.c_str()));
+                               App::auto_recover->set_timeout(i);
+                               return true;
+                       }
+                       if(key=="file_history.size")
+                       {
+                               int i(atoi(value.c_str()));
+                               App::set_max_recent_files(i);
+                               return true;
+                       }
+                       if(key=="use_colorspace_gamma")
+                       {
+                               int i(atoi(value.c_str()));
+                               App::use_colorspace_gamma=i;
+                               return true;
+                       }
+                       if(key=="distance_system")
+                       {
+                               App::distance_system=Distance::ident_system(value);;
+                               return true;
+                       }
 #ifdef SINGLE_THREADED
-               if(key=="single_threaded")
-               {
-                       int i(atoi(value.c_str()));
-                       App::single_threaded=i;
-                       return true;
-               }
+                       if(key=="single_threaded")
+                       {
+                               int i(atoi(value.c_str()));
+                               App::single_threaded=i;
+                               return true;
+                       }
 #endif
-               if(key=="restrict_radius_ducks")
-               {
-                       int i(atoi(value.c_str()));
-                       App::restrict_radius_ducks=i;
-                       return true;
-               }
-               if(key=="resize_imported_images")
-               {
-                       int i(atoi(value.c_str()));
-                       App::resize_imported_images=i;
-                       return true;
-               }
-               if(key=="browser_command")
-               {
-                       App::browser_command=value;
-                       return true;
-               }
-               if(key=="custom_filename_prefix")
-               {
-                       App::custom_filename_prefix=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;
-               }
-               if(key=="predefined_size")
-               {
-                       App::predefined_size=value;
-                       return true;
-               }
-               if(key=="preferred_fps")
-               {
-                       float i(atof(value.c_str()));
-                       App::preferred_fps=i;
-                       return true;
+                       if(key=="restrict_radius_ducks")
+                       {
+                               int i(atoi(value.c_str()));
+                               App::restrict_radius_ducks=i;
+                               return true;
+                       }
+                       if(key=="resize_imported_images")
+                       {
+                               int i(atoi(value.c_str()));
+                               App::resize_imported_images=i;
+                               return true;
+                       }
+                       if(key=="browser_command")
+                       {
+                               App::browser_command=value;
+                               return true;
+                       }
+                       if(key=="custom_filename_prefix")
+                       {
+                               App::custom_filename_prefix=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;
+                       }
+                       if(key=="predefined_size")
+                       {
+                               App::predefined_size=value;
+                               return true;
+                       }
+                       if(key=="preferred_fps")
+                       {
+                               float i(atof(value.c_str()));
+                               App::preferred_fps=i;
+                               return true;
+                       }
+                       if(key=="predefined_fps")
+                       {
+                               App::predefined_fps=value;
+                               return true;
+                       }
+                       SETTINGS_LOCALE_RESTORE
                }
-               if(key=="predefined_fps")
+               catch(...)
                {
-                       App::predefined_fps=value;
-                       return true;
+                       synfig::warning("Preferences: Caught exception when attempting to set value.");
                }
-
                return synfigapp::Settings::set_value(key,value);
        }
 
@@ -1600,11 +1616,9 @@ App::set_time_format(synfig::Time::Format x)
 void
 App::save_settings()
 {
-       char * old_locale;
        try
        {
-       old_locale=strdup(setlocale(LC_NUMERIC, NULL));
-       setlocale(LC_NUMERIC, "C");
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
                {
                        std::string filename=get_config_file("accelrc");
                        Gtk::AccelMap::save(filename);
@@ -1644,7 +1658,7 @@ App::save_settings()
                }while(0);
                std::string filename=get_config_file("settings");
                synfigapp::Main::settings().save_to_file(filename);
-       setlocale(LC_NUMERIC,old_locale);
+               SETTINGS_LOCALE_RESTORE
        }
        catch(...)
        {
@@ -1655,11 +1669,9 @@ App::save_settings()
 void
 App::load_settings()
 {
-       char  * old_locale;
        try
        {
-       old_locale=strdup(setlocale(LC_NUMERIC, NULL));
-       setlocale(LC_NUMERIC, "C");
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
                {
                        std::string filename=get_config_file("accelrc");
                        Gtk::AccelMap::load(filename);
@@ -1715,7 +1727,7 @@ App::load_settings()
                                reset_initial_window_configuration();
                        }
                }
-       setlocale(LC_NUMERIC,old_locale);
+       SETTINGS_LOCALE_RESTORE
        }
        catch(...)
        {
index d020374..9d0a10c 100644 (file)
@@ -236,64 +236,82 @@ StateBLine::~StateBLine()
 void
 StateBLine_Context::load_settings()
 {
-       String value;
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
 
-       if(settings.get_value("bline.layer_region",value) && value=="0")
-               set_layer_region_flag(false);
-       else
-               set_layer_region_flag(true);
+               if(settings.get_value("bline.layer_region",value) && value=="0")
+                       set_layer_region_flag(false);
+               else
+                       set_layer_region_flag(true);
 
-       if(settings.get_value("bline.layer_outline",value) && value=="0")
-               set_layer_outline_flag(false);
-       else
-               set_layer_outline_flag(true);
+               if(settings.get_value("bline.layer_outline",value) && value=="0")
+                       set_layer_outline_flag(false);
+               else
+                       set_layer_outline_flag(true);
 
-       if(settings.get_value("bline.layer_curve_gradient",value) && value=="1")
-               set_layer_curve_gradient_flag(true);
-       else
-               set_layer_curve_gradient_flag(false);
+               if(settings.get_value("bline.layer_curve_gradient",value) && value=="1")
+                       set_layer_curve_gradient_flag(true);
+               else
+                       set_layer_curve_gradient_flag(false);
 
-       if(settings.get_value("bline.layer_plant",value) && value=="1")
-               set_layer_plant_flag(true);
-       else
-               set_layer_plant_flag(false);
+               if(settings.get_value("bline.layer_plant",value) && value=="1")
+                       set_layer_plant_flag(true);
+               else
+                       set_layer_plant_flag(false);
 
-       if(settings.get_value("bline.layer_link_origins",value) && value=="0")
-               set_layer_link_origins_flag(false);
-       else
-               set_layer_link_origins_flag(true);
+               if(settings.get_value("bline.layer_link_origins",value) && value=="0")
+                       set_layer_link_origins_flag(false);
+               else
+                       set_layer_link_origins_flag(true);
 
-       if(settings.get_value("bline.auto_export",value) && value=="1")
-               set_auto_export_flag(true);
-       else
-               set_auto_export_flag(false);
+               if(settings.get_value("bline.auto_export",value) && value=="1")
+                       set_auto_export_flag(true);
+               else
+                       set_auto_export_flag(false);
 
-       if(settings.get_value("bline.id",value))
-               set_id(value);
-       else
-               set_id("NewBLine");
+               if(settings.get_value("bline.id",value))
+                       set_id(value);
+               else
+                       set_id("NewBLine");
 
-       if(settings.get_value("bline.feather",value))
+               if(settings.get_value("bline.feather",value))
+               {
+                       Real n = atof(value.c_str());
+                       set_feather(n);
+               }
+
+               sanity_check();
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
        {
-               Real n = atof(value.c_str());
-               set_feather(n);
+               synfig::warning("State BLine: Caught exception when attempting to load settings.");
        }
-
-       sanity_check();
 }
 
 void
 StateBLine_Context::save_settings()
 {
-       sanity_check();
-       settings.set_value("bline.layer_outline",get_layer_outline_flag()?"1":"0");
-       settings.set_value("bline.layer_region",get_layer_region_flag()?"1":"0");
-       settings.set_value("bline.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
-       settings.set_value("bline.layer_plant",get_layer_plant_flag()?"1":"0");
-       settings.set_value("bline.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
-       settings.set_value("bline.auto_export",get_auto_export_flag()?"1":"0");
-       settings.set_value("bline.id",get_id().c_str());
-       settings.set_value("bline.feather",strprintf("%f",get_feather()));
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               sanity_check();
+               settings.set_value("bline.layer_outline",get_layer_outline_flag()?"1":"0");
+               settings.set_value("bline.layer_region",get_layer_region_flag()?"1":"0");
+               settings.set_value("bline.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
+               settings.set_value("bline.layer_plant",get_layer_plant_flag()?"1":"0");
+               settings.set_value("bline.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
+               settings.set_value("bline.auto_export",get_auto_export_flag()?"1":"0");
+               settings.set_value("bline.id",get_id().c_str());
+               settings.set_value("bline.feather",strprintf("%f",get_feather()));
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State BLine : Caught exception when attempting to save settings.");
+       }
 }
 
 void
index af83784..ff9e2ca 100644 (file)
@@ -239,101 +239,119 @@ StateCircle::~StateCircle()
 void
 StateCircle_Context::load_settings()
 {
-       String value;
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
 
-       //parse the arguments yargh!
-       if(settings.get_value("circle.id",value))
-               set_id(value);
-       else
-               set_id("Circle");
+               //parse the arguments yargh!
+               if(settings.get_value("circle.id",value))
+                       set_id(value);
+               else
+                       set_id("Circle");
 
-       if(settings.get_value("circle.fallofftype",value) && value != "")
-               set_falloff(atoi(value.c_str()));
-       else
-               set_falloff(2);
+               if(settings.get_value("circle.fallofftype",value) && value != "")
+                       set_falloff(atoi(value.c_str()));
+               else
+                       set_falloff(2);
 
-#ifdef BLEND_METHOD_IN_TOOL_OPTIONS
-       if(settings.get_value("circle.blend",value) && value != "")
-               set_blend(atoi(value.c_str()));
-       else
-               set_blend(0);//(int)Color::BLEND_COMPOSITE); //0 should be blend composites value
-#endif // BLEND_METHOD_IN_TOOL_OPTIONS
+       #ifdef BLEND_METHOD_IN_TOOL_OPTIONS
+               if(settings.get_value("circle.blend",value) && value != "")
+                       set_blend(atoi(value.c_str()));
+               else
+                       set_blend(0);//(int)Color::BLEND_COMPOSITE); //0 should be blend composites value
+       #endif  // BLEND_METHOD_IN_TOOL_OPTIONS
 
-       if(settings.get_value("circle.feather",value))
-               set_feather(atof(value.c_str()));
-       else
-               set_feather(0);
+               if(settings.get_value("circle.feather",value))
+                       set_feather(atof(value.c_str()));
+               else
+                       set_feather(0);
 
-       if(settings.get_value("circle.number_of_bline_points",value))
-               set_number_of_bline_points(atof(value.c_str()));
-       else
-               set_number_of_bline_points(4);
+               if(settings.get_value("circle.number_of_bline_points",value))
+                       set_number_of_bline_points(atof(value.c_str()));
+               else
+                       set_number_of_bline_points(4);
 
-       if(settings.get_value("circle.bline_point_angle_offset",value))
-               set_bline_point_angle_offset(atof(value.c_str()));
-       else
-               set_bline_point_angle_offset(0);
+               if(settings.get_value("circle.bline_point_angle_offset",value))
+                       set_bline_point_angle_offset(atof(value.c_str()));
+               else
+                       set_bline_point_angle_offset(0);
 
-       if(settings.get_value("circle.invert",value) && value != "0")
-               set_invert(true);
-       else
-               set_invert(false);
+               if(settings.get_value("circle.invert",value) && value != "0")
+                       set_invert(true);
+               else
+                       set_invert(false);
 
-       if(settings.get_value("circle.layer_circle",value) && value=="0")
-               set_layer_circle_flag(false);
-       else
-               set_layer_circle_flag(true);
+               if(settings.get_value("circle.layer_circle",value) && value=="0")
+                       set_layer_circle_flag(false);
+               else
+                       set_layer_circle_flag(true);
 
-       if(settings.get_value("circle.layer_region",value) && value=="1")
-               set_layer_region_flag(true);
-       else
-               set_layer_region_flag(false);
+               if(settings.get_value("circle.layer_region",value) && value=="1")
+                       set_layer_region_flag(true);
+               else
+                       set_layer_region_flag(false);
 
-       if(settings.get_value("circle.layer_outline",value) && value=="1")
-               set_layer_outline_flag(true);
-       else
-               set_layer_outline_flag(false);
+               if(settings.get_value("circle.layer_outline",value) && value=="1")
+                       set_layer_outline_flag(true);
+               else
+                       set_layer_outline_flag(false);
 
-       if(settings.get_value("circle.layer_curve_gradient",value) && value=="1")
-               set_layer_curve_gradient_flag(true);
-       else
-               set_layer_curve_gradient_flag(false);
+               if(settings.get_value("circle.layer_curve_gradient",value) && value=="1")
+                       set_layer_curve_gradient_flag(true);
+               else
+                       set_layer_curve_gradient_flag(false);
 
-       if(settings.get_value("circle.layer_plant",value) && value=="1")
-               set_layer_plant_flag(true);
-       else
-               set_layer_plant_flag(false);
+               if(settings.get_value("circle.layer_plant",value) && value=="1")
+                       set_layer_plant_flag(true);
+               else
+                       set_layer_plant_flag(false);
 
-       if(settings.get_value("circle.layer_link_origins",value) && value=="0")
-               set_layer_link_origins_flag(false);
-       else
-               set_layer_link_origins_flag(true);
+               if(settings.get_value("circle.layer_link_origins",value) && value=="0")
+                       set_layer_link_origins_flag(false);
+               else
+                       set_layer_link_origins_flag(true);
 
-       if(settings.get_value("circle.layer_origins_at_center",value) && value=="0")
-               set_layer_origins_at_center_flag(false);
-       else
-               set_layer_origins_at_center_flag(true);
+               if(settings.get_value("circle.layer_origins_at_center",value) && value=="0")
+                       set_layer_origins_at_center_flag(false);
+               else
+                       set_layer_origins_at_center_flag(true);
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Circle: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateCircle_Context::save_settings()
 {
-       settings.set_value("circle.id",get_id());
-       settings.set_value("circle.fallofftype",strprintf("%d",get_falloff()));
-#ifdef BLEND_METHOD_IN_TOOL_OPTIONS
-       settings.set_value("circle.blend",strprintf("%d",get_blend()));
-#endif // BLEND_METHOD_IN_TOOL_OPTIONS
-       settings.set_value("circle.feather",strprintf("%f",(float)get_feather()));
-       settings.set_value("circle.number_of_bline_points",strprintf("%d",(int)(get_number_of_bline_points() + 0.5)));
-       settings.set_value("circle.bline_point_angle_offset",strprintf("%f",(float)get_bline_point_angle_offset()));
-       settings.set_value("circle.invert",get_invert()?"1":"0");
-       settings.set_value("circle.layer_circle",get_layer_circle_flag()?"1":"0");
-       settings.set_value("circle.layer_outline",get_layer_outline_flag()?"1":"0");
-       settings.set_value("circle.layer_region",get_layer_region_flag()?"1":"0");
-       settings.set_value("circle.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
-       settings.set_value("circle.layer_plant",get_layer_plant_flag()?"1":"0");
-       settings.set_value("circle.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
-       settings.set_value("circle.layer_origins_at_center",get_layer_origins_at_center_flag()?"1":"0");
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("circle.id",get_id());
+               settings.set_value("circle.fallofftype",strprintf("%d",get_falloff()));
+       #ifdef BLEND_METHOD_IN_TOOL_OPTIONS
+               settings.set_value("circle.blend",strprintf("%d",get_blend()));
+       #endif  // BLEND_METHOD_IN_TOOL_OPTIONS
+               settings.set_value("circle.feather",strprintf("%f",(float)get_feather()));
+               settings.set_value("circle.number_of_bline_points",strprintf("%d",(int)(get_number_of_bline_points() + 0.5)));
+               settings.set_value("circle.bline_point_angle_offset",strprintf("%f",(float)get_bline_point_angle_offset()));
+               settings.set_value("circle.invert",get_invert()?"1":"0");
+               settings.set_value("circle.layer_circle",get_layer_circle_flag()?"1":"0");
+               settings.set_value("circle.layer_outline",get_layer_outline_flag()?"1":"0");
+               settings.set_value("circle.layer_region",get_layer_region_flag()?"1":"0");
+               settings.set_value("circle.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
+               settings.set_value("circle.layer_plant",get_layer_plant_flag()?"1":"0");
+               settings.set_value("circle.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
+               settings.set_value("circle.layer_origins_at_center",get_layer_origins_at_center_flag()?"1":"0");
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Circle: Caught exception when attempting to save settings.");
+       }
 }
 
 void
index 8200c6b..0a3b101 100644 (file)
@@ -257,102 +257,120 @@ StateDraw::~StateDraw()
 void
 StateDraw_Context::load_settings()
 {
-       String value;
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
 
-       if(settings.get_value("draw.id",value))
-               set_id(value);
-       else
-               set_id("NewDrawing");
+               if(settings.get_value("draw.id",value))
+                       set_id(value);
+               else
+                       set_id("NewDrawing");
 
-       if(settings.get_value("draw.pressure_width",value) && value=="0")
-               set_pressure_width_flag(false);
-       else
-               set_pressure_width_flag(true);
+               if(settings.get_value("draw.pressure_width",value) && value=="0")
+                       set_pressure_width_flag(false);
+               else
+                       set_pressure_width_flag(true);
 
-       if(settings.get_value("draw.auto_loop",value) && value=="0")
-               set_auto_loop_flag(false);
-       else
-               set_auto_loop_flag(true);
+               if(settings.get_value("draw.auto_loop",value) && value=="0")
+                       set_auto_loop_flag(false);
+               else
+                       set_auto_loop_flag(true);
 
-       if(settings.get_value("draw.auto_extend",value) && value=="0")
-               set_auto_extend_flag(false);
-       else
-               set_auto_extend_flag(true);
+               if(settings.get_value("draw.auto_extend",value) && value=="0")
+                       set_auto_extend_flag(false);
+               else
+                       set_auto_extend_flag(true);
 
-       if(settings.get_value("draw.auto_link",value) && value=="0")
-               set_auto_link_flag(false);
-       else
-               set_auto_link_flag(true);
+               if(settings.get_value("draw.auto_link",value) && value=="0")
+                       set_auto_link_flag(false);
+               else
+                       set_auto_link_flag(true);
 
-       if(settings.get_value("draw.region",value) && value=="0")
-               set_region_flag(false);
-       else
-               set_region_flag(true);
+               if(settings.get_value("draw.region",value) && value=="0")
+                       set_region_flag(false);
+               else
+                       set_region_flag(true);
 
-       if(settings.get_value("draw.outline",value) && value=="0")
-               set_outline_flag(false);
-       else
-               set_outline_flag(true);
+               if(settings.get_value("draw.outline",value) && value=="0")
+                       set_outline_flag(false);
+               else
+                       set_outline_flag(true);
 
-       if(settings.get_value("draw.auto_export",value) && value=="1")
-               set_auto_export_flag(true);
-       else
-               set_auto_export_flag(false);
+               if(settings.get_value("draw.auto_export",value) && value=="1")
+                       set_auto_export_flag(true);
+               else
+                       set_auto_export_flag(false);
 
-       if(settings.get_value("draw.min_pressure_on",value) && value=="0")
-               set_min_pressure_flag(false);
-       else
-               set_min_pressure_flag(true);
+               if(settings.get_value("draw.min_pressure_on",value) && value=="0")
+                       set_min_pressure_flag(false);
+               else
+                       set_min_pressure_flag(true);
 
-       if(settings.get_value("draw.min_pressure",value))
-       {
-               Real n = atof(value.c_str());
-               set_min_pressure(n);
-       }else
-               set_min_pressure(0);
+               if(settings.get_value("draw.min_pressure",value))
+               {
+                       Real n = atof(value.c_str());
+                       set_min_pressure(n);
+               }else
+                       set_min_pressure(0);
 
-       if(settings.get_value("draw.feather",value))
-       {
-               Real n = atof(value.c_str());
-               set_feather(n);
-       }else
-               set_feather(0);
+               if(settings.get_value("draw.feather",value))
+               {
+                       Real n = atof(value.c_str());
+                       set_feather(n);
+               }else
+                       set_feather(0);
 
-       if(settings.get_value("draw.gthreshold",value))
-       {
-               Real n = atof(value.c_str());
-               set_gthres(n);
-       }
+               if(settings.get_value("draw.gthreshold",value))
+               {
+                       Real n = atof(value.c_str());
+                       set_gthres(n);
+               }
+
+               if(settings.get_value("draw.lthreshold",value))
+               {
+                       Real n = atof(value.c_str());
+                       set_lthres(n);
+               }
 
-       if(settings.get_value("draw.lthreshold",value))
+               if(settings.get_value("draw.localize",value) && value == "1")
+                       set_local_error_flag(true);
+               else
+                       set_local_error_flag(false);
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
        {
-               Real n = atof(value.c_str());
-               set_lthres(n);
+               synfig::warning("State Draw: Caught exception when attempting to load settings.");
        }
-
-       if(settings.get_value("draw.localize",value) && value == "1")
-               set_local_error_flag(true);
-       else
-               set_local_error_flag(false);
 }
 
 void
 StateDraw_Context::save_settings()
 {
-       settings.set_value("draw.id",get_id().c_str());
-       settings.set_value("draw.pressure_width",get_pressure_width_flag()?"1":"0");
-       settings.set_value("draw.auto_loop",get_auto_loop_flag()?"1":"0");
-       settings.set_value("draw.auto_extend",get_auto_extend_flag()?"1":"0");
-       settings.set_value("draw.auto_link",get_auto_link_flag()?"1":"0");
-       settings.set_value("draw.region",get_region_flag()?"1":"0");
-       settings.set_value("draw.outline",get_outline_flag()?"1":"0");
-       settings.set_value("draw.auto_export",get_auto_export_flag()?"1":"0");
-       settings.set_value("draw.min_pressure",strprintf("%f",get_min_pressure()));
-       settings.set_value("draw.feather",strprintf("%f",get_feather()));
-       settings.set_value("draw.min_pressure_on",get_min_pressure_flag()?"1":"0");
-       settings.set_value("draw.gthreshold",strprintf("%f",get_gthres()));
-       settings.set_value("draw.lthreshold",strprintf("%f",get_lthres()));
-       settings.set_value("draw.localize",get_local_error_flag()?"1":"0");
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("draw.id",get_id().c_str());
+               settings.set_value("draw.pressure_width",get_pressure_width_flag()?"1":"0");
+               settings.set_value("draw.auto_loop",get_auto_loop_flag()?"1":"0");
+               settings.set_value("draw.auto_extend",get_auto_extend_flag()?"1":"0");
+               settings.set_value("draw.auto_link",get_auto_link_flag()?"1":"0");
+               settings.set_value("draw.region",get_region_flag()?"1":"0");
+               settings.set_value("draw.outline",get_outline_flag()?"1":"0");
+               settings.set_value("draw.auto_export",get_auto_export_flag()?"1":"0");
+               settings.set_value("draw.min_pressure",strprintf("%f",get_min_pressure()));
+               settings.set_value("draw.feather",strprintf("%f",get_feather()));
+               settings.set_value("draw.min_pressure_on",get_min_pressure_flag()?"1":"0");
+               settings.set_value("draw.gthreshold",strprintf("%f",get_gthres()));
+               settings.set_value("draw.lthreshold",strprintf("%f",get_lthres()));
+               settings.set_value("draw.localize",get_local_error_flag()?"1":"0");
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Draw: Caught exception when attempting to save settings.");
+       }
 }
 
 void
index 1e3d104..4b0250e 100644 (file)
@@ -174,34 +174,52 @@ StateGradient::~StateGradient()
 void
 StateGradient_Context::load_settings()
 {
-       String value;
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
 
-       if(settings.get_value("gradient.id",value))
-               set_id(value);
-       else
-               set_id("Gradient");
+               if(settings.get_value("gradient.id",value))
+                       set_id(value);
+               else
+                       set_id("Gradient");
 
-       if(settings.get_value("gradient.type",value))
-               set_type(atoi(value.c_str()));
-       else
-               set_type(GRADIENT_INTERPOLATION_LINEAR);
+               if(settings.get_value("gradient.type",value))
+                       set_type(atoi(value.c_str()));
+               else
+                       set_type(GRADIENT_INTERPOLATION_LINEAR);
 
 #ifdef BLEND_METHOD_IN_TOOL_OPTIONS
-       if(settings.get_value("gradient.blend",value))
-               set_blend(atoi(value.c_str()));
-       else
-               set_blend(Color::BLEND_COMPOSITE);
+               if(settings.get_value("gradient.blend",value))
+                       set_blend(atoi(value.c_str()));
+               else
+                       set_blend(Color::BLEND_COMPOSITE);
 #endif // BLEND_METHOD_IN_TOOL_OPTIONS
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Gradient: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateGradient_Context::save_settings()
 {
-       settings.set_value("gradient.id",get_id().c_str());
-       settings.set_value("gradient.type",strprintf("%d",get_type()));
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("gradient.id",get_id().c_str());
+               settings.set_value("gradient.type",strprintf("%d",get_type()));
 #ifdef BLEND_METHOD_IN_TOOL_OPTIONS
-       settings.set_value("gradient.blend",strprintf("%d",get_blend()));
+               settings.set_value("gradient.blend",strprintf("%d",get_blend()));
 #endif // BLEND_METHOD_IN_TOOL_OPTIONS
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Gradient: Caught exception when attempting to save settings.");
+       }
 }
 
 void
index f05a6de..b721e10 100644 (file)
@@ -199,67 +199,85 @@ StatePolygon::~StatePolygon()
 void
 StatePolygon_Context::load_settings()
 {
-       String value;
-
-       if(settings.get_value("polygon.id",value))
-               set_id(value);
-       else
-               set_id("Polygon");
-
-       if(settings.get_value("polygon.invert",value) && value != "0")
-               set_invert(true);
-       else
-               set_invert(false);
-
-       if(settings.get_value("polygon.layer_polygon",value) && value=="0")
-               set_layer_polygon_flag(false);
-       else
-               set_layer_polygon_flag(true);
-
-       if(settings.get_value("polygon.layer_region",value) && value=="1")
-               set_layer_region_flag(true);
-       else
-               set_layer_region_flag(false);
-
-       if(settings.get_value("polygon.layer_outline",value) && value=="1")
-               set_layer_outline_flag(true);
-       else
-               set_layer_outline_flag(false);
-
-       if(settings.get_value("polygon.layer_curve_gradient",value) && value=="1")
-               set_layer_curve_gradient_flag(true);
-       else
-               set_layer_curve_gradient_flag(false);
-
-       if(settings.get_value("polygon.layer_plant",value) && value=="1")
-               set_layer_plant_flag(true);
-       else
-               set_layer_plant_flag(false);
-
-       if(settings.get_value("polygon.layer_link_origins",value) && value=="0")
-               set_layer_link_origins_flag(false);
-       else
-               set_layer_link_origins_flag(true);
-
-       if(settings.get_value("polygon.feather",value))
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
+
+               if(settings.get_value("polygon.id",value))
+                       set_id(value);
+               else
+                       set_id("Polygon");
+
+               if(settings.get_value("polygon.invert",value) && value != "0")
+                       set_invert(true);
+               else
+                       set_invert(false);
+
+               if(settings.get_value("polygon.layer_polygon",value) && value=="0")
+                       set_layer_polygon_flag(false);
+               else
+                       set_layer_polygon_flag(true);
+
+               if(settings.get_value("polygon.layer_region",value) && value=="1")
+                       set_layer_region_flag(true);
+               else
+                       set_layer_region_flag(false);
+
+               if(settings.get_value("polygon.layer_outline",value) && value=="1")
+                       set_layer_outline_flag(true);
+               else
+                       set_layer_outline_flag(false);
+
+               if(settings.get_value("polygon.layer_curve_gradient",value) && value=="1")
+                       set_layer_curve_gradient_flag(true);
+               else
+                       set_layer_curve_gradient_flag(false);
+
+               if(settings.get_value("polygon.layer_plant",value) && value=="1")
+                       set_layer_plant_flag(true);
+               else
+                       set_layer_plant_flag(false);
+
+               if(settings.get_value("polygon.layer_link_origins",value) && value=="0")
+                       set_layer_link_origins_flag(false);
+               else
+                       set_layer_link_origins_flag(true);
+
+               if(settings.get_value("polygon.feather",value))
+               {
+                       Real n = atof(value.c_str());
+                       set_feather(n);
+               }
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
        {
-               Real n = atof(value.c_str());
-               set_feather(n);
+               synfig::warning("State Polygon: Caught exception when attempting to load settings.");
        }
 }
 
 void
 StatePolygon_Context::save_settings()
 {
-       settings.set_value("polygon.id",get_id().c_str());
-       settings.set_value("polygon.invert",get_invert()?"1":"0");
-       settings.set_value("polygon.layer_polygon",get_layer_polygon_flag()?"1":"0");
-       settings.set_value("polygon.layer_outline",get_layer_outline_flag()?"1":"0");
-       settings.set_value("polygon.layer_region",get_layer_region_flag()?"1":"0");
-       settings.set_value("polygon.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
-       settings.set_value("polygon.layer_plant",get_layer_plant_flag()?"1":"0");
-       settings.set_value("polygon.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
-       settings.set_value("polygon.feather",strprintf("%f",get_feather()));
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("polygon.id",get_id().c_str());
+               settings.set_value("polygon.invert",get_invert()?"1":"0");
+               settings.set_value("polygon.layer_polygon",get_layer_polygon_flag()?"1":"0");
+               settings.set_value("polygon.layer_outline",get_layer_outline_flag()?"1":"0");
+               settings.set_value("polygon.layer_region",get_layer_region_flag()?"1":"0");
+               settings.set_value("polygon.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
+               settings.set_value("polygon.layer_plant",get_layer_plant_flag()?"1":"0");
+               settings.set_value("polygon.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
+               settings.set_value("polygon.feather",strprintf("%f",get_feather()));
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Polygon: Caught exception when attempting to save settings.");
+       }
 }
 
 void
index 05f52c7..5858cc0 100644 (file)
@@ -207,73 +207,91 @@ StateRectangle::~StateRectangle()
 void
 StateRectangle_Context::load_settings()
 {
-       String value;
-
-       //parse the arguments yargh!
-       if(settings.get_value("rectangle.id",value))
-               set_id(value);
-       else
-               set_id("Rectangle");
-
-       if(settings.get_value("rectangle.expand",value))
-               set_expand(atof(value.c_str()));
-       else
-               set_expand(0);
-
-       if(settings.get_value("rectangle.feather",value))
-               set_feather(atof(value.c_str()));
-       else
-               set_feather(0);
-
-       if(settings.get_value("rectangle.invert",value) && value != "0")
-               set_invert(true);
-       else
-               set_invert(false);
-
-       if(settings.get_value("rectangle.layer_rectangle",value) && value=="0")
-               set_layer_rectangle_flag(false);
-       else
-               set_layer_rectangle_flag(true);
-
-       if(settings.get_value("rectangle.layer_region",value) && value=="1")
-               set_layer_region_flag(true);
-       else
-               set_layer_region_flag(false);
-
-       if(settings.get_value("rectangle.layer_outline",value) && value=="1")
-               set_layer_outline_flag(true);
-       else
-               set_layer_outline_flag(false);
-
-       if(settings.get_value("rectangle.layer_curve_gradient",value) && value=="1")
-               set_layer_curve_gradient_flag(true);
-       else
-               set_layer_curve_gradient_flag(false);
-
-       if(settings.get_value("rectangle.layer_plant",value) && value=="1")
-               set_layer_plant_flag(true);
-       else
-               set_layer_plant_flag(false);
-
-       if(settings.get_value("rectangle.layer_link_origins",value) && value=="0")
-               set_layer_link_origins_flag(false);
-       else
-               set_layer_link_origins_flag(true);
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
+
+               //parse the arguments yargh!
+               if(settings.get_value("rectangle.id",value))
+                       set_id(value);
+               else
+                       set_id("Rectangle");
+
+               if(settings.get_value("rectangle.expand",value))
+                       set_expand(atof(value.c_str()));
+               else
+                       set_expand(0);
+
+               if(settings.get_value("rectangle.feather",value))
+                       set_feather(atof(value.c_str()));
+               else
+                       set_feather(0);
+
+               if(settings.get_value("rectangle.invert",value) && value != "0")
+                       set_invert(true);
+               else
+                       set_invert(false);
+
+               if(settings.get_value("rectangle.layer_rectangle",value) && value=="0")
+                       set_layer_rectangle_flag(false);
+               else
+                       set_layer_rectangle_flag(true);
+
+               if(settings.get_value("rectangle.layer_region",value) && value=="1")
+                       set_layer_region_flag(true);
+               else
+                       set_layer_region_flag(false);
+
+               if(settings.get_value("rectangle.layer_outline",value) && value=="1")
+                       set_layer_outline_flag(true);
+               else
+                       set_layer_outline_flag(false);
+
+               if(settings.get_value("rectangle.layer_curve_gradient",value) && value=="1")
+                       set_layer_curve_gradient_flag(true);
+               else
+                       set_layer_curve_gradient_flag(false);
+
+               if(settings.get_value("rectangle.layer_plant",value) && value=="1")
+                       set_layer_plant_flag(true);
+               else
+                       set_layer_plant_flag(false);
+
+               if(settings.get_value("rectangle.layer_link_origins",value) && value=="0")
+                       set_layer_link_origins_flag(false);
+               else
+                       set_layer_link_origins_flag(true);
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Rectangle: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateRectangle_Context::save_settings()
 {
-       settings.set_value("rectangle.id",get_id().c_str());
-       settings.set_value("rectangle.expand",strprintf("%f",get_expand()));
-       settings.set_value("rectangle.feather",strprintf("%f",(float)get_feather()));
-       settings.set_value("rectangle.invert",get_invert()?"1":"0");
-       settings.set_value("rectangle.layer_rectangle",get_layer_rectangle_flag()?"1":"0");
-       settings.set_value("rectangle.layer_outline",get_layer_outline_flag()?"1":"0");
-       settings.set_value("rectangle.layer_region",get_layer_region_flag()?"1":"0");
-       settings.set_value("rectangle.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
-       settings.set_value("rectangle.layer_plant",get_layer_plant_flag()?"1":"0");
-       settings.set_value("rectangle.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("rectangle.id",get_id().c_str());
+               settings.set_value("rectangle.expand",strprintf("%f",get_expand()));
+               settings.set_value("rectangle.feather",strprintf("%f",(float)get_feather()));
+               settings.set_value("rectangle.invert",get_invert()?"1":"0");
+               settings.set_value("rectangle.layer_rectangle",get_layer_rectangle_flag()?"1":"0");
+               settings.set_value("rectangle.layer_outline",get_layer_outline_flag()?"1":"0");
+               settings.set_value("rectangle.layer_region",get_layer_region_flag()?"1":"0");
+               settings.set_value("rectangle.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
+               settings.set_value("rectangle.layer_plant",get_layer_plant_flag()?"1":"0");
+               settings.set_value("rectangle.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Rectangle: Caught exception when attempting to save settings.");
+       }
 }
 
 void
index 53ee7c9..e582835 100644 (file)
@@ -158,18 +158,36 @@ StateRotate::~StateRotate()
 void
 StateRotate_Context::load_settings()
 {
-       String value;
-
-       if(settings.get_value("rotate.scale",value) && value=="0")
-               set_scale_flag(false);
-       else
-               set_scale_flag(true);
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
+
+               if(settings.get_value("rotate.scale",value) && value=="0")
+                       set_scale_flag(false);
+               else
+                       set_scale_flag(true);
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Rotate: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateRotate_Context::save_settings()
 {
-       settings.set_value("rotate.scale",get_scale_flag()?"1":"0");
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("rotate.scale",get_scale_flag()?"1":"0");
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Rotate: Caught exception when attempting to save settings.");
+       }
 }
 
 StateRotate_Context::StateRotate_Context(CanvasView* canvas_view):
index 4cc6600..5b723fc 100644 (file)
@@ -147,18 +147,36 @@ StateScale::~StateScale()
 void
 StateScale_Context::load_settings()
 {
-       String value;
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
 
-       if(settings.get_value("scale.lock_aspect",value) && value=="0")
-               set_aspect_lock_flag(false);
-       else
-               set_aspect_lock_flag(true);
+               if(settings.get_value("scale.lock_aspect",value) && value=="0")
+                       set_aspect_lock_flag(false);
+               else
+                       set_aspect_lock_flag(true);
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Scale: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateScale_Context::save_settings()
 {
-       settings.set_value("scale.lock_aspect",get_aspect_lock_flag()?"1":"0");
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("scale.lock_aspect",get_aspect_lock_flag()?"1":"0");
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Scale: Caught exception when attempting to save settings.");
+       }
 }
 
 StateScale_Context::StateScale_Context(CanvasView* canvas_view):
index d2227cc..3b4f36c 100644 (file)
@@ -155,18 +155,36 @@ StateSmoothMove::~StateSmoothMove()
 void
 StateSmoothMove_Context::load_settings()
 {
-       String value;
-
-       if(settings.get_value("smooth_move.radius",value))
-               set_radius(atof(value.c_str()));
-       else
-               set_radius(1.0f);
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
+
+               if(settings.get_value("smooth_move.radius",value))
+                       set_radius(atof(value.c_str()));
+               else
+                       set_radius(1.0f);
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State SmothMove: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateSmoothMove_Context::save_settings()
 {
-       settings.set_value("smooth_move.radius",strprintf("%f",get_radius()));
+       try
+       {
+       SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("smooth_move.radius",strprintf("%f",get_radius()));
+       SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State SmoothMove: Caught exception when attempting to save settings.");
+       }
 }
 
 StateSmoothMove_Context::StateSmoothMove_Context(CanvasView* canvas_view):
index c5fb3ce..6033baf 100644 (file)
@@ -246,121 +246,139 @@ StateStar::~StateStar()
 void
 StateStar_Context::load_settings()
 {
-       String value;
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
 
-       //parse the arguments yargh!
-       if(settings.get_value("star.id",value))
-               set_id(value);
-       else
-               set_id("Star");
+               //parse the arguments yargh!
+               if(settings.get_value("star.id",value))
+                       set_id(value);
+               else
+                       set_id("Star");
 
-       if(settings.get_value("star.feather",value))
-               set_feather(atof(value.c_str()));
-       else
-               set_feather(0);
+               if(settings.get_value("star.feather",value))
+                       set_feather(atof(value.c_str()));
+               else
+                       set_feather(0);
 
-       if(settings.get_value("star.number_of_points",value))
-               set_number_of_points(atof(value.c_str()));
-       else
-               set_number_of_points(5);
+               if(settings.get_value("star.number_of_points",value))
+                       set_number_of_points(atof(value.c_str()));
+               else
+                       set_number_of_points(5);
 
-       if(settings.get_value("star.inner_tangent",value))
-               set_inner_tangent(atof(value.c_str()));
-       else
-               set_inner_tangent(0);
+               if(settings.get_value("star.inner_tangent",value))
+                       set_inner_tangent(atof(value.c_str()));
+               else
+                       set_inner_tangent(0);
 
-       if(settings.get_value("star.outer_tangent",value))
-               set_outer_tangent(atof(value.c_str()));
-       else
-               set_outer_tangent(0);
+               if(settings.get_value("star.outer_tangent",value))
+                       set_outer_tangent(atof(value.c_str()));
+               else
+                       set_outer_tangent(0);
 
-       if(settings.get_value("star.inner_width",value))
-               set_inner_width(atof(value.c_str()));
-       else
-               set_inner_width(1);
+               if(settings.get_value("star.inner_width",value))
+                       set_inner_width(atof(value.c_str()));
+               else
+                       set_inner_width(1);
 
-       if(settings.get_value("star.outer_width",value))
-               set_outer_width(atof(value.c_str()));
-       else
-               set_outer_width(1);
+               if(settings.get_value("star.outer_width",value))
+                       set_outer_width(atof(value.c_str()));
+               else
+                       set_outer_width(1);
 
-       if(settings.get_value("star.radius_ratio",value))
-               set_radius_ratio(atof(value.c_str()));
-       else
-               set_radius_ratio(0.5);
+               if(settings.get_value("star.radius_ratio",value))
+                       set_radius_ratio(atof(value.c_str()));
+               else
+                       set_radius_ratio(0.5);
 
-       if(settings.get_value("star.angle_offset",value))
-               set_angle_offset(atof(value.c_str()));
-       else
-               set_angle_offset(0);
+               if(settings.get_value("star.angle_offset",value))
+                       set_angle_offset(atof(value.c_str()));
+               else
+                       set_angle_offset(0);
 
-       if(settings.get_value("star.invert",value) && value != "0")
-               set_invert(true);
-       else
-               set_invert(false);
+               if(settings.get_value("star.invert",value) && value != "0")
+                       set_invert(true);
+               else
+                       set_invert(false);
 
-       if(settings.get_value("star.regular_polygon",value) && value != "0")
-               set_regular_polygon(true);
-       else
-               set_regular_polygon(false);
+               if(settings.get_value("star.regular_polygon",value) && value != "0")
+                       set_regular_polygon(true);
+               else
+                       set_regular_polygon(false);
 
-       if(settings.get_value("star.layer_star",value) && value=="0")
-               set_layer_star_flag(false);
-       else
-               set_layer_star_flag(true);
+               if(settings.get_value("star.layer_star",value) && value=="0")
+                       set_layer_star_flag(false);
+               else
+                       set_layer_star_flag(true);
 
-       if(settings.get_value("star.layer_region",value) && value=="1")
-               set_layer_region_flag(true);
-       else
-               set_layer_region_flag(false);
+               if(settings.get_value("star.layer_region",value) && value=="1")
+                       set_layer_region_flag(true);
+               else
+                       set_layer_region_flag(false);
 
-       if(settings.get_value("star.layer_outline",value) && value=="1")
-               set_layer_outline_flag(true);
-       else
-               set_layer_outline_flag(false);
+               if(settings.get_value("star.layer_outline",value) && value=="1")
+                       set_layer_outline_flag(true);
+               else
+                       set_layer_outline_flag(false);
 
-       if(settings.get_value("star.layer_curve_gradient",value) && value=="1")
-               set_layer_curve_gradient_flag(true);
-       else
-               set_layer_curve_gradient_flag(false);
+               if(settings.get_value("star.layer_curve_gradient",value) && value=="1")
+                       set_layer_curve_gradient_flag(true);
+               else
+                       set_layer_curve_gradient_flag(false);
 
-       if(settings.get_value("star.layer_plant",value) && value=="1")
-               set_layer_plant_flag(true);
-       else
-               set_layer_plant_flag(false);
+               if(settings.get_value("star.layer_plant",value) && value=="1")
+                       set_layer_plant_flag(true);
+               else
+                       set_layer_plant_flag(false);
 
-       if(settings.get_value("star.layer_link_origins",value) && value=="0")
-               set_layer_link_origins_flag(false);
-       else
-               set_layer_link_origins_flag(true);
+               if(settings.get_value("star.layer_link_origins",value) && value=="0")
+                       set_layer_link_origins_flag(false);
+               else
+                       set_layer_link_origins_flag(true);
 
-       if(settings.get_value("star.layer_origins_at_center",value) && value=="0")
-               set_layer_origins_at_center_flag(false);
-       else
-               set_layer_origins_at_center_flag(true);
+               if(settings.get_value("star.layer_origins_at_center",value) && value=="0")
+                       set_layer_origins_at_center_flag(false);
+               else
+                       set_layer_origins_at_center_flag(true);
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Star: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateStar_Context::save_settings()
 {
-       settings.set_value("star.id",get_id());
-       settings.set_value("star.feather",strprintf("%f",(float)get_feather()));
-       settings.set_value("star.number_of_points",strprintf("%d",(int)(get_number_of_points() + 0.5)));
-       settings.set_value("star.inner_tangent",strprintf("%f",(float)get_inner_tangent()));
-       settings.set_value("star.outer_tangent",strprintf("%f",(float)get_outer_tangent()));
-       settings.set_value("star.inner_width",strprintf("%f",(float)get_inner_width()));
-       settings.set_value("star.outer_width",strprintf("%f",(float)get_outer_width()));
-       settings.set_value("star.radius_ratio",strprintf("%f",(float)get_radius_ratio()));
-       settings.set_value("star.angle_offset",strprintf("%f",(float)get_angle_offset()));
-       settings.set_value("star.invert",get_invert()?"1":"0");
-       settings.set_value("star.regular_polygon",get_regular_polygon()?"1":"0");
-       settings.set_value("star.layer_star",get_layer_star_flag()?"1":"0");
-       settings.set_value("star.layer_outline",get_layer_outline_flag()?"1":"0");
-       settings.set_value("star.layer_region",get_layer_region_flag()?"1":"0");
-       settings.set_value("star.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
-       settings.set_value("star.layer_plant",get_layer_plant_flag()?"1":"0");
-       settings.set_value("star.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
-       settings.set_value("star.layer_origins_at_center",get_layer_origins_at_center_flag()?"1":"0");
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("star.id",get_id());
+               settings.set_value("star.feather",strprintf("%f",(float)get_feather()));
+               settings.set_value("star.number_of_points",strprintf("%d",(int)(get_number_of_points() + 0.5)));
+               settings.set_value("star.inner_tangent",strprintf("%f",(float)get_inner_tangent()));
+               settings.set_value("star.outer_tangent",strprintf("%f",(float)get_outer_tangent()));
+               settings.set_value("star.inner_width",strprintf("%f",(float)get_inner_width()));
+               settings.set_value("star.outer_width",strprintf("%f",(float)get_outer_width()));
+               settings.set_value("star.radius_ratio",strprintf("%f",(float)get_radius_ratio()));
+               settings.set_value("star.angle_offset",strprintf("%f",(float)get_angle_offset()));
+               settings.set_value("star.invert",get_invert()?"1":"0");
+               settings.set_value("star.regular_polygon",get_regular_polygon()?"1":"0");
+               settings.set_value("star.layer_star",get_layer_star_flag()?"1":"0");
+               settings.set_value("star.layer_outline",get_layer_outline_flag()?"1":"0");
+               settings.set_value("star.layer_region",get_layer_region_flag()?"1":"0");
+               settings.set_value("star.layer_curve_gradient",get_layer_curve_gradient_flag()?"1":"0");
+               settings.set_value("star.layer_plant",get_layer_plant_flag()?"1":"0");
+               settings.set_value("star.layer_link_origins",get_layer_link_origins_flag()?"1":"0");
+               settings.set_value("star.layer_origins_at_center",get_layer_origins_at_center_flag()?"1":"0");
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Star: Caught exception when attempting to save settings.");
+       }
 }
 
 void
index 29440b2..6a752d2 100644 (file)
@@ -163,56 +163,74 @@ StateText::~StateText()
 void
 StateText_Context::load_settings()
 {
-       String value;
-       Vector v;
-
-       //parse the arguments yargh!
-       if(settings.get_value("text.id",value))
-               set_id(value);
-       else
-               set_id("Text");
-
-       if(settings.get_value("text.paragraph",value) && value=="1")
-               set_paragraph_flag(true);
-       else
-               set_paragraph_flag(false);
-
-       if(settings.get_value("text.size_x",value))
-               v[0] = atof(value.c_str());
-       else
-               v[0] = 0.25;
-       if(settings.get_value("text.size_y",value))
-               v[1] = atof(value.c_str());
-       else
-               v[1] = 0.25;
-       set_size(v);
-
-       if(settings.get_value("text.orient_x",value))
-               v[0] = atof(value.c_str());
-       else
-               v[0] = 0.5;
-       if(settings.get_value("text.orient_y",value))
-               v[1] = atof(value.c_str());
-       else
-               v[1] = 0.5;
-       set_orientation(v);
-
-       if(settings.get_value("text.family",value))
-               set_family(value);
-       else
-               set_family("Sans Serif");
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
+               Vector v;
+
+               //parse the arguments yargh!
+               if(settings.get_value("text.id",value))
+                       set_id(value);
+               else
+                       set_id("Text");
+
+               if(settings.get_value("text.paragraph",value) && value=="1")
+                       set_paragraph_flag(true);
+               else
+                       set_paragraph_flag(false);
+
+               if(settings.get_value("text.size_x",value))
+                       v[0] = atof(value.c_str());
+               else
+                       v[0] = 0.25;
+               if(settings.get_value("text.size_y",value))
+                       v[1] = atof(value.c_str());
+               else
+                       v[1] = 0.25;
+               set_size(v);
+
+               if(settings.get_value("text.orient_x",value))
+                       v[0] = atof(value.c_str());
+               else
+                       v[0] = 0.5;
+               if(settings.get_value("text.orient_y",value))
+                       v[1] = atof(value.c_str());
+               else
+                       v[1] = 0.5;
+               set_orientation(v);
+
+               if(settings.get_value("text.family",value))
+                       set_family(value);
+               else
+                       set_family("Sans Serif");
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Text: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateText_Context::save_settings()
 {
-       settings.set_value("text.id",get_id());
-       settings.set_value("text.paragraph",get_paragraph_flag()?"1":"0");
-       settings.set_value("text.size_x",strprintf("%f",(float)get_size()[0]));
-       settings.set_value("text.size_y",strprintf("%f",(float)get_size()[1]));
-       settings.set_value("text.orient_x",strprintf("%f",(float)get_orientation()[0]));
-       settings.set_value("text.orient_y",strprintf("%f",(float)get_orientation()[1]));
-       settings.set_value("text.family",get_family());
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("text.id",get_id());
+               settings.set_value("text.paragraph",get_paragraph_flag()?"1":"0");
+               settings.set_value("text.size_x",strprintf("%f",(float)get_size()[0]));
+               settings.set_value("text.size_y",strprintf("%f",(float)get_size()[1]));
+               settings.set_value("text.orient_x",strprintf("%f",(float)get_orientation()[0]));
+               settings.set_value("text.orient_y",strprintf("%f",(float)get_orientation()[1]));
+               settings.set_value("text.family",get_family());
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Text: Caught exception when attempting to save settings.");
+       }
 }
 
 void
index 32c2665..6e212ea 100644 (file)
@@ -173,32 +173,50 @@ StateWidth::~StateWidth()
 void
 StateWidth_Context::load_settings()
 {
-       String value;
-
-       //parse the arguments yargh!
-       if(settings.get_value("width.delta",value))
-               set_delta(atof(value.c_str()));
-       else
-               set_delta(6);
-
-       if(settings.get_value("width.radius",value))
-               set_radius(atof(value.c_str()));
-       else
-               set_radius(15);
-
-       //defaults to false
-       if(settings.get_value("width.relative",value) && value == "1")
-               set_relative(true);
-       else
-               set_relative(false);
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               String value;
+
+               //parse the arguments yargh!
+               if(settings.get_value("width.delta",value))
+                       set_delta(atof(value.c_str()));
+               else
+                       set_delta(6);
+
+               if(settings.get_value("width.radius",value))
+                       set_radius(atof(value.c_str()));
+               else
+                       set_radius(15);
+
+               //defaults to false
+               if(settings.get_value("width.relative",value) && value == "1")
+                       set_relative(true);
+               else
+                       set_relative(false);
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Width: Caught exception when attempting to load settings.");
+       }
 }
 
 void
 StateWidth_Context::save_settings()
 {
-       settings.set_value("width.delta",strprintf("%f",get_delta()));
-       settings.set_value("width.radius",strprintf("%f",get_radius()));
-       settings.set_value("width.relative",get_relative()?"1":"0");
+       try
+       {
+               SETTINGS_LOCALE_SAFE_AND_BACKUP
+               settings.set_value("width.delta",strprintf("%f",get_delta()));
+               settings.set_value("width.radius",strprintf("%f",get_radius()));
+               settings.set_value("width.relative",get_relative()?"1":"0");
+               SETTINGS_LOCALE_RESTORE
+       }
+       catch(...)
+       {
+               synfig::warning("State Width: Caught exception when attempting to save settings.");
+       }
 }
 
 void
index d9df69d..aea4e62 100644 (file)
@@ -60,56 +60,64 @@ public:
 
        virtual bool get_value(const synfig::String& key, synfig::String& value)const
        {
-               if(key=="state")
+               try
                {
-                       value=input_device->get_state();
-                       return true;
-               }
-               if(key=="bline_width")
-               {
-                       value=strprintf("%s",input_device->get_bline_width().get_string().c_str());
-                       return true;
-               }
-               if(key=="opacity")
-               {
-                       value=strprintf("%f",(float)input_device->get_opacity());
-                       return true;
-               }
-               if(key=="blend_method")
-               {
-                       value=strprintf("%i",(int)input_device->get_blend_method());
-                       return true;
-               }
-               if(key=="outline_color")
-               {
-                       Color c(input_device->get_outline_color());
-                       value=strprintf("%f %f %f %f",(float)c.get_r(),(float)c.get_g(),(float)c.get_b(),(float)c.get_a());
+                       SETTINGS_LOCALE_SAFE_AND_BACKUP
+                       if(key=="state")
+                       {
+                               value=input_device->get_state();
+                               return true;
+                       }
+                       if(key=="bline_width")
+                       {
+                               value=strprintf("%s",input_device->get_bline_width().get_string().c_str());
+                               return true;
+                       }
+                       if(key=="opacity")
+                       {
+                               value=strprintf("%f",(float)input_device->get_opacity());
+                               return true;
+                       }
+                       if(key=="blend_method")
+                       {
+                               value=strprintf("%i",(int)input_device->get_blend_method());
+                               return true;
+                       }
+                       if(key=="outline_color")
+                       {
+                               Color c(input_device->get_outline_color());
+                               value=strprintf("%f %f %f %f",(float)c.get_r(),(float)c.get_g(),(float)c.get_b(),(float)c.get_a());
 
-                       return true;
-               }
-               if(key=="fill_color")
-               {
-                       Color c(input_device->get_fill_color());
-                       value=strprintf("%f %f %f %f",(float)c.get_r(),(float)c.get_g(),(float)c.get_b(),(float)c.get_a());
+                               return true;
+                       }
+                       if(key=="fill_color")
+                       {
+                               Color c(input_device->get_fill_color());
+                               value=strprintf("%f %f %f %f",(float)c.get_r(),(float)c.get_g(),(float)c.get_b(),(float)c.get_a());
 
-                       return true;
-               }
-               if(key=="mode")
-               {
-                       get_mode_value(value);
-                       return true;
-               }
-               if(key=="axes")
-               {
-                       get_axes_value(value);
-                       return true;
+                               return true;
+                       }
+                       if(key=="mode")
+                       {
+                               get_mode_value(value);
+                               return true;
+                       }
+                       if(key=="axes")
+                       {
+                               get_axes_value(value);
+                               return true;
+                       }
+                       if(key=="keys")
+                       {
+                               get_keys_value(value);
+                               return true;
+                       }
+                       SETTINGS_LOCALE_RESTORE
                }
-               if(key=="keys")
+               catch(...)
                {
-                       get_keys_value(value);
-                       return true;
+                       synfig::warning("DeviceSettings: Caught exception when attempting to get value.");
                }
-
                return Settings::get_value(key, value);
        }
 
@@ -143,58 +151,66 @@ public:
 
        virtual bool set_value(const synfig::String& key,const synfig::String& value)
        {
-               if(key=="state")
+               try
                {
-                       input_device->set_state(value);
-                       return true;
-               }
-               if(key=="bline_width")
-               {
-                       input_device->set_bline_width(synfig::Distance(value));
-                       return true;
-               }
-               if(key=="opacity")
-               {
-                       input_device->set_opacity(atof(value.c_str()));
-                       return true;
-               }
-               if(key=="blend_method")
-               {
-                       input_device->set_blend_method(Color::BlendMethod(atoi(value.c_str())));
-                       return true;
-               }
-               if(key=="outline_color")
-               {
-                       float r=0,g=0,b=0,a=1;
-                       if(!strscanf(value,"%f %f %f %f",&r,&g,&b,&a))
-                               return false;
-                       input_device->set_outline_color(synfig::Color(r,g,b,a));
-                       return true;
-               }
-               if(key=="fill_color")
-               {
-                       float r=0,g=0,b=0,a=1;
-                       if(!strscanf(value,"%f %f %f %f",&r,&g,&b,&a))
-                               return false;
-                       input_device->set_fill_color(synfig::Color(r,g,b,a));
-                       return true;
-               }
-               if(key=="mode")
-               {
-                       set_mode_value(value);
-                       return true;
-               }
-               if(key=="axes")
-               {
-                       set_axes_value(value);
-                       return true;
+                       SETTINGS_LOCALE_SAFE_AND_BACKUP
+                       if(key=="state")
+                       {
+                               input_device->set_state(value);
+                               return true;
+                       }
+                       if(key=="bline_width")
+                       {
+                               input_device->set_bline_width(synfig::Distance(value));
+                               return true;
+                       }
+                       if(key=="opacity")
+                       {
+                               input_device->set_opacity(atof(value.c_str()));
+                               return true;
+                       }
+                       if(key=="blend_method")
+                       {
+                               input_device->set_blend_method(Color::BlendMethod(atoi(value.c_str())));
+                               return true;
+                       }
+                       if(key=="outline_color")
+                       {
+                               float r=0,g=0,b=0,a=1;
+                               if(!strscanf(value,"%f %f %f %f",&r,&g,&b,&a))
+                                       return false;
+                               input_device->set_outline_color(synfig::Color(r,g,b,a));
+                               return true;
+                       }
+                       if(key=="fill_color")
+                       {
+                               float r=0,g=0,b=0,a=1;
+                               if(!strscanf(value,"%f %f %f %f",&r,&g,&b,&a))
+                                       return false;
+                               input_device->set_fill_color(synfig::Color(r,g,b,a));
+                               return true;
+                       }
+                       if(key=="mode")
+                       {
+                               set_mode_value(value);
+                               return true;
+                       }
+                       if(key=="axes")
+                       {
+                               set_axes_value(value);
+                               return true;
+                       }
+                       if(key=="keys")
+                       {
+                               set_keys_value(value);
+                               return true;
+                       }
+                       SETTINGS_LOCALE_RESTORE
                }
-               if(key=="keys")
+               catch(...)
                {
-                       set_keys_value(value);
-                       return true;
+                       synfig::warning("DeviceSettings: Caught exception when attempting to set value.");
                }
-
                return Settings::set_value(key, value);
        }
 
index 9009827..1bf9227 100644 (file)
 #include <map>
 #include <list>
 #include <ETL/stringf>
+#include <string.h>
 
 /* === M A C R O S ========================================================= */
 
+#define SETTINGS_LOCALE_SAFE_AND_BACKUP                                                                                \
+       char * old_locale;                                                                                                              \
+       old_locale=strdup(setlocale(LC_NUMERIC, NULL));                                                 \
+       setlocale(LC_NUMERIC, "C");
+
+#define SETTINGS_LOCALE_RESTORE                                                                                                \
+       setlocale(LC_NUMERIC,old_locale);
+
 /* === T Y P E D E F S ===================================================== */
 
 /* === C L A S S E S & S T R U C T S ======================================= */