2 * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
4 * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
5 * Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
6 * Copyright (C) 2014-2017 Robin Gareus <robin@gareus.org>
7 * Copyright (C) 2016 Tim Mayberry <mojofunk@gmail.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 #ifndef __ardour_gtk_axis_view_h__
25 #define __ardour_gtk_axis_view_h__
28 #include <boost/unordered_map.hpp>
30 #include <gtkmm/label.h>
31 #include <gdkmm/color.h>
33 #include "pbd/xml++.h"
34 #include "pbd/signals.h"
36 #include "ardour/session_handle.h"
38 #include "gui_object.h"
39 #include "selectable.h"
48 class PresentationInfo;
52 * AxisView defines the abstract base class for horizontal and vertical
53 * presentations of Stripables.
56 class AxisView : public virtual PBD::ScopedConnectionList, public virtual ARDOUR::SessionHandlePtr, public virtual Selectable
59 virtual std::string name() const = 0;
60 virtual Gdk::Color color() const = 0;
62 sigc::signal<void> Hiding;
64 virtual boost::shared_ptr<ARDOUR::Stripable> stripable() const = 0;
65 virtual boost::shared_ptr<ARDOUR::AutomationControl> control() const { return boost::shared_ptr<ARDOUR::AutomationControl>(); }
67 virtual std::string state_id() const = 0;
68 /* for now, we always return properties in string form.
70 std::string gui_property (const std::string& property_name) const;
72 bool get_gui_property (const std::string& property_name, std::string& value) const;
75 bool get_gui_property (const std::string& property_name, T& value) const
77 std::string str = gui_property (property_name);
80 return PBD::string_to<T>(str, value);
85 void set_gui_property (const std::string& property_name, const std::string& value);
87 void set_gui_property (const std::string& property_name, const char* value) {
88 set_gui_property (property_name, std::string(value));
92 void set_gui_property (const std::string& property_name, const T& value)
94 set_gui_property (property_name, PBD::to_string(value));
97 void cleanup_gui_properties () {
98 /* remove related property node from the GUI state */
99 gui_object_state().remove_node (state_id());
100 property_hashtable.clear ();
103 void set_selected (bool yn);
105 virtual bool marked_for_display () const;
106 virtual bool set_marked_for_display (bool);
108 static GUIObjectState& gui_object_state();
109 void clear_property_cache() { property_hashtable.clear(); }
112 * Generate a new random TrackView color, unique from those colors already used.
114 * @return the unique random color.
116 static Gdk::Color unique_random_color();
122 static std::list<Gdk::Color> used_colors;
124 Gtk::Label name_label;
126 mutable boost::unordered_map<std::string, std::string> property_hashtable;
127 }; /* class AxisView */
129 #endif /* __ardour_gtk_axis_view_h__ */