-/* === S I N F G =========================================================== */
+/* === S Y N F I G ========================================================= */
/*! \file app.cpp
** \brief writeme
**
#include <gtk/gtk.h>
-#include <sinfg/loadcanvas.h>
+#include <synfig/loadcanvas.h>
#include "app.h"
#include "about.h"
#include "autorecover.h"
-#include <sinfgapp/settings.h>
+#include <synfigapp/settings.h>
#include "dock_history.h"
#include "dock_canvases.h"
#include "dock_keyframes.h"
using namespace std;
using namespace etl;
-using namespace sinfg;
+using namespace synfig;
using namespace studio;
/* === M A C R O S ========================================================= */
# define IMAGE_EXT "tif"
#endif
-#include <sinfgapp/main.h>
+#include <synfigapp/main.h>
/* === S I G N A L S ======================================================= */
int App::Busy::count;
bool App::shutdown_in_progress;
-sinfg::Gamma App::gamma;
+synfig::Gamma App::gamma;
Glib::RefPtr<studio::UIManager> App::ui_manager_;
-sinfg::Distance::System App::distance_system;
+synfig::Distance::System App::distance_system;
studio::Dialog_Setup* App::dialog_setup;
std::list<etl::handle<Instance> > App::instance_list;
-static etl::handle<sinfgapp::UIInterface> ui_interface_;
-const etl::handle<sinfgapp::UIInterface>& App::get_ui_interface() { return ui_interface_; }
+static etl::handle<synfigapp::UIInterface> ui_interface_;
+const etl::handle<synfigapp::UIInterface>& App::get_ui_interface() { return ui_interface_; }
etl::handle<Instance> App::selected_instance;
etl::handle<CanvasView> App::selected_canvas_view;
int studio::App::get_max_recent_files() { return max_recent_files_; }
void studio::App::set_max_recent_files(int x) { max_recent_files_=x; }
-static sinfg::String app_base_path_;
+static synfig::String app_base_path_;
namespace studio {
}; // END of namespace studio
-class GlobalUIInterface : public sinfgapp::UIInterface
+class GlobalUIInterface : public synfigapp::UIInterface
{
public:
fclose(file);
}
else
- sinfg::error("Unable to save license key!");
+ synfig::error("Unable to save license key!");
}
- sinfg::info("License Authenticated -- Serial #%05d",serial);
+ synfig::info("License Authenticated -- Serial #%05d",serial);
return serial;
}
Gtk::UIManager::remove_action_group(action_group);
return;
}
- sinfg::error("Unable to find action group");
+ synfig::error("Unable to find action group");
}
void
DEBUGPOINT();
if(*iter && (*iter)->get_name()!="menus")
{
- sinfg::info("Removing action group "+(*iter)->get_name());
+ synfig::info("Removing action group "+(*iter)->get_name());
ui_manager->remove_action_group(*iter);
}
}
DEBUGPOINT();
}
*/
-class Preferences : public sinfgapp::Settings
+class Preferences : public synfigapp::Settings
{
public:
- virtual bool get_value(const sinfg::String& key, sinfg::String& value)const
+ virtual bool get_value(const synfig::String& key, synfig::String& value)const
{
if(key=="gamma")
{
return true;
}
- return sinfgapp::Settings::get_value(key,value);
+ return synfigapp::Settings::get_value(key,value);
}
- virtual bool set_value(const sinfg::String& key,const sinfg::String& value)
+ virtual bool set_value(const synfig::String& key,const synfig::String& value)
{
if(key=="gamma")
{
if(key=="time_format")
{
int i(atoi(value.c_str()));
- App::set_time_format(static_cast<sinfg::Time::Format>(i));
+ App::set_time_format(static_cast<synfig::Time::Format>(i));
return true;
}
if(key=="auto_recover_backup_interval")
return true;
}
- return sinfgapp::Settings::set_value(key,value);
+ return synfigapp::Settings::set_value(key,value);
}
virtual KeyList get_key_list()const
{
- KeyList ret(sinfgapp::Settings::get_key_list());
+ KeyList ret(synfigapp::Settings::get_key_list());
ret.push_back("gamma");
ret.push_back("time_format");
ret.push_back("distance_system");
menus_action_group->add( Gtk::Action::create("menu-state", "State") );
menus_action_group->add( Gtk::Action::create("menu-toolbox", "Toolbox") );
- // Add the sinfgapp actions...
- sinfgapp::Action::Book::iterator iter;
- for(iter=sinfgapp::Action::book().begin();iter!=sinfgapp::Action::book().end();++iter)
+ // Add the synfigapp actions...
+ synfigapp::Action::Book::iterator iter;
+ for(iter=synfigapp::Action::book().begin();iter!=synfigapp::Action::book().end();++iter)
{
actions_action_group->add(Gtk::Action::create(
"action-"+iter->second.name,
#define DEFINE_ACTION_SIG(group,x,stock,sig) { Glib::RefPtr<Gtk::Action> action( Gtk::Action::create(x, stock) ); /*action->set_sensitive(false);*/ group->add(action,sig); }
DEFINE_ACTION2("keyframe-properties", Gtk::StockID("gtk-properties"), _("Keyframe Properties"));
- DEFINE_ACTION("about", Gtk::StockID("sinfg-about"));
+ DEFINE_ACTION("about", Gtk::StockID("synfig-about"));
DEFINE_ACTION("open", Gtk::Stock::OPEN);
DEFINE_ACTION("save", Gtk::Stock::SAVE);
DEFINE_ACTION("save-as", Gtk::Stock::SAVE_AS);
DEFINE_ACTION("revert", Gtk::Stock::REVERT_TO_SAVED);
- DEFINE_ACTION("cvs-add", Gtk::StockID("sinfg-cvs_add"));
- DEFINE_ACTION("cvs-update", Gtk::StockID("sinfg-cvs_update"));
- DEFINE_ACTION("cvs-commit", Gtk::StockID("sinfg-cvs_commit"));
- DEFINE_ACTION("cvs-revert", Gtk::StockID("sinfg-cvs_revert"));
+ DEFINE_ACTION("cvs-add", Gtk::StockID("synfig-cvs_add"));
+ DEFINE_ACTION("cvs-update", Gtk::StockID("synfig-cvs_update"));
+ DEFINE_ACTION("cvs-commit", Gtk::StockID("synfig-cvs_commit"));
+ DEFINE_ACTION("cvs-revert", Gtk::StockID("synfig-cvs_revert"));
DEFINE_ACTION("import", _("Import"));
DEFINE_ACTION("render", _("Render"));
DEFINE_ACTION("preview", _("Preview"));
#undef DEFINE_ACTION
-// Set up sinfgapp actions
+// Set up synfigapp actions
/*{
- sinfgapp::Action::Book::iterator iter;
+ synfigapp::Action::Book::iterator iter;
- for(iter=sinfgapp::Action::book().begin();iter!=sinfgapp::Action::book().end();++iter)
+ for(iter=synfigapp::Action::book().begin();iter!=synfigapp::Action::book().end();++iter)
{
Gtk::StockID stock_id;
- if(!(iter->second.category&sinfgapp::Action::CATEGORY_HIDDEN))
+ if(!(iter->second.category&synfigapp::Action::CATEGORY_HIDDEN))
{
//Gtk::Image* image(manage(new Gtk::Image()));
if(iter->second.task=="raise") stock_id=Gtk::Stock::GO_UP;
else if(iter->second.task=="set_off") stock_id=Gtk::Stock::NO;
//else if(iter->second.task=="duplicate") stock_id=Gtk::Stock::COPY;
else if(iter->second.task=="remove") stock_id=Gtk::Stock::DELETE;
- else stock_id=Gtk::StockID("sinfg-"+iter->second.task);
+ else stock_id=Gtk::StockID("synfig-"+iter->second.task);
actions_action_group->add(Gtk::Action::create(
"action-"+iter->second.name,
}
catch(const Glib::Error& ex)
{
- sinfg::error("building menus and toolbars failed: " + ex.what());
+ synfig::error("building menus and toolbars failed: " + ex.what());
}
// Add default keyboard accelerators
if(mkdir(get_user_app_directory().c_str(),ACCESSPERMS)<0)
{
if(errno!=EEXIST)
- sinfg::error("UNABLE TO CREATE \"%s\"",get_user_app_directory().c_str());
+ synfig::error("UNABLE TO CREATE \"%s\"",get_user_app_directory().c_str());
}
else
{
- sinfg::info("Created directory \"%s\"",get_user_app_directory().c_str());
+ synfig::info("Created directory \"%s\"",get_user_app_directory().c_str());
}
try
{
- if(!SINFG_CHECK_VERSION())
+ if(!SYNFIG_CHECK_VERSION())
{
- cerr<<"FATAL: Sinfg Version Mismatch"<<endl;
- dialog_error_blocking("SINFG Studio",
- "This copy of SINFG Studio was compiled against a\n"
- "different version of libsinfg than what is currently\n"
- "installed. Sinfg Studio will now abort. Try downloading\n"
- "the latest version from the SINFG Development Website at\n"
- "http://dev.sinfg.com/ "
+ cerr<<"FATAL: Synfig Version Mismatch"<<endl;
+ dialog_error_blocking("SYNFIG Studio",
+ "This copy of SYNFIG Studio was compiled against a\n"
+ "different version of libsynfig than what is currently\n"
+ "installed. Synfig Studio will now abort. Try downloading\n"
+ "the latest version from the SYNFIG Development Website at\n"
+ "http://dev.synfig.com/ "
);
throw 40;
}
}
- catch(sinfg::SoftwareExpired)
+ catch(synfig::SoftwareExpired)
{
cerr<<"FATAL: Software Expired"<<endl;
- dialog_error_blocking("SINFG Studio",
- "This copy of SINFG Studio has expired.\n"
+ dialog_error_blocking("SYNFIG Studio",
+ "This copy of SYNFIG Studio has expired.\n"
"Please erase this copy, or download and\n"
- "install the latest copy from the SINFG\n"
- "Development Website at http://dev.sinfg.com/ ."
+ "install the latest copy from the SYNFIG\n"
+ "Development Website at http://dev.synfig.com/ ."
);
throw 39;
}
- Glib::set_application_name(_("SINFG Studio"));
+ Glib::set_application_name(_("SYNFIG Studio"));
About about_window;
about_window.set_can_self_destruct(false);
about_window.show();
shutdown_in_progress=false;
- SuperCallback sinfg_init_cb(about_window.get_callback(),0,9000,10000);
+ SuperCallback synfig_init_cb(about_window.get_callback(),0,9000,10000);
SuperCallback studio_init_cb(about_window.get_callback(),9000,10000,10000);
- // Initialize the Sinfg library
- try { sinfgapp_main=etl::smart_ptr<sinfgapp::Main>(new sinfgapp::Main(etl::dirname((*argv)[0]),&sinfg_init_cb)); }
+ // Initialize the Synfig library
+ try { synfigapp_main=etl::smart_ptr<synfigapp::Main>(new synfigapp::Main(etl::dirname((*argv)[0]),&synfig_init_cb)); }
catch(...)
{
- get_ui_interface()->error("Failed to initialize sinfg!");
+ get_ui_interface()->error("Failed to initialize synfig!");
throw;
}
// add the preferences to the settings
- sinfgapp::Main::settings().add_domain(&_preferences,"pref");
+ synfigapp::Main::settings().add_domain(&_preferences,"pref");
try
{
if(
get_ui_interface()->yes_no(
"Auto Recovery",
- "SINFG Studio seems to have crashed\n"
+ "SYNFIG Studio seems to have crashed\n"
"before you could save all your files.\n"
"Would you like to re-open those files\n"
"and recover your unsaved changes?"
- )==sinfgapp::UIInterface::RESPONSE_YES
+ )==synfigapp::UIInterface::RESPONSE_YES
)
{
if(!auto_recover->recover())
}
else
get_ui_interface()->error(
- _("SINFG Studio has attempted to recover\n"
+ _("SYNFIG Studio has attempted to recover\n"
"from a previous crash. The files that it has\n"
"recovered are NOT YET SAVED. It would be a good\n"
"idea to review them and save them now.")
save_settings();
- sinfgapp::Main::settings().remove_domain("pref");
+ synfigapp::Main::settings().remove_domain("pref");
selected_instance=0;
String
App::get_user_app_directory()
{
- return Glib::build_filename(Glib::get_home_dir(),"sinfg");
+#ifdef __APPLE__
+ return Glib::build_filename(Glib::get_home_dir(),"Library/Synfig");
+#else
+ return Glib::build_filename(Glib::get_home_dir(),"Synfig");
+#endif
}
-sinfg::String
-App::get_config_file(const sinfg::String& file)
+synfig::String
+App::get_config_file(const synfig::String& file)
{
return Glib::build_filename(get_user_app_directory(),file);
}
}
void
-App::set_time_format(sinfg::Time::Format x)
+App::set_time_format(synfig::Time::Format x)
{
_App_time_format=x;
}
if(!file)
{
- sinfg::warning("Unable to save %s",filename.c_str());
+ synfig::warning("Unable to save %s",filename.c_str());
break;
}
}while(0);
std::string filename=get_config_file("settings");
- sinfgapp::Main::settings().save_to_file(filename);
+ synfigapp::Main::settings().save_to_file(filename);
}
catch(...)
{
- sinfg::warning("Caught exception when attempting to save settings.");
+ synfig::warning("Caught exception when attempting to save settings.");
}
}
}
}
std::string filename=get_config_file("settings");
- if(!sinfgapp::Main::settings().load_from_file(filename))
+ if(!synfigapp::Main::settings().load_from_file(filename))
{
- //std::string filename=Glib::build_filename(Glib::get_home_dir(),".sinfgrc");
- //if(!sinfgapp::Main::settings().load_from_file(filename))
+ //std::string filename=Glib::build_filename(Glib::get_home_dir(),".synfigrc");
+ //if(!synfigapp::Main::settings().load_from_file(filename))
{
gamma.set_gamma(1.0/2.2);
- sinfgapp::Main::settings().set_value("dock.dialog.1.comp_selector","1");
- sinfgapp::Main::settings().set_value("dock.dialog.1.contents","navigator - info pal_edit pal_browse - tool_options history canvases - layers groups");
- sinfgapp::Main::settings().set_value("dock.dialog.1.contents_size","225 167 207");
- sinfgapp::Main::settings().set_value("dock.dialog.1.pos","1057 32");
- sinfgapp::Main::settings().set_value("dock.dialog.1.size","208 1174");
- sinfgapp::Main::settings().set_value("dock.dialog.2.comp_selector","0");
- sinfgapp::Main::settings().set_value("dock.dialog.2.contents","params children keyframes | timetrack curves meta_data");
- sinfgapp::Main::settings().set_value("dock.dialog.2.contents_size","263");
- sinfgapp::Main::settings().set_value("dock.dialog.2.pos","0 973");
- sinfgapp::Main::settings().set_value("dock.dialog.2.size","1045 235");
- sinfgapp::Main::settings().set_value("pref.distance_system","pt");
- sinfgapp::Main::settings().set_value("pref.use_colorspace_gamma","1");
- sinfgapp::Main::settings().set_value("window.toolbox.pos","4 4");
+ synfigapp::Main::settings().set_value("dock.dialog.1.comp_selector","1");
+ synfigapp::Main::settings().set_value("dock.dialog.1.contents","navigator - info pal_edit pal_browse - tool_options history canvases - layers groups");
+ synfigapp::Main::settings().set_value("dock.dialog.1.contents_size","225 167 207");
+ synfigapp::Main::settings().set_value("dock.dialog.1.pos","1057 32");
+ synfigapp::Main::settings().set_value("dock.dialog.1.size","208 1174");
+ synfigapp::Main::settings().set_value("dock.dialog.2.comp_selector","0");
+ synfigapp::Main::settings().set_value("dock.dialog.2.contents","params children keyframes | timetrack curves meta_data");
+ synfigapp::Main::settings().set_value("dock.dialog.2.contents_size","263");
+ synfigapp::Main::settings().set_value("dock.dialog.2.pos","0 973");
+ synfigapp::Main::settings().set_value("dock.dialog.2.size","1045 235");
+ synfigapp::Main::settings().set_value("pref.distance_system","pt");
+ synfigapp::Main::settings().set_value("pref.use_colorspace_gamma","1");
+ synfigapp::Main::settings().set_value("window.toolbox.pos","4 4");
}
}
}
catch(...)
{
- sinfg::warning("Caught exception when attempting to load settings.");
+ synfig::warning("Caught exception when attempting to load settings.");
}
}
return;
/*
- if((*iter)->sinfgapp::Instance::get_action_count())
+ if((*iter)->synfigapp::Instance::get_action_count())
{
- handle<sinfgapp::UIInterface> uim;
+ handle<synfigapp::UIInterface> uim;
uim=(*iter)->find_canvas_view((*iter)->get_canvas())->get_ui_interface();
assert(uim);
string str=strprintf(_("Would you like to save your changes to %s?"),(*iter)->get_file_name().c_str() );
- switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,sinfgapp::UIInterface::RESPONSE_YES))
+ switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES))
{
- case sinfgapp::UIInterface::RESPONSE_NO:
+ case synfigapp::UIInterface::RESPONSE_NO:
break;
- case sinfgapp::UIInterface::RESPONSE_YES:
+ case synfigapp::UIInterface::RESPONSE_YES:
(*iter)->save();
break;
- case sinfgapp::UIInterface::RESPONSE_CANCEL:
+ case synfigapp::UIInterface::RESPONSE_CANCEL:
return;
default:
assert(0);
}
- if((*iter)->sinfgapp::Instance::is_modified())
+ if((*iter)->synfigapp::Instance::is_modified())
{
- handle<sinfgapp::UIInterface> uim;
+ handle<synfigapp::UIInterface> uim;
uim=(*iter)->find_canvas_view((*iter)->get_canvas())->get_ui_interface();
assert(uim);
string str=strprintf(_("%s has changes not yet on the CVS repository.\nWould you like to commit these changes?"),(*iter)->get_file_name().c_str() );
- switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,sinfgapp::UIInterface::RESPONSE_YES))
+ switch(uim->yes_no_cancel((*iter)->get_canvas()->get_name(),str,synfigapp::UIInterface::RESPONSE_YES))
{
- case sinfgapp::UIInterface::RESPONSE_NO:
+ case synfigapp::UIInterface::RESPONSE_NO:
break;
- case sinfgapp::UIInterface::RESPONSE_YES:
+ case synfigapp::UIInterface::RESPONSE_YES:
(*iter)->dialog_cvs_commit();
break;
- case sinfgapp::UIInterface::RESPONSE_CANCEL:
+ case synfigapp::UIInterface::RESPONSE_CANCEL:
return;
default:
assert(0);
return false;
#else
- sinfg::String prev_path;
+ synfig::String prev_path;
if(!_preferences.get_value("curr_path",prev_path))
prev_path=".";
{
OneMoment one_moment;
- etl::handle<sinfg::Canvas> canvas(open_canvas_as(filename,as));
+ etl::handle<synfig::Canvas> canvas(open_canvas_as(filename,as));
if(canvas && get_instance(canvas))
{
get_instance(canvas)->find_canvas_view(canvas)->present();
void
App::new_instance()
{
- handle<sinfg::Canvas> canvas=sinfg::Canvas::create();
+ handle<synfig::Canvas> canvas=synfig::Canvas::create();
canvas->set_name(strprintf("Untitled%d",Instance::get_count()));
String file_name(strprintf("untitled%d.sif",Instance::get_count()));
selected_instance->redo();
}
-sinfg::String
+synfig::String
studio::App::get_base_path()
{
return app_base_path_;