From adc1af4fb0c51317dc3a237c0d11bf05e768ad86 Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 17 Sep 2007 23:01:17 +0000 Subject: [PATCH] App::dialog_saveas_file() and App::dialog_save_file() are identical. Deleted one of them. git-svn-id: http://svn.voria.com/code@701 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/app.cpp | 73 ++---------------------------- synfig-studio/trunk/src/gtkmm/app.h | 1 - synfig-studio/trunk/src/gtkmm/instance.cpp | 12 ++--- synfig-studio/trunk/src/gtkmm/render.cpp | 2 +- 4 files changed, 10 insertions(+), 78 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/app.cpp b/synfig-studio/trunk/src/gtkmm/app.cpp index d665c41..d004654 100644 --- a/synfig-studio/trunk/src/gtkmm/app.cpp +++ b/synfig-studio/trunk/src/gtkmm/app.cpp @@ -1768,76 +1768,6 @@ App::dialog_open_file(const std::string &title, std::string &filename) bool App::dialog_save_file(const std::string &title, std::string &filename) { -#ifdef USE_WIN32_FILE_DIALOGS - static TCHAR szFilter[] = TEXT ("All Files (*.*)\0*.*\0\0") ; - - GdkWindow *gdkWinPtr=toolbox->get_window()->gobj(); - HINSTANCE hInstance=static_cast(GetModuleHandle(NULL)); - HWND hWnd=static_cast(GDK_WINDOW_HWND(gdkWinPtr)); - - ofn.lStructSize=sizeof(OPENFILENAME); - ofn.hwndOwner = hWnd; - ofn.hInstance = hInstance; - ofn.lpstrFilter = szFilter; -// ofn.lpstrCustomFilter=NULL; -// ofn.nMaxCustFilter=0; -// ofn.nFilterIndex=0; -// ofn.lpstrFile=NULL; - ofn.nMaxFile=MAX_PATH; -// ofn.lpstrFileTitle=NULL; -// ofn.lpstrInitialDir=NULL; -// ofn.lpstrTitle=NULL; - ofn.Flags=OFN_OVERWRITEPROMPT; -// ofn.nFileOffset=0; -// ofn.nFileExtension=0; - ofn.lpstrDefExt=TEXT("sif"); -// ofn.lCustData = 0l; - ofn.lpfnHook=NULL; -// ofn.lpTemplateName=NULL; - - CHAR szFilename[MAX_PATH]; - CHAR szTitle[500]; - strcpy(szFilename,filename.c_str()); - strcpy(szTitle,title.c_str()); - - ofn.lpstrFile=szFilename; - ofn.lpstrFileTitle=szTitle; - - if(GetSaveFileName(&ofn)) - { - filename=szFilename; - return true; - } - return false; -#else - synfig::String prev_path; - if(!_preferences.get_value("curr_path",prev_path)) - prev_path="."; - prev_path = absolute_path(prev_path); - - Gtk::FileChooserDialog *dialog=new Gtk::FileChooserDialog(title,Gtk::FILE_CHOOSER_ACTION_SAVE); - dialog->set_current_folder(prev_path); - dialog->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - dialog->add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_ACCEPT); - if(!filename.empty()) - if (is_absolute_path(filename)) - dialog->set_filename(filename); - else - dialog->set_filename(prev_path + ETL_DIRECTORY_SEPARATOR + filename); - if(dialog->run()==GTK_RESPONSE_ACCEPT) { - filename=dialog->get_filename(); - delete dialog; - return true; - } - delete dialog; - return false; -// return dialog_open_file(title, filename); -#endif -} - -bool -App::dialog_saveas_file(const std::string &title, std::string &filename) -{ #if USE_WIN32_FILE_DIALOGS static TCHAR szFilter[] = TEXT ("All Files (*.*)\0*.*\0\0") ; @@ -2009,6 +1939,9 @@ App::open(std::string filename) return open_as(filename,filename); } +// this is called from autorecover.cpp: +// App::open_as(get_shadow_file_name(filename),filename) +// other than that, 'filename' and 'as' are the same bool App::open_as(std::string filename,std::string as) { diff --git a/synfig-studio/trunk/src/gtkmm/app.h b/synfig-studio/trunk/src/gtkmm/app.h index b4cf757..98c1da8 100644 --- a/synfig-studio/trunk/src/gtkmm/app.h +++ b/synfig-studio/trunk/src/gtkmm/app.h @@ -306,7 +306,6 @@ public: static bool dialog_open_file(const std::string &title, std::string &filename); static bool dialog_save_file(const std::string &title, std::string &filename); - static bool dialog_saveas_file(const std::string &title, std::string &filename); static void dialog_error_blocking(const std::string &title, const std::string &message); diff --git a/synfig-studio/trunk/src/gtkmm/instance.cpp b/synfig-studio/trunk/src/gtkmm/instance.cpp index 7d9900d..185acca 100644 --- a/synfig-studio/trunk/src/gtkmm/instance.cpp +++ b/synfig-studio/trunk/src/gtkmm/instance.cpp @@ -253,12 +253,12 @@ studio::Instance::dialog_save_as() } // show the canvas' name if it has one, else its ID - while(App::dialog_saveas_file(_("Choose a Filename to Save As") + - String(" (") + - (canvas->get_name().empty() - ? canvas->get_id() - : canvas->get_name()) + - ") ...", filename)) + while(App::dialog_save_file(_("Choose a Filename to Save As") + + String(" (") + + (canvas->get_name().empty() + ? canvas->get_id() + : canvas->get_name()) + + ") ...", filename)) { // If the filename still has wildcards, then we should // continue looking for the file we want diff --git a/synfig-studio/trunk/src/gtkmm/render.cpp b/synfig-studio/trunk/src/gtkmm/render.cpp index 4b2f2b2..1e098b7 100644 --- a/synfig-studio/trunk/src/gtkmm/render.cpp +++ b/synfig-studio/trunk/src/gtkmm/render.cpp @@ -211,7 +211,7 @@ void RenderSettings::on_choose_pressed() { String filename=entry_filename.get_text(); - if(App::dialog_saveas_file("Save Render As",filename)) + if(App::dialog_save_file("Save Render As",filename)) entry_filename.set_text(filename); } -- 2.7.4