From: dooglus Date: Fri, 21 Sep 2007 00:27:07 +0000 (+0000) Subject: Fixed 1799250: Add a function to update the render filename from the document filenam... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=7d58afa900b7d7792de3bf09c3b32aa4313ff4cb;p=synfig.git Fixed 1799250: Add a function to update the render filename from the document filename (plus the canvas name, if it's not the root canvas). git-svn-id: http://svn.voria.com/code@729 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/render.cpp b/synfig-studio/trunk/src/gtkmm/render.cpp index 1e098b7..4a5a4b6 100644 --- a/synfig-studio/trunk/src/gtkmm/render.cpp +++ b/synfig-studio/trunk/src/gtkmm/render.cpp @@ -177,22 +177,44 @@ RenderSettings::RenderSettings(Gtk::Window& parent,handleshow_all(); +} + +RenderSettings::~RenderSettings() +{ +} + +void +RenderSettings::set_entry_filename() +{ + String filename(canvas_interface_->get_canvas()->get_file_name()); + + // if the basename of the filename has an extension, remove it + String base = basename(filename); + if(find(base.begin(),base.end(),'.')!=base.end()) + filename = String(filename.begin(), filename.begin()+filename.find_last_of('.')); + + // if this isn't the root canvas, append () to the filename + etl::handle canvas = canvas_interface_->get_canvas(); + if (!canvas->is_root()) + if(canvas->get_name().empty()) + filename+=" ("+canvas->get_id()+')'; + else + filename+=" ("+canvas->get_name()+')'; + + filename += ".png"; try { - entry_filename.set_text(Glib::build_filename(Glib::get_home_dir(),Glib::ustring("Desktop")+ETL_DIRECTORY_SEPARATOR+Glib::ustring("output.png"))); + entry_filename.set_text((filename)); } catch(...) { synfig::warning("Averted crash!"); entry_filename.set_text("output.png"); } - - get_vbox()->show_all(); -} - -RenderSettings::~RenderSettings() -{ } void