diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 3e3021eaf1..abc42610b1 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -694,6 +694,7 @@ Editor::Editor () Location::start_changed.connect (*this, invalidator (*this), boost::bind (&Editor::location_changed, this, _1), gui_context()); Location::end_changed.connect (*this, invalidator (*this), boost::bind (&Editor::location_changed, this, _1), gui_context()); Location::changed.connect (*this, invalidator (*this), boost::bind (&Editor::location_changed, this, _1), gui_context()); + Location::flags_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_section_rects, this), gui_context ()); #if SELECTION_PROPERTIES_BOX_TODO add_notebook_page (_("Selection"), *_properties_box); @@ -1435,10 +1436,6 @@ Editor::set_session (Session *t) _session->auto_loop_location_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::loop_location_changed, this, _1), gui_context ()); _session->history().Changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::history_changed, this), gui_context()); - Location::start_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_section_rects, this), gui_context ()); - Location::end_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_section_rects, this), gui_context ()); - Location::flags_changed.connect (_session_connections, invalidator (*this), boost::bind (&Editor::update_section_rects, this), gui_context ()); - _playhead_cursor->track_canvas_item().reparent ((ArdourCanvas::Item*) get_cursor_scroll_group()); _playhead_cursor->show (); diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 6a74eef452..72dbb637af 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -282,6 +282,9 @@ Editor::location_changed (Location *location) if (lam->end) { check_marker_label (lam->end); } + if (location->is_section ()) { + update_section_rects (); + } } /** Look at a marker and check whether its label, and those of the previous and next markers, @@ -659,13 +662,14 @@ Editor::update_section_rects () timepos_t start; timepos_t end; + std::vector locs; Locations* loc = _session->locations (); Location* l = NULL; bool bright = false; do { - l = loc->next_section (l, start, end); + l = loc->next_section_iter (l, start, end, locs); if (l) { double const left = sample_to_pixel (start.samples ()); double const right = sample_to_pixel (end.samples ()); diff --git a/gtk2_ardour/editor_sections.cc b/gtk2_ardour/editor_sections.cc index 7dd8f7d7f1..55f01551a2 100644 --- a/gtk2_ardour/editor_sections.cc +++ b/gtk2_ardour/editor_sections.cc @@ -96,14 +96,14 @@ EditorSections::set_session (Session* s) SessionHandlePtr::set_session (s); if (_session) { - _session->locations ()->added.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ()); - _session->locations ()->removed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ()); + _session->locations ()->added.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ()); + _session->locations ()->removed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ()); _session->locations ()->changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ()); - Location::start_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ()); - Location::end_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ()); + Location::start_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ()); + Location::end_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ()); Location::flags_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ()); - Location::name_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::redisplay, this), gui_context ()); + Location::name_changed.connect (_session_connections, invalidator (*this), boost::bind (&EditorSections::location_changed, this, _1), gui_context ()); } redisplay (); @@ -118,6 +118,14 @@ EditorSections::select (ARDOUR::Location* l) } } +void +EditorSections::location_changed (ARDOUR::Location* l) +{ + if (l->is_section ()) { + redisplay (); + } +} + void EditorSections::redisplay () { @@ -134,12 +142,13 @@ EditorSections::redisplay () timepos_t start; timepos_t end; + std::vector locs; Locations* loc = _session->locations (); Location* l = NULL; do { - l = loc->next_section (l, start, end); + l = loc->next_section_iter (l, start, end, locs); if (l) { TreeModel::Row newrow = *(_model->append ()); newrow[_columns.name] = l->name (); @@ -214,9 +223,11 @@ EditorSections::update_time_selection () Locations* loc = _session->locations (); Location* l = NULL; + + std::vector locs; do { timepos_t start, end; - l = loc->next_section (l, start, end); + l = loc->next_section_iter (l, start, end, locs); if (l) { if (start == selection.time.start_time () && end == selection.time.end_time ()) { LocationRowMap::iterator map_it = _location_row_map.find (l); diff --git a/gtk2_ardour/editor_sections.h b/gtk2_ardour/editor_sections.h index afc2b250f1..f726c7e38e 100644 --- a/gtk2_ardour/editor_sections.h +++ b/gtk2_ardour/editor_sections.h @@ -45,6 +45,7 @@ public: private: void redisplay (); + void location_changed (ARDOUR::Location*); bool delete_selected_section (); bool rename_selected_section ();