minor fixes/changes based on comparison with existing bindings
[ardour.git] / gtk2_ardour / export_range_markers_dialog.cc
index 2a1e2a9af4e7d99441332bac6196b9b451d8aa84..df612a340d1a6df22e3fd1544eb04e61a1bda64f 100644 (file)
@@ -22,8 +22,8 @@
 
 #include <sstream>
 
-#include <ardour/audioengine.h>
-#include <ardour/sndfile_helpers.h>
+#include "ardour/audioengine.h"
+#include "ardour/sndfile_helpers.h"
 
 #include "ardour_ui.h"
 #include "export_range_markers_dialog.h"
@@ -38,15 +38,23 @@ using namespace std;
 ExportRangeMarkersDialog::ExportRangeMarkersDialog (PublicEditor& editor) 
        : ExportDialog(editor)
 { 
+       set_title (_("ardour: export ranges"));
+       file_frame.set_label (_("Export to Directory"));
+
        do_not_allow_export_cd_markers();
        
        total_duration = 0;
        current_range_marker_index = 0;
 }
-       
+
+Gtk::FileChooserAction
+ExportRangeMarkersDialog::browse_action () const
+{
+       return Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER;
+}
        
 void 
-ExportRangeMarkersDialog::export_audio_data ()
+ExportRangeMarkersDialog::export_data ()
 {
        getSession().locations()->apply(*this, &ExportRangeMarkersDialog::process_range_markers_export);
 }
@@ -57,7 +65,7 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList&
        Locations::LocationList::iterator locationIter;
        current_range_marker_index = 0;
        init_progress_computing(locations);
-       
+
        for (locationIter = locations.begin(); locationIter != locations.end(); ++locationIter) {
                Location *currentLocation = (*locationIter);
 
@@ -73,16 +81,15 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList&
                        spec.start_frame = currentLocation->start();
                        spec.end_frame = currentLocation->end();
 
-                       getSession().request_locate(spec.start_frame, false);
-
-                       if (getSession().start_audio_export(spec)){
+                       if (getSession().start_export(spec)){
                                // if export fails                      
                                return;
                        }
 
                        // wait until export of this range finished
                        gtk_main_iteration();
-                       while(spec.running){
+
+                       while (spec.running){
                                if(gtk_events_pending()){
                                        gtk_main_iteration();
                                }else {
@@ -91,6 +98,8 @@ ExportRangeMarkersDialog::process_range_markers_export(Locations::LocationList&
                        }
                        
                        current_range_marker_index++;
+                       
+                       getSession().stop_export (spec);
                }
        }
        
@@ -122,7 +131,6 @@ ExportRangeMarkersDialog::get_target_filepath(string path, string filename, stri
        return target_filepath;
 }
 
-
 bool
 ExportRangeMarkersDialog::is_filepath_valid(string &filepath)
 {
@@ -139,10 +147,10 @@ ExportRangeMarkersDialog::is_filepath_valid(string &filepath)
        
        if ( (stat (filepath.c_str(), &statbuf) != 0) || 
                (!S_ISDIR (statbuf.st_mode)) ) {
-                       string txt = _("Please select an existing target directory. Files are not allowed!");
-                       MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);
-                       msg.run();
-                       return false;
+               string txt = _("Please select an existing target directory. Files are not allowed!");
+               MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);
+               msg.run();
+               return false;
        }
        
        // directory needs to exist and be writable
@@ -157,7 +165,6 @@ ExportRangeMarkersDialog::is_filepath_valid(string &filepath)
        return true;
 }
 
-
 void
 ExportRangeMarkersDialog::init_progress_computing(Locations::LocationList& locations)
 {
@@ -189,12 +196,6 @@ ExportRangeMarkersDialog::progress_timeout ()
 {
        double progress = 0.0;
 
-       cerr << "Progress timeout, total = " << total_duration << " index = " << current_range_marker_index
-            << " current = " << range_markers_durations[current_range_marker_index]
-            << " agg = " << range_markers_durations_aggregated[current_range_marker_index]
-            << " prog = " << spec.progress
-            << endl;
-       
        if (current_range_marker_index >= range_markers_durations.size()){
                progress = 1.0;
        } else{