diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2009-07-26 21:19:34 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2009-07-26 21:19:34 (GMT) |
commit | 3155a05a21a52a173b8a711c402426392eb53c2a (patch) | |
tree | c5b7ea9b1d5438b5b10055fbafbc5b61141ed2b0 /src | |
parent | 43e278987f0453e34483368f6d512d942ef6dd34 (diff) |
Cleaned and improved the drawing of the block view.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@102 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src')
-rw-r--r-- | src/analysis/line.c | 2 | ||||
-rw-r--r-- | src/analysis/line.h | 2 | ||||
-rw-r--r-- | src/gtkext/gtkblockview.c | 91 | ||||
-rw-r--r-- | src/plugins/pglist.c | 2 |
4 files changed, 30 insertions, 67 deletions
diff --git a/src/analysis/line.c b/src/analysis/line.c index cd54db0..988de1f 100644 --- a/src/analysis/line.c +++ b/src/analysis/line.c @@ -671,7 +671,7 @@ void g_rendering_line_get_size(GRenderingLine *lines, const GRenderingLine *last * * ******************************************************************************/ -GRenderingLine *g_rendering_line_find_by_y(GRenderingLine *lines, const GRenderingLine *last, gdouble *y) +GRenderingLine *g_rendering_line_find_by_y(GRenderingLine *lines, const GRenderingLine *last, int *y) { GRenderingLine *result; /* Trouvaille à retourner */ int h; /* Hauteur de l'objet actuel */ diff --git a/src/analysis/line.h b/src/analysis/line.h index 621ab60..a46f47d 100644 --- a/src/analysis/line.h +++ b/src/analysis/line.h @@ -126,7 +126,7 @@ void g_rendering_line_update_bin_len(GRenderingLine *, GRenderingLine *, MainRen void g_rendering_line_get_size(GRenderingLine *, const GRenderingLine *, MainRendering, int *, int *, int *); /* Recherche une ligne d'après sa position à l'écran. */ -GRenderingLine *g_rendering_line_find_by_y(GRenderingLine *, const GRenderingLine *, gdouble *); +GRenderingLine *g_rendering_line_find_by_y(GRenderingLine *, const GRenderingLine *, int *); /* Recherche une ligne d'après sa position en mémoire/physique. */ GRenderingLine *g_rendering_line_find_by_address(GRenderingLine *, const GRenderingLine *, vmpa_t); diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c index 19510cb..ad0aded 100644 --- a/src/gtkext/gtkblockview.c +++ b/src/gtkext/gtkblockview.c @@ -111,7 +111,7 @@ static gboolean gtk_block_view_button_press(GtkWidget *, GdkEventButton *event); /* Met à jour l'affichage de la vue sous forme de bloc. */ static gboolean gtk_block_view_expose(GtkWidget *widget, GdkEventExpose *event); -static void gtk_block_view_paint(GtkBlockView *view); + static void gtk_block_view_destroy(GtkObject *object); @@ -254,7 +254,7 @@ static gboolean gtk_block_view_button_press(GtkWidget *widget, GdkEventButton *e { gboolean result; /* Décision à retourner */ GtkBlockView *view; /* Composant GTK réel */ - gdouble y; /* Position à manipuler */ + int y; /* Position à manipuler */ GRenderingLine *line; /* Ligne de rendu visée */ result = FALSE; @@ -275,12 +275,6 @@ static gboolean gtk_block_view_button_press(GtkWidget *widget, GdkEventButton *e } - if (result) - { - /* TODO: regions */ - gtk_block_view_paint(view); - } - return result; } @@ -304,7 +298,8 @@ void gtk_block_view_update_margin(GRenderingLine *line, GtkBlockView *view) { - gtk_block_view_paint(view); + /* TODO : à améliorer ! */ + gtk_widget_queue_draw(GTK_WIDGET(view)); @@ -331,45 +326,7 @@ void gtk_block_view_update_margin(GRenderingLine *line, GtkBlockView *view) static gboolean gtk_block_view_expose(GtkWidget *widget, GdkEventExpose *event) { - GtkBinViewClass *parent_class; /* Version pure du parent */ - - g_return_val_if_fail(widget != NULL, FALSE); - g_return_val_if_fail(GTK_IS_BLOCK_VIEW(widget), FALSE); - g_return_val_if_fail(event != NULL, FALSE); - - gtk_block_view_paint(GTK_BLOCK_VIEW(widget)); - - - - /* - - -gdk_gc_set_clip_region (GdkGC *gc, - const GdkRegion *region); - -gdk_window_invalidate_region (GdkWindow *window, - const GdkRegion *region, - gboolean invalidate_children); -gdk_window_begin_paint_region (GdkWindow *window, - const GdkRegion *region); -void gdk_window_end_paint (GdkWindow *window); - */ - - - - parent_class = GTK_BIN_VIEW_CLASS(g_type_class_peek_parent(GTK_BLOCK_VIEW_GET_CLASS(widget))); - - GTK_WIDGET_CLASS(parent_class)->expose_event(widget, event); - - return TRUE; - -} - - -static void -gtk_block_view_paint(GtkBlockView *view) -{ - GtkWidget *widget; /* Version GTK du composant */ + GtkBinView *view; /* Autre version du composant */ GdkGCValues values; /* Propriétés du contexte */ GdkColor white; /* Couleur du fond */ int width; /* Largeur de l'élément */ @@ -377,37 +334,43 @@ gtk_block_view_paint(GtkBlockView *view) int y; /* Ordonnée du haut d'une ligne*/ GRenderingLine *iter; /* Boucle de parcours */ - widget = GTK_WIDGET(view); - gdk_gc_get_values(GTK_BIN_VIEW(view)->gc, &values); + view = GTK_BIN_VIEW(widget); + + gdk_window_begin_paint_region(GDK_DRAWABLE(widget->window), event->region); + + gdk_gc_set_clip_region(view->gc, event->region); + + gdk_gc_get_values(view->gc, &values); gdk_color_white(gtk_widget_get_colormap(widget), &white); - gdk_gc_set_foreground(GTK_BIN_VIEW(view)->gc, &white); + gdk_gc_set_foreground(view->gc, &white); gtk_widget_get_size_request(widget, &width, &height); - gdk_draw_rectangle(GDK_DRAWABLE(widget->window), GTK_BIN_VIEW(widget)->gc, + gdk_draw_rectangle(GDK_DRAWABLE(widget->window), view->gc, TRUE, 0, 0, width, height); - gdk_gc_set_foreground(GTK_BIN_VIEW(view)->gc, &values.foreground); + gdk_gc_set_foreground(view->gc, &values.foreground); - gdk_draw_layout(GDK_DRAWABLE(widget->window), GTK_BIN_VIEW(view)->gc, - 2 * MARGIN_SPACE + view->line_height, 0, - view->layout); + y = event->area.y; + iter = g_rendering_line_find_by_y(view->lines, view->last, &y); - y = 0; + y = event->area.y - y; - for (iter = GTK_BIN_VIEW(view)->lines; - iter != NULL; - iter = g_rendering_line_get_next_iter(GTK_BIN_VIEW(view)->lines, iter, GTK_BIN_VIEW(view)->last)) + for ( ; iter != NULL; + iter = g_rendering_line_get_next_iter(view->lines, iter, view->last)) { - g_rendering_line_draw(iter, GDK_DRAWABLE(widget->window), GTK_BIN_VIEW(view)->gc, - MARGIN_SPACE, 2 * MARGIN_SPACE + view->line_height, - y, view->line_height, view->rendering); + g_rendering_line_draw(iter, GDK_DRAWABLE(widget->window), view->gc, + MARGIN_SPACE, 2 * MARGIN_SPACE + GTK_BLOCK_VIEW(view)->line_height, + y, GTK_BLOCK_VIEW(view)->line_height, GTK_BLOCK_VIEW(view)->rendering); - y += view->line_height; + y += GTK_BLOCK_VIEW(view)->line_height; } + gdk_window_end_paint(GDK_DRAWABLE(widget->window)); + + return TRUE; } diff --git a/src/plugins/pglist.c b/src/plugins/pglist.c index 6d47f57..6725fd8 100644 --- a/src/plugins/pglist.c +++ b/src/plugins/pglist.c @@ -77,7 +77,7 @@ bool init_all_plugins(GObject *ref) { _list.ref = ref; - browse_directory_for_plugins(&_list, PACKAGE_SOURCE_DIR "/plugins"); + browse_directory_for_plugins(&_list, PACKAGE_SOURCE_DIR "/plugins.disabled"); return true; |