X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_timespan_selector.cc;h=f239ab194ba2533f10e3bd00bd0b106f114aefa0;hb=d176cbc80476cdc8ca082631efc171ea39116d63;hp=cea01ff4c8455df59c7e90d56c34ce835c046802;hpb=6fb2f3e743310b9236aeb056f2ddfa10195e5623;p=ardour.git diff --git a/gtk2_ardour/export_timespan_selector.cc b/gtk2_ardour/export_timespan_selector.cc index cea01ff4c8..f239ab194b 100644 --- a/gtk2_ardour/export_timespan_selector.cc +++ b/gtk2_ardour/export_timespan_selector.cc @@ -22,7 +22,6 @@ #include "ardour_ui.h" -#include "ardour/tempo.h" #include "ardour/location.h" #include "ardour/types.h" #include "ardour/session.h" @@ -51,6 +50,22 @@ ExportTimespanSelector::ExportTimespanSelector (ARDOUR::Session * session, Profi option_hbox.pack_start (time_format_label, false, false, 0); option_hbox.pack_start (time_format_combo, false, false, 6); + Gtk::Button* b = manage (new Gtk::Button (_("Select All"))); + b->signal_clicked().connect ( + sigc::bind ( + sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), true + ) + ); + option_hbox.pack_start (*b, false, false, 6); + + b = manage (new Gtk::Button (_("Deselect All"))); + b->signal_clicked().connect ( + sigc::bind ( + sigc::mem_fun (*this, &ExportTimespanSelector::set_selection_state_of_all_timespans), false + ) + ); + option_hbox.pack_start (*b, false, false, 6); + range_scroller.add (range_view); pack_start (option_hbox, false, false, 0); @@ -102,12 +117,10 @@ ExportTimespanSelector::~ExportTimespanSelector () void ExportTimespanSelector::add_range_to_selection (ARDOUR::Location const * loc) { - TimespanPtr span = _session->get_export_handler()->add_timespan(); + ExportTimespanPtr span = _session->get_export_handler()->add_timespan(); std::string id; - if (loc == state->session_range.get()) { - id = "session"; - } else if (loc == state->selection_range.get()) { + if (loc == state->selection_range.get()) { id = "selection"; } else { id = loc->id().to_s(); @@ -180,9 +193,6 @@ ExportTimespanSelector::construct_label (ARDOUR::Location const * location) cons start = to_string (start_frame, std::dec); end = to_string (end_frame, std::dec); break; - - case AudioClock::Off: - break; } // label += _("from "); @@ -208,7 +218,7 @@ ExportTimespanSelector::construct_length (ARDOUR::Location const * location) con } std::stringstream s; - + switch (state->time_format) { case AudioClock::BBT: s << bbt_str (location->length ()); @@ -225,13 +235,10 @@ ExportTimespanSelector::construct_length (ARDOUR::Location const * location) con case AudioClock::MinSec: s << ms_str (location->length ()); break; - + case AudioClock::Frames: s << location->length (); break; - - case AudioClock::Off: - break; } return s.str (); @@ -323,6 +330,14 @@ ExportTimespanSelector::update_range_name (std::string const & path, std::string CriticalSelectionChanged(); } +void +ExportTimespanSelector::set_selection_state_of_all_timespans (bool s) +{ + for (Gtk::ListStore::Children::iterator it = range_list->children().begin(); it != range_list->children().end(); ++it) { + it->set_value (range_cols.selected, s); + } +} + /*** ExportTimespanSelectorSingle ***/ ExportTimespanSelectorSingle::ExportTimespanSelectorSingle (ARDOUR::Session * session, ProfileManagerPtr manager, std::string range_id) : @@ -332,12 +347,6 @@ ExportTimespanSelectorSingle::ExportTimespanSelectorSingle (ARDOUR::Session * se range_scroller.set_policy (Gtk::POLICY_NEVER, Gtk::POLICY_NEVER); range_view.append_column_editable (_("Range"), range_cols.name); - // Adjust selector height - int x_offset, y_offset, width, height; - Gtk::CellRenderer * renderer = *range_view.get_column(0)->get_cell_renderers().begin(); - renderer->get_size (range_view, x_offset, y_offset, width, height); - range_scroller.set_size_request (-1, height); - if (Gtk::CellRendererText * renderer = dynamic_cast (range_view.get_column_cell_renderer (0))) { renderer->signal_edited().connect (sigc::mem_fun (*this, &ExportTimespanSelectorSingle::update_range_name)); } @@ -356,9 +365,7 @@ ExportTimespanSelectorSingle::fill_range_list () if (!state) { return; } std::string id; - if (!range_id.compare (X_("session"))) { - id = state->session_range->id().to_s(); - } else if (!range_id.compare (X_("selection"))) { + if (!range_id.compare (X_("selection"))) { id = state->selection_range->id().to_s(); } else { id = range_id; @@ -448,9 +455,8 @@ ExportTimespanSelectorMultiple::set_selection_from_state () for (tree_it = range_list->children().begin(); tree_it != range_list->children().end(); ++tree_it) { Location * loc = tree_it->get_value (range_cols.location); - if ((!id.compare ("session") && loc == state->session_range.get()) || - (!id.compare ("selection") && loc == state->selection_range.get()) || - (!id.compare (loc->id().to_s()))) { + if ((id == "selection" && loc == state->selection_range.get()) || + (id == loc->id().to_s())) { tree_it->set_value (range_cols.selected, true); } }