X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftime_info_box.cc;h=364b0fda43025111e7c85216dd6556624f884be4;hb=c08b336292cd66e066eae23bc6272dce42ae28c2;hp=515d49f72b6faf18c73c9e040c666c8940f0d348;hpb=20aeb5af0abd50dc01db503d65897c7dfebf6467;p=ardour.git diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc index 515d49f72b..364b0fda43 100644 --- a/gtk2_ardour/time_info_box.cc +++ b/gtk2_ardour/time_info_box.cc @@ -32,6 +32,8 @@ #include "time_info_box.h" #include "audio_clock.h" #include "editor.h" +#include "control_point.h" +#include "automation_line.h" #include "i18n.h" @@ -46,6 +48,8 @@ TimeInfoBox::TimeInfoBox () , syncing_selection (false) , syncing_punch (false) { + set_name (X_("TimeInfoBox")); + selection_start = new AudioClock ("selection-start", false, "selection", false, false, false, false); selection_end = new AudioClock ("selection-end", false, "selection", false, false, false, false); selection_length = new AudioClock ("selection-length", false, "selection", false, false, true, false); @@ -63,7 +67,7 @@ TimeInfoBox::TimeInfoBox () punch_title.set_text (_("Punch")); set_homogeneous (false); - set_spacing (6); + set_spacing (0); set_border_width (2); pack_start (left, true, true); @@ -82,7 +86,7 @@ TimeInfoBox::TimeInfoBox () Gtk::Label* l; selection_title.set_name ("TimeInfoSelectionTitle"); - left.attach (selection_title, 0, 2, 0, 1); + left.attach (selection_title, 1, 2, 0, 1); l = manage (new Label); l->set_text (_("Start")); l->set_alignment (1.0, 0.5); @@ -118,7 +122,7 @@ TimeInfoBox::TimeInfoBox () Gtkmm2ext::UI::instance()->set_tip (punch_out_button, _("Stop recording at auto-punch end")); punch_title.set_name ("TimeInfoSelectionTitle"); - right.attach (punch_title, 2, 4, 0, 1); + right.attach (punch_title, 3, 4, 0, 1); right.attach (punch_in_button, 2, 3, 1, 2, FILL, SHRINK); right.attach (*punch_start, 3, 4, 1, 2); right.attach (punch_out_button, 2, 3, 2, 3, FILL, SHRINK); @@ -142,7 +146,7 @@ TimeInfoBox::TimeInfoBox () Editor::instance().get_selection().TimeChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed)); Editor::instance().get_selection().RegionsChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed)); - Editor::instance().MouseModeChanged.connect (editor_connections, invalidator(*this), ui_bind (&TimeInfoBox::track_mouse_mode, this), gui_context()); + Editor::instance().MouseModeChanged.connect (editor_connections, invalidator(*this), boost::bind (&TimeInfoBox::track_mouse_mode, this), gui_context()); } TimeInfoBox::~TimeInfoBox () @@ -247,15 +251,29 @@ TimeInfoBox::selection_changed () } else { if (selection.regions.empty()) { if (selection.points.empty()) { - selection_start->set_off (true); - selection_end->set_off (true); - selection_length->set_off (true); + Glib::RefPtr act = ActionManager::get_action ("MouseMode", "set-mouse-mode-object-range"); + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + + if (tact && tact->get_active() && !selection.time.empty()) { + /* show selected range */ + selection_start->set_off (false); + selection_end->set_off (false); + selection_length->set_off (false); + selection_start->set (selection.time.start()); + selection_end->set (selection.time.end_frame()); + selection_length->set (selection.time.length()); + } else { + selection_start->set_off (true); + selection_end->set_off (true); + selection_length->set_off (true); + } } else { s = max_framepos; e = 0; for (PointSelection::iterator i = selection.points.begin(); i != selection.points.end(); ++i) { - s = min (s, (framepos_t) i->start); - e = max (e, (framepos_t) i->end); + framepos_t const p = (*i)->line().session_position ((*i)->model ()); + s = min (s, p); + e = max (e, p); } selection_start->set_off (false); selection_end->set_off (false); @@ -279,9 +297,24 @@ TimeInfoBox::selection_changed () case Editing::MouseRange: if (selection.time.empty()) { - selection_start->set_off (true); - selection_end->set_off (true); - selection_length->set_off (true); + Glib::RefPtr act = ActionManager::get_action ("MouseMode", "set-mouse-mode-object-range"); + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); + + if (tact && tact->get_active() && !selection.regions.empty()) { + /* show selected regions */ + s = selection.regions.start(); + e = selection.regions.end_frame(); + selection_start->set_off (false); + selection_end->set_off (false); + selection_length->set_off (false); + selection_start->set (s); + selection_end->set (e); + selection_length->set (e - s + 1); + } else { + selection_start->set_off (true); + selection_end->set_off (true); + selection_length->set_off (true); + } } else { selection_start->set_off (false); selection_end->set_off (false);