From: Paul Davis Date: Thu, 26 Jan 2017 18:20:40 +0000 (+0100) Subject: use RAII for class-wide PresentationInfo::Change signal, along with properties to... X-Git-Tag: 5.6~169 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=e5aa0d774e571878e600495cbabfe8073de0599c;hp=8cb3c42548e10539c1ccb1252189d65075132828 use RAII for class-wide PresentationInfo::Change signal, along with properties to describe what changed --- diff --git a/gtk2_ardour/editor_routes.cc b/gtk2_ardour/editor_routes.cc index 69c876ba99..27189f29af 100644 --- a/gtk2_ardour/editor_routes.cc +++ b/gtk2_ardour/editor_routes.cc @@ -1019,6 +1019,8 @@ EditorRoutes::sync_presentation_info_from_treeview () OrderingKeys sorted; const size_t cmp_max = rows.size (); + PresentationInfo::ChangeSuspender cs; + // special case master if it's got PI order 0 lets keep it there if (_session->master_out() && (_session->master_out()->presentation_info().order() == 0)) { order++; @@ -1059,7 +1061,7 @@ EditorRoutes::sync_presentation_info_from_treeview () } if (order != stripable->presentation_info().order()) { - stripable->set_presentation_order (order, false); + stripable->set_presentation_order (order); change = true; } @@ -1083,17 +1085,11 @@ EditorRoutes::sync_presentation_info_from_treeview () n = 0; for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) { if (sr->stripable->presentation_info().order() != n) { - sr->stripable->set_presentation_order (n, false); + sr->stripable->set_presentation_order (n); } } } } - - if (change) { - DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from editor GUI\n"); - _session->notify_presentation_info_change (); - _session->set_dirty(); - } } void diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc index 0d7eec1c7c..b27460de10 100644 --- a/gtk2_ardour/group_tabs.cc +++ b/gtk2_ardour/group_tabs.cc @@ -666,6 +666,9 @@ GroupTabs::collect (RouteGroup* g) int diff = 0; int coll = -1; + + PresentationInfo::ChangeSuspender cs; + while (i != group_routes->end() && j != routes->end()) { PresentationInfo::order_t const k = (*j)->presentation_info ().order(); @@ -679,21 +682,19 @@ GroupTabs::collect (RouteGroup* g) --diff; } - (*j)->set_presentation_order (coll, false); + (*j)->set_presentation_order (coll); ++coll; ++i; } else { - (*j)->set_presentation_order (k + diff, false); + (*j)->set_presentation_order (k + diff); } ++j; } - - _session->notify_presentation_info_change (); } void @@ -724,10 +725,11 @@ GroupTabs::remove_group (RouteGroup* g) RouteList rl (*(g->route_list().get())); _session->remove_route_group (*g); + PresentationInfo::ChangeSuspender cs; + for (RouteList::iterator i = rl.begin(); i != rl.end(); ++i) { (*i)->presentation_info().PropertyChanged (Properties::color); } - PresentationInfo::Change (); // notify summary & port-matrix } /** Set the color of the tab of a route group */ @@ -841,7 +843,6 @@ GroupTabs::route_added_to_route_group (RouteGroup*, boost::weak_ptr w) } r->presentation_info().PropertyChanged (Properties::color); - PresentationInfo::Change (); // notify summary & port-matrix set_dirty (); } @@ -857,7 +858,6 @@ GroupTabs::route_removed_from_route_group (RouteGroup*, boost::weak_ptr w } r->presentation_info().PropertyChanged (Properties::color); - PresentationInfo::Change (); // notify summary & port-matrix set_dirty (); } @@ -865,8 +865,9 @@ GroupTabs::route_removed_from_route_group (RouteGroup*, boost::weak_ptr w void GroupTabs::emit_gui_changed_for_members (RouteGroup* rg) { + PresentationInfo::ChangeSuspender cs; + for (RouteList::iterator i = rg->route_list()->begin(); i != rg->route_list()->end(); ++i) { (*i)->presentation_info().PropertyChanged (Properties::color); } - PresentationInfo::Change (); // notify summary & port-matrix } diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 00a351d60e..4ffa753e0c 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -714,6 +714,8 @@ Mixer_UI::sync_presentation_info_from_treeview () order++; } + PresentationInfo::ChangeSuspender cs; + for (ri = rows.begin(); ri != rows.end(); ++ri) { bool visible = (*ri)[stripable_columns.visible]; boost::shared_ptr stripable = (*ri)[stripable_columns.stripable]; @@ -742,7 +744,7 @@ Mixer_UI::sync_presentation_info_from_treeview () } if (order != stripable->presentation_info().order()) { - stripable->set_presentation_order (order, false); + stripable->set_presentation_order (order); change = true; } @@ -765,7 +767,7 @@ Mixer_UI::sync_presentation_info_from_treeview () n = 0; for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) { if (sr->stripable->presentation_info().order() != n) { - sr->stripable->set_presentation_order (n, false); + sr->stripable->set_presentation_order (n); } } } @@ -773,7 +775,6 @@ Mixer_UI::sync_presentation_info_from_treeview () if (change) { DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from mixer GUI\n"); - _session->notify_presentation_info_change (); _session->set_dirty(); } }