X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Fapp.cpp;h=14fc4b175488935736dedd25a1fa9ff5e276e289;hb=7dd8043ef6511adc0eadcd9f011da4cdfdb7536b;hp=277cc80397285872c35f129a380e4b5e25eb7f46;hpb=67567152a10173ae01e29eeda32267160c3c96c4;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/app.cpp b/synfig-studio/trunk/src/gtkmm/app.cpp index 277cc80..14fc4b1 100644 --- a/synfig-studio/trunk/src/gtkmm/app.cpp +++ b/synfig-studio/trunk/src/gtkmm/app.cpp @@ -5,16 +5,17 @@ ** $Id: app.cpp,v 1.11 2005/03/24 21:47:28 darco Exp $ ** ** \legal -** Copyright (c) 2002 Robert B. Quattlebaum Jr. +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley ** -** This software and associated documentation -** are CONFIDENTIAL and PROPRIETARY property of -** the above-mentioned copyright holder. +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. ** -** You may not copy, print, publish, or in any -** other way distribute this software without -** a prior written agreement with -** the copyright holder. +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. ** \endlegal */ /* ========================================================================= */ @@ -31,6 +32,9 @@ #include #include +#ifdef HAVE_SYS_ERRNO_H +#include +#endif #include #include #include @@ -109,9 +113,12 @@ #endif #ifdef WIN32 +#define _WIN32_WINNT 0x0500 #include #endif #include +#include +#include #endif @@ -654,7 +661,7 @@ public: } }; -static Preferences _preferences; +static ::Preferences _preferences; void init_ui_manager() @@ -1649,6 +1656,21 @@ App::dialog_open_file(const std::string &title, std::string &filename) if(!_preferences.get_value("curr_path",prev_path)) prev_path="."; + Gtk::FileChooserDialog *dialog=new Gtk::FileChooserDialog(title,Gtk::FILE_CHOOSER_ACTION_OPEN); + dialog->set_current_folder(prev_path); + dialog->add_button(Gtk::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT); + dialog->add_button(Gtk::StockID("gtk-cancel"),GTK_RESPONSE_CANCEL); + if(!filename.empty()) + dialog->set_filename(filename); + if(dialog->run()==GTK_RESPONSE_ACCEPT) { + filename=dialog->get_filename(); + delete dialog; + return true; + } + delete dialog; + return false; + /* + GtkWidget *ok; GtkWidget *cancel; int val=0; @@ -1690,6 +1712,7 @@ App::dialog_open_file(const std::string &title, std::string &filename) } gtk_widget_destroy(fileselection); return true; + */ #endif } @@ -1738,7 +1761,24 @@ App::dialog_save_file(const std::string &title, std::string &filename) } return false; #else - return dialog_open_file(title, filename); + synfig::String prev_path; + if(!_preferences.get_value("curr_path",prev_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::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT); + dialog->add_button(Gtk::StockID("gtk-cancel"),GTK_RESPONSE_CANCEL); + if(!filename.empty()) + dialog->set_filename(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 } @@ -1787,7 +1827,24 @@ App::dialog_saveas_file(const std::string &title, std::string &filename) } return false; #else - return dialog_open_file(title, filename); + synfig::String prev_path; + if(!_preferences.get_value("curr_path",prev_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::StockID("gtk-ok"),GTK_RESPONSE_ACCEPT); + dialog->add_button(Gtk::StockID("gtk-cancel"),GTK_RESPONSE_CANCEL); + if(!filename.empty()) + dialog->set_filename(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 } @@ -1923,6 +1980,12 @@ App::open(std::string filename) bool App::open_as(std::string filename,std::string as) { +#ifdef WIN32 + char long_name[1024]; + if(GetLongPathName(as.c_str(),long_name,sizeof(long_name))); + as=long_name; +#endif + try { OneMoment one_moment;