/[svn]/gigedit/trunk/src/gigedit/mainwindow.cpp
ViewVC logotype

Diff of /gigedit/trunk/src/gigedit/mainwindow.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1673 by schoenebeck, Wed Feb 6 22:08:29 2008 UTC revision 1714 by persson, Thu Mar 6 20:50:04 2008 UTC
# Line 18  Line 18 
18   */   */
19    
20  #include <iostream>  #include <iostream>
21    #include <cstring>
22    
23  #include <gtkmm/filechooserdialog.h>  #include <gtkmm/filechooserdialog.h>
24  #include <gtkmm/messagedialog.h>  #include <gtkmm/messagedialog.h>
# Line 752  bool MainWindow::file_save_as() Line 753  bool MainWindow::file_save_as()
753      filter.add_pattern("*.gig");      filter.add_pattern("*.gig");
754      dialog.set_filter(filter);      dialog.set_filter(filter);
755    
756      if (Glib::path_is_absolute(filename)) {      // set initial dir and filename of the Save As dialog
757          dialog.set_filename(filename);      // and prepare that initial filename as a copy of the gig
758      } else if (current_dir != "") {      {
759          dialog.set_current_folder(current_dir);          std::string basename = Glib::path_get_basename(filename);
760            std::string dir = Glib::path_get_dirname(filename);
761            basename = std::string("copy_of_") + basename;
762            Glib::ustring copyFileName = Glib::build_filename(dir, basename);
763            if (Glib::path_is_absolute(filename)) {
764                dialog.set_filename(copyFileName);
765            } else {
766                if (current_dir != "") dialog.set_current_folder(current_dir);
767            }
768            dialog.set_current_name(Glib::filename_display_basename(copyFileName));
769      }      }
770      dialog.set_current_name(Glib::filename_display_basename(filename));  
771        // show warning in the dialog
772        Gtk::HBox descriptionArea;
773        descriptionArea.set_spacing(15);
774        Gtk::Image warningIcon(Gtk::Stock::DIALOG_WARNING, Gtk::IconSize(Gtk::ICON_SIZE_DIALOG));
775        descriptionArea.pack_start(warningIcon, Gtk::PACK_SHRINK);
776        warningIcon.show();
777        Gtk::Label description;
778        description.set_markup(
779            _("\n<b>CAUTION:</b> You <b>MUST</b> use the "
780              "<span style=\"italic\">\"Save\"</span> dialog instead of "
781              "<span style=\"italic\">\"Save As...\"</span> if you want to save "
782              "to the same .gig file. Using "
783              "<span style=\"italic\">\"Save As...\"</span> for writing to the "
784              "same .gig file will end up in corrupted sample wave data!\n")
785        );
786        description.set_line_wrap(true);
787        descriptionArea.pack_start(description, Gtk::PACK_SHRINK);
788        description.show();
789        dialog.get_vbox()->pack_start(descriptionArea, Gtk::PACK_SHRINK);
790        descriptionArea.show();
791    
792      if (dialog.run() == Gtk::RESPONSE_OK) {      if (dialog.run() == Gtk::RESPONSE_OK) {
793          file_structure_to_be_changed_signal.emit(this->file);          file_structure_to_be_changed_signal.emit(this->file);

Legend:
Removed from v.1673  
changed lines
  Added in v.1714

  ViewVC Help
Powered by ViewVC