diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-04-06 11:09:00 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-04-06 11:09:00 (GMT) |
commit | 944225261e872785366d1df5377f59ea917a2195 (patch) | |
tree | fb6d2c12e22f368808bfb92557d647b1e5688a8a /src/gtkext/graph/nodes | |
parent | e108e192582aa1dbe020dfbc09bee5e6ab2cc534 (diff) |
Done some refactoring in order to make the code more GObject-friendly.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@506 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/graph/nodes')
-rw-r--r-- | src/gtkext/graph/nodes/flow.c | 13 | ||||
-rw-r--r-- | src/gtkext/graph/nodes/flow.h | 11 | ||||
-rw-r--r-- | src/gtkext/graph/nodes/virtual.c | 32 | ||||
-rw-r--r-- | src/gtkext/graph/nodes/virtual.h | 11 |
4 files changed, 28 insertions, 39 deletions
diff --git a/src/gtkext/graph/nodes/flow.c b/src/gtkext/graph/nodes/flow.c index d691da5..5ff21c9 100644 --- a/src/gtkext/graph/nodes/flow.c +++ b/src/gtkext/graph/nodes/flow.c @@ -130,12 +130,18 @@ G_DEFINE_TYPE(GFlowNode, g_flow_node, G_TYPE_GRAPH_NODE); static void g_flow_node_class_init(GFlowNodeClass *klass) { GObjectClass *object; /* Autre version de la classe */ + GGraphNodeClass *node_class; /* Version parente de la classe*/ object = G_OBJECT_CLASS(klass); + node_class = G_GRAPH_NODE_CLASS(klass); object->dispose = (GObjectFinalizeFunc/* ! */)g_flow_node_dispose; object->finalize = (GObjectFinalizeFunc)g_flow_node_finalize; + node_class->get_rank = (get_node_rank_fc)g_flow_node_get_rank; + node_class->prepare_x = (node_prepare_x_fc)g_flow_node_prepare_x_line; + node_class->visit = (visit_flow_nodes_fc)g_flow_node_visit_flow_nodes; + } @@ -153,13 +159,6 @@ static void g_flow_node_class_init(GFlowNodeClass *klass) static void g_flow_node_init(GFlowNode *node) { - GGraphNode *base; /* Version basique */ - - base = G_GRAPH_NODE(node); - - base->get_rank = (get_node_rank_fc)g_flow_node_get_rank; - base->prepare_x = (node_prepare_x_fc)g_flow_node_prepare_x_line; - base->visit = (visit_flow_nodes_fc)g_flow_node_visit_flow_nodes; } diff --git a/src/gtkext/graph/nodes/flow.h b/src/gtkext/graph/nodes/flow.h index 4e34481..413a8f2 100644 --- a/src/gtkext/graph/nodes/flow.h +++ b/src/gtkext/graph/nodes/flow.h @@ -35,11 +35,12 @@ typedef struct _GGraphLayout GGraphLayout; -#define G_TYPE_FLOW_NODE g_flow_node_get_type() -#define G_FLOW_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_flow_node_get_type(), GFlowNode)) -#define G_IS_FLOW_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_flow_node_get_type())) -#define G_FLOW_NODE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_flow_node_get_type(), GFlowNodeIface)) -#define G_FLOW_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_FLOW_NODE, GFlowNodeClass)) +#define G_TYPE_FLOW_NODE (g_flow_node_get_type()) +#define G_FLOW_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_FLOW_NODE, GFlowNode)) +#define G_FLOW_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_FLOW_NODE, GFlowNodeClass)) +#define G_IS_FLOW_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_FLOW_NODE)) +#define G_IS_FLOW_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FLOW_NODE)) +#define G_FLOW_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_FLOW_NODE, GFlowNodeClass)) /* Type d'un accrochage pour lien */ diff --git a/src/gtkext/graph/nodes/virtual.c b/src/gtkext/graph/nodes/virtual.c index cb46aee..894c6b6 100644 --- a/src/gtkext/graph/nodes/virtual.c +++ b/src/gtkext/graph/nodes/virtual.c @@ -85,9 +85,6 @@ struct _GVirtualNode GVirtualBlock *block; /* Bloc virtuel associé */ - gint x; /* Abscisse du noeud */ - gint y; /* Ordonnée du noeud */ - GGraphNode **children; /* Noeuds englobés */ size_t count; /* Quantité de ces noeuds */ virtual_level *levels; /* Différents étages de noeuds */ @@ -245,11 +242,6 @@ static void extend_vertical_links_spans(vert_links *links, const reserved_vspan - - - - - /* ---------------------------------------------------------------------------------- */ /* REPRESENTATIONS DES GROUPES LOGIQUES */ /* ---------------------------------------------------------------------------------- */ @@ -274,12 +266,22 @@ G_DEFINE_TYPE(GVirtualNode, g_virtual_node, G_TYPE_GRAPH_NODE); static void g_virtual_node_class_init(GVirtualNodeClass *klass) { GObjectClass *object; /* Autre version de la classe */ + GGraphNodeClass *node_class; /* Version parente de la classe*/ object = G_OBJECT_CLASS(klass); + node_class = G_GRAPH_NODE_CLASS(klass); object->dispose = (GObjectFinalizeFunc/* ! */)g_virtual_node_dispose; object->finalize = (GObjectFinalizeFunc)g_virtual_node_finalize; + node_class->get_rank = (get_node_rank_fc)g_virtual_node_get_rank; + node_class->reset_pos = (node_reset_pos_fc)g_virtual_node_reset_position; + node_class->prepare_x = (node_prepare_x_fc)g_virtual_node_prepare_x_line; + node_class->apply_pos = (node_apply_pos_fc)g_virtual_node_apply_position; + node_class->set_pos = (node_set_pos_fc)g_virtual_node_set_position; + node_class->visit = (visit_flow_nodes_fc)g_virtual_node_visit_flow_nodes; + node_class->contain = (find_container_fc)g_virtual_node_find_container; + } @@ -297,20 +299,6 @@ static void g_virtual_node_class_init(GVirtualNodeClass *klass) static void g_virtual_node_init(GVirtualNode *node) { - GGraphNode *base; /* Version basique */ - - base = G_GRAPH_NODE(node); - - base->get_rank = (get_node_rank_fc)g_virtual_node_get_rank; - base->reset_pos = (node_reset_pos_fc)g_virtual_node_reset_position; - base->prepare_x = (node_prepare_x_fc)g_virtual_node_prepare_x_line; - base->apply_pos = (node_apply_pos_fc)g_virtual_node_apply_position; - base->set_pos = (node_set_pos_fc)g_virtual_node_set_position; - base->visit = (visit_flow_nodes_fc)g_virtual_node_visit_flow_nodes; - base->contain = (find_container_fc)g_virtual_node_find_container; - - node->x = UNINITIALIZED_NODE_POS; - node->y = UNINITIALIZED_NODE_POS; } diff --git a/src/gtkext/graph/nodes/virtual.h b/src/gtkext/graph/nodes/virtual.h index c496df5..7f32591 100644 --- a/src/gtkext/graph/nodes/virtual.h +++ b/src/gtkext/graph/nodes/virtual.h @@ -36,11 +36,12 @@ typedef size_t vspan_slot_t; #define UNINITIALIZED_VSPAN_SLOT (~((vspan_slot_t)0)) -#define G_TYPE_VIRTUAL_NODE g_virtual_node_get_type() -#define G_VIRTUAL_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_virtual_node_get_type(), GVirtualNode)) -#define G_IS_VIRTUAL_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_virtual_node_get_type())) -#define G_VIRTUAL_NODE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), g_virtual_node_get_type(), GVirtualNodeIface)) -#define G_VIRTUAL_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_VIRTUAL_NODE, GVirtualNodeClass)) +#define G_TYPE_VIRTUAL_NODE (g_virtual_node_get_type()) +#define G_VIRTUAL_NODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_VIRTUAL_NODE, GVirtualNode)) +#define G_VIRTUAL_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_VIRTUAL_NODE, GVirtualNodeClass)) +#define G_IS_VIRTUAL_NODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_VIRTUAL_NODE)) +#define G_IS_VIRTUAL_NODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_VIRTUAL_NODE)) +#define G_VIRTUAL_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_VIRTUAL_NODE, GVirtualNodeClass)) /* Encapsulation graphique d'un bloc virtuel (instance) */ |