The 'polygon', 'draw', 'sketch', and 'width' tools are disabled by default. This...
[synfig.git] / synfig-studio / trunk / src / gtkmm / app.cpp
index 14fc4b1..e1d1a6e 100644 (file)
 
 #include <fstream>
 #include <iostream>
+#include <locale>
 
 #ifdef HAVE_SYS_ERRNO_H
 #include <sys/errno.h>
 #endif
 #include <gtkmm/fileselection.h>
 #include <gtkmm/dialog.h>
+#include <gtkmm/messagedialog.h>
 #include <gtkmm/label.h>
 #include <gtkmm/stock.h>
 #include <gtkmm/stockitem.h>
@@ -131,6 +133,14 @@ using namespace studio;
 
 /* === M A C R O S ========================================================= */
 
+#ifndef SYNFIG_USER_APP_DIR
+#ifdef __APPLE__
+#define SYNFIG_USER_APP_DIR    "Library/Synfig"
+#else
+#define SYNFIG_USER_APP_DIR    "Synfig"
+#endif
+#endif
+
 #ifndef DPM2DPI
 #define DPM2DPI(x)     (float(x)/39.3700787402f)
 #define DPI2DPM(x)     (float(x)*39.3700787402f)
@@ -677,7 +687,7 @@ init_ui_manager()
        menus_action_group->add( Gtk::Action::create("menu-view", "_View") );
        menus_action_group->add( Gtk::Action::create("menu-canvas", "_Canvas") );
        menus_action_group->add( Gtk::Action::create("menu-layer", "_Layer") );
-       menus_action_group->add( Gtk::Action::create("menu-duck-mask", "Mask Ducks") );
+       menus_action_group->add( Gtk::Action::create("menu-duck-mask", "Show/Hide Ducks") );
        menus_action_group->add( Gtk::Action::create("menu-preview-quality", "Preview Quality") );
        menus_action_group->add( Gtk::Action::create("menu-layer-new", "New Layer") );
        menus_action_group->add( Gtk::Action::create("menu-keyframe", "Keyframe") );
@@ -728,12 +738,12 @@ init_ui_manager()
        DEFINE_ACTION("unselect-all-layers", _("Unselect All Layers"));
        DEFINE_ACTION("properties", _("Properties"));
 
-       DEFINE_ACTION("mask-position-ducks", _("Mask Position Ducks"));
-       DEFINE_ACTION("mask-vertex-ducks", _("Mask Vertex Ducks"));
-       DEFINE_ACTION("mask-tangent-ducks", _("Mask Tangent Ducks"));
-       DEFINE_ACTION("mask-radius-ducks", _("Mask Radius Ducks"));
-       DEFINE_ACTION("mask-width-ducks", _("Mask Width Ducks"));
-       DEFINE_ACTION("mask-angle-ducks", _("Mask Angle Ducks"));
+       DEFINE_ACTION("mask-position-ducks", _("Show Position Ducks"));
+       DEFINE_ACTION("mask-vertex-ducks", _("Show Vertex Ducks"));
+       DEFINE_ACTION("mask-tangent-ducks", _("Show Tangent Ducks"));
+       DEFINE_ACTION("mask-radius-ducks", _("Show Radius Ducks"));
+       DEFINE_ACTION("mask-width-ducks", _("Show Width Ducks"));
+       DEFINE_ACTION("mask-angle-ducks", _("Show Angle Ducks"));
        DEFINE_ACTION("quality-00", _("Use Parametric Renderer"));
        DEFINE_ACTION("quality-01", _("Use Quality Level 1"));
        DEFINE_ACTION("quality-02", _("Use Quality Level 2"));
@@ -1203,21 +1213,27 @@ App::App(int *argc, char ***argv):
                state_manager->add_state(&state_rotate);
 
                state_manager->add_state(&state_bline);
-               state_manager->add_state(&state_polygon);
+               
+               
                state_manager->add_state(&state_circle);
                state_manager->add_state(&state_rectangle);
 
-               state_manager->add_state(&state_draw);
-               state_manager->add_state(&state_sketch);
-
+               state_manager->add_state(&state_gradient);
                state_manager->add_state(&state_eyedrop);
                state_manager->add_state(&state_fill);
                
-               state_manager->add_state(&state_width);
-               state_manager->add_state(&state_gradient);
-               
                state_manager->add_state(&state_zoom);
 
+               // Disabled this tool because it should be
+               // considered deprecated. Use the bline tool instead.
+               if(getenv("SYNFIG_ENABLE_POLYGON")) state_manager->add_state(&state_polygon);
+       
+               // These tools are disabled by default for now,
+               // because they tend to confuse users.
+               if(getenv("SYNFIG_ENABLE_DRAW"  )) state_manager->add_state(&state_draw);
+               if(getenv("SYNFIG_ENABLE_SKETCH")) state_manager->add_state(&state_sketch);
+               if(getenv("SYNFIG_ENABLE_WIDTH" )) state_manager->add_state(&state_width);
+
                studio_init_cb.task("Init ModPalette...");
                module_list_.push_back(new ModPalette()); module_list_.back()->start();
 
@@ -1340,11 +1356,7 @@ App::~App()
 String
 App::get_user_app_directory()
 {
-#ifdef __APPLE__
-       return Glib::build_filename(Glib::get_home_dir(),"Library/Synfig");
-#else
-       return Glib::build_filename(Glib::get_home_dir(),"Synfig");
-#endif
+       return Glib::build_filename(Glib::get_home_dir(),SYNFIG_USER_APP_DIR);
 }
 
 synfig::String
@@ -1412,8 +1424,11 @@ 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");
                {
                        std::string filename=get_config_file("accelrc");
                        Gtk::AccelMap::save(filename);
@@ -1437,6 +1452,7 @@ App::save_settings()
 
                std::string filename=get_config_file("settings");
                synfigapp::Main::settings().save_to_file(filename);
+       setlocale(LC_NUMERIC,old_locale);       
        }
        catch(...)
        {
@@ -1447,8 +1463,11 @@ App::save_settings()
 void
 App::load_settings()
 {
+       char  * old_locale;
        try
        {
+       old_locale=strdup(setlocale(LC_NUMERIC, NULL));
+       setlocale(LC_NUMERIC, "C");
                {
                        std::string filename=get_config_file("accelrc");
                        Gtk::AccelMap::load(filename);
@@ -1488,7 +1507,7 @@ App::load_settings()
                                synfigapp::Main::settings().set_value("window.toolbox.pos","4 4");
                        }
                }
-               
+       setlocale(LC_NUMERIC,old_locale);       
        }
        catch(...)
        {
@@ -1922,18 +1941,9 @@ App::dialog_yes_no_cancel(const std::string &title, const std::string &message)
 void
 App::dialog_not_implemented()
 {
-       Gtk::Dialog dialog(
-               "Feature not available",                // Title
-               true,           // Modal
-               true            // use_separator
-       );
-       Gtk::Label label("Sorry, this feature has not yet been implemented.");
-       label.show();
-       
-       dialog.get_vbox()->pack_start(label);
-       dialog.add_button(Gtk::StockID("gtk-ok"),Gtk::RESPONSE_OK);
-       dialog.show();
-       dialog.run();
+       Gtk::MessageDialog dialog("Feature not available", false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_CLOSE, true);
+       dialog.set_secondary_text("Sorry, this feature has not yet been implemented.");
+       dialog.run(); 
 }
 
 bool