diff options
author | Carl Hetherington <carl@carlh.net> | 2009-07-09 13:39:45 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2009-07-09 13:39:45 +0000 |
commit | 4297071b3f7360b17d81ef9cf36b8d75d46d2818 (patch) | |
tree | 13cbb169cfcf79a2e845d8860f0f98e192f3a8d3 /gtk2_ardour/time_axis_view.h | |
parent | 0f8031da06e131595b3625169f9687c1a1ab2f3a (diff) |
Use shared_ptr for the TimeAxisView hierarchy.
git-svn-id: svn://localhost/ardour2/branches/3.0@5339 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/time_axis_view.h')
-rw-r--r-- | gtk2_ardour/time_axis_view.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 486dc6404d..c8dc6b1da0 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -23,6 +23,8 @@ #include <vector> #include <list> +#include <boost/enable_shared_from_this.hpp> + #include <gtkmm/box.h> #include <gtkmm/frame.h> #include <gtkmm/drawingarea.h> @@ -44,6 +46,7 @@ #include "enums.h" #include "editing.h" #include "canvas.h" +#include "shared_ptrs.h" namespace ARDOUR { class Session; @@ -73,7 +76,7 @@ class StreamView; * This class provides the basic LHS controls and display methods. This should be * extended to create functional time-axis based views. */ -class TimeAxisView : public virtual AxisView, public PBD::Stateful +class TimeAxisView : public virtual AxisView, public PBD::Stateful, public boost::enable_shared_from_this<TimeAxisView> { private: enum NamePackingBits { @@ -89,7 +92,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful static uint32_t hSmaller; static uint32_t hSmall; - TimeAxisView(ARDOUR::Session& sess, PublicEditor& ed, TimeAxisView* parent, ArdourCanvas::Canvas& canvas); + TimeAxisView(ARDOUR::Session& sess, PublicEditor& ed, TimeAxisViewPtr parent, ArdourCanvas::Canvas& canvas); virtual ~TimeAxisView (); XMLNode& get_state (); @@ -153,7 +156,7 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful virtual void set_height (uint32_t h); void reset_height(); - std::pair<TimeAxisView*, ARDOUR::layer_t> covers_y_position (double); + std::pair<TimeAxisViewPtr, ARDOUR::layer_t> covers_y_position (double); /** * Steps through the defined heights for this TrackView. @@ -204,8 +207,8 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful expensive data loading/redisplay code in here. */ virtual void first_idle () {} - TimeAxisView* get_parent () { return parent; } - void set_parent (TimeAxisView& p); + TimeAxisViewPtr get_parent () { return parent; } + void set_parent (TimeAxisViewPtr p); bool has_state () const; /* call this on the parent */ @@ -214,6 +217,8 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful virtual LayerDisplay layer_display () const { return Overlaid; } virtual StreamView* view () const { return 0; } + + TimeAxisViewPtr find_time_axis (TimeAxisView *); typedef std::vector<boost::shared_ptr<TimeAxisView> > Children; @@ -293,16 +298,16 @@ class TimeAxisView : public virtual AxisView, public PBD::Stateful Gtk::Label name_label; - TimeAxisView* parent; + TimeAxisViewPtr parent; /** Find the parent with state */ - TimeAxisView* get_parent_with_state(); + TimeAxisViewPtr get_parent_with_state(); Children children; - bool is_child (TimeAxisView*); + bool is_child (TimeAxisViewPtr); - void remove_child (boost::shared_ptr<TimeAxisView>); - void add_child (boost::shared_ptr<TimeAxisView>); + void remove_child (TimeAxisViewPtr); + void add_child (TimeAxisViewPtr); /* selection display */ |