change Canvas heirarchy and constructors

Items no longer need a parent group (they require a Canvas pointer instead), so all constructors have been rationalized
and have two variants, one with a parent and one with a canvas.

All Items now inherit from Fill and Outline, to banish diagonal inheritance and virtual base classes and all that.

There were zero changes to the Ardour GUI arising from these changes.
This commit is contained in:
Paul Davis 2014-06-12 14:53:44 -04:00
parent 551014240a
commit 590882f3c8
48 changed files with 409 additions and 178 deletions

View file

@ -31,15 +31,20 @@
using namespace std;
using namespace ArdourCanvas;
Arc::Arc (Group* parent)
: Item (parent)
, Outline (parent)
, Fill (parent)
Arc::Arc (Canvas* c)
: Item (c)
, _radius (0.0)
, _arc_degrees (0.0)
, _start_degrees (0.0)
{
}
Arc::Arc (Group* g)
: Item (g)
, _radius (0.0)
, _arc_degrees (0.0)
, _start_degrees (0.0)
{
}
void

View file

@ -34,11 +34,21 @@ using namespace ArdourCanvas;
/** Construct an Arrow.
* @param parent Parent canvas group.
*/
Arrow::Arrow (Group* parent)
: Group (parent)
Arrow::Arrow (Canvas* c)
: Group (c)
{
assert (parent);
setup ();
}
Arrow::Arrow (Group* g)
: Group (g)
{
setup ();
}
void
Arrow::setup ()
{
/* set up default arrow heads at each end */
for (int i = 0; i < 2; ++i) {
_heads[i].polygon = new Polygon (this);
@ -53,6 +63,7 @@ Arrow::Arrow (Group* parent)
CANVAS_DEBUG_NAME (_line, "arrow line");
}
/** Set whether to show an arrow head at one end or other
* of the line.
* @param which 0 or 1 to specify the arrow head to set up.

View file

@ -26,10 +26,13 @@
namespace ArdourCanvas {
class LIBCANVAS_API Arc : virtual public Item, public Outline, public Fill
class Canvas;
class LIBCANVAS_API Arc : public Item
{
public:
Arc (Group *);
Arc (Canvas*);
Arc (Group*);
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
void compute_bounding_box () const;

View file

@ -31,6 +31,7 @@
namespace ArdourCanvas {
class Canvas;
class Line;
class Polygon;
@ -48,7 +49,8 @@ class Polygon;
class LIBCANVAS_API Arrow : public Group
{
public:
Arrow (Group *);
Arrow (Canvas*);
Arrow (Group*);
void set_show_head (int, bool);
void set_head_outward (int, bool);
@ -68,6 +70,7 @@ public:
private:
void setup_polygon (int);
void setup ();
/** Representation of a single arrow head */
struct Head {

View file

@ -27,8 +27,9 @@ namespace ArdourCanvas {
class LIBCANVAS_API Circle : public Arc
{
public:
Circle (Group *);
public:
Circle (Canvas*);
Circle (Group*);
};
}

View file

@ -29,10 +29,11 @@ namespace ArdourCanvas {
class XFadeCurve;
class LIBCANVAS_API Curve : public PolyItem, public Fill, public InterpolatedCurve
class LIBCANVAS_API Curve : public PolyItem, public InterpolatedCurve
{
public:
Curve (Group *);
public:
Curve (Canvas*);
Curve (Group*);
enum CurveFill {
None,

View file

@ -23,15 +23,20 @@
#include <vector>
#include <stdint.h>
#include <boost/noncopyable.hpp>
#include "canvas/visibility.h"
#include "canvas/item.h"
#include "canvas/types.h"
namespace ArdourCanvas {
class LIBCANVAS_API Fill : virtual public Item
class Item;
class LIBCANVAS_API Fill : public boost::noncopyable
{
public:
Fill (Group *);
Fill (Item& self);
virtual ~Fill() {}
virtual void set_fill_color (Color);
virtual void set_fill (bool);
@ -52,6 +57,7 @@ protected:
void setup_fill_context (Cairo::RefPtr<Cairo::Context>) const;
void setup_gradient_context (Cairo::RefPtr<Cairo::Context>, Rect const &, Duple const &) const;
Item& _self;
Color _fill_color;
bool _fill;
bool _transparent;

View file

@ -30,7 +30,8 @@ class Rectangle;
class LIBCANVAS_API Flag : public Group
{
public:
Flag (Group *, Distance, Color, Color, Duple);
Flag (Canvas *, Distance, Color, Color, Duple);
Flag (Group*, Distance, Color, Color, Duple);
void set_text (std::string const &);
void set_height (Distance);
@ -38,6 +39,8 @@ public:
bool covers (Duple const &) const;
private:
void setup (Distance height, Duple position);
Color _outline_color;
Color _fill_color;
Text* _text;

View file

@ -33,9 +33,10 @@ namespace ArdourCanvas {
class LIBCANVAS_API Group : public Item
{
public:
explicit Group (Group *);
explicit Group (Group *, Duple);
~Group ();
Group (Canvas*);
Group (Group*);
Group (Group*, Duple const& positon);
virtual ~Group ();
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
virtual void compute_bounding_box () const;
@ -60,14 +61,9 @@ public:
static int default_items_per_cell;
protected:
explicit Group (Canvas *);
private:
friend class ::OptimizingLookupTableTest;
Group (Group const &);
void ensure_lut () const;
void invalidate_lut () const;
void clear_items (bool with_delete);

View file

@ -34,7 +34,8 @@ namespace ArdourCanvas {
class LIBCANVAS_API Image : public Item
{
public:
Image (Group *, Cairo::Format, int width, int height);
Image (Canvas *, Cairo::Format, int width, int height);
Image (Group*, Cairo::Format, int width, int height);
struct Data {
Data (uint8_t *d, int w, int h, int s, Cairo::Format fmt)

View file

@ -30,6 +30,8 @@
#include "canvas/visibility.h"
#include "canvas/types.h"
#include "canvas/fill.h"
#include "canvas/outline.h"
namespace ArdourCanvas
{
@ -50,12 +52,12 @@ class ScrollGroup;
* and all except the `root group' have a pointer to their parent group.
*/
class LIBCANVAS_API Item
class LIBCANVAS_API Item : public Fill, public Outline
{
public:
Item (Canvas *);
Item (Group *);
Item (Group *, Duple);
Item (Group *, Duple const& p);
virtual ~Item ();
void redraw () const;
@ -219,6 +221,8 @@ public:
std::string whatami() const;
protected:
friend class Fill;
friend class Outline;
/** To be called at the beginning of any property change that
* may alter the bounding box of this item

View file

@ -27,10 +27,11 @@
namespace ArdourCanvas {
class LIBCANVAS_API Line : virtual public Item, public Outline
class LIBCANVAS_API Line : public Item
{
public:
Line (Group *);
public:
Line (Canvas*);
Line (Group*);
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
void compute_bounding_box () const;

View file

@ -35,7 +35,8 @@ public:
Horizontal
};
LineSet (Group *, Orientation o = Vertical);
LineSet (Canvas*, Orientation o = Vertical);
LineSet (Group*, Orientation o = Vertical);
void compute_bounding_box () const;
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;

View file

@ -22,17 +22,20 @@
#include <stdint.h>
#include <boost/noncopyable.hpp>
#include "canvas/visibility.h"
#include "canvas/types.h"
#include "canvas/item.h"
namespace ArdourCanvas {
class LIBCANVAS_API Outline : virtual public Item
class Item;
class LIBCANVAS_API Outline : public boost::noncopyable
{
public:
Outline (Group *);
virtual ~Outline () {}
Outline (Item& self);
virtual ~Outline() {}
Color outline_color () const {
return _outline_color;
@ -56,6 +59,7 @@ protected:
void setup_outline_context (Cairo::RefPtr<Cairo::Context>) const;
Item& _self;
Color _outline_color;
Distance _outline_width;
bool _outline;

View file

@ -34,7 +34,8 @@ namespace ArdourCanvas {
class LIBCANVAS_API Pixbuf : public Item
{
public:
Pixbuf (Group *);
Pixbuf (Canvas*);
Pixbuf (Group*);
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
void compute_bounding_box () const;

View file

@ -26,10 +26,11 @@
namespace ArdourCanvas {
class LIBCANVAS_API PolyItem : virtual public Item, public Outline
class LIBCANVAS_API PolyItem : public Item
{
public:
PolyItem (Group *);
PolyItem (Canvas*);
PolyItem (Group*);
void compute_bounding_box () const;

View file

@ -29,7 +29,8 @@ namespace ArdourCanvas {
class LIBCANVAS_API PolyLine : public PolyItem
{
public:
PolyLine (Group *);
PolyLine (Canvas*);
PolyLine (Group*);
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;

View file

@ -27,10 +27,11 @@
namespace ArdourCanvas {
class LIBCANVAS_API Polygon : public PolyItem, public Fill
class LIBCANVAS_API Polygon : public PolyItem
{
public:
Polygon (Group *);
Polygon (Canvas*);
Polygon (Group*);
virtual ~Polygon();
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;

View file

@ -29,11 +29,13 @@
namespace ArdourCanvas
{
class LIBCANVAS_API Rectangle : virtual public Item, public Outline, public Fill
class LIBCANVAS_API Rectangle : public Item
{
public:
Rectangle (Group *);
Rectangle (Group *, Rect const &);
Rectangle (Canvas*);
Rectangle (Canvas*, Rect const &);
Rectangle (Group*);
Rectangle (Group*, Rect const &);
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
void compute_bounding_box () const;

View file

@ -55,8 +55,10 @@ public:
virtual void get_marks (std::vector<Mark>&, double lower, double upper, int maxchars) const = 0;
};
Ruler (Group *, const Metric& m);
Ruler (Group *, const Metric& m, Rect const&);
Ruler (Canvas*, const Metric& m);
Ruler (Canvas*, const Metric& m, Rect const&);
Ruler (Group*, const Metric& m);
Ruler (Group*, const Metric& m, Rect const&);
void set_range (double lower, double upper);
void set_font_description (Pango::FontDescription);

View file

@ -31,8 +31,8 @@ class LIBCANVAS_API ScrollGroup : public Group
ScrollsHorizontally = 0x2
};
explicit ScrollGroup (Group *, ScrollSensitivity);
explicit ScrollGroup (Group *, Duple, ScrollSensitivity);
ScrollGroup (Canvas*, ScrollSensitivity);
ScrollGroup (Group*, ScrollSensitivity);
void scroll_to (Duple const& d);
Duple scroll_offset() const { return _scroll_offset; }

View file

@ -49,6 +49,7 @@ class StatefulImage : public Item
public:
StatefulImage (Canvas*, const XMLNode&);
StatefulImage (Group*, const XMLNode&);
~StatefulImage ();

View file

@ -31,7 +31,8 @@ namespace ArdourCanvas {
class LIBCANVAS_API Text : public Item
{
public:
Text (Group *);
Text (Canvas*);
Text (Group*);
~Text();
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;

View file

@ -45,7 +45,7 @@ class WaveViewTest;
namespace ArdourCanvas {
class LIBCANVAS_API WaveView : virtual public Item, public Outline, public Fill
class LIBCANVAS_API WaveView : public Item
{
public:
@ -86,7 +86,8 @@ public:
*/
WaveView (Group *, boost::shared_ptr<ARDOUR::AudioRegion>);
WaveView (Canvas *, boost::shared_ptr<ARDOUR::AudioRegion>);
WaveView (Group*, boost::shared_ptr<ARDOUR::AudioRegion>);
~WaveView ();
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;

View file

@ -28,10 +28,11 @@
namespace ArdourCanvas
{
class LIBCANVAS_API Widget : virtual public Item
class LIBCANVAS_API Widget : public Item
{
public:
Widget (Group *, CairoWidget&);
Widget (Canvas*, CairoWidget&);
Widget (Group*, CairoWidget&);
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
void compute_bounding_box () const;

View file

@ -34,8 +34,10 @@ public:
End,
};
XFadeCurve (Group *);
XFadeCurve (Group *, XFadePosition);
XFadeCurve (Canvas *);
XFadeCurve (Canvas *, XFadePosition);
XFadeCurve (Group*);
XFadeCurve (Group*, XFadePosition);
void set_fade_position (XFadePosition xfp) { _xfadeposition = xfp; }

View file

@ -20,10 +20,16 @@
using namespace ArdourCanvas;
Circle::Circle (Group* parent)
: Item (parent)
, Arc (parent)
Circle::Circle (Canvas* c)
: Arc (c)
{
set_arc (360.0);
}
Circle::Circle (Group* g)
: Arc (g)
{
set_arc (360.0);
}

View file

@ -27,10 +27,17 @@ using namespace ArdourCanvas;
using std::min;
using std::max;
Curve::Curve (Group* parent)
: Item (parent)
, PolyItem (parent)
, Fill (parent)
Curve::Curve (Canvas* c)
: PolyItem (c)
, n_samples (0)
, points_per_segment (16)
, curve_type (CatmullRomCentripetal)
, curve_fill (None)
{
}
Curve::Curve (Group* g)
: PolyItem (g)
, n_samples (0)
, points_per_segment (16)
, curve_type (CatmullRomCentripetal)

View file

@ -17,31 +17,34 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <cairomm/cairomm.h>
#include "ardour/utils.h"
#include "pbd/compose.h"
#include "pbd/convert.h"
#include "canvas/fill.h"
#include "canvas/item.h"
#include "canvas/types.h"
#include "canvas/utils.h"
using namespace std;
using namespace ArdourCanvas;
Fill::Fill (Group* parent)
: Item (parent)
Fill::Fill (Item& self)
: _self (self)
, _fill_color (0x000000ff)
, _fill (true)
, _transparent (false)
{
}
void
Fill::set_fill_color (Color color)
{
if (_fill_color != color) {
begin_visual_change ();
_self.begin_visual_change ();
_fill_color = color;
double r, g, b, a;
@ -52,7 +55,7 @@ Fill::set_fill_color (Color color)
_transparent = false;
}
end_visual_change ();
_self.end_visual_change ();
}
}
@ -60,9 +63,9 @@ void
Fill::set_fill (bool fill)
{
if (_fill != fill) {
begin_visual_change ();
_self.begin_visual_change ();
_fill = fill;
end_visual_change ();
_self.end_visual_change ();
}
}
@ -95,7 +98,7 @@ Fill::setup_gradient_context (Cairo::RefPtr<Cairo::Context> context, Rect const
void
Fill::set_gradient (StopList const & stops, bool vertical)
{
begin_visual_change ();
_self.begin_visual_change ();
if (stops.empty()) {
_stops.clear ();
@ -104,5 +107,5 @@ Fill::set_gradient (StopList const & stops, bool vertical)
_vertical_gradient = vertical;
}
end_visual_change ();
_self.end_visual_change ();
}

View file

@ -25,10 +25,24 @@
using namespace std;
using namespace ArdourCanvas;
Flag::Flag (Group* parent, Distance height, Color outline_color, Color fill_color, Duple position)
: Group (parent)
Flag::Flag (Canvas* canvas, Distance height, Color outline_color, Color fill_color, Duple position)
: Group (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)
, _outline_color (outline_color)
, _fill_color (fill_color)
{
setup (height, position);
}
void
Flag::setup (Distance height, Duple position)
{
_text = new Text (this);
_text->set_alignment (Pango::ALIGN_CENTER);

View file

@ -39,21 +39,18 @@ Group::Group (Canvas* canvas)
: Item (canvas)
, _lut (0)
{
}
Group::Group (Group* parent)
: Item (parent)
Group::Group (Group* group)
: Item (group)
, _lut (0)
{
}
Group::Group (Group* parent, Duple position)
: Item (parent, position)
Group::Group (Group* group, Duple const& p)
: Item (group, p)
, _lut (0)
{
}
Group::~Group ()
@ -197,10 +194,9 @@ 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

View file

@ -22,6 +22,16 @@
using namespace ArdourCanvas;
Image::Image (Canvas* canvas, Cairo::Format fmt, int width, int height)
: Item (canvas)
, _format (fmt)
, _width (width)
, _height (height)
, _need_render (false)
{
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)
, _format (fmt)

View file

@ -34,41 +34,53 @@ using namespace PBD;
using namespace ArdourCanvas;
Item::Item (Canvas* canvas)
: _canvas (canvas)
: Fill (*this)
, Outline (*this)
, _canvas (canvas)
, _parent (0)
, _visible (true)
, _bounding_box_dirty (true)
, _ignore_events (false)
{
init ();
DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this));
}
Item::Item (Group* parent)
: _canvas (parent->canvas ())
: Fill (*this)
, Outline (*this)
, _canvas (parent->canvas())
, _parent (parent)
, _visible (true)
, _bounding_box_dirty (true)
, _ignore_events (false)
{
init ();
DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this));
if (parent) {
_parent->add (this);
}
find_scroll_parent ();
}
Item::Item (Group* parent, Duple position)
: _canvas (parent->canvas())
Item::Item (Group* parent, Duple const& p)
: Fill (*this)
, Outline (*this)
, _canvas (parent->canvas())
, _parent (parent)
, _position (position)
, _position (p)
, _visible (true)
, _bounding_box_dirty (true)
, _ignore_events (false)
{
init ();
}
DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this));
void
Item::init ()
{
_visible = true;
_bounding_box_dirty = true;
_ignore_events = false;
if (_parent) {
if (parent) {
_parent->add (this);
}
find_scroll_parent ();
DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this));
}
Item::~Item ()
@ -98,7 +110,7 @@ Item::window_origin () const
if (_parent) {
return _parent->item_to_window (_position);
} else {
return _parent->item_to_window (Duple (0,0));
return _position;
}
}
@ -254,22 +266,25 @@ Item::set_y_position (Coord y)
void
Item::raise_to_top ()
{
assert (_parent);
if (_parent) {
_parent->raise_child_to_top (this);
}
}
void
Item::raise (int levels)
{
assert (_parent);
if (_parent) {
_parent->raise_child (this, levels);
}
}
void
Item::lower_to_bottom ()
{
assert (_parent);
if (_parent) {
_parent->lower_child_to_bottom (this);
}
}
void
@ -318,7 +333,11 @@ Item::unparent ()
void
Item::reparent (Group* new_parent)
{
assert (_canvas == _parent->canvas());
if (new_parent == _parent) {
return;
}
assert (_canvas == new_parent->canvas());
if (_parent) {
_parent->remove (this);
@ -370,10 +389,16 @@ Item::common_ancestor_within (uint32_t limit, const Item& other) const
while (d1 != d2) {
if (d1 > d2) {
if (!i1) {
return false;
}
i1 = i1->parent();
d1--;
limit--;
} else {
if (!i2) {
return false;
}
i2 = i2->parent();
d2--;
limit--;
@ -416,9 +441,15 @@ Item::closest_ancestor_with (const Item& other) const
while (d1 != d2) {
if (d1 > d2) {
if (!i1) {
return 0;
}
i1 = i1->parent();
d1--;
} else {
if (!i2) {
return 0;
}
i2 = i2->parent();
d2--;
}

View file

@ -29,11 +29,14 @@
using namespace std;
using namespace ArdourCanvas;
Line::Line (Group* parent)
: Item (parent)
, Outline (parent)
Line::Line (Canvas* c)
: Item (c)
{
}
Line::Line (Group* group)
: Item (group)
{
}
void

View file

@ -30,8 +30,16 @@ public:
}
};
LineSet::LineSet (Group* parent, Orientation o)
: Item (parent)
LineSet::LineSet (Canvas* c, Orientation o)
: Item (c)
, _extent (0)
, _orientation (o)
{
}
LineSet::LineSet (Group* group, Orientation o)
: Item (group)
, _extent (0)
, _orientation (o)
{

View file

@ -23,28 +23,29 @@
#include "pbd/convert.h"
#include "ardour/utils.h"
#include "canvas/item.h"
#include "canvas/outline.h"
#include "canvas/utils.h"
#include "canvas/debug.h"
using namespace ArdourCanvas;
Outline::Outline (Group* parent)
: Item (parent)
Outline::Outline (Item& self)
: _self (self)
, _outline_color (0x000000ff)
, _outline_width (1.0)
, _outline (true)
{
}
void
Outline::set_outline_color (Color color)
{
if (color != _outline_color) {
begin_visual_change ();
_self.begin_visual_change ();
_outline_color = color;
end_visual_change ();
_self.end_visual_change ();
}
}
@ -52,10 +53,10 @@ void
Outline::set_outline_width (Distance width)
{
if (width != _outline_width) {
begin_change ();
_self.begin_change ();
_outline_width = width;
_bounding_box_dirty = true;
end_change ();
_self._bounding_box_dirty = true;
_self.end_change ();
}
}
@ -63,10 +64,10 @@ void
Outline::set_outline (bool outline)
{
if (outline != _outline) {
begin_change ();
_self.begin_change ();
_outline = outline;
_bounding_box_dirty = true;
end_change ();
_self._bounding_box_dirty = true;
_self.end_change ();
}
}

View file

@ -25,10 +25,14 @@
using namespace std;
using namespace ArdourCanvas;
Pixbuf::Pixbuf (Canvas* c)
: Item (c)
{
}
Pixbuf::Pixbuf (Group* g)
: Item (g)
{
}
void

View file

@ -27,11 +27,14 @@
using namespace std;
using namespace ArdourCanvas;
PolyItem::PolyItem (Group* parent)
: Item (parent)
, Outline (parent)
PolyItem::PolyItem (Canvas* c)
: Item (c)
{
}
PolyItem::PolyItem (Group* g)
: Item (g)
{
}
void

View file

@ -25,12 +25,16 @@
using namespace ArdourCanvas;
PolyLine::PolyLine (Group* parent)
: Item (parent)
, PolyItem (parent)
PolyLine::PolyLine (Canvas* c)
: PolyItem (c)
, _threshold (1.0)
{
}
PolyLine::PolyLine (Group* g)
: PolyItem (g)
, _threshold (1.0)
{
}
void

View file

@ -21,15 +21,20 @@
using namespace ArdourCanvas;
Polygon::Polygon (Group* parent)
: Item (parent)
, PolyItem (parent)
, Fill (parent)
Polygon::Polygon (Canvas* c)
: PolyItem (c)
, multiple (0)
, constant (0)
, cached_size (0)
{
}
Polygon::Polygon (Group* g)
: PolyItem (g)
, multiple (0)
, constant (0)
, cached_size (0)
{
}
Polygon::~Polygon ()

View file

@ -30,22 +30,30 @@
using namespace std;
using namespace ArdourCanvas;
Rectangle::Rectangle (Group* parent)
: Item (parent)
, Outline (parent)
, Fill (parent)
Rectangle::Rectangle (Canvas* c)
: Item (c)
, _outline_what ((What) (LEFT | RIGHT | TOP | BOTTOM))
{
}
Rectangle::Rectangle (Group* parent, Rect const & rect)
: Item (parent)
, Outline (parent)
, Fill (parent)
Rectangle::Rectangle (Canvas* c, Rect const & rect)
: Item (c)
, _rect (rect)
, _outline_what ((What) (LEFT | RIGHT | TOP | BOTTOM))
{
}
Rectangle::Rectangle (Group* g)
: Item (g)
, _outline_what ((What) (LEFT | RIGHT | TOP | BOTTOM))
{
}
Rectangle::Rectangle (Group* g, Rect const & rect)
: Item (g)
, _rect (rect)
, _outline_what ((What) (LEFT | RIGHT | TOP | BOTTOM))
{
}
void

View file

@ -31,9 +31,8 @@
using namespace std;
using namespace ArdourCanvas;
Ruler::Ruler (Group *p, const Metric& m)
: Item (p)
, Rectangle (p)
Ruler::Ruler (Canvas* c, const Metric& m)
: Rectangle (c)
, _metric (m)
, _lower (0)
, _upper (0)
@ -41,9 +40,26 @@ Ruler::Ruler (Group *p, const Metric& m)
{
}
Ruler::Ruler (Group *p, const Metric& m, Rect const& r)
: Item (p)
, Rectangle (p, r)
Ruler::Ruler (Canvas* c, const Metric& m, Rect const& r)
: Rectangle (c, r)
, _metric (m)
, _lower (0)
, _upper (0)
, _need_marks (true)
{
}
Ruler::Ruler (Group* g, const Metric& m)
: Rectangle (g)
, _metric (m)
, _lower (0)
, _upper (0)
, _need_marks (true)
{
}
Ruler::Ruler (Group* g, const Metric& m, Rect const& r)
: Rectangle (g, r)
, _metric (m)
, _lower (0)
, _upper (0)

View file

@ -27,14 +27,14 @@
using namespace std;
using namespace ArdourCanvas;
ScrollGroup::ScrollGroup (Group* parent, ScrollSensitivity s)
: Group (parent)
ScrollGroup::ScrollGroup (Canvas* c, ScrollSensitivity s)
: Group (c)
, _scroll_sensitivity (s)
{
}
ScrollGroup::ScrollGroup (Group* parent, Duple position, ScrollSensitivity s)
: Group (parent, position)
ScrollGroup::ScrollGroup (Group* g, ScrollSensitivity s)
: Group (g)
, _scroll_sensitivity (s)
{
}

View file

@ -19,8 +19,8 @@ using PBD::error;
PBD::Searchpath StatefulImage::_image_search_path;
StatefulImage::ImageCache StatefulImage::_image_cache;
StatefulImage::StatefulImage (Group* group, const XMLNode& node)
: Item (group)
StatefulImage::StatefulImage (Canvas* c, const XMLNode& node)
: Item (c)
, _state (0)
, _font (0)
, _text_x (0)

View file

@ -31,8 +31,8 @@
using namespace std;
using namespace ArdourCanvas;
Text::Text (Group* parent)
: Item (parent)
Text::Text (Canvas* c)
: Item (c)
, _color (0x000000ff)
, _font_description (0)
, _alignment (Pango::ALIGN_LEFT)
@ -41,7 +41,18 @@ Text::Text (Group* parent)
, _need_redraw (false)
, _clamped_width (COORD_MAX)
{
}
Text::Text (Group* g)
: Item (g)
, _color (0x000000ff)
, _font_description (0)
, _alignment (Pango::ALIGN_LEFT)
, _width (0)
, _height (0)
, _need_redraw (false)
, _clamped_width (COORD_MAX)
{
}
Text::~Text ()

View file

@ -53,10 +53,31 @@ double WaveView::_clip_level = 0.98853;
PBD::Signal0<void> WaveView::VisualPropertiesChanged;
PBD::Signal0<void> WaveView::ClipLevelChanged;
WaveView::WaveView (Group* parent, boost::shared_ptr<ARDOUR::AudioRegion> region)
: Item (parent)
, Outline (parent)
, Fill (parent)
WaveView::WaveView (Canvas* c, boost::shared_ptr<ARDOUR::AudioRegion> region)
: Item (c)
, _region (region)
, _channel (0)
, _samples_per_pixel (0)
, _height (64)
, _show_zero (false)
, _zero_color (0xff0000ff)
, _clip_color (0xff0000ff)
, _logscaled (_global_logscaled)
, _shape (_global_shape)
, _gradient_depth (_global_gradient_depth)
, _shape_independent (false)
, _logscaled_independent (false)
, _gradient_depth_independent (false)
, _amplitude_above_axis (1.0)
, _region_amplitude (_region->scale_amplitude ())
, _region_start (region->start())
{
VisualPropertiesChanged.connect_same_thread (invalidation_connection, boost::bind (&WaveView::handle_visual_property_change, this));
ClipLevelChanged.connect_same_thread (invalidation_connection, boost::bind (&WaveView::handle_clip_level_change, this));
}
WaveView::WaveView (Group* g, boost::shared_ptr<ARDOUR::AudioRegion> region)
: Item (g)
, _region (region)
, _channel (0)
, _samples_per_pixel (0)

View file

@ -29,8 +29,15 @@
using namespace std;
using namespace ArdourCanvas;
Widget::Widget (Group* parent, CairoWidget& w)
: Item (parent)
Widget::Widget (Canvas* c, CairoWidget& w)
: Item (c)
, _widget (w)
{
Event.connect (sigc::mem_fun (*this, &Widget::event_proxy));
}
Widget::Widget (Group* g, CairoWidget& w)
: Item (g)
, _widget (w)
{
Event.connect (sigc::mem_fun (*this, &Widget::event_proxy));
@ -39,6 +46,7 @@ Widget::Widget (Group* parent, CairoWidget& w)
bool
Widget::event_proxy (GdkEvent* ev)
{
/* XXX need to translate coordinate into widget's own coordinate space */
return _widget.event (ev);
}

View file

@ -30,8 +30,8 @@ using namespace ArdourCanvas;
using std::min;
using std::max;
XFadeCurve::XFadeCurve (Group* parent)
: Item (parent)
XFadeCurve::XFadeCurve (Canvas* c)
: Item (c)
, points_per_segment (32)
, _xfadeposition (Start)
, _outline_color (0x000000ff)
@ -39,8 +39,26 @@ XFadeCurve::XFadeCurve (Group* parent)
{
}
XFadeCurve::XFadeCurve (Group* parent, XFadePosition pos)
: Item (parent)
XFadeCurve::XFadeCurve (Canvas* c, XFadePosition pos)
: Item (c)
, points_per_segment (32)
, _xfadeposition (pos)
, _outline_color (0x000000ff)
, _fill_color (0x22448880)
{
}
XFadeCurve::XFadeCurve (Group* g)
: Item (g)
, points_per_segment (32)
, _xfadeposition (Start)
, _outline_color (0x000000ff)
, _fill_color (0x22448880)
{
}
XFadeCurve::XFadeCurve (Group* g, XFadePosition pos)
: Item (g)
, points_per_segment (32)
, _xfadeposition (pos)
, _outline_color (0x000000ff)