convert editor routes code to use Stripable
This commit is contained in:
parent
2380bbae5b
commit
f022784014
@ -256,7 +256,7 @@ EditorRoutes::EditorRoutes (Editor* e)
|
||||
_display.set_name (X_("EditGroupList"));
|
||||
_display.set_rules_hint (true);
|
||||
_display.set_size_request (100, -1);
|
||||
_display.add_object_drag (_columns.route.index(), "routes");
|
||||
_display.add_object_drag (_columns.stripable.index(), "routes");
|
||||
|
||||
CellRendererText* name_cell = dynamic_cast<CellRendererText*> (_display.get_column_cell_renderer (_name_column));
|
||||
|
||||
@ -546,7 +546,7 @@ EditorRoutes::redisplay_real ()
|
||||
|
||||
for (n = 0, position = 0, i = rows.begin(); i != rows.end(); ++i) {
|
||||
TimeAxisView *tv = (*i)[_columns.tv];
|
||||
boost::shared_ptr<Route> route = (*i)[_columns.route];
|
||||
boost::shared_ptr<Stripable> route = (*i)[_columns.stripable];
|
||||
|
||||
if (tv == 0) {
|
||||
// just a "title" row
|
||||
@ -677,9 +677,12 @@ EditorRoutes::active_changed (std::string const & path)
|
||||
}
|
||||
|
||||
Gtk::TreeModel::Row row = *_model->get_iter (path);
|
||||
boost::shared_ptr<Route> route = row[_columns.route];
|
||||
bool const active = row[_columns.active];
|
||||
route->set_active (!active, this);
|
||||
boost::shared_ptr<Stripable> stripable = row[_columns.stripable];
|
||||
boost::shared_ptr<Route> route = boost::dynamic_pointer_cast<Route> (stripable);
|
||||
if (route) {
|
||||
bool const active = row[_columns.active];
|
||||
route->set_active (!active, this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -690,7 +693,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
|
||||
Gtk::TreeModel::Children::iterator insert_iter = _model->children().end();
|
||||
|
||||
for (Gtk::TreeModel::Children::iterator it = _model->children().begin(); it != _model->children().end(); ++it) {
|
||||
boost::shared_ptr<Route> r = (*it)[_columns.route];
|
||||
boost::shared_ptr<Stripable> r = (*it)[_columns.stripable];
|
||||
|
||||
if (r->presentation_info().group_order() == (routes.front()->route()->presentation_info().group_order() + routes.size())) {
|
||||
insert_iter = it;
|
||||
@ -712,7 +715,7 @@ EditorRoutes::routes_added (list<RouteTimeAxisView*> routes)
|
||||
row[_columns.visible] = (*x)->marked_for_display();
|
||||
row[_columns.active] = (*x)->route()->active ();
|
||||
row[_columns.tv] = *x;
|
||||
row[_columns.route] = (*x)->route ();
|
||||
row[_columns.stripable] = (*x)->route ();
|
||||
row[_columns.is_track] = (boost::dynamic_pointer_cast<Track> ((*x)->route()) != 0);
|
||||
|
||||
if (midi_trk) {
|
||||
@ -831,7 +834,7 @@ EditorRoutes::route_property_changed (const PropertyChange& what_changed, boost:
|
||||
TreeModel::Children::iterator i;
|
||||
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
boost::shared_ptr<Route> t = (*i)[_columns.route];
|
||||
boost::shared_ptr<Stripable> t = (*i)[_columns.stripable];
|
||||
if (t == route) {
|
||||
(*i)[_columns.text] = route->name();
|
||||
break;
|
||||
@ -933,21 +936,21 @@ EditorRoutes::sync_presentation_info_from_treeview ()
|
||||
|
||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||
|
||||
boost::shared_ptr<Route> route = (*ri)[_columns.route];
|
||||
boost::shared_ptr<Stripable> stripable = (*ri)[_columns.stripable];
|
||||
bool visible = (*ri)[_columns.visible];
|
||||
|
||||
if (route->presentation_info().special ()) {
|
||||
if (stripable->presentation_info().special ()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!visible) {
|
||||
route->presentation_info().set_flag (PresentationInfo::Hidden);
|
||||
stripable->presentation_info().set_flag (PresentationInfo::Hidden);
|
||||
} else {
|
||||
route->presentation_info().unset_flag (PresentationInfo::Hidden);
|
||||
stripable->presentation_info().unset_flag (PresentationInfo::Hidden);
|
||||
}
|
||||
|
||||
if (order != route->presentation_info().group_order()) {
|
||||
route->set_presentation_group_order_explicit (order);
|
||||
if (order != stripable->presentation_info().group_order()) {
|
||||
stripable->set_presentation_group_order_explicit (order);
|
||||
change = true;
|
||||
}
|
||||
|
||||
@ -990,8 +993,8 @@ EditorRoutes::sync_treeview_from_presentation_info ()
|
||||
OrderingKeys sorted;
|
||||
|
||||
for (TreeModel::Children::iterator ri = rows.begin(); ri != rows.end(); ++ri, ++old_order) {
|
||||
boost::shared_ptr<Route> route = (*ri)[_columns.route];
|
||||
sorted.push_back (OrderKeys (old_order, route->presentation_info().group_order()));
|
||||
boost::shared_ptr<Stripable> stripable = (*ri)[_columns.stripable];
|
||||
sorted.push_back (OrderKeys (old_order, stripable->presentation_info().group_order()));
|
||||
}
|
||||
|
||||
SortByNewDisplayOrder cmp;
|
||||
@ -1413,33 +1416,33 @@ EditorRoutes::move_selected_tracks (bool up)
|
||||
return;
|
||||
}
|
||||
|
||||
typedef std::pair<TimeAxisView*,boost::shared_ptr<Route> > ViewRoute;
|
||||
std::list<ViewRoute> view_routes;
|
||||
typedef std::pair<TimeAxisView*,boost::shared_ptr<Stripable> > ViewStripable;
|
||||
std::list<ViewStripable> view_stripables;
|
||||
std::vector<int> neworder;
|
||||
TreeModel::Children rows = _model->children();
|
||||
TreeModel::Children::iterator ri;
|
||||
|
||||
for (ri = rows.begin(); ri != rows.end(); ++ri) {
|
||||
TimeAxisView* tv = (*ri)[_columns.tv];
|
||||
boost::shared_ptr<Route> route = (*ri)[_columns.route];
|
||||
boost::shared_ptr<Stripable> stripable = (*ri)[_columns.stripable];
|
||||
|
||||
view_routes.push_back (ViewRoute (tv, route));
|
||||
view_stripables.push_back (ViewStripable (tv, stripable));
|
||||
}
|
||||
|
||||
list<ViewRoute>::iterator trailing;
|
||||
list<ViewRoute>::iterator leading;
|
||||
list<ViewStripable>::iterator trailing;
|
||||
list<ViewStripable>::iterator leading;
|
||||
|
||||
if (up) {
|
||||
|
||||
trailing = view_routes.begin();
|
||||
leading = view_routes.begin();
|
||||
trailing = view_stripables.begin();
|
||||
leading = view_stripables.begin();
|
||||
|
||||
++leading;
|
||||
|
||||
while (leading != view_routes.end()) {
|
||||
while (leading != view_stripables.end()) {
|
||||
if (_editor->selection->selected (leading->first)) {
|
||||
view_routes.insert (trailing, ViewRoute (leading->first, leading->second));
|
||||
leading = view_routes.erase (leading);
|
||||
view_stripables.insert (trailing, ViewStripable (leading->first, leading->second));
|
||||
leading = view_stripables.erase (leading);
|
||||
} else {
|
||||
++leading;
|
||||
++trailing;
|
||||
@ -1453,17 +1456,17 @@ EditorRoutes::move_selected_tracks (bool up)
|
||||
and so it looks like a bit of a mess.
|
||||
*/
|
||||
|
||||
trailing = view_routes.end();
|
||||
leading = view_routes.end();
|
||||
trailing = view_stripables.end();
|
||||
leading = view_stripables.end();
|
||||
|
||||
--leading; if (leading == view_routes.begin()) { return; }
|
||||
--leading; if (leading == view_stripables.begin()) { return; }
|
||||
--leading;
|
||||
--trailing;
|
||||
|
||||
while (1) {
|
||||
|
||||
if (_editor->selection->selected (leading->first)) {
|
||||
list<ViewRoute>::iterator tmp;
|
||||
list<ViewStripable>::iterator tmp;
|
||||
|
||||
/* need to insert *after* trailing, not *before* it,
|
||||
which is what insert (iter, val) normally does.
|
||||
@ -1472,7 +1475,7 @@ EditorRoutes::move_selected_tracks (bool up)
|
||||
tmp = trailing;
|
||||
tmp++;
|
||||
|
||||
view_routes.insert (tmp, ViewRoute (leading->first, leading->second));
|
||||
view_stripables.insert (tmp, ViewStripable (leading->first, leading->second));
|
||||
|
||||
/* can't use iter = cont.erase (iter); form here, because
|
||||
we need iter to move backwards.
|
||||
@ -1483,7 +1486,7 @@ EditorRoutes::move_selected_tracks (bool up)
|
||||
|
||||
bool done = false;
|
||||
|
||||
if (leading == view_routes.begin()) {
|
||||
if (leading == view_stripables.begin()) {
|
||||
/* the one we've just inserted somewhere else
|
||||
was the first in the list. erase this copy,
|
||||
and then break, because we're done.
|
||||
@ -1491,7 +1494,7 @@ EditorRoutes::move_selected_tracks (bool up)
|
||||
done = true;
|
||||
}
|
||||
|
||||
view_routes.erase (leading);
|
||||
view_stripables.erase (leading);
|
||||
|
||||
if (done) {
|
||||
break;
|
||||
@ -1500,7 +1503,7 @@ EditorRoutes::move_selected_tracks (bool up)
|
||||
leading = tmp;
|
||||
|
||||
} else {
|
||||
if (leading == view_routes.begin()) {
|
||||
if (leading == view_stripables.begin()) {
|
||||
break;
|
||||
}
|
||||
--leading;
|
||||
@ -1509,7 +1512,7 @@ EditorRoutes::move_selected_tracks (bool up)
|
||||
};
|
||||
}
|
||||
|
||||
for (leading = view_routes.begin(); leading != view_routes.end(); ++leading) {
|
||||
for (leading = view_stripables.begin(); leading != view_stripables.end(); ++leading) {
|
||||
uint32_t order = (uint32_t) leading->second->presentation_info().group_order ();
|
||||
neworder.push_back (order);
|
||||
}
|
||||
@ -1539,10 +1542,10 @@ EditorRoutes::update_input_active_display ()
|
||||
TreeModel::Children::iterator i;
|
||||
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
boost::shared_ptr<Route> route = (*i)[_columns.route];
|
||||
boost::shared_ptr<Stripable> stripable = (*i)[_columns.stripable];
|
||||
|
||||
if (boost::dynamic_pointer_cast<Track> (route)) {
|
||||
boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (route);
|
||||
if (boost::dynamic_pointer_cast<Track> (stripable)) {
|
||||
boost::shared_ptr<MidiTrack> mt = boost::dynamic_pointer_cast<MidiTrack> (stripable);
|
||||
|
||||
if (mt) {
|
||||
(*i)[_columns.is_input_active] = mt->input_active();
|
||||
@ -1567,12 +1570,17 @@ EditorRoutes::idle_update_mute_rec_solo_etc()
|
||||
TreeModel::Children::iterator i;
|
||||
|
||||
for (i = rows.begin(); i != rows.end(); ++i) {
|
||||
boost::shared_ptr<Route> route = (*i)[_columns.route];
|
||||
(*i)[_columns.mute_state] = RouteUI::mute_active_state (_session, route);
|
||||
(*i)[_columns.solo_state] = RouteUI::solo_active_state (route);
|
||||
(*i)[_columns.solo_isolate_state] = RouteUI::solo_isolate_active_state (route) ? 1 : 0;
|
||||
(*i)[_columns.solo_safe_state] = RouteUI::solo_safe_active_state (route) ? 1 : 0;
|
||||
(*i)[_columns.active] = route->active ();
|
||||
boost::shared_ptr<Stripable> stripable = (*i)[_columns.stripable];
|
||||
boost::shared_ptr<Route> route = boost::dynamic_pointer_cast<Route> (stripable);
|
||||
(*i)[_columns.mute_state] = RouteUI::mute_active_state (_session, stripable);
|
||||
(*i)[_columns.solo_state] = RouteUI::solo_active_state (stripable);
|
||||
(*i)[_columns.solo_isolate_state] = RouteUI::solo_isolate_active_state (stripable) ? 1 : 0;
|
||||
(*i)[_columns.solo_safe_state] = RouteUI::solo_safe_active_state (stripable) ? 1 : 0;
|
||||
if (route) {
|
||||
(*i)[_columns.active] = route->active ();
|
||||
} else {
|
||||
(*i)[_columns.active] = true;
|
||||
}
|
||||
|
||||
boost::shared_ptr<Track> trk (boost::dynamic_pointer_cast<Track>(route));
|
||||
|
||||
@ -1676,10 +1684,10 @@ EditorRoutes::name_edit (std::string const & path, std::string const & new_text)
|
||||
return;
|
||||
}
|
||||
|
||||
boost::shared_ptr<Route> route = (*iter)[_columns.route];
|
||||
boost::shared_ptr<Stripable> stripable = (*iter)[_columns.stripable];
|
||||
|
||||
if (route && route->name() != new_text) {
|
||||
route->set_name (new_text);
|
||||
if (stripable && stripable->name() != new_text) {
|
||||
stripable->set_name (new_text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ private:
|
||||
add (solo_safe_state);
|
||||
add (is_track);
|
||||
add (tv);
|
||||
add (route);
|
||||
add (stripable);
|
||||
add (name_editable);
|
||||
add (is_input_active);
|
||||
add (is_midi);
|
||||
@ -147,7 +147,7 @@ private:
|
||||
Gtk::TreeModelColumn<uint32_t> solo_safe_state;
|
||||
Gtk::TreeModelColumn<bool> is_track;
|
||||
Gtk::TreeModelColumn<TimeAxisView*> tv;
|
||||
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Route> > route;
|
||||
Gtk::TreeModelColumn<boost::shared_ptr<ARDOUR::Stripable> > stripable;
|
||||
Gtk::TreeModelColumn<bool> name_editable;
|
||||
Gtk::TreeModelColumn<bool> is_input_active;
|
||||
Gtk::TreeModelColumn<bool> is_midi;
|
||||
|
@ -1114,15 +1114,15 @@ RouteUI::send_blink (bool onoff)
|
||||
}
|
||||
|
||||
Gtkmm2ext::ActiveState
|
||||
RouteUI::solo_active_state (boost::shared_ptr<Route> r)
|
||||
RouteUI::solo_active_state (boost::shared_ptr<Stripable> s)
|
||||
{
|
||||
if (!r->can_solo()) {
|
||||
if (!s->solo_control()->can_solo()) {
|
||||
return Gtkmm2ext::Off;
|
||||
}
|
||||
|
||||
if (r->self_soloed()) {
|
||||
if (s->solo_control()->self_soloed()) {
|
||||
return Gtkmm2ext::ExplicitActive;
|
||||
} else if (r->soloed_by_others()) {
|
||||
} else if (s->solo_control()->soloed_by_others()) {
|
||||
return Gtkmm2ext::ImplicitActive;
|
||||
} else {
|
||||
return Gtkmm2ext::Off;
|
||||
@ -1130,7 +1130,7 @@ RouteUI::solo_active_state (boost::shared_ptr<Route> r)
|
||||
}
|
||||
|
||||
Gtkmm2ext::ActiveState
|
||||
RouteUI::solo_isolate_active_state (boost::shared_ptr<Route> r)
|
||||
RouteUI::solo_isolate_active_state (boost::shared_ptr<Stripable> r)
|
||||
{
|
||||
if (r->is_master() || r->is_monitor()) {
|
||||
return Gtkmm2ext::Off;
|
||||
@ -1144,7 +1144,7 @@ RouteUI::solo_isolate_active_state (boost::shared_ptr<Route> r)
|
||||
}
|
||||
|
||||
Gtkmm2ext::ActiveState
|
||||
RouteUI::solo_safe_active_state (boost::shared_ptr<Route> r)
|
||||
RouteUI::solo_safe_active_state (boost::shared_ptr<Stripable> r)
|
||||
{
|
||||
if (r->is_master() || r->is_monitor()) {
|
||||
return Gtkmm2ext::Off;
|
||||
@ -1205,7 +1205,7 @@ RouteUI::solo_changed_so_update_mute ()
|
||||
}
|
||||
|
||||
ActiveState
|
||||
RouteUI::mute_active_state (Session* s, boost::shared_ptr<Route> r)
|
||||
RouteUI::mute_active_state (Session* s, boost::shared_ptr<Stripable> r)
|
||||
{
|
||||
if (r->is_monitor()) {
|
||||
return ActiveState(0);
|
||||
@ -1216,7 +1216,7 @@ RouteUI::mute_active_state (Session* s, boost::shared_ptr<Route> r)
|
||||
if (r->mute_control()->muted_by_self ()) {
|
||||
/* full mute */
|
||||
return Gtkmm2ext::ExplicitActive;
|
||||
} else if (r->muted_by_others_soloing () || r->muted_by_masters ()) {
|
||||
} else if (r->mute_control()->muted_by_others_soloing () || r->mute_control()->muted_by_masters ()) {
|
||||
/* this will reflect both solo mutes AND master mutes */
|
||||
return Gtkmm2ext::ImplicitActive;
|
||||
} else {
|
||||
@ -1229,7 +1229,7 @@ RouteUI::mute_active_state (Session* s, boost::shared_ptr<Route> r)
|
||||
if (r->mute_control()->muted_by_self()) {
|
||||
/* full mute */
|
||||
return Gtkmm2ext::ExplicitActive;
|
||||
} else if (r->muted_by_masters ()) {
|
||||
} else if (r->mute_control()->muted_by_masters ()) {
|
||||
/* this shows only master mutes, not mute-by-others-soloing */
|
||||
return Gtkmm2ext::ImplicitActive;
|
||||
} else {
|
||||
|
@ -250,10 +250,10 @@ class RouteUI : public virtual AxisView
|
||||
void save_as_template ();
|
||||
void open_remote_control_id_dialog ();
|
||||
|
||||
static Gtkmm2ext::ActiveState solo_active_state (boost::shared_ptr<ARDOUR::Route>);
|
||||
static Gtkmm2ext::ActiveState solo_isolate_active_state (boost::shared_ptr<ARDOUR::Route>);
|
||||
static Gtkmm2ext::ActiveState solo_safe_active_state (boost::shared_ptr<ARDOUR::Route>);
|
||||
static Gtkmm2ext::ActiveState mute_active_state (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Route>);
|
||||
static Gtkmm2ext::ActiveState solo_active_state (boost::shared_ptr<ARDOUR::Stripable>);
|
||||
static Gtkmm2ext::ActiveState solo_isolate_active_state (boost::shared_ptr<ARDOUR::Stripable>);
|
||||
static Gtkmm2ext::ActiveState solo_safe_active_state (boost::shared_ptr<ARDOUR::Stripable>);
|
||||
static Gtkmm2ext::ActiveState mute_active_state (ARDOUR::Session*, boost::shared_ptr<ARDOUR::Stripable>);
|
||||
|
||||
/** Emitted when a bus has been set or unset from `display sends to this bus' mode
|
||||
* by a click on the `Sends' button. The parameter is the route that the sends are
|
||||
|
@ -266,6 +266,7 @@ gtk2_ardour_sources = [
|
||||
'video_image_frame.cc',
|
||||
'add_video_dialog.cc',
|
||||
'editor_videotimeline.cc',
|
||||
'vca_time_axis.cc',
|
||||
'video_timeline.cc',
|
||||
'video_monitor.cc',
|
||||
'transcode_ffmpeg.cc',
|
||||
|
@ -39,6 +39,8 @@ class LIBARDOUR_API SoloControl : public SlavableAutomationControl
|
||||
|
||||
double get_value () const;
|
||||
|
||||
bool can_solo() const;
|
||||
|
||||
/* Export additional API so that objects that only get access
|
||||
* to a Controllable/AutomationControl can do more fine-grained
|
||||
* operations with respect to solo. Obviously, they would need
|
||||
|
@ -328,3 +328,9 @@ SoloControl::pre_remove_master (boost::shared_ptr<AutomationControl> m)
|
||||
_transition_into_solo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
SoloControl::can_solo () const
|
||||
{
|
||||
return _soloable.can_solo ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user