From 3ce4684ba034e0e9e3c7b78768560dcf31d07b12 Mon Sep 17 00:00:00 2001 From: dooglus Date: Wed, 19 Sep 2007 12:53:55 +0000 Subject: [PATCH] If the user choses to save his work using the default name ("Synfig Animation 1.sifz", for example), don't keep showing the 'Save As' selector and warning about file overwriting each time she saves. Also moved the string "Synfig Animation " into a single #define rather than having it appear in multiple places in the code. git-svn-id: http://svn.voria.com/code@721 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/app.cpp | 4 ++-- synfig-studio/trunk/src/gtkmm/instance.cpp | 6 ++++-- synfig-studio/trunk/src/gtkmm/instance.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/app.cpp b/synfig-studio/trunk/src/gtkmm/app.cpp index 5444784..a9c95e3 100644 --- a/synfig-studio/trunk/src/gtkmm/app.cpp +++ b/synfig-studio/trunk/src/gtkmm/app.cpp @@ -2009,9 +2009,9 @@ void App::new_instance() { handle canvas=synfig::Canvas::create(); - canvas->set_name(strprintf("Synfig Animation %d",Instance::get_count()+1)); + canvas->set_name(strprintf("%s%d", DEFAULT_FILENAME_PREFIX, Instance::get_count()+1)); - String file_name(strprintf("Synfig Animation %d.sifz",Instance::get_count()+1)); + String file_name(strprintf("%s%d.sifz", DEFAULT_FILENAME_PREFIX, Instance::get_count()+1)); canvas->rend_desc().set_frame_rate(24.0); canvas->rend_desc().set_time_start(0.0); diff --git a/synfig-studio/trunk/src/gtkmm/instance.cpp b/synfig-studio/trunk/src/gtkmm/instance.cpp index 122e96b..a82c89b 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.cpp +++ b/synfig-studio/trunk/src/gtkmm/instance.cpp @@ -198,14 +198,16 @@ studio::Instance::save_as(const synfig::String &file_name) bool studio::Instance::save() { - if(basename(get_file_name()).find("Synfig Animation")==0) + // the filename will be set to "Synfig Animation 1" or some such when first created + // and will be changed to an absolute path once it has been saved + // so if it still begins with "Synfig Animation " then we need to ask where to save it + if(get_file_name().find(DEFAULT_FILENAME_PREFIX)==0) { dialog_save_as(); return true; } return synfigapp::Instance::save(); - } void diff --git a/synfig-studio/trunk/src/gtkmm/instance.h b/synfig-studio/trunk/src/gtkmm/instance.h index 21b7b22..2768fac 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.h +++ b/synfig-studio/trunk/src/gtkmm/instance.h @@ -37,6 +37,7 @@ #include /* === M A C R O S ========================================================= */ +#define DEFAULT_FILENAME_PREFIX _("Synfig Animation ") // will be followed by a different number for each document /* === T Y P E D E F S ===================================================== */ -- 2.7.4