X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Faxis_view.h;h=2a7c3781978d92d8ea5e959c4ed794a2a9fe3cf5;hb=28bb82cee7400cb26a97cd4113e76b5a7dc81ca2;hp=4ae8f8d46e597ce0e15818c0d615f96e06336834;hpb=25d1670a61d19e795227b939a98be9cf5a050c67;p=ardour.git diff --git a/gtk2_ardour/axis_view.h b/gtk2_ardour/axis_view.h index 4ae8f8d46e..2a7c378197 100644 --- a/gtk2_ardour/axis_view.h +++ b/gtk2_ardour/axis_view.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2003 Paul Davis + Copyright (C) 2003 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -15,59 +15,75 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id$ */ #ifndef __ardour_gtk_axis_view_h__ #define __ardour_gtk_axis_view_h__ #include +#include #include #include -#include +#include "pbd/xml++.h" +#include "pbd/signals.h" + +#include "ardour/session_handle.h" + +#include "gui_object.h" #include "prompter.h" #include "selectable.h" namespace ARDOUR { class Session; + class Stripable; + class PresentationInfo; } /** - * AxisView defines the abstract base class for time-axis trackviews and routes. + * AxisView defines the abstract base class for horizontal and vertical + * presentations of Stripables. * */ -class AxisView : public virtual Selectable +class AxisView : public virtual PBD::ScopedConnectionList, public virtual ARDOUR::SessionHandlePtr, public virtual Selectable { public: - /** - * Returns the current 'Track' Color - * - * @return the current Track Color - */ - Gdk::Color color() const { return _color; } + ARDOUR::Session* session() const { return _session; } - ARDOUR::Session& session() const { return _session; } + virtual std::string name() const = 0; + virtual Gdk::Color color() const = 0; - virtual string name() const = 0; + sigc::signal Hiding; - virtual bool marked_for_display() const { return _marked_for_display; } + virtual boost::shared_ptr stripable() const = 0; - virtual void set_marked_for_display (bool yn) { - if (yn != _marked_for_display) { - _marked_for_display = yn; - } + virtual std::string state_id() const = 0; + /* for now, we always return properties in string form. + */ + std::string gui_property (const std::string& property_name) const; + + template void set_gui_property (const std::string& property_name, const T& value) { + std::stringstream s; + s << value; + property_hashtable.erase(property_name); + property_hashtable.emplace(property_name, s.str()); + gui_object_state().set_property (state_id(), property_name, value); } - - sigc::signal Hiding; - sigc::signal GoingAway; - protected: + void cleanup_gui_properties () { + /* remove related property node from the GUI state */ + gui_object_state().remove_node (state_id()); + property_hashtable.clear (); + } - AxisView (ARDOUR::Session& sess); - virtual ~AxisView(); - + void set_selected (bool yn); + + virtual bool marked_for_display () const; + virtual bool set_marked_for_display (bool); + + static GUIObjectState& gui_object_state(); + void clear_property_cache() { property_hashtable.clear(); } /** * Generate a new random TrackView color, unique from those colors already used. @@ -76,17 +92,15 @@ class AxisView : public virtual Selectable */ static Gdk::Color unique_random_color(); + protected: + AxisView (); + virtual ~AxisView(); - ARDOUR::Session& _session; - Gdk::Color _color; - - static list used_colors; + static std::list used_colors; Gtk::Label name_label; - bool _marked_for_display; - + mutable boost::unordered_map property_hashtable; }; /* class AxisView */ #endif /* __ardour_gtk_axis_view_h__ */ -