Apply patch from mantis 2761 from tinram to add padding and make a string translatable.
[ardour.git] / gtk2_ardour / export_dialog.cc
index 7ae81a016aecc64a15bff599dd7ef3ed0128da2e..fd39aca3355e105b1303a408cfa48a155bfcf17b 100644 (file)
 
 #include <sigc++/signal.h>
 
-#include <pbd/filesystem.h>
+#include "pbd/filesystem.h"
 
-#include <ardour/export_status.h>
-#include <ardour/export_handler.h>
+#include "ardour/export_status.h"
+#include "ardour/export_handler.h"
 
 using namespace ARDOUR;
 using namespace PBD;
@@ -45,8 +45,6 @@ ExportDialog::~ExportDialog ()
 void
 ExportDialog::set_session (ARDOUR::Session* s)
 {
-       init ();
-
        session = s;
        
        /* Init handler and profile manager */
@@ -55,6 +53,12 @@ ExportDialog::set_session (ARDOUR::Session* s)
        status = session->get_export_status ();
        profile_manager.reset (new ExportProfileManager (*session));
        
+       /* Possibly init stuff in derived classes */
+       
+       init ();
+       
+       /* Rest of session related initialization */
+       
        preset_selector->set_manager (profile_manager);
        file_notebook->set_session_and_manager (session, profile_manager);
        
@@ -111,9 +115,11 @@ ExportDialog::init ()
        /* Buttons */
        
        cancel_button = add_button (Gtk::Stock::CANCEL, RESPONSE_CANCEL);
-       rt_export_button = add_button (_("Realtime export"), RESPONSE_RT);
+       rt_export_button = add_button (_("Realtime Export"), RESPONSE_RT);
        fast_export_button = add_button (_("Fast Export"), 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));
@@ -133,14 +139,14 @@ ExportDialog::init_gui ()
        get_vbox()->pack_start (*preset_align, false, false, 0);
        
        Gtk::Alignment * timespan_align = Gtk::manage (new Gtk::Alignment());
-       Gtk::Label * timespan_label = Gtk::manage (new Gtk::Label (_("Time Span"), Gtk::ALIGN_LEFT));
+       timespan_label = Gtk::manage (new Gtk::Label (_("Time Span"), Gtk::ALIGN_LEFT));
        timespan_align->add (*timespan_selector);
        timespan_align->set_padding (0, 12, 18, 0);
        get_vbox()->pack_start (*timespan_label, false, false, 0);
        get_vbox()->pack_start (*timespan_align, false, false, 0);
        
        Gtk::Alignment * channels_align = Gtk::manage (new Gtk::Alignment());
-       Gtk::Label * channels_label = Gtk::manage (new Gtk::Label (_("Channels"), Gtk::ALIGN_LEFT));
+       channels_label = Gtk::manage (new Gtk::Label (_("Channels"), Gtk::ALIGN_LEFT));
        channels_align->add (*channel_selector);
        channels_align->set_padding (0, 12, 18, 0);
        get_vbox()->pack_start (*channels_label, false, false, 0);
@@ -162,8 +168,8 @@ void
 ExportDialog::init_components ()
 {
        preset_selector.reset (new ExportPresetSelector ());
-       timespan_selector.reset (new ExportTimespanSelectorMultiple ());
-       channel_selector.reset (new ExportChannelSelector ());
+       timespan_selector.reset (new ExportTimespanSelectorMultiple (session, profile_manager));
+       channel_selector.reset (new PortExportChannelSelector (session, profile_manager));
        file_notebook.reset (new ExportFileNotebook ());
 }
 
@@ -192,8 +198,8 @@ ExportDialog::close_dialog ()
 void
 ExportDialog::sync_with_manager ()
 {
-       timespan_selector->set_state (profile_manager->get_timespans().front(), session);
-       channel_selector->set_state (profile_manager->get_channel_configs().front(), session);
+       timespan_selector->sync_with_manager();
+       channel_selector->sync_with_manager();
        file_notebook->sync_with_manager ();
 
        update_warnings ();
@@ -228,7 +234,7 @@ ExportDialog::update_warnings ()
        if (!warnings->conflicting_filenames.empty()) {
                list_files_hbox.show ();
                for (std::list<Glib::ustring>::iterator it = warnings->conflicting_filenames.begin(); it != warnings->conflicting_filenames.end(); ++it) {
-                       ustring::size_type pos = it->find_last_of ("/");
+                       Glib::ustring::size_type pos = it->find_last_of ("/");
                        list_files_string += "\n" + it->substr (0, pos + 1) + "<b>" + it->substr (pos + 1) + "</b>";
                }
        }
@@ -357,8 +363,8 @@ void
 ExportRangeDialog::init_components ()
 {
        preset_selector.reset (new ExportPresetSelector ());
-       timespan_selector.reset (new ExportTimespanSelectorSingle (range_id));
-       channel_selector.reset (new ExportChannelSelector ());
+       timespan_selector.reset (new ExportTimespanSelectorSingle (session, profile_manager, range_id));
+       channel_selector.reset (new PortExportChannelSelector (session, profile_manager));
        file_notebook.reset (new ExportFileNotebook ());
 }
 
@@ -370,7 +376,32 @@ void
 ExportSelectionDialog::init_components ()
 {
        preset_selector.reset (new ExportPresetSelector ());
-       timespan_selector.reset (new ExportTimespanSelectorSingle (X_("selection")));
-       channel_selector.reset (new ExportChannelSelector ());
+       timespan_selector.reset (new ExportTimespanSelectorSingle (session, profile_manager, X_("selection")));
+       channel_selector.reset (new PortExportChannelSelector (session, profile_manager));
+       file_notebook.reset (new ExportFileNotebook ());
+}
+
+ExportRegionDialog::ExportRegionDialog (PublicEditor & editor, ARDOUR::AudioRegion const & region, ARDOUR::AudioTrack & track) :
+  ExportDialog (editor, _("Export Region")),
+  region (region),
+  track (track)
+{}
+
+void
+ExportRegionDialog::init_gui ()
+{
+       ExportDialog::init_gui ();
+       
+       channels_label->set_text (_("Source"));
+}
+
+void
+ExportRegionDialog::init_components ()
+{
+       Glib::ustring loc_id = profile_manager->set_single_range (region.position(), region.position() + region.length(), region.name());
+
+       preset_selector.reset (new ExportPresetSelector ());
+       timespan_selector.reset (new ExportTimespanSelectorSingle (session, profile_manager, loc_id));
+       channel_selector.reset (new RegionExportChannelSelector (session, profile_manager, region, track));
        file_notebook.reset (new ExportFileNotebook ());
 }