diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-02-25 21:57:42 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-02-25 21:57:42 (GMT) |
commit | 4724b73c5161140222cab3c61bb5b3d0c8dde360 (patch) | |
tree | d341f43bacdad465ddae8c8b6c076a573c53e43d /src/gtkext/gtkbufferview.c | |
parent | 9ff8702e5c51c7916e239caee13b974dccff6413 (diff) |
Provided tweaks about positions when looking for address coordinates.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@480 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/gtkbufferview.c')
-rw-r--r-- | src/gtkext/gtkbufferview.c | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index f179845..30cf075 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -59,7 +59,7 @@ static void gtk_buffer_view_compute_requested_size(GtkBufferView *, gint *, gint static void gtk_buffer_view_compute_scroll_inc(GtkBufferView *, gint, GtkOrientation, gdouble *, gdouble *); /* Indique la position d'affichage d'une adresse donnée. */ -static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *, const vmpa2t *, gint *, gint *); +static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *, const vmpa2t *, gint *, gint *, ScrollPositionTweak); /* Place en cache un rendu destiné à l'aperçu graphique rapide. */ static void gtk_buffer_view_cache_glance(GtkBufferView *, cairo_t *, const GtkAllocation *, double); @@ -474,7 +474,7 @@ static gboolean gtk_buffer_view_key_press(GtkWidget *widget, GdkEventKey *event) printf("ctrl ? %d -- keyval = %d -->> %d\n", ctrl, event->keyval, result); - if (addr != NULL) gtk_view_panel_scroll_to_address(pview, addr); + if (addr != NULL) gtk_view_panel_scroll_to_address(pview, addr, SPT_RAW); printf("\n"); @@ -552,10 +552,11 @@ static void gtk_buffer_view_compute_scroll_inc(GtkBufferView *view, gint size, G /****************************************************************************** * * -* Paramètres : view = composant GTK à consulter. * -* addr = adresse à présenter à l'écran. * -* x = position horizontale au sein du composant. [OUT] * -* y = position verticale au sein du composant. [OUT] * +* Paramètres : view = composant GTK à consulter. * +* addr = adresse à présenter à l'écran. * +* x = position horizontale au sein du composant. [OUT] * +* y = position verticale au sein du composant. [OUT] * +* tweak = adaptation finale à effectuer. * * * * Description : Indique la position d'affichage d'une adresse donnée. * * * @@ -565,9 +566,42 @@ static void gtk_buffer_view_compute_scroll_inc(GtkBufferView *view, gint size, G * * ******************************************************************************/ -static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *view, const vmpa2t *addr, gint *x, gint *y) +static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *view, const vmpa2t *addr, gint *x, gint *y, ScrollPositionTweak tweak) { - return g_buffer_view_get_address_coordinates(view->buffer_view, addr, x, y); + bool result; /* Bilan à remonter */ + bool need_code; /* Recherche plus raffinée */ + int height; /* Hauteur allouée */ + + need_code = (tweak == SPT_BOTTOM); + + result = g_buffer_view_get_address_coordinates(view->buffer_view, addr, x, y, need_code); + + if (result) + { + height = gtk_widget_get_allocated_height(GTK_WIDGET(view)); + + switch (tweak) + { + case SPT_RAW: + break; + + case SPT_TOP: + break; + + case SPT_CENTER: + *y -= (height / 2); + break; + + case SPT_BOTTOM: + *y -= height; + *y += g_buffer_view_get_line_height(view->buffer_view); + break; + + } + + } + + return result; } |