mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
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:
parent
551014240a
commit
590882f3c8
48 changed files with 409 additions and 178 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -26,9 +26,12 @@
|
|||
|
||||
namespace ArdourCanvas {
|
||||
|
||||
class LIBCANVAS_API Arc : virtual public Item, public Outline, public Fill
|
||||
class Canvas;
|
||||
|
||||
class LIBCANVAS_API Arc : public Item
|
||||
{
|
||||
public:
|
||||
Arc (Canvas*);
|
||||
Arc (Group*);
|
||||
|
||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
namespace ArdourCanvas {
|
||||
|
||||
class Canvas;
|
||||
class Line;
|
||||
class Polygon;
|
||||
|
||||
|
|
@ -48,6 +49,7 @@ class Polygon;
|
|||
class LIBCANVAS_API Arrow : public Group
|
||||
{
|
||||
public:
|
||||
Arrow (Canvas*);
|
||||
Arrow (Group*);
|
||||
|
||||
void set_show_head (int, bool);
|
||||
|
|
@ -68,6 +70,7 @@ public:
|
|||
|
||||
private:
|
||||
void setup_polygon (int);
|
||||
void setup ();
|
||||
|
||||
/** Representation of a single arrow head */
|
||||
struct Head {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ namespace ArdourCanvas {
|
|||
class LIBCANVAS_API Circle : public Arc
|
||||
{
|
||||
public:
|
||||
Circle (Canvas*);
|
||||
Circle (Group*);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -29,9 +29,10 @@ namespace ArdourCanvas {
|
|||
|
||||
class XFadeCurve;
|
||||
|
||||
class LIBCANVAS_API Curve : public PolyItem, public Fill, public InterpolatedCurve
|
||||
class LIBCANVAS_API Curve : public PolyItem, public InterpolatedCurve
|
||||
{
|
||||
public:
|
||||
Curve (Canvas*);
|
||||
Curve (Group*);
|
||||
|
||||
enum CurveFill {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class Rectangle;
|
|||
class LIBCANVAS_API Flag : public Group
|
||||
{
|
||||
public:
|
||||
Flag (Canvas *, Distance, Color, Color, Duple);
|
||||
Flag (Group*, Distance, Color, Color, Duple);
|
||||
|
||||
void set_text (std::string const &);
|
||||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ namespace ArdourCanvas {
|
|||
class LIBCANVAS_API Image : public Item
|
||||
{
|
||||
public:
|
||||
Image (Canvas *, Cairo::Format, int width, int height);
|
||||
Image (Group*, Cairo::Format, int width, int height);
|
||||
|
||||
struct Data {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -27,9 +27,10 @@
|
|||
|
||||
namespace ArdourCanvas {
|
||||
|
||||
class LIBCANVAS_API Line : virtual public Item, public Outline
|
||||
class LIBCANVAS_API Line : public Item
|
||||
{
|
||||
public:
|
||||
Line (Canvas*);
|
||||
Line (Group*);
|
||||
|
||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ public:
|
|||
Horizontal
|
||||
};
|
||||
|
||||
LineSet (Canvas*, Orientation o = Vertical);
|
||||
LineSet (Group*, Orientation o = Vertical);
|
||||
|
||||
void compute_bounding_box () const;
|
||||
|
|
|
|||
|
|
@ -22,16 +22,19 @@
|
|||
|
||||
#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 *);
|
||||
Outline (Item& self);
|
||||
virtual ~Outline() {}
|
||||
|
||||
Color outline_color () const {
|
||||
|
|
@ -56,6 +59,7 @@ protected:
|
|||
|
||||
void setup_outline_context (Cairo::RefPtr<Cairo::Context>) const;
|
||||
|
||||
Item& _self;
|
||||
Color _outline_color;
|
||||
Distance _outline_width;
|
||||
bool _outline;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ namespace ArdourCanvas {
|
|||
class LIBCANVAS_API Pixbuf : public Item
|
||||
{
|
||||
public:
|
||||
Pixbuf (Canvas*);
|
||||
Pixbuf (Group*);
|
||||
|
||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||
|
|
|
|||
|
|
@ -26,9 +26,10 @@
|
|||
|
||||
namespace ArdourCanvas {
|
||||
|
||||
class LIBCANVAS_API PolyItem : virtual public Item, public Outline
|
||||
class LIBCANVAS_API PolyItem : public Item
|
||||
{
|
||||
public:
|
||||
PolyItem (Canvas*);
|
||||
PolyItem (Group*);
|
||||
|
||||
void compute_bounding_box () const;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ namespace ArdourCanvas {
|
|||
class LIBCANVAS_API PolyLine : public PolyItem
|
||||
{
|
||||
public:
|
||||
PolyLine (Canvas*);
|
||||
PolyLine (Group*);
|
||||
|
||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||
|
|
|
|||
|
|
@ -27,9 +27,10 @@
|
|||
|
||||
namespace ArdourCanvas {
|
||||
|
||||
class LIBCANVAS_API Polygon : public PolyItem, public Fill
|
||||
class LIBCANVAS_API Polygon : public PolyItem
|
||||
{
|
||||
public:
|
||||
Polygon (Canvas*);
|
||||
Polygon (Group*);
|
||||
virtual ~Polygon();
|
||||
|
||||
|
|
|
|||
|
|
@ -29,9 +29,11 @@
|
|||
namespace ArdourCanvas
|
||||
{
|
||||
|
||||
class LIBCANVAS_API Rectangle : virtual public Item, public Outline, public Fill
|
||||
class LIBCANVAS_API Rectangle : public Item
|
||||
{
|
||||
public:
|
||||
Rectangle (Canvas*);
|
||||
Rectangle (Canvas*, Rect const &);
|
||||
Rectangle (Group*);
|
||||
Rectangle (Group*, Rect const &);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ public:
|
|||
virtual void get_marks (std::vector<Mark>&, double lower, double upper, int maxchars) const = 0;
|
||||
};
|
||||
|
||||
Ruler (Canvas*, const Metric& m);
|
||||
Ruler (Canvas*, const Metric& m, Rect const&);
|
||||
Ruler (Group*, const Metric& m);
|
||||
Ruler (Group*, const Metric& m, Rect const&);
|
||||
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class StatefulImage : public Item
|
|||
|
||||
public:
|
||||
|
||||
StatefulImage (Canvas*, const XMLNode&);
|
||||
StatefulImage (Group*, const XMLNode&);
|
||||
~StatefulImage ();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ namespace ArdourCanvas {
|
|||
class LIBCANVAS_API Text : public Item
|
||||
{
|
||||
public:
|
||||
Text (Canvas*);
|
||||
Text (Group*);
|
||||
~Text();
|
||||
|
||||
|
|
|
|||
|
|
@ -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,6 +86,7 @@ public:
|
|||
*/
|
||||
|
||||
|
||||
WaveView (Canvas *, boost::shared_ptr<ARDOUR::AudioRegion>);
|
||||
WaveView (Group*, boost::shared_ptr<ARDOUR::AudioRegion>);
|
||||
~WaveView ();
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,10 @@
|
|||
namespace ArdourCanvas
|
||||
{
|
||||
|
||||
class LIBCANVAS_API Widget : virtual public Item
|
||||
class LIBCANVAS_API Widget : public Item
|
||||
{
|
||||
public:
|
||||
Widget (Canvas*, CairoWidget&);
|
||||
Widget (Group*, CairoWidget&);
|
||||
|
||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ public:
|
|||
End,
|
||||
};
|
||||
|
||||
XFadeCurve (Canvas *);
|
||||
XFadeCurve (Canvas *, XFadePosition);
|
||||
XFadeCurve (Group*);
|
||||
XFadeCurve (Group*, XFadePosition);
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
Item::Item (Group* parent, Duple position)
|
||||
: _canvas (parent->canvas())
|
||||
, _parent (parent)
|
||||
, _position (position)
|
||||
{
|
||||
init ();
|
||||
find_scroll_parent ();
|
||||
}
|
||||
|
||||
void
|
||||
Item::init ()
|
||||
Item::Item (Group* parent, Duple const& p)
|
||||
: Fill (*this)
|
||||
, Outline (*this)
|
||||
, _canvas (parent->canvas())
|
||||
, _parent (parent)
|
||||
, _position (p)
|
||||
, _visible (true)
|
||||
, _bounding_box_dirty (true)
|
||||
, _ignore_events (false)
|
||||
{
|
||||
_visible = true;
|
||||
_bounding_box_dirty = true;
|
||||
_ignore_events = false;
|
||||
DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this));
|
||||
|
||||
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,23 +266,26 @@ 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
|
||||
Item::hide ()
|
||||
|
|
@ -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--;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 ();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,10 +25,14 @@
|
|||
using namespace std;
|
||||
using namespace ArdourCanvas;
|
||||
|
||||
Pixbuf::Pixbuf (Canvas* c)
|
||||
: Item (c)
|
||||
{
|
||||
}
|
||||
|
||||
Pixbuf::Pixbuf (Group* g)
|
||||
: Item (g)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 ()
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue