summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/nodes/virtual.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext/graph/nodes/virtual.c')
-rw-r--r--src/gtkext/graph/nodes/virtual.c106
1 files changed, 8 insertions, 98 deletions
diff --git a/src/gtkext/graph/nodes/virtual.c b/src/gtkext/graph/nodes/virtual.c
index e04ff5d..cb46aee 100644
--- a/src/gtkext/graph/nodes/virtual.c
+++ b/src/gtkext/graph/nodes/virtual.c
@@ -24,6 +24,7 @@
#include "virtual.h"
+#include <assert.h>
#include <malloc.h>
#include <sys/param.h>
@@ -365,7 +366,6 @@ static void g_virtual_node_finalize(GVirtualNode *node)
/******************************************************************************
* *
* Paramètres : block = bloc virtuel représenté graphiquement. *
-* view = morceau d'affichage à représenter. *
* *
* Description : Encapsule graphiquement un bloc virtuel. *
* *
@@ -489,12 +489,14 @@ static void g_virtual_node_apply_position(GVirtualNode *node)
}
/* Espace pour les liens remontants */
+
if (node->left_count > 0)
offset = EDGE_SLOT_HORIZ_MARGIN + EDGE_HORIZONTAL_MIN_SEP * (node->left_count - 1);
else
offset = 0;
/* Ajout du décallage le plus grand */
+
offset += -min;
/* Traitement des sous-noeuds */
@@ -543,14 +545,14 @@ static void g_virtual_node_apply_x_line(GVirtualNode *node)
{
level = &node->levels[i];
- /* Si l'ensemble de l'étage doit être aligné */
+ /* Si l'ensemble de l'étage doit être centré */
if (level->children[0]->pending_flag == PPF_NONE)
{
width_sum = 0;
for (j = 0; j < level->count; j++)
{
- /* BUG_ON(level->children[j]->pending_flag != PPF_NONE); */
+ assert(level->children[j]->pending_flag == PPF_NONE);
g_graph_node_apply_position(level->children[j]);
width_sum += level->children[j]->alloc.width;
@@ -698,98 +700,6 @@ static void g_virtual_node_set_position(GVirtualNode *node, gint x)
/******************************************************************************
* *
-* Paramètres : node = noeud graphique à consulter. *
-* *
-* Description : Indique l'espace requis pour un noeud d'encapsulation. *
-* *
-* Retour : Espace constitué, entièrement ou non. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static GtkAllocation g_virtual_node_get_allocation(const GVirtualNode *node)
-{
- GtkAllocation result; /* Valeurs à retourner */
- gint margins; /* Bordures gauche et droite */
- unsigned int last_rank; /* Détection de saut de rangs */
- size_t vert_count; /* Quantité à la verticale */
- gint rank_width; /* Largeur d'un rang donné */
- gint rank_height; /* Hauteur d'un rang donné */
- size_t i; /* Boucle de parcours */
- GtkAllocation alloc; /* Allocation d'un sous-noeud */
-
- result.x = node->x;
- result.y = node->y;
-
- result.width = 0;
- margins = 0;
- if (node->left_count > 0)
- {
- margins += EDGE_SLOT_HORIZ_MARGIN;
- margins += (node->left_count - 1) * EDGE_HORIZONTAL_MIN_SEP;
- }
- if (node->right_count > 0)
- {
- margins += EDGE_SLOT_HORIZ_MARGIN;
- margins += (node->right_count - 1) * EDGE_HORIZONTAL_MIN_SEP;
- }
- result.height = 0;
-
- last_rank = -1;
-
- vert_count = 0;
-
- rank_width = 0;
- rank_height = 0;
-
- for (i = 0; i < node->count; i++)
- {
- alloc = g_graph_node_get_allocation(node->children[i]);
-
- /* Prise en compte de l'étage précédent */
- if (last_rank != g_graph_node_get_rank(node->children[i]))
- {
- last_rank = g_graph_node_get_rank(node->children[i]);
-
- result.width = MAX(result.width, rank_width);
- result.height += rank_height;
-
- rank_width = 0;
- rank_height = 0;
-
- vert_count++;
-
- }
-
- /* Mise à jour de l'étage courant */
-
- if (node->x == UNINITIALIZED_NODE_POS)
- {
- rank_width += alloc.width;
- if (rank_width > 0) rank_width += NODE_LEFT_MARGIN;
- }
- else
- rank_width = MAX(alloc.x + alloc.width - node->x, rank_width);
-
- rank_height = MAX(rank_height, alloc.height);
-
- }
-
- result.width = MAX(result.width, rank_width);
-
- result.width += margins;
-
- if (vert_count > 1)
- result.height += (vert_count - 1) * NODE_TOP_MARGIN;
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : node = noeud graphique démarrant la visite. *
* callback = ensemble de blocs à parcourir. *
* data = donnée utilisateur à associer au parcours. *
@@ -1026,14 +936,14 @@ gint g_virtual_node_get_x_for_vspan_slot(const GVirtualNode *node, vspan_slot_t
gint result; /* Position à retourner */
GtkAllocation alloc; /* Taille totale requise */
- alloc = g_virtual_node_get_allocation(node);
+ alloc = G_GRAPH_NODE(node)->alloc;
if (left)
{
/*BUG_ON(slot >= node->left_count) */
- result = (node->left_count - 1) * EDGE_HORIZONTAL_MIN_SEP/* + EDGE_SLOT_HORIZ_MARGIN*/;
- result -= (slot * EDGE_HORIZONTAL_MIN_SEP/* + EDGE_SLOT_HORIZ_MARGIN*/);
+ result = -(node->left_count - 1) * EDGE_HORIZONTAL_MIN_SEP/* + EDGE_SLOT_HORIZ_MARGIN*/;
+ result += (slot * EDGE_HORIZONTAL_MIN_SEP/* + EDGE_SLOT_HORIZ_MARGIN*/);
result += alloc.x;