diff options
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkbufferview.c | 41 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel-int.h | 2 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel.c | 10 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel.h | 2 |
4 files changed, 30 insertions, 25 deletions
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index 2032547..2d1b51c 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -80,7 +80,7 @@ static const vmpa2t *gtk_buffer_view_get_caret_location(const GtkBufferView *); static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *, const vmpa2t *, gint *, gint *, ScrollPositionTweak); /* Fournit des éléments liés à la position courante dans la vue. */ -static bool gtk_buffer_view_get_position(const GtkBufferView *, GBufferLine **, GBufferSegment **); +static bool gtk_buffer_view_get_position(const GtkBufferView *, GBufferLine **, GObject **); /* Place en cache un rendu destiné à l'aperçu graphique rapide. */ static void gtk_buffer_view_cache_glance(GtkBufferView *, cairo_t *, const GtkAllocation *, double); @@ -557,11 +557,11 @@ static gboolean gtk_buffer_view_key_press(GtkWidget *widget, GdkEventKey *event) static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y, gboolean keyboard, GtkTooltip *tooltip) { + gboolean result; /* Bilan à retourner */ GtkBufferView *view; /* Autre version du composant */ gint real_x; /* Abscisse absolue réelle */ gint real_y; /* Ordonnée absolue réelle */ GBufferLine *line; /* Ligne en cours de survol */ - GBufferSegment *segment; /* Segment actif s'il existe */ GObject *creator; /* Créateur à l'orgine du seg. */ virt_t virt; /* Adresse virtuelle */ vmpa2t addr; /* Adresse de destination */ @@ -579,6 +579,8 @@ static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y, if (keyboard) return FALSE; + result = FALSE; + view = GTK_BUFFER_VIEW(widget); /* Récupération de la destination pointée */ @@ -587,14 +589,11 @@ static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y, real_y = y; gtk_view_panel_compute_real_coord(GTK_VIEW_PANEL(view), &real_x, &real_y); - line = g_buffer_view_find_line_and_segment_at(view->buffer_view, + line = g_buffer_view_find_line_and_creator_at(view->buffer_view, &real_x, real_y, NULL, - GTK_VIEW_PANEL(view)->display, &segment); - - if (line == NULL || segment == NULL) goto no_tooltip; + GTK_VIEW_PANEL(view)->display, &creator); - creator = g_buffer_segment_get_creator(segment); - if (creator == NULL) goto no_tooltip; + if (line == NULL || creator == NULL) goto no_tooltip; /** * On fait le pari de reposer uniquement sur des adresses virtuelles ! @@ -677,14 +676,20 @@ static gboolean gtk_buffer_view_query_tooltip(GtkWidget *widget, gint x, gint y, /* Impression finale */ + result = TRUE; + gtk_tooltip_set_markup(tooltip, markup); free(markup); - return TRUE; - no_tooltip: - return FALSE; + if (creator != NULL) + g_object_unref(creator); + + if (line != NULL) + g_object_unref(G_OBJECT(line)); + + return result; } @@ -862,7 +867,7 @@ static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *view, c * * * Paramètres : view = composant GTK à consulter. * * line = ligne de tampon où se trouve le curseur. [OUT] * -* segment = eventuel segment de ligne actif. [OUT] * +* creator = instance à l'origine de la représentation. [OUT] * * * * Description : Fournit des éléments liés à la position courante dans la vue.* * * @@ -872,20 +877,20 @@ static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *view, c * * ******************************************************************************/ -static bool gtk_buffer_view_get_position(const GtkBufferView *view, GBufferLine **line, GBufferSegment **segment) +static bool gtk_buffer_view_get_position(const GtkBufferView *view, GBufferLine **line, GObject **creator) { - GBufferSegment *seg; /* Segment à récupérer */ + GObject *obj; /* Elément à récupérer */ /* Si aucune position n'est définie... */ if (view->caret_addr == NULL) return false; - *line = g_buffer_view_find_line_and_segment_at(view->buffer_view, + *line = g_buffer_view_find_line_and_creator_at(view->buffer_view, (gint []){ view->caret.x }, view->caret.y, NULL, - GTK_VIEW_PANEL(view)->display, &seg); + GTK_VIEW_PANEL(view)->display, &obj); - if (segment != NULL) - *segment = seg; + if (creator != NULL) + *creator = obj; return (line != NULL); diff --git a/src/gtkext/gtkviewpanel-int.h b/src/gtkext/gtkviewpanel-int.h index f827b2c..5e24bec 100644 --- a/src/gtkext/gtkviewpanel-int.h +++ b/src/gtkext/gtkviewpanel-int.h @@ -58,7 +58,7 @@ typedef const vmpa2t * (* get_caret_location_fc) (const GtkViewPanel *); typedef bool (* get_addr_coordinates_fc) (const GtkViewPanel *, const vmpa2t *, gint *, gint *, ScrollPositionTweak); /* Fournit des éléments liés à la position courante dans la vue. */ -typedef bool (* get_view_position_fc) (const GtkViewPanel *, GBufferLine **, GBufferSegment **); +typedef bool (* get_view_position_fc) (const GtkViewPanel *, GBufferLine **, GObject **); /* Déplace le curseur à un emplacement défini. */ typedef bool (* move_caret_to_fc) (GtkViewPanel *, gint, gint); diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c index a39ea24..b7b58d9 100644 --- a/src/gtkext/gtkviewpanel.c +++ b/src/gtkext/gtkviewpanel.c @@ -1021,24 +1021,24 @@ void gtk_view_panel_request_move(GtkViewPanel *panel, const vmpa2t *addr) * * ******************************************************************************/ -bool gtk_view_panel_get_position(const GtkViewPanel *panel, GBufferLine **line, GBufferSegment **segment) +bool gtk_view_panel_get_position(const GtkViewPanel *panel, GBufferLine **line, GObject **creator) { bool result; /* Bilan de l'opération */ *line = NULL; - if (segment != NULL) *segment = NULL; + if (creator != NULL) *creator = NULL; if (GTK_VIEW_PANEL_GET_CLASS(panel)->get_position == NULL) return false; - result = GTK_VIEW_PANEL_GET_CLASS(panel)->get_position(panel, line, segment); + result = GTK_VIEW_PANEL_GET_CLASS(panel)->get_position(panel, line, creator); if (result) { g_object_ref(G_OBJECT(*line)); - if (segment != NULL && *segment != NULL) - g_object_ref(G_OBJECT(*segment)); + if (creator != NULL && *creator != NULL) + g_object_ref(G_OBJECT(*creator)); } diff --git a/src/gtkext/gtkviewpanel.h b/src/gtkext/gtkviewpanel.h index 0943dd1..9e198ac 100644 --- a/src/gtkext/gtkviewpanel.h +++ b/src/gtkext/gtkviewpanel.h @@ -95,7 +95,7 @@ void _gtk_view_panel_scroll_to_address(GtkViewPanel *, const vmpa2t *, ScrollPos void gtk_view_panel_request_move(GtkViewPanel *, const vmpa2t *); /* Fournit des éléments liés à la position courante dans la vue. */ -bool gtk_view_panel_get_position(const GtkViewPanel *, GBufferLine **, GBufferSegment **); +bool gtk_view_panel_get_position(const GtkViewPanel *, GBufferLine **, GObject **); /* Place en cache un rendu destiné à l'aperçu graphique rapide. */ void gtk_view_panel_cache_glance(GtkViewPanel *, cairo_t *, const GtkAllocation *, double); |