summaryrefslogtreecommitdiff
path: root/src/gtkext/graph/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext/graph/node.c')
-rw-r--r--src/gtkext/graph/node.c327
1 files changed, 0 insertions, 327 deletions
diff --git a/src/gtkext/graph/node.c b/src/gtkext/graph/node.c
index ec09941..439d4e7 100644
--- a/src/gtkext/graph/node.c
+++ b/src/gtkext/graph/node.c
@@ -40,10 +40,6 @@
/* -------------------------- GESTION DES NOEUDS A L'UNITE -------------------------- */
-/* Taille maximale des lignes de description de noeud */
-#define NODE_DESC_LEN 128
-
-
/* Initialise la classe des intermédiaires avec les noeuds dot. */
static void g_graph_node_class_init(GGraphNodeClass *);
@@ -82,52 +78,12 @@ G_DEFINE_TYPE(GGraphNode, g_graph_node, G_TYPE_OBJECT);
static void g_graph_node_class_init(GGraphNodeClass *klass)
{
GObjectClass *object; /* Autre version de la classe */
- GdkScreen *screen; /* Ecran par défaut */
- gint width; /* Largeur d'écran en pixels */
- gint height; /* Hauteur d'écran en pixels */
- gint width_mm; /* Largeur d'écran en mm. */
- gint height_mm; /* Hauteur d'écran en mm. */
object = G_OBJECT_CLASS(klass);
object->dispose = (GObjectFinalizeFunc/* ! */)g_graph_node_dispose;
object->finalize = (GObjectFinalizeFunc)g_graph_node_finalize;
- /* Calcul des résolutions */
-
- screen = gdk_screen_get_default();
-
- width = gdk_screen_get_width(screen);
- height = gdk_screen_get_height(screen);
-
- width_mm = gdk_screen_get_width_mm(screen);
- height_mm = gdk_screen_get_height_mm(screen);
-
- /**
- * Il y a 2.54 centimètres, soit 25.4 millimètres, dans un pouce.
- * On a donc :
- *
- * dpi = N pixels / (M millimètres / (25.4 millimètres / 1 pouce))
- * = N pixels / (M pouces / 25.4)
- * = N * 25.4 pixels / M pouces
- *
- */
-
- if (width_mm > 0 && height_mm > 0)
- {
- klass->dpi_x = (width * 25.4) / (double)width_mm;
- klass->dpi_y = (height * 25.4) / (double)height_mm;
- }
- else
- {
- klass->dpi_x = 96;
- klass->dpi_y = 96;
- }
-
-
- klass->dpi_x = 72;
- klass->dpi_y = 72;
-
}
@@ -165,8 +121,6 @@ static void g_graph_node_init(GGraphNode *node)
static void g_graph_node_dispose(GGraphNode *node)
{
- g_object_unref(G_OBJECT(node->view));
-
G_OBJECT_CLASS(g_graph_node_parent_class)->dispose(G_OBJECT(node));
}
@@ -193,38 +147,6 @@ static void g_graph_node_finalize(GGraphNode *node)
/******************************************************************************
* *
-* Paramètres : view = morceau d'affichage à représenter. *
-* *
-* Description : Constitue un intermédiaire entre un noeud dot et du code. *
-* *
-* Retour : Adresse de la structure mise en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GGraphNode *g_graph_node_new(GtkWidget *view)
-{
- GGraphNode *result; /* Structure à retourner */
-
- result = g_object_new(G_TYPE_GRAPH_NODE, NULL);
-
- result->view = view;
- g_object_ref(G_OBJECT(view));
-
- snprintf(result->name, NODE_NAME_LEN, "_%p", result->view);
-
- return result;
-
-}
-
-
-
-
-
-
-/******************************************************************************
-* *
* Paramètres : node = noeud graphique à consulter. *
* *
* Description : Fournit le rang du noeud dans le graphique. *
@@ -555,183 +477,6 @@ GGraphNode *g_graph_node_find_container_at_same_level(GGraphNode *nodes, GGraphN
-
-
-
-/******************************************************************************
-* *
-* Paramètres : node = intermédiaire à consulter. *
-* rank = description pour dot à compléter. *
-* *
-* Description : Inscrit le noeud au rang donné. *
-* *
-* Retour : Description dûment complétée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-char *g_graph_node_append_name_to_rank(const GGraphNode *node, char *rank)
-{
- char buffer[NODE_DESC_LEN]; /* Tampon pour les commandes */
-
- snprintf(buffer, NODE_DESC_LEN, " %s;", node->name);
-
- if (rank == NULL)
- rank = strdup(buffer);
- else
- rank = stradd(rank, buffer);
-
- return rank;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : node = intermédiaire à consulter. *
-* cmds = description pour dot à compléter. *
-* level = profondeur du noeud pour l'indentation. *
-* *
-* Description : Déclare l'intermédiaire en tant que noeud pour dot. *
-* *
-* Retour : Description dûment complétée. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-char *g_graph_node_register_for_dot(const GGraphNode *node, char *cmds, unsigned int level)
-{
- GtkRequisition requisition; /* Taille à l'écran requise */
- unsigned int i; /* Boucle de parcours */
- char buffer[NODE_DESC_LEN]; /* Tampon pour les commandes */
-
- gtk_widget_get_preferred_size(node->view, NULL, &requisition);
-
- for (i = 0; i < level; i++)
- cmds = stradd(cmds, DOT_IDENT);
-
- snprintf(buffer, NODE_DESC_LEN, "subgraph cluster%s {\n", node->name);
- cmds = stradd(cmds, buffer);
-
- for (i = 0; i < (level + 1); i++)
- cmds = stradd(cmds, DOT_IDENT);
-
- cmds = stradd(cmds, "style=invisible;\n");
-
- for (i = 0; i < (level + 1); i++)
- cmds = stradd(cmds, DOT_IDENT);
-
- cmds = stradd(cmds, node->name);
- cmds = stradd(cmds, " [shape=box, fixedsize ");
-
- snprintf(buffer, NODE_DESC_LEN, ", width=\"%g\"",
- requisition.width / G_GRAPH_NODE_GET_CLASS(node)->dpi_x);
- cmds = stradd(cmds, buffer);
-
- snprintf(buffer, NODE_DESC_LEN, ", height=\"%g\"",
- requisition.height / G_GRAPH_NODE_GET_CLASS(node)->dpi_y);
- cmds = stradd(cmds, buffer);
-
- cmds = stradd(cmds, "];\n");
-
- for (i = 0; i < level; i++)
- cmds = stradd(cmds, DOT_IDENT);
-
- cmds = stradd(cmds, "}\n");
-
- return cmds;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : node = intermédiaire à consulter. *
-* view = support de destination. *
-* x = abscisse du point d'intégration. *
-* y = ordonnée du point d'intégration. *
-* *
-* Description : Place le morceau de code de l'intermédiaire à l'écran. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_graph_node_place_old(GGraphNode *node, GtkGraphView *view, gint x, gint y)
-{
- GtkRequisition requisition; /* Taille à l'écran actuelle */
-
- gtk_widget_get_preferred_size(node->view, NULL, &requisition);
-
- x -= requisition.width / 2;
- y -= requisition.height / 2;
-
- node->alloc.x = x;
- node->alloc.y = y;
- node->alloc.width = requisition.width;
- node->alloc.height = requisition.height;
-
- gtk_graph_view_put(view, node->view, &node->alloc);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : node = intermédiaire à consulter. *
-* x = abscisse du point à relier. *
-* y = ordonnée du point à relier. *
-* points = liste de points à mettre à jour. [OUT] *
-* count = taille de cette même liste. [OUT] *
-* *
-* Description : Etablit une jonction ferme avec un noeud. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_graph_node_connect(const GGraphNode *node, gint x, gint y, GdkPoint **points, size_t *count)
-{
- const GtkAllocation *alloc; /* Emplacement du bloc rattaché*/
-
- alloc = &node->alloc;
-
- *points = (GdkPoint *)realloc(*points, ++(*count) * sizeof(GdkPoint));
-
- /* Si le point est sur la gauche... */
- if (x < alloc->x)
- (*points)[*count - 1].x = alloc->x;
-
- /* Ou s'il est sur la droite... */
- else if (x > (alloc->x + alloc->width))
- (*points)[*count - 1].x = alloc->x + alloc->width;
-
- /* Ou s'il se trouve déjà bien placé... */
- else
- (*points)[*count - 1].x = x;
-
- /* Si le point est au dessus... */
- if (y < alloc->y)
- (*points)[*count - 1].y = alloc->y;
-
- /* Ou s'il est en dessous... */
- else if (y > (alloc->y + alloc->height))
- (*points)[*count - 1].y = alloc->y + alloc->height;
-
- /* Ou s'il se trouve déjà bien placé... */
- else
- (*points)[*count - 1].y = y;
-
-}
-
-
-
/* ---------------------------------------------------------------------------------- */
/* MANIPULATION D'ENSEMBLES DE NOEUDS */
/* ---------------------------------------------------------------------------------- */
@@ -879,75 +624,3 @@ GGraphNode *find_node_for_instruction(GGraphNode *nodes, GArchInstruction *instr
return result;
}
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : nodes = liste de noeuds à parcourir. *
-* count = taille de la liste. *
-* addrt = adresse de début du noeud recherché. *
-* *
-* Description : Recherche un noeud donné dans une série de noeuds. *
-* *
-* Retour : Noeud trouvé ou NULL si aucun. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GGraphNode *find_graph_node_by_start_address(GGraphNode **nodes, size_t count, const vmpa2t *addr)
-{
- GGraphNode *result; /* Trouvaille à remonter */
- size_t i; /* Boucle de parcours */
- GBufferView *buffer; /* Tampon d'une partie de code */
- vmpa2t start; /* Adresse de départ du tampon */
-
- result = NULL;
-
- for (i = 0; i < count && result == NULL; i++)
- {
- buffer = gtk_buffer_view_get_buffer(GTK_BUFFER_VIEW(nodes[i]->view));
- g_buffer_view_get_restrictions(buffer, &start, NULL);
-
- if (cmp_vmpa(&start, addr) == 0)
- result = nodes[i];
-
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : nodes = liste de noeuds à parcourir. *
-* count = taille de la liste. *
-* target = nom du noeud recherché. *
-* *
-* Description : Recherche un noeud donné dans une série de noeuds. *
-* *
-* Retour : Noeud trouvé ou NULL si aucun. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GGraphNode *find_graph_node_by_name(GGraphNode **nodes, size_t count, const char *target)
-{
- GGraphNode *result; /* Trouvaille à remonter */
- size_t i; /* Boucle de parcours */
-
- result = NULL;
-
- for (i = 0; i < count && result == NULL; i++)
- if (strcmp(nodes[i]->name, target) == 0)
- result = nodes[i];
-
- return result;
-
-}