#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>
/* === 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)
}
};
-static Preferences _preferences;
+static ::Preferences _preferences;
void
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") );
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"));
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();
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
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);
std::string filename=get_config_file("settings");
synfigapp::Main::settings().save_to_file(filename);
+ setlocale(LC_NUMERIC,old_locale);
}
catch(...)
{
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);
synfigapp::Main::settings().set_value("window.toolbox.pos","4 4");
}
}
-
+ setlocale(LC_NUMERIC,old_locale);
}
catch(...)
{
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