X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fapp.cpp;h=a22bae00834eb5ed84d48c9a44f742d1feb42795;hb=0c2b7e48750351e8f3d39885dd1e2c2b73551523;hp=e726bf63808e2d7b0ba41a510d5916d1603ae7b1;hpb=22141e99d589c693677d2cba122a198f45c0fa74;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/app.cpp b/synfig-studio/trunk/src/gtkmm/app.cpp index e726bf6..a22bae0 100644 --- a/synfig-studio/trunk/src/gtkmm/app.cpp +++ b/synfig-studio/trunk/src/gtkmm/app.cpp @@ -113,9 +113,12 @@ #endif #ifdef WIN32 +#define _WIN32_WINNT 0x0500 #include #endif #include +#include +#include #endif @@ -128,6 +131,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) @@ -658,7 +669,7 @@ public: } }; -static Preferences _preferences; +static ::Preferences _preferences; void init_ui_manager() @@ -674,7 +685,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") ); @@ -725,12 +736,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")); @@ -1337,11 +1348,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 @@ -1653,6 +1660,21 @@ App::dialog_open_file(const std::string &title, std::string &filename) if(!_preferences.get_value("curr_path",prev_path)) prev_path="."; + Gtk::FileChooserDialog *dialog=new Gtk::FileChooserDialog(title,Gtk::FILE_CHOOSER_ACTION_OPEN); + dialog->set_current_folder(prev_path); + dialog->add_button(Gtk::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT); + dialog->add_button(Gtk::StockID("gtk-cancel"),GTK_RESPONSE_CANCEL); + if(!filename.empty()) + dialog->set_filename(filename); + if(dialog->run()==GTK_RESPONSE_ACCEPT) { + filename=dialog->get_filename(); + delete dialog; + return true; + } + delete dialog; + return false; + /* + GtkWidget *ok; GtkWidget *cancel; int val=0; @@ -1694,6 +1716,7 @@ App::dialog_open_file(const std::string &title, std::string &filename) } gtk_widget_destroy(fileselection); return true; + */ #endif } @@ -1742,7 +1765,24 @@ App::dialog_save_file(const std::string &title, std::string &filename) } return false; #else - return dialog_open_file(title, filename); + synfig::String prev_path; + if(!_preferences.get_value("curr_path",prev_path)) + prev_path="."; + + Gtk::FileChooserDialog *dialog=new Gtk::FileChooserDialog(title,Gtk::FILE_CHOOSER_ACTION_SAVE); + dialog->set_current_folder(prev_path); + dialog->add_button(Gtk::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT); + dialog->add_button(Gtk::StockID("gtk-cancel"),GTK_RESPONSE_CANCEL); + if(!filename.empty()) + dialog->set_filename(filename); + if(dialog->run()==GTK_RESPONSE_ACCEPT) { + filename=dialog->get_filename(); + delete dialog; + return true; + } + delete dialog; + return false; +// return dialog_open_file(title, filename); #endif } @@ -1791,7 +1831,24 @@ App::dialog_saveas_file(const std::string &title, std::string &filename) } return false; #else - return dialog_open_file(title, filename); + synfig::String prev_path; + if(!_preferences.get_value("curr_path",prev_path)) + prev_path="."; + + Gtk::FileChooserDialog *dialog=new Gtk::FileChooserDialog(title,Gtk::FILE_CHOOSER_ACTION_SAVE); + dialog->set_current_folder(prev_path); + dialog->add_button(Gtk::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT); + dialog->add_button(Gtk::StockID("gtk-cancel"),GTK_RESPONSE_CANCEL); + if(!filename.empty()) + dialog->set_filename(filename); + if(dialog->run()==GTK_RESPONSE_ACCEPT) { + filename=dialog->get_filename(); + delete dialog; + return true; + } + delete dialog; + return false; +// return dialog_open_file(title, filename); #endif } @@ -1927,6 +1984,12 @@ App::open(std::string filename) bool App::open_as(std::string filename,std::string as) { +#ifdef WIN32 + char long_name[1024]; + if(GetLongPathName(as.c_str(),long_name,sizeof(long_name))); + as=long_name; +#endif + try { OneMoment one_moment;