X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Faxis_view.h;h=bacaa8410de8bfb6ff6c7d05d84ee423751ad352;hb=f443626daa8cc654ef5682e4c144394f49876e80;hp=51f744c4e550e7cbd38fadb5a70d6ca7fb1f89d0;hpb=99904735e066804358f1d0bd138a84f1e9ecda91;p=ardour.git diff --git a/gtk2_ardour/axis_view.h b/gtk2_ardour/axis_view.h index 51f744c4e5..bacaa8410d 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 @@ -21,52 +21,88 @@ #define __ardour_gtk_axis_view_h__ #include +#include #include #include -#include -#include "prompter.h" +#include "pbd/xml++.h" +#include "pbd/signals.h" + +#include "ardour/session_handle.h" + +#include "gui_object.h" #include "selectable.h" +namespace PBD { + class Controllable; +} + 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; } +public: + virtual std::string name() const = 0; + virtual Gdk::Color color() const = 0; + + sigc::signal Hiding; - ARDOUR::Session& session() const { return _session; } + virtual boost::shared_ptr stripable() const = 0; + virtual boost::shared_ptr control() const { return boost::shared_ptr(); } - virtual string name() const = 0; + 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; - virtual bool marked_for_display() const { return _marked_for_display; } + bool get_gui_property (const std::string& property_name, std::string& value) const; - virtual void set_marked_for_display (bool yn) { - if (yn != _marked_for_display) { - _marked_for_display = yn; + template + bool get_gui_property (const std::string& property_name, T& value) const + { + std::string str = gui_property (property_name); + + if (!str.empty ()) { + return PBD::string_to(str, value); + } + return false; } + + void set_gui_property (const std::string& property_name, const std::string& value); + + void set_gui_property (const std::string& property_name, const char* value) { + set_gui_property (property_name, std::string(value)); + } + + template + void set_gui_property (const std::string& property_name, const T& value) + { + set_gui_property (property_name, PBD::to_string(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. @@ -75,17 +111,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__ */ -