summaryrefslogtreecommitdiff
path: root/src/gtkext/gtkgraphview.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-06-14 22:55:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-06-14 22:55:24 (GMT)
commitc987ca944052019957d3f31d69c679ed5ad994f2 (patch)
tree44f9c7a7f94925814ebebce50388935c83b34e88 /src/gtkext/gtkgraphview.c
parentc1b22ec0aa497a212ef897f3f8fffedf07cd45a6 (diff)
Been able to move the caret when scrolling to a given address.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@541 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/gtkgraphview.c')
-rw-r--r--src/gtkext/gtkgraphview.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c
index 1b18c64..ac78981 100644
--- a/src/gtkext/gtkgraphview.c
+++ b/src/gtkext/gtkgraphview.c
@@ -86,6 +86,9 @@ static void gtk_graph_view_define_main_address(GtkGraphView *, const vmpa2t *);
/* Indique la position d'affichage d'une adresse donnée. */
static bool gtk_graph_view_get_address_coordinates(const GtkGraphView *, const vmpa2t *addr, gint *x, gint *y, ScrollPositionTweak tweak);
+/* Déplace le curseur à un emplacement défini. */
+static bool gtk_graph_view_move_caret_to(GtkGraphView *, gint, gint);
+
/* Place en cache un rendu destiné à l'aperçu graphique rapide. */
static void gtk_graph_view_cache_glance(GtkGraphView *, cairo_t *, const GtkAllocation *, double);
@@ -129,6 +132,7 @@ static void gtk_graph_view_class_init(GtkGraphViewClass *class)
panel_class->adjust = (adjust_scroll_value_fc)gtk_graph_view_adjust_scroll_value;
panel_class->define = (define_address_fc)gtk_graph_view_define_main_address;
panel_class->get_coordinates = (get_addr_coordinates_fc)gtk_graph_view_get_address_coordinates;
+ panel_class->move_caret_to = (move_caret_to_fc)gtk_graph_view_move_caret_to;
panel_class->cache_glance = (cache_glance_fc)gtk_graph_view_cache_glance;
}
@@ -401,6 +405,50 @@ static bool gtk_graph_view_get_address_coordinates(const GtkGraphView *view, con
/******************************************************************************
* *
+* Paramètres : view = composant GTK à manipuler. *
+* x = abscisse proposée pour le nouvel emplacement. *
+* y = ordonnée proposée pour le nouvel emplacement. *
+* *
+* Description : Déplace le curseur à un emplacement défini. *
+* *
+* Retour : true si un traitement a été effectué, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static bool gtk_graph_view_move_caret_to(GtkGraphView *view, gint x, gint y)
+{
+ bool result; /* Bilan à retourner */
+ size_t i; /* Boucle de parcours */
+ GtkViewPanel *pview; /* Autre vision d'enfance */
+ gint sub_x; /* Abscisse relative à l'enfant*/
+ gint sub_y; /* Ordonnée relative à l'enfant*/
+
+ result = false;
+
+ for (i = 0; i < view->children_count; i++)
+ {
+ if (x < view->allocs[i].x || x >= (view->allocs[i].x + view->allocs[i].width)) continue;
+ if (y < view->allocs[i].y || y >= (view->allocs[i].y + view->allocs[i].height)) continue;
+
+ pview = GTK_VIEW_PANEL(view->children[i]);
+
+ sub_x = x - view->allocs[i].x;
+ sub_y = y - view->allocs[i].y;
+
+ result = GTK_VIEW_PANEL_GET_CLASS(pview)->move_caret_to(pview, sub_x, sub_y);
+ break;
+
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : view = composant GTK à manipuler. *
* cairo = assistant pour la création de rendus. *
* area = taille de la surface réduite à disposition. *