Make export type an enum and pass it to the profile manager instead of the xml node...
authorSakari Bergen <sakari.bergen@beatwaves.net>
Fri, 7 Dec 2012 21:58:33 +0000 (21:58 +0000)
committerSakari Bergen <sakari.bergen@beatwaves.net>
Fri, 7 Dec 2012 21:58:33 +0000 (21:58 +0000)
Use this to always include the channel configuration name in stem exports.

git-svn-id: svn://localhost/ardour2/branches/3.0@13616 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/editor_export_audio.cc
gtk2_ardour/export_dialog.cc
gtk2_ardour/export_dialog.h
libs/ardour/ardour/export_profile_manager.h
libs/ardour/export_profile_manager.cc

index 94f43a0e5ec8808a63e0bdacee560cce1ac8abe1..78e7674042b69da0d399dceff5dde01ba45026f2 100644 (file)
@@ -60,7 +60,7 @@ using namespace Gtk;
 void
 Editor::export_audio ()
 {
-       ExportDialog dialog (*this, _("Export"), X_("ExportProfile"));
+       ExportDialog dialog (*this, _("Export"), ExportProfileManager::RegularExport);
        dialog.set_session (_session);
        dialog.run();
 }
index 5e6812429a15ab6e093165c252cc2041f21ddc99..a64acd16801af3c2ec619e39ce1ea44bc75fba59 100644 (file)
@@ -37,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)
@@ -64,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 */
 
@@ -403,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)
 {}
 
@@ -417,7 +417,7 @@ ExportRangeDialog::init_components ()
 }
 
 ExportSelectionDialog::ExportSelectionDialog (PublicEditor & editor) :
-  ExportDialog (editor, _("Export Selection"), X_("SelectionExportProfile"))
+  ExportDialog (editor, _("Export Selection"), ExportProfileManager::SelectionExport)
 {}
 
 void
@@ -430,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)
 {}
@@ -455,7 +455,7 @@ ExportRegionDialog::init_components ()
 }
 
 StemExportDialog::StemExportDialog (PublicEditor & editor)
-  : ExportDialog(editor, _("Stem Export"), X_("StemExportProfile"))
+  : ExportDialog(editor, _("Stem Export"), ExportProfileManager::StemExport)
 {
 
 }
index 066b594812c735c70822e485ba96ab076ac23f30..52c53660d865a17e78fa7e4f7e8e27406346612a 100644 (file)
@@ -47,7 +47,7 @@ class ExportDialog : public ArdourDialog {
 
   public:
 
-       ExportDialog (PublicEditor & editor, std::string title, std::string xml_node_name);
+       ExportDialog (PublicEditor & editor, std::string title, ARDOUR::ExportProfileManager::ExportType type);
        ~ExportDialog ();
 
        void set_session (ARDOUR::Session* s);
@@ -65,7 +65,7 @@ class ExportDialog : public ArdourDialog {
        typedef boost::shared_ptr<ARDOUR::ExportHandler> HandlerPtr;
        typedef boost::shared_ptr<ARDOUR::ExportProfileManager> ManagerPtr;
 
-       std::string     xml_node_name;
+       ARDOUR::ExportProfileManager::ExportType type;
        HandlerPtr      handler;
        ManagerPtr      profile_manager;
 
index 31e93a5b8974530a718c06f78d9552f08be7e251..82b32fb032a8939fc8b04058d8cadf0d83647051 100644 (file)
@@ -50,7 +50,15 @@ class ExportProfileManager
 {
   public:
 
-       ExportProfileManager (Session & s, std::string xml_node_name);
+       enum ExportType {
+               RegularExport,
+               RangeExport,
+               SelectionExport,
+               RegionExport,
+               StemExport
+       };
+
+       ExportProfileManager (Session & s, ExportType type);
        ~ExportProfileManager ();
 
        void load_profile ();
@@ -70,7 +78,8 @@ class ExportProfileManager
        typedef std::pair<PBD::UUID, std::string> FilePair;
        typedef std::map<PBD::UUID, std::string> FileMap;
 
-       std::string const xml_node_name;
+       ExportType type;
+       std::string xml_node_name;
        HandlerPtr  handler;
        Session &   session;
 
index af7f6a73f810cbcaaf8663a177e4395dc59316d7..deeb3aea2b07862873f43945d642f73b8ba70c7e 100644 (file)
@@ -56,8 +56,8 @@ using namespace PBD;
 namespace ARDOUR
 {
 
-ExportProfileManager::ExportProfileManager (Session & s, std::string xml_node_name)
-  : xml_node_name (xml_node_name)
+ExportProfileManager::ExportProfileManager (Session & s, ExportType type)
+  : type(type)
   , handler (s.get_export_handler())
   , session (s)
 
@@ -67,6 +67,24 @@ ExportProfileManager::ExportProfileManager (Session & s, std::string xml_node_na
 
   , format_list (new FormatList ())
 {
+       switch(type) {
+       case RegularExport:
+               xml_node_name = X_("ExportProfile");
+               break;
+       case RangeExport:
+               xml_node_name = X_("RangeExportProfile");
+               break;
+       case SelectionExport:
+               xml_node_name = X_("SelectionExportProfile");
+               break;
+       case RegionExport:
+               xml_node_name = X_("RegionExportProfile");
+               break;
+       case StemExport:
+               xml_node_name = X_("StemExportProfile");
+               break;
+       }
+
        /* Initialize path variables */
 
        export_config_dir = Glib::build_filename (user_config_directory(), export_dir_name);
@@ -139,7 +157,8 @@ ExportProfileManager::prepare_for_export ()
                        }
 
                        // ...and each channel config
-                       filename->include_channel_config = (channel_configs.size() > 1);
+                       filename->include_channel_config = (type == StemExport) ||
+                                                          (channel_configs.size() > 1);
                        for(ChannelConfigStateList::iterator cc_it = channel_configs.begin(); cc_it != channel_configs.end(); ++cc_it) {
                                handler->add_export_config (*ts_it, (*cc_it)->config, (*format_it)->format, filename, b);
                        }