X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Ftime_info_box.cc;h=a26ec50932c2f04e8d2d4e4824e2f243be7c2f7f;hb=22b07e0233a29d9633ffa825a79503befaf2e16e;hp=364b0fda43025111e7c85216dd6556624f884be4;hpb=82a2e96e8cbd058b1da5ffc40553a6ca6bd93d25;p=ardour.git diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc index 364b0fda43..a26ec50932 100644 --- a/gtk2_ardour/time_info_box.cc +++ b/gtk2_ardour/time_info_box.cc @@ -27,6 +27,7 @@ #include "gtkmm2ext/actions.h" #include "ardour/location.h" +#include "ardour/profile.h" #include "ardour/session.h" #include "time_info_box.h" @@ -71,7 +72,9 @@ TimeInfoBox::TimeInfoBox () set_border_width (2); pack_start (left, true, true); - pack_start (right, true, true); + if (!ARDOUR::Profile->get_trx()) { + pack_start (right, true, true); + } left.set_homogeneous (false); left.set_spacings (0); @@ -146,6 +149,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)); + Region::RegionPropertyChanged.connect (region_property_connections, invalidator (*this), boost::bind (&TimeInfoBox::region_property_change, this, _1, _2), gui_context()); Editor::instance().MouseModeChanged.connect (editor_connections, invalidator(*this), boost::bind (&TimeInfoBox::track_mouse_mode, this), gui_context()); } @@ -154,7 +158,7 @@ TimeInfoBox::~TimeInfoBox () delete selection_length; delete selection_end; delete selection_start; - + delete punch_start; delete punch_end; } @@ -165,6 +169,33 @@ TimeInfoBox::track_mouse_mode () selection_changed (); } +void +TimeInfoBox::region_property_change (boost::shared_ptr /* r */, const PBD::PropertyChange& what_changed) +{ + Selection& selection (Editor::instance().get_selection()); + + if (selection.regions.empty()) { + return; + } + + PBD::PropertyChange our_interests; + + our_interests.add (ARDOUR::Properties::position); + our_interests.add (ARDOUR::Properties::length); + our_interests.add (ARDOUR::Properties::start); + + if (!what_changed.contains (our_interests)) { + return; + } + + /* TODO: check if RegionSelection includes the given region. + * This is not straight foward because RegionSelection is done by + * RegionView (not Region itself). + */ + + selection_changed (); +} + bool TimeInfoBox::clock_button_release_event (GdkEventButton* ev, AudioClock* src) { @@ -204,7 +235,7 @@ TimeInfoBox::sync_punch_mode (AudioClock* src) syncing_punch = false; } } - + void TimeInfoBox::set_session (Session* s) @@ -220,14 +251,14 @@ TimeInfoBox::set_session (Session* s) if (s) { Location* punch = s->locations()->auto_punch_location (); - + if (punch) { watch_punch (punch); } - + punch_changed (punch); - _session->auto_punch_location_changed.connect (_session_connections, MISSING_INVALIDATOR, + _session->auto_punch_location_changed.connect (_session_connections, MISSING_INVALIDATOR, boost::bind (&TimeInfoBox::punch_location_changed, this, _1), gui_context()); } } @@ -240,51 +271,40 @@ TimeInfoBox::selection_changed () switch (Editor::instance().current_mouse_mode()) { + case Editing::MouseContent: + /* displaying MIDI note selection is tricky */ + selection_start->set_off (true); + selection_end->set_off (true); + selection_length->set_off (true); + break; + case Editing::MouseObject: - if (Editor::instance().internal_editing()) { - /* displaying MIDI note selection is tricky */ - - selection_start->set_off (true); - selection_end->set_off (true); - selection_length->set_off (true); + if (selection.regions.empty()) { + if (selection.points.empty()) { + Glib::RefPtr act = ActionManager::get_action ("MouseMode", "set-mouse-mode-object-range"); + Glib::RefPtr tact = Glib::RefPtr::cast_dynamic (act); - } else { - if (selection.regions.empty()) { - if (selection.points.empty()) { - 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) { - framepos_t const p = (*i)->line().session_position ((*i)->model ()); - s = min (s, p); - e = max (e, p); - } + 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 (s); - selection_end->set (e); - selection_length->set (e - s + 1); + 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 = selection.regions.start(); - e = selection.regions.end_frame(); + s = max_framepos; + e = 0; + for (PointSelection::iterator i = selection.points.begin(); i != selection.points.end(); ++i) { + 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); selection_length->set_off (false); @@ -292,6 +312,15 @@ TimeInfoBox::selection_changed () selection_end->set (e); selection_length->set (e - s + 1); } + } else { + 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); } break; @@ -300,7 +329,7 @@ TimeInfoBox::selection_changed () 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()) { + if (tact && tact->get_active() && !selection.regions.empty()) { /* show selected regions */ s = selection.regions.start(); e = selection.regions.end_frame(); @@ -328,7 +357,7 @@ TimeInfoBox::selection_changed () default: selection_start->set_off (true); selection_end->set_off (true); - selection_length->set_off (true); + selection_length->set_off (true); break; } } @@ -338,7 +367,7 @@ TimeInfoBox::punch_location_changed (Location* loc) { if (loc) { watch_punch (loc); - } + } } void @@ -366,5 +395,5 @@ TimeInfoBox::punch_changed (Location* loc) punch_start->set (loc->start()); punch_end->set (loc->end()); -} +}