use lucida grande for clocks with all OS X versions, BUT BETTER
[ardour.git] / gtk2_ardour / export_dialog.cc
index 9da584307bd3c2d941c59ba7e775e4cdb59eea17..a64acd16801af3c2ec619e39ce1ea44bc75fba59 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <sigc++/signal.h>
 
-#include "pbd/filesystem.h"
+#include <gtkmm/messagedialog.h>
 
 #include "ardour/audioregion.h"
 #include "ardour/export_status.h"
@@ -29,6 +29,7 @@
 
 #include "export_dialog.h"
 #include "gui_thread.h"
+#include "nag.h"
 
 #include "i18n.h"
 
@@ -36,9 +37,9 @@ using namespace ARDOUR;
 using namespace PBD;
 using std::string;
 
-ExportDialog::ExportDialog (PublicEditor & editor, std::string title, std::string xml_node_name)
+ExportDialog::ExportDialog (PublicEditor & editor, std::string title, ARDOUR::ExportProfileManager::ExportType type)
   : ArdourDialog (title)
-  , xml_node_name (xml_node_name)
+  , type (type)
   , editor (editor)
 
   , warn_label ("", Gtk::ALIGN_LEFT)
@@ -63,7 +64,7 @@ ExportDialog::set_session (ARDOUR::Session* s)
        handler = _session->get_export_handler ();
        status = _session->get_export_status ();
 
-       profile_manager.reset (new ExportProfileManager (*_session, xml_node_name));
+       profile_manager.reset (new ExportProfileManager (*_session, type));
 
        /* Possibly init stuff in derived classes */
 
@@ -95,8 +96,6 @@ ExportDialog::set_session (ARDOUR::Session* s)
        channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename));
        file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename));
 
-       status->Aborting.connect (abort_connection, invalidator (*this), boost::bind (&ExportDialog::notify_errors, this), gui_context());
-
        update_warnings_and_example_filename ();
 }
 
@@ -127,17 +126,13 @@ ExportDialog::init ()
        /* Buttons */
 
        cancel_button = add_button (Gtk::Stock::CANCEL, RESPONSE_CANCEL);
-       // Realtime export is disabled for now, as it will most probably not work
-       //rt_export_button = add_button (_("Realtime Export"), RESPONSE_RT);
-       //fast_export_button = add_button (_("Fast Export"), RESPONSE_FAST);
-       fast_export_button = add_button (_("Export"), RESPONSE_FAST);
+       export_button = add_button (_("Export"), RESPONSE_FAST);
        set_default_response (RESPONSE_FAST);
 
        list_files_button.set_name ("PaddedButton");
 
        cancel_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::close_dialog));
-       //rt_export_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::export_rt));
-       fast_export_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::export_fw));
+       export_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::do_export));
 
        /* Done! */
 
@@ -189,7 +184,7 @@ ExportDialog::init_gui ()
        get_vbox()->pack_start (warning_widget, false, false, 0);
        get_vbox()->pack_start (progress_widget, false, false, 0);
 
-       advanced = Gtk::manage (new Gtk::Expander (_("Advanced options")));
+       advanced = Gtk::manage (new Gtk::Expander (_("Time span and channel options")));
        advanced->property_expanded().signal_changed().connect(
                sigc::mem_fun(*this, &ExportDialog::expanded_changed));
        advanced->add (*advanced_paned);
@@ -262,8 +257,7 @@ ExportDialog::update_warnings_and_example_filename ()
        list_files_hbox.hide ();
        list_files_string = "";
 
-       fast_export_button->set_sensitive (true);
-       //rt_export_button->set_sensitive (true);
+       export_button->set_sensitive (true);
 
        /* Add new warnings */
 
@@ -307,18 +301,10 @@ ExportDialog::show_conflicting_files ()
 }
 
 void
-ExportDialog::export_rt ()
-{
-       profile_manager->prepare_for_export ();
-       handler->do_export (true);
-       show_progress ();
-}
-
-void
-ExportDialog::export_fw ()
+ExportDialog::do_export ()
 {
        profile_manager->prepare_for_export ();
-       handler->do_export (false);
+       handler->do_export ();
        show_progress ();
 }
 
@@ -328,8 +314,7 @@ ExportDialog::show_progress ()
        status->running = true;
 
        cancel_button->set_label (_("Stop Export"));
-       //rt_export_button->set_sensitive (false);
-       fast_export_button->set_sensitive (false);
+       export_button->set_sensitive (false);
 
        progress_bar.set_fraction (0.0);
        warning_widget.hide_all();
@@ -338,6 +323,7 @@ ExportDialog::show_progress ()
        progress_connection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &ExportDialog::progress_timeout), 100);
 
        gtk_main_iteration ();
+
        while (status->running) {
                if (gtk_events_pending()) {
                        gtk_main_iteration ();
@@ -347,8 +333,18 @@ ExportDialog::show_progress ()
        }
 
        if (!status->aborted()) {
-               status->finish ();
+
+               NagScreen* ns = NagScreen::maybe_nag (_("export"));
+               
+               if (ns) {
+                       ns->nag ();
+                       delete ns;
+               }
+       } else {
+               notify_errors ();
        }
+
+       status->finish ();
 }
 
 gint
@@ -381,8 +377,7 @@ ExportDialog::progress_timeout ()
 void
 ExportDialog::add_error (string const & text)
 {
-       fast_export_button->set_sensitive (false);
-       //rt_export_button->set_sensitive (false);
+       export_button->set_sensitive (false);
 
        if (warn_string.empty()) {
                warn_string = _("<span color=\"#ffa755\">Error: ") + text + "</span>";
@@ -408,7 +403,7 @@ ExportDialog::add_warning (string const & text)
 /*** Dialog specializations ***/
 
 ExportRangeDialog::ExportRangeDialog (PublicEditor & editor, string range_id) :
-  ExportDialog (editor, _("Export Range"), X_("RangeExportProfile")),
+  ExportDialog (editor, _("Export Range"), ExportProfileManager::RangeExport),
   range_id (range_id)
 {}
 
@@ -422,7 +417,7 @@ ExportRangeDialog::init_components ()
 }
 
 ExportSelectionDialog::ExportSelectionDialog (PublicEditor & editor) :
-  ExportDialog (editor, _("Export Selection"), X_("SelectionExportProfile"))
+  ExportDialog (editor, _("Export Selection"), ExportProfileManager::SelectionExport)
 {}
 
 void
@@ -435,7 +430,7 @@ ExportSelectionDialog::init_components ()
 }
 
 ExportRegionDialog::ExportRegionDialog (PublicEditor & editor, ARDOUR::AudioRegion const & region, ARDOUR::AudioTrack & track) :
-  ExportDialog (editor, _("Export Region"), X_("RegionExportProfile")),
+  ExportDialog (editor, _("Export Region"), ExportProfileManager::RegionExport),
   region (region),
   track (track)
 {}
@@ -460,7 +455,7 @@ ExportRegionDialog::init_components ()
 }
 
 StemExportDialog::StemExportDialog (PublicEditor & editor)
-  : ExportDialog(editor, _("Stem Export"), X_("StemExportProfile"))
+  : ExportDialog(editor, _("Stem Export"), ExportProfileManager::StemExport)
 {
 
 }