From a8bd6ecc4fe4016090fad92daf6d9a572941d035 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 21 Jun 2014 11:43:42 -0400 Subject: [PATCH 1/3] refactor Canvas so that all Items have children; add Container abstract base class; rename Group as "Layout" and retain only drawing semantics --- libs/canvas/arc.cc | 4 +- libs/canvas/arrow.cc | 6 +- libs/canvas/canvas.cc | 2 +- libs/canvas/canvas/arc.h | 2 +- libs/canvas/canvas/arrow.h | 7 +- libs/canvas/canvas/canvas.h | 8 +- libs/canvas/canvas/circle.h | 2 +- libs/canvas/canvas/curve.h | 2 +- libs/canvas/canvas/flag.h | 6 +- libs/canvas/canvas/fwd.h | 1 + libs/canvas/canvas/group.h | 79 ------ libs/canvas/canvas/image.h | 2 +- libs/canvas/canvas/item.h | 49 +++- libs/canvas/canvas/line.h | 2 +- libs/canvas/canvas/line_set.h | 2 +- libs/canvas/canvas/lookup_table.h | 9 +- libs/canvas/canvas/pixbuf.h | 2 +- libs/canvas/canvas/poly_item.h | 2 +- libs/canvas/canvas/poly_line.h | 2 +- libs/canvas/canvas/polygon.h | 2 +- libs/canvas/canvas/rectangle.h | 4 +- libs/canvas/canvas/root_group.h | 7 +- libs/canvas/canvas/ruler.h | 4 +- libs/canvas/canvas/scroll_group.h | 10 +- libs/canvas/canvas/stateful_image.h | 2 +- libs/canvas/canvas/text.h | 2 +- libs/canvas/canvas/wave_view.h | 2 +- libs/canvas/canvas/widget.h | 2 +- libs/canvas/canvas/xfade_curve.h | 4 +- libs/canvas/circle.cc | 4 +- libs/canvas/curve.cc | 4 +- libs/canvas/flag.cc | 6 +- libs/canvas/group.cc | 395 ---------------------------- libs/canvas/image.cc | 4 +- libs/canvas/item.cc | 310 ++++++++++++++++++++-- libs/canvas/line.cc | 4 +- libs/canvas/line_set.cc | 4 +- libs/canvas/lookup_table.cc | 42 +-- libs/canvas/pixbuf.cc | 4 +- libs/canvas/poly_item.cc | 4 +- libs/canvas/poly_line.cc | 4 +- libs/canvas/polygon.cc | 4 +- libs/canvas/rectangle.cc | 8 +- libs/canvas/root_group.cc | 11 +- libs/canvas/ruler.cc | 8 +- libs/canvas/scroll_group.cc | 12 +- libs/canvas/text.cc | 4 +- libs/canvas/wave_view.cc | 4 +- libs/canvas/widget.cc | 4 +- libs/canvas/wscript | 3 +- libs/canvas/xfade_curve.cc | 8 +- 51 files changed, 442 insertions(+), 637 deletions(-) delete mode 100644 libs/canvas/canvas/group.h delete mode 100644 libs/canvas/group.cc diff --git a/libs/canvas/arc.cc b/libs/canvas/arc.cc index 80141d4c66..baec2fafb1 100644 --- a/libs/canvas/arc.cc +++ b/libs/canvas/arc.cc @@ -39,8 +39,8 @@ Arc::Arc (Canvas* c) { } -Arc::Arc (Group* g) - : Item (g) +Arc::Arc (Item* parent) + : Item (parent) , _radius (0.0) , _arc_degrees (0.0) , _start_degrees (0.0) diff --git a/libs/canvas/arrow.cc b/libs/canvas/arrow.cc index 86d4e33ca9..5cac31300e 100644 --- a/libs/canvas/arrow.cc +++ b/libs/canvas/arrow.cc @@ -35,13 +35,13 @@ using namespace ArdourCanvas; * @param parent Parent canvas group. */ Arrow::Arrow (Canvas* c) - : Group (c) + : Layout (c) { setup (); } -Arrow::Arrow (Group* g) - : Group (g) +Arrow::Arrow (Item* parent) + : Layout (parent) { setup (); } diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 4ccf46b019..8c7960a217 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -396,7 +396,7 @@ GtkCanvas::pick_current_item (Duple const & point, int state) /* We ignore invisible items, groups and items that ignore events */ - if (!new_item->visible() || new_item->ignore_events() || dynamic_cast(new_item) != 0) { + if (!new_item->visible() || new_item->ignore_events() || dynamic_cast(new_item) != 0) { continue; } diff --git a/libs/canvas/canvas/arc.h b/libs/canvas/canvas/arc.h index 5eaa4a0ab9..c2b32d9e10 100644 --- a/libs/canvas/canvas/arc.h +++ b/libs/canvas/canvas/arc.h @@ -32,7 +32,7 @@ class LIBCANVAS_API Arc : public Item { public: Arc (Canvas*); - Arc (Group*); + Arc (Item*); void render (Rect const & area, Cairo::RefPtr) const; void compute_bounding_box () const; diff --git a/libs/canvas/canvas/arrow.h b/libs/canvas/canvas/arrow.h index 75c21da07c..7db225553e 100644 --- a/libs/canvas/canvas/arrow.h +++ b/libs/canvas/canvas/arrow.h @@ -26,8 +26,7 @@ #define __CANVAS_ARROW_H__ #include "canvas/visibility.h" - -#include "canvas/group.h" +#include "canvas/layout.h" namespace ArdourCanvas { @@ -46,11 +45,11 @@ class Polygon; * to draw lines at any angle. */ -class LIBCANVAS_API Arrow : public Group +class LIBCANVAS_API Arrow : public Layout { public: Arrow (Canvas*); - Arrow (Group*); + Arrow (Item*); void set_show_head (int, bool); void set_head_outward (int, bool); diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h index fac9367985..94005f4cc7 100644 --- a/libs/canvas/canvas/canvas.h +++ b/libs/canvas/canvas/canvas.h @@ -42,7 +42,7 @@ namespace ArdourCanvas { class Rect; -class Group; +class Item; class ScrollGroup; /** The base class for our different types of canvas. @@ -78,7 +78,7 @@ public: void render (Rect const &, Cairo::RefPtr const &) const; /** @return root group */ - Group* root () { + Item* root () { return &_root; } @@ -122,8 +122,8 @@ public: protected: void queue_draw_item_area (Item *, Rect); - /** our root group */ - RootGroup _root; + /** our root item */ + Root _root; virtual void pick_current_item (int state) = 0; virtual void pick_current_item (Duple const &, int state) = 0; diff --git a/libs/canvas/canvas/circle.h b/libs/canvas/canvas/circle.h index 1ca376a7a2..c84e3aceec 100644 --- a/libs/canvas/canvas/circle.h +++ b/libs/canvas/canvas/circle.h @@ -29,7 +29,7 @@ class LIBCANVAS_API Circle : public Arc { public: Circle (Canvas*); - Circle (Group*); + Circle (Item*); }; } diff --git a/libs/canvas/canvas/curve.h b/libs/canvas/canvas/curve.h index 1bcab58e32..d27291e353 100644 --- a/libs/canvas/canvas/curve.h +++ b/libs/canvas/canvas/curve.h @@ -33,7 +33,7 @@ class LIBCANVAS_API Curve : public PolyItem, public InterpolatedCurve { public: Curve (Canvas*); - Curve (Group*); + Curve (Item*); enum CurveFill { None, diff --git a/libs/canvas/canvas/flag.h b/libs/canvas/canvas/flag.h index 2429e1775e..05c0e2777d 100644 --- a/libs/canvas/canvas/flag.h +++ b/libs/canvas/canvas/flag.h @@ -18,8 +18,8 @@ */ #include "canvas/visibility.h" -#include "canvas/group.h" #include "canvas/types.h" +#include "canvas/layout.h" namespace ArdourCanvas { @@ -27,11 +27,11 @@ class Text; class Line; class Rectangle; -class LIBCANVAS_API Flag : public Group +class LIBCANVAS_API Flag : public Layout { public: Flag (Canvas *, Distance, Color, Color, Duple); - Flag (Group*, Distance, Color, Color, Duple); + Flag (Item*, Distance, Color, Color, Duple); void set_text (std::string const &); void set_height (Distance); diff --git a/libs/canvas/canvas/fwd.h b/libs/canvas/canvas/fwd.h index 728e6988d4..61cab3c9d2 100644 --- a/libs/canvas/canvas/fwd.h +++ b/libs/canvas/canvas/fwd.h @@ -33,6 +33,7 @@ namespace ArdourCanvas { class GtkCanvasViewport; class Text; class Curve; + class ScrollGroup; } #endif /* __canvas_canvas_fwd_h__ */ diff --git a/libs/canvas/canvas/group.h b/libs/canvas/canvas/group.h deleted file mode 100644 index 6bfc40ba28..0000000000 --- a/libs/canvas/canvas/group.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2011-2013 Paul Davis - Author: Carl Hetherington - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef __CANVAS_GROUP_H__ -#define __CANVAS_GROUP_H__ - -#include -#include - -#include "canvas/visibility.h" -#include "canvas/item.h" -#include "canvas/types.h" -#include "canvas/lookup_table.h" - -namespace ArdourCanvas { - -class LIBCANVAS_API Group : public Item -{ -public: - Group (Canvas*); - Group (Group*); - Group (Group*, Duple const& positon); - virtual ~Group (); - - void render (Rect const &, Cairo::RefPtr) const; - virtual void compute_bounding_box () const; - - void add (Item *); - void remove (Item *); - void clear (bool with_delete = false); - std::list const & items () const { - return _items; - } - - void raise_child_to_top (Item *); - void raise_child (Item *, int); - void lower_child_to_bottom (Item *); - void child_changed (); - - void scroll_to (Duple const& d); - - void add_items_at_point (Duple, std::vector &) const; - - void dump (std::ostream&) const; - - static int default_items_per_cell; - -private: - friend class ::OptimizingLookupTableTest; - - void ensure_lut () const; - void invalidate_lut () const; - void clear_items (bool with_delete); - - /* our items, from lowest to highest in the stack */ - std::list _items; - - mutable LookupTable* _lut; -}; - -} - -#endif diff --git a/libs/canvas/canvas/image.h b/libs/canvas/canvas/image.h index fd86818c21..64d70a5751 100644 --- a/libs/canvas/canvas/image.h +++ b/libs/canvas/canvas/image.h @@ -35,7 +35,7 @@ class LIBCANVAS_API Image : public Item { public: Image (Canvas *, Cairo::Format, int width, int height); - Image (Group*, Cairo::Format, int width, int height); + Image (Item*, Cairo::Format, int width, int height); struct Data { Data (uint8_t *d, int w, int h, int s, Cairo::Format fmt) diff --git a/libs/canvas/canvas/item.h b/libs/canvas/canvas/item.h index bf752f66db..ced94e1e3b 100644 --- a/libs/canvas/canvas/item.h +++ b/libs/canvas/canvas/item.h @@ -32,12 +32,12 @@ #include "canvas/types.h" #include "canvas/fill.h" #include "canvas/outline.h" +#include "canvas/lookup_table.h" namespace ArdourCanvas { class Canvas; -class Group; class Rect; class ScrollGroup; @@ -56,8 +56,8 @@ class LIBCANVAS_API Item : public Fill, public Outline { public: Item (Canvas *); - Item (Group *); - Item (Group *, Duple const& p); + Item (Item *); + Item (Item *, Duple const& p); virtual ~Item (); void redraw () const; @@ -80,13 +80,11 @@ public: * * Note that Item::add_items_at_window_point() is only intended to be * called on items already looked up in a LookupTable (i.e. by a - * parent group) and thus known to cover @param point already. + * parent) and thus known to cover @param point already. * - * Derived classes may add more items than themselves (e.g. Group). + * Derived classes may add more items than themselves (e.g. containers). */ - virtual void add_items_at_point (Duple /*point*/, std::vector& items) const { - items.push_back (this); - } + virtual void add_items_at_point (Duple /*point*/, std::vector& items) const; virtual bool covers (Duple const &) const; @@ -97,10 +95,10 @@ public: void ungrab (); void unparent (); - void reparent (Group *); + void reparent (Item *); /** @return Parent group, or 0 if this is the root group */ - Group* parent () const { + Item* parent () const { return _parent; } @@ -124,8 +122,6 @@ public: void set_y_position (Coord); void move (Duple); - virtual void scroll_to (Duple const&) {} - /** @return Position of this item in the parent's coordinates */ Duple position () const { return _position; @@ -187,6 +183,21 @@ public: void set_data (std::string const &, void *); void* get_data (std::string const &) const; + + /* nested item ("grouping") API */ + void add (Item *); + void remove (Item *); + void clear (bool with_delete = false); + std::list const & items () const { + return _items; + } + void raise_child_to_top (Item *); + void raise_child (Item *, int); + void lower_child_to_bottom (Item *); + void child_changed (); + + static int default_items_per_cell; + /* This is a sigc++ signal because it is solely concerned with GUI stuff and is thus single-threaded @@ -243,7 +254,7 @@ protected: Canvas* _canvas; /** parent group; may be 0 if we are the root group or if we have been unparent()ed */ - Group* _parent; + Item* _parent; /** scroll parent group; may be 0 if we are the root group or if we have been unparent()ed */ ScrollGroup* _scroll_parent; /** position of this item in parent coordinates */ @@ -261,6 +272,18 @@ protected: /* XXX: this is a bit grubby */ std::map _data; + /* nesting ("grouping") API */ + + void invalidate_lut () const; + void clear_items (bool with_delete); + + void ensure_lut () const; + mutable LookupTable* _lut; + /* our items, from lowest to highest in the stack */ + std::list _items; + + void add_child_bounding_boxes() const; + private: void init (); diff --git a/libs/canvas/canvas/line.h b/libs/canvas/canvas/line.h index e8f57a00ba..b178554c84 100644 --- a/libs/canvas/canvas/line.h +++ b/libs/canvas/canvas/line.h @@ -31,7 +31,7 @@ class LIBCANVAS_API Line : public Item { public: Line (Canvas*); - Line (Group*); + Line (Item*); void render (Rect const & area, Cairo::RefPtr) const; void compute_bounding_box () const; diff --git a/libs/canvas/canvas/line_set.h b/libs/canvas/canvas/line_set.h index 38f97250ce..fad100fdf9 100644 --- a/libs/canvas/canvas/line_set.h +++ b/libs/canvas/canvas/line_set.h @@ -36,7 +36,7 @@ public: }; LineSet (Canvas*, Orientation o = Vertical); - LineSet (Group*, Orientation o = Vertical); + LineSet (Item*, Orientation o = Vertical); void compute_bounding_box () const; void render (Rect const & area, Cairo::RefPtr) const; diff --git a/libs/canvas/canvas/lookup_table.h b/libs/canvas/canvas/lookup_table.h index 5be33c1bca..29452365cd 100644 --- a/libs/canvas/canvas/lookup_table.h +++ b/libs/canvas/canvas/lookup_table.h @@ -31,12 +31,11 @@ class OptimizingLookupTableTest; namespace ArdourCanvas { class Item; -class Group; class LIBCANVAS_API LookupTable { public: - LookupTable (Group const &); + LookupTable (Item const &); virtual ~LookupTable (); virtual std::vector get (Rect const &) = 0; @@ -45,13 +44,13 @@ public: protected: - Group const & _group; + Item const & _item; }; class LIBCANVAS_API DumbLookupTable : public LookupTable { public: - DumbLookupTable (Group const &); + DumbLookupTable (Item const &); std::vector get (Rect const &); std::vector items_at_point (Duple const &) const; @@ -61,7 +60,7 @@ public: class LIBCANVAS_API OptimizingLookupTable : public LookupTable { public: - OptimizingLookupTable (Group const &, int); + OptimizingLookupTable (Item const &, int); ~OptimizingLookupTable (); std::vector get (Rect const &); std::vector items_at_point (Duple const &) const; diff --git a/libs/canvas/canvas/pixbuf.h b/libs/canvas/canvas/pixbuf.h index eba73e57bf..2749b96668 100644 --- a/libs/canvas/canvas/pixbuf.h +++ b/libs/canvas/canvas/pixbuf.h @@ -35,7 +35,7 @@ class LIBCANVAS_API Pixbuf : public Item { public: Pixbuf (Canvas*); - Pixbuf (Group*); + Pixbuf (Item*); void render (Rect const &, Cairo::RefPtr) const; void compute_bounding_box () const; diff --git a/libs/canvas/canvas/poly_item.h b/libs/canvas/canvas/poly_item.h index ab68204ff0..732adb14b3 100644 --- a/libs/canvas/canvas/poly_item.h +++ b/libs/canvas/canvas/poly_item.h @@ -30,7 +30,7 @@ class LIBCANVAS_API PolyItem : public Item { public: PolyItem (Canvas*); - PolyItem (Group*); + PolyItem (Item*); void compute_bounding_box () const; diff --git a/libs/canvas/canvas/poly_line.h b/libs/canvas/canvas/poly_line.h index 5476711e97..16db9a69e2 100644 --- a/libs/canvas/canvas/poly_line.h +++ b/libs/canvas/canvas/poly_line.h @@ -30,7 +30,7 @@ class LIBCANVAS_API PolyLine : public PolyItem { public: PolyLine (Canvas*); - PolyLine (Group*); + PolyLine (Item*); void render (Rect const & area, Cairo::RefPtr) const; diff --git a/libs/canvas/canvas/polygon.h b/libs/canvas/canvas/polygon.h index a3eed37cdc..9703eb46e9 100644 --- a/libs/canvas/canvas/polygon.h +++ b/libs/canvas/canvas/polygon.h @@ -31,7 +31,7 @@ class LIBCANVAS_API Polygon : public PolyItem { public: Polygon (Canvas*); - Polygon (Group*); + Polygon (Item*); virtual ~Polygon(); void render (Rect const & area, Cairo::RefPtr) const; diff --git a/libs/canvas/canvas/rectangle.h b/libs/canvas/canvas/rectangle.h index ff6eca3cd9..2983d33ed2 100644 --- a/libs/canvas/canvas/rectangle.h +++ b/libs/canvas/canvas/rectangle.h @@ -34,8 +34,8 @@ class LIBCANVAS_API Rectangle : public Item public: Rectangle (Canvas*); Rectangle (Canvas*, Rect const &); - Rectangle (Group*); - Rectangle (Group*, Rect const &); + Rectangle (Item*); + Rectangle (Item*, Rect const &); void render (Rect const &, Cairo::RefPtr) const; void compute_bounding_box () const; diff --git a/libs/canvas/canvas/root_group.h b/libs/canvas/canvas/root_group.h index 70c3e5b90b..5db8024f51 100644 --- a/libs/canvas/canvas/root_group.h +++ b/libs/canvas/canvas/root_group.h @@ -21,19 +21,18 @@ #define __CANVAS_ROOT_GROUP_H__ #include "canvas/visibility.h" -#include "canvas/group.h" +#include "canvas/layout.h" namespace ArdourCanvas { -class LIBCANVAS_API RootGroup : public Group +class LIBCANVAS_API Root : public Layout { private: friend class Canvas; - RootGroup (Canvas *); + Root (Canvas *); void compute_bounding_box () const; - void child_changed (); }; } diff --git a/libs/canvas/canvas/ruler.h b/libs/canvas/canvas/ruler.h index 633a1d569e..25040247c9 100644 --- a/libs/canvas/canvas/ruler.h +++ b/libs/canvas/canvas/ruler.h @@ -57,8 +57,8 @@ public: Ruler (Canvas*, const Metric& m); Ruler (Canvas*, const Metric& m, Rect const&); - Ruler (Group*, const Metric& m); - Ruler (Group*, const Metric& m, Rect const&); + Ruler (Item*, const Metric& m); + Ruler (Item*, const Metric& m, Rect const&); void set_range (double lower, double upper); void set_font_description (Pango::FontDescription); diff --git a/libs/canvas/canvas/scroll_group.h b/libs/canvas/canvas/scroll_group.h index 552538eb21..013d769c2f 100644 --- a/libs/canvas/canvas/scroll_group.h +++ b/libs/canvas/canvas/scroll_group.h @@ -19,11 +19,15 @@ #ifndef __CANVAS_SCROLL_GROUP_H__ #define __CANVAS_SCROLL_GROUP_H__ -#include "canvas/group.h" +#include "canvas/layout.h" namespace ArdourCanvas { -class LIBCANVAS_API ScrollGroup : public Group +/** A ScrollGroup has no contents of its own, but renders + * its children in a way that reflects the most recent + * call to its scroll_to() method. + */ +class LIBCANVAS_API ScrollGroup : public Layout { public: enum ScrollSensitivity { @@ -32,7 +36,7 @@ class LIBCANVAS_API ScrollGroup : public Group }; ScrollGroup (Canvas*, ScrollSensitivity); - ScrollGroup (Group*, ScrollSensitivity); + ScrollGroup (Item*, ScrollSensitivity); void scroll_to (Duple const& d); Duple scroll_offset() const { return _scroll_offset; } diff --git a/libs/canvas/canvas/stateful_image.h b/libs/canvas/canvas/stateful_image.h index 5952752e71..7c00b0c5a4 100644 --- a/libs/canvas/canvas/stateful_image.h +++ b/libs/canvas/canvas/stateful_image.h @@ -50,7 +50,7 @@ class StatefulImage : public Item public: StatefulImage (Canvas*, const XMLNode&); - StatefulImage (Group*, const XMLNode&); + StatefulImage (Item*, const XMLNode&); ~StatefulImage (); bool set_state (States::size_type); diff --git a/libs/canvas/canvas/text.h b/libs/canvas/canvas/text.h index cc6d5c815d..85262ee984 100644 --- a/libs/canvas/canvas/text.h +++ b/libs/canvas/canvas/text.h @@ -32,7 +32,7 @@ class LIBCANVAS_API Text : public Item { public: Text (Canvas*); - Text (Group*); + Text (Item*); ~Text(); void render (Rect const &, Cairo::RefPtr) const; diff --git a/libs/canvas/canvas/wave_view.h b/libs/canvas/canvas/wave_view.h index c98c62c7a3..042414e1e2 100644 --- a/libs/canvas/canvas/wave_view.h +++ b/libs/canvas/canvas/wave_view.h @@ -92,7 +92,7 @@ public: WaveView (Canvas *, boost::shared_ptr); - WaveView (Group*, boost::shared_ptr); + WaveView (Item*, boost::shared_ptr); ~WaveView (); void render (Rect const & area, Cairo::RefPtr) const; diff --git a/libs/canvas/canvas/widget.h b/libs/canvas/canvas/widget.h index 842f336a51..590bb3af7d 100644 --- a/libs/canvas/canvas/widget.h +++ b/libs/canvas/canvas/widget.h @@ -32,7 +32,7 @@ class LIBCANVAS_API Widget : public Item { public: Widget (Canvas*, CairoWidget&); - Widget (Group*, CairoWidget&); + Widget (Item*, CairoWidget&); void render (Rect const &, Cairo::RefPtr) const; void compute_bounding_box () const; diff --git a/libs/canvas/canvas/xfade_curve.h b/libs/canvas/canvas/xfade_curve.h index d6a10d1f86..c63e47c583 100644 --- a/libs/canvas/canvas/xfade_curve.h +++ b/libs/canvas/canvas/xfade_curve.h @@ -36,8 +36,8 @@ public: XFadeCurve (Canvas *); XFadeCurve (Canvas *, XFadePosition); - XFadeCurve (Group*); - XFadeCurve (Group*, XFadePosition); + XFadeCurve (Item*); + XFadeCurve (Item*, XFadePosition); void set_fade_position (XFadePosition xfp) { _xfadeposition = xfp; } diff --git a/libs/canvas/circle.cc b/libs/canvas/circle.cc index 3799bf60ac..1859434123 100644 --- a/libs/canvas/circle.cc +++ b/libs/canvas/circle.cc @@ -26,8 +26,8 @@ Circle::Circle (Canvas* c) set_arc (360.0); } -Circle::Circle (Group* g) - : Arc (g) +Circle::Circle (Item * parent) + : Arc (parent) { set_arc (360.0); } diff --git a/libs/canvas/curve.cc b/libs/canvas/curve.cc index 547783ae08..ba6ac68df6 100644 --- a/libs/canvas/curve.cc +++ b/libs/canvas/curve.cc @@ -36,8 +36,8 @@ Curve::Curve (Canvas* c) { } -Curve::Curve (Group* g) - : PolyItem (g) +Curve::Curve (Item* parent) + : PolyItem (parent) , n_samples (0) , points_per_segment (16) , curve_type (CatmullRomCentripetal) diff --git a/libs/canvas/flag.cc b/libs/canvas/flag.cc index f5379791df..b6532d7fd2 100644 --- a/libs/canvas/flag.cc +++ b/libs/canvas/flag.cc @@ -26,15 +26,15 @@ using namespace std; using namespace ArdourCanvas; Flag::Flag (Canvas* canvas, Distance height, Color outline_color, Color fill_color, Duple position) - : Group (canvas) + : Layout (canvas) , _outline_color (outline_color) , _fill_color (fill_color) { setup (height, position); } -Flag::Flag (Group* group, Distance height, Color outline_color, Color fill_color, Duple position) - : Group (group) +Flag::Flag (Item* parent, Distance height, Color outline_color, Color fill_color, Duple position) + : Layout (parent) , _outline_color (outline_color) , _fill_color (fill_color) { diff --git a/libs/canvas/group.cc b/libs/canvas/group.cc deleted file mode 100644 index d63b217396..0000000000 --- a/libs/canvas/group.cc +++ /dev/null @@ -1,395 +0,0 @@ -/* - Copyright (C) 2011-2013 Paul Davis - Author: Carl Hetherington - - 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 - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include -#include - -#include "pbd/stacktrace.h" -#include "pbd/compose.h" - -#include "canvas/group.h" -#include "canvas/types.h" -#include "canvas/debug.h" -#include "canvas/item.h" -#include "canvas/canvas.h" - -using namespace std; -using namespace ArdourCanvas; - -int Group::default_items_per_cell = 64; - - -Group::Group (Canvas* canvas) - : Item (canvas) - , _lut (0) -{ -} - -Group::Group (Group* group) - : Item (group) - , _lut (0) -{ -} - -Group::Group (Group* group, Duple const& p) - : Item (group, p) - , _lut (0) -{ -} - -Group::~Group () -{ - clear_items (true); -} - -/** @param area Area to draw in window coordinates. - * @param context Context, set up with its origin at this group's position. - */ -void -Group::render (Rect const & area, Cairo::RefPtr context) const -{ - ensure_lut (); - vector items = _lut->get (area); - -#ifdef CANVAS_DEBUG - if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) { - cerr << string_compose ("%1GROUP %2 @ %7 render %5 @ %6 %3 items out of %4\n", - _canvas->render_indent(), (name.empty() ? string ("[unnamed]") : name), items.size(), _items.size(), area, _position, this); - } -#endif - - ++render_depth; - - for (vector::const_iterator i = items.begin(); i != items.end(); ++i) { - - if (!(*i)->visible ()) { -#ifdef CANVAS_DEBUG - if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) { - cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] invisible - skipped\n"; - } -#endif - continue; - } - - boost::optional item_bbox = (*i)->bounding_box (); - - if (!item_bbox) { -#ifdef CANVAS_DEBUG - if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) { - cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] empty - skipped\n"; - } -#endif - continue; - } - - Rect item = (*i)->item_to_window (item_bbox.get()); - boost::optional d = item.intersection (area); - - if (d) { - Rect draw = d.get(); - if (draw.width() && draw.height()) { -#ifdef CANVAS_DEBUG - if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) { - if (dynamic_cast(*i) == 0) { - cerr << _canvas->render_indent() << "render " - << ' ' - << (*i) - << ' ' - << (*i)->whatami() - << ' ' - << (*i)->name - << " item " - << item_bbox.get() - << " window = " - << item - << " intersect = " - << draw - << " @ " - << _position - << endl; - } - } -#endif - - (*i)->render (area, context); - ++render_count; - } - - } else { - -#ifdef CANVAS_DEBUG - if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) { - cerr << string_compose ("%1skip render of %2 %3, no intersection between %4 and %5\n", _canvas->render_indent(), (*i)->whatami(), - (*i)->name, item, area); - } -#endif - - } - } - - --render_depth; -} - -void -Group::scroll_to (Duple const& d) -{ - Item::scroll_to (d); - - for (list::iterator i = _items.begin(); i != _items.end(); ++i) { - (*i)->scroll_to (d); - } -} - -void -Group::compute_bounding_box () const -{ - Rect bbox; - bool have_one = false; - - for (list::const_iterator i = _items.begin(); i != _items.end(); ++i) { - - boost::optional item_bbox = (*i)->bounding_box (); - - if (!item_bbox) { - continue; - } - - Rect group_bbox = (*i)->item_to_parent (item_bbox.get ()); - if (have_one) { - bbox = bbox.extend (group_bbox); - } else { - bbox = group_bbox; - have_one = true; - } - } - - if (!have_one) { - _bounding_box = boost::optional (); - } else { - _bounding_box = bbox; - } - - _bounding_box_dirty = false; -} - -void -Group::add (Item* i) -{ - /* XXX should really notify canvas about this */ - - _items.push_back (i); - i->reparent (this); - invalidate_lut (); - _bounding_box_dirty = true; -} - -void -Group::remove (Item* i) -{ - - if (i->parent() != this) { - return; - } - - /* we cannot call bounding_box() here because that will iterate over - _items, one of which (the argument, i) may be in the middle of - deletion, making it impossible to call compute_bounding_box() - on it. - */ - - if (_bounding_box) { - _pre_change_bounding_box = _bounding_box; - } else { - _pre_change_bounding_box = Rect(); - } - - i->unparent (); - _items.remove (i); - invalidate_lut (); - _bounding_box_dirty = true; - - end_change (); -} - -void -Group::clear (bool with_delete) -{ - begin_change (); - - clear_items (with_delete); - - invalidate_lut (); - _bounding_box_dirty = true; - - end_change (); -} - -void -Group::clear_items (bool with_delete) -{ - for (list::iterator i = _items.begin(); i != _items.end(); ) { - - list::iterator tmp = i; - Item *item = *i; - - ++tmp; - - /* remove from list before doing anything else, because we - * don't want to find the item in _items during any activity - * driven by unparent-ing or deletion. - */ - - _items.erase (i); - item->unparent (); - - if (with_delete) { - delete item; - } - - i = tmp; - } -} - -void -Group::raise_child_to_top (Item* i) -{ - if (!_items.empty()) { - if (_items.back() == i) { - return; - } - } - - _items.remove (i); - _items.push_back (i); - invalidate_lut (); -} - -void -Group::raise_child (Item* i, int levels) -{ - list::iterator j = find (_items.begin(), _items.end(), i); - assert (j != _items.end ()); - - ++j; - _items.remove (i); - - while (levels > 0 && j != _items.end ()) { - ++j; - --levels; - } - - _items.insert (j, i); - invalidate_lut (); -} - -void -Group::lower_child_to_bottom (Item* i) -{ - if (!_items.empty()) { - if (_items.front() == i) { - return; - } - } - _items.remove (i); - _items.push_front (i); - invalidate_lut (); -} - -void -Group::ensure_lut () const -{ - if (!_lut) { - _lut = new DumbLookupTable (*this); - } -} - -void -Group::invalidate_lut () const -{ - delete _lut; - _lut = 0; -} - -void -Group::child_changed () -{ - invalidate_lut (); - _bounding_box_dirty = true; - - if (_parent) { - _parent->child_changed (); - } -} - -void -Group::add_items_at_point (Duple const point, vector& items) const -{ - boost::optional const bbox = bounding_box (); - - /* Point is in window coordinate system */ - - if (!bbox || !item_to_window (bbox.get()).contains (point)) { - return; - } - - /* now recurse and add any items within our group that contain point */ - - ensure_lut (); - vector our_items = _lut->items_at_point (point); - - if (!our_items.empty()) { - /* this adds this group itself to the list of items at point */ - Item::add_items_at_point (point, items); - } - - for (vector::iterator i = our_items.begin(); i != our_items.end(); ++i) { - (*i)->add_items_at_point (point, items); - } -} - -void -Group::dump (ostream& o) const -{ -#ifdef CANVAS_DEBUG - o << _canvas->indent(); - o << "Group " << this << " [" << name << ']'; - o << " @ " << position(); - o << " Items: " << _items.size(); - o << " Visible ? " << _visible; - - boost::optional bb = bounding_box(); - - if (bb) { - o << endl << _canvas->indent() << " bbox: " << bb.get(); - o << endl << _canvas->indent() << " CANVAS bbox: " << item_to_canvas (bb.get()); - } else { - o << " bbox unset"; - } - - o << endl; -#endif - - ArdourCanvas::dump_depth++; - - for (list::const_iterator i = _items.begin(); i != _items.end(); ++i) { - o << **i; - } - - ArdourCanvas::dump_depth--; -} diff --git a/libs/canvas/image.cc b/libs/canvas/image.cc index 5ab280cbbc..46cadd0d1c 100644 --- a/libs/canvas/image.cc +++ b/libs/canvas/image.cc @@ -32,8 +32,8 @@ Image::Image (Canvas* canvas, Cairo::Format fmt, int width, int height) DataReady.connect (data_connections, MISSING_INVALIDATOR, boost::bind (&Image::accept_data, this), gui_context()); } -Image::Image (Group* group, Cairo::Format fmt, int width, int height) - : Item (group) +Image::Image (Item* parent, Cairo::Format fmt, int width, int height) + : Item (parent) , _format (fmt) , _width (width) , _height (height) diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc index ea77008b5f..e58411f17f 100644 --- a/libs/canvas/item.cc +++ b/libs/canvas/item.cc @@ -25,7 +25,6 @@ #include "canvas/canvas.h" #include "canvas/debug.h" -#include "canvas/group.h" #include "canvas/item.h" #include "canvas/scroll_group.h" @@ -33,6 +32,8 @@ using namespace std; using namespace PBD; using namespace ArdourCanvas; +int Item::default_items_per_cell = 64; + Item::Item (Canvas* canvas) : Fill (*this) , Outline (*this) @@ -41,12 +42,13 @@ Item::Item (Canvas* canvas) , _scroll_parent (0) , _visible (true) , _bounding_box_dirty (true) + , _lut (0) , _ignore_events (false) { DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this)); } -Item::Item (Group* parent) +Item::Item (Item* parent) : Fill (*this) , Outline (*this) , _canvas (parent->canvas()) @@ -54,6 +56,7 @@ Item::Item (Group* parent) , _scroll_parent (0) , _visible (true) , _bounding_box_dirty (true) + , _lut (0) , _ignore_events (false) { DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this)); @@ -65,7 +68,7 @@ Item::Item (Group* parent) find_scroll_parent (); } -Item::Item (Group* parent, Duple const& p) +Item::Item (Item* parent, Duple const& p) : Fill (*this) , Outline (*this) , _canvas (parent->canvas()) @@ -74,6 +77,7 @@ Item::Item (Group* parent, Duple const& p) , _position (p) , _visible (true) , _bounding_box_dirty (true) + , _lut (0) , _ignore_events (false) { DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this)); @@ -95,6 +99,9 @@ Item::~Item () if (_canvas) { _canvas->item_going_away (this, _bounding_box); } + + clear_items (true); + delete _lut; } Duple @@ -350,7 +357,7 @@ Item::unparent () } void -Item::reparent (Group* new_parent) +Item::reparent (Item* new_parent) { if (new_parent == _parent) { return; @@ -516,6 +523,7 @@ Item::bounding_box () const if (_bounding_box_dirty) { compute_bounding_box (); assert (!_bounding_box_dirty); + add_child_bounding_boxes (); } return _bounding_box; @@ -626,30 +634,6 @@ Item::set_ignore_events (bool ignore) _ignore_events = ignore; } -void -Item::dump (ostream& o) const -{ - boost::optional bb = bounding_box(); - - o << _canvas->indent() << whatami() << ' ' << this << " Visible ? " << _visible; - o << " @ " << position(); - -#ifdef CANVAS_DEBUG - if (!name.empty()) { - o << ' ' << name; - } -#endif - - if (bb) { - o << endl << _canvas->indent() << "\tbbox: " << bb.get(); - o << endl << _canvas->indent() << "\tCANVAS bbox: " << item_to_canvas (bb.get()); - } else { - o << " bbox unset"; - } - - o << endl; -} - std::string Item::whatami () const { @@ -687,6 +671,276 @@ Item::covers (Duple const & point) const return r.get().contains (p); } +/* nesting/grouping API */ + +void +Item::add_child_bounding_boxes() const +{ + boost::optional self; + Rect bbox; + bool have_one = false; + + if (_bounding_box) { + bbox = _bounding_box.get(); + have_one = true; + } + + for (list::const_iterator i = _items.begin(); i != _items.end(); ++i) { + + boost::optional item_bbox = (*i)->bounding_box (); + + if (!item_bbox) { + continue; + } + + Rect group_bbox = (*i)->item_to_parent (item_bbox.get ()); + if (have_one) { + bbox = bbox.extend (group_bbox); + } else { + bbox = group_bbox; + have_one = true; + } + } + + if (!have_one) { + _bounding_box = boost::optional (); + } else { + _bounding_box = bbox; + } +} + +void +Item::add (Item* i) +{ + /* XXX should really notify canvas about this */ + + _items.push_back (i); + i->reparent (this); + invalidate_lut (); + _bounding_box_dirty = true; +} + +void +Item::remove (Item* i) +{ + + if (i->parent() != this) { + return; + } + + /* we cannot call bounding_box() here because that will iterate over + _items, one of which (the argument, i) may be in the middle of + deletion, making it impossible to call compute_bounding_box() + on it. + */ + + if (_bounding_box) { + _pre_change_bounding_box = _bounding_box; + } else { + _pre_change_bounding_box = Rect(); + } + + i->unparent (); + _items.remove (i); + invalidate_lut (); + _bounding_box_dirty = true; + + end_change (); +} + +void +Item::clear (bool with_delete) +{ + begin_change (); + + clear_items (with_delete); + + invalidate_lut (); + _bounding_box_dirty = true; + + end_change (); +} + +void +Item::clear_items (bool with_delete) +{ + for (list::iterator i = _items.begin(); i != _items.end(); ) { + + list::iterator tmp = i; + Item *item = *i; + + ++tmp; + + /* remove from list before doing anything else, because we + * don't want to find the item in _items during any activity + * driven by unparent-ing or deletion. + */ + + _items.erase (i); + item->unparent (); + + if (with_delete) { + delete item; + } + + i = tmp; + } +} + +void +Item::raise_child_to_top (Item* i) +{ + if (!_items.empty()) { + if (_items.back() == i) { + return; + } + } + + _items.remove (i); + _items.push_back (i); + invalidate_lut (); +} + +void +Item::raise_child (Item* i, int levels) +{ + list::iterator j = find (_items.begin(), _items.end(), i); + assert (j != _items.end ()); + + ++j; + _items.remove (i); + + while (levels > 0 && j != _items.end ()) { + ++j; + --levels; + } + + _items.insert (j, i); + invalidate_lut (); +} + +void +Item::lower_child_to_bottom (Item* i) +{ + if (!_items.empty()) { + if (_items.front() == i) { + return; + } + } + _items.remove (i); + _items.push_front (i); + invalidate_lut (); +} + +void +Item::ensure_lut () const +{ + if (!_lut) { + _lut = new DumbLookupTable (*this); + } +} + +void +Item::invalidate_lut () const +{ + delete _lut; + _lut = 0; +} + +void +Item::child_changed () +{ + invalidate_lut (); + _bounding_box_dirty = true; + + if (_parent) { + _parent->child_changed (); + } +} + +void +Item::add_items_at_point (Duple const point, vector& items) const +{ + boost::optional const bbox = bounding_box (); + + /* Point is in window coordinate system */ + + if (!bbox || !item_to_window (bbox.get()).contains (point)) { + return; + } + + /* recurse and add any items within our group that contain point */ + + vector our_items; + + if (!_items.empty()) { + ensure_lut (); + our_items = _lut->items_at_point (point); + } + + if (!our_items.empty() || covers (point)) { + /* this adds this item itself to the list of items at point */ + items.push_back (this); + } + + for (vector::iterator i = our_items.begin(); i != our_items.end(); ++i) { + (*i)->add_items_at_point (point, items); + } +} + +void +Item::dump (ostream& o) const +{ + boost::optional bb = bounding_box(); + + o << _canvas->indent() << whatami() << ' ' << this << " Visible ? " << _visible; + o << " @ " << position(); + +#ifdef CANVAS_DEBUG + if (!name.empty()) { + o << ' ' << name; + } +#endif + + if (bb) { + o << endl << _canvas->indent() << "\tbbox: " << bb.get(); + o << endl << _canvas->indent() << "\tCANVAS bbox: " << item_to_canvas (bb.get()); + } else { + o << " bbox unset"; + } + + o << endl; + + if (!_items.empty()) { + +#ifdef CANVAS_DEBUG + o << _canvas->indent(); + o << " @ " << position(); + o << " Items: " << _items.size(); + o << " Visible ? " << _visible; + + boost::optional bb = bounding_box(); + + if (bb) { + o << endl << _canvas->indent() << " bbox: " << bb.get(); + o << endl << _canvas->indent() << " CANVAS bbox: " << item_to_canvas (bb.get()); + } else { + o << " bbox unset"; + } + + o << endl; +#endif + + ArdourCanvas::dump_depth++; + + for (list::const_iterator i = _items.begin(); i != _items.end(); ++i) { + o << **i; + } + + ArdourCanvas::dump_depth--; + } +} + ostream& ArdourCanvas::operator<< (ostream& o, const Item& i) { diff --git a/libs/canvas/line.cc b/libs/canvas/line.cc index 844f05522d..8bd26b9067 100644 --- a/libs/canvas/line.cc +++ b/libs/canvas/line.cc @@ -34,8 +34,8 @@ Line::Line (Canvas* c) { } -Line::Line (Group* group) - : Item (group) +Line::Line (Item* parent) + : Item (parent) { } diff --git a/libs/canvas/line_set.cc b/libs/canvas/line_set.cc index 3eacadaba2..54fe980b1c 100644 --- a/libs/canvas/line_set.cc +++ b/libs/canvas/line_set.cc @@ -38,8 +38,8 @@ LineSet::LineSet (Canvas* c, Orientation o) } -LineSet::LineSet (Group* group, Orientation o) - : Item (group) +LineSet::LineSet (Item* parent, Orientation o) + : Item (parent) , _extent (0) , _orientation (o) { diff --git a/libs/canvas/lookup_table.cc b/libs/canvas/lookup_table.cc index 8e744638d8..2396f59635 100644 --- a/libs/canvas/lookup_table.cc +++ b/libs/canvas/lookup_table.cc @@ -17,14 +17,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "canvas/item.h" #include "canvas/lookup_table.h" -#include "canvas/group.h" using namespace std; using namespace ArdourCanvas; -LookupTable::LookupTable (Group const & group) - : _group (group) +LookupTable::LookupTable (Item const & item) + : _item (item) { } @@ -34,8 +34,8 @@ LookupTable::~LookupTable () } -DumbLookupTable::DumbLookupTable (Group const & group) - : LookupTable (group) +DumbLookupTable::DumbLookupTable (Item const & item) + : LookupTable (item) { } @@ -43,7 +43,7 @@ DumbLookupTable::DumbLookupTable (Group const & group) vector DumbLookupTable::get (Rect const &) { - list const & items = _group.items (); + list const & items = _item.items (); vector vitems; copy (items.begin(), items.end(), back_inserter (vitems)); return vitems; @@ -54,7 +54,7 @@ DumbLookupTable::items_at_point (Duple const & point) const { /* Point is in window coordinate system */ - list const & items (_group.items ()); + list const & items (_item.items ()); vector vitems; for (list::const_iterator i = items.begin(); i != items.end(); ++i) { @@ -73,7 +73,7 @@ DumbLookupTable::has_item_at_point (Duple const & point) const { /* Point is in window coordinate system */ - list const & items (_group.items ()); + list const & items (_item.items ()); vector vitems; for (list::const_iterator i = items.begin(); i != items.end(); ++i) { @@ -92,12 +92,12 @@ DumbLookupTable::has_item_at_point (Duple const & point) const return false; } -OptimizingLookupTable::OptimizingLookupTable (Group const & group, int items_per_cell) - : LookupTable (group) +OptimizingLookupTable::OptimizingLookupTable (Item const & item, int items_per_cell) + : LookupTable (item) , _items_per_cell (items_per_cell) , _added (false) { - list const & items = _group.items (); + list const & items = _item.items (); /* number of cells */ int const cells = items.size() / _items_per_cell; @@ -109,8 +109,8 @@ OptimizingLookupTable::OptimizingLookupTable (Group const & group, int items_per _cells[i] = new Cell[_dimension]; } - /* our group's bounding box in its coordinates */ - boost::optional bbox = _group.bounding_box (); + /* our item's bounding box in its coordinates */ + boost::optional bbox = _item.bounding_box (); if (!bbox) { return; } @@ -130,11 +130,11 @@ OptimizingLookupTable::OptimizingLookupTable (Group const & group, int items_per continue; } - /* and in the group's coordinates */ - Rect const item_bbox_in_group = (*i)->item_to_parent (item_bbox.get ()); + /* and in the item's coordinates */ + Rect const item_bbox_in_item = (*i)->item_to_parent (item_bbox.get ()); int x0, y0, x1, y1; - area_to_indices (item_bbox_in_group, x0, y0, x1, y1); + area_to_indices (item_bbox_in_item, x0, y0, x1, y1); /* XXX */ assert (x0 >= 0); @@ -147,19 +147,19 @@ OptimizingLookupTable::OptimizingLookupTable (Group const & group, int items_per //assert (y1 <= _dimension); if (x0 > _dimension) { - cout << "WARNING: item outside bbox by " << (item_bbox_in_group.x0 - bbox.get().x0) << "\n"; + cout << "WARNING: item outside bbox by " << (item_bbox_in_item.x0 - bbox.get().x0) << "\n"; x0 = _dimension; } if (x1 > _dimension) { - cout << "WARNING: item outside bbox by " << (item_bbox_in_group.x1 - bbox.get().x1) << "\n"; + cout << "WARNING: item outside bbox by " << (item_bbox_in_item.x1 - bbox.get().x1) << "\n"; x1 = _dimension; } if (y0 > _dimension) { - cout << "WARNING: item outside bbox by " << (item_bbox_in_group.y0 - bbox.get().y0) << "\n"; + cout << "WARNING: item outside bbox by " << (item_bbox_in_item.y0 - bbox.get().y0) << "\n"; y0 = _dimension; } if (y1 > _dimension) { - cout << "WARNING: item outside bbox by " << (item_bbox_in_group.y1 - bbox.get().y1) << "\n"; + cout << "WARNING: item outside bbox by " << (item_bbox_in_item.y1 - bbox.get().y1) << "\n"; y1 = _dimension; } @@ -284,7 +284,7 @@ OptimizingLookupTable::has_item_at_point (Duple const & point) const return false; } -/** @param area Area in our owning group's coordinates */ +/** @param area Area in our owning item's coordinates */ vector OptimizingLookupTable::get (Rect const & area) { diff --git a/libs/canvas/pixbuf.cc b/libs/canvas/pixbuf.cc index 82eb916397..d285c41b10 100644 --- a/libs/canvas/pixbuf.cc +++ b/libs/canvas/pixbuf.cc @@ -30,8 +30,8 @@ Pixbuf::Pixbuf (Canvas* c) { } -Pixbuf::Pixbuf (Group* g) - : Item (g) +Pixbuf::Pixbuf (Item* parent) + : Item (parent) { } diff --git a/libs/canvas/poly_item.cc b/libs/canvas/poly_item.cc index 618983db97..d50c097e07 100644 --- a/libs/canvas/poly_item.cc +++ b/libs/canvas/poly_item.cc @@ -32,8 +32,8 @@ PolyItem::PolyItem (Canvas* c) { } -PolyItem::PolyItem (Group* g) - : Item (g) +PolyItem::PolyItem (Item* parent) + : Item (parent) { } diff --git a/libs/canvas/poly_line.cc b/libs/canvas/poly_line.cc index bade7d855e..60bca6bccf 100644 --- a/libs/canvas/poly_line.cc +++ b/libs/canvas/poly_line.cc @@ -31,8 +31,8 @@ PolyLine::PolyLine (Canvas* c) { } -PolyLine::PolyLine (Group* g) - : PolyItem (g) +PolyLine::PolyLine (Item* parent) + : PolyItem (parent) , _threshold (1.0) { } diff --git a/libs/canvas/polygon.cc b/libs/canvas/polygon.cc index d84bca4af6..aa16a60178 100644 --- a/libs/canvas/polygon.cc +++ b/libs/canvas/polygon.cc @@ -29,8 +29,8 @@ Polygon::Polygon (Canvas* c) { } -Polygon::Polygon (Group* g) - : PolyItem (g) +Polygon::Polygon (Item* parent) + : PolyItem (parent) , multiple (0) , constant (0) , cached_size (0) diff --git a/libs/canvas/rectangle.cc b/libs/canvas/rectangle.cc index ac05003693..bc4ad0c960 100644 --- a/libs/canvas/rectangle.cc +++ b/libs/canvas/rectangle.cc @@ -43,14 +43,14 @@ Rectangle::Rectangle (Canvas* c, Rect const & rect) { } -Rectangle::Rectangle (Group* g) - : Item (g) +Rectangle::Rectangle (Item* parent) + : Item (parent) , _outline_what ((What) (LEFT | RIGHT | TOP | BOTTOM)) { } -Rectangle::Rectangle (Group* g, Rect const & rect) - : Item (g) +Rectangle::Rectangle (Item* parent, Rect const & rect) + : Item (parent) , _rect (rect) , _outline_what ((What) (LEFT | RIGHT | TOP | BOTTOM)) { diff --git a/libs/canvas/root_group.cc b/libs/canvas/root_group.cc index cded570b2c..015f52bb54 100644 --- a/libs/canvas/root_group.cc +++ b/libs/canvas/root_group.cc @@ -23,8 +23,8 @@ using namespace std; using namespace ArdourCanvas; -RootGroup::RootGroup (Canvas* canvas) - : Group (canvas) +Root::Root (Canvas* canvas) + : Layout (canvas) { #ifdef CANVAS_DEBUG name = "ROOT"; @@ -32,11 +32,12 @@ RootGroup::RootGroup (Canvas* canvas) } void -RootGroup::compute_bounding_box () const +Root::compute_bounding_box () const { - Group::compute_bounding_box (); + Layout::compute_bounding_box (); if (_bounding_box) { - _canvas->request_size (Duple (_bounding_box.get().width (), _bounding_box.get().height ())); + Rect r (_bounding_box.get()); + _canvas->request_size (Duple (r.width (), r.height ())); } } diff --git a/libs/canvas/ruler.cc b/libs/canvas/ruler.cc index 1e7a731899..120ba845a5 100644 --- a/libs/canvas/ruler.cc +++ b/libs/canvas/ruler.cc @@ -49,8 +49,8 @@ Ruler::Ruler (Canvas* c, const Metric& m, Rect const& r) { } -Ruler::Ruler (Group* g, const Metric& m) - : Rectangle (g) +Ruler::Ruler (Item* parent, const Metric& m) + : Rectangle (parent) , _metric (m) , _lower (0) , _upper (0) @@ -58,8 +58,8 @@ Ruler::Ruler (Group* g, const Metric& m) { } -Ruler::Ruler (Group* g, const Metric& m, Rect const& r) - : Rectangle (g, r) +Ruler::Ruler (Item* parent, const Metric& m, Rect const& r) + : Rectangle (parent, r) , _metric (m) , _lower (0) , _upper (0) diff --git a/libs/canvas/scroll_group.cc b/libs/canvas/scroll_group.cc index d78caf4ed0..15b607a564 100644 --- a/libs/canvas/scroll_group.cc +++ b/libs/canvas/scroll_group.cc @@ -28,13 +28,13 @@ using namespace std; using namespace ArdourCanvas; ScrollGroup::ScrollGroup (Canvas* c, ScrollSensitivity s) - : Group (c) + : Layout (c) , _scroll_sensitivity (s) { } -ScrollGroup::ScrollGroup (Group* g, ScrollSensitivity s) - : Group (g) +ScrollGroup::ScrollGroup (Item* parent, ScrollSensitivity s) + : Layout (parent) , _scroll_sensitivity (s) { } @@ -60,12 +60,10 @@ ScrollGroup::render (Rect const & area, Cairo::RefPtr context) c context->save (); context->rectangle (self.x0, self.y0, self.width(), self.height()); context->clip (); - - Group::render (area, context); + + Layout::render (area, context); context->restore (); - - } void diff --git a/libs/canvas/text.cc b/libs/canvas/text.cc index 4c2077a70b..cfad375814 100644 --- a/libs/canvas/text.cc +++ b/libs/canvas/text.cc @@ -43,8 +43,8 @@ Text::Text (Canvas* c) { } -Text::Text (Group* g) - : Item (g) +Text::Text (Item* parent) + : Item (parent) , _color (0x000000ff) , _font_description (0) , _alignment (Pango::ALIGN_LEFT) diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc index 631be6254a..3e131487b6 100644 --- a/libs/canvas/wave_view.cc +++ b/libs/canvas/wave_view.cc @@ -76,8 +76,8 @@ WaveView::WaveView (Canvas* c, boost::shared_ptr region) ClipLevelChanged.connect_same_thread (invalidation_connection, boost::bind (&WaveView::handle_clip_level_change, this)); } -WaveView::WaveView (Group* g, boost::shared_ptr region) - : Item (g) +WaveView::WaveView (Item* parent, boost::shared_ptr region) + : Item (parent) , _region (region) , _channel (0) , _samples_per_pixel (0) diff --git a/libs/canvas/widget.cc b/libs/canvas/widget.cc index 0961382128..17d0d29e59 100644 --- a/libs/canvas/widget.cc +++ b/libs/canvas/widget.cc @@ -36,8 +36,8 @@ Widget::Widget (Canvas* c, CairoWidget& w) Event.connect (sigc::mem_fun (*this, &Widget::event_proxy)); } -Widget::Widget (Group* g, CairoWidget& w) - : Item (g) +Widget::Widget (Item* parent, CairoWidget& w) + : Item (parent) , _widget (w) { Event.connect (sigc::mem_fun (*this, &Widget::event_proxy)); diff --git a/libs/canvas/wscript b/libs/canvas/wscript index 483e19d338..c6e31cafd6 100644 --- a/libs/canvas/wscript +++ b/libs/canvas/wscript @@ -32,13 +32,14 @@ canvas_sources = [ 'arrow.cc', 'canvas.cc', 'circle.cc', + 'container.cc', 'curve.cc', 'debug.cc', 'item.cc', 'fill.cc', 'flag.cc', - 'group.cc', 'image.cc', + 'layout.cc', 'line.cc', 'line_set.cc', 'lookup_table.cc', diff --git a/libs/canvas/xfade_curve.cc b/libs/canvas/xfade_curve.cc index 9a854cd54e..f97cd234d2 100644 --- a/libs/canvas/xfade_curve.cc +++ b/libs/canvas/xfade_curve.cc @@ -48,8 +48,8 @@ XFadeCurve::XFadeCurve (Canvas* c, XFadePosition pos) { } -XFadeCurve::XFadeCurve (Group* g) - : Item (g) +XFadeCurve::XFadeCurve (Item* parent) + : Item (parent) , points_per_segment (32) , _xfadeposition (Start) , _outline_color (0x000000ff) @@ -57,8 +57,8 @@ XFadeCurve::XFadeCurve (Group* g) { } -XFadeCurve::XFadeCurve (Group* g, XFadePosition pos) - : Item (g) +XFadeCurve::XFadeCurve (Item* parent, XFadePosition pos) + : Item (parent) , points_per_segment (32) , _xfadeposition (pos) , _outline_color (0x000000ff) From 0796ccfb652dd31ea1d94526e0e6d92863a972b0 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 21 Jun 2014 11:44:22 -0400 Subject: [PATCH 2/3] use newly factored canvas in gtk2_ardour --- gtk2_ardour/audio_region_view.cc | 4 +-- gtk2_ardour/audio_region_view.h | 4 +-- gtk2_ardour/automation_line.cc | 4 +-- gtk2_ardour/automation_line.h | 10 +++--- gtk2_ardour/automation_region_view.cc | 2 +- gtk2_ardour/automation_region_view.h | 2 +- gtk2_ardour/crossfade_view.h | 2 +- gtk2_ardour/editor.h | 52 +++++++++++++-------------- gtk2_ardour/editor_canvas.cc | 24 ++++++------- gtk2_ardour/editor_cursors.cc | 1 + gtk2_ardour/editor_drag.cc | 4 +-- gtk2_ardour/editor_markers.cc | 12 +++---- gtk2_ardour/editor_rulers.cc | 3 +- gtk2_ardour/ghostregion.cc | 8 ++--- gtk2_ardour/ghostregion.h | 6 ++-- gtk2_ardour/hit.cc | 4 +-- gtk2_ardour/hit.h | 2 +- gtk2_ardour/marker.cc | 13 +++---- gtk2_ardour/marker.h | 14 ++++---- gtk2_ardour/midi_automation_line.cc | 4 +-- gtk2_ardour/midi_automation_line.h | 2 +- gtk2_ardour/midi_region_view.cc | 16 ++++----- gtk2_ardour/midi_region_view.h | 8 ++--- gtk2_ardour/midi_streamview.cc | 2 +- gtk2_ardour/midi_streamview.h | 2 +- gtk2_ardour/note.cc | 4 +-- gtk2_ardour/note.h | 4 +-- gtk2_ardour/patch_change.cc | 2 +- gtk2_ardour/patch_change.h | 2 +- gtk2_ardour/public_editor.h | 8 ++--- gtk2_ardour/region_gain_line.cc | 2 +- gtk2_ardour/region_gain_line.h | 2 +- gtk2_ardour/region_view.cc | 4 +-- gtk2_ardour/region_view.h | 4 +-- gtk2_ardour/streamview.cc | 4 +-- gtk2_ardour/streamview.h | 8 ++--- gtk2_ardour/sys_ex.cc | 2 +- gtk2_ardour/sys_ex.h | 2 +- gtk2_ardour/tape_region_view.cc | 2 +- gtk2_ardour/tape_region_view.h | 2 +- gtk2_ardour/tempo_lines.cc | 2 +- gtk2_ardour/tempo_lines.h | 2 +- gtk2_ardour/time_axis_view.cc | 6 ++-- gtk2_ardour/time_axis_view.h | 12 +++---- gtk2_ardour/time_axis_view_item.cc | 12 +++---- gtk2_ardour/time_axis_view_item.h | 12 +++---- gtk2_ardour/verbose_cursor.cc | 1 + gtk2_ardour/video_image_frame.cc | 4 +-- gtk2_ardour/video_image_frame.h | 6 ++-- gtk2_ardour/video_timeline.cc | 2 +- gtk2_ardour/video_timeline.h | 6 ++-- 51 files changed, 163 insertions(+), 159 deletions(-) diff --git a/gtk2_ardour/audio_region_view.cc b/gtk2_ardour/audio_region_view.cc index 928902bf42..63f081608d 100644 --- a/gtk2_ardour/audio_region_view.cc +++ b/gtk2_ardour/audio_region_view.cc @@ -75,7 +75,7 @@ using namespace ArdourCanvas; static const int32_t sync_mark_width = 9; static double const handle_size = 10; /* height of fade handles */ -AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, +AudioRegionView::AudioRegionView (ArdourCanvas::Layout *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, uint32_t basic_color) : RegionView (parent, tv, r, spu, basic_color) , sync_mark(0) @@ -96,7 +96,7 @@ AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&AudioRegionView::parameter_changed, this, _1), gui_context()); } -AudioRegionView::AudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, +AudioRegionView::AudioRegionView (ArdourCanvas::Layout *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, uint32_t basic_color, bool recording, TimeAxisViewItem::Visibility visibility) : RegionView (parent, tv, r, spu, basic_color, recording, visibility) , sync_mark(0) diff --git a/gtk2_ardour/audio_region_view.h b/gtk2_ardour/audio_region_view.h index ffadce0c59..11be83dc44 100644 --- a/gtk2_ardour/audio_region_view.h +++ b/gtk2_ardour/audio_region_view.h @@ -51,13 +51,13 @@ class RouteTimeAxisView; class AudioRegionView : public RegionView { public: - AudioRegionView (ArdourCanvas::Group *, + AudioRegionView (ArdourCanvas::Layout *, RouteTimeAxisView&, boost::shared_ptr, double initial_samples_per_pixel, uint32_t base_color); - AudioRegionView (ArdourCanvas::Group *, + AudioRegionView (ArdourCanvas::Layout *, RouteTimeAxisView&, boost::shared_ptr, double samples_per_pixel, diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 670083e0d4..4040f8d3bd 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -70,7 +70,7 @@ using namespace Editing; /** @param converter A TimeConverter whose origin_b is the start time of the AutomationList in session frames. * This will not be deleted by AutomationLine. */ -AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanvas::Group& parent, +AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanvas::Item& parent, boost::shared_ptr al, Evoral::TimeConverter* converter) : trackview (tv) @@ -99,7 +99,7 @@ AutomationLine::AutomationLine (const string& name, TimeAxisView& tv, ArdourCanv terminal_points_can_slide = true; _height = 0; - group = new ArdourCanvas::Group (&parent); + group = new ArdourCanvas::Layout (&parent); CANVAS_DEBUG_NAME (group, "region gain envelope group"); line = new ArdourCanvas::PolyLine (group); diff --git a/gtk2_ardour/automation_line.h b/gtk2_ardour/automation_line.h index 67e8fbc52b..5695527002 100644 --- a/gtk2_ardour/automation_line.h +++ b/gtk2_ardour/automation_line.h @@ -37,7 +37,7 @@ #include "ardour/types.h" #include "canvas/types.h" -#include "canvas/group.h" +#include "canvas/layout.h" #include "canvas/poly_line.h" class AutomationLine; @@ -60,7 +60,7 @@ public: SelectedControlPoints = 0x4 }; - AutomationLine (const std::string& name, TimeAxisView&, ArdourCanvas::Group&, + AutomationLine (const std::string& name, TimeAxisView&, ArdourCanvas::Item&, boost::shared_ptr, Evoral::TimeConverter* converter = 0); virtual ~AutomationLine (); @@ -105,7 +105,7 @@ public: TimeAxisView& trackview; - ArdourCanvas::Group& canvas_group() const { return *group; } + ArdourCanvas::Layout& canvas_group() const { return *group; } ArdourCanvas::Item& parent_group() const { return _parent_group; } ArdourCanvas::Item& grab_item() const { return *line; } @@ -173,8 +173,8 @@ protected: /** true if we did a push at any point during the current drag */ bool did_push; - ArdourCanvas::Group& _parent_group; - ArdourCanvas::Group* group; + ArdourCanvas::Item& _parent_group; + ArdourCanvas::Layout* group; ArdourCanvas::PolyLine* line; /* line */ ArdourCanvas::Points line_points; /* coordinates for canvas line */ std::vector control_points; /* visible control points */ diff --git a/gtk2_ardour/automation_region_view.cc b/gtk2_ardour/automation_region_view.cc index 82c9278b01..44744fa39b 100644 --- a/gtk2_ardour/automation_region_view.cc +++ b/gtk2_ardour/automation_region_view.cc @@ -39,7 +39,7 @@ #include "i18n.h" -AutomationRegionView::AutomationRegionView (ArdourCanvas::Group* parent, +AutomationRegionView::AutomationRegionView (ArdourCanvas::Layout* parent, AutomationTimeAxisView& time_axis, boost::shared_ptr region, const Evoral::Parameter& param, diff --git a/gtk2_ardour/automation_region_view.h b/gtk2_ardour/automation_region_view.h index 3b372bce7d..dd9d6a7f82 100644 --- a/gtk2_ardour/automation_region_view.h +++ b/gtk2_ardour/automation_region_view.h @@ -37,7 +37,7 @@ class TimeAxisView; class AutomationRegionView : public RegionView { public: - AutomationRegionView(ArdourCanvas::Group*, + AutomationRegionView(ArdourCanvas::Layout*, AutomationTimeAxisView&, boost::shared_ptr, const Evoral::Parameter& parameter, diff --git a/gtk2_ardour/crossfade_view.h b/gtk2_ardour/crossfade_view.h index 960bcc2d26..9e6e943904 100644 --- a/gtk2_ardour/crossfade_view.h +++ b/gtk2_ardour/crossfade_view.h @@ -36,7 +36,7 @@ namespace ArdourCanvas { class CrossfadeView : public TimeAxisViewItem { public: - CrossfadeView (ArdourCanvas::Group*, + CrossfadeView (ArdourCanvas::Layout*, RouteTimeAxisView&, boost::shared_ptr, double initial_samples_per_pixel, diff --git a/gtk2_ardour/editor.h b/gtk2_ardour/editor.h index 3aee8e87c6..6eb4be81f8 100644 --- a/gtk2_ardour/editor.h +++ b/gtk2_ardour/editor.h @@ -451,10 +451,10 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD _stepping_axis_view = v; } - ArdourCanvas::Group* get_trackview_group () const { return _trackview_group; } - ArdourCanvas::Group* get_hscroll_group () const { return h_scroll_group; } - ArdourCanvas::Group* get_vscroll_group () const { return v_scroll_group; } - ArdourCanvas::Group* get_hvscroll_group () const { return hv_scroll_group; } + ArdourCanvas::Layout* get_trackview_group () const { return _trackview_group; } + ArdourCanvas::ScrollGroup* get_hscroll_group () const { return h_scroll_group; } + ArdourCanvas::ScrollGroup* get_vscroll_group () const { return v_scroll_group; } + ArdourCanvas::ScrollGroup* get_hvscroll_group () const { return hv_scroll_group; } ArdourCanvas::GtkCanvasViewport* get_track_canvas () const; @@ -560,7 +560,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD void refresh_location_display (); void refresh_location_display_internal (ARDOUR::Locations::LocationList&); void add_new_location (ARDOUR::Location *); - ArdourCanvas::Group* add_new_location_internal (ARDOUR::Location *); + ArdourCanvas::Layout* add_new_location_internal (ARDOUR::Location *); void location_gone (ARDOUR::Location *); void remove_marker (ArdourCanvas::Item&, GdkEvent*); gint really_remove_marker (ARDOUR::Location* loc); @@ -606,7 +606,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD LocationMarkerMap location_markers; void update_marker_labels (); - void update_marker_labels (ArdourCanvas::Group *); + void update_marker_labels (ArdourCanvas::Layout *); void check_marker_label (Marker *); /** A set of lists of Markers that are in each of the canvas groups @@ -615,7 +615,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD * a marker has moved we can decide whether we need to update the labels * for all markers or for just a few. */ - std::map > _sorted_marker_lists; + std::map > _sorted_marker_lists; void remove_sorted_marker (Marker *); void hide_marker (ArdourCanvas::Item*, GdkEvent*); @@ -729,42 +729,42 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD ArdourCanvas::Pixbuf *logo_item; #if 0 /* these will be needed when we have canvas rulers */ - ArdourCanvas::Group *minsec_group; - ArdourCanvas::Group *bbt_group; - ArdourCanvas::Group *timecode_group; - ArdourCanvas::Group *frame_group; + ArdourCanvas::Layout *minsec_group; + ArdourCanvas::Layout *bbt_group; + ArdourCanvas::Layout *timecode_group; + ArdourCanvas::Layout *frame_group; #endif - ArdourCanvas::Group *tempo_group; - ArdourCanvas::Group *meter_group; - ArdourCanvas::Group *marker_group; - ArdourCanvas::Group *range_marker_group; - ArdourCanvas::Group *transport_marker_group; - ArdourCanvas::Group* cd_marker_group; + ArdourCanvas::Layout *tempo_group; + ArdourCanvas::Layout *meter_group; + ArdourCanvas::Layout *marker_group; + ArdourCanvas::Layout *range_marker_group; + ArdourCanvas::Layout *transport_marker_group; + ArdourCanvas::Layout* cd_marker_group; /* parent for groups which themselves contain time markers */ - ArdourCanvas::Group* _time_markers_group; + ArdourCanvas::Layout* _time_markers_group; /* The group containing all other groups that are scrolled vertically and horizontally. */ - ArdourCanvas::Group* hv_scroll_group; + ArdourCanvas::ScrollGroup* hv_scroll_group; /* The group containing all other groups that are scrolled vertically ONLY */ - ArdourCanvas::Group* v_scroll_group; + ArdourCanvas::ScrollGroup* v_scroll_group; /* The group containing all other groups that are scrolled horizontally ONLY */ - ArdourCanvas::Group* h_scroll_group; + ArdourCanvas::ScrollGroup* h_scroll_group; /* The group containing all trackviews. */ - ArdourCanvas::Group* _trackview_group; + ArdourCanvas::Layout* _trackview_group; /* The group holding things (mostly regions) while dragging so they * are on top of everything else */ - ArdourCanvas::Group* _drag_motion_group; + ArdourCanvas::Layout* _drag_motion_group; /* a rect that sits at the bottom of all tracks to act as a drag-no-drop/clickable * target area. @@ -898,7 +898,7 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD /* videtimline related actions */ Gtk::Label videotl_label; - ArdourCanvas::Group* videotl_group; + ArdourCanvas::Layout* videotl_group; Glib::RefPtr ruler_video_action; Glib::RefPtr xjadeo_proc_action; Glib::RefPtr xjadeo_ontop_action; @@ -1478,8 +1478,8 @@ class Editor : public PublicEditor, public PBD::ScopedConnectionList, public ARD TempoLines* tempo_lines; - ArdourCanvas::Group* global_rect_group; - ArdourCanvas::Group* time_line_group; + ArdourCanvas::Layout* global_rect_group; + ArdourCanvas::Layout* time_line_group; void hide_measures (); void draw_measures (ARDOUR::TempoMap::BBTPointList::const_iterator& begin, diff --git a/gtk2_ardour/editor_canvas.cc b/gtk2_ardour/editor_canvas.cc index ed30d4b364..ce20b841ad 100644 --- a/gtk2_ardour/editor_canvas.cc +++ b/gtk2_ardour/editor_canvas.cc @@ -101,7 +101,7 @@ Editor::initialize_canvas () } /*a group to hold global rects like punch/loop indicators */ - global_rect_group = new ArdourCanvas::Group (hv_scroll_group); + global_rect_group = new ArdourCanvas::Layout (hv_scroll_group); CANVAS_DEBUG_NAME (global_rect_group, "global rect group"); transport_loop_range_rect = new ArdourCanvas::Rectangle (global_rect_group, ArdourCanvas::Rect (0.0, 0.0, 0.0, ArdourCanvas::COORD_MAX)); @@ -113,10 +113,10 @@ Editor::initialize_canvas () transport_punch_range_rect->hide(); /*a group to hold time (measure) lines */ - time_line_group = new ArdourCanvas::Group (hv_scroll_group); + time_line_group = new ArdourCanvas::Layout (hv_scroll_group); CANVAS_DEBUG_NAME (time_line_group, "time line group"); - _trackview_group = new ArdourCanvas::Group (hv_scroll_group); + _trackview_group = new ArdourCanvas::Layout (hv_scroll_group); CANVAS_DEBUG_NAME (_trackview_group, "Canvas TrackViews"); // used to show zoom mode active zooming @@ -131,30 +131,30 @@ Editor::initialize_canvas () /* a group to hold stuff while it gets dragged around. Must be the * uppermost (last) group with hv_scroll_group as a parent */ - _drag_motion_group = new ArdourCanvas::Group (hv_scroll_group); + _drag_motion_group = new ArdourCanvas::Layout (hv_scroll_group); CANVAS_DEBUG_NAME (_drag_motion_group, "Canvas Drag Motion"); /* TIME BAR CANVAS */ - _time_markers_group = new ArdourCanvas::Group (h_scroll_group); + _time_markers_group = new ArdourCanvas::Layout (h_scroll_group); CANVAS_DEBUG_NAME (_time_markers_group, "time bars"); - cd_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, 0.0)); + cd_marker_group = new ArdourCanvas::Layout (_time_markers_group, ArdourCanvas::Duple (0.0, 0.0)); CANVAS_DEBUG_NAME (cd_marker_group, "cd marker group"); /* the vide is temporarily placed a the same location as the cd_marker_group, but is moved later. */ - videotl_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple(0.0, 0.0)); + videotl_group = new ArdourCanvas::Layout (_time_markers_group, ArdourCanvas::Duple(0.0, 0.0)); CANVAS_DEBUG_NAME (videotl_group, "videotl group"); - marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height + 1.0)); + marker_group = new ArdourCanvas::Layout (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height + 1.0)); CANVAS_DEBUG_NAME (marker_group, "marker group"); - transport_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 2.0) + 1.0)); + transport_marker_group = new ArdourCanvas::Layout (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 2.0) + 1.0)); CANVAS_DEBUG_NAME (transport_marker_group, "transport marker group"); - range_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 3.0) + 1.0)); + range_marker_group = new ArdourCanvas::Layout (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 3.0) + 1.0)); CANVAS_DEBUG_NAME (range_marker_group, "range marker group"); - tempo_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 4.0) + 1.0)); + tempo_group = new ArdourCanvas::Layout (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 4.0) + 1.0)); CANVAS_DEBUG_NAME (tempo_group, "tempo group"); - meter_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 5.0) + 1.0)); + meter_group = new ArdourCanvas::Layout (_time_markers_group, ArdourCanvas::Duple (0.0, (timebar_height * 5.0) + 1.0)); CANVAS_DEBUG_NAME (meter_group, "meter group"); meter_bar = new ArdourCanvas::Rectangle (meter_group, ArdourCanvas::Rect (0.0, 0.0, ArdourCanvas::COORD_MAX, timebar_height)); diff --git a/gtk2_ardour/editor_cursors.cc b/gtk2_ardour/editor_cursors.cc index a820b5fc1f..dd9970c730 100644 --- a/gtk2_ardour/editor_cursors.cc +++ b/gtk2_ardour/editor_cursors.cc @@ -22,6 +22,7 @@ #include "canvas/canvas.h" #include "canvas/debug.h" +#include "canvas/scroll_group.h" #include "utils.h" #include "editor_cursors.h" diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index fb983f33f6..4019eb24c2 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -736,8 +736,8 @@ RegionMotionDrag::motion (GdkEvent* event, bool first_move) /* reparent the regionview into a group above all * others */ - - ArdourCanvas::Group* rvg = rv->get_canvas_group(); + + ArdourCanvas::Item* rvg = rv->get_canvas_group(); Duple rv_canvas_offset = rvg->parent()->canvas_origin (); Duple dmg_canvas_offset = _editor->_drag_motion_group->canvas_origin (); rv->get_canvas_group()->reparent (_editor->_drag_motion_group); diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 371feaff58..66edefc211 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -64,7 +64,7 @@ Editor::add_new_location (Location *location) { ENSURE_GUI_THREAD (*this, &Editor::add_new_location, location); - ArdourCanvas::Group* group = add_new_location_internal (location); + ArdourCanvas::Layout* group = add_new_location_internal (location); /* Do a full update of the markers in this group */ update_marker_labels (group); @@ -82,14 +82,14 @@ Editor::add_new_location (Location *location) * the caller must call update_marker_labels () after calling this. * @return canvas group that the location's marker was added to. */ -ArdourCanvas::Group* +ArdourCanvas::Layout* Editor::add_new_location_internal (Location* location) { LocationMarkers *lam = new LocationMarkers; uint32_t color; /* make a note here of which group this marker ends up in */ - ArdourCanvas::Group* group = 0; + ArdourCanvas::Layout* group = 0; if (location->is_cd_marker()) { color = location_cd_marker_color; @@ -311,14 +311,14 @@ struct MarkerComparator { void Editor::update_marker_labels () { - for (std::map >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) { + for (std::map >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) { update_marker_labels (i->first); } } /** Look at all markers in a group and update label widths */ void -Editor::update_marker_labels (ArdourCanvas::Group* group) +Editor::update_marker_labels (ArdourCanvas::Layout* group) { list& sorted = _sorted_marker_lists[group]; @@ -1576,7 +1576,7 @@ Editor::toggle_marker_lines () void Editor::remove_sorted_marker (Marker* m) { - for (std::map >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) { + for (std::map >::iterator i = _sorted_marker_lists.begin(); i != _sorted_marker_lists.end(); ++i) { i->second.remove (m); } } diff --git a/gtk2_ardour/editor_rulers.cc b/gtk2_ardour/editor_rulers.cc index 01a6940cea..7b9a2a495b 100644 --- a/gtk2_ardour/editor_rulers.cc +++ b/gtk2_ardour/editor_rulers.cc @@ -29,10 +29,11 @@ #include -#include "canvas/group.h" +#include "canvas/layout.h" #include "canvas/canvas.h" #include "canvas/ruler.h" #include "canvas/debug.h" +#include "canvas/scroll_group.h" #include "ardour/session.h" #include "ardour/tempo.h" diff --git a/gtk2_ardour/ghostregion.cc b/gtk2_ardour/ghostregion.cc index da2beeeca7..4c3e904c72 100644 --- a/gtk2_ardour/ghostregion.cc +++ b/gtk2_ardour/ghostregion.cc @@ -18,7 +18,7 @@ */ #include "evoral/Note.hpp" -#include "canvas/group.h" +#include "canvas/layout.h" #include "canvas/rectangle.h" #include "canvas/wave_view.h" #include "canvas/debug.h" @@ -38,11 +38,11 @@ using namespace ARDOUR; PBD::Signal1 GhostRegion::CatchDeletion; -GhostRegion::GhostRegion (ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_pos) +GhostRegion::GhostRegion (ArdourCanvas::Layout* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_pos) : trackview (tv) , source_trackview (source_tv) { - group = new ArdourCanvas::Group (parent); + group = new ArdourCanvas::Layout (parent); CANVAS_DEBUG_NAME (group, "ghost region"); group->set_position (ArdourCanvas::Duple (initial_pos, 0)); @@ -191,7 +191,7 @@ MidiGhostRegion::~MidiGhostRegion() clear_events (); } -MidiGhostRegion::GhostEvent::GhostEvent (NoteBase* e, ArdourCanvas::Group* g) +MidiGhostRegion::GhostEvent::GhostEvent (NoteBase* e, ArdourCanvas::Layout* g) : event (e) { rect = new ArdourCanvas::Rectangle (g, ArdourCanvas::Rect (e->x0(), e->y0(), e->x1(), e->y1())); diff --git a/gtk2_ardour/ghostregion.h b/gtk2_ardour/ghostregion.h index e8271a8ad8..851c5502f8 100644 --- a/gtk2_ardour/ghostregion.h +++ b/gtk2_ardour/ghostregion.h @@ -36,7 +36,7 @@ class TimeAxisView; class GhostRegion : public sigc::trackable { public: - GhostRegion(ArdourCanvas::Group* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); + GhostRegion(ArdourCanvas::Layout* parent, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos); virtual ~GhostRegion(); virtual void set_samples_per_pixel (double) = 0; @@ -52,7 +52,7 @@ public: TimeAxisView& trackview; /** TimeAxisView that we are a ghost for */ TimeAxisView& source_trackview; - ArdourCanvas::Group* group; + ArdourCanvas::Layout* group; ArdourCanvas::Rectangle* base_rect; static PBD::Signal1 CatchDeletion; @@ -73,7 +73,7 @@ class MidiGhostRegion : public GhostRegion { public: class GhostEvent : public sigc::trackable { public: - GhostEvent(::NoteBase *, ArdourCanvas::Group *); + GhostEvent(::NoteBase *, ArdourCanvas::Layout *); virtual ~GhostEvent (); NoteBase* event; diff --git a/gtk2_ardour/hit.cc b/gtk2_ardour/hit.cc index 69dd8d5bc8..c06160f3b2 100644 --- a/gtk2_ardour/hit.cc +++ b/gtk2_ardour/hit.cc @@ -30,10 +30,10 @@ using namespace ARDOUR; using namespace ArdourCanvas; -Hit::Hit (MidiRegionView& region, Group* group, double size, const boost::shared_ptr note, bool with_events) +Hit::Hit (MidiRegionView& region, Item* parent, double size, const boost::shared_ptr note, bool with_events) : NoteBase (region, with_events, note) { - _polygon = new ArdourCanvas::Polygon (group); + _polygon = new ArdourCanvas::Polygon (parent); CANVAS_DEBUG_NAME (_polygon, "note"); set_item (_polygon); set_height (size); diff --git a/gtk2_ardour/hit.h b/gtk2_ardour/hit.h index 0a02501606..5a6cef9943 100644 --- a/gtk2_ardour/hit.h +++ b/gtk2_ardour/hit.h @@ -33,7 +33,7 @@ public: typedef Evoral::Note NoteType; Hit (MidiRegionView& region, - ArdourCanvas::Group* group, + ArdourCanvas::Item* parent, double size, const boost::shared_ptr note = boost::shared_ptr(), bool with_events = true); diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc index ed24f20e84..ea47929db7 100644 --- a/gtk2_ardour/marker.cc +++ b/gtk2_ardour/marker.cc @@ -21,11 +21,12 @@ #include "ardour/tempo.h" #include "canvas/rectangle.h" -#include "canvas/group.h" +#include "canvas/layout.h" #include "canvas/line.h" #include "canvas/polygon.h" #include "canvas/text.h" #include "canvas/canvas.h" +#include "canvas/scroll_group.h" #include "canvas/debug.h" #include "ardour_ui.h" @@ -52,7 +53,7 @@ PBD::Signal1 Marker::CatchDeletion; static const double marker_height = 13.0; -Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, const string& annotation, +Marker::Marker (PublicEditor& ed, ArdourCanvas::Layout& parent, guint32 rgba, const string& annotation, Type type, framepos_t frame, bool handle_events) : editor (ed) @@ -241,7 +242,7 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con unit_position = editor.sample_to_pixel (frame); unit_position -= _shift; - group = new ArdourCanvas::Group (&parent, ArdourCanvas::Duple (unit_position, 0)); + group = new ArdourCanvas::Layout (&parent, ArdourCanvas::Duple (unit_position, 0)); #ifdef CANVAS_DEBUG group->name = string_compose ("Marker::group for %1", annotation); #endif @@ -301,7 +302,7 @@ Marker::~Marker () delete _track_canvas_line; } -void Marker::reparent(ArdourCanvas::Group & parent) +void Marker::reparent(ArdourCanvas::Layout & parent) { group->reparent (&parent); _parent = &parent; @@ -500,7 +501,7 @@ Marker::set_right_label_limit (double p) /***********************************************************************/ -TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, +TempoMarker::TempoMarker (PublicEditor& editor, ArdourCanvas::Layout& parent, guint32 rgba, const string& text, ARDOUR::TempoSection& temp) : Marker (editor, parent, rgba, text, Tempo, 0, false), _tempo (temp) @@ -515,7 +516,7 @@ TempoMarker::~TempoMarker () /***********************************************************************/ -MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Group& parent, guint32 rgba, const string& text, +MeterMarker::MeterMarker (PublicEditor& editor, ArdourCanvas::Layout& parent, guint32 rgba, const string& text, ARDOUR::MeterSection& m) : Marker (editor, parent, rgba, text, Meter, 0, false), _meter (m) diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h index 727f4bee18..facaaffb09 100644 --- a/gtk2_ardour/marker.h +++ b/gtk2_ardour/marker.h @@ -56,7 +56,7 @@ class Marker : public sigc::trackable }; - Marker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, Type, + Marker (PublicEditor& editor, ArdourCanvas::Layout &, guint32 rgba, const std::string& text, Type, framepos_t frame = 0, bool handle_events = true); virtual ~Marker (); @@ -76,8 +76,8 @@ class Marker : public sigc::trackable framepos_t position() const { return frame_position; } - ArdourCanvas::Group * get_parent() { return _parent; } - void reparent (ArdourCanvas::Group & parent); + ArdourCanvas::Layout * get_parent() { return _parent; } + void reparent (ArdourCanvas::Layout & parent); void hide (); void show (); @@ -98,8 +98,8 @@ class Marker : public sigc::trackable Pango::FontDescription name_font; - ArdourCanvas::Group* _parent; - ArdourCanvas::Group *group; + ArdourCanvas::Layout* _parent; + ArdourCanvas::Layout *group; ArdourCanvas::Polygon *mark; ArdourCanvas::Text *_name_item; ArdourCanvas::Points *points; @@ -134,7 +134,7 @@ private: class TempoMarker : public Marker { public: - TempoMarker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, ARDOUR::TempoSection&); + TempoMarker (PublicEditor& editor, ArdourCanvas::Layout &, guint32 rgba, const std::string& text, ARDOUR::TempoSection&); ~TempoMarker (); ARDOUR::TempoSection& tempo() const { return _tempo; } @@ -146,7 +146,7 @@ class TempoMarker : public Marker class MeterMarker : public Marker { public: - MeterMarker (PublicEditor& editor, ArdourCanvas::Group &, guint32 rgba, const std::string& text, ARDOUR::MeterSection&); + MeterMarker (PublicEditor& editor, ArdourCanvas::Layout &, guint32 rgba, const std::string& text, ARDOUR::MeterSection&); ~MeterMarker (); ARDOUR::MeterSection& meter() const { return _meter; } diff --git a/gtk2_ardour/midi_automation_line.cc b/gtk2_ardour/midi_automation_line.cc index 971944266f..e5f30493d7 100644 --- a/gtk2_ardour/midi_automation_line.cc +++ b/gtk2_ardour/midi_automation_line.cc @@ -29,12 +29,12 @@ using namespace std; MidiAutomationLine::MidiAutomationLine ( const std::string& name, TimeAxisView& tav, - ArdourCanvas::Group& group, + ArdourCanvas::Item& parent, boost::shared_ptr list, boost::shared_ptr region, Evoral::Parameter parameter, Evoral::TimeConverter* converter) - : AutomationLine (name, tav, group, list, converter) + : AutomationLine (name, tav, parent, list, converter) , _region (region) , _parameter (parameter) { diff --git a/gtk2_ardour/midi_automation_line.h b/gtk2_ardour/midi_automation_line.h index df4db06c2c..3748c35bd4 100644 --- a/gtk2_ardour/midi_automation_line.h +++ b/gtk2_ardour/midi_automation_line.h @@ -26,7 +26,7 @@ class MidiAutomationLine : public AutomationLine { public: - MidiAutomationLine (const std::string&, TimeAxisView&, ArdourCanvas::Group&, + MidiAutomationLine (const std::string&, TimeAxisView&, ArdourCanvas::Item&, boost::shared_ptr, boost::shared_ptr, Evoral::Parameter, diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc index db3f4760bc..b20727889a 100644 --- a/gtk2_ardour/midi_region_view.cc +++ b/gtk2_ardour/midi_region_view.cc @@ -88,13 +88,13 @@ PBD::Signal1 MidiRegionView::SelectionCleared; #define MIDI_BP_ZERO ((Config->get_first_midi_bank_is_zero())?0:1) -MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, +MidiRegionView::MidiRegionView (ArdourCanvas::Layout *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, uint32_t basic_color) : RegionView (parent, tv, r, spu, basic_color) , _current_range_min(0) , _current_range_max(0) , _active_notes(0) - , _note_group (new ArdourCanvas::Group (group)) + , _note_group (new ArdourCanvas::Layout (group)) , _note_diff_command (0) , _ghost_note(0) , _step_edit_cursor (0) @@ -124,14 +124,14 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView & SelectionCleared.connect (_selection_cleared_connection, invalidator (*this), boost::bind (&MidiRegionView::selection_cleared, this, _1), gui_context ()); } -MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, +MidiRegionView::MidiRegionView (ArdourCanvas::Layout *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, uint32_t basic_color, TimeAxisViewItem::Visibility visibility) : RegionView (parent, tv, r, spu, basic_color, false, visibility) , _current_range_min(0) , _current_range_max(0) , _active_notes(0) - , _note_group (new ArdourCanvas::Group (parent)) + , _note_group (new ArdourCanvas::Layout (parent)) , _note_diff_command (0) , _ghost_note(0) , _step_edit_cursor (0) @@ -177,7 +177,7 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other) , _current_range_min(0) , _current_range_max(0) , _active_notes(0) - , _note_group (new ArdourCanvas::Group (get_canvas_group())) + , _note_group (new ArdourCanvas::Layout (get_canvas_group())) , _note_diff_command (0) , _ghost_note(0) , _step_edit_cursor (0) @@ -205,7 +205,7 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptrset_y0 (0); @@ -3725,7 +3725,7 @@ MidiRegionView::trim_front_starting () /* Reparent the note group to the region view's parent, so that it doesn't change when the region view is trimmed. */ - _temporary_note_group = new ArdourCanvas::Group (group->parent ()); + _temporary_note_group = new ArdourCanvas::Layout (group->parent ()); _temporary_note_group->move (group->position ()); _note_group->reparent (_temporary_note_group); } diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h index 0f4dd52ff4..213d97795e 100644 --- a/gtk2_ardour/midi_region_view.h +++ b/gtk2_ardour/midi_region_view.h @@ -67,7 +67,7 @@ public: typedef Evoral::Note NoteType; typedef Evoral::Sequence::Notes Notes; - MidiRegionView (ArdourCanvas::Group *, + MidiRegionView (ArdourCanvas::Layout *, RouteTimeAxisView&, boost::shared_ptr, double initial_samples_per_pixel, @@ -309,7 +309,7 @@ protected: /** Allows derived types to specify their visibility requirements * to the TimeAxisViewItem parent class. */ - MidiRegionView (ArdourCanvas::Group *, + MidiRegionView (ArdourCanvas::Layout *, RouteTimeAxisView&, boost::shared_ptr, double samples_per_pixel, @@ -387,7 +387,7 @@ private: PatchChanges _patch_changes; SysExes _sys_exes; Note** _active_notes; - ArdourCanvas::Group* _note_group; + ArdourCanvas::Layout* _note_group; ARDOUR::MidiModel::NoteDiffCommand* _note_diff_command; Note* _ghost_note; double _last_ghost_x; @@ -401,7 +401,7 @@ private: /** A group used to temporarily reparent _note_group to during start trims, so * that the notes don't move with the parent region view. */ - ArdourCanvas::Group* _temporary_note_group; + ArdourCanvas::Layout* _temporary_note_group; MouseState _mouse_state; int _pressed_button; diff --git a/gtk2_ardour/midi_streamview.cc b/gtk2_ardour/midi_streamview.cc index b8bd0c257b..b687020e3d 100644 --- a/gtk2_ardour/midi_streamview.cc +++ b/gtk2_ardour/midi_streamview.cc @@ -68,7 +68,7 @@ MidiStreamView::MidiStreamView (MidiTimeAxisView& tv) , _updates_suspended (false) { /* use a group dedicated to MIDI underlays. Audio underlays are not in this group. */ - midi_underlay_group = new ArdourCanvas::Group (_canvas_group); + midi_underlay_group = new ArdourCanvas::Layout (_canvas_group); midi_underlay_group->lower_to_bottom(); /* put the note lines in the timeaxisview's group, so it diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h index b3506d4224..6cd9d10e21 100644 --- a/gtk2_ardour/midi_streamview.h +++ b/gtk2_ardour/midi_streamview.h @@ -68,7 +68,7 @@ class MidiStreamView : public StreamView }; Gtk::Adjustment note_range_adjustment; - ArdourCanvas::Group* midi_underlay_group; + ArdourCanvas::Layout* midi_underlay_group; void set_note_range(VisibleNoteRange r); diff --git a/gtk2_ardour/note.cc b/gtk2_ardour/note.cc index 3adcd751f8..dc8decf837 100644 --- a/gtk2_ardour/note.cc +++ b/gtk2_ardour/note.cc @@ -31,9 +31,9 @@ using namespace ARDOUR; using namespace ArdourCanvas; Note::Note ( - MidiRegionView& region, Group* group, const boost::shared_ptr note, bool with_events) + MidiRegionView& region, Item* parent, const boost::shared_ptr note, bool with_events) : NoteBase (region, with_events, note) - , _rectangle (new ArdourCanvas::Rectangle (group)) + , _rectangle (new ArdourCanvas::Rectangle (parent)) { CANVAS_DEBUG_NAME (_rectangle, "note"); set_item (_rectangle); diff --git a/gtk2_ardour/note.h b/gtk2_ardour/note.h index c6bcd957e3..944dbf1b2e 100644 --- a/gtk2_ardour/note.h +++ b/gtk2_ardour/note.h @@ -26,7 +26,7 @@ #include "midi_util.h" namespace ArdourCanvas { - class Group; + class Layout; } class Note : public NoteBase @@ -35,7 +35,7 @@ public: typedef Evoral::Note NoteType; Note (MidiRegionView& region, - ArdourCanvas::Group* group, + ArdourCanvas::Item* parent, const boost::shared_ptr note = boost::shared_ptr(), bool with_events = true); diff --git a/gtk2_ardour/patch_change.cc b/gtk2_ardour/patch_change.cc index 6be40811bf..a029563f0f 100644 --- a/gtk2_ardour/patch_change.cc +++ b/gtk2_ardour/patch_change.cc @@ -43,7 +43,7 @@ using namespace std; */ PatchChange::PatchChange( MidiRegionView& region, - ArdourCanvas::Group* parent, + ArdourCanvas::Layout* parent, const string& text, double height, double x, diff --git a/gtk2_ardour/patch_change.h b/gtk2_ardour/patch_change.h index 652f9d66c1..ed1f4aadf4 100644 --- a/gtk2_ardour/patch_change.h +++ b/gtk2_ardour/patch_change.h @@ -35,7 +35,7 @@ class PatchChange public: PatchChange( MidiRegionView& region, - ArdourCanvas::Group* parent, + ArdourCanvas::Layout* parent, const string& text, double height, double x, diff --git a/gtk2_ardour/public_editor.h b/gtk2_ardour/public_editor.h index a0f5e74ef9..86e9e16cdd 100644 --- a/gtk2_ardour/public_editor.h +++ b/gtk2_ardour/public_editor.h @@ -365,10 +365,10 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible, publi virtual Gtk::HBox& get_status_bar_packer() = 0; #endif - virtual ArdourCanvas::Group* get_trackview_group () const = 0; - virtual ArdourCanvas::Group* get_hscroll_group () const = 0; - virtual ArdourCanvas::Group* get_vscroll_group () const = 0; - virtual ArdourCanvas::Group* get_hvscroll_group () const = 0; + virtual ArdourCanvas::Layout* get_trackview_group () const = 0; + virtual ArdourCanvas::ScrollGroup* get_hscroll_group () const = 0; + virtual ArdourCanvas::ScrollGroup* get_vscroll_group () const = 0; + virtual ArdourCanvas::ScrollGroup* get_hvscroll_group () const = 0; virtual ArdourCanvas::GtkCanvasViewport* get_track_canvas() const = 0; diff --git a/gtk2_ardour/region_gain_line.cc b/gtk2_ardour/region_gain_line.cc index 827ebde12d..d0fd762e24 100644 --- a/gtk2_ardour/region_gain_line.cc +++ b/gtk2_ardour/region_gain_line.cc @@ -38,7 +38,7 @@ using namespace std; using namespace ARDOUR; using namespace PBD; -AudioRegionGainLine::AudioRegionGainLine (const string & name, AudioRegionView& r, ArdourCanvas::Group& parent, boost::shared_ptr l) +AudioRegionGainLine::AudioRegionGainLine (const string & name, AudioRegionView& r, ArdourCanvas::Layout& parent, boost::shared_ptr l) : AutomationLine (name, r.get_time_axis_view(), parent, l) , rv (r) { diff --git a/gtk2_ardour/region_gain_line.h b/gtk2_ardour/region_gain_line.h index 1eae91bc27..998f3b3cf2 100644 --- a/gtk2_ardour/region_gain_line.h +++ b/gtk2_ardour/region_gain_line.h @@ -35,7 +35,7 @@ class AudioRegionView; class AudioRegionGainLine : public AutomationLine { public: - AudioRegionGainLine (const std::string & name, AudioRegionView&, ArdourCanvas::Group& parent, boost::shared_ptr); + AudioRegionGainLine (const std::string & name, AudioRegionView&, ArdourCanvas::Layout& parent, boost::shared_ptr); void start_drag_single (ControlPoint*, double, float); void end_drag (bool with_push, uint32_t final_index); diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index aee25b2e01..4a732b6360 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -63,7 +63,7 @@ static const int32_t sync_mark_width = 9; PBD::Signal1 RegionView::RegionViewGoingAway; -RegionView::RegionView (ArdourCanvas::Group* parent, +RegionView::RegionView (ArdourCanvas::Layout* parent, TimeAxisView& tv, boost::shared_ptr r, double spu, @@ -128,7 +128,7 @@ RegionView::RegionView (const RegionView& other, boost::shared_ptr other GhostRegion::CatchDeletion.connect (*this, invalidator (*this), boost::bind (&RegionView::remove_ghost, this, _1), gui_context()); } -RegionView::RegionView (ArdourCanvas::Group* parent, +RegionView::RegionView (ArdourCanvas::Layout* parent, TimeAxisView& tv, boost::shared_ptr r, double spu, diff --git a/gtk2_ardour/region_view.h b/gtk2_ardour/region_view.h index e3bc1e6cbf..1c34d29360 100644 --- a/gtk2_ardour/region_view.h +++ b/gtk2_ardour/region_view.h @@ -49,7 +49,7 @@ namespace ArdourCanvas { class RegionView : public TimeAxisViewItem { public: - RegionView (ArdourCanvas::Group* parent, + RegionView (ArdourCanvas::Layout* parent, TimeAxisView& time_view, boost::shared_ptr region, double samples_per_pixel, @@ -128,7 +128,7 @@ class RegionView : public TimeAxisViewItem /** Allows derived types to specify their visibility requirements * to the TimeAxisViewItem parent class */ - RegionView (ArdourCanvas::Group *, + RegionView (ArdourCanvas::Layout *, TimeAxisView&, boost::shared_ptr, double samples_per_pixel, diff --git a/gtk2_ardour/streamview.cc b/gtk2_ardour/streamview.cc index 97e3d3aa79..15facc3adf 100644 --- a/gtk2_ardour/streamview.cc +++ b/gtk2_ardour/streamview.cc @@ -52,9 +52,9 @@ using namespace ARDOUR; using namespace PBD; using namespace Editing; -StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Group* canvas_group) +StreamView::StreamView (RouteTimeAxisView& tv, ArdourCanvas::Layout* canvas_group) : _trackview (tv) - , _canvas_group (canvas_group ? canvas_group : new ArdourCanvas::Group (_trackview.canvas_display())) + , _canvas_group (canvas_group ? canvas_group : new ArdourCanvas::Layout (_trackview.canvas_display())) , _samples_per_pixel (_trackview.editor().get_current_zoom ()) , rec_updating(false) , rec_active(false) diff --git a/gtk2_ardour/streamview.h b/gtk2_ardour/streamview.h index e0d60baf34..7c7bbad924 100644 --- a/gtk2_ardour/streamview.h +++ b/gtk2_ardour/streamview.h @@ -42,7 +42,7 @@ namespace ARDOUR { namespace ArdourCanvas { class Rectangle; - class Group; + class Layout; } struct RecBoxInfo { @@ -82,7 +82,7 @@ public: void set_layer_display (LayerDisplay); LayerDisplay layer_display () const { return _layer_display; } - ArdourCanvas::Group* canvas_item() { return _canvas_group; } + ArdourCanvas::Layout* canvas_item() { return _canvas_group; } enum ColorTarget { RegionColor, @@ -128,7 +128,7 @@ public: sigc::signal ContentsHeightChanged; protected: - StreamView (RouteTimeAxisView&, ArdourCanvas::Group* canvas_group = 0); + StreamView (RouteTimeAxisView&, ArdourCanvas::Layout* canvas_group = 0); void transport_changed(); void transport_looped(); @@ -151,7 +151,7 @@ protected: virtual void color_handler () = 0; RouteTimeAxisView& _trackview; - ArdourCanvas::Group* _canvas_group; + ArdourCanvas::Layout* _canvas_group; ArdourCanvas::Rectangle* canvas_rect; /* frame around the whole thing */ typedef std::list RegionViewList; diff --git a/gtk2_ardour/sys_ex.cc b/gtk2_ardour/sys_ex.cc index 2097de4fa9..103df599ec 100644 --- a/gtk2_ardour/sys_ex.cc +++ b/gtk2_ardour/sys_ex.cc @@ -26,7 +26,7 @@ using namespace std; SysEx::SysEx ( MidiRegionView& region, - ArdourCanvas::Group* parent, + ArdourCanvas::Layout* parent, string& text, double height, double x, diff --git a/gtk2_ardour/sys_ex.h b/gtk2_ardour/sys_ex.h index 1d6787a75e..281731e863 100644 --- a/gtk2_ardour/sys_ex.h +++ b/gtk2_ardour/sys_ex.h @@ -31,7 +31,7 @@ class SysEx public: SysEx ( MidiRegionView& region, - ArdourCanvas::Group* parent, + ArdourCanvas::Layout* parent, std::string& text, double height, double x, diff --git a/gtk2_ardour/tape_region_view.cc b/gtk2_ardour/tape_region_view.cc index 62d37a9f7e..6de7b65327 100644 --- a/gtk2_ardour/tape_region_view.cc +++ b/gtk2_ardour/tape_region_view.cc @@ -46,7 +46,7 @@ const TimeAxisViewItem::Visibility TapeAudioRegionView::default_tape_visibility TimeAxisViewItem::HideFrameRight | TimeAxisViewItem::FullWidthNameHighlight); -TapeAudioRegionView::TapeAudioRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv, +TapeAudioRegionView::TapeAudioRegionView (ArdourCanvas::Layout *parent, RouteTimeAxisView &tv, boost::shared_ptr r, double spu, uint32_t basic_color) diff --git a/gtk2_ardour/tape_region_view.h b/gtk2_ardour/tape_region_view.h index bda41ca8ad..4729328625 100644 --- a/gtk2_ardour/tape_region_view.h +++ b/gtk2_ardour/tape_region_view.h @@ -27,7 +27,7 @@ class TapeAudioRegionView : public AudioRegionView { public: - TapeAudioRegionView (ArdourCanvas::Group *, + TapeAudioRegionView (ArdourCanvas::Layout *, RouteTimeAxisView&, boost::shared_ptr, double initial_samples_per_pixel, diff --git a/gtk2_ardour/tempo_lines.cc b/gtk2_ardour/tempo_lines.cc index c2f7df1c42..b9686821f8 100644 --- a/gtk2_ardour/tempo_lines.cc +++ b/gtk2_ardour/tempo_lines.cc @@ -28,7 +28,7 @@ using namespace std; -TempoLines::TempoLines (ArdourCanvas::Group* group, double) +TempoLines::TempoLines (ArdourCanvas::Layout* group, double) : lines (group, ArdourCanvas::LineSet::Vertical) { lines.set_extent (ArdourCanvas::COORD_MAX); diff --git a/gtk2_ardour/tempo_lines.h b/gtk2_ardour/tempo_lines.h index e096df54af..8b64885667 100644 --- a/gtk2_ardour/tempo_lines.h +++ b/gtk2_ardour/tempo_lines.h @@ -25,7 +25,7 @@ class TempoLines { public: - TempoLines (ArdourCanvas::Group* group, double screen_height); + TempoLines (ArdourCanvas::Layout* group, double screen_height); void tempo_map_changed(); diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc index cbd4e32cc6..3478297e58 100644 --- a/gtk2_ardour/time_axis_view.cc +++ b/gtk2_ardour/time_axis_view.cc @@ -97,16 +97,16 @@ TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisVie compute_heights (); } - _canvas_display = new Group (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0)); + _canvas_display = new ArdourCanvas::Layout (ed.get_trackview_group (), ArdourCanvas::Duple (0.0, 0.0)); CANVAS_DEBUG_NAME (_canvas_display, "main for TAV"); _canvas_display->hide(); // reveal as needed - selection_group = new Group (_canvas_display); + selection_group = new ArdourCanvas::Layout (_canvas_display); CANVAS_DEBUG_NAME (selection_group, "selection for TAV"); selection_group->set_data (X_("timeselection"), (void *) 1); selection_group->hide(); - _ghost_group = new Group (_canvas_display); + _ghost_group = new ArdourCanvas::Layout (_canvas_display); CANVAS_DEBUG_NAME (_ghost_group, "ghost for TAV"); _ghost_group->lower_to_bottom(); _ghost_group->show(); diff --git a/gtk2_ardour/time_axis_view.h b/gtk2_ardour/time_axis_view.h index 38626a080d..cddf9f9e29 100644 --- a/gtk2_ardour/time_axis_view.h +++ b/gtk2_ardour/time_axis_view.h @@ -59,7 +59,7 @@ namespace Gtk { namespace ArdourCanvas { class Canvas; - class Group; + class Layout; class Item; } @@ -104,8 +104,8 @@ class TimeAxisView : public virtual AxisView virtual void enter_internal_edit_mode () {} virtual void leave_internal_edit_mode () {} - ArdourCanvas::Group* canvas_display () { return _canvas_display; } - ArdourCanvas::Group* ghost_group () { return _ghost_group; } + ArdourCanvas::Layout* canvas_display () { return _canvas_display; } + ArdourCanvas::Layout* ghost_group () { return _ghost_group; } /** @return effective height (taking children into account) in canvas units, or 0 if this TimeAxisView has not yet been shown */ @@ -212,15 +212,15 @@ class TimeAxisView : public virtual AxisView std::string controls_base_selected_name; Gtk::Menu* display_menu; /* The standard LHS Track control popup-menus */ TimeAxisView* parent; - ArdourCanvas::Group* selection_group; - ArdourCanvas::Group* _ghost_group; + ArdourCanvas::Layout* selection_group; + ArdourCanvas::Layout* _ghost_group; std::list ghosts; std::list free_selection_rects; std::list used_selection_rects; bool _hidden; bool in_destructor; Gtk::Menu* _size_menu; - ArdourCanvas::Group* _canvas_display; + ArdourCanvas::Layout* _canvas_display; double _y_position; PublicEditor& _editor; diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc index 1e1e66889f..4494b9b265 100644 --- a/gtk2_ardour/time_axis_view_item.cc +++ b/gtk2_ardour/time_axis_view_item.cc @@ -28,7 +28,7 @@ #include "gtkmm2ext/utils.h" #include "gtkmm2ext/gui_thread.h" -#include "canvas/group.h" +#include "canvas/layout.h" #include "canvas/rectangle.h" #include "canvas/debug.h" #include "canvas/text.h" @@ -119,7 +119,7 @@ TimeAxisViewItem::set_constant_heights () * @param automation true if this is an automation region view */ TimeAxisViewItem::TimeAxisViewItem( - const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, uint32_t base_color, + const string & it_name, ArdourCanvas::Item& parent, TimeAxisView& tv, double spu, uint32_t base_color, framepos_t start, framecnt_t duration, bool recording, bool automation, Visibility vis ) : trackview (tv) @@ -149,7 +149,7 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other) { /* share the other's parent, but still create a new group */ - ArdourCanvas::Group* parent = other.group->parent(); + ArdourCanvas::Item* parent = other.group->parent(); _selected = other._selected; @@ -158,11 +158,11 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other) } void -TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, uint32_t base_color, +TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_color, framepos_t start, framepos_t duration, Visibility vis, bool wide, bool high) { - group = new ArdourCanvas::Group (parent); + group = new ArdourCanvas::Layout (parent); CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name())); group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event)); @@ -646,7 +646,7 @@ TimeAxisViewItem::get_canvas_frame() return frame; } -ArdourCanvas::Group* +ArdourCanvas::Item* TimeAxisViewItem::get_canvas_group() { return group; diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h index 04072d1a8e..388aa43b7a 100644 --- a/gtk2_ardour/time_axis_view_item.h +++ b/gtk2_ardour/time_axis_view_item.h @@ -33,8 +33,8 @@ namespace ArdourCanvas { class Pixbuf; class Rectangle; class Item; - class Group; - class Text; + class Layout; + class Text; } using ARDOUR::framepos_t; @@ -79,7 +79,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList uint32_t get_fill_color () const; ArdourCanvas::Item* get_canvas_frame(); - ArdourCanvas::Group* get_canvas_group(); + ArdourCanvas::Item* get_canvas_group(); ArdourCanvas::Item* get_name_highlight(); virtual void set_samples_per_pixel (double); @@ -170,12 +170,12 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList }; protected: - TimeAxisViewItem (const std::string &, ArdourCanvas::Group&, TimeAxisView&, double, uint32_t fill_color, + TimeAxisViewItem (const std::string &, ArdourCanvas::Item&, TimeAxisView&, double, uint32_t fill_color, framepos_t, framecnt_t, bool recording = false, bool automation = false, Visibility v = Visibility (0)); TimeAxisViewItem (const TimeAxisViewItem&); - void init (ArdourCanvas::Group*, double, uint32_t, framepos_t, framepos_t, Visibility, bool, bool); + void init (ArdourCanvas::Item*, double, uint32_t, framepos_t, framepos_t, Visibility, bool, bool); virtual bool canvas_group_event (GdkEvent*); @@ -240,7 +240,7 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList bool high_enough_for_name; bool rect_visible; - ArdourCanvas::Group* group; + ArdourCanvas::Layout* group; ArdourCanvas::Rectangle* vestigial_frame; ArdourCanvas::Rectangle* frame; ArdourCanvas::Text* name_text; diff --git a/gtk2_ardour/verbose_cursor.cc b/gtk2_ardour/verbose_cursor.cc index d6f89bde2b..abe145d4bf 100644 --- a/gtk2_ardour/verbose_cursor.cc +++ b/gtk2_ardour/verbose_cursor.cc @@ -23,6 +23,7 @@ #include "ardour/profile.h" #include "canvas/debug.h" +#include "canvas/scroll_group.h" #include "ardour_ui.h" #include "audio_clock.h" diff --git a/gtk2_ardour/video_image_frame.cc b/gtk2_ardour/video_image_frame.cc index 1ae69f02e1..861c763665 100644 --- a/gtk2_ardour/video_image_frame.cc +++ b/gtk2_ardour/video_image_frame.cc @@ -24,7 +24,7 @@ #include "video_image_frame.h" #include "public_editor.h" #include "utils.h" -#include "canvas/group.h" +#include "canvas/layout.h" #include "utils_videotl.h" #include @@ -43,7 +43,7 @@ static void freedata_cb (uint8_t *d, void* /*arg*/) { free (d); } -VideoImageFrame::VideoImageFrame (PublicEditor& ed, ArdourCanvas::Group& parent, int w, int h, std::string vsurl, std::string vfn) +VideoImageFrame::VideoImageFrame (PublicEditor& ed, ArdourCanvas::Layout& parent, int w, int h, std::string vsurl, std::string vfn) : editor (ed) , _parent(&parent) , clip_width(w) diff --git a/gtk2_ardour/video_image_frame.h b/gtk2_ardour/video_image_frame.h index b611ff0d9e..cbe3a8da91 100644 --- a/gtk2_ardour/video_image_frame.h +++ b/gtk2_ardour/video_image_frame.h @@ -32,7 +32,7 @@ #include "ardour/ardour.h" #include "pbd/signals.h" -#include "canvas/group.h" +#include "canvas/layout.h" #include "canvas/pixbuf.h" #include "canvas/image.h" @@ -49,7 +49,7 @@ class PublicEditor; class VideoImageFrame : public sigc::trackable { public: - VideoImageFrame (PublicEditor&, ArdourCanvas::Group&, int, int, std::string, std::string); + VideoImageFrame (PublicEditor&, ArdourCanvas::Layout&, int, int, std::string, std::string); virtual ~VideoImageFrame (); void set_position (framepos_t); @@ -69,7 +69,7 @@ class VideoImageFrame : public sigc::trackable protected: PublicEditor& editor; - ArdourCanvas::Group *_parent; + ArdourCanvas::Layout *_parent; ArdourCanvas::Image *image; boost::shared_ptr img; diff --git a/gtk2_ardour/video_timeline.cc b/gtk2_ardour/video_timeline.cc index 72b0dff654..180876b0ed 100644 --- a/gtk2_ardour/video_timeline.cc +++ b/gtk2_ardour/video_timeline.cc @@ -51,7 +51,7 @@ using namespace PBD; using namespace Timecode; using namespace VideoUtils; -VideoTimeLine::VideoTimeLine (PublicEditor *ed, ArdourCanvas::Group *vbg, int initial_height) +VideoTimeLine::VideoTimeLine (PublicEditor *ed, ArdourCanvas::Layout *vbg, int initial_height) : editor (ed) , videotl_group(vbg) , bar_height(initial_height) diff --git a/gtk2_ardour/video_timeline.h b/gtk2_ardour/video_timeline.h index f84e613cc8..55384f4836 100644 --- a/gtk2_ardour/video_timeline.h +++ b/gtk2_ardour/video_timeline.h @@ -29,7 +29,7 @@ #include "video_image_frame.h" #include "video_monitor.h" #include "pbd/signals.h" -#include "canvas/group.h" +#include "canvas/layout.h" namespace ARDOUR { class Session; @@ -55,7 +55,7 @@ class PublicEditor; class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, public PBD::ScopedConnectionList, public PBD::StatefulDestructible { public: - VideoTimeLine (PublicEditor*, ArdourCanvas::Group*, int); + VideoTimeLine (PublicEditor*, ArdourCanvas::Layout*, int); virtual ~VideoTimeLine (); void set_session (ARDOUR::Session *s); @@ -102,7 +102,7 @@ class VideoTimeLine : public sigc::trackable, public ARDOUR::SessionHandlePtr, p protected: PublicEditor *editor; - ArdourCanvas::Group *videotl_group; + ArdourCanvas::Layout *videotl_group; int bar_height; std::string _xjadeo_bin; From 99f9b3456ab72d8172ce8296ed57417558ab73c7 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 22 Jun 2014 09:29:16 -0400 Subject: [PATCH 3/3] explicitly qualify cast to ArdourCanvas::Container so that it works. I assume that gcc is failing to complain about ambiguity with Gtk::Container even though there should really be no ambiguity --- libs/canvas/canvas.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 8c7960a217..4371e60658 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -392,15 +392,14 @@ GtkCanvas::pick_current_item (Duple const & point, int state) for (i = items.begin(); i != items.end(); ++i) { - Item const * new_item = *i; + Item const * possible_item = *i; - /* We ignore invisible items, groups and items that ignore events */ + /* We ignore invisible items, containers and items that ignore events */ - if (!new_item->visible() || new_item->ignore_events() || dynamic_cast(new_item) != 0) { + if (!possible_item->visible() || possible_item->ignore_events() || dynamic_cast(possible_item) != 0) { continue; } - - within_items.push_front (new_item); + within_items.push_front (possible_item); } if (within_items.empty()) {