From: Paul Davis Date: Fri, 5 May 2017 11:31:21 +0000 (+0100) Subject: libardour now has CoreSelection object to manage selection status of Stripables and... X-Git-Tag: 5.9~89 X-Git-Url: https://main.carlh.net/gitweb/?p=ardour.git;a=commitdiff_plain;h=0c035778e162bd5934fc0070e43a26ffb4c8825a libardour now has CoreSelection object to manage selection status of Stripables and AutomationControls --- diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h index ae2c8dd41f..cde527bed6 100644 --- a/libs/ardour/ardour/automatable.h +++ b/libs/ardour/ardour/automatable.h @@ -54,6 +54,7 @@ public: boost::shared_ptr control_factory(const Evoral::Parameter& id); + boost::shared_ptr automation_control (PBD::ID const & id) const; boost::shared_ptr automation_control (const Evoral::Parameter& id) { return automation_control (id, false); } diff --git a/libs/ardour/ardour/debug.h b/libs/ardour/ardour/debug.h index eff8305bf1..61903cd724 100644 --- a/libs/ardour/ardour/debug.h +++ b/libs/ardour/ardour/debug.h @@ -72,6 +72,7 @@ namespace PBD { LIBARDOUR_API extern DebugBits AudioEngine; LIBARDOUR_API extern DebugBits Soundcloud; LIBARDOUR_API extern DebugBits Butler; + LIBARDOUR_API extern DebugBits Selection; LIBARDOUR_API extern DebugBits GenericMidi; LIBARDOUR_API extern DebugBits BackendMIDI; LIBARDOUR_API extern DebugBits BackendAudio; diff --git a/libs/ardour/ardour/presentation_info.h b/libs/ardour/ardour/presentation_info.h index 7c847e9fce..c508f8401a 100644 --- a/libs/ardour/ardour/presentation_info.h +++ b/libs/ardour/ardour/presentation_info.h @@ -93,11 +93,6 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful * change after construction (not strictly the constructor itself, but * a more generalized notion of construction, as in "ready to use"). * - * SELECTION - * - * When an object is selected, its _flags member will have the Selected - * bit set. - * * VISIBILITY * * When an object is hidden, its _flags member will have the Hidden @@ -119,13 +114,12 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful /* These are for sharing Stripable states between the GUI and other * user interfaces/control surfaces */ - Selected = 0x100, - Hidden = 0x200, + Hidden = 0x100, /* single bit indicates that the group order is set */ OrderSet = 0x400, /* special mask to delect out "state" bits */ - StatusMask = (Selected|Hidden), + StatusMask = (Hidden), /* special mask to delect select type bits */ TypeMask = (AudioBus|AudioTrack|MidiTrack|MidiBus|VCA|MasterOut|MonitorOut|Auditioner) }; @@ -152,7 +146,6 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful bool color_set() const; void set_color (color_t); - void set_selected (bool yn); void set_hidden (bool yn); void set_flags (Flag f) { _flags = f; } @@ -161,7 +154,6 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful int selection_cnt() const { return _selection_cnt; } bool hidden() const { return _flags & Hidden; } - bool selected() const { return _flags & Selected; } bool special() const { return _flags & (MasterOut|MonitorOut|Auditioner); } bool flag_match (Flag f) const { @@ -238,6 +230,7 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful */ static PBD::Signal1 Change; + static void send_static_change (const PBD::PropertyChange&); static void make_property_quarks (); @@ -270,7 +263,6 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful static PBD::PropertyChange _pending_static_changes; static Glib::Threads::Mutex static_signal_lock; static int _change_signal_suspended; - static void send_static_change (const PBD::PropertyChange&); static int selection_counter; }; diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 9313df2f0c..794f87d607 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -28,7 +28,6 @@ #include #include -#include #include #include "pbd/fastlog.h" @@ -89,9 +88,7 @@ class LIBARDOUR_API Route : public Stripable, public Soloable, public Muteable, public Monitorable, - public Automatable, - public RouteGroupMember, - public boost::enable_shared_from_this + public RouteGroupMember { public: diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index dfeb1d0834..f748adb15d 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -114,6 +114,7 @@ class Bundle; class Butler; class Click; class ControllableDescriptor; +class CoreSelection; class Diskstream; class ExportHandler; class ExportStatus; @@ -289,6 +290,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop return routes.reader (); } + CoreSelection& selection () { return *_selection; } + /* because the set of Stripables consists of objects managed * independently, in multiple containers within the Session (or objects * owned by the session), we fill out a list in-place rather than @@ -323,6 +326,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop bool io_name_is_legal (const std::string&) const; boost::shared_ptr route_by_name (std::string) const; boost::shared_ptr route_by_id (PBD::ID) const; + boost::shared_ptr stripable_by_id (PBD::ID) const; boost::shared_ptr get_remote_nth_stripable (PresentationInfo::order_t n, PresentationInfo::Flag) const; boost::shared_ptr get_remote_nth_route (PresentationInfo::order_t n) const; boost::shared_ptr route_by_selected_count (uint32_t cnt) const; @@ -1060,6 +1064,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop boost::shared_ptr processor_by_id (PBD::ID) const; boost::shared_ptr controllable_by_id (const PBD::ID&); + boost::shared_ptr automation_control_by_id (const PBD::ID&); boost::shared_ptr controllable_by_descriptor (const ARDOUR::ControllableDescriptor&); void add_controllable (boost::shared_ptr); @@ -2088,6 +2093,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop void rewire_selected_midi (boost::shared_ptr); void rewire_midi_selection_ports (); boost::weak_ptr current_midi_target; + + CoreSelection* _selection; }; diff --git a/libs/ardour/ardour/session_handle.h b/libs/ardour/ardour/session_handle.h index 330f1805cd..804bf004c2 100644 --- a/libs/ardour/ardour/session_handle.h +++ b/libs/ardour/ardour/session_handle.h @@ -47,6 +47,7 @@ class LIBARDOUR_API SessionHandlePtr virtual ~SessionHandlePtr () {} virtual void set_session (ARDOUR::Session *); + virtual ARDOUR::Session* session() const { return _session; } protected: ARDOUR::Session* _session; diff --git a/libs/ardour/ardour/stripable.h b/libs/ardour/ardour/stripable.h index 2484c26345..7298a4807e 100644 --- a/libs/ardour/ardour/stripable.h +++ b/libs/ardour/ardour/stripable.h @@ -25,9 +25,11 @@ #include #include #include +#include #include "pbd/signals.h" +#include "ardour/automatable.h" #include "ardour/presentation_info.h" #include "ardour/session_object.h" #include "ardour/libardour_visibility.h" @@ -56,10 +58,13 @@ class RecordSafeControl; * and behaviour of the object. */ -class LIBARDOUR_API Stripable : public SessionObject { - public: +class LIBARDOUR_API Stripable : public SessionObject, + public Automatable, + public boost::enable_shared_from_this +{ + public: Stripable (Session& session, std::string const & name, PresentationInfo const &); - virtual ~Stripable () {} + virtual ~Stripable (); /* XXX midi on/off @@ -72,7 +77,7 @@ class LIBARDOUR_API Stripable : public SessionObject { int set_state (XMLNode const&, int); bool is_hidden() const { return _presentation_info.flags() & PresentationInfo::Hidden; } - bool is_selected() const { return _presentation_info.flags() & PresentationInfo::Selected; } + bool is_selected() const; PresentationInfo const & presentation_info () const { return _presentation_info; } PresentationInfo& presentation_info () { return _presentation_info; } diff --git a/libs/ardour/ardour/vca.h b/libs/ardour/ardour/vca.h index 0977001927..5cf06e4d69 100644 --- a/libs/ardour/ardour/vca.h +++ b/libs/ardour/ardour/vca.h @@ -28,7 +28,6 @@ #include "pbd/controllable.h" #include "pbd/statefuldestructible.h" -#include "ardour/automatable.h" #include "ardour/muteable.h" #include "ardour/monitorable.h" #include "ardour/recordable.h" @@ -47,10 +46,9 @@ class MonitorControl; class LIBARDOUR_API VCA : public Stripable, public Soloable, public Muteable, - public Automatable, public Recordable, - public Monitorable, - public boost::enable_shared_from_this { + public Monitorable +{ public: VCA (Session& session, int32_t num, const std::string& name); ~VCA(); diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc index 7ad930f60b..00dcdec8f0 100644 --- a/libs/ardour/automatable.cc +++ b/libs/ardour/automatable.cc @@ -508,6 +508,21 @@ Automatable::control_factory(const Evoral::Parameter& param) return boost::shared_ptr(control); } +boost::shared_ptr +Automatable::automation_control (PBD::ID const & id) const +{ + Controls::const_iterator li; + + for (li = _controls.begin(); li != _controls.end(); ++li) { + boost::shared_ptr ac = boost::dynamic_pointer_cast (li->second); + if (ac && (ac->id() == id)) { + return ac; + } + } + + return boost::shared_ptr(); +} + boost::shared_ptr Automatable::automation_control (const Evoral::Parameter& id, bool create) { diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc index 84c606cfd8..ffff120a23 100644 --- a/libs/ardour/automation_control.cc +++ b/libs/ardour/automation_control.cc @@ -30,6 +30,7 @@ #include "ardour/control_group.h" #include "ardour/event_type_map.h" #include "ardour/session.h" +#include "ardour/selection.h" #include "pbd/i18n.h" @@ -68,6 +69,7 @@ AutomationControl::AutomationControl(ARDOUR::Session& s AutomationControl::~AutomationControl () { + _session.selection().remove_control_by_id (id()); DropReferences (); /* EMIT SIGNAL */ } diff --git a/libs/ardour/debug.cc b/libs/ardour/debug.cc index 5c645a8095..0f03475fe4 100644 --- a/libs/ardour/debug.cc +++ b/libs/ardour/debug.cc @@ -68,6 +68,7 @@ PBD::DebugBits PBD::DEBUG::Ports = PBD::new_debug_bit ("Ports"); PBD::DebugBits PBD::DEBUG::AudioEngine = PBD::new_debug_bit ("AudioEngine"); PBD::DebugBits PBD::DEBUG::Soundcloud = PBD::new_debug_bit ("Soundcloud"); PBD::DebugBits PBD::DEBUG::Butler = PBD::new_debug_bit ("Butler"); +PBD::DebugBits PBD::DEBUG::Selection = PBD::new_debug_bit ("selection"); PBD::DebugBits PBD::DEBUG::GenericMidi = PBD::new_debug_bit ("genericmidi"); PBD::DebugBits PBD::DEBUG::BackendMIDI = PBD::new_debug_bit ("backendmidi"); diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 9e57f078d2..76d21021a1 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -722,7 +722,6 @@ setup_enum_writer () REGISTER_CLASS_ENUM (PresentationInfo, MasterOut); REGISTER_CLASS_ENUM (PresentationInfo, MonitorOut); REGISTER_CLASS_ENUM (PresentationInfo, Auditioner); - REGISTER_CLASS_ENUM (PresentationInfo, Selected); REGISTER_CLASS_ENUM (PresentationInfo, Hidden); REGISTER_CLASS_ENUM (PresentationInfo, OrderSet); REGISTER_BITS (_PresentationInfo_Flag); diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index d8464c8b83..bd7f8ada13 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -1636,7 +1636,6 @@ LuaBindings::common (lua_State* L) .addConst ("MasterOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MasterOut)) .addConst ("MonitorOut", ARDOUR::PresentationInfo::Flag(PresentationInfo::MonitorOut)) .addConst ("Auditioner", ARDOUR::PresentationInfo::Flag(PresentationInfo::Auditioner)) - .addConst ("Selected", ARDOUR::PresentationInfo::Flag(PresentationInfo::Selected)) .addConst ("Hidden", ARDOUR::PresentationInfo::Flag(PresentationInfo::Hidden)) .addConst ("GroupOrderSet", ARDOUR::PresentationInfo::Flag(PresentationInfo::OrderSet)) .addConst ("StatusMask", ARDOUR::PresentationInfo::Flag(PresentationInfo::StatusMask)) diff --git a/libs/ardour/presentation_info.cc b/libs/ardour/presentation_info.cc index f269541de0..d070f83220 100644 --- a/libs/ardour/presentation_info.cc +++ b/libs/ardour/presentation_info.cc @@ -30,6 +30,7 @@ #include "pbd/xml++.h" #include "ardour/presentation_info.h" +#include "ardour/selection.h" #include "pbd/i18n.h" @@ -47,7 +48,7 @@ PBD::Signal1 PresentationInfo::Change; Glib::Threads::Mutex PresentationInfo::static_signal_lock; int PresentationInfo::_change_signal_suspended = 0; PBD::PropertyChange PresentationInfo::_pending_static_changes; -int PresentationInfo::selection_counter = 0; +int PresentationInfo::selection_counter= 0; namespace ARDOUR { namespace Properties { @@ -240,22 +241,6 @@ PresentationInfo::color_set () const return _color != 0; } -void -PresentationInfo::set_selected (bool yn) -{ - if (yn != selected()) { - if (yn) { - _flags = Flag (_flags | Selected); - _selection_cnt = g_atomic_int_add (&selection_counter, 1); - } else { - _flags = Flag (_flags & ~Selected); - _selection_cnt = 0; - } - send_change (PropertyChange (Properties::selected)); - send_static_change (PropertyChange (Properties::selected)); - } -} - void PresentationInfo::set_hidden (bool yn) { diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index ec54f83a9a..82ce635511 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -89,7 +89,6 @@ Route::Route (Session& sess, string name, PresentationInfo::Flag flag, DataType : Stripable (sess, name, PresentationInfo (flag)) , GraphNode (sess._process_graph) , Muteable (sess, name) - , Automatable (sess) , _active (true) , _signal_latency (0) , _signal_latency_at_amp_position (0) @@ -121,7 +120,7 @@ Route::Route (Session& sess, string name, PresentationInfo::Flag flag, DataType boost::weak_ptr Route::weakroute () { - return boost::weak_ptr (shared_from_this ()); + return boost::weak_ptr (boost::dynamic_pointer_cast (shared_from_this ())); } int @@ -970,7 +969,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr flags &= mask; if (flags != None) { - boost::optional rv = PluginSetup (shared_from_this (), pi, flags); /* EMIT SIGNAL */ + boost::optional rv = PluginSetup (boost::dynamic_pointer_cast(shared_from_this ()), pi, flags); /* EMIT SIGNAL */ int mode = rv.get_value_or (0); switch (mode & 3) { case 1: @@ -3283,13 +3282,13 @@ Route::direct_feeds_according_to_reality (boost::shared_ptr other, bool* bool Route::direct_feeds_according_to_graph (boost::shared_ptr other, bool* via_send_only) { - return _session._current_route_graph.has (shared_from_this (), other, via_send_only); + return _session._current_route_graph.has (boost::dynamic_pointer_cast (shared_from_this ()), other, via_send_only); } bool Route::feeds_according_to_graph (boost::shared_ptr other) { - return _session._current_route_graph.feeds (shared_from_this (), other); + return _session._current_route_graph.feeds (boost::dynamic_pointer_cast (shared_from_this ()), other); } /** Called from the (non-realtime) butler thread when the transport is stopped */ @@ -3338,7 +3337,7 @@ Route::input_change_handler (IOChange change, void * /*src*/) continue; } bool sends_only; - bool does_feed = (*i)->direct_feeds_according_to_reality (shared_from_this(), &sends_only); + bool does_feed = (*i)->direct_feeds_according_to_reality (boost::dynamic_pointer_cast (shared_from_this()), &sends_only); if (does_feed && !sends_only) { if ((*i)->soloed()) { ++sbou; @@ -3452,7 +3451,7 @@ Route::output_change_handler (IOChange change, void * /*src*/) _solo_control->mod_solo_by_others_downstream (delta); // Session::route_solo_changed() does not propagate indirect solo-changes // propagate upstream to tracks - boost::shared_ptr shared_this = shared_from_this(); + boost::shared_ptr shared_this = boost::dynamic_pointer_cast (shared_from_this()); for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) { if ((*i).get() == this || !can_solo()) { continue; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 4ffb58566e..3cf24ba581 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -94,6 +94,7 @@ #include "ardour/route_graph.h" #include "ardour/route_group.h" #include "ardour/send.h" +#include "ardour/selection.h" #include "ardour/session.h" #include "ardour/session_directory.h" #include "ardour/session_playlists.h" @@ -324,6 +325,7 @@ Session::Session (AudioEngine &eng, , _midi_ports (0) , _mmc (0) , _vca_manager (new VCAManager (*this)) + , _selection (new CoreSelection (*this)) { uint32_t sr = 0; @@ -4388,6 +4390,22 @@ Session::route_by_id (PBD::ID id) const return boost::shared_ptr ((Route*) 0); } + +boost::shared_ptr +Session::stripable_by_id (PBD::ID id) const +{ + StripableList sl; + get_stripables (sl); + + for (StripableList::const_iterator s = sl.begin(); s != sl.end(); ++s) { + if ((*s)->id() == id) { + return *s; + } + } + + return boost::shared_ptr(); +} + boost::shared_ptr Session::processor_by_id (PBD::ID id) const { @@ -4487,7 +4505,7 @@ Session::route_by_selected_count (uint32_t id) const RouteList::iterator i; for (i = r.begin(); i != r.end(); ++i) { - if ((*i)->presentation_info().selected()) { + if ((*i)->is_selected()) { if (id == 0) { return *i; } diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index b0fb946011..081db24d2a 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -736,7 +736,7 @@ Session::midi_track_presentation_info_changed (PropertyChange const& what_change boost::shared_ptr new_midi_target (mt.lock ()); - if (new_midi_target->presentation_info().selected()) { + if (new_midi_target->is_selected()) { rewire_selected_midi (new_midi_target); } } diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 581d6950c5..b7fac84ffe 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -114,6 +114,7 @@ #include "ardour/revision.h" #include "ardour/route_group.h" #include "ardour/send.h" +#include "ardour/selection.h" #include "ardour/session.h" #include "ardour/session_directory.h" #include "ardour/session_metadata.h" @@ -1286,6 +1287,8 @@ Session::state (bool full_state) if (full_state) { + node->add_child_nocopy (_selection->get_state()); + if (_locations) { node->add_child_nocopy (_locations->get_state()); } @@ -1649,6 +1652,10 @@ Session::set_state (const XMLNode& node, int version) } } + if ((child = find_named_node (node, X_("Selection")))) { + _selection->set_state (*child, version); + } + update_route_record_state (); /* here beginneth the second phase ... */ @@ -3583,6 +3590,12 @@ Session::controllable_by_id (const PBD::ID& id) return boost::shared_ptr(); } +boost::shared_ptr +Session::automation_control_by_id (const PBD::ID& id) +{ + return boost::dynamic_pointer_cast (controllable_by_id (id)); +} + boost::shared_ptr Session::controllable_by_descriptor (const ControllableDescriptor& desc) { diff --git a/libs/ardour/stripable.cc b/libs/ardour/stripable.cc index c2f5b7239a..c4f128b4e8 100644 --- a/libs/ardour/stripable.cc +++ b/libs/ardour/stripable.cc @@ -21,24 +21,32 @@ #include "pbd/compose.h" #include "pbd/convert.h" +#include "pbd/i18n.h" + #include "ardour/debug.h" #include "ardour/rc_configuration.h" +#include "ardour/session.h" +#include "ardour/selection.h" #include "ardour/stripable.h" -#include "pbd/i18n.h" - using namespace ARDOUR; using namespace PBD; using std::string; Stripable::Stripable (Session& s, string const & name, PresentationInfo const & pi) : SessionObject (s, name) + , Automatable (s) , _presentation_info (pi) , _active_color_picker (0) { } +Stripable::~Stripable () +{ + _session.selection().remove_stripable_by_id (id()); +} + void Stripable::set_presentation_order (PresentationInfo::order_t order) { @@ -103,3 +111,15 @@ Stripable::set_state (XMLNode const& node, int version) return 0; } + +bool +Stripable::is_selected() const +{ + try { + boost::shared_ptr s (shared_from_this()); + } catch (...) { + std::cerr << "cannot shared-from-this for " << this << std::endl; + abort (); + } + return _session.selection().selected (shared_from_this()); +} diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 1d17d9238c..d7d9a0a9d1 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -65,7 +65,7 @@ Track::init () return -1; } - boost::shared_ptr rp (shared_from_this()); + boost::shared_ptr rp (boost::dynamic_pointer_cast (shared_from_this())); boost::shared_ptr rt = boost::dynamic_pointer_cast (rp); _record_enable_control.reset (new RecordEnableControl (_session, EventTypeMap::instance().to_symbol (RecEnableAutomation), *this)); diff --git a/libs/ardour/vca.cc b/libs/ardour/vca.cc index d056c855ed..3eff1a6b45 100644 --- a/libs/ardour/vca.cc +++ b/libs/ardour/vca.cc @@ -70,7 +70,6 @@ VCA::get_next_vca_number () VCA::VCA (Session& s, int32_t num, const string& name) : Stripable (s, name, PresentationInfo (num, PresentationInfo::VCA)) , Muteable (s, name) - , Automatable (s) , _number (num) , _gain_control (new GainControl (s, Evoral::Parameter (GainAutomation), boost::shared_ptr ())) { diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 1098477426..7148a26042 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -194,6 +194,7 @@ libardour_sources = [ 'rb_effect.cc', 'scene_change.cc', 'search_paths.cc', + 'selection.cc', 'send.cc', 'session.cc', 'session_butler.cc', diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 62d0abab09..a359982799 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -335,7 +335,7 @@ MackieControlProtocol::get_sorted_stripables() } break; case Selected: // For example: a group (this is USER) - if (s->presentation_info().selected() && !s->presentation_info().hidden()) { + if (s->is_selected() && !s->presentation_info().hidden()) { sorted.push_back (s); } break; @@ -2038,7 +2038,7 @@ MackieControlProtocol::select_range (uint32_t pressed) return; } - if (stripables.size() == 1 && ControlProtocol::last_selected().size() == 1 && stripables.front()->presentation_info().selected()) { + if (stripables.size() == 1 && ControlProtocol::last_selected().size() == 1 && stripables.front()->is_selected()) { /* cancel selection for one and only selected stripable */ ToggleStripableSelection (stripables.front()); } else { diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index e396af575c..9a570f8227 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -380,8 +380,8 @@ Strip::notify_property_changed (const PropertyChange& what_changed) if (what_changed.contains (ARDOUR::Properties::selected)) { if (_stripable) { - _surface->write (_select->set_state (_stripable->presentation_info().selected())); - _surface->mcp().update_selected (_stripable, _stripable->presentation_info().selected()); + _surface->write (_select->set_state (_stripable->is_selected())); + _surface->mcp().update_selected (_stripable, _stripable->is_selected()); } } } diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 5fe8e25f41..fae9db11e1 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -3998,17 +3998,13 @@ OSC::get_sorted_stripables(std::bitset<32> types, bool cue) sorted.push_back (s); } } - } else - if (types[3] && (s->presentation_info().flags() & PresentationInfo::MidiBus)) { + } else if (types[3] && (s->presentation_info().flags() & PresentationInfo::MidiBus)) { sorted.push_back (s); - } else - if (types[4] && (s->presentation_info().flags() & PresentationInfo::VCA)) { + } else if (types[4] && (s->presentation_info().flags() & PresentationInfo::VCA)) { sorted.push_back (s); - } else - if (types[8] && (s->presentation_info().flags() & PresentationInfo::Selected)) { + } else if (types[8] && (s->is_selected())) { sorted.push_back (s); - } else - if (types[9] && (s->presentation_info().flags() & PresentationInfo::Hidden)) { + } else if (types[9] && (s->presentation_info().flags() & PresentationInfo::Hidden)) { sorted.push_back (s); } } diff --git a/libs/surfaces/push2/mix.cc b/libs/surfaces/push2/mix.cc index 75b17f8c20..4582cd0d30 100644 --- a/libs/surfaces/push2/mix.cc +++ b/libs/surfaces/push2/mix.cc @@ -448,7 +448,7 @@ MixLayout::stripable_property_change (PropertyChange const& what_changed, uint32 if (what_changed.contains (Properties::color)) { lower_backgrounds[which]->set_fill_color (stripable[which]->presentation_info().color()); - if (stripable[which]->presentation_info().selected()) { + if (stripable[which]->is_selected()) { lower_text[which]->set_fill_color (contrasting_text_color (stripable[which]->presentation_info().color())); /* might not be a MIDI track, in which case this will do nothing @@ -467,7 +467,7 @@ MixLayout::stripable_property_change (PropertyChange const& what_changed, uint32 return; } - if (stripable[which]->presentation_info().selected()) { + if (stripable[which]->is_selected()) { show_selection (which); } else { hide_selection (which); @@ -581,7 +581,7 @@ MixLayout::switch_bank (uint32_t base) stripable[n]->solo_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::solo_changed, this, n), &p2); stripable[n]->mute_control()->Changed.connect (stripable_connections, invalidator (*this), boost::bind (&MixLayout::mute_changed, this, n), &p2); - if (stripable[n]->presentation_info().selected()) { + if (stripable[n]->is_selected()) { show_selection (n); } else { hide_selection (n); @@ -671,7 +671,7 @@ MixLayout::button_select_release () for (int n = 0; n < 8; ++n) { if (stripable[n]) { - if (stripable[n]->presentation_info().selected()) { + if (stripable[n]->is_selected()) { selected = n; break; }