summaryrefslogtreecommitdiffstats
path: root/ganv
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-12-08 22:34:35 +0000
committerDavid Robillard <d@drobilla.net>2011-12-08 22:34:35 +0000
commitcf71d7ee9914de3936456eebe6d87948b46b2e57 (patch)
treef9a90d23a3e9e2f68adf329952de33b6e452f9b4 /ganv
parentf808fa7d26df3b42c0bb33c49894920b0f975ec9 (diff)
downloadganv-cf71d7ee9914de3936456eebe6d87948b46b2e57.tar.gz
ganv-cf71d7ee9914de3936456eebe6d87948b46b2e57.tar.bz2
ganv-cf71d7ee9914de3936456eebe6d87948b46b2e57.zip
Hide implementations.
git-svn-id: http://svn.drobilla.net/lad/trunk/ganv@3837 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'ganv')
-rw-r--r--ganv/Module.hpp46
-rw-r--r--ganv/box.h97
-rw-r--r--ganv/circle.h24
-rw-r--r--ganv/edge.h48
-rw-r--r--ganv/module.h31
-rw-r--r--ganv/node.h170
-rw-r--r--ganv/port.h64
-rw-r--r--ganv/text.h33
-rw-r--r--ganv/types.h3
9 files changed, 174 insertions, 342 deletions
diff --git a/ganv/Module.hpp b/ganv/Module.hpp
index 101b063..628a3c1 100644
--- a/ganv/Module.hpp
+++ b/ganv/Module.hpp
@@ -65,31 +65,45 @@ public:
template<typename P, typename C>
class iterator_base {
public:
- iterator_base(C** p) : _ptr(p) {}
+ iterator_base(GanvModule* m, guint i) : _module(m), _index(i) {}
template<typename T, typename U>
iterator_base(const iterator_base<T, U>& i)
- : _ptr(const_cast<C**>(i._ptr))
+ : _module(i._module)
+ , _index(i._index)
{}
- P* operator*() const { return Glib::wrap(*_ptr); }
- P* operator->() const { return Glib::wrap(*_ptr); }
- iterator_base operator++(int) { return iterator_base<P, C>(_ptr + 1); }
- iterator_base& operator++() { ++_ptr; return *this; }
- bool operator==(const iterator_base<P, C>& i) const { return _ptr == i._ptr; }
- bool operator!=(const iterator_base<P, C>& i) const { return _ptr != i._ptr; }
+ P* operator*() const {
+ return Glib::wrap(ganv_module_get_port(_module, _index));
+ }
+ P* operator->() const {
+ return Glib::wrap(ganv_module_get_port(_module, _index));
+ }
+ iterator_base operator++(int) const {
+ return iterator_base<P, C>(_index + 1);
+ }
+ iterator_base& operator++() {
+ ++_index; return *this;
+ }
+ bool operator==(const iterator_base<P, C>& i) const {
+ return _index == i._index;
+ }
+ bool operator!=(const iterator_base<P, C>& i) const {
+ return _index != i._index;
+ }
private:
template<typename T, typename U> friend class iterator_base;
- C** _ptr;
+ GanvModule* _module;
+ guint _index;
};
typedef iterator_base<Port, GanvPort> iterator;
typedef iterator_base<const Port, const GanvPort> const_iterator;
- iterator begin() { return iterator((GanvPort**)gobj()->ports->pdata); }
- iterator end() { return iterator((GanvPort**)gobj()->ports->pdata + gobj()->ports->len); }
- iterator back() { return iterator((GanvPort**)gobj()->ports->pdata + gobj()->ports->len - 1); }
- const_iterator begin() const { return const_iterator((const GanvPort**)gobj()->ports->pdata); }
- const_iterator end() const { return const_iterator((const GanvPort**)gobj()->ports->pdata + gobj()->ports->len); }
- const_iterator back() const { return const_iterator((const GanvPort**)gobj()->ports->pdata + gobj()->ports->len - 1); }
+ iterator begin() { return iterator(gobj(), 0); }
+ iterator end() { return iterator(gobj(), num_ports()); }
+ iterator back() { return iterator(gobj(), num_ports() - 1); }
+ const_iterator begin() const { return iterator(const_cast<GanvModule*>(gobj()), 0); }
+ const_iterator end() const { return iterator(const_cast<GanvModule*>(gobj()), num_ports()); }
+ const_iterator back() const { return iterator(const_cast<GanvModule*>(gobj()), num_ports() - 1); }
void set_icon(Gdk::Pixbuf* icon) {
ganv_module_set_icon(gobj(), icon->gobj());
@@ -103,7 +117,7 @@ public:
ganv_module_for_each_port(gobj(), f, data);
}
- size_t num_ports() const { return gobj()->ports->len; }
+ guint num_ports() const { return ganv_module_num_ports(gobj()); }
RW_PROPERTY(gboolean, stacked)
RW_PROPERTY(gboolean, show_port_labels)
diff --git a/ganv/box.h b/ganv/box.h
index 15e0fe4..5961afd 100644
--- a/ganv/box.h
+++ b/ganv/box.h
@@ -20,31 +20,21 @@
G_BEGIN_DECLS
-#define GANV_TYPE_BOX (ganv_box_get_type())
-#define GANV_BOX(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_BOX, GanvBox))
-#define GANV_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_BOX, GanvBoxClass))
-#define GANV_IS_BOX(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_BOX))
-#define GANV_IS_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_BOX))
-#define GANV_BOX_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_BOX, GanvBoxClass))
+#define GANV_TYPE_BOX (ganv_box_get_type())
+#define GANV_BOX(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_BOX, GanvBox))
+#define GANV_BOX_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_BOX, GanvBoxClass))
+#define GANV_IS_BOX(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_BOX))
+#define GANV_IS_BOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_BOX))
+#define GANV_BOX_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_BOX, GanvBoxClass))
+#define GANV_BOX_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GANV_TYPE_BOX, GanvBoxImpl))
-typedef struct _GanvBox GanvBox;
typedef struct _GanvBoxClass GanvBoxClass;
-
-typedef struct {
- double x1, y1, x2, y2;
- double border_width;
- gboolean stacked;
-} GanvBoxCoords;
+typedef struct _GanvBoxImpl GanvBoxImpl;
struct _GanvBox
{
- GanvNode node;
- GanvBoxCoords coords;
- GanvBoxCoords old_coords;
- double radius_tl;
- double radius_tr;
- double radius_br;
- double radius_bl;
+ GanvNode node;
+ GanvBoxImpl* impl;
};
struct _GanvBoxClass {
@@ -57,63 +47,16 @@ struct _GanvBoxClass {
double height);
};
-GType ganv_box_get_type(void);
-
-static inline double
-ganv_box_get_x1(const GanvBox* box)
-{
- return box->coords.x1;
-}
-
-static inline double
-ganv_box_get_y1(const GanvBox* box)
-{
- return box->coords.y1;
-}
-
-static inline double
-ganv_box_get_x2(const GanvBox* box)
-{
- return box->coords.x2;
-}
-
-static inline double
-ganv_box_get_y2(const GanvBox* box)
-{
- return box->coords.y2;
-}
-
-static inline double
-ganv_box_get_width(const GanvBox* box)
-{
- return box->coords.x2 - box->coords.x1;
-}
-
-static inline void
-ganv_box_set_width(GanvBox* box,
- double width)
-{
- GANV_BOX_GET_CLASS(box)->set_width(box, width);
-}
-
-static inline double
-ganv_box_get_height(const GanvBox* box)
-{
- return box->coords.y2 - box->coords.y1;
-}
-
-static inline void
-ganv_box_set_height(GanvBox* box,
- double height)
-{
- GANV_BOX_GET_CLASS(box)->set_height(box, height);
-}
-
-static inline double
-ganv_box_get_border_width(const GanvBox* box)
-{
- return box->coords.border_width;
-}
+GType ganv_box_get_type(void);
+double ganv_box_get_x1(const GanvBox* box);
+double ganv_box_get_y1(const GanvBox* box);
+double ganv_box_get_x2(const GanvBox* box);
+double ganv_box_get_y2(const GanvBox* box);
+double ganv_box_get_width(const GanvBox* box);
+void ganv_box_set_width(GanvBox* box, double width);
+double ganv_box_get_height(const GanvBox* box);
+void ganv_box_set_height(GanvBox* box, double height);
+double ganv_box_get_border_width(const GanvBox* box);
void
ganv_box_normalize(GanvBox* box);
diff --git a/ganv/circle.h b/ganv/circle.h
index 40c193c..f02f475 100644
--- a/ganv/circle.h
+++ b/ganv/circle.h
@@ -20,26 +20,22 @@
G_BEGIN_DECLS
-#define GANV_TYPE_CIRCLE (ganv_circle_get_type())
-#define GANV_CIRCLE(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_CIRCLE, GanvCircle))
-#define GANV_CIRCLE_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_CIRCLE, GanvCircleClass))
-#define GANV_IS_CIRCLE(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_CIRCLE))
-#define GANV_IS_CIRCLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_CIRCLE))
-#define GANV_CIRCLE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_CIRCLE, GanvCircleClass))
+#define GANV_TYPE_CIRCLE (ganv_circle_get_type())
+#define GANV_CIRCLE(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_CIRCLE, GanvCircle))
+#define GANV_CIRCLE_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_CIRCLE, GanvCircleClass))
+#define GANV_IS_CIRCLE(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_CIRCLE))
+#define GANV_IS_CIRCLE_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_CIRCLE))
+#define GANV_CIRCLE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_CIRCLE, GanvCircleClass))
+#define GANV_CIRCLE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GANV_TYPE_CIRCLE, GanvCircleImpl))
typedef struct _GanvCircle GanvCircle;
typedef struct _GanvCircleClass GanvCircleClass;
-
-typedef struct {
- double x, y, radius;
- double width;
-} GanvCircleCoords;
+typedef struct _GanvCircleImpl GanvCircleImpl;
struct _GanvCircle
{
- GanvNode node;
- GanvCircleCoords coords;
- GanvCircleCoords old_coords;
+ GanvNode node;
+ GanvCircleImpl* impl;
};
struct _GanvCircleClass {
diff --git a/ganv/edge.h b/ganv/edge.h
index 15da68a..461aa17 100644
--- a/ganv/edge.h
+++ b/ganv/edge.h
@@ -23,37 +23,21 @@
G_BEGIN_DECLS
-#define GANV_TYPE_EDGE (ganv_edge_get_type())
-#define GANV_EDGE(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_EDGE, GanvEdge))
-#define GANV_EDGE_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_EDGE, GanvEdgeClass))
-#define GANV_IS_EDGE(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_EDGE))
-#define GANV_IS_EDGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_EDGE))
-#define GANV_EDGE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_EDGE, GanvEdgeClass))
+#define GANV_TYPE_EDGE (ganv_edge_get_type())
+#define GANV_EDGE(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_EDGE, GanvEdge))
+#define GANV_EDGE_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_EDGE, GanvEdgeClass))
+#define GANV_IS_EDGE(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_EDGE))
+#define GANV_IS_EDGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_EDGE))
+#define GANV_EDGE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_EDGE, GanvEdgeClass))
+#define GANV_EDGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GANV_TYPE_EDGE, GanvEdgeImpl))
typedef struct _GanvEdgeClass GanvEdgeClass;
-
-typedef struct {
- double x1, y1, x2, y2;
- double cx1, cy1, cx2, cy2;
- double handle_x, handle_y, handle_radius;
- double width;
- gboolean curved;
- gboolean arrowhead;
-} GanvEdgeCoords;
+typedef struct _GanvEdgeImpl GanvEdgeImpl;
struct _GanvEdge
{
GnomeCanvasItem item;
- GanvNode* tail;
- GanvNode* head;
- GanvEdgeCoords coords;
- GanvEdgeCoords old_coords;
- double dash_length;
- double dash_offset;
- guint color;
- gboolean selected;
- gboolean highlighted;
- gboolean ghost;
+ GanvEdgeImpl* impl;
};
struct _GanvEdgeClass {
@@ -97,17 +81,11 @@ void
ganv_edge_tick(GanvEdge* edge,
double seconds);
-static inline GanvNode*
-ganv_edge_get_tail(const GanvEdge* edge)
-{
- return edge->tail;
-}
+GanvNode*
+ganv_edge_get_tail(const GanvEdge* edge);
-static inline GanvNode*
-ganv_edge_get_head(const GanvEdge* edge)
-{
- return edge->head;
-}
+GanvNode*
+ganv_edge_get_head(const GanvEdge* edge);
G_END_DECLS
diff --git a/ganv/module.h b/ganv/module.h
index 3bf6192..4f89a38 100644
--- a/ganv/module.h
+++ b/ganv/module.h
@@ -23,30 +23,23 @@
G_BEGIN_DECLS
-#define GANV_TYPE_MODULE (ganv_module_get_type())
-#define GANV_MODULE(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_MODULE, GanvModule))
-#define GANV_MODULE_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_MODULE, GanvModuleClass))
-#define GANV_IS_MODULE(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_MODULE))
-#define GANV_IS_MODULE_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_MODULE))
-#define GANV_MODULE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_MODULE, GanvModuleClass))
+#define GANV_TYPE_MODULE (ganv_module_get_type())
+#define GANV_MODULE(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_MODULE, GanvModule))
+#define GANV_MODULE_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_MODULE, GanvModuleClass))
+#define GANV_IS_MODULE(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_MODULE))
+#define GANV_IS_MODULE_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_MODULE))
+#define GANV_MODULE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_MODULE, GanvModuleClass))
+#define GANV_MODULE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GANV_TYPE_MODULE, GanvModuleImpl))
typedef struct _GanvModuleClass GanvModuleClass;
+typedef struct _GanvModuleImpl GanvModuleImpl;
typedef void (*GanvPortFunction)(GanvPort* port, void* data);
struct _GanvModule
{
- GanvBox box;
- GPtrArray* ports;
- GnomeCanvasItem* icon_box;
- GnomeCanvasItem* embed_item;
- int embed_width;
- int embed_height;
- double widest_input;
- double widest_output;
- gboolean show_port_labels;
- gboolean must_resize;
- gboolean port_size_changed;
+ GanvBox box;
+ GanvModuleImpl* impl;
};
struct _GanvModuleClass {
@@ -61,6 +54,10 @@ ganv_module_new(GanvCanvas* canvas,
guint
ganv_module_num_ports(const GanvModule* module);
+
+GanvPort*
+ganv_module_get_port(GanvModule* module,
+ guint index);
void
ganv_module_add_port(GanvModule* module,
diff --git a/ganv/node.h b/ganv/node.h
index bd6863f..fb7dd4c 100644
--- a/ganv/node.h
+++ b/ganv/node.h
@@ -29,126 +29,93 @@ G_BEGIN_DECLS
#define GANV_IS_NODE(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_NODE))
#define GANV_IS_NODE_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_NODE))
#define GANV_NODE_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_NODE, GanvNodeClass))
+#define GANV_NODE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GANV_TYPE_NODE, GanvNodeImpl))
typedef struct _GanvNodeClass GanvNodeClass;
+typedef struct _GanvNodeImpl GanvNodeImpl;
struct _GanvNode {
- GnomeCanvasGroup group;
- struct _GanvNode* partner;
- GanvText* label;
- double dash_length;
- double dash_offset;
- double border_width;
- guint fill_color;
- guint border_color;
- gboolean can_tail;
- gboolean can_head;
- gboolean selected;
- gboolean highlighted;
- gboolean draggable;
+ GnomeCanvasGroup group;
+ GanvNodeImpl* impl;
};
struct _GanvNodeClass {
GnomeCanvasGroupClass parent_class;
- void (* tick)(GanvNode* self,
- double seconds);
+ void (*tick)(GanvNode* self,
+ double seconds);
- void (* move)(GanvNode* node,
- double dx,
- double dy);
+ void (*move)(GanvNode* node,
+ double dx,
+ double dy);
- void (* move_to)(GanvNode* node,
- double x,
- double y);
+ void (*move_to)(GanvNode* node,
+ double x,
+ double y);
- void (* resize)(GanvNode* node);
+ void (*resize)(GanvNode* node);
- void (* disconnect)(GanvNode* node);
+ void (*disconnect)(GanvNode* node);
- gboolean (* is_within)(const GanvNode* self,
- double x1,
- double y1,
- double x2,
- double y2);
+ gboolean (*is_within)(const GanvNode* self,
+ double x1,
+ double y1,
+ double x2,
+ double y2);
- void (* tail_vector)(const GanvNode* self,
- const GanvNode* head,
- double* x,
- double* y,
- double* dx,
- double* dy);
+ void (*tail_vector)(const GanvNode* self,
+ const GanvNode* head,
+ double* x,
+ double* y,
+ double* dx,
+ double* dy);
- void (* head_vector)(const GanvNode* self,
- const GanvNode* tail,
- double* x,
- double* y,
- double* dx,
- double* dy);
+ void (*head_vector)(const GanvNode* self,
+ const GanvNode* tail,
+ double* x,
+ double* y,
+ double* dx,
+ double* dy);
- gboolean (* on_event)(GanvNode* node,
- GdkEvent* event);
+ gboolean (*on_event)(GanvNode* node,
+ GdkEvent* event);
};
GType ganv_node_get_type(void);
-static inline gboolean
-ganv_node_can_tail(const GanvNode* self)
-{
- return self->can_tail;
-}
+gboolean
+ganv_node_can_tail(const GanvNode* self);
-static inline gboolean
-ganv_node_can_head(const GanvNode* self)
-{
- return self->can_head;
-}
+gboolean
+ganv_node_can_head(const GanvNode* self);
-static inline gboolean
+gboolean
ganv_node_is_within(const GanvNode* self,
double x1,
double y1,
double x2,
- double y2)
-{
- return GANV_NODE_GET_CLASS(self)->is_within(
- self, x1, y1, x2, y2);
-}
+ double y2);
-static inline void
+void
ganv_node_tick(GanvNode* self,
- double seconds)
-{
- GanvNodeClass* klass = GANV_NODE_GET_CLASS(self);
- if (klass->tick) {
- klass->tick(self, seconds);
- }
-}
-
-static inline void
+ double seconds);
+
+void
ganv_node_tail_vector(const GanvNode* self,
const GanvNode* head,
double* x1,
double* y1,
double* x2,
- double* y2)
-{
- GANV_NODE_GET_CLASS(self)->tail_vector(
- self, head, x1, y1, x2, y2);
-}
+ double* y2);
-static inline void
+void
ganv_node_head_vector(const GanvNode* self,
const GanvNode* tail,
double* x1,
double* y1,
double* x2,
- double* y2)
-{
- GANV_NODE_GET_CLASS(self)->head_vector(
- self, tail, x1, y1, x2, y2);
-}
+ double* y2);
/**
Get the colours that should currently be used for drawing this node.
@@ -162,45 +129,26 @@ void ganv_node_get_draw_properties(const GanvNode* node,
const char* ganv_node_get_label(const GanvNode* node);
-static inline GanvNode*
-ganv_node_get_partner(const GanvNode* node)
-{
- return node->partner;
-}
+GanvNode*
+ganv_node_get_partner(const GanvNode* node);
-void ganv_node_set_label(GanvNode* node,
- const char* str);
+void ganv_node_set_label(GanvNode* node, const char* str);
-static inline void
+void
ganv_node_move(GanvNode* node,
double dx,
- double dy)
-{
- GANV_NODE_GET_CLASS(node)->move(node, dx, dy);
-}
+ double dy);
-static inline void
+void
ganv_node_move_to(GanvNode* node,
double x,
- double y)
-{
- GANV_NODE_GET_CLASS(node)->move_to(node, x, y);
-}
-
-static inline void
-ganv_node_resize(GanvNode* node)
-{
- GanvNodeClass* klass = GANV_NODE_GET_CLASS(node);
- if (klass->resize) {
- klass->resize(node);
- }
-}
-
-static inline void
-ganv_node_disconnect(GanvNode* node)
-{
- GANV_NODE_GET_CLASS(node)->disconnect(node);
-}
+ double y);
+
+void
+ganv_node_resize(GanvNode* node);
+
+void
+ganv_node_disconnect(GanvNode* node);
G_END_DECLS
diff --git a/ganv/port.h b/ganv/port.h
index 454c4a8..1ae7673 100644
--- a/ganv/port.h
+++ b/ganv/port.h
@@ -22,28 +22,21 @@ struct _GanvModule;
G_BEGIN_DECLS
-#define GANV_TYPE_PORT (ganv_port_get_type())
-#define GANV_PORT(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_PORT, GanvPort))
-#define GANV_PORT_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_PORT, GanvPortClass))
-#define GANV_IS_PORT(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_PORT))
-#define GANV_IS_PORT_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_PORT))
-#define GANV_PORT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_PORT, GanvPortClass))
+#define GANV_TYPE_PORT (ganv_port_get_type())
+#define GANV_PORT(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_PORT, GanvPort))
+#define GANV_PORT_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_PORT, GanvPortClass))
+#define GANV_IS_PORT(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_PORT))
+#define GANV_IS_PORT_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_PORT))
+#define GANV_PORT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_PORT, GanvPortClass))
+#define GANV_PORT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GANV_TYPE_PORT, GanvPortImpl))
typedef struct _GanvPortClass GanvPortClass;
-
-typedef struct {
- GanvBox* rect;
- float value;
- float min;
- float max;
- gboolean is_toggle;
-} GanvPortControl;
+typedef struct _GanvPortImpl GanvPortImpl;
struct _GanvPort
{
- GanvBox box;
- GanvPortControl* control;
- gboolean is_input;
+ GanvBox box;
+ GanvPortImpl* impl;
};
struct _GanvPortClass {
@@ -86,39 +79,14 @@ ganv_port_get_natural_width(const GanvPort* port);
* ganv_port_get_module:
* Return value: (transfer none): The module @a port is on.
*/
-GanvModule*
-ganv_port_get_module(const GanvPort* port);
+GanvModule* ganv_port_get_module(const GanvPort* port);
-static inline float
-ganv_port_get_control_value(const GanvPort* port)
-{
- return port->control ? port->control->value : 0.0f;
-}
+float ganv_port_get_control_value(const GanvPort* port);
+float ganv_port_get_control_min(const GanvPort* port);
+float ganv_port_get_control_max(const GanvPort* port);
+gboolean ganv_port_is_input(const GanvPort* port);
+gboolean ganv_port_is_output(const GanvPort* port);
-static inline float
-ganv_port_get_control_min(const GanvPort* port)
-{
- return port->control ? port->control->min : 0.0f;
-}
-
-static inline float
-ganv_port_get_control_max(const GanvPort* port)
-{
- return port->control ? port->control->max : 0.0f;
-}
-
-static inline gboolean
-ganv_port_is_input(const GanvPort* port)
-{
- return port->is_input;
-}
-
-static inline gboolean
-ganv_port_is_output(const GanvPort* port)
-{
- return !port->is_input;
-}
-
G_END_DECLS
#endif /* GANV_PORT_H */
diff --git a/ganv/text.h b/ganv/text.h
index 5d0d464..6926ab1 100644
--- a/ganv/text.h
+++ b/ganv/text.h
@@ -18,37 +18,24 @@
#include <libgnomecanvas/libgnomecanvas.h>
-#include <cairo.h>
-
G_BEGIN_DECLS
-#define GANV_TYPE_TEXT (ganv_text_get_type())
-#define GANV_TEXT(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_TEXT, GanvText))
-#define GANV_TEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_TEXT, GanvTextClass))
-#define GANV_IS_TEXT(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_TEXT))
-#define GANV_IS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_TEXT))
-#define GANV_TEXT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_TEXT, GanvTextClass))
+#define GANV_TYPE_TEXT (ganv_text_get_type())
+#define GANV_TEXT(obj) (GTK_CHECK_CAST((obj), GANV_TYPE_TEXT, GanvText))
+#define GANV_TEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST((klass), GANV_TYPE_TEXT, GanvTextClass))
+#define GANV_IS_TEXT(obj) (GTK_CHECK_TYPE((obj), GANV_TYPE_TEXT))
+#define GANV_IS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE((klass), GANV_TYPE_TEXT))
+#define GANV_TEXT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS((obj), GANV_TYPE_TEXT, GanvTextClass))
+#define GANV_TEXT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), GANV_TYPE_TEXT, GanvTextImpl))
typedef struct _GanvText GanvText;
typedef struct _GanvTextClass GanvTextClass;
-
-typedef struct
-{
- double x;
- double y;
- double width;
- double height;
-} GanvTextCoords;
+typedef struct _GanvTextImpl GanvTextImpl;
struct _GanvText
{
- GnomeCanvasItem item;
- cairo_surface_t* surface;
- char* text;
- GanvTextCoords coords;
- GanvTextCoords old_coords;
- guint color;
- gboolean needs_layout;
+ GnomeCanvasItem item;
+ GanvTextImpl* impl;
};
struct _GanvTextClass {
diff --git a/ganv/types.h b/ganv/types.h
index aee8f8e..f669fbc 100644
--- a/ganv/types.h
+++ b/ganv/types.h
@@ -22,6 +22,7 @@ typedef struct _GanvItem GanvItem;
typedef struct _GanvModule GanvModule;
typedef struct _GanvNode GanvNode;
typedef struct _GanvPort GanvPort;
+typedef struct _GanvBox GanvBox;
-#endif // GANV_TYPES_H
+#endif /* GANV_TYPES_H */