diff options
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkblockview.c | 2 | ||||
-rw-r--r-- | src/gtkext/gtkbufferview-int.h | 7 | ||||
-rw-r--r-- | src/gtkext/gtkbufferview.c | 89 | ||||
-rw-r--r-- | src/gtkext/gtkbufferview.h | 8 | ||||
-rw-r--r-- | src/gtkext/gtkgraphview.c | 2 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel-int.h | 14 | ||||
-rw-r--r-- | src/gtkext/gtkviewpanel.c | 79 |
7 files changed, 99 insertions, 102 deletions
diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c index 2b72ff4..5d14db2 100644 --- a/src/gtkext/gtkblockview.c +++ b/src/gtkext/gtkblockview.c @@ -225,7 +225,7 @@ static gboolean gtk_block_view_button_press_event(GtkBlockView *view, GdkEventBu real_x = event->x; real_y = event->y; - gtk_buffer_view_compute_real_coord(bview, &real_x, &real_y); + gtk_view_panel_compute_real_coord(GTK_VIEW_PANEL(bview), &real_x, &real_y); g_buffer_view_highlight_segments(gtk_buffer_view_get_buffer(bview), real_x, real_y, NULL); diff --git a/src/gtkext/gtkbufferview-int.h b/src/gtkext/gtkbufferview-int.h index 105d32b..944ddc7 100644 --- a/src/gtkext/gtkbufferview-int.h +++ b/src/gtkext/gtkbufferview-int.h @@ -70,12 +70,5 @@ struct _GtkBufferViewClass }; -/* Transcrit les coordonnées à l'écran en coordonnées absolues. */ -void gtk_buffer_view_compute_fake_coord(GtkBufferView *, gint *, gint *); - -/* Transcrit les coordonnées absolues en coordonnées à l'écran. */ -void gtk_buffer_view_compute_real_coord(GtkBufferView *, gint *, gint *); - - #endif /* _GTK_BUFFERVIEW_INT_H */ diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index f54ecff..86a738a 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -287,7 +287,7 @@ static gboolean gtk_buffer_view_button_press(GtkWidget *widget, GdkEventButton * real_x = event->x; real_y = event->y; - gtk_buffer_view_compute_real_coord(view, &real_x, &real_y); + gtk_view_panel_compute_real_coord(GTK_VIEW_PANEL(view), &real_x, &real_y); printf(" !mouse! :: (%g ; %g) -> (%d ; %d)\n", event->x, event->y, @@ -313,54 +313,6 @@ static gboolean gtk_buffer_view_button_press(GtkWidget *widget, GdkEventButton * /****************************************************************************** * * -* Paramètres : view = composant GTK à consulter. * -* event = informations liées à l'événement. * -* * -* Description : Transcrit les coordonnées à l'écran en coordonnées absolues. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void gtk_buffer_view_compute_fake_coord(GtkBufferView *view, gint *x, gint *y) -{ - if (GTK_VIEW_PANEL(view)->hadjustment != NULL) - *x -= gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->hadjustment); - - if (GTK_VIEW_PANEL(view)->vadjustment != NULL) - *y += gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->vadjustment); - -} - - -/****************************************************************************** -* * -* Paramètres : view = composant GTK à consulter. * -* event = informations liées à l'événement. * -* * -* Description : Transcrit les coordonnées absolues en coordonnées à l'écran. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void gtk_buffer_view_compute_real_coord(GtkBufferView *view, gint *x, gint *y) -{ - if (x != NULL && GTK_VIEW_PANEL(view)->hadjustment != NULL) - *x += gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->hadjustment); - - if (y != NULL && GTK_VIEW_PANEL(view)->vadjustment != NULL) - *y += gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->vadjustment); - -} - - -/****************************************************************************** -* * * Paramètres : widget = composant GTK à redessiner. * * cr = contexte graphique associé à l'événement. * * * @@ -420,7 +372,7 @@ static gboolean gtk_buffer_view_draw(GtkWidget *widget, cairo_t *cr) { fake_x = 0; fake_y = 0; - gtk_buffer_view_compute_fake_coord(view, &fake_x, &fake_y); + gtk_view_panel_compute_fake_coord(GTK_VIEW_PANEL(view), &fake_x, &fake_y); g_generic_config_get_value(get_main_configuration(), MPK_SELECTION_LINE, &sel_line); sel_line &= gtk_widget_has_focus(widget); @@ -806,39 +758,6 @@ GBufferView *gtk_buffer_view_get_buffer(const GtkBufferView *view) - - -/* ---------------------------------------------------------------------------------- */ -/* CONVERSIONS DE COORDONNEES */ -/* ---------------------------------------------------------------------------------- */ - - -/****************************************************************************** -* * -* Paramètres : view = composant GTK à consulter. * -* x = abscisse à ajuster. [OUT] * -* x = ordonnée à ajuster. [OUT] * -* * -* Description : Transcrit les coordonnées absolues en coordonnées à l'écran. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void gtk_buffer_view_compute_relative_coords(GtkBufferView *view, gint *x, gint *y) -{ - if (x != NULL && GTK_VIEW_PANEL(view)->hadjustment != NULL) - *x -= gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->hadjustment); - - if (y != NULL && GTK_VIEW_PANEL(view)->vadjustment != NULL) - *y -= gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->vadjustment); - -} - - - /* ---------------------------------------------------------------------------------- */ /* ANIMATION DU CURSEUR */ /* ---------------------------------------------------------------------------------- */ @@ -963,7 +882,7 @@ static void gtk_buffer_view_relocate_caret(GtkBufferView *view, const GdkRectang else if (clear_old) { - gtk_buffer_view_compute_relative_coords(view, &old_area.x, &old_area.y); + gtk_view_panel_compute_relative_coords(GTK_VIEW_PANEL(view), &old_area.x, &old_area.y); gtk_widget_queue_draw_area(GTK_WIDGET(view), old_area.x, old_area.y, old_area.width, old_area.height); @@ -1063,7 +982,7 @@ static gboolean gtk_buffer_view_refresh_caret(GtkBufferView *view) } area = view->caret; - gtk_buffer_view_compute_relative_coords(view, &area.x, &area.y); + gtk_view_panel_compute_relative_coords(GTK_VIEW_PANEL(view), &area.x, &area.y); /* Réinitialisation de la surface */ if (view->show_caret) diff --git a/src/gtkext/gtkbufferview.h b/src/gtkext/gtkbufferview.h index ed26fd5..6b5cf30 100644 --- a/src/gtkext/gtkbufferview.h +++ b/src/gtkext/gtkbufferview.h @@ -59,14 +59,6 @@ GBufferView *gtk_buffer_view_get_buffer(const GtkBufferView *); -/* --------------------------- CONVERSIONS DE COORDONNEES --------------------------- */ - - -/* Transcrit les coordonnées absolues en coordonnées à l'écran. */ -void gtk_buffer_view_compute_relative_coords(GtkBufferView *, gint *, gint *); - - - /* ------------------------------ ANIMATION DU CURSEUR ------------------------------ */ diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c index 46a82eb..3c117d9 100644 --- a/src/gtkext/gtkgraphview.c +++ b/src/gtkext/gtkgraphview.c @@ -240,7 +240,7 @@ static void gtk_graph_view_adjust_scroll_value(GtkGraphView *view, GtkAdjustment fake_x = 0; fake_y = 0; - gtk_buffer_view_compute_fake_coord(view, &fake_x, &fake_y); + gtk_view_panel_compute_fake_coord(GTK_VIEW_PANEL(view), &fake_x, &fake_y); gtk_fixed_move(GTK_FIXED(view), GTK_WIDGET(view->support), fake_x, -fake_y); diff --git a/src/gtkext/gtkviewpanel-int.h b/src/gtkext/gtkviewpanel-int.h index 10ae933..e51dbac 100644 --- a/src/gtkext/gtkviewpanel-int.h +++ b/src/gtkext/gtkviewpanel-int.h @@ -112,4 +112,18 @@ typedef enum _ViewPanelProps +/* --------------------------- CONVERSIONS DE COORDONNEES --------------------------- */ + + +/* Transcrit les coordonnées à l'écran en coordonnées absolues. */ +void gtk_view_panel_compute_fake_coord(GtkViewPanel *, gint *, gint *); + +/* Transcrit les coordonnées absolues en coordonnées à l'écran. */ +void gtk_view_panel_compute_real_coord(GtkViewPanel *, gint *, gint *); + +/* Transcrit les coordonnées absolues en coordonnées à l'écran. */ +void gtk_view_panel_compute_relative_coords(GtkViewPanel *, gint *, gint *); + + + #endif /* _GTK_VIEWPANEL_INT_H */ diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c index 574bf22..03f6daa 100644 --- a/src/gtkext/gtkviewpanel.c +++ b/src/gtkext/gtkviewpanel.c @@ -961,3 +961,82 @@ void gtk_view_panel_cache_glance(GtkViewPanel *panel, cairo_t *cairo, const GtkA GTK_VIEW_PANEL_GET_CLASS(panel)->cache_glance(panel, cairo, area, scale); } + + + +/* ---------------------------------------------------------------------------------- */ +/* CONVERSIONS DE COORDONNEES */ +/* ---------------------------------------------------------------------------------- */ + + +/****************************************************************************** +* * +* Paramètres : panel = composant GTK à consulter. * +* event = informations liées à l'événement. * +* * +* Description : Transcrit les coordonnées à l'écran en coordonnées absolues. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void gtk_view_panel_compute_fake_coord(GtkViewPanel *panel, gint *x, gint *y) +{ + if (panel->hadjustment != NULL) + *x -= gtk_adjustment_get_value(panel->hadjustment); + + if (panel->vadjustment != NULL) + *y += gtk_adjustment_get_value(panel->vadjustment); + +} + + +/****************************************************************************** +* * +* Paramètres : panel = composant GTK à consulter. * +* event = informations liées à l'événement. * +* * +* Description : Transcrit les coordonnées absolues en coordonnées à l'écran. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void gtk_view_panel_compute_real_coord(GtkViewPanel *panel, gint *x, gint *y) +{ + if (x != NULL && panel->hadjustment != NULL) + *x += gtk_adjustment_get_value(panel->hadjustment); + + if (y != NULL && panel->vadjustment != NULL) + *y += gtk_adjustment_get_value(panel->vadjustment); + +} + + +/****************************************************************************** +* * +* Paramètres : panel = composant GTK à consulter. * +* x = abscisse à ajuster. [OUT] * +* x = ordonnée à ajuster. [OUT] * +* * +* Description : Transcrit les coordonnées absolues en coordonnées à l'écran. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void gtk_view_panel_compute_relative_coords(GtkViewPanel *panel, gint *x, gint *y) +{ + if (x != NULL && panel->hadjustment != NULL) + *x -= gtk_adjustment_get_value(panel->hadjustment); + + if (y != NULL && panel->vadjustment != NULL) + *y -= gtk_adjustment_get_value(panel->vadjustment); + +} |