/*
- Copyright (C) 1999-2003 Paul Davis
+ Copyright (C) 1999-2005 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
*/
#include <unistd.h>
#include <utility>
-
+#include <sys/stat.h>
#include <fstream>
-
#include <samplerate.h>
-#include <pbd/pthread_utils.h>
+#include <pbd/convert.h>
#include <pbd/xml++.h>
-#include <gtkmm.h>
#include <gtkmm2ext/utils.h>
+
#include <ardour/export.h>
#include <ardour/sndfile_helpers.h>
#include <ardour/audio_track.h>
#include <ardour/audioengine.h>
#include <ardour/gdither.h>
#include <ardour/utils.h>
+#include <ardour/profile.h>
#include "export_dialog.h"
-#include "check_mark.h"
#include "ardour_ui.h"
#include "public_editor.h"
#include "keyboard.h"
+#include "nag.h"
#include "i18n.h"
-#define FRAME_SHADOW_STYLE Gtk::SHADOW_IN
#define FRAME_NAME "BaseFrame"
-GdkPixmap* ExportDialog::check_pixmap = 0;
-GdkPixmap* ExportDialog::check_mask = 0;
-GdkPixmap* ExportDialog::empty_pixmap = 0;
-GdkPixmap* ExportDialog::empty_mask = 0;
-
using namespace std;
-
using namespace ARDOUR;
+using namespace PBD;
using namespace sigc;
using namespace Gtk;
+using namespace Gtkmm2ext;
static const gchar *sample_rates[] = {
N_("22.05kHz"),
0
};
-static const gchar *src_qualities[] = {
+static const gchar *src_quality[] = {
N_("best"),
N_("fastest"),
N_("linear"),
0
};
-ExportDialog::ExportDialog(PublicEditor& e, AudioRegion* r)
+ExportDialog::ExportDialog(PublicEditor& e)
: ArdourDialog ("export dialog"),
editor (e),
format_table (9, 2),
- format_frame (_("FORMAT")),
- sample_rate_label (_("SAMPLE RATE")),
- src_quality_label (_("CONVERSION QUALITY")),
- dither_type_label (_("DITHER TYPE")),
- cue_file_label (_("CD MARKER FILE TYPE")),
- channel_count_label (_("CHANNELS")),
- header_format_label (_("FILE TYPE")),
- bitdepth_format_label (_("SAMPLE FORMAT")),
- endian_format_label (_("SAMPLE ENDIANNESS")),
- cuefile_only_checkbox (_("EXPORT CD MARKER FILE ONLY")),
- file_frame (_("EXPORT TO FILE")),
+ format_frame (_("Format")),
+ cue_file_label (_("CD Marker File Type"), 1.0, 0.5),
+ channel_count_label (_("Channels"), 1.0, 0.5),
+ header_format_label (_("File Type"), 1.0, 0.5),
+ bitdepth_format_label (_("Sample Format"), 1.0, 0.5),
+ endian_format_label (_("Sample Endianness"), 1.0, 0.5),
+ sample_rate_label (_("Sample Rate"), 1.0, 0.5),
+ src_quality_label (_("Conversion Quality"), 1.0, 0.5),
+ dither_type_label (_("Dither Type"), 1.0, 0.5),
+ cuefile_only_checkbox (_("Export CD Marker File Only")),
file_browse_button (_("Browse")),
- ok_button (_("Export")),
- track_selector_button (_("Specific tracks ...")),
- track_selector (3),
- master_selector (3)
+ track_selector_button (_("Specific tracks ..."))
{
guint32 n;
guint32 len;
guint32 maxlen;
- audio_region = r;
-
session = 0;
-
- set_title (_("ardour: export"));
- set_wmclass (_("ardour_export"), "Ardour");
+ track_and_master_selection_allowed = true;
+ channel_count_selection_allowed = true;
+ export_cd_markers_allowed = true;
+
+ set_title (_("Export"));
+ set_wmclass (X_("ardour_export"), "Ardour");
set_name ("ExportWindow");
add_events (Gdk::KEY_PRESS_MASK|Gdk::KEY_RELEASE_MASK);
-
- add (vpacker);
-
- vpacker.set_border_width (10);
- vpacker.set_spacing (10);
-
- file_selector = 0;
+
spec.running = false;
- file_entry.signal_focus_in_event().connect (sigc::ptr_fun (ARDOUR_UI::generic_focus_in_event));
- file_entry.signal_focus_out_event().connect (sigc::ptr_fun (ARDOUR_UI::generic_focus_out_event));
-
file_entry.set_name ("ExportFileNameEntry");
+ file_entry.set_activates_default (true);
+
+ master_list = ListStore::create (exp_cols);
+ master_selector.set_model (master_list);
master_selector.set_name ("ExportTrackSelector");
master_selector.set_size_request (-1, 100);
- master_selector.set_column_min_width (0, 100);
- master_selector.set_column_min_width (1, 40);
- master_selector.set_column_auto_resize(1, true);
- master_selector.set_column_min_width (2, 40);
- master_selector.set_column_auto_resize(2, true);
- master_selector.set_column_title (0, _("Output"));
- master_selector.column_titles_show ();
- master_selector.set_selection_mode (Gtk::SELECTION_MULTIPLE);
- master_selector.signal_button_press_event().connect (mem_fun(*this, &ExportDialog::master_selector_button_press_event));
-
+ master_selector.append_column(_("Output"), exp_cols.output);
+ master_selector.append_column_editable(_("Left"), exp_cols.left);
+ master_selector.append_column_editable(_("Right"), exp_cols.right);
+ master_selector.get_column(0)->set_min_width(100);
+
+ master_selector.get_column(1)->set_min_width(40);
+ master_selector.get_column(1)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
+ master_selector.get_column(2)->set_min_width(40);
+ master_selector.get_column(2)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
+ master_selector.get_selection()->set_mode (Gtk::SELECTION_NONE);
+
+ track_list = ListStore::create (exp_cols);
+ track_selector.set_model (track_list);
+
track_selector.set_name ("ExportTrackSelector");
track_selector.set_size_request (-1, 130);
- track_selector.set_column_min_width (0, 100);
- track_selector.set_column_min_width (1, 40);
- track_selector.set_column_auto_resize(1, true);
- track_selector.set_column_min_width (2, 40);
- track_selector.set_column_auto_resize(2, true);
- track_selector.set_column_title (0, _("Track"));
- track_selector.column_titles_show ();
- track_selector.set_selection_mode (Gtk::SELECTION_MULTIPLE);
- track_selector.signal_button_press_event().connect (mem_fun(*this, &ExportDialog::track_selector_button_press_event));
-
- check_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
- gtk_widget_get_colormap(GTK_WIDGET(track_selector.gobj())),
- &check_mask, NULL, (gchar**) check_xpm);
- empty_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL,
- gtk_widget_get_colormap(GTK_WIDGET(track_selector.gobj())),
- &empty_mask, NULL, (gchar**) empty_xpm);
-
- progress_bar.set_show_text (false);
- progress_bar.set_orientation (PROGRESS_LEFT_TO_RIGHT);
+ track_selector.append_column(_("Output"), exp_cols.output);
+ track_selector.append_column_editable(_("Left"), exp_cols.left);
+ track_selector.append_column_editable(_("Right"), exp_cols.right);
+
+ track_selector.get_column(0)->set_min_width(100);
+ track_selector.get_column(1)->set_min_width(40);
+ track_selector.get_column(1)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
+ track_selector.get_column(2)->set_min_width(40);
+ track_selector.get_column(2)->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
+ track_selector.get_selection()->set_mode (Gtk::SELECTION_NONE);
+
progress_bar.set_name ("ExportProgress");
format_frame.add (format_table);
track_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
master_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
- vpacker.pack_start (file_frame, false, false);
+ get_vbox()->pack_start (file_frame, false, false);
hpacker.set_spacing (5);
hpacker.set_border_width (5);
hpacker.pack_start (format_frame, false, false);
- if (!audio_region) {
-
- master_scroll.add (master_selector);
- track_scroll.add (track_selector);
+ master_scroll.add (master_selector);
+ track_scroll.add (track_selector);
- master_scroll.set_size_request (220, 100);
- track_scroll.set_size_request (220, 100);
-
-
+ master_scroll.set_size_request (220, 100);
+ track_scroll.set_size_request (220, 100);
- /* we may hide some of these later */
- track_vpacker.pack_start (master_scroll, true, true);
- track_vpacker.pack_start (track_scroll, true, true);
- track_vpacker.pack_start (track_selector_button, false);
+ /* we may hide some of these later */
+ track_vpacker.pack_start (master_scroll);
+ track_vpacker.pack_start (track_scroll);
+ track_vpacker.pack_start (track_selector_button, Gtk::PACK_EXPAND_PADDING);
- hpacker.pack_start (track_vpacker, true, true);
- }
+ hpacker.pack_start (track_vpacker);
- vpacker.pack_start (hpacker, true, true);
+ get_vbox()->pack_start (hpacker);
track_selector_button.set_name ("EditorGTKButton");
track_selector_button.signal_clicked().connect (mem_fun(*this, &ExportDialog::track_selector_button_click));
- vpacker.pack_start (button_box, false, false);
- vpacker.pack_start (progress_bar, false, false);
+ get_vbox()->pack_start (progress_bar, false, false);
Gtkmm2ext::set_size_request_to_display_given_text (file_entry, X_("Kg/quite/a/reasonable/size/for/files/i/think"), 5, 8);
file_frame.set_border_width (5);
file_frame.set_name (FRAME_NAME);
- set_popdown_strings (sample_rate_combo, internationalize(sample_rates));
- set_popdown_strings (src_quality_combo, internationalize (src_qualities));
- set_popdown_strings (dither_type_combo, internationalize (dither_types));
- set_popdown_strings (channel_count_combo, internationalize (channel_strings));
- set_popdown_strings (header_format_combo, internationalize ((const char **) sndfile_header_formats_strings));
- set_popdown_strings (bitdepth_format_combo, internationalize ((const char **) sndfile_bitdepth_formats_strings));
- set_popdown_strings (endian_format_combo, internationalize ((const char **) sndfile_endian_formats_strings));
- set_popdown_strings (cue_file_combo, internationalize (cue_file_types));
+ /* pop_strings needs to be created on the stack because set_popdown_strings()
+ takes a reference.
+ */
+
+ 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 = I18N (src_quality);
+ Gtkmm2ext::set_popdown_strings (src_quality_combo, pop_strings);
+ src_quality_combo.set_active_text (pop_strings.front());
+ 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 = I18N (channel_strings);
+ Gtkmm2ext::set_popdown_strings (channel_count_combo, pop_strings);
+ channel_count_combo.set_active_text (pop_strings.front());
+ 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 = 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 = 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 = I18N (cue_file_types);
+ Gtkmm2ext::set_popdown_strings (cue_file_combo, pop_strings);
+ cue_file_combo.set_active_text (pop_strings.front());
/* this will re-sensitized as soon as a non RIFF/WAV
header format is chosen.
/* determine longest strings at runtime */
- const guint32 FUDGE = 10; // Combo's are stupid - they steal space from the entry for the button
-
maxlen = 0;
- const char *longest = "gl";
+ const char *longest = X_("gl"); /* translators: one ascender, one descender */
string longest_str;
for (n = 0; n < SNDFILE_HEADER_FORMATS; ++n) {
longest_str[0] = 'g';
longest_str[1] = 'l';
- Gtkmm2ext::set_size_request_to_display_given_text (*header_format_combo.get_entry(), longest_str.c_str(), 5+FUDGE, 5);
+ //Gtkmm2ext::set_size_request_to_display_given_text (header_format_combo, longest_str.c_str(), 5+FUDGE, 5);
// TRANSLATORS: "slereg" is "stereo" with ascender and descender substituted
- Gtkmm2ext::set_size_request_to_display_given_text (*channel_count_combo.get_entry(), _("slereg"), 5+FUDGE, 5);
-
- header_format_combo.set_use_arrows_always (true);
- bitdepth_format_combo.set_use_arrows_always (true);
- endian_format_combo.set_use_arrows_always (true);
- channel_count_combo.set_use_arrows_always (true);
- src_quality_combo.set_use_arrows_always (true);
- dither_type_combo.set_use_arrows_always (true);
- sample_rate_combo.set_use_arrows_always (true);
- cue_file_combo.set_use_arrows_always (true);
-
- header_format_combo.set_value_in_list (true, false);
- bitdepth_format_combo.set_value_in_list (true, false);
- endian_format_combo.set_value_in_list (true, false);
- channel_count_combo.set_value_in_list (true, false);
- src_quality_combo.set_value_in_list (true, false);
- dither_type_combo.set_value_in_list (true, false);
- sample_rate_combo.set_value_in_list (true, false);
- cue_file_combo.set_value_in_list (true, false);
-
- header_format_combo.get_entry()->set_editable (false);
- bitdepth_format_combo.get_entry()->set_editable (false);
- endian_format_combo.get_entry()->set_editable (false);
- channel_count_combo.get_entry()->set_editable (false);
- src_quality_combo.get_entry()->set_editable (false);
- dither_type_combo.get_entry()->set_editable (false);
- sample_rate_combo.get_entry()->set_editable (false);
- cue_file_combo.get_entry()->set_editable (false);
-
+ //Gtkmm2ext::set_size_request_to_display_given_text (channel_count_combo, _("slereg"), 5+FUDGE, 5);
+
+/* header_format_combo.set_focus_on_click (true);
+ bitdepth_format_combo.set_focus_on_click (true);
+ endian_format_combo.set_focus_on_click (true);
+ channel_count_combo.set_focus_on_click (true);
+ src_quality_combo.set_focus_on_click (true);
+ dither_type_combo.set_focus_on_click (true);
+ sample_rate_combo.set_focus_on_click (true);
+ cue_file_combo.set_focus_on_click (true);
+*/
dither_type_label.set_name ("ExportFormatLabel");
sample_rate_label.set_name ("ExportFormatLabel");
src_quality_label.set_name ("ExportFormatLabel");
endian_format_label.set_name ("ExportFormatLabel");
cue_file_label.set_name ("ExportFormatLabel");
- header_format_combo.get_entry()->set_name ("ExportFormatDisplay");
- bitdepth_format_combo.get_entry()->set_name ("ExportFormatDisplay");
- endian_format_combo.get_entry()->set_name ("ExportFormatDisplay");
- channel_count_combo.get_entry()->set_name ("ExportFormatDisplay");
- dither_type_combo.get_entry()->set_name ("ExportFormatDisplay");
- src_quality_combo.get_entry()->set_name ("ExportFormatDisplay");
- sample_rate_combo.get_entry()->set_name ("ExportFormatDisplay");
- cue_file_combo.get_entry()->set_name ("ExportFormatDisplay");
+ header_format_combo.set_name ("ExportFormatDisplay");
+ bitdepth_format_combo.set_name ("ExportFormatDisplay");
+ endian_format_combo.set_name ("ExportFormatDisplay");
+ channel_count_combo.set_name ("ExportFormatDisplay");
+ dither_type_combo.set_name ("ExportFormatDisplay");
+ src_quality_combo.set_name ("ExportFormatDisplay");
+ sample_rate_combo.set_name ("ExportFormatDisplay");
+ cue_file_combo.set_name ("ExportFormatDisplay");
cuefile_only_checkbox.set_name ("ExportCheckbox");
- format_table.set_homogeneous (true);
+ format_table.set_homogeneous (false);
format_table.set_border_width (5);
format_table.set_col_spacings (5);
format_table.set_row_spacings (5);
- if (!audio_region) {
- format_table.attach (channel_count_label, 0, 1, 0, 1);
- format_table.attach (channel_count_combo, 0, 1, 1, 2);
- }
+ int row = 0;
- format_table.attach (header_format_label, 1, 2, 0, 1);
- format_table.attach (header_format_combo, 1, 2, 1, 2);
+ format_table.attach (channel_count_label, 0, 1, row, row+1);
+ format_table.attach (channel_count_combo, 1, 2, row, row+1);
- format_table.attach (bitdepth_format_label, 0, 1, 2, 3);
- format_table.attach (bitdepth_format_combo, 0, 1, 3, 4);
+ row++;
+
+ format_table.attach (header_format_label, 0, 1, row, row+1);
+ format_table.attach (header_format_combo, 1, 2, row, row+1);
+
+ row++;
- format_table.attach (endian_format_label, 1, 2, 2, 3);
- format_table.attach (endian_format_combo, 1, 2, 3, 4);
+ format_table.attach (bitdepth_format_label, 0, 1, row, row+1);
+ format_table.attach (bitdepth_format_combo, 1, 2, row, row+1);
- format_table.attach (sample_rate_label, 0, 1, 4, 5);
- format_table.attach (sample_rate_combo, 0, 1, 5, 6);
+ row++;
- format_table.attach (src_quality_label, 1, 2, 4, 5);
- format_table.attach (src_quality_combo, 1, 2, 5, 6);
+ if (!Profile->get_sae()) {
+ format_table.attach (endian_format_label, 0, 1, row, row+1);
+ format_table.attach (endian_format_combo, 1, 2, row, row+1);
+ row++;
+ }
- format_table.attach (dither_type_label, 0, 1, 6, 7);
- format_table.attach (dither_type_combo, 0, 1, 7, 8);
+ format_table.attach (sample_rate_label, 0, 1, row, row+1);
+ format_table.attach (sample_rate_combo, 1, 2, row, row+1);
- format_table.attach (cue_file_label, 1, 2, 6, 7);
- format_table.attach (cue_file_combo, 1, 2, 7, 8);
- format_table.attach (cuefile_only_checkbox, 1, 2, 8, 9);
+ row++;
+ if (!Profile->get_sae()) {
+ format_table.attach (src_quality_label, 0, 1, row, row+1);
+ format_table.attach (src_quality_combo, 1, 2, row, row+1);
+ row++;
+ }
- button_box.set_spacing (10);
- button_box.set_homogeneous (true);
+ format_table.attach (dither_type_label, 0, 1, row, row+1);
+ format_table.attach (dither_type_combo, 1, 2, row, row+1);
- cancel_button.add (cancel_label);
+ row++;
- button_box.pack_start (ok_button, false, true);
- button_box.pack_start (cancel_button, false, true);
+ if (!Profile->get_sae()) {
+ format_table.attach (cue_file_label, 0, 1, row, row+1);
+ format_table.attach (cue_file_combo, 1, 2, row, row+1);
+ row++;
- ok_button.set_name ("EditorGTKButton");
- cancel_button.set_name ("EditorGTKButton");
+ format_table.attach (cuefile_only_checkbox, 0, 2, row, row+1);
+ }
+
file_entry.set_name ("ExportFileDisplay");
- delete_event.connect (mem_fun(*this, &ExportDialog::window_closed));
- ok_button.signal_clicked().connect (mem_fun(*this, &ExportDialog::do_export));
- cancel_button.signal_clicked().connect (mem_fun(*this, &ExportDialog::end_dialog));
+ signal_delete_event().connect (mem_fun(*this, &ExportDialog::window_closed));
+
+ cancel_button = add_button (Stock::CANCEL, RESPONSE_CANCEL);
+ cancel_button->signal_clicked().connect (mem_fun(*this, &ExportDialog::end_dialog));
+ ok_button = add_button (_("Export"), RESPONSE_ACCEPT);
+ set_default_response (RESPONSE_ACCEPT);
+ ok_button->signal_clicked().connect (mem_fun(*this, &ExportDialog::do_export));
file_browse_button.set_name ("EditorGTKButton");
- file_browse_button.signal_clicked().connect (mem_fun(*this, &ExportDialog::initiate_browse));
+ file_browse_button.signal_clicked().connect (mem_fun(*this, &ExportDialog::browse));
- channel_count_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &ExportDialog::channels_chosen));
- bitdepth_format_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &ExportDialog::bitdepth_chosen));
- header_format_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &ExportDialog::header_chosen));
- sample_rate_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &ExportDialog::sample_rate_chosen));
- cue_file_combo.get_popwin()->signal_unmap_event().connect (mem_fun(*this, &ExportDialog::cue_file_type_chosen));
+ channel_count_combo.signal_changed().connect (mem_fun(*this, &ExportDialog::channels_chosen));
+ bitdepth_format_combo.signal_changed().connect (mem_fun(*this, &ExportDialog::bitdepth_chosen));
+ header_format_combo.signal_changed().connect (mem_fun(*this, &ExportDialog::header_chosen));
+ sample_rate_combo.signal_changed().connect (mem_fun(*this, &ExportDialog::sample_rate_chosen));
+ cue_file_combo.signal_changed().connect (mem_fun(*this, &ExportDialog::cue_file_type_chosen));
}
ExportDialog::~ExportDialog()
{
- if (file_selector) {
- delete file_selector;
- }
+}
+
+void
+ExportDialog::do_not_allow_track_and_master_selection()
+{
+ track_and_master_selection_allowed = false;
+ track_vpacker.set_no_show_all();
+}
+
+void
+ExportDialog::do_not_allow_channel_count_selection()
+{
+ channel_count_selection_allowed = false;
+ channel_count_combo.set_no_show_all();
+ channel_count_label.set_no_show_all();
+}
+
+void
+ExportDialog::do_not_allow_export_cd_markers()
+{
+ export_cd_markers_allowed = false;
+ cue_file_label.set_no_show_all();
+ cue_file_combo.set_no_show_all();
+ cuefile_only_checkbox.set_no_show_all();
}
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:
- sample_rate_combo.get_entry()->set_text (N_("22.05kHz"));
+ sample_rate_combo.set_active_text (_("22.05kHz"));
break;
case 44100:
- sample_rate_combo.get_entry()->set_text (N_("44.1kHz"));
+ sample_rate_combo.set_active_text (_("44.1kHz"));
break;
case 48000:
- sample_rate_combo.get_entry()->set_text (N_("48kHz"));
+ sample_rate_combo.set_active_text (_("48kHz"));
break;
case 88200:
- sample_rate_combo.get_entry()->set_text (N_("88.2kHz"));
+ sample_rate_combo.set_active_text (_("88.2kHz"));
break;
case 96000:
- sample_rate_combo.get_entry()->set_text (N_("96kHz"));
+ sample_rate_combo.set_active_text (_("96kHz"));
break;
case 192000:
- sample_rate_combo.get_entry()->set_text (N_("192kHz"));
+ sample_rate_combo.set_active_text (_("192kHz"));
break;
default:
- sample_rate_combo.get_entry()->set_text (N_("44.1kHz"));
+ sample_rate_combo.set_active_text (_("44.1kHz"));
break;
}
if (node) {
if ((prop = node->property (X_("sample_rate"))) != 0) {
- sample_rate_combo.get_entry()->set_text(prop->value());
+ sample_rate_combo.set_active_text(prop->value());
}
if ((prop = node->property (X_("src_quality"))) != 0) {
- src_quality_combo.get_entry()->set_text(prop->value());
+ src_quality_combo.set_active_text(prop->value());
}
if ((prop = node->property (X_("dither_type"))) != 0) {
- dither_type_combo.get_entry()->set_text(prop->value());
+ dither_type_combo.set_active_text(prop->value());
}
if ((prop = node->property (X_("channel_count"))) != 0) {
- channel_count_combo.get_entry()->set_text(prop->value());
+ channel_count_combo.set_active_text(prop->value());
}
if ((prop = node->property (X_("header_format"))) != 0) {
- header_format_combo.get_entry()->set_text(prop->value());
+ header_format_combo.set_active_text(prop->value());
}
if ((prop = node->property (X_("bitdepth_format"))) != 0) {
- bitdepth_format_combo.get_entry()->set_text(prop->value());
+ bitdepth_format_combo.set_active_text(prop->value());
}
if ((prop = node->property (X_("endian_format"))) != 0) {
- endian_format_combo.get_entry()->set_text(prop->value());
+ endian_format_combo.set_active_text(prop->value());
}
if ((prop = node->property (X_("filename"))) != 0) {
file_entry.set_text(prop->value());
}
if ((prop = node->property (X_("cue_file_type"))) != 0) {
- cue_file_combo.get_entry()->set_text(prop->value());
+ cue_file_combo.set_active_text(prop->value());
}
}
- header_chosen (0);
- bitdepth_chosen(0);
- channels_chosen(0);
- sample_rate_chosen(0);
+ header_chosen ();
+ bitdepth_chosen();
+ channels_chosen();
+ sample_rate_chosen();
if (session->master_out()) {
track_scroll.hide ();
if (!master) {
/* default is to use all */
- if (channel_count_combo.get_entry()->get_text() == _("mono")) {
+ if (channel_count_combo.get_active_text() == _("mono")) {
nchns = 1;
} else {
nchns = 2;
}
+ TreeModel::Children rows = master_selector.get_model()->children();
for (uint32_t r = 0; r < session->master_out()->n_outputs(); ++r) {
if (nchns == 2) {
if (r % 2) {
- master_selector.cell (r, 2).set_pixmap (check_pixmap, check_mask);
+ rows[r][exp_cols.right] = true;
} else {
- master_selector.cell (r, 1).set_pixmap (check_pixmap, check_mask);
+ rows[r][exp_cols.left] = true;
}
} else {
- master_selector.cell (r, 1).set_pixmap (check_pixmap, check_mask);
+ rows[r][exp_cols.left] = true;
}
}
}
XMLNodeList track_list = tracks->children(X_("Track"));
- CList_Helpers::RowIterator ri = track_selector.rows().begin();
- uint32_t n = 0;
- for (XMLNodeIterator it = track_list.begin(); it != track_list.end(); ++it, ++ri, ++n) {
- if (ri == track_selector.rows().end()) {
+ TreeModel::Children rows = track_selector.get_model()->children();
+ TreeModel::Children::iterator ri = rows.begin();
+ TreeModel::Row row;
+
+ for (XMLNodeIterator it = track_list.begin(); it != track_list.end(); ++it, ++ri) {
+ if (ri == rows.end()){
break;
}
XMLNode* track = *it;
+ row = *ri;
if ((prop = track->property(X_("channel1"))) != 0) {
if (prop->value() == X_("on")) {
- track_selector.cell (n,1).set_pixmap (check_pixmap, check_mask);
+ row[exp_cols.left] = true;
} else {
- track_selector.cell (n,1).set_pixmap (empty_pixmap, empty_mask);
+ row[exp_cols.left] = false;
}
}
if ((prop = track->property(X_("channel2"))) != 0) {
if (prop->value() == X_("on")) {
- track_selector.cell (n,2).set_pixmap (check_pixmap, check_mask);
+ row[exp_cols.right] = true;
} else {
- track_selector.cell (n,2).set_pixmap (empty_pixmap, empty_mask);
+ row[exp_cols.right] = false;
}
}
}
- }
+}
void
ExportDialog::save_state()
XMLNode* node = new XMLNode(X_("ExportDialog"));
- node->add_property(X_("sample_rate"), sample_rate_combo.get_entry()->get_text());
- node->add_property(X_("src_quality"), src_quality_combo.get_entry()->get_text());
- node->add_property(X_("dither_type"), dither_type_combo.get_entry()->get_text());
- node->add_property(X_("channel_count"), channel_count_combo.get_entry()->get_text());
- node->add_property(X_("header_format"), header_format_combo.get_entry()->get_text());
- node->add_property(X_("bitdepth_format"), bitdepth_format_combo.get_entry()->get_text());
- node->add_property(X_("endian_format"), endian_format_combo.get_entry()->get_text());
+ node->add_property(X_("sample_rate"), sample_rate_combo.get_active_text());
+ node->add_property(X_("src_quality"), src_quality_combo.get_active_text());
+ node->add_property(X_("dither_type"), dither_type_combo.get_active_text());
+ node->add_property(X_("channel_count"), channel_count_combo.get_active_text());
+ node->add_property(X_("header_format"), header_format_combo.get_active_text());
+ node->add_property(X_("bitdepth_format"), bitdepth_format_combo.get_active_text());
+ node->add_property(X_("endian_format"), endian_format_combo.get_active_text());
node->add_property(X_("filename"), file_entry.get_text());
- node->add_property(X_("cue_file_type"), cue_file_combo.get_entry()->get_text());
+ node->add_property(X_("cue_file_type"), cue_file_combo.get_active_text());
XMLNode* tracks = new XMLNode(X_("Tracks"));
- uint32_t n = 0;
- for (CList_Helpers::RowIterator ri = track_selector.rows().begin(); ri != track_selector.rows().end(); ++ri, ++n) {
+ TreeModel::Children rows = track_selector.get_model()->children();
+ TreeModel::Row row;
+ for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri) {
XMLNode* track = new XMLNode(X_("Track"));
- Gdk::Pixmap left_pixmap = track_selector.cell (n, 1).get_pixmap ();
- track->add_property(X_("channel1"), left_pixmap.gobj() == check_pixmap ? X_("on") : X_("off"));
-
- Gdk::Pixmap right_pixmap = track_selector.cell (n, 2).get_pixmap ();
- track->add_property(X_("channel2"), right_pixmap.gobj() == check_pixmap ? X_("on") : X_("off"));
+ row = *ri;
+ track->add_property(X_("channel1"), row[exp_cols.left] ? X_("on") : X_("off"));
+ track->add_property(X_("channel2"), row[exp_cols.right] ? X_("on") : X_("off"));
tracks->add_child_nocopy(*track);
}
}
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;
-
- if (!audio_region) {
- // XXX: this is a hack until we figure out what is really wrong
- session->request_locate (spec.start_frame, false);
- }
}
gint
ExportDialog::progress_timeout ()
{
- progress_bar.set_fraction (spec.progress/100);
+ progress_bar.set_fraction (spec.progress);
return TRUE;
}
-void*
-ExportDialog::_export_region_thread (void *arg)
-{
- PBD::ThreadCreated (pthread_self(), X_("Export Region"));
-
- static_cast<ExportDialog*>(arg)->export_region ();
- return 0;
-}
-
void
-ExportDialog::export_region ()
-{
- audio_region->exportme (*session, spec);
-}
-
-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;
void
ExportDialog::export_toc_file (Locations::LocationList& locations, const string& path)
{
+ if(!export_cd_markers_allowed){
+ return;
+ }
- string filepath = path + ".toc";
- ofstream out (filepath.c_str());
long unsigned int last_end_time = spec.start_frame, last_start_time = spec.start_frame;
- int numtracks = 0;
gchar buf[18];
-
+
+ /* Build the toc's file name from the specified audio file name. */
+ string basename = Glib::path_get_basename(path);
+ size_t ext_pos = basename.rfind('.');
+ if (ext_pos != string::npos) {
+ basename = basename.substr(0, ext_pos); /* strip file extension, if there is one */
+ }
+ string filepath = Glib::build_filename(Glib::path_get_dirname(path), basename + ".toc");
+
+ ofstream out (filepath.c_str());
if (!out) {
error << string_compose(_("Editor: cannot open \"%1\" as export file for CD toc file"), filepath) << endmsg;
return;
Locations::LocationList temp;
for (i = locations.begin(); i != locations.end(); ++i) {
- if ((*i)->start() >= spec.start_frame && (*i)->end() <= spec.end_frame && (*i)->is_cd_marker() && !(*i)->is_end()) {
- temp.push_back (*i);
- if (!(*i)->is_mark()) {
- numtracks ++;
- }
- }
+ if ((*i)->start() >= spec.start_frame && (*i)->end() <= spec.end_frame && (*i)->is_cd_marker() && !(*i)->is_end()) {
+ temp.push_back (*i);
+ }
}
- if (numtracks == 0 ) {
- /* the user supplied no track markers.
- we now treat the session as one track.*/
-
- out << endl << "TRACK AUDIO" << endl;
-
- out << "COPY" << endl;
-
- out << "NO PRE_EMPHASIS" << endl;
-
- /* XXX add session properties for catalog etc.
- (so far only the session name is used) */
-
- out << "CD_TEXT {" << endl << " LANGUAGE 0 {" << endl << " TITLE \"" << session->name() << "\"" << endl;
- out << " }" << endl << "}" << endl;
-
- out << "FILE \"" << path << "\" ";
- out << "00:00:00 " ;
- frames_to_cd_frames_string (buf, spec.end_frame - spec.start_frame, session->frame_rate());
- out << buf << endl;
- out << "START 00:00:00" << endl;
-
- last_start_time = spec.start_frame;
- last_end_time = spec.end_frame;
- }
-
- if (temp.size()) {
+ if (temp.size() > 0) {
LocationSortByStart cmp;
temp.sort (cmp);
+ Location * curr_range = 0;
+ Locations::LocationList::iterator nexti;
for (i = temp.begin(); i != temp.end(); ++i) {
-
- if (!(*i)->is_mark()) {
- /*this is a track */
- out << endl << "TRACK AUDIO" << endl;
- if ((*i)->cd_info.find("scms") != (*i)->cd_info.end()) {
- out << "NO ";
- }
- out << "COPY" << endl;
-
- if ((*i)->cd_info.find("preemph") != (*i)->cd_info.end()) {
- out << "PRE_EMPHASIS" << endl;
- } else {
- out << "NO PRE_EMPHASIS" << endl;
- }
-
- if ((*i)->cd_info.find("isrc") != (*i)->cd_info.end()) {
- out << "ISRC \"" << (*i)->cd_info["isrc"] << "\"" << endl;
- }
+ if ((*i)->start() >= last_end_time)
+ {
+ /* this is a track, defined by a cd range marker or a cd location marker outside of a cd range */
+ out << endl << "TRACK AUDIO" << endl;
+
+ if ((*i)->cd_info.find("scms") != (*i)->cd_info.end()) {
+ out << "NO ";
+ }
+ out << "COPY" << endl;
+
+ if ((*i)->cd_info.find("preemph") != (*i)->cd_info.end()) {
+ out << "PRE_EMPHASIS" << endl;
+ } else {
+ out << "NO PRE_EMPHASIS" << endl;
+ }
+
+ if ((*i)->cd_info.find("isrc") != (*i)->cd_info.end()) {
+ out << "ISRC \"" << (*i)->cd_info["isrc"] << "\"" << endl;
+ }
+
+ out << "CD_TEXT {" << endl << " LANGUAGE 0 {" << endl << " TITLE \"" << (*i)->name() << "\"" << endl;
+ if ((*i)->cd_info.find("performer") != (*i)->cd_info.end()) {
+ out << " PERFORMER \"" << (*i)->cd_info["performer"] << "\"" << endl;
+ }
+ if ((*i)->cd_info.find("string_composer") != (*i)->cd_info.end()) {
+ out << " COMPOSER \"" << (*i)->cd_info["string_composer"] << "\"" << endl;
+ }
+
+ if ((*i)->cd_info.find("isrc") != (*i)->cd_info.end()) {
+ out << " ISRC \"";
+ out << (*i)->cd_info["isrc"].substr(0,2) << "-";
+ out << (*i)->cd_info["isrc"].substr(2,3) << "-";
+ out << (*i)->cd_info["isrc"].substr(5,2) << "-";
+ out << (*i)->cd_info["isrc"].substr(7,5) << "\"" << endl;
+ }
+
+ out << " }" << endl << "}" << endl;
+
+ frames_to_cd_frames_string (buf, last_end_time - spec.start_frame, session->frame_rate());
+ out << "FILE \"" << Glib::path_get_basename(path) << "\"" << buf;
+
+ if ((*i)->is_mark()) {
+ // a mark track location needs to look ahead to the next marker's start to determine length
+ nexti = i;
+ ++nexti;
+ if (nexti != temp.end()) {
+ frames_to_cd_frames_string (buf, (*nexti)->start() - last_end_time, session->frame_rate());
+ out << buf << endl;
+
+ frames_to_cd_frames_string (buf, (*i)->start() - last_end_time, session->frame_rate());
+ out << "START" << buf << endl;
+
+ last_start_time = (*i)->start();
+ last_end_time = (*nexti)->start();
+ }
+ else {
+ // this was the last marker, use session end
+ frames_to_cd_frames_string (buf, spec.end_frame - last_end_time, session->frame_rate());
+ out << buf << endl;
+
+ frames_to_cd_frames_string (buf, (*i)->start() - last_end_time, session->frame_rate());
+ out << "START" << buf << endl;
+
+ last_start_time = (*i)->start();
+ last_end_time = spec.end_frame;
+ }
- out << "CD_TEXT {" << endl << " LANGUAGE 0 {" << endl << " TITLE \"" << (*i)->name() << "\"" << endl;
- if ((*i)->cd_info.find("performer") != (*i)->cd_info.end()) {
- out << " PERFORMER \"" << (*i)->cd_info["performer"] << "\"" << endl;
- }
- if ((*i)->cd_info.find("string_composer") != (*i)->cd_info.end()) {
- out << " COMPOSER \"" << (*i)->cd_info["string_composer"] << "\"" << endl;
+ curr_range = 0;
+ }
+ else {
+ // range
+ frames_to_cd_frames_string (buf, (*i)->end() - last_end_time, session->frame_rate());
+ out << buf << endl;
+
+ frames_to_cd_frames_string (buf, (*i)->start() - last_end_time, session->frame_rate());
+ out << "START" << buf << endl;
+
+ last_start_time = (*i)->start();
+ last_end_time = (*i)->end();
+
+ curr_range = (*i);
+ }
+
}
-
- if ((*i)->cd_info.find("isrc") != (*i)->cd_info.end()) {
- out << " ISRC \"";
- out << (*i)->cd_info["isrc"].substr(0,2) << "-";
- out << (*i)->cd_info["isrc"].substr(2,3) << "-";
- out << (*i)->cd_info["isrc"].substr(5,2) << "-";
- out << (*i)->cd_info["isrc"].substr(7,5) << "\"" << endl;
+ else if ((*i)->is_mark())
+ {
+ /* this is an index within a track */
+
+ frames_to_cd_frames_string (buf, (*i)->start() - last_start_time, session->frame_rate());
+ out << "INDEX" << buf << endl;
}
-
- out << " }" << endl << "}" << endl;
-
- frames_to_cd_frames_string (buf, last_end_time - spec.start_frame, session->frame_rate());
- out << "FILE \"" << path << "\" " << buf;
-
- frames_to_cd_frames_string (buf, (*i)->end() - last_end_time, session->frame_rate());
- out << buf << endl;
-
- frames_to_cd_frames_string (buf, (*i)->start() - last_end_time, session->frame_rate());
- out << "START" << buf << endl;
-
- last_start_time = (*i)->start();
- last_end_time = (*i)->end();
-
-
- } else if ((*i)->start() < last_end_time) {
- /* this is an index within a track */
-
- frames_to_cd_frames_string (buf, (*i)->start() - last_start_time, session->frame_rate());
- out << "INDEX" << buf << endl;
- }
}
}
void
ExportDialog::export_cue_file (Locations::LocationList& locations, const string& path)
{
- string filepath = path + ".cue";
- ofstream out (filepath.c_str());
+ if(!export_cd_markers_allowed){
+ return;
+ }
+
gchar buf[18];
long unsigned int last_track_end = spec.start_frame;
int numtracks = 0, tracknum = 0, indexnum = 0;
-
+
+ /* Build the cue sheet's file name from the specified audio file name. */
+ string basename = Glib::path_get_basename(path);
+ size_t ext_pos = basename.rfind('.');
+ if (ext_pos != string::npos) {
+ basename = basename.substr(0, ext_pos); /* strip file extension, if there is one */
+ }
+ string filepath = Glib::build_filename(Glib::path_get_dirname(path), basename + ".cue");
+
+ ofstream out (filepath.c_str());
if (!out) {
error << string_compose(_("Editor: cannot open \"%1\" as export file for CD cue file"), filepath) << endmsg;
return;
out << "REM Cue file generated by Ardour" << endl;
out << "TITLE \"" << session->name() << "\"" << endl;
+
+ out << "FILE \"" << Glib::path_get_basename(path) << "\" ";
+
+ /* The cue sheet syntax has originally five file types:
+ WAVE : 44.1 kHz, 16 Bit (little endian)
+ AIFF : 44.1 kHz, 16 Bit (big endian)
+ BINARY : 44.1 kHz, 16 Bit (little endian)
+ MOTOROLA : 44.1 kHz, 16 Bit (big endian)
+ MP3
+
+ We want to use cue sheets not only as CD images but also as general playlyist
+ format, thus for WAVE and AIFF we don't care if it's really 44.1 kHz/16 Bit, the
+ soundfile's header shows it anyway. But for the raw formats, i.e. BINARY
+ and MOTOROLA we do care, because no header would tell us about a different format.
- if ((header_format_combo.get_entry()->get_text() == N_("WAV"))) {
- out << "FILE " << path << " WAVE" << endl;
+ For all other formats we just make up our own file type. MP3 is not supported
+ at the moment.
+ */
+ int file_format = sndfile_header_format_from_string (header_format_combo.get_active_text ());
+ if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV) {
+ out << "WAVE";
+ } else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AIFF) {
+ out << "AIFF";
+ } else if ( ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_RAW)
+ && (sndfile_bitdepth_format_from_string(bitdepth_format_combo.get_active_text()) == SF_FORMAT_PCM_16)
+ && (sample_rate_combo.get_active_text() == _("44.1kHz")) ) {
+ /* raw audio, 16 Bit, 44.1 kHz */
+ if (sndfile_endian_format_from_string(endian_format_combo.get_active_text()) == SF_ENDIAN_LITTLE) {
+ out << "BINARY";
+ } else {
+ out << "MOTOROLA";
+ }
} else {
- out << "FILE " << path << ' ' << (header_format_combo.get_entry()->get_text()) << endl;
+ out << (header_format_combo.get_active_text());
}
+ out << endl;
+
+ if (false && numtracks == 0) {
+ /* the user has supplied no track markers.
+ the entire export is treated as one track.
+ */
+
+ numtracks++;
+ tracknum++;
+ indexnum = 0;
+
+ snprintf (buf, sizeof(buf), " TRACK %02d AUDIO", tracknum);
+ out << buf << endl;
+ out << " FLAGS DCP" << endl;
+
+ /* use the session name*/
- if (numtracks == 0) {
- /* the user has supplied no track markers.
- the entire export is treated as one track.
- */
-
- numtracks++;
- tracknum++;
- indexnum = 0;
- out << endl << "TRACK " << tracknum << " AUDIO" << endl;
- out << "FLAGS " ;
-
- out << "DCP " << endl;
-
- /* use the session name*/
-
- if (session->name() != "") {
- out << "TITLE \"" << session->name() << "\"" << endl;
- }
-
- /* no pregap in this case */
-
- out << "INDEX 00 00:00:00" << endl;
- indexnum++;
- out << "INDEX 01 00:00:00" << endl;
- indexnum++;
- last_track_end = spec.end_frame;
+ out << " TITLE \"" << session->name() << "\"" << endl;
+
+ /* No pregap is specified in this case, adding the default pregap
+ is left to the burning application. */
+
+ out << " INDEX 01 00:00:00" << endl;
+ indexnum = 2;
+ last_track_end = spec.end_frame;
}
if (temp.size()) {
LocationSortByStart cmp;
temp.sort (cmp);
+ Location * curr_range = 0;
+ Locations::LocationList::iterator nexti;
for ( i = temp.begin(); i != temp.end(); ++i) {
- if (!(*i)->is_mark() && ((*i)->start() >= last_track_end)) {
- /* this is a track and it doesn't start inside another one*/
-
- tracknum++;
- indexnum = 0;
- out << endl << "TRACK " << tracknum << " AUDIO" << endl;
- out << "FLAGS " ;
-
- if ((*i)->cd_info.find("scms") != (*i)->cd_info.end()) {
- out << "SCMS ";
- } else {
- out << "DCP ";
- }
-
- if ((*i)->cd_info.find("preemph") != (*i)->cd_info.end()) {
- out << "PRE";
- }
- out << endl;
-
- if ((*i)->cd_info.find("isrc") != (*i)->cd_info.end()) {
- out << "ISRC " << (*i)->cd_info["isrc"] << endl;
-
- }
- if ((*i)->name() != "") {
- out << "TITLE \"" << (*i)->name() << "\"" << endl;
- }
-
- if ((*i)->cd_info.find("performer") != (*i)->cd_info.end()) {
- out << "PERFORMER \"" << (*i)->cd_info["performer"] << "\"" << endl;
- }
-
- if ((*i)->cd_info.find("string_composer") != (*i)->cd_info.end()) {
- out << "SONGWRITER \"" << (*i)->cd_info["string_composer"] << "\"" << endl;
- }
- snprintf (buf, sizeof(buf), "INDEX %02d", indexnum);
- out << buf;
- frames_to_cd_frames_string (buf, last_track_end - spec.start_frame, session->frame_rate());
- out << buf << endl;
- indexnum++;
- last_track_end = (*i)->end();
- }
- if ((tracknum > 0) && ((*i)->start() < last_track_end)) {
- /*this is an index and it lies within a track*/
- snprintf (buf, sizeof(buf), "INDEX %02d", indexnum);
- out << buf;
- frames_to_cd_frames_string (buf,(*i)->start() - spec.start_frame, session->frame_rate());
- out << buf << endl;
- indexnum++;
- }
+ if ((*i)->start() >= last_track_end)
+ {
+ /* this is a track and it doesn't start inside another one*/
+
+ tracknum++;
+ indexnum = 0;
+
+ snprintf (buf, sizeof(buf), " TRACK %02d AUDIO", tracknum);
+ out << buf << endl;
+
+ out << " FLAGS" ;
+ if ((*i)->cd_info.find("scms") != (*i)->cd_info.end()) {
+ out << " SCMS";
+ } else {
+ out << " DCP";
+ }
+ if ((*i)->cd_info.find("preemph") != (*i)->cd_info.end()) {
+ out << " PRE";
+ }
+ out << endl;
+
+ if ((*i)->cd_info.find("isrc") != (*i)->cd_info.end()) {
+ out << " ISRC " << (*i)->cd_info["isrc"] << endl;
+ }
+
+ if ((*i)->name() != "") {
+ out << " TITLE \"" << (*i)->name() << "\"" << endl;
+ }
+
+ if ((*i)->cd_info.find("performer") != (*i)->cd_info.end()) {
+ out << " PERFORMER \"" << (*i)->cd_info["performer"] << "\"" << endl;
+ }
+
+ if ((*i)->cd_info.find("string_composer") != (*i)->cd_info.end()) {
+ out << " SONGWRITER \"" << (*i)->cd_info["string_composer"] << "\"" << endl;
+ }
+
+ /* only print "Index 00" if not at the same position as "Index 01" */
+ if (last_track_end != (*i)->start()) {
+ frames_to_cd_frames_string (buf, last_track_end - spec.start_frame, session->frame_rate());
+ out << " INDEX 00" << buf << endl;
+ }
+
+ indexnum++;
+
+ if ((*i)->is_mark()) {
+ // need to find the next start to define the end
+ nexti = i;
+ ++nexti;
+ if (nexti != temp.end()) {
+ last_track_end = (*nexti)->start();
+ }
+ else {
+ last_track_end = spec.end_frame;
+ }
+ curr_range = 0;
+ }
+ else {
+ last_track_end = (*i)->end();
+ curr_range = (*i);
+ }
+ }
+
+ if ((tracknum > 0) && ((*i)->start() < last_track_end)) {
+ /*this is an index and it lies within a track*/
+ snprintf (buf, sizeof(buf), " INDEX %02d", indexnum);
+ out << buf;
+ frames_to_cd_frames_string (buf,(*i)->start() - spec.start_frame, session->frame_rate());
+ out << buf << endl;
+ indexnum++;
+ }
}
}
}
-
+
void
ExportDialog::do_export_cd_markers (const string& path,const string& cuefile_type)
{
- if (cuefile_type == "TOC") {
+ if (cuefile_type == _("TOC")) {
session->locations()->apply (*this, &ExportDialog::export_toc_file, path);
} else {
session->locations()->apply (*this, &ExportDialog::export_cue_file, path);
}
}
-
-void
-ExportDialog::do_export ()
+string
+ExportDialog::get_suffixed_filepath ()
{
- using namespace CList_Helpers;
-
- ok_button.set_sensitive(false);
- save_state();
+ string filepath = file_entry.get_text();
- if (cue_file_combo.get_entry()->get_text () != _("None")) {
- do_export_cd_markers (file_entry.get_text(), cue_file_combo.get_entry()->get_text ());
- }
-
- if (cuefile_only_checkbox.get_active()) {
- end_dialog ();
- return;
+ if (wants_dir()) {
+ return filepath;
}
- set_modal (true);
+ string::size_type dotpos;
- spec.path = file_entry.get_text();
- spec.progress = 0;
- spec.running = true;
- spec.stop = false;
- spec.port_map.clear();
+ /* maybe add suffix */
- if (channel_count_combo.get_entry()->get_text() == _("mono")) {
- spec.channels = 1;
- } else {
- spec.channels = 2;
- }
-
- spec.format = 0;
-
- spec.format |= sndfile_header_format_from_string (header_format_combo.get_entry()->get_text ());
+ int file_format = sndfile_header_format_from_string (header_format_combo.get_active_text ());
- if ((spec.format & SF_FORMAT_WAV) == 0) {
- /* RIFF/WAV specifies endianess */
- spec.format |= sndfile_endian_format_from_string (endian_format_combo.get_entry()->get_text ());
+ if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV) {
+ if (filepath.find (".wav") != filepath.length() - 4) {
+ if ((dotpos = filepath.rfind ('.')) != string::npos) {
+ filepath = filepath.substr (0, dotpos);
+ }
+ filepath += ".wav";
+ }
+ } else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_AIFF) {
+ if (filepath.find (".aiff") != filepath.length() - 5) {
+ if ((dotpos = filepath.rfind ('.')) != string::npos) {
+ filepath = filepath.substr (0, dotpos);
+ }
+ filepath += ".aiff";
+ }
+ } else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_CAF) {
+ if (filepath.find (".caf") != filepath.length() - 4) {
+ if ((dotpos = filepath.rfind ('.')) != string::npos) {
+ filepath = filepath.substr (0, dotpos);
+ }
+ filepath += ".caf";
+ }
+ } else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_W64) {
+ if (filepath.find (".w64") != filepath.length() - 4) {
+ if ((dotpos = filepath.rfind ('.')) != string::npos) {
+ filepath = filepath.substr (0, dotpos);
+ }
+ filepath += ".w64";
+ }
+ } else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_FLAC) {
+ if (filepath.find (".flac") != filepath.length() - 5) {
+ if ((dotpos = filepath.rfind ('.')) != string::npos) {
+ filepath = filepath.substr (0, dotpos);
+ }
+ filepath += ".flac";
+ }
+ } else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_OGG) {
+ if (filepath.find (".ogg") != filepath.length() - 4) {
+ if ((dotpos = filepath.rfind ('.')) != string::npos) {
+ filepath = filepath.substr (0, dotpos);
+ }
+ filepath += ".ogg";
+ }
+ } else if ((file_format & SF_FORMAT_TYPEMASK) == SF_FORMAT_RAW) {
+ if (filepath.find (".raw") != filepath.length() - 4) {
+ if ((dotpos = filepath.rfind ('.')) != string::npos) {
+ filepath = filepath.substr (0, dotpos);
+ }
+ filepath += ".raw";
+ }
}
+ return filepath;
+}
- spec.format |= sndfile_bitdepth_format_from_string (bitdepth_format_combo.get_entry()->get_text ());
-
- string sr_str = sample_rate_combo.get_entry()->get_text();
- if (sr_str == N_("22.05kHz")) {
- spec.sample_rate = 22050;
- } else if (sr_str == N_("44.1kHz")) {
- spec.sample_rate = 44100;
- } else if (sr_str == N_("48kHz")) {
- spec.sample_rate = 48000;
- } else if (sr_str == N_("88.2kHz")) {
- spec.sample_rate = 88200;
- } else if (sr_str == N_("96kHz")) {
- spec.sample_rate = 96000;
- } else if (sr_str == N_("192kHz")) {
- spec.sample_rate = 192000;
- } else {
- spec.sample_rate = session->frame_rate();
- }
-
- string src_str = src_quality_combo.get_entry()->get_text();
- if (src_str == _("fastest")) {
- spec.src_quality = SRC_ZERO_ORDER_HOLD;
- } else if (src_str == _("linear")) {
- spec.src_quality = SRC_LINEAR;
- } else if (src_str == _("better")) {
- spec.src_quality = SRC_SINC_FASTEST;
- } else if (src_str == _("intermediate")) {
- spec.src_quality = SRC_SINC_MEDIUM_QUALITY;
- } else {
- spec.src_quality = SRC_SINC_BEST_QUALITY;
+void
+ExportDialog::do_export ()
+{
+ if (!ARDOUR_UI::instance()->the_engine().connected()) {
+ MessageDialog msg (*this,
+ _("Not connected to audioengine"),
+ true,
+ MESSAGE_ERROR,
+ BUTTONS_OK);
+ msg.set_secondary_text (_("Ardour cannot export audio when disconnected"));
+ msg.present ();
+ msg.run ();
+ return;
}
- string dither_str = dither_type_combo.get_entry()->get_text();
- if (dither_str == _("None")) {
- spec.dither_type = GDitherNone;
- } else if (dither_str == _("Rectangular")) {
- spec.dither_type = GDitherRect;
- } else if (dither_str == _("Triangular")) {
- spec.dither_type = GDitherTri;
- } else {
- spec.dither_type = GDitherShaped;
- }
+ string filepath;
- if (!audio_region) {
+ filepath = get_suffixed_filepath ();
- uint32_t n = 0;
- uint32_t chan=0;
- Port *last_port = 0;
-
- for (RowIterator ri = master_selector.rows().begin(); ri != master_selector.rows().end(); ++ri, ++n) {
-
- Port* port = static_cast<Port*> ((*ri)->get_data ());
-
- if (last_port != port) {
- chan = 0;
- }
-
- Gdk::Pixmap left_pixmap = master_selector.cell (n, 1).get_pixmap ();
-
- if (left_pixmap.gobj() == check_pixmap) {
- spec.port_map[0].push_back (std::pair<Port*,uint32_t>(port, chan));
- }
-
- if (spec.channels == 2) {
-
- Gdk::Pixmap right_pixmap = master_selector.cell (n, 2).get_pixmap ();
-
- if (right_pixmap.gobj() == check_pixmap) {
- spec.port_map[1].push_back (std::pair<Port*,uint32_t>(port, chan));
- }
-
- }
- }
+ if(!is_filepath_valid(filepath)){
+ return;
+ }
- chan = 0;
- n = 0;
+ if (!Profile->get_sae() && export_cd_markers_allowed) {
+ if (cue_file_combo.get_active_text () != _("None")) {
+ do_export_cd_markers (filepath, cue_file_combo.get_active_text ());
+ }
- for (RowIterator ri = track_selector.rows().begin(); ri != track_selector.rows().end(); ++ri, ++n) {
-
- Port* port = static_cast<Port*> ((*ri)->get_data ());
-
- if (last_port != port) {
- chan = 0;
- }
-
- Gdk::Pixmap left_pixmap = track_selector.cell (n, 1).get_pixmap ();
-
- if (left_pixmap.gobj() == check_pixmap) {
- spec.port_map[0].push_back (std::pair<Port*,uint32_t>(port, chan));
- }
-
- if (spec.channels == 2) {
-
- Gdk::Pixmap right_pixmap = track_selector.cell (n, 2).get_pixmap ();
-
- if (right_pixmap.gobj() == check_pixmap) {
- spec.port_map[1].push_back (std::pair<Port*,uint32_t>(port, chan));
- }
-
- }
-
- last_port = port;
- ++chan;
+ if (cuefile_only_checkbox.get_active()) {
+ end_dialog ();
+ return;
}
}
- progress_connection = Main::timeout.connect (mem_fun(*this, &ExportDialog::progress_timeout), 100);
+ ok_button->set_sensitive(false);
+ save_state();
+
+ set_modal (true);
+
+ // read user input into spec
+ initSpec(filepath);
+
+ progress_connection = Glib::signal_timeout().connect (mem_fun(*this, &ExportDialog::progress_timeout), 100);
cancel_label.set_text (_("Stop Export"));
- if (!audio_region) {
- if (session->start_audio_export (spec)) {
- goto out;
- }
- } else {
- pthread_t thr;
- pthread_create_and_store ("region export", &thr, 0, ExportDialog::_export_region_thread, this);
- }
+ session->pre_export ();
- gtk_main_iteration ();
- while (spec.running) {
- if (gtk_events_pending()) {
- gtk_main_iteration ();
- } else {
- usleep (10000);
- }
- }
+ export_audio_data();
- out:
- progress_connection.disconnect ();
+ progress_connection.disconnect ();
end_dialog ();
+
+ /* if not stopped early and not SAE, ask for money, maybe */
+
+ if (!spec.stop && !Profile->get_sae()) {
+
+ NagScreen* ns = NagScreen::maybe_nag (_("export"));
+
+ if (ns) {
+ ns->nag ();
+ delete ns;
+ }
+ }
}
-
void
ExportDialog::end_dialog ()
{
-
if (spec.running) {
spec.stop = true;
}
}
- session->engine().freewheel (false);
+ session->finalize_audio_export ();
hide_all ();
- if (file_selector) {
- file_selector->hide_all ();
- }
-
set_modal (false);
- ok_button.set_sensitive(true);
+ ok_button->set_sensitive(true);
}
void
return;
}
- /* If it the filename hasn't been set before, use the
- directory above the current session as a default
+ /* If the filename hasn't been set before, use the
+ current session's export directory as a default
location for the export.
*/
if (file_entry.get_text().length() == 0) {
- string dir = session->path();
- string::size_type last_slash;
-
- if ((last_slash = dir.find_last_of ('/')) != string::npos) {
- dir = dir.substr (0, last_slash+1);
+ Glib::ustring export_path = session->export_dir();
+
+ if (!wants_dir()) {
+ export_path = Glib::build_filename (export_path, "export.wav");
}
- file_entry.set_text (dir);
+ file_entry.set_text (export_path);
}
progress_bar.set_fraction (0);
}
}
-gint
-ExportDialog::header_chosen (GdkEventAny* ignored)
+void
+ExportDialog::header_chosen ()
{
- if (sndfile_header_format_from_string (header_format_combo.get_entry()->get_text ()) == SF_FORMAT_WAV) {
+ int fmt = sndfile_header_format_from_string (header_format_combo.get_active_text ());
+
+ if ((fmt & SF_FORMAT_TYPEMASK) == SF_FORMAT_OGG) {
endian_format_combo.set_sensitive (false);
- } else {
- endian_format_combo.set_sensitive (true);
+ bitdepth_format_combo.set_sensitive (false);
+ } else {
+ if ((fmt & SF_FORMAT_TYPEMASK) == SF_FORMAT_WAV) {
+ endian_format_combo.set_sensitive (false);
+ } else {
+ endian_format_combo.set_sensitive (true);
+ }
+ bitdepth_format_combo.set_sensitive (true);
}
- return FALSE;
+
+ file_entry.set_text (get_suffixed_filepath());
}
-gint
-ExportDialog::bitdepth_chosen (GdkEventAny* ignored)
+void
+ExportDialog::bitdepth_chosen ()
{
- int format = sndfile_bitdepth_format_from_string (bitdepth_format_combo.get_entry()->get_text ());
+ int format = sndfile_bitdepth_format_from_string (bitdepth_format_combo.get_active_text ());
switch (format) {
case SF_FORMAT_PCM_24:
case SF_FORMAT_PCM_32:
dither_type_combo.set_sensitive (true);
break;
}
-
- return FALSE;
}
-gint
-ExportDialog::cue_file_type_chosen (GdkEventAny* ignored)
+void
+ExportDialog::cue_file_type_chosen ()
{
- if (cue_file_combo.get_entry()->get_text () != "None") {
+ if (cue_file_combo.get_active_text () != "None") {
cuefile_only_checkbox.set_sensitive (true);
} else {
cuefile_only_checkbox.set_active (false);
cuefile_only_checkbox.set_sensitive (false);
}
- return FALSE;
}
-gint
-ExportDialog::sample_rate_chosen (GdkEventAny* ignored)
+void
+ExportDialog::sample_rate_chosen ()
{
- string sr_str = sample_rate_combo.get_entry()->get_text();
- jack_nframes_t rate;
+ string sr_str = sample_rate_combo.get_active_text();
+ nframes_t rate;
if (sr_str == N_("22.05kHz")) {
rate = 22050;
- } else if (sr_str == N_("44.1kHz")) {
+ } else if (sr_str == _("44.1kHz")) {
rate = 44100;
- } else if (sr_str == N_("48kHz")) {
+ } else if (sr_str == _("48kHz")) {
rate = 48000;
- } else if (sr_str == N_("88.2kHz")) {
+ } else if (sr_str == _("88.2kHz")) {
rate = 88200;
- } else if (sr_str == N_("96kHz")) {
+ } else if (sr_str == _("96kHz")) {
rate = 96000;
- } else if (sr_str == N_("192kHz")) {
+ } else if (sr_str == _("192kHz")) {
rate = 192000;
} else {
rate = session->frame_rate();
} else {
src_quality_combo.set_sensitive (false);
}
-
- return FALSE;
}
-gint
-ExportDialog::channels_chosen (GdkEventAny* ignored)
+void
+ExportDialog::channels_chosen ()
{
bool mono;
- mono = (channel_count_combo.get_entry()->get_text() == _("mono"));
+ mono = (channel_count_combo.get_active_text() == _("mono"));
if (mono) {
- track_selector.set_column_visibility (2, false);
- track_selector.set_column_title (1, _("Export"));
+ track_selector.get_column(2)->set_visible(false);
+ track_selector.get_column(1)->set_title(_("Export"));
if (session->master_out()) {
- master_selector.set_column_visibility (2, false);
- master_selector.set_column_title (1, _("Export"));
+ master_selector.get_column(2)->set_visible(false);
+ master_selector.get_column(1)->set_title(_("Export"));
}
} else {
- track_selector.set_column_visibility (2, true);
- track_selector.set_column_title (1, _("Left"));
- track_selector.set_column_title (2, _("Right"));
+ track_selector.get_column(2)->set_visible(true);
+ track_selector.get_column(1)->set_title(_("Left"));
if (session->master_out()) {
- master_selector.set_column_visibility (2, true);
- master_selector.set_column_title (1, _("Left"));
- master_selector.set_column_title (2, _("Right"));
+ master_selector.get_column(2)->set_visible(true);
+ master_selector.get_column(1)->set_title(_("Left"));
}
}
- track_selector.column_titles_show ();
- track_selector.clear ();
- master_selector.column_titles_show ();
- master_selector.clear ();
-
- Session::RouteList routes = session->get_routes ();
+ fill_lists();
+}
- for (Session::RouteList::iterator ri = routes.begin(); ri != routes.end(); ++ri) {
+void
+ExportDialog::fill_lists ()
+{
+ track_list->clear();
+ master_list->clear();
+
+ boost::shared_ptr<Session::RouteList> routes = session->get_routes ();
- Route* route = (*ri);
+ for (Session::RouteList::iterator ri = routes->begin(); ri != routes->end(); ++ri) {
+
+ boost::shared_ptr<Route> route = (*ri);
if (route->hidden()) {
continue;
}
for (uint32_t i=0; i < route->n_outputs(); ++i) {
-
- list<string> stupid_list;
-
+ string name;
if (route->n_outputs() == 1) {
- stupid_list.push_back (route->name());
+ name = route->name();
} else {
- stupid_list.push_back (string_compose("%1: out-%2", route->name(), i+1));
+ name = string_compose("%1: out-%2", route->name(), i+1);
}
- stupid_list.push_back ("");
- stupid_list.push_back ("");
-
if (route == session->master_out()) {
- master_selector.rows().push_back (stupid_list);
- CList_Helpers::Row row = master_selector.rows().back();
- row.set_data (route->output (i));
- master_selector.cell (row.get_row_num(), 1).set_pixmap (empty_pixmap, empty_mask);
- master_selector.cell (row.get_row_num(), 2).set_pixmap (empty_pixmap, empty_mask);
+ TreeModel::iterator iter = master_list->append();
+ TreeModel::Row row = *iter;
+ row[exp_cols.output] = name;
+ row[exp_cols.left] = false;
+ row[exp_cols.right] = false;
+ row[exp_cols.port] = route->output (i);
} else {
- track_selector.rows().push_back (stupid_list);
- CList_Helpers::Row row = track_selector.rows().back();
- row.set_data (route->output (i));
- track_selector.cell (row.get_row_num(), 1).set_pixmap (empty_pixmap, empty_mask);
- track_selector.cell (row.get_row_num(), 2).set_pixmap (empty_pixmap, empty_mask);
+ TreeModel::iterator iter = track_list->append();
+ TreeModel::Row row = *iter;
+ row[exp_cols.output] = name;
+ row[exp_cols.left] = false;
+ row[exp_cols.right] = false;
+ row[exp_cols.port] = route->output (i);
}
}
}
-
- track_selector.select_all ();
- master_selector.select_all ();
+}
+
- return FALSE;
+bool
+ExportDialog::is_filepath_valid(string &filepath)
+{
+ // sanity check file name first
+
+ struct stat statbuf;
+
+ if (filepath.empty()) {
+ string txt = _("Please enter a valid filename.");
+ MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);
+ msg.run();
+ return false;
+ }
+
+ // check if file exists already and warn
+
+ if (stat (filepath.c_str(), &statbuf) == 0) {
+ if (S_ISDIR (statbuf.st_mode)) {
+ string txt = _("Please specify a complete filename for the audio file.");
+ MessageDialog msg (*this, txt, false, MESSAGE_ERROR, BUTTONS_OK, true);
+ msg.run();
+ return false;
+ }
+ else {
+ string txt = _("File already exists, do you want to overwrite it?");
+ MessageDialog msg (*this, txt, false, MESSAGE_QUESTION, BUTTONS_YES_NO, true);
+ if ((ResponseType) msg.run() == Gtk::RESPONSE_NO) {
+ return false;
+ }
+ }
+ }
+
+ // directory needs to exist and be writable
+
+ 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);
+ msg.run();
+ return false;
+ }
+
+ return true;
}
-gint
-ExportDialog::track_selector_button_press_event (GdkEventButton* ev)
+void
+ExportDialog::initSpec(string &filepath)
{
- gint row, col;
+ spec.path = filepath;
+ spec.progress = 0;
+ spec.running = false;
+ spec.stop = false;
+ spec.port_map.clear();
+
+ if (channel_count_combo.get_active_text() == _("mono")) {
+ spec.channels = 1;
+ } else {
+ spec.channels = 2;
+ }
+
+ spec.format = 0;
- if (track_selector.get_selection_info ((int)ev->x, (int)ev->y, &row, &col) == 0) {
- return FALSE;
+ spec.format |= sndfile_header_format_from_string (header_format_combo.get_active_text ());
+
+ /* if they picked Ogg, give them Ogg/Vorbis */
+
+ if ((spec.format & SF_FORMAT_TYPEMASK) == SF_FORMAT_OGG) {
+ spec.format |= SF_FORMAT_VORBIS;
}
- gtk_signal_emit_stop_by_name (GTK_OBJECT(track_selector.gobj()), "button_press_event");
-
- Gdk::Pixmap pixmap = track_selector.cell (row,col).get_pixmap ();
+ if (!Profile->get_sae()) {
+ if (((spec.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_WAV) && ((spec.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_OGG)) {
+ /* RIFF/WAV specifies endianess and O/V has no such concept */
+ spec.format |= sndfile_endian_format_from_string (endian_format_combo.get_active_text ());
+ }
+ }
+
+ if ((spec.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_OGG) {
+ spec.format |= sndfile_bitdepth_format_from_string (bitdepth_format_combo.get_active_text ());
+ }
- if (col != 0) {
- if (pixmap.gobj() == check_pixmap) {
- track_selector.cell (row,col).set_pixmap (empty_pixmap, empty_mask);
+ string sr_str = sample_rate_combo.get_active_text();
+ if (sr_str == N_("22.05kHz")) {
+ spec.sample_rate = 22050;
+ } else if (sr_str == _("44.1kHz")) {
+ spec.sample_rate = 44100;
+ } else if (sr_str == _("48kHz")) {
+ spec.sample_rate = 48000;
+ } else if (sr_str == _("88.2kHz")) {
+ spec.sample_rate = 88200;
+ } else if (sr_str == _("96kHz")) {
+ spec.sample_rate = 96000;
+ } else if (sr_str == _("192kHz")) {
+ spec.sample_rate = 192000;
+ } else {
+ spec.sample_rate = session->frame_rate();
+ }
+
+ if (Profile->get_sae()) {
+ spec.src_quality = SRC_SINC_BEST_QUALITY;
+ } else {
+ string src_str = src_quality_combo.get_active_text();
+ if (src_str == _("fastest")) {
+ spec.src_quality = SRC_ZERO_ORDER_HOLD;
+ } else if (src_str == _("linear")) {
+ spec.src_quality = SRC_LINEAR;
+ } else if (src_str == _("better")) {
+ spec.src_quality = SRC_SINC_FASTEST;
+ } else if (src_str == _("intermediate")) {
+ spec.src_quality = SRC_SINC_MEDIUM_QUALITY;
} else {
- track_selector.cell (row,col).set_pixmap (check_pixmap, check_mask);
+ spec.src_quality = SRC_SINC_BEST_QUALITY;
}
}
-
- return TRUE;
+
+ string dither_str = dither_type_combo.get_active_text();
+ if (dither_str == _("None")) {
+ spec.dither_type = GDitherNone;
+ } else if (dither_str == _("Rectangular")) {
+ spec.dither_type = GDitherRect;
+ } else if (dither_str == _("Triangular")) {
+ spec.dither_type = GDitherTri;
+ } else {
+ spec.dither_type = GDitherShaped;
+ }
+
+ write_track_and_master_selection_to_spec();
}
-gint
-ExportDialog::master_selector_button_press_event (GdkEventButton* ev)
-{
- gint row, col;
- if (master_selector.get_selection_info ((int)ev->x, (int)ev->y, &row, &col) == 0) {
- return FALSE;
+void
+ExportDialog::write_track_and_master_selection_to_spec()
+{
+ if(!track_and_master_selection_allowed){
+ return;
}
- gtk_signal_emit_stop_by_name (GTK_OBJECT(master_selector.gobj()), "button_press_event");
-
- if (col != 0) {
- Gdk::Pixmap pixmap = master_selector.cell (row,col).get_pixmap ();
+ uint32_t chan=0;
+ Port *last_port = 0;
- if (pixmap.gobj() == check_pixmap) {
- master_selector.cell (row,col).set_pixmap (empty_pixmap, empty_mask);
- } else {
- master_selector.cell (row,col).set_pixmap (check_pixmap, check_mask);
+ TreeModel::Children rows = master_selector.get_model()->children();
+ TreeModel::Children::iterator ri;
+ TreeModel::Row row;
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
+ row = *ri;
+ Port* port = row[exp_cols.port];
+
+ if (last_port != port) {
+ chan = 0;
+ }
+
+ if (row[exp_cols.left]) {
+ spec.port_map[0].push_back (std::pair<Port*,uint32_t>(port, chan));
+ }
+
+ if (spec.channels == 2) {
+ if (row[exp_cols.right]) {
+ spec.port_map[1].push_back (std::pair<Port*,uint32_t>(port, chan));
+ }
}
}
- return TRUE;
+ chan = 0;
+ rows = track_selector.get_model()->children();
+
+ for (ri = rows.begin(); ri != rows.end(); ++ri) {
+ row = *ri;
+
+ Port* port = row[exp_cols.port];
+
+ if (last_port != port) {
+ chan = 0;
+ }
+
+ if (row[exp_cols.left]) {
+ spec.port_map[0].push_back (std::pair<Port*,uint32_t>(port, chan));
+ }
+
+ if (spec.channels == 2) {
+ if (row[exp_cols.right]) {
+ spec.port_map[1].push_back (std::pair<Port*,uint32_t>(port, chan));
+ }
+
+ }
+
+ last_port = port;
+ ++chan;
+ }
}
+
gint
ExportDialog::window_closed (GdkEventAny *ignored)
{
end_dialog ();
return TRUE;
}
+
void
-ExportDialog::initiate_browse ()
+ExportDialog::browse ()
{
- if (file_selector == 0) {
- file_selector = new FileSelection;
- file_selector->set_modal (true);
-
- file_selector->get_cancel_button()->signal_clicked().connect (bind (mem_fun(*this, &ExportDialog::finish_browse), -1));
- file_selector->get_ok_button()->signal_clicked().connect (bind (mem_fun(*this, &ExportDialog::finish_browse), 1));
- file_selector->signal_map_event().connect (bind (mem_fun(*this, &ExportDialog::change_focus_policy), true));
- file_selector->signal_unmap_event().connect (bind (mem_fun(*this, &ExportDialog::change_focus_policy), false));
- }
- file_selector->show_all ();
-}
+ FileChooserDialog dialog("Export to file", browse_action());
+ dialog.set_transient_for(*this);
+ dialog.set_filename (file_entry.get_text());
-gint
-ExportDialog::change_focus_policy (GdkEventAny *ev, bool yn)
-{
- Keyboard::the_keyboard().allow_focus (yn);
- return FALSE;
-}
+ dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
+ dialog.add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
+
+ int result = dialog.run();
-void
-ExportDialog::finish_browse (int status)
-{
- if (file_selector) {
- if (status > 0) {
- string result = file_selector->get_filename();
-
- if (result.length()) {
- file_entry.set_text (result);
- }
+ if (result == Gtk::RESPONSE_OK) {
+ string filename = dialog.get_filename();
+
+ if (filename.length()) {
+ file_entry.set_text (filename);
}
- file_selector->hide_all();
}
}