App::dialog_saveas_file() and App::dialog_save_file() are identical. Deleted one...
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 17 Sep 2007 23:01:17 +0000 (23:01 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Mon, 17 Sep 2007 23:01:17 +0000 (23:01 +0000)
git-svn-id: http://svn.voria.com/code@701 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/app.cpp
synfig-studio/trunk/src/gtkmm/app.h
synfig-studio/trunk/src/gtkmm/instance.cpp
synfig-studio/trunk/src/gtkmm/render.cpp

index d665c41..d004654 100644 (file)
@@ -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<HINSTANCE>(GetModuleHandle(NULL));
-       HWND hWnd=static_cast<HWND>(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)
 {
index b4cf757..98c1da8 100644 (file)
@@ -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);
 
index 7d9900d..185acca 100644 (file)
@@ -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
index 4b2f2b2..1e098b7 100644 (file)
@@ -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);
 }