diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2015-04-11 22:34:59 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2015-04-11 22:34:59 (GMT) |
commit | 054d2d76f1951c20822286bce0128e60c26c4b9b (patch) | |
tree | 450c707498f4008c99302c12e274baefc50f383c /src/gtkext | |
parent | 7bd707cb43ed8830add9d9eec3a670c9a0ce4d68 (diff) |
Drawn a selection line on buffer views.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@510 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/gtkbufferview.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c index ef5aac6..1c2c7a9 100644 --- a/src/gtkext/gtkbufferview.c +++ b/src/gtkext/gtkbufferview.c @@ -27,6 +27,7 @@ #include <gdk/gdkkeysyms.h> +#include "../core/params.h" #include "../glibext/chrysamarshal.h" @@ -127,7 +128,6 @@ static void gtk_buffer_view_class_init(GtkBufferViewClass *class) panel_class->get_position = (get_view_position_fc)gtk_buffer_view_get_position; panel_class->cache_glance = (cache_glance_fc)gtk_buffer_view_cache_glance; - g_signal_new("caret-moved", GTK_TYPE_BUFFER_VIEW, G_SIGNAL_RUN_LAST, @@ -341,6 +341,8 @@ static gboolean gtk_buffer_view_draw(GtkWidget *widget, cairo_t *cr) GtkStyleContext *context; /* Contexte du thème actuel */ gint fake_x; /* Abscisse virtuelle */ gint fake_y; /* Ordonnée virtuelle */ + bool sel_line; /* Souslignage de la sélection */ + gint *selected; /* Ordonnée d'une sélection */ view = GTK_BUFFER_VIEW(widget); pview = GTK_VIEW_PANEL(widget); @@ -379,7 +381,14 @@ static gboolean gtk_buffer_view_draw(GtkWidget *widget, cairo_t *cr) fake_y = 0; gtk_buffer_view_compute_fake_coord(view, &fake_x, &fake_y); - g_buffer_view_draw(view->buffer_view, cr, fake_x, fake_y, &area, pview->display); + g_generic_config_get_value(get_main_configuration(), MPK_SELECTION_LINE, &sel_line); + + if (!sel_line || view->caret_addr == NULL) + selected = NULL; + else + selected = &view->caret.y; + + g_buffer_view_draw(view->buffer_view, cr, fake_x, fake_y, &area, pview->display, selected); } @@ -796,8 +805,6 @@ void gtk_buffer_view_compute_relative_coords(GtkBufferView *view, gint *x, gint - - /* ---------------------------------------------------------------------------------- */ /* ANIMATION DU CURSEUR */ /* ---------------------------------------------------------------------------------- */ @@ -823,8 +830,12 @@ static void gtk_buffer_view_relocate_caret(GtkBufferView *view, const GdkRectang { gtk_buffer_view_compute_relative_coords(view, &view->caret.x, &view->caret.y); + /* gtk_widget_queue_draw_area(GTK_WIDGET(view), view->caret.x, view->caret.y, view->caret.width, view->caret.height); + */ + + gtk_widget_queue_draw(GTK_WIDGET(view)); } |