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 std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Arc::Arc (Group* parent)
|
Arc::Arc (Canvas* c)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
, Outline (parent)
|
|
||||||
, Fill (parent)
|
|
||||||
, _radius (0.0)
|
, _radius (0.0)
|
||||||
, _arc_degrees (0.0)
|
, _arc_degrees (0.0)
|
||||||
, _start_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
|
void
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,21 @@ using namespace ArdourCanvas;
|
||||||
/** Construct an Arrow.
|
/** Construct an Arrow.
|
||||||
* @param parent Parent canvas group.
|
* @param parent Parent canvas group.
|
||||||
*/
|
*/
|
||||||
Arrow::Arrow (Group* parent)
|
Arrow::Arrow (Canvas* c)
|
||||||
: Group (parent)
|
: Group (c)
|
||||||
{
|
{
|
||||||
assert (parent);
|
setup ();
|
||||||
|
}
|
||||||
|
|
||||||
|
Arrow::Arrow (Group* g)
|
||||||
|
: Group (g)
|
||||||
|
{
|
||||||
|
setup ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Arrow::setup ()
|
||||||
|
{
|
||||||
/* set up default arrow heads at each end */
|
/* set up default arrow heads at each end */
|
||||||
for (int i = 0; i < 2; ++i) {
|
for (int i = 0; i < 2; ++i) {
|
||||||
_heads[i].polygon = new Polygon (this);
|
_heads[i].polygon = new Polygon (this);
|
||||||
|
|
@ -53,6 +63,7 @@ Arrow::Arrow (Group* parent)
|
||||||
CANVAS_DEBUG_NAME (_line, "arrow line");
|
CANVAS_DEBUG_NAME (_line, "arrow line");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Set whether to show an arrow head at one end or other
|
/** Set whether to show an arrow head at one end or other
|
||||||
* of the line.
|
* of the line.
|
||||||
* @param which 0 or 1 to specify the arrow head to set up.
|
* @param which 0 or 1 to specify the arrow head to set up.
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,13 @@
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
namespace ArdourCanvas {
|
||||||
|
|
||||||
class LIBCANVAS_API Arc : virtual public Item, public Outline, public Fill
|
class Canvas;
|
||||||
|
|
||||||
|
class LIBCANVAS_API Arc : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Arc (Group *);
|
Arc (Canvas*);
|
||||||
|
Arc (Group*);
|
||||||
|
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
namespace ArdourCanvas {
|
||||||
|
|
||||||
|
class Canvas;
|
||||||
class Line;
|
class Line;
|
||||||
class Polygon;
|
class Polygon;
|
||||||
|
|
||||||
|
|
@ -48,7 +49,8 @@ class Polygon;
|
||||||
class LIBCANVAS_API Arrow : public Group
|
class LIBCANVAS_API Arrow : public Group
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Arrow (Group *);
|
Arrow (Canvas*);
|
||||||
|
Arrow (Group*);
|
||||||
|
|
||||||
void set_show_head (int, bool);
|
void set_show_head (int, bool);
|
||||||
void set_head_outward (int, bool);
|
void set_head_outward (int, bool);
|
||||||
|
|
@ -68,6 +70,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setup_polygon (int);
|
void setup_polygon (int);
|
||||||
|
void setup ();
|
||||||
|
|
||||||
/** Representation of a single arrow head */
|
/** Representation of a single arrow head */
|
||||||
struct Head {
|
struct Head {
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,9 @@ namespace ArdourCanvas {
|
||||||
|
|
||||||
class LIBCANVAS_API Circle : public Arc
|
class LIBCANVAS_API Circle : public Arc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Circle (Group *);
|
Circle (Canvas*);
|
||||||
|
Circle (Group*);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,11 @@ namespace ArdourCanvas {
|
||||||
|
|
||||||
class XFadeCurve;
|
class XFadeCurve;
|
||||||
|
|
||||||
class LIBCANVAS_API Curve : public PolyItem, public Fill, public InterpolatedCurve
|
class LIBCANVAS_API Curve : public PolyItem, public InterpolatedCurve
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Curve (Group *);
|
Curve (Canvas*);
|
||||||
|
Curve (Group*);
|
||||||
|
|
||||||
enum CurveFill {
|
enum CurveFill {
|
||||||
None,
|
None,
|
||||||
|
|
|
||||||
|
|
@ -23,15 +23,20 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
#include "canvas/visibility.h"
|
#include "canvas/visibility.h"
|
||||||
#include "canvas/item.h"
|
#include "canvas/types.h"
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
namespace ArdourCanvas {
|
||||||
|
|
||||||
class LIBCANVAS_API Fill : virtual public Item
|
class Item;
|
||||||
|
|
||||||
|
class LIBCANVAS_API Fill : public boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Fill (Group *);
|
Fill (Item& self);
|
||||||
|
virtual ~Fill() {}
|
||||||
|
|
||||||
virtual void set_fill_color (Color);
|
virtual void set_fill_color (Color);
|
||||||
virtual void set_fill (bool);
|
virtual void set_fill (bool);
|
||||||
|
|
@ -52,6 +57,7 @@ protected:
|
||||||
void setup_fill_context (Cairo::RefPtr<Cairo::Context>) const;
|
void setup_fill_context (Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void setup_gradient_context (Cairo::RefPtr<Cairo::Context>, Rect const &, Duple const &) const;
|
void setup_gradient_context (Cairo::RefPtr<Cairo::Context>, Rect const &, Duple const &) const;
|
||||||
|
|
||||||
|
Item& _self;
|
||||||
Color _fill_color;
|
Color _fill_color;
|
||||||
bool _fill;
|
bool _fill;
|
||||||
bool _transparent;
|
bool _transparent;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ class Rectangle;
|
||||||
class LIBCANVAS_API Flag : public Group
|
class LIBCANVAS_API Flag : public Group
|
||||||
{
|
{
|
||||||
public:
|
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_text (std::string const &);
|
||||||
void set_height (Distance);
|
void set_height (Distance);
|
||||||
|
|
@ -38,6 +39,8 @@ public:
|
||||||
bool covers (Duple const &) const;
|
bool covers (Duple const &) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void setup (Distance height, Duple position);
|
||||||
|
|
||||||
Color _outline_color;
|
Color _outline_color;
|
||||||
Color _fill_color;
|
Color _fill_color;
|
||||||
Text* _text;
|
Text* _text;
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,10 @@ namespace ArdourCanvas {
|
||||||
class LIBCANVAS_API Group : public Item
|
class LIBCANVAS_API Group : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Group (Group *);
|
Group (Canvas*);
|
||||||
explicit Group (Group *, Duple);
|
Group (Group*);
|
||||||
~Group ();
|
Group (Group*, Duple const& positon);
|
||||||
|
virtual ~Group ();
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
virtual void compute_bounding_box () const;
|
virtual void compute_bounding_box () const;
|
||||||
|
|
@ -60,14 +61,9 @@ public:
|
||||||
|
|
||||||
static int default_items_per_cell;
|
static int default_items_per_cell;
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
explicit Group (Canvas *);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class ::OptimizingLookupTableTest;
|
friend class ::OptimizingLookupTableTest;
|
||||||
|
|
||||||
Group (Group const &);
|
|
||||||
void ensure_lut () const;
|
void ensure_lut () const;
|
||||||
void invalidate_lut () const;
|
void invalidate_lut () const;
|
||||||
void clear_items (bool with_delete);
|
void clear_items (bool with_delete);
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ namespace ArdourCanvas {
|
||||||
class LIBCANVAS_API Image : public Item
|
class LIBCANVAS_API Image : public Item
|
||||||
{
|
{
|
||||||
public:
|
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 {
|
struct Data {
|
||||||
Data (uint8_t *d, int w, int h, int s, Cairo::Format fmt)
|
Data (uint8_t *d, int w, int h, int s, Cairo::Format fmt)
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
|
|
||||||
#include "canvas/visibility.h"
|
#include "canvas/visibility.h"
|
||||||
#include "canvas/types.h"
|
#include "canvas/types.h"
|
||||||
|
#include "canvas/fill.h"
|
||||||
|
#include "canvas/outline.h"
|
||||||
|
|
||||||
namespace ArdourCanvas
|
namespace ArdourCanvas
|
||||||
{
|
{
|
||||||
|
|
@ -50,12 +52,12 @@ class ScrollGroup;
|
||||||
* and all except the `root group' have a pointer to their parent group.
|
* 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:
|
public:
|
||||||
Item (Canvas *);
|
Item (Canvas *);
|
||||||
Item (Group *);
|
Item (Group *);
|
||||||
Item (Group *, Duple);
|
Item (Group *, Duple const& p);
|
||||||
virtual ~Item ();
|
virtual ~Item ();
|
||||||
|
|
||||||
void redraw () const;
|
void redraw () const;
|
||||||
|
|
@ -219,6 +221,8 @@ public:
|
||||||
std::string whatami() const;
|
std::string whatami() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
friend class Fill;
|
||||||
|
friend class Outline;
|
||||||
|
|
||||||
/** To be called at the beginning of any property change that
|
/** To be called at the beginning of any property change that
|
||||||
* may alter the bounding box of this item
|
* may alter the bounding box of this item
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,11 @@
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
namespace ArdourCanvas {
|
||||||
|
|
||||||
class LIBCANVAS_API Line : virtual public Item, public Outline
|
class LIBCANVAS_API Line : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Line (Group *);
|
Line (Canvas*);
|
||||||
|
Line (Group*);
|
||||||
|
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ public:
|
||||||
Horizontal
|
Horizontal
|
||||||
};
|
};
|
||||||
|
|
||||||
LineSet (Group *, Orientation o = Vertical);
|
LineSet (Canvas*, Orientation o = Vertical);
|
||||||
|
LineSet (Group*, Orientation o = Vertical);
|
||||||
|
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
|
|
|
||||||
|
|
@ -22,17 +22,20 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <boost/noncopyable.hpp>
|
||||||
|
|
||||||
#include "canvas/visibility.h"
|
#include "canvas/visibility.h"
|
||||||
#include "canvas/types.h"
|
#include "canvas/types.h"
|
||||||
#include "canvas/item.h"
|
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
namespace ArdourCanvas {
|
||||||
|
|
||||||
class LIBCANVAS_API Outline : virtual public Item
|
class Item;
|
||||||
|
|
||||||
|
class LIBCANVAS_API Outline : public boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Outline (Group *);
|
Outline (Item& self);
|
||||||
virtual ~Outline () {}
|
virtual ~Outline() {}
|
||||||
|
|
||||||
Color outline_color () const {
|
Color outline_color () const {
|
||||||
return _outline_color;
|
return _outline_color;
|
||||||
|
|
@ -56,9 +59,10 @@ protected:
|
||||||
|
|
||||||
void setup_outline_context (Cairo::RefPtr<Cairo::Context>) const;
|
void setup_outline_context (Cairo::RefPtr<Cairo::Context>) const;
|
||||||
|
|
||||||
Color _outline_color;
|
Item& _self;
|
||||||
|
Color _outline_color;
|
||||||
Distance _outline_width;
|
Distance _outline_width;
|
||||||
bool _outline;
|
bool _outline;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ namespace ArdourCanvas {
|
||||||
class LIBCANVAS_API Pixbuf : public Item
|
class LIBCANVAS_API Pixbuf : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Pixbuf (Group *);
|
Pixbuf (Canvas*);
|
||||||
|
Pixbuf (Group*);
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,11 @@
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
namespace ArdourCanvas {
|
||||||
|
|
||||||
class LIBCANVAS_API PolyItem : virtual public Item, public Outline
|
class LIBCANVAS_API PolyItem : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PolyItem (Group *);
|
PolyItem (Canvas*);
|
||||||
|
PolyItem (Group*);
|
||||||
|
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ namespace ArdourCanvas {
|
||||||
class LIBCANVAS_API PolyLine : public PolyItem
|
class LIBCANVAS_API PolyLine : public PolyItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PolyLine (Group *);
|
PolyLine (Canvas*);
|
||||||
|
PolyLine (Group*);
|
||||||
|
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,11 @@
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
namespace ArdourCanvas {
|
||||||
|
|
||||||
class LIBCANVAS_API Polygon : public PolyItem, public Fill
|
class LIBCANVAS_API Polygon : public PolyItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Polygon (Group *);
|
Polygon (Canvas*);
|
||||||
|
Polygon (Group*);
|
||||||
virtual ~Polygon();
|
virtual ~Polygon();
|
||||||
|
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,13 @@
|
||||||
namespace ArdourCanvas
|
namespace ArdourCanvas
|
||||||
{
|
{
|
||||||
|
|
||||||
class LIBCANVAS_API Rectangle : virtual public Item, public Outline, public Fill
|
class LIBCANVAS_API Rectangle : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Rectangle (Group *);
|
Rectangle (Canvas*);
|
||||||
Rectangle (Group *, Rect const &);
|
Rectangle (Canvas*, Rect const &);
|
||||||
|
Rectangle (Group*);
|
||||||
|
Rectangle (Group*, Rect const &);
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,10 @@ public:
|
||||||
virtual void get_marks (std::vector<Mark>&, double lower, double upper, int maxchars) const = 0;
|
virtual void get_marks (std::vector<Mark>&, double lower, double upper, int maxchars) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
Ruler (Group *, const Metric& m);
|
Ruler (Canvas*, const Metric& m);
|
||||||
Ruler (Group *, const Metric& m, Rect const&);
|
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_range (double lower, double upper);
|
||||||
void set_font_description (Pango::FontDescription);
|
void set_font_description (Pango::FontDescription);
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ class LIBCANVAS_API ScrollGroup : public Group
|
||||||
ScrollsHorizontally = 0x2
|
ScrollsHorizontally = 0x2
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit ScrollGroup (Group *, ScrollSensitivity);
|
ScrollGroup (Canvas*, ScrollSensitivity);
|
||||||
explicit ScrollGroup (Group *, Duple, ScrollSensitivity);
|
ScrollGroup (Group*, ScrollSensitivity);
|
||||||
|
|
||||||
void scroll_to (Duple const& d);
|
void scroll_to (Duple const& d);
|
||||||
Duple scroll_offset() const { return _scroll_offset; }
|
Duple scroll_offset() const { return _scroll_offset; }
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ class StatefulImage : public Item
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
StatefulImage (Canvas*, const XMLNode&);
|
||||||
StatefulImage (Group*, const XMLNode&);
|
StatefulImage (Group*, const XMLNode&);
|
||||||
~StatefulImage ();
|
~StatefulImage ();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,8 @@ namespace ArdourCanvas {
|
||||||
class LIBCANVAS_API Text : public Item
|
class LIBCANVAS_API Text : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Text (Group *);
|
Text (Canvas*);
|
||||||
|
Text (Group*);
|
||||||
~Text();
|
~Text();
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class WaveViewTest;
|
||||||
|
|
||||||
namespace ArdourCanvas {
|
namespace ArdourCanvas {
|
||||||
|
|
||||||
class LIBCANVAS_API WaveView : virtual public Item, public Outline, public Fill
|
class LIBCANVAS_API WaveView : public Item
|
||||||
{
|
{
|
||||||
public:
|
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 ();
|
~WaveView ();
|
||||||
|
|
||||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const & area, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,11 @@
|
||||||
namespace ArdourCanvas
|
namespace ArdourCanvas
|
||||||
{
|
{
|
||||||
|
|
||||||
class LIBCANVAS_API Widget : virtual public Item
|
class LIBCANVAS_API Widget : public Item
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Widget (Group *, CairoWidget&);
|
Widget (Canvas*, CairoWidget&);
|
||||||
|
Widget (Group*, CairoWidget&);
|
||||||
|
|
||||||
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
void render (Rect const &, Cairo::RefPtr<Cairo::Context>) const;
|
||||||
void compute_bounding_box () const;
|
void compute_bounding_box () const;
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,10 @@ public:
|
||||||
End,
|
End,
|
||||||
};
|
};
|
||||||
|
|
||||||
XFadeCurve (Group *);
|
XFadeCurve (Canvas *);
|
||||||
XFadeCurve (Group *, XFadePosition);
|
XFadeCurve (Canvas *, XFadePosition);
|
||||||
|
XFadeCurve (Group*);
|
||||||
|
XFadeCurve (Group*, XFadePosition);
|
||||||
|
|
||||||
void set_fade_position (XFadePosition xfp) { _xfadeposition = xfp; }
|
void set_fade_position (XFadePosition xfp) { _xfadeposition = xfp; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,16 @@
|
||||||
|
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Circle::Circle (Group* parent)
|
Circle::Circle (Canvas* c)
|
||||||
: Item (parent)
|
: Arc (c)
|
||||||
, Arc (parent)
|
|
||||||
{
|
{
|
||||||
set_arc (360.0);
|
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::min;
|
||||||
using std::max;
|
using std::max;
|
||||||
|
|
||||||
Curve::Curve (Group* parent)
|
Curve::Curve (Canvas* c)
|
||||||
: Item (parent)
|
: PolyItem (c)
|
||||||
, PolyItem (parent)
|
, n_samples (0)
|
||||||
, Fill (parent)
|
, points_per_segment (16)
|
||||||
|
, curve_type (CatmullRomCentripetal)
|
||||||
|
, curve_fill (None)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Curve::Curve (Group* g)
|
||||||
|
: PolyItem (g)
|
||||||
, n_samples (0)
|
, n_samples (0)
|
||||||
, points_per_segment (16)
|
, points_per_segment (16)
|
||||||
, curve_type (CatmullRomCentripetal)
|
, curve_type (CatmullRomCentripetal)
|
||||||
|
|
|
||||||
|
|
@ -17,31 +17,34 @@
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <cairomm/cairomm.h>
|
||||||
|
|
||||||
#include "ardour/utils.h"
|
#include "ardour/utils.h"
|
||||||
|
|
||||||
#include "pbd/compose.h"
|
#include "pbd/compose.h"
|
||||||
#include "pbd/convert.h"
|
#include "pbd/convert.h"
|
||||||
|
|
||||||
#include "canvas/fill.h"
|
#include "canvas/fill.h"
|
||||||
|
#include "canvas/item.h"
|
||||||
|
#include "canvas/types.h"
|
||||||
#include "canvas/utils.h"
|
#include "canvas/utils.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Fill::Fill (Group* parent)
|
Fill::Fill (Item& self)
|
||||||
: Item (parent)
|
: _self (self)
|
||||||
, _fill_color (0x000000ff)
|
, _fill_color (0x000000ff)
|
||||||
, _fill (true)
|
, _fill (true)
|
||||||
, _transparent (false)
|
, _transparent (false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Fill::set_fill_color (Color color)
|
Fill::set_fill_color (Color color)
|
||||||
{
|
{
|
||||||
if (_fill_color != color) {
|
if (_fill_color != color) {
|
||||||
begin_visual_change ();
|
_self.begin_visual_change ();
|
||||||
_fill_color = color;
|
_fill_color = color;
|
||||||
|
|
||||||
double r, g, b, a;
|
double r, g, b, a;
|
||||||
|
|
@ -52,7 +55,7 @@ Fill::set_fill_color (Color color)
|
||||||
_transparent = false;
|
_transparent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
end_visual_change ();
|
_self.end_visual_change ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,9 +63,9 @@ void
|
||||||
Fill::set_fill (bool fill)
|
Fill::set_fill (bool fill)
|
||||||
{
|
{
|
||||||
if (_fill != fill) {
|
if (_fill != fill) {
|
||||||
begin_visual_change ();
|
_self.begin_visual_change ();
|
||||||
_fill = fill;
|
_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
|
void
|
||||||
Fill::set_gradient (StopList const & stops, bool vertical)
|
Fill::set_gradient (StopList const & stops, bool vertical)
|
||||||
{
|
{
|
||||||
begin_visual_change ();
|
_self.begin_visual_change ();
|
||||||
|
|
||||||
if (stops.empty()) {
|
if (stops.empty()) {
|
||||||
_stops.clear ();
|
_stops.clear ();
|
||||||
|
|
@ -104,5 +107,5 @@ Fill::set_gradient (StopList const & stops, bool vertical)
|
||||||
_vertical_gradient = vertical;
|
_vertical_gradient = vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
end_visual_change ();
|
_self.end_visual_change ();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,24 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Flag::Flag (Group* parent, Distance height, Color outline_color, Color fill_color, Duple position)
|
Flag::Flag (Canvas* canvas, Distance height, Color outline_color, Color fill_color, Duple position)
|
||||||
: Group (parent)
|
: Group (canvas)
|
||||||
, _outline_color (outline_color)
|
, _outline_color (outline_color)
|
||||||
, _fill_color (fill_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 = new Text (this);
|
||||||
_text->set_alignment (Pango::ALIGN_CENTER);
|
_text->set_alignment (Pango::ALIGN_CENTER);
|
||||||
|
|
|
||||||
|
|
@ -39,21 +39,18 @@ Group::Group (Canvas* canvas)
|
||||||
: Item (canvas)
|
: Item (canvas)
|
||||||
, _lut (0)
|
, _lut (0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group::Group (Group* parent)
|
Group::Group (Group* group)
|
||||||
: Item (parent)
|
: Item (group)
|
||||||
, _lut (0)
|
, _lut (0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group::Group (Group* parent, Duple position)
|
Group::Group (Group* group, Duple const& p)
|
||||||
: Item (parent, position)
|
: Item (group, p)
|
||||||
, _lut (0)
|
, _lut (0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Group::~Group ()
|
Group::~Group ()
|
||||||
|
|
@ -197,10 +194,9 @@ Group::add (Item* i)
|
||||||
/* XXX should really notify canvas about this */
|
/* XXX should really notify canvas about this */
|
||||||
|
|
||||||
_items.push_back (i);
|
_items.push_back (i);
|
||||||
|
i->reparent (this);
|
||||||
invalidate_lut ();
|
invalidate_lut ();
|
||||||
_bounding_box_dirty = true;
|
_bounding_box_dirty = true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,16 @@
|
||||||
|
|
||||||
using namespace ArdourCanvas;
|
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)
|
Image::Image (Group* group, Cairo::Format fmt, int width, int height)
|
||||||
: Item (group)
|
: Item (group)
|
||||||
, _format (fmt)
|
, _format (fmt)
|
||||||
|
|
|
||||||
|
|
@ -34,41 +34,53 @@ using namespace PBD;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Item::Item (Canvas* canvas)
|
Item::Item (Canvas* canvas)
|
||||||
: _canvas (canvas)
|
: Fill (*this)
|
||||||
|
, Outline (*this)
|
||||||
|
, _canvas (canvas)
|
||||||
, _parent (0)
|
, _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)
|
Item::Item (Group* parent)
|
||||||
: _canvas (parent->canvas ())
|
: Fill (*this)
|
||||||
|
, Outline (*this)
|
||||||
|
, _canvas (parent->canvas())
|
||||||
, _parent (parent)
|
, _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)
|
Item::Item (Group* parent, Duple const& p)
|
||||||
: _canvas (parent->canvas())
|
: Fill (*this)
|
||||||
|
, Outline (*this)
|
||||||
|
, _canvas (parent->canvas())
|
||||||
, _parent (parent)
|
, _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
|
if (parent) {
|
||||||
Item::init ()
|
|
||||||
{
|
|
||||||
_visible = true;
|
|
||||||
_bounding_box_dirty = true;
|
|
||||||
_ignore_events = false;
|
|
||||||
|
|
||||||
if (_parent) {
|
|
||||||
_parent->add (this);
|
_parent->add (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
find_scroll_parent ();
|
find_scroll_parent ();
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item::~Item ()
|
Item::~Item ()
|
||||||
|
|
@ -98,7 +110,7 @@ Item::window_origin () const
|
||||||
if (_parent) {
|
if (_parent) {
|
||||||
return _parent->item_to_window (_position);
|
return _parent->item_to_window (_position);
|
||||||
} else {
|
} else {
|
||||||
return _parent->item_to_window (Duple (0,0));
|
return _position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -254,22 +266,25 @@ Item::set_y_position (Coord y)
|
||||||
void
|
void
|
||||||
Item::raise_to_top ()
|
Item::raise_to_top ()
|
||||||
{
|
{
|
||||||
assert (_parent);
|
if (_parent) {
|
||||||
_parent->raise_child_to_top (this);
|
_parent->raise_child_to_top (this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Item::raise (int levels)
|
Item::raise (int levels)
|
||||||
{
|
{
|
||||||
assert (_parent);
|
if (_parent) {
|
||||||
_parent->raise_child (this, levels);
|
_parent->raise_child (this, levels);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Item::lower_to_bottom ()
|
Item::lower_to_bottom ()
|
||||||
{
|
{
|
||||||
assert (_parent);
|
if (_parent) {
|
||||||
_parent->lower_child_to_bottom (this);
|
_parent->lower_child_to_bottom (this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -318,7 +333,11 @@ Item::unparent ()
|
||||||
void
|
void
|
||||||
Item::reparent (Group* new_parent)
|
Item::reparent (Group* new_parent)
|
||||||
{
|
{
|
||||||
assert (_canvas == _parent->canvas());
|
if (new_parent == _parent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert (_canvas == new_parent->canvas());
|
||||||
|
|
||||||
if (_parent) {
|
if (_parent) {
|
||||||
_parent->remove (this);
|
_parent->remove (this);
|
||||||
|
|
@ -370,10 +389,16 @@ Item::common_ancestor_within (uint32_t limit, const Item& other) const
|
||||||
|
|
||||||
while (d1 != d2) {
|
while (d1 != d2) {
|
||||||
if (d1 > d2) {
|
if (d1 > d2) {
|
||||||
|
if (!i1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
i1 = i1->parent();
|
i1 = i1->parent();
|
||||||
d1--;
|
d1--;
|
||||||
limit--;
|
limit--;
|
||||||
} else {
|
} else {
|
||||||
|
if (!i2) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
i2 = i2->parent();
|
i2 = i2->parent();
|
||||||
d2--;
|
d2--;
|
||||||
limit--;
|
limit--;
|
||||||
|
|
@ -416,9 +441,15 @@ Item::closest_ancestor_with (const Item& other) const
|
||||||
|
|
||||||
while (d1 != d2) {
|
while (d1 != d2) {
|
||||||
if (d1 > d2) {
|
if (d1 > d2) {
|
||||||
|
if (!i1) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
i1 = i1->parent();
|
i1 = i1->parent();
|
||||||
d1--;
|
d1--;
|
||||||
} else {
|
} else {
|
||||||
|
if (!i2) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
i2 = i2->parent();
|
i2 = i2->parent();
|
||||||
d2--;
|
d2--;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,14 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Line::Line (Group* parent)
|
Line::Line (Canvas* c)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
, Outline (parent)
|
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Line::Line (Group* group)
|
||||||
|
: Item (group)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,16 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
LineSet::LineSet (Group* parent, Orientation o)
|
LineSet::LineSet (Canvas* c, Orientation o)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
|
, _extent (0)
|
||||||
|
, _orientation (o)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
LineSet::LineSet (Group* group, Orientation o)
|
||||||
|
: Item (group)
|
||||||
, _extent (0)
|
, _extent (0)
|
||||||
, _orientation (o)
|
, _orientation (o)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -23,28 +23,29 @@
|
||||||
#include "pbd/convert.h"
|
#include "pbd/convert.h"
|
||||||
|
|
||||||
#include "ardour/utils.h"
|
#include "ardour/utils.h"
|
||||||
|
|
||||||
|
#include "canvas/item.h"
|
||||||
#include "canvas/outline.h"
|
#include "canvas/outline.h"
|
||||||
#include "canvas/utils.h"
|
#include "canvas/utils.h"
|
||||||
#include "canvas/debug.h"
|
#include "canvas/debug.h"
|
||||||
|
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Outline::Outline (Group* parent)
|
Outline::Outline (Item& self)
|
||||||
: Item (parent)
|
: _self (self)
|
||||||
, _outline_color (0x000000ff)
|
, _outline_color (0x000000ff)
|
||||||
, _outline_width (1.0)
|
, _outline_width (1.0)
|
||||||
, _outline (true)
|
, _outline (true)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Outline::set_outline_color (Color color)
|
Outline::set_outline_color (Color color)
|
||||||
{
|
{
|
||||||
if (color != _outline_color) {
|
if (color != _outline_color) {
|
||||||
begin_visual_change ();
|
_self.begin_visual_change ();
|
||||||
_outline_color = color;
|
_outline_color = color;
|
||||||
end_visual_change ();
|
_self.end_visual_change ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,10 +53,10 @@ void
|
||||||
Outline::set_outline_width (Distance width)
|
Outline::set_outline_width (Distance width)
|
||||||
{
|
{
|
||||||
if (width != _outline_width) {
|
if (width != _outline_width) {
|
||||||
begin_change ();
|
_self.begin_change ();
|
||||||
_outline_width = width;
|
_outline_width = width;
|
||||||
_bounding_box_dirty = true;
|
_self._bounding_box_dirty = true;
|
||||||
end_change ();
|
_self.end_change ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,10 +64,10 @@ void
|
||||||
Outline::set_outline (bool outline)
|
Outline::set_outline (bool outline)
|
||||||
{
|
{
|
||||||
if (outline != _outline) {
|
if (outline != _outline) {
|
||||||
begin_change ();
|
_self.begin_change ();
|
||||||
_outline = outline;
|
_outline = outline;
|
||||||
_bounding_box_dirty = true;
|
_self._bounding_box_dirty = true;
|
||||||
end_change ();
|
_self.end_change ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,14 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
|
Pixbuf::Pixbuf (Canvas* c)
|
||||||
|
: Item (c)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Pixbuf::Pixbuf (Group* g)
|
Pixbuf::Pixbuf (Group* g)
|
||||||
: Item (g)
|
: Item (g)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,14 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
PolyItem::PolyItem (Group* parent)
|
PolyItem::PolyItem (Canvas* c)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
, Outline (parent)
|
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PolyItem::PolyItem (Group* g)
|
||||||
|
: Item (g)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,16 @@
|
||||||
|
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
PolyLine::PolyLine (Group* parent)
|
PolyLine::PolyLine (Canvas* c)
|
||||||
: Item (parent)
|
: PolyItem (c)
|
||||||
, PolyItem (parent)
|
|
||||||
, _threshold (1.0)
|
, _threshold (1.0)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PolyLine::PolyLine (Group* g)
|
||||||
|
: PolyItem (g)
|
||||||
|
, _threshold (1.0)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,20 @@
|
||||||
|
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Polygon::Polygon (Group* parent)
|
Polygon::Polygon (Canvas* c)
|
||||||
: Item (parent)
|
: PolyItem (c)
|
||||||
, PolyItem (parent)
|
|
||||||
, Fill (parent)
|
|
||||||
, multiple (0)
|
, multiple (0)
|
||||||
, constant (0)
|
, constant (0)
|
||||||
, cached_size (0)
|
, cached_size (0)
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Polygon::Polygon (Group* g)
|
||||||
|
: PolyItem (g)
|
||||||
|
, multiple (0)
|
||||||
|
, constant (0)
|
||||||
|
, cached_size (0)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Polygon::~Polygon ()
|
Polygon::~Polygon ()
|
||||||
|
|
|
||||||
|
|
@ -30,22 +30,30 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Rectangle::Rectangle (Group* parent)
|
Rectangle::Rectangle (Canvas* c)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
, Outline (parent)
|
|
||||||
, Fill (parent)
|
|
||||||
, _outline_what ((What) (LEFT | RIGHT | TOP | BOTTOM))
|
, _outline_what ((What) (LEFT | RIGHT | TOP | BOTTOM))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle::Rectangle (Group* parent, Rect const & rect)
|
Rectangle::Rectangle (Canvas* c, Rect const & rect)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
, Outline (parent)
|
|
||||||
, Fill (parent)
|
|
||||||
, _rect (rect)
|
, _rect (rect)
|
||||||
, _outline_what ((What) (LEFT | RIGHT | TOP | BOTTOM))
|
, _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
|
void
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,8 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Ruler::Ruler (Group *p, const Metric& m)
|
Ruler::Ruler (Canvas* c, const Metric& m)
|
||||||
: Item (p)
|
: Rectangle (c)
|
||||||
, Rectangle (p)
|
|
||||||
, _metric (m)
|
, _metric (m)
|
||||||
, _lower (0)
|
, _lower (0)
|
||||||
, _upper (0)
|
, _upper (0)
|
||||||
|
|
@ -41,9 +40,26 @@ Ruler::Ruler (Group *p, const Metric& m)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Ruler::Ruler (Group *p, const Metric& m, Rect const& r)
|
Ruler::Ruler (Canvas* c, const Metric& m, Rect const& r)
|
||||||
: Item (p)
|
: Rectangle (c, r)
|
||||||
, Rectangle (p, 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)
|
, _metric (m)
|
||||||
, _lower (0)
|
, _lower (0)
|
||||||
, _upper (0)
|
, _upper (0)
|
||||||
|
|
|
||||||
|
|
@ -27,14 +27,14 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
ScrollGroup::ScrollGroup (Group* parent, ScrollSensitivity s)
|
ScrollGroup::ScrollGroup (Canvas* c, ScrollSensitivity s)
|
||||||
: Group (parent)
|
: Group (c)
|
||||||
, _scroll_sensitivity (s)
|
, _scroll_sensitivity (s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollGroup::ScrollGroup (Group* parent, Duple position, ScrollSensitivity s)
|
ScrollGroup::ScrollGroup (Group* g, ScrollSensitivity s)
|
||||||
: Group (parent, position)
|
: Group (g)
|
||||||
, _scroll_sensitivity (s)
|
, _scroll_sensitivity (s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ using PBD::error;
|
||||||
PBD::Searchpath StatefulImage::_image_search_path;
|
PBD::Searchpath StatefulImage::_image_search_path;
|
||||||
StatefulImage::ImageCache StatefulImage::_image_cache;
|
StatefulImage::ImageCache StatefulImage::_image_cache;
|
||||||
|
|
||||||
StatefulImage::StatefulImage (Group* group, const XMLNode& node)
|
StatefulImage::StatefulImage (Canvas* c, const XMLNode& node)
|
||||||
: Item (group)
|
: Item (c)
|
||||||
, _state (0)
|
, _state (0)
|
||||||
, _font (0)
|
, _font (0)
|
||||||
, _text_x (0)
|
, _text_x (0)
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Text::Text (Group* parent)
|
Text::Text (Canvas* c)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
, _color (0x000000ff)
|
, _color (0x000000ff)
|
||||||
, _font_description (0)
|
, _font_description (0)
|
||||||
, _alignment (Pango::ALIGN_LEFT)
|
, _alignment (Pango::ALIGN_LEFT)
|
||||||
|
|
@ -41,7 +41,18 @@ Text::Text (Group* parent)
|
||||||
, _need_redraw (false)
|
, _need_redraw (false)
|
||||||
, _clamped_width (COORD_MAX)
|
, _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 ()
|
Text::~Text ()
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,31 @@ double WaveView::_clip_level = 0.98853;
|
||||||
PBD::Signal0<void> WaveView::VisualPropertiesChanged;
|
PBD::Signal0<void> WaveView::VisualPropertiesChanged;
|
||||||
PBD::Signal0<void> WaveView::ClipLevelChanged;
|
PBD::Signal0<void> WaveView::ClipLevelChanged;
|
||||||
|
|
||||||
WaveView::WaveView (Group* parent, boost::shared_ptr<ARDOUR::AudioRegion> region)
|
WaveView::WaveView (Canvas* c, boost::shared_ptr<ARDOUR::AudioRegion> region)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
, Outline (parent)
|
, _region (region)
|
||||||
, Fill (parent)
|
, _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)
|
, _region (region)
|
||||||
, _channel (0)
|
, _channel (0)
|
||||||
, _samples_per_pixel (0)
|
, _samples_per_pixel (0)
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,15 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ArdourCanvas;
|
using namespace ArdourCanvas;
|
||||||
|
|
||||||
Widget::Widget (Group* parent, CairoWidget& w)
|
Widget::Widget (Canvas* c, CairoWidget& w)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
|
, _widget (w)
|
||||||
|
{
|
||||||
|
Event.connect (sigc::mem_fun (*this, &Widget::event_proxy));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget::Widget (Group* g, CairoWidget& w)
|
||||||
|
: Item (g)
|
||||||
, _widget (w)
|
, _widget (w)
|
||||||
{
|
{
|
||||||
Event.connect (sigc::mem_fun (*this, &Widget::event_proxy));
|
Event.connect (sigc::mem_fun (*this, &Widget::event_proxy));
|
||||||
|
|
@ -39,6 +46,7 @@ Widget::Widget (Group* parent, CairoWidget& w)
|
||||||
bool
|
bool
|
||||||
Widget::event_proxy (GdkEvent* ev)
|
Widget::event_proxy (GdkEvent* ev)
|
||||||
{
|
{
|
||||||
|
/* XXX need to translate coordinate into widget's own coordinate space */
|
||||||
return _widget.event (ev);
|
return _widget.event (ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ using namespace ArdourCanvas;
|
||||||
using std::min;
|
using std::min;
|
||||||
using std::max;
|
using std::max;
|
||||||
|
|
||||||
XFadeCurve::XFadeCurve (Group* parent)
|
XFadeCurve::XFadeCurve (Canvas* c)
|
||||||
: Item (parent)
|
: Item (c)
|
||||||
, points_per_segment (32)
|
, points_per_segment (32)
|
||||||
, _xfadeposition (Start)
|
, _xfadeposition (Start)
|
||||||
, _outline_color (0x000000ff)
|
, _outline_color (0x000000ff)
|
||||||
|
|
@ -39,8 +39,26 @@ XFadeCurve::XFadeCurve (Group* parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
XFadeCurve::XFadeCurve (Group* parent, XFadePosition pos)
|
XFadeCurve::XFadeCurve (Canvas* c, XFadePosition pos)
|
||||||
: Item (parent)
|
: 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)
|
, points_per_segment (32)
|
||||||
, _xfadeposition (pos)
|
, _xfadeposition (pos)
|
||||||
, _outline_color (0x000000ff)
|
, _outline_color (0x000000ff)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue