From 5c51c967a7566f29218b3d8233248742ff4d5e4c Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Tue, 4 Dec 2012 20:54:16 +0000
Subject: Drawn a dirty preview for buffer views.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@295 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog                  |  5 +++++
 src/gtkext/gtkbufferview.c | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 0ceb01b..a861c48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 12-12-04  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/gtkext/gtkbufferview.c:
+	Draw a dirty preview for buffer views.
+
+12-12-04  Cyrille Bagard <nocbos@gmail.com>
+
 	* src/arch/dalvik/instruction.c:
 	List accesses to Dalvik registers.
 
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c
index e94d11a..027ae5c 100644
--- a/src/gtkext/gtkbufferview.c
+++ b/src/gtkext/gtkbufferview.c
@@ -49,6 +49,9 @@ static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *, vmpa_
 /* Réagit à un défilement quelconque. */
 static void gtk_buffer_view_scroll(GtkBufferView *);
 
+/* Place en cache un rendu destiné à l'aperçu graphique rapide. */
+static void gtk_buffer_view_cache_glance(GtkBufferView *, cairo_t *);
+
 
 
 /* ---------------------------------------------------------------------------------- */
@@ -105,6 +108,7 @@ static void gtk_buffer_view_init(GtkBufferView *view)
 
     viewpanel->get_coordinates = (get_addr_coordinates_fc)gtk_buffer_view_get_address_coordinates;
     viewpanel->scroll = (scroll_fc)gtk_buffer_view_scroll;
+    viewpanel->cache_glance = (cache_glance_fc)gtk_buffer_view_cache_glance;
 
 }
 
@@ -378,6 +382,38 @@ static void gtk_buffer_view_scroll(GtkBufferView *view)
 
 /******************************************************************************
 *                                                                             *
+*  Paramètres  : view  = composant GTK à manipuler.                           *
+*                cairo = assistant pour la création de rendus.                *
+*                                                                             *
+*  Description : Place en cache un rendu destiné à l'aperçu graphique rapide. *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void gtk_buffer_view_cache_glance(GtkBufferView *view, cairo_t *cairo)
+{
+    GtkRequisition req;                     /* Pleine taille de la source  */
+
+    gtk_widget_size_request(GTK_WIDGET(view), &req);
+    gtk_buffer_view_compute_real_coord(view, &req.width, &req.height);
+
+    /* FIXME : hardcoded 20 */
+
+    cairo_set_line_width(cairo, 20);
+    cairo_set_source_rgb(cairo, 0, 0, 0);
+
+    cairo_rectangle(cairo, 0, 0, req.width - 20, req.height - 20);
+
+    cairo_stroke(cairo);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
 *  Paramètres  : view   = composant GTK à mettre à jour.                      *
 *                buffer = tampon de lignes à encadrer.                        *
 *                addr   = indique si les positions doivent être affichées.    *
-- 
cgit v0.11.2-87-g4458