X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_format_dialog.cc;h=1e8e87c7cf88e471be9a166c315df3ab186b355c;hb=d1f45e9b3d6a7e272e5563cc50175dfb6d904361;hp=5fa8333116642e84c548398fe041965a718fc01b;hpb=27bdf4700afc48b13d596d4e3cb515066f595a2f;p=ardour.git diff --git a/gtk2_ardour/export_format_dialog.cc b/gtk2_ardour/export_format_dialog.cc index 5fa8333116..1e8e87c7cf 100644 --- a/gtk2_ardour/export_format_dialog.cc +++ b/gtk2_ardour/export_format_dialog.cc @@ -36,6 +36,7 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) : applying_changes_from_engine (0), name_label (_("Label: "), Gtk::ALIGN_LEFT), + name_generated_part ("", Gtk::ALIGN_LEFT), normalize_checkbox (_("Normalize to:")), normalize_adjustment (0.00, -90.00, 0.00, 0.1, 0.2), @@ -44,11 +45,11 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) : silence_table (2, 4), trim_start_checkbox (_("Trim silence at start")), silence_start_checkbox (_("Add silence at start:")), - silence_start_clock ("silence_start", true, "PreRollClock", true, false, true), + silence_start_clock ("silence_start", true, "", true, false, true), trim_end_checkbox (_("Trim silence at end")), silence_end_checkbox (_("Add silence at end:")), - silence_end_clock ("silence_end", true, "PreRollClock", true, false, true), + silence_end_clock ("silence_end", true, "", true, false, true), format_table (3, 4), compatibility_label (_("Compatibility"), Gtk::ALIGN_LEFT), @@ -64,20 +65,30 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) : sample_format_label (_("Sample Format"), Gtk::ALIGN_LEFT), dither_label (_("Dithering"), Gtk::ALIGN_LEFT), + with_cue (_("Create CUE file for disk-at-once CD/DVD creation")), + with_toc (_("Create TOC file for disk-at-once CD/DVD creation")), + tag_checkbox (_("Tag file with session's metadata")) { /* Pack containers in dialog */ - get_vbox()->pack_start (name_hbox, false, false, 0); get_vbox()->pack_start (silence_table, false, false, 6); get_vbox()->pack_start (format_table, false, false, 6); get_vbox()->pack_start (encoding_options_vbox, false, false, 0); + get_vbox()->pack_start (cue_toc_vbox, false, false, 0); + get_vbox()->pack_start (name_hbox, false, false, 6); /* Name, new and remove */ name_hbox.pack_start (name_label, false, false, 0); - name_hbox.pack_start (name_entry, true, true, 0); + name_hbox.pack_start (name_entry, false, false, 0); + name_hbox.pack_start (name_generated_part, true, true, 0); + name_entry.set_width_chars(20); + update_description(); + manager.DescriptionChanged.connect( + *this, invalidator (*this), + boost::bind (&ExportFormatDialog::update_description, this), gui_context()); /* Normalize */ @@ -127,7 +138,13 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) : close_button = add_button (Gtk::Stock::SAVE, Gtk::RESPONSE_APPLY); close_button->set_sensitive (false); close_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportFormatDialog::end_dialog)); - manager.CompleteChanged.connect (*this, invalidator (*this), ui_bind (&Gtk::Button::set_sensitive, close_button, _1), gui_context()); + manager.CompleteChanged.connect (*this, invalidator (*this), boost::bind (&Gtk::Button::set_sensitive, close_button, _1), gui_context()); + + with_cue.signal_toggled().connect (sigc::mem_fun (*this, &ExportFormatDialog::update_with_cue)); + with_toc.signal_toggled().connect (sigc::mem_fun (*this, &ExportFormatDialog::update_with_toc)); + + cue_toc_vbox.pack_start (with_cue, false, false); + cue_toc_vbox.pack_start (with_toc, false, false); /* Load state before hooking up the rest of the signals */ @@ -228,11 +245,14 @@ ExportFormatDialog::load_state (FormatPtr spec) trim_start_checkbox.set_active (spec->trim_beginning()); silence_start = spec->silence_beginning_time(); - silence_start_checkbox.set_active (spec->silence_beginning() > 0); + silence_start_checkbox.set_active (spec->silence_beginning_time().not_zero()); trim_end_checkbox.set_active (spec->trim_end()); silence_end = spec->silence_end_time(); - silence_end_checkbox.set_active (spec->silence_end() > 0); + silence_end_checkbox.set_active (spec->silence_end_time().not_zero()); + + with_cue.set_active (spec->with_cue()); + with_toc.set_active (spec->with_toc()); for (Gtk::ListStore::Children::iterator it = src_quality_list->children().begin(); it != src_quality_list->children().end(); ++it) { if (it->get_value (src_quality_cols.id) == spec->src_quality()) { @@ -323,7 +343,7 @@ ExportFormatDialog::init_format_table () row[compatibility_cols.label] = (*it)->name(); WeakCompatPtr ptr (*it); - (*it)->SelectChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_compatibility_selection, this, _1, ptr), gui_context()); + (*it)->SelectChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_compatibility_selection, this, _1, ptr), gui_context()); } compatibility_view.append_column_editable ("", compatibility_cols.selected); @@ -351,8 +371,8 @@ ExportFormatDialog::init_format_table () row[quality_cols.label] = (*it)->name(); WeakQualityPtr ptr (*it); - (*it)->SelectChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_quality_selection, this, _1, ptr), gui_context()); - (*it)->CompatibleChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_quality_compatibility, this, _1, ptr), gui_context()); + (*it)->SelectChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_quality_selection, this, _1, ptr), gui_context()); + (*it)->CompatibleChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_quality_compatibility, this, _1, ptr), gui_context()); } quality_view.append_column ("", quality_cols.label); @@ -373,19 +393,19 @@ ExportFormatDialog::init_format_table () row[format_cols.label] = (*it)->name(); WeakFormatPtr ptr (*it); - (*it)->SelectChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_format_selection, this, _1, ptr), gui_context()); - (*it)->CompatibleChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_format_compatibility, this, _1, ptr), gui_context()); + (*it)->SelectChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_format_selection, this, _1, ptr), gui_context()); + (*it)->CompatibleChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_format_compatibility, this, _1, ptr), gui_context()); /* Encoding options */ boost::shared_ptr hsf; - if (hsf = boost::dynamic_pointer_cast (*it)) { - hsf->SampleFormatSelectChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_sample_format_selection, this, _1, _2), gui_context()); - hsf->SampleFormatCompatibleChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_sample_format_compatibility, this, _1, _2), gui_context()); + if ((hsf = boost::dynamic_pointer_cast (*it))) { + hsf->SampleFormatSelectChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_sample_format_selection, this, _1, _2), gui_context()); + hsf->SampleFormatCompatibleChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_sample_format_compatibility, this, _1, _2), gui_context()); - hsf->DitherTypeSelectChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_dither_type_selection, this, _1, _2), gui_context()); - hsf->DitherTypeCompatibleChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_dither_type_compatibility, this, _1, _2), gui_context()); + hsf->DitherTypeSelectChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_dither_type_selection, this, _1, _2), gui_context()); + hsf->DitherTypeCompatibleChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_dither_type_compatibility, this, _1, _2), gui_context()); } } @@ -405,10 +425,10 @@ ExportFormatDialog::init_format_table () row[sample_rate_cols.ptr] = *it; row[sample_rate_cols.color] = "white"; row[sample_rate_cols.label] = (*it)->name(); - + WeakSampleRatePtr ptr (*it); - (*it)->SelectChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_sample_rate_selection, this, _1, ptr), gui_context()); - (*it)->CompatibleChanged.connect (*this, invalidator (*this), ui_bind (&ExportFormatDialog::change_sample_rate_compatibility, this, _1, ptr), gui_context()); + (*it)->SelectChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_sample_rate_selection, this, _1, ptr), gui_context()); + (*it)->CompatibleChanged.connect (*this, invalidator (*this), boost::bind (&ExportFormatDialog::change_sample_rate_compatibility, this, _1, ptr), gui_context()); } sample_rate_view.append_column ("", sample_rate_cols.label); @@ -493,7 +513,7 @@ ExportFormatDialog::update_compatibility_selection (std::string const & path) { Gtk::TreeModel::iterator iter = compatibility_view.get_model ()->get_iter (path); - ExportFormatManager::CompatPtr ptr = iter->get_value (compatibility_cols.ptr); + ExportFormatCompatibilityPtr ptr = iter->get_value (compatibility_cols.ptr); bool state = iter->get_value (compatibility_cols.selected); iter->set_value (compatibility_cols.selected, state); @@ -553,7 +573,7 @@ ExportFormatDialog::change_compatibility_selection (bool select, WeakCompatPtr c { ++applying_changes_from_engine; - ExportFormatManager::CompatPtr ptr = compat.lock(); + ExportFormatCompatibilityPtr ptr = compat.lock(); for (Gtk::ListStore::Children::iterator it = compatibility_list->children().begin(); it != compatibility_list->children().end(); ++it) { if (it->get_value (compatibility_cols.ptr) == ptr) { @@ -576,7 +596,7 @@ ExportFormatDialog::change_format_selection (bool select, WeakFormatPtr format) { change_selection (select, format, format_list, format_view, format_cols); - ExportFormatManager::FormatPtr ptr = format.lock(); + ExportFormatPtr ptr = format.lock(); if (select && ptr) { change_encoding_options (ptr); @@ -685,6 +705,25 @@ ExportFormatDialog::change_compatibility (bool compatibility, boost::weak_ptr } } +void +ExportFormatDialog::update_with_cue () +{ + manager.select_with_cue (with_cue.get_active()); +} + +void +ExportFormatDialog::update_with_toc () +{ + manager.select_with_toc (with_toc.get_active()); +} + +void +ExportFormatDialog::update_description() +{ + std::string text = ": " + format->description(false); + name_generated_part.set_text(text); +} + void ExportFormatDialog::update_name () { @@ -732,7 +771,7 @@ void ExportFormatDialog::update_clock (AudioClock & clock, ARDOUR::AnyTime const & time) { // TODO position - clock.set (_session->convert_to_frames_at (0, time), true); + clock.set (_session->convert_to_frames (time), true); AudioClock::Mode mode(AudioClock::Timecode); @@ -780,9 +819,6 @@ ExportFormatDialog::update_time (AnyTime & time, AudioClock const & clock) time.type = AnyTime::Frames; time.frames = frames; break; - case AudioClock::Off: - silence_end_checkbox.set_active (false); - return; } } @@ -801,7 +837,7 @@ ExportFormatDialog::update_tagging_selection () } void -ExportFormatDialog::change_encoding_options (ExportFormatManager::FormatPtr ptr) +ExportFormatDialog::change_encoding_options (ExportFormatPtr ptr) { empty_encoding_option_table (); @@ -810,13 +846,13 @@ ExportFormatDialog::change_encoding_options (ExportFormatManager::FormatPtr ptr) boost::shared_ptr flac_ptr; boost::shared_ptr bwf_ptr; - if (linear_ptr = boost::dynamic_pointer_cast (ptr)) { + if ((linear_ptr = boost::dynamic_pointer_cast (ptr))) { show_linear_enconding_options (linear_ptr); - } else if (ogg_ptr = boost::dynamic_pointer_cast (ptr)) { + } else if ((ogg_ptr = boost::dynamic_pointer_cast (ptr))) { show_ogg_enconding_options (ogg_ptr); - } else if (flac_ptr = boost::dynamic_pointer_cast (ptr)) { + } else if ((flac_ptr = boost::dynamic_pointer_cast (ptr))) { show_flac_enconding_options (flac_ptr); - } else if (bwf_ptr = boost::dynamic_pointer_cast (ptr)) { + } else if ((bwf_ptr = boost::dynamic_pointer_cast (ptr))) { show_bwf_enconding_options (bwf_ptr); } else { std::cout << "Unrecognized format!" << std::endl;