a reverb is a reverb is a reverb
[ardour.git] / gtk2_ardour / time_info_box.cc
index afd48715b3f7af0e7ebca4e1a7316188477ff751..d0d6871cbb0c07a3626e035b12e3e9b4f986c89e 100644 (file)
@@ -36,7 +36,7 @@
 #include "control_point.h"
 #include "automation_line.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace Gtk;
 using namespace ARDOUR;
@@ -58,12 +58,6 @@ TimeInfoBox::TimeInfoBox ()
        punch_start = new AudioClock ("punch-start", false, "punch", false, false, false, false);
        punch_end = new AudioClock ("punch-end", false, "punch", false, false, false, false);
 
-       selection_start->set_draw_background (false);
-       selection_end->set_draw_background (false);
-       selection_length->set_draw_background (false);
-       punch_start->set_draw_background (false);
-       punch_end->set_draw_background (false);
-
        selection_title.set_text (_("Selection"));
        punch_title.set_text (_("Punch"));
 
@@ -149,6 +143,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());
 }
 
@@ -157,7 +152,7 @@ TimeInfoBox::~TimeInfoBox ()
         delete selection_length;
         delete selection_end;
         delete selection_start;
-        
+
         delete punch_start;
         delete punch_end;
 }
@@ -168,6 +163,33 @@ TimeInfoBox::track_mouse_mode ()
        selection_changed ();
 }
 
+void
+TimeInfoBox::region_property_change (boost::shared_ptr<ARDOUR::Region> /* 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)
 {
@@ -207,7 +229,7 @@ TimeInfoBox::sync_punch_mode (AudioClock* src)
                syncing_punch = false;
        }
 }
-       
+
 
 void
 TimeInfoBox::set_session (Session* s)
@@ -223,14 +245,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());
        }
 }
@@ -301,7 +323,7 @@ TimeInfoBox::selection_changed ()
                        Glib::RefPtr<Action> act = ActionManager::get_action ("MouseMode", "set-mouse-mode-object-range");
                        Glib::RefPtr<ToggleAction> tact = Glib::RefPtr<ToggleAction>::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();
@@ -329,7 +351,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;
        }
 }
@@ -339,7 +361,7 @@ TimeInfoBox::punch_location_changed (Location* loc)
 {
        if (loc) {
                watch_punch (loc);
-       } 
+       }
 }
 
 void
@@ -367,5 +389,5 @@ TimeInfoBox::punch_changed (Location* loc)
 
        punch_start->set (loc->start());
        punch_end->set (loc->end());
-}      
+}