2 Copyright (C) 2017 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __ardour_selection_h__
21 #define __ardour_selection_h__
26 #include <boost/weak_ptr.hpp>
27 #include <boost/shared_ptr.hpp>
29 #include "pbd/stateful.h"
32 #include "ardour/presentation_info.h"
36 class AutomationControl;
40 class PresentationInfo;
42 class LIBARDOUR_API CoreSelection : public PBD::Stateful {
44 CoreSelection (Session& s);
47 void toggle (boost::shared_ptr<Stripable>, boost::shared_ptr<AutomationControl>);
48 void add (boost::shared_ptr<Stripable>, boost::shared_ptr<AutomationControl>);
49 void remove (boost::shared_ptr<Stripable>, boost::shared_ptr<AutomationControl>);
50 void set (boost::shared_ptr<Stripable>, boost::shared_ptr<AutomationControl>);
51 void clear_stripables();
53 bool selected (boost::shared_ptr<const Stripable>) const;
54 bool selected (boost::shared_ptr<const AutomationControl>) const;
55 uint32_t selected() const;
57 struct StripableAutomationControl {
58 boost::shared_ptr<Stripable> stripable;
59 boost::shared_ptr<AutomationControl> controllable;
62 StripableAutomationControl (boost::shared_ptr<Stripable> s, boost::shared_ptr<AutomationControl> c, int o)
63 : stripable (s), controllable (c), order (o) {}
66 typedef std::vector<StripableAutomationControl> StripableAutomationControls;
68 void get_stripables (StripableAutomationControls&) const;
70 XMLNode& get_state (void);
71 int set_state (const XMLNode&, int version);
74 friend class AutomationControl;
75 void remove_control_by_id (PBD::ID const &);
78 friend class Stripable;
80 friend class VCAManager;
81 void remove_stripable_by_id (PBD::ID const &);
84 mutable Glib::Threads::RWLock _lock;
88 struct SelectedStripable {
89 SelectedStripable (boost::shared_ptr<Stripable>, boost::shared_ptr<AutomationControl>, int);
90 SelectedStripable (PBD::ID const & s, PBD::ID const & c, int o)
91 : stripable (s), controllable (c), order (o) {}
97 bool operator< (SelectedStripable const & other) const {
98 if (stripable == other.stripable) {
99 return controllable < other.controllable;
101 return stripable < other.stripable;
105 typedef std::set<SelectedStripable> SelectedStripables;
107 SelectedStripables _stripables;
109 void send_selection_change ();
112 } // namespace ARDOUR
114 #endif /* __ardour_selection_h__ */