patch from mantis user cth103 to fix up fixed-time cross-track drags
[ardour.git] / gtk2_ardour / export_dialog.cc
index 1293fca34bfbb9c697baa57ccfe2a42fe3abb30a..538f0ed74c198a069ac26bf23857c9552ab1ca63 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 
 */
 
@@ -27,7 +26,6 @@
 #include <samplerate.h>
 
 #include <pbd/convert.h>
-#include <pbd/dirname.h>
 #include <pbd/xml++.h>
 
 #include <gtkmm2ext/utils.h>
 
 using namespace std;
 using namespace ARDOUR;
+using namespace PBD;
 using namespace sigc;
 using namespace Gtk;
 
-using PBD::internationalize;
-
 static const gchar *sample_rates[] = {
        N_("22.05kHz"),
        N_("44.1kHz"),
@@ -123,7 +120,7 @@ ExportDialog::ExportDialog(PublicEditor& e)
        export_cd_markers_allowed = true;
        
        set_title (_("ardour: export"));
-       set_wmclass (_("ardour_export"), "Ardour");
+       set_wmclass (X_("ardour_export"), "Ardour");
        set_name ("ExportWindow");
        add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
 
@@ -212,28 +209,28 @@ ExportDialog::ExportDialog(PublicEditor& e)
           takes a reference. 
        */
 
-       vector<string> pop_strings = internationalize(sample_rates);
+       vector<string> pop_strings = I18N (sample_rates);
        Gtkmm2ext::set_popdown_strings (sample_rate_combo, pop_strings);
        sample_rate_combo.set_active_text (pop_strings.front());
-       pop_strings = internationalize(src_quality);
+       pop_strings = I18N (src_quality);
        Gtkmm2ext::set_popdown_strings (src_quality_combo, pop_strings);
        src_quality_combo.set_active_text (pop_strings.front());
-       pop_strings = internationalize(dither_types);
+       pop_strings = I18N (dither_types);
        Gtkmm2ext::set_popdown_strings (dither_type_combo, pop_strings);
        dither_type_combo.set_active_text (pop_strings.front());
-       pop_strings = internationalize(channel_strings);
+       pop_strings = I18N (channel_strings);
        Gtkmm2ext::set_popdown_strings (channel_count_combo, pop_strings);
        channel_count_combo.set_active_text (pop_strings.front());
-       pop_strings = internationalize((const char **) sndfile_header_formats_strings);
+       pop_strings = I18N ((const char **) sndfile_header_formats_strings);
        Gtkmm2ext::set_popdown_strings (header_format_combo, pop_strings);
        header_format_combo.set_active_text (pop_strings.front());
-       pop_strings = internationalize((const char **) sndfile_bitdepth_formats_strings);
+       pop_strings = I18N ((const char **) sndfile_bitdepth_formats_strings);
        Gtkmm2ext::set_popdown_strings (bitdepth_format_combo, pop_strings);
        bitdepth_format_combo.set_active_text (pop_strings.front());
-       pop_strings = internationalize((const char **) sndfile_endian_formats_strings);
+       pop_strings = I18N ((const char **) sndfile_endian_formats_strings);
        Gtkmm2ext::set_popdown_strings (endian_format_combo, pop_strings);
        endian_format_combo.set_active_text (pop_strings.front());
-       pop_strings = internationalize(cue_file_types);
+       pop_strings = I18N (cue_file_types);
        Gtkmm2ext::set_popdown_strings (cue_file_combo, pop_strings);
        cue_file_combo.set_active_text (pop_strings.front());
 
@@ -392,7 +389,7 @@ void
 ExportDialog::connect_to_session (Session *s)
 {
        session = s;
-       session->going_away.connect (mem_fun(*this, &Window::hide_all));
+       session->GoingAway.connect (mem_fun(*this, &Window::hide_all));
 
        switch (session->frame_rate()) {
        case 22050:
@@ -571,7 +568,7 @@ ExportDialog::save_state()
 
                row = *ri;
                track->add_property(X_("channel1"), row[exp_cols.left] ? X_("on") : X_("off"));
-               track->add_property(X_("channel1"), row[exp_cols.right] ? X_("on") : X_("off"));
+               track->add_property(X_("channel2"), row[exp_cols.right] ? X_("on") : X_("off"));
 
                tracks->add_child_nocopy(*track);
        }
@@ -581,7 +578,7 @@ ExportDialog::save_state()
 }
 
 void
-ExportDialog::set_range (jack_nframes_t start, jack_nframes_t end)
+ExportDialog::set_range (nframes_t start, nframes_t end)
 {
        spec.start_frame = start;
        spec.end_frame = end;
@@ -595,7 +592,7 @@ ExportDialog::progress_timeout ()
 }
 
 void
-frames_to_cd_frames_string (char* buf, jack_nframes_t when, jack_nframes_t fr)
+frames_to_cd_frames_string (char* buf, nframes_t when, nframes_t fr)
 {
 
   long unsigned int remainder;
@@ -917,7 +914,6 @@ ExportDialog::do_export ()
        end_dialog ();
 }
        
-
 void
 ExportDialog::end_dialog ()
 {
@@ -950,19 +946,21 @@ ExportDialog::start_export ()
        }
 
        /* If the filename hasn't been set before, use the
-          directory above the current session as a default
+          current session's export directory as a default
           location for the export.  
        */
        
        if (file_entry.get_text().length() == 0) {
-               string dir = session->path();
+               string dir = session->export_dir();
                string::size_type last_slash;
                
-               if ((last_slash = dir.find_last_of ('/')) != string::npos) {
+               if ((last_slash = dir.find_last_of ('/')) != string::npos && last_slash != 0) {
                        dir = dir.substr (0, last_slash+1);
                }
 
-               dir = dir + "export.wav";
+               if (!wants_dir()) {
+                       dir = dir + "export.wav";
+               }
                
                file_entry.set_text (dir);
        }
@@ -1022,7 +1020,7 @@ void
 ExportDialog::sample_rate_chosen ()
 {
        string sr_str = sample_rate_combo.get_active_text();
-       jack_nframes_t rate;
+       nframes_t rate;
 
        if (sr_str == N_("22.05kHz")) {
                rate = 22050;
@@ -1082,11 +1080,11 @@ ExportDialog::fill_lists ()
        track_list->clear();
        master_list->clear();
        
-       Session::RouteList routes = session->get_routes ();
+       boost::shared_ptr<Session::RouteList> routes = session->get_routes ();
 
-       for (Session::RouteList::iterator ri = routes.begin(); ri != routes.end(); ++ri) {
-
-               Route* route = (*ri);
+       for (Session::RouteList::iterator ri = routes->begin(); ri != routes->end(); ++ri) {
+               
+               boost::shared_ptr<Route> route = (*ri);
                
                if (route->hidden()) {
                        continue;
@@ -1154,7 +1152,7 @@ ExportDialog::is_filepath_valid(string &filepath)
        
        // directory needs to exist and be writable
 
-       string dirpath = PBD::dirname (filepath);
+       string dirpath = Glib::path_get_dirname (filepath);
        if (::access (dirpath.c_str(), W_OK) != 0) {
                string txt = _("Cannot write file in: ") + dirpath;
                MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);