** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
** Copyright (c) 2007, 2008 Chris Moore
** Copyright (c) 2008 Gerald Young
+** Copyright (c) 2008 Carlos López
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
bool studio::App::single_threaded=false;
#endif
bool studio::App::restrict_radius_ducks=false;
+String studio::App::custom_filename_prefix(DEFAULT_FILENAME_PREFIX);
+int studio::App::preferred_x_size=480;
+int studio::App::preferred_y_size=270;
+String studio::App::predefined_size(DEFAULT_PREDEFINED_SIZE);
#ifdef USE_OPEN_FOR_URLS
String studio::App::browser_command("open"); // MacOS only
#else
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;
+ }
+
return synfigapp::Settings::get_value(key,value);
}
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;
+ }
return synfigapp::Settings::set_value(key,value);
}
ret.push_back("auto_recover_backup_interval");
ret.push_back("restrict_radius_ducks");
ret.push_back("browser_command");
+ ret.push_back("custom_filename_prefix");
+ ret.push_back("preferred_x_size");
+ ret.push_back("preferred_y_size");
+ ret.push_back("predefined_size");
return ret;
}
};
if(!getenv("SYNFIG_DISABLE_DRAW" )) state_manager->add_state(&state_draw); // Enabled for now. Let's see whether they're good enough yet.
if(!getenv("SYNFIG_DISABLE_SKETCH" )) state_manager->add_state(&state_sketch);
-
- // Disabled by default - it doesn't work properly?
- if(getenv("SYNFIG_ENABLE_WIDTH" )) state_manager->add_state(&state_width);
+ if(!getenv("SYNFIG_DISABLE_WIDTH" )) state_manager->add_state(&state_width); // Enabled since 0.61.09
studio_init_cb.task(_("Init ModPalette..."));
module_list_.push_back(new ModPalette()); module_list_.back()->start();
{
if(!window_size_broken && !file_window_size)
window_size_broken = true;
- if(!window_size_broken)
- add_recent_file(recent_file,recent_file_window_size);
- else
- add_recent_file(recent_file);
+ if (std::ifstream(recent_file.c_str()))
+ {
+ if(!window_size_broken)
+ add_recent_file(recent_file,recent_file_window_size);
+ else
+ add_recent_file(recent_file);
+ }
}
}
if(!window_size_broken && file_window_size)
synfigapp::Main::settings().set_value("pref.single_threaded","0");
#endif
synfigapp::Main::settings().set_value("pref.restrict_radius_ducks","0");
+ synfigapp::Main::settings().set_value("pref.custom_filename_prefix",DEFAULT_FILENAME_PREFIX);
+ synfigapp::Main::settings().set_value("pref.preferred_x_size","480");
+ synfigapp::Main::settings().set_value("pref.preferred_y_size","270");
+ synfigapp::Main::settings().set_value("pref.predefined_size",DEFAULT_PREDEFINED_SIZE);
synfigapp::Main::settings().set_value("window.toolbox.pos","4 4");
}
if(dialog->run() == GTK_RESPONSE_ACCEPT) {
filename = dialog->get_filename();
- info("Saving preference %s = '%s' in App::dialog_open_file()", preference.c_str(), dirname(filename).c_str());
+ // info("Saving preference %s = '%s' in App::dialog_open_file()", preference.c_str(), dirname(filename).c_str());
_preferences.set_value(preference, dirname(filename));
delete dialog;
return true;
if (preference == ANIMATION_DIR_PREFERENCE)
set_file_version(synfig::ReleaseVersion(file_type_enum->get_value()));
filename = dialog->get_filename();
- info("Saving preference %s = '%s' in App::dialog_save_file()", preference.c_str(), dirname(filename).c_str());
+ // info("Saving preference %s = '%s' in App::dialog_save_file()", preference.c_str(), dirname(filename).c_str());
_preferences.set_value(preference, dirname(filename));
delete dialog;
return true;
try
{
OneMoment one_moment;
+ String errors;
- etl::handle<synfig::Canvas> canvas(open_canvas_as(filename,as));
+ etl::handle<synfig::Canvas> canvas(open_canvas_as(filename,as,errors));
if(canvas && get_instance(canvas))
{
get_instance(canvas)->find_canvas_view(canvas)->present();
else
{
if(!canvas)
- throw (String)strprintf(_("Unable to open file \"%s\""),filename.c_str());
+ throw (String)strprintf(_("Unable to load \"%s\":\n\n"),filename.c_str()) + errors;
- if (as.find(DEFAULT_FILENAME_PREFIX) != 0)
+ if (as.find(custom_filename_prefix.c_str()) != 0)
add_recent_file(as);
handle<Instance> instance(Instance::create(canvas));
{
handle<synfig::Canvas> canvas=synfig::Canvas::create();
- String file_name(strprintf("%s%d", DEFAULT_FILENAME_PREFIX, Instance::get_count()+1));
+ String file_name(strprintf("%s%d", App::custom_filename_prefix.c_str(), Instance::get_count()+1));
canvas->set_name(file_name);
file_name += ".sifz";
canvas->rend_desc().set_time_end(5.0);
canvas->rend_desc().set_x_res(DPI2DPM(72.0f));
canvas->rend_desc().set_y_res(DPI2DPM(72.0f));
- canvas->rend_desc().set_tl(Vector(-4,2.25));
- canvas->rend_desc().set_br(Vector(4,-2.25));
- canvas->rend_desc().set_w(480);
- canvas->rend_desc().set_h(270);
+ // The top left and botton right positions are expressed in units
+ // Original convention is that 1 unit = 60 pixels
+ canvas->rend_desc().set_tl(Vector(-(preferred_x_size/60.0)/2.0,(preferred_y_size/60.0)/2.0));
+ canvas->rend_desc().set_br(Vector((preferred_x_size/60.0)/2.0,-(preferred_y_size/60.0)/2.0));
+ canvas->rend_desc().set_w(preferred_x_size);
+ canvas->rend_desc().set_h(preferred_y_size);
canvas->rend_desc().set_antialias(1);
canvas->rend_desc().set_flags(RendDesc::PX_ASPECT|RendDesc::IM_SPAN);
canvas->set_file_name(file_name);