mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
use RAII for class-wide PresentationInfo::Change signal, along with properties to describe what changed
This commit is contained in:
parent
8cb3c42548
commit
e5aa0d774e
3 changed files with 17 additions and 19 deletions
|
|
@ -1019,6 +1019,8 @@ EditorRoutes::sync_presentation_info_from_treeview ()
|
||||||
OrderingKeys sorted;
|
OrderingKeys sorted;
|
||||||
const size_t cmp_max = rows.size ();
|
const size_t cmp_max = rows.size ();
|
||||||
|
|
||||||
|
PresentationInfo::ChangeSuspender cs;
|
||||||
|
|
||||||
// special case master if it's got PI order 0 lets keep it there
|
// 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)) {
|
if (_session->master_out() && (_session->master_out()->presentation_info().order() == 0)) {
|
||||||
order++;
|
order++;
|
||||||
|
|
@ -1059,7 +1061,7 @@ EditorRoutes::sync_presentation_info_from_treeview ()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (order != stripable->presentation_info().order()) {
|
if (order != stripable->presentation_info().order()) {
|
||||||
stripable->set_presentation_order (order, false);
|
stripable->set_presentation_order (order);
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1083,17 +1085,11 @@ EditorRoutes::sync_presentation_info_from_treeview ()
|
||||||
n = 0;
|
n = 0;
|
||||||
for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) {
|
for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) {
|
||||||
if (sr->stripable->presentation_info().order() != 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
|
void
|
||||||
|
|
|
||||||
|
|
@ -666,6 +666,9 @@ GroupTabs::collect (RouteGroup* g)
|
||||||
|
|
||||||
int diff = 0;
|
int diff = 0;
|
||||||
int coll = -1;
|
int coll = -1;
|
||||||
|
|
||||||
|
PresentationInfo::ChangeSuspender cs;
|
||||||
|
|
||||||
while (i != group_routes->end() && j != routes->end()) {
|
while (i != group_routes->end() && j != routes->end()) {
|
||||||
|
|
||||||
PresentationInfo::order_t const k = (*j)->presentation_info ().order();
|
PresentationInfo::order_t const k = (*j)->presentation_info ().order();
|
||||||
|
|
@ -679,21 +682,19 @@ GroupTabs::collect (RouteGroup* g)
|
||||||
--diff;
|
--diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*j)->set_presentation_order (coll, false);
|
(*j)->set_presentation_order (coll);
|
||||||
|
|
||||||
++coll;
|
++coll;
|
||||||
++i;
|
++i;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
(*j)->set_presentation_order (k + diff, false);
|
(*j)->set_presentation_order (k + diff);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++j;
|
++j;
|
||||||
}
|
}
|
||||||
|
|
||||||
_session->notify_presentation_info_change ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -724,10 +725,11 @@ GroupTabs::remove_group (RouteGroup* g)
|
||||||
RouteList rl (*(g->route_list().get()));
|
RouteList rl (*(g->route_list().get()));
|
||||||
_session->remove_route_group (*g);
|
_session->remove_route_group (*g);
|
||||||
|
|
||||||
|
PresentationInfo::ChangeSuspender cs;
|
||||||
|
|
||||||
for (RouteList::iterator i = rl.begin(); i != rl.end(); ++i) {
|
for (RouteList::iterator i = rl.begin(); i != rl.end(); ++i) {
|
||||||
(*i)->presentation_info().PropertyChanged (Properties::color);
|
(*i)->presentation_info().PropertyChanged (Properties::color);
|
||||||
}
|
}
|
||||||
PresentationInfo::Change (); // notify summary & port-matrix
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the color of the tab of a route group */
|
/** Set the color of the tab of a route group */
|
||||||
|
|
@ -841,7 +843,6 @@ GroupTabs::route_added_to_route_group (RouteGroup*, boost::weak_ptr<Route> w)
|
||||||
}
|
}
|
||||||
|
|
||||||
r->presentation_info().PropertyChanged (Properties::color);
|
r->presentation_info().PropertyChanged (Properties::color);
|
||||||
PresentationInfo::Change (); // notify summary & port-matrix
|
|
||||||
|
|
||||||
set_dirty ();
|
set_dirty ();
|
||||||
}
|
}
|
||||||
|
|
@ -857,7 +858,6 @@ GroupTabs::route_removed_from_route_group (RouteGroup*, boost::weak_ptr<Route> w
|
||||||
}
|
}
|
||||||
|
|
||||||
r->presentation_info().PropertyChanged (Properties::color);
|
r->presentation_info().PropertyChanged (Properties::color);
|
||||||
PresentationInfo::Change (); // notify summary & port-matrix
|
|
||||||
|
|
||||||
set_dirty ();
|
set_dirty ();
|
||||||
}
|
}
|
||||||
|
|
@ -865,8 +865,9 @@ GroupTabs::route_removed_from_route_group (RouteGroup*, boost::weak_ptr<Route> w
|
||||||
void
|
void
|
||||||
GroupTabs::emit_gui_changed_for_members (RouteGroup* rg)
|
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) {
|
for (RouteList::iterator i = rg->route_list()->begin(); i != rg->route_list()->end(); ++i) {
|
||||||
(*i)->presentation_info().PropertyChanged (Properties::color);
|
(*i)->presentation_info().PropertyChanged (Properties::color);
|
||||||
}
|
}
|
||||||
PresentationInfo::Change (); // notify summary & port-matrix
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -714,6 +714,8 @@ Mixer_UI::sync_presentation_info_from_treeview ()
|
||||||
order++;
|
order++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PresentationInfo::ChangeSuspender cs;
|
||||||
|
|
||||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||||
bool visible = (*ri)[stripable_columns.visible];
|
bool visible = (*ri)[stripable_columns.visible];
|
||||||
boost::shared_ptr<Stripable> stripable = (*ri)[stripable_columns.stripable];
|
boost::shared_ptr<Stripable> stripable = (*ri)[stripable_columns.stripable];
|
||||||
|
|
@ -742,7 +744,7 @@ Mixer_UI::sync_presentation_info_from_treeview ()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (order != stripable->presentation_info().order()) {
|
if (order != stripable->presentation_info().order()) {
|
||||||
stripable->set_presentation_order (order, false);
|
stripable->set_presentation_order (order);
|
||||||
change = true;
|
change = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -765,7 +767,7 @@ Mixer_UI::sync_presentation_info_from_treeview ()
|
||||||
n = 0;
|
n = 0;
|
||||||
for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) {
|
for (OrderingKeys::iterator sr = sorted.begin(); sr != sorted.end(); ++sr, ++n) {
|
||||||
if (sr->stripable->presentation_info().order() != 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) {
|
if (change) {
|
||||||
DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from mixer GUI\n");
|
DEBUG_TRACE (DEBUG::OrderKeys, "... notify PI change from mixer GUI\n");
|
||||||
_session->notify_presentation_info_change ();
|
|
||||||
_session->set_dirty();
|
_session->set_dirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue