**
** \legal
** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2007 Chris Moore
**
** This package is free software; you can redistribute it and/or
** modify it under the terms of the GNU General Public License as
if(find(filename.begin(),filename.end(),'*')!=filename.end())
continue;
- std::string base = basename(filename);
- if(find(base.begin(),base.end(),'.')==base.end())
+ if (filename_extension(filename) == "")
filename+=".sifz";
try
{
- String ext(String(filename.begin()+filename.find_last_of('.')+1,filename.end()));
- if(ext!="sif" && ext!="sifz" && !App::dialog_yes_no(_("Unknown extension"),
+ String ext(filename_extension(filename));
+ if(ext!=".sif" && ext!=".sifz" && !App::dialog_yes_no(_("Unknown extension"),
_("You have given the file name an extension\nwhich I do not recognise. Are you sure this is what you want?")))
- {
continue;
- }
}
catch(...)
{
studio::App::set_selected_instance(0);
}
else
- {
- studio::App::set_selected_canvas_view(studio::App::instance_list.front()->canvas_view_list().front());
- //studio::App::set_selected_instance(studio::App::instance_list.front());
- }
+ studio::App::instance_list.front()->canvas_view_list().front()->present();
}
bool
Instance::safe_close()
{
- handle<synfigapp::UIInterface> uim;
- uim=find_canvas_view(get_canvas())->get_ui_interface();
+ handle<CanvasView> canvas_view = find_canvas_view(get_canvas());
+ handle<synfigapp::UIInterface> uim=canvas_view->get_ui_interface();
+ // if the animation is currently playing, closing the window will cause a crash,
+ // so don't allow it
+ if (canvas_view->is_playing())
+ {
+ canvas_view->present();
+ App::dialog_error_blocking("Close Error", "The animation is currently playing so the window cannot be closed.");
+ return false;
+ }
if(get_action_count())
do
{
candidate_list.sort();
if(candidate_list.empty())
- synfig::warning("Action CandidateList is empty!");
+ synfig::warning("%s:%d Action CandidateList is empty!", __FILE__, __LINE__);
for(iter=candidate_list.begin();iter!=candidate_list.end();++iter)
{
candidate_list.sort();
if(candidate_list.empty())
- synfig::warning("Action CandidateList is empty!");
+ synfig::warning("%s:%d Action CandidateList is empty!", __FILE__, __LINE__);
for(iter=candidate_list.begin();iter!=candidate_list.end();++iter)
{
candidate_list.sort();
if(candidate_list.empty())
- synfig::warning("Action CandidateList is empty!");
+ synfig::warning("%s:%d Action CandidateList is empty!", __FILE__, __LINE__);
if(candidate_list2.empty())
- synfig::warning("Action CandidateList2 is empty!");
+ synfig::warning("%s:%d Action CandidateList2 is empty!", __FILE__, __LINE__);
// Seperate out the candidate lists so that there are no conflicts
for(iter=candidate_list.begin();iter!=candidate_list.end();++iter)