2 Copyright (C) 2003 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_gtk_axis_view_h__
21 #define __ardour_gtk_axis_view_h__
24 #include <boost/unordered_map.hpp>
26 #include <gtkmm/label.h>
27 #include <gdkmm/color.h>
29 #include "pbd/xml++.h"
30 #include "pbd/signals.h"
32 #include "ardour/session_handle.h"
34 #include "gui_object.h"
36 #include "selectable.h"
41 class PresentationInfo;
45 * AxisView defines the abstract base class for horizontal and vertical
46 * presentations of Stripables.
49 class AxisView : public virtual PBD::ScopedConnectionList, public virtual ARDOUR::SessionHandlePtr, public virtual Selectable
52 ARDOUR::Session* session() const { return _session; }
54 virtual std::string name() const = 0;
55 virtual Gdk::Color color() const = 0;
57 sigc::signal<void> Hiding;
59 virtual boost::shared_ptr<ARDOUR::Stripable> stripable() const = 0;
61 virtual std::string state_id() const = 0;
62 /* for now, we always return properties in string form.
64 std::string gui_property (const std::string& property_name) const;
66 template<typename T> void set_gui_property (const std::string& property_name, const T& value) {
69 property_hashtable.erase(property_name);
70 property_hashtable.emplace(property_name, s.str());
71 gui_object_state().set_property<T> (state_id(), property_name, value);
74 void cleanup_gui_properties () {
75 /* remove related property node from the GUI state */
76 gui_object_state().remove_node (state_id());
77 property_hashtable.clear ();
80 void set_selected (bool yn);
82 virtual bool marked_for_display () const;
83 virtual bool set_marked_for_display (bool);
85 static GUIObjectState& gui_object_state();
86 void clear_property_cache() { property_hashtable.clear(); }
89 * Generate a new random TrackView color, unique from those colors already used.
91 * @return the unique random color.
93 static Gdk::Color unique_random_color();
99 static std::list<Gdk::Color> used_colors;
101 Gtk::Label name_label;
103 mutable boost::unordered_map<std::string, std::string> property_hashtable;
104 }; /* class AxisView */
106 #endif /* __ardour_gtk_axis_view_h__ */