From f2d479c16a427696790441fa1459e7194f49bb6a Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sun, 28 Nov 2010 13:03:25 +0000
Subject: Loaded all buffers of decompiled files.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@195 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog                      |  46 ++++++
 configure.ac                   |   2 +
 src/Makefile.am                |   5 +-
 src/analysis/binary.c          |  36 ++---
 src/analysis/binary.h          |   2 +-
 src/editor.c                   |  91 +++++++++++-
 src/format/dex/dex.c           |  46 ++++++
 src/format/format-int.h        |   3 +
 src/format/format.c            |  24 +++
 src/format/format.h            |   3 +
 src/gtkext/Makefile.am         |   2 +
 src/gtkext/gtkbufferview-int.h |  58 ++++++++
 src/gtkext/gtkbufferview.c     | 323 +++++++++++++++++++++++++++++++++++++++++
 src/gtkext/gtkbufferview.h     |  59 ++++++++
 src/gtkext/gtksourceview.c     | 270 +---------------------------------
 src/gtkext/gtksourceview.h     |   1 -
 src/gui/Makefile.am            |  20 +++
 src/gui/editem-int.h           |  77 ++++++++++
 src/gui/editem.c               | 171 ++++++++++++++++++++++
 src/gui/editem.h               |  74 ++++++++++
 src/gui/tb/Makefile.am         |  17 +++
 src/gui/tb/source.c            | 227 +++++++++++++++++++++++++++++
 src/gui/tb/source.h            |  38 +++++
 src/gui/tb/toolbar.c           | 138 ++++++++++++++++++
 src/gui/tb/toolbar.h           |  56 +++++++
 25 files changed, 1497 insertions(+), 292 deletions(-)
 create mode 100644 src/gtkext/gtkbufferview-int.h
 create mode 100644 src/gtkext/gtkbufferview.c
 create mode 100644 src/gtkext/gtkbufferview.h
 create mode 100644 src/gui/Makefile.am
 create mode 100644 src/gui/editem-int.h
 create mode 100644 src/gui/editem.c
 create mode 100644 src/gui/editem.h
 create mode 100644 src/gui/tb/Makefile.am
 create mode 100644 src/gui/tb/source.c
 create mode 100644 src/gui/tb/source.h
 create mode 100644 src/gui/tb/toolbar.c
 create mode 100644 src/gui/tb/toolbar.h

diff --git a/ChangeLog b/ChangeLog
index d7e0ee7..82c6916 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+10-11-28  Cyrille Bagard <nocbos@gmail.com>
+
+	* configure.ac:
+	Add the new Makefiles from the 'src/gui' and 'src/gui/tb'
+	directories to AC_CONFIG_FILES.
+
+	* src/analysis/binary.c:
+	* src/analysis/binary.h:
+	Load all buffers of decompiled files.
+
+	* src/editor.c:
+	Extend the "View" menu.
+
+	* src/format/dex/dex.c:
+	* src/format/format.c:
+	* src/format/format.h:
+	* src/format/format-int.h:
+	Find all source files in a Dex binary.
+
+	* src/gtkext/gtkbufferview.c:
+	* src/gtkext/gtkbufferview.h:
+	* src/gtkext/gtkbufferview-int.h:
+	New entries: provide a new GTK widget which can be shared between all
+	views using a buffer for rendering.
+
+	* src/gtkext/gtksourceview.c:
+	* src/gtkext/gtksourceview.h:
+	Update code.
+
+	* src/gtkext/Makefile.am:
+	Add gtkbufferview.[ch] and gtkbufferview-int.h to libgtkext_la_SOURCES.
+
+	* src/gui/editem.c:
+	* src/gui/editem.h:
+	* src/gui/editem-int.h:
+	* src/gui/Makefile.am:
+	* src/gui/tb/Makefile.am:
+	* src/gui/tb/source.c:
+	* src/gui/tb/source.h:
+	* src/gui/tb/toolbar.c:
+	* src/gui/tb/toolbar.h:
+	New entries: create a new framework for GUI items.
+
+	* src/Makefile.am:
+	Add gui/libgui.la to openida_LDADD.
+
 10-11-15  Cyrille Bagard <nocbos@gmail.com>
 
 	* src/format/dex/dex.c:
diff --git a/configure.ac b/configure.ac
index 9b0d4ca..c098dbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -268,6 +268,8 @@ AC_CONFIG_FILES([Makefile
                  src/glibext/Makefile
                  src/graph/Makefile
                  src/gtkext/Makefile
+                 src/gui/Makefile
+                 src/gui/tb/Makefile
                  src/panels/Makefile
                  src/plugins/Makefile
                  src/plugins/overjump/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index 7ef9192..908a1f1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -100,7 +100,8 @@ openida_LDFLAGS = $(LIBGTK_LIBS) -L/usr/X11R6/lib -ldl -lm $(LIBXML_LIBS) `pkg-c
 
 
 openida_LDADD = $(LIBINTL) 				\
-	dialogs/libdialogs.a
+	dialogs/libdialogs.a 				\
+	gui/libgui.la
 
 
 
@@ -110,4 +111,4 @@ openida_LDADD = $(LIBINTL) 				\
 
 # gtkext doit être traité en premier, à cause des marshals GLib
 
-SUBDIRS = glibext gtkext analysis arch format common debug decomp dialogs graph panels plugins
+SUBDIRS = glibext gtkext analysis arch format common debug decomp dialogs graph gui panels plugins
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 0159b29..4093f6e 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -142,9 +142,9 @@ struct _GOpenidaBinary
     GRenderingLine *lines;                  /* Lignes de rendu en place    */
     GRenderingOptions *options;             /* Options de désassemblage    */
 
-    char **src_files;                       /* Nom des fichiers source     */
     GCodeBuffer **dec_buffers;              /* Sources sous forme de texte */
     size_t decbuf_count;                    /* Taille des tableaux         */
+    size_t defsrc;                          /* Fichier source principal    */
 
     GBreakGroup **brk_groups;               /* Groupes de points d'arrêt   */
     size_t brk_count;                       /* Taille de cette liste       */
@@ -1362,8 +1362,8 @@ GArchInstruction *g_openida_binary_get_instructions(const GOpenidaBinary *binary
 
 /******************************************************************************
 *                                                                             *
-*  Paramètres  : binary   = élément binaire à consulter.                      *
-*                filename = nom de fichier à retrouver.                       *
+*  Paramètres  : binary = élément binaire à consulter.                        *
+*                index  = indice du fichier à retrouver.                      *
 *                                                                             *
 *  Description : Fournit le tampon associé au contenu d'un fichier source.    *
 *                                                                             *
@@ -1373,24 +1373,15 @@ GArchInstruction *g_openida_binary_get_instructions(const GOpenidaBinary *binary
 *                                                                             *
 ******************************************************************************/
 
-GCodeBuffer *g_openida_binary_get_decompiled_buffer(const GOpenidaBinary *binary, const char *filename)
+GCodeBuffer *g_openida_binary_get_decompiled_buffer(const GOpenidaBinary *binary, size_t index)
 {
     GCodeBuffer *result;                    /* Tampon à retourner          */
-    size_t i;                               /* Boucle de parcours          */
 
-    result = NULL;
+    if (index >= binary->decbuf_count)
+        result = binary->dec_buffers[binary->defsrc];
 
-    for (i = 0; i < binary->decbuf_count; i++)
-    {
-        /* Si aucune demande précise, on renvoie le premier ! */
-        if (filename == NULL
-            || strcmp(binary->src_files[i], filename) == 0)
-        {
-            result = binary->dec_buffers[i];
-            break;
-        }
-
-    }
+    else
+        result = binary->dec_buffers[index];
 
     return result;
 
@@ -1546,17 +1537,20 @@ void ack_completed_disassembly(GDelayedDisassembly *disass, GOpenidaBinary *bina
     size_t pgcount;                         /* Taille de cette liste       */
     size_t i;                               /* Boucle de parcours          */
 
+    const char * const *files;              /* Liste de fichiers source    */
+
 
     /* Décompilation... */
 
 
-    binary->decbuf_count++;
-    binary->src_files = (char **)calloc(binary->decbuf_count, sizeof(char *));
-    binary->dec_buffers = (GCodeBuffer **)calloc(binary->decbuf_count, sizeof(GCodeBuffer *));
 
-    binary->dec_buffers[0] = decompile_all_from_file(binary, "RC4.java");
+    files = g_binary_format_get_source_files(G_BIN_FORMAT(binary->format),
+                                             &binary->decbuf_count, &binary->defsrc);
 
+    binary->dec_buffers = (GCodeBuffer **)calloc(binary->decbuf_count, sizeof(GCodeBuffer *));
 
+    for (i = 0; i < binary->decbuf_count; i++)
+        binary->dec_buffers[i] = decompile_all_from_file(binary, files[i]);
 
 
 
diff --git a/src/analysis/binary.h b/src/analysis/binary.h
index 666cfaa..cac3b86 100644
--- a/src/analysis/binary.h
+++ b/src/analysis/binary.h
@@ -110,7 +110,7 @@ GRenderingLine *g_openida_binary_get_lines(const GOpenidaBinary *);
 GArchInstruction *g_openida_binary_get_instructions(const GOpenidaBinary *);
 
 /* Fournit le tampon associé au contenu d'un fichier source. */
-GCodeBuffer *g_openida_binary_get_decompiled_buffer(const GOpenidaBinary *, const char *);
+GCodeBuffer *g_openida_binary_get_decompiled_buffer(const GOpenidaBinary *, size_t);
 
 
 
diff --git a/src/editor.c b/src/editor.c
index c5c697e..7e5bb80 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -56,6 +56,8 @@
 #include "dialogs/binparts.h"
 #include "dialogs/export.h"
 #include "dialogs/plugins.h"
+#include "gui/editem.h"
+#include "gui/tb/source.h"
 #include "panels/panel.h"
 
 
@@ -172,6 +174,16 @@ static void on_debugger_halted(GBinaryDebugger *, int, vmpa_t, pid_t, GObject *)
 
 
 
+/* ------------------------ INTEGRATION DE LA BARRE D'OUTILS ------------------------ */
+
+
+/* Construit la barre d'outils de l'éditeur. */
+static GtkWidget *build_editor_toolbar(GObject *);
+
+
+
+
+
 
 /******************************************************************************
 *                                                                             *
@@ -197,6 +209,11 @@ GtkWidget *create_editor(void)
     GSList *rgroup;                         /* Groupe des boutons radio    */
 
 
+    GtkWidget *ssubmenuitem;                /* Sous-élément de menu        */
+
+
+    GtkWidget *toolbar;                     /* Barre d'outils              */
+
   GtkWidget *vbox1;
   GtkWidget *vpaned1;
   GtkWidget *hpaned1;
@@ -291,6 +308,8 @@ GtkWidget *create_editor(void)
     submenubar = gtk_menu_new();
     gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenuitem), submenubar);
 
+    /* Affichage */
+
     menuitem = gtk_menu_item_new_with_mnemonic(_("_View"));
     gtk_widget_show(menuitem);
     gtk_container_add(GTK_CONTAINER(menuboard), menuitem);
@@ -326,8 +345,23 @@ GtkWidget *create_editor(void)
     submenuitem = qck_create_check_menu_item(NULL, NULL, _("Binary code"), G_CALLBACK(mcb_view_code), result);
     gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
 
+    submenuitem = qck_create_menu_separator();
+    gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
 
+    submenuitem = qck_create_menu_item(NULL, NULL, _("Toolbar"), NULL, NULL);
+    gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
 
+    submenubar = gtk_menu_new();
+    gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenuitem), submenubar);
+
+    ssubmenuitem = qck_create_check_menu_item(NULL, NULL, _("Source file"), G_CALLBACK(NULL), result);
+    gtk_container_add(GTK_CONTAINER(submenubar), ssubmenuitem);
+
+
+
+
+
+    /* Projet */
 
     menuitem = gtk_menu_item_new_with_mnemonic(_("_Project"));
     gtk_widget_show(menuitem);
@@ -428,8 +462,10 @@ GtkWidget *create_editor(void)
     gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
 
 
+    /* Barre d'outils */
 
-
+    toolbar = build_editor_toolbar(G_OBJECT(result));
+    gtk_box_pack_start(GTK_BOX(vbox1), toolbar, FALSE, FALSE, 0);
 
 
 
@@ -877,12 +913,12 @@ void mcb_view_change_support(GtkRadioMenuItem *menuitem, GObject *ref)
         binary = (GOpenidaBinary *)g_object_get_data(ref, "current_binary");
         panel = get_view_for_openida_project_binary(get_current_openida_project(), binary, view, &pview);
 
-        g_object_set_data(ref, "current_view", pview);
-
         ditem = gtk_dock_panel_get_item_from_binary(get_current_openida_project(), binary);
 
         g_dock_item_set_panel(ditem, panel);
 
+        change_editor_items_current_view(ref, pview);
+
         notify_panels_of_view_change(pview, true);
 
     }
@@ -1454,11 +1490,11 @@ static void on_dock_item_switch(GtkDockPanel *panel, GDockItem *item, GObject *r
 
         if (old_binary != binary)
         {
-            g_object_set_data(ref, "current_binary", binary);
             notify_panels_of_binary_change(binary);
+            change_editor_items_current_binary(ref, binary);
         }
 
-        g_object_set_data(ref, "current_view", widget);
+        change_editor_items_current_view(ref, GTK_VIEW_PANEL(widget));
 
         refresh_editor_menus(ref, binary, GTK_BIN_VIEW(widget));
 
@@ -1553,3 +1589,48 @@ static void on_debugger_halted(GBinaryDebugger *debugger, int sig, vmpa_t addr,
 
 
 }
+
+
+
+
+
+
+
+
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/*                          INTEGRATION DE LA BARRE D'OUTILS                          */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : ref = espace de référencement global.                        *
+*                                                                             *
+*  Description : Construit la barre d'outils de l'éditeur.                    *
+*                                                                             *
+*  Retour      : Adresse du composant mis en place.                           *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static GtkWidget *build_editor_toolbar(GObject *ref)
+{
+    GtkWidget *result;                      /* Support à retourner         */
+    GEditorItem *item;                      /* Elément de barre d'outils   */
+
+    result = gtk_toolbar_new();
+    gtk_widget_show(result);
+    g_object_set_data(ref, "toolbar", result);
+
+
+    item = create_source_tb_item(ref);
+    register_editor_item(item);
+
+
+    return result;
+
+}
diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c
index e30ed7a..25482af 100755
--- a/src/format/dex/dex.c
+++ b/src/format/dex/dex.c
@@ -45,6 +45,9 @@ static void g_dex_format_class_init(GDexFormatClass *);
 /* Initialise une instance de format d'exécutable DEX. */
 static void g_dex_format_init(GDexFormat *);
 
+/* Détermine tous les fichiers source indiqués. */
+static void g_dex_format_find_all_sources(GDexFormat *);
+
 /* Procède à la décompilation complète du format. */
 static void g_dex_format_decompile(const GDexFormat *, GCodeBuffer *, const char *);
 
@@ -191,6 +194,7 @@ GBinFormat *g_dex_format_new(const bin_t *content, off_t length)
 
     register_all_dex_class_methods(result);
 
+    g_dex_format_find_all_sources(result);
 
 
     return G_BIN_FORMAT(result);
@@ -200,6 +204,48 @@ GBinFormat *g_dex_format_new(const bin_t *content, off_t length)
 
 /******************************************************************************
 *                                                                             *
+*  Paramètres  : format = informations chargées à mettre à jour.              *
+*                                                                             *
+*  Description : Détermine tous les fichiers source indiqués.                 *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_dex_format_find_all_sources(GDexFormat *format)
+{
+    GBinFormat *bf;                         /* Instance parente            */
+    size_t i;                               /* Boucle de parcours #1       */
+    const char *source;                     /* Fichier source trouvé       */
+    bool found;                             /* Présence dans la liste      */
+    size_t k;                               /* Boucle de parcours #2       */
+
+    bf = G_BIN_FORMAT(format);
+
+    for (i = 0; i < format->classes_count; i++)
+    {
+        source = g_dex_class_get_source_file(format->classes[i], format);
+        found = false;
+
+        for (k = 0; k < bf->src_count && !found; k++)
+            found = (strcmp(source, bf->src_files[k]) == 0);
+
+        if (!found)
+        {
+            bf->src_files = (const char **)realloc(bf->src_files,
+                                                   ++bf->src_count * sizeof(const char **));
+            bf->src_files[bf->src_count - 1] = source;
+        }
+
+    }
+
+}
+
+
+/******************************************************************************
+*                                                                             *
 *  Paramètres  : format   = informations chargées à consulter.                *
 *                buffer   = tampon mis à disposition pour la sortie.          *
 *                filename = nom du fichier source à cibler.                   *
diff --git a/src/format/format-int.h b/src/format/format-int.h
index 27d4129..5473e57 100644
--- a/src/format/format-int.h
+++ b/src/format/format-int.h
@@ -50,6 +50,9 @@ struct _GBinFormat
     GBinRoutine **routines;                 /* Liste des routines trouvées */
     size_t routines_count;                  /* Nombre de ces routines      */
 
+    const char **src_files;                 /* Nom des fichiers source     */
+    size_t src_count;                       /* Taille de la liste          */
+    size_t def_source;                      /* Fichier source principal    */
     format_decompile_fc decompile;          /* Décompilation d'un fichier  */
 
 };
diff --git a/src/format/format.c b/src/format/format.c
index e618120..c104649 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -335,6 +335,30 @@ GDecInstruction *g_binary_format_decompile_routine(const GBinFormat *format, GBi
 
 /******************************************************************************
 *                                                                             *
+*  Paramètres  : format = informations chargées à consulter.                  *
+*                count  = taille de la liste retournée. [OUT]                 *
+*                defsrc = fichier de code principal. [OUT]                    *
+*                                                                             *
+*  Description : Fournit la liste des fichiers source détectés.               *
+*                                                                             *
+*  Retour      : Liste de noms de fichier ou NULL si aucun.                   *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+const char * const *g_binary_format_get_source_files(const GBinFormat *format, size_t *count, size_t *defsrc)
+{
+    *count = format->src_count;
+    *defsrc = format->def_source;
+
+    return format->src_files;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
 *  Paramètres  : format   = informations chargées à consulter.                *
 *                buffer   = tampon mis à disposition pour la sortie.          *
 *                filename = nom du fichier source à cibler.                   *
diff --git a/src/format/format.h b/src/format/format.h
index 5a8c684..90aabbc 100644
--- a/src/format/format.h
+++ b/src/format/format.h
@@ -75,6 +75,9 @@ GBinRoutine **g_binary_format_get_routines(const GBinFormat *, size_t *);
 /* Procède à la décompilation basique d'une routine donnée. */
 GDecInstruction *g_binary_format_decompile_routine(const GBinFormat *, GBinRoutine *);
 
+/* Fournit la liste des fichiers source détectés. */
+const char * const *g_binary_format_get_source_files(const GBinFormat *, size_t *, size_t *);
+
 /* Procède à la décompilation complète du format. */
 void g_binary_format_decompile(const GBinFormat *, GCodeBuffer *, const char *filename);
 
diff --git a/src/gtkext/Makefile.am b/src/gtkext/Makefile.am
index d253edc..47d4e41 100644
--- a/src/gtkext/Makefile.am
+++ b/src/gtkext/Makefile.am
@@ -9,6 +9,8 @@ libgtkext_la_SOURCES =					\
 	gtkbinview-int.h					\
 	gtkbinview.h gtkbinview.c			\
 	gtkblockview.h gtkblockview.c		\
+	gtkbufferview-int.h					\
+	gtkbufferview.h gtkbufferview.c		\
 	gtkdockitem.h gtkdockitem.c			\
 	gtkdockpanel.h gtkdockpanel.c		\
 	gtkdropwindow.h gtkdropwindow.c		\
diff --git a/src/gtkext/gtkbufferview-int.h b/src/gtkext/gtkbufferview-int.h
new file mode 100644
index 0000000..936e31d
--- /dev/null
+++ b/src/gtkext/gtkbufferview-int.h
@@ -0,0 +1,58 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkbufferview.h - prototypes pour l'affichage de tampons de lignes
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GTK_BUFFERVIEW_INT_H
+#define _GTK_BUFFERVIEW_INT_H
+
+
+#include "gtkbufferview.h"
+
+
+#include "gtkviewpanel-int.h"
+
+
+
+/* Composant d'affichage de tampon de lignes (instance) */
+struct _GtkBufferView
+{
+    GtkViewPanel parent;                    /* A laisser en premier        */
+
+    GCodeBuffer *buffer;                    /* Code sous forme de texte    */
+    GBufferView *buffer_view;               /* Affichage de cette forme    */
+
+    gint line_height;                       /* Hauteur maximale des lignes */
+    gint left_margin;                       /* Marge gauche + espace       */
+    gint left_text;                         /* Début d'impression du code  */
+
+};
+
+/* Composant d'affichage de tampon de lignes (classe) */
+struct _GtkBufferViewClass
+{
+    GtkViewPanelClass parent;               /* A laisser en premier        */
+
+};
+
+
+
+#endif  /* _GTK_BUFFERVIEW_INT_H */
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c
new file mode 100644
index 0000000..81fb998
--- /dev/null
+++ b/src/gtkext/gtkbufferview.c
@@ -0,0 +1,323 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkbufferview.c - affichage de tampons de lignes
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "gtkbufferview-int.h"
+
+
+
+/* -------------------------- INTERACTION DIRECTE AVEC GTK -------------------------- */
+
+
+/* Procède à l'initialisation de l'afficheur de tampons. */
+static void gtk_buffer_view_class_init(GtkBufferViewClass *);
+
+/* Procède à l'initialisation de l'afficheur de tampons. */
+static void gtk_buffer_view_init(GtkBufferView *);
+
+/* Fournit la taille de composant requise pour un plein rendu. */
+static void gtk_buffer_view_size_request(GtkWidget *, GtkRequisition *);
+
+/* S'adapte à la surface concédée par le composant parent. */
+static void gtk_buffer_view_size_allocate(GtkWidget *, GtkAllocation *);
+
+/* Met à jour l'affichage de la visualisation de code buffer. */
+static gboolean gtk_buffer_view_expose(GtkWidget *, GdkEventExpose *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/*                            INTERACTION DIRECTE AVEC GTK                            */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Détermine le type du composant d'affichage de tampon de lignes. */
+G_DEFINE_TYPE(GtkBufferView, gtk_buffer_view, GTK_TYPE_VIEW_PANEL)
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : class = classe GTK à initialiser.                            *
+*                                                                             *
+*  Description : Procède à l'initialisation de l'afficheur de tampons.        *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void gtk_buffer_view_class_init(GtkBufferViewClass *class)
+{
+    GtkWidgetClass *widget_class;           /* Classe version Widget       */
+
+    widget_class = GTK_WIDGET_CLASS(class);
+
+    widget_class->size_request = gtk_buffer_view_size_request;
+    widget_class->size_allocate = gtk_buffer_view_size_allocate;
+    widget_class->expose_event = gtk_buffer_view_expose;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : view = composant GTK à initialiser.                          *
+*                                                                             *
+*  Description : Procède à l'initialisation de l'afficheur de tampons.        *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void gtk_buffer_view_init(GtkBufferView *view)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : widget      = composant GTK à consulter.                     *
+*                requisition = dimensions souhaitées. [OUT]                   *
+*                                                                             *
+*  Description : Fournit la taille de composant requise pour un plein rendu.  *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void gtk_buffer_view_size_request(GtkWidget *widget, GtkRequisition *requisition)
+{
+    if (GTK_BUFFER_VIEW(widget)->buffer_view != NULL)
+    {
+
+    g_buffer_view_get_size(GTK_BUFFER_VIEW(widget)->buffer_view,
+                           &requisition->width, &requisition->height);
+
+    printf(" === size req :: (%d ; %d)\n",
+           requisition->width, requisition->height);
+
+    }
+    else printf(" === size req :: ??\n");
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : view       = composant GTK à mettre à jour.                  *
+*                allocation = étendue accordée à la vue.                      *
+*                                                                             *
+*  Description : S'adapte à la surface concédée par le composant parent.      *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void gtk_buffer_view_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
+{
+    GtkViewPanel *panel;                    /* Autre version du composant  */
+    gint width;                             /* Largeur de l'objet actuelle */
+    gint height;                            /* Hauteur de l'objet actuelle */
+    GtkAllocation valloc;                   /* Surface utilisable          */
+    gboolean changed;                       /* Changement de valeur ?      */
+
+    /* Mise à jour GTK */
+
+    widget->allocation = *allocation;
+
+    if (GTK_WIDGET_REALIZED(widget))
+        gdk_window_move_resize(widget->window,
+                               allocation->x, allocation->y,
+                               allocation->width, allocation->height);
+
+    panel = GTK_VIEW_PANEL(widget);
+
+    if (panel->hadjustment == NULL || panel->vadjustment == NULL)
+        return;
+
+    g_buffer_view_get_size(GTK_BUFFER_VIEW(widget)->buffer_view, &width, &height);
+
+    gtk_view_panel_compute_allocation(panel, &valloc);
+
+    /* Défilement horizontal */
+
+    panel->hadjustment->page_size = valloc.width;
+    panel->hadjustment->step_increment = valloc.width * 0.1;
+    panel->hadjustment->page_increment = valloc.width * 0.9;
+
+    panel->hadjustment->upper = MAX(width, valloc.width);
+
+    gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed);
+
+    gtk_adjustment_changed(panel->hadjustment);
+
+    if (changed)
+        gtk_adjustment_value_changed(panel->hadjustment);
+
+    /* Défilement vertical */
+
+    panel->vadjustment->page_size = valloc.height;
+    panel->vadjustment->step_increment = GTK_BUFFER_VIEW(widget)->line_height;
+    panel->vadjustment->page_increment = panel->vadjustment->step_increment * 10.0;
+
+    panel->vadjustment->upper = MAX(height, valloc.height);
+
+    gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed);
+
+    gtk_adjustment_changed(panel->vadjustment);
+
+    if (changed)
+        gtk_adjustment_value_changed(panel->vadjustment);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : view  = composant GTK à redessiner.                          *
+*                event = informations liées à l'événement.                    *
+*                                                                             *
+*  Description : Met à jour l'affichage de la visualisation de code buffer.   *
+*                                                                             *
+*  Retour      : FALSE pour poursuivre la propagation de l'événement.         *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static gboolean gtk_buffer_view_expose(GtkWidget *widget, GdkEventExpose *event)
+{
+    GtkBufferView *view;                    /* Autre version du composant  */
+    GtkViewPanel *pview;                    /* Autre version du composant  */
+    GtkStyle *style;                        /* Style associé au composant  */
+    GdkDrawable *drawable;                  /* Surface de dessin           */
+    gint fake_x;                            /* Abscisse virtuelle          */
+    gint fake_y;                            /* Ordonnée virtuelle          */
+    GtkViewPanelClass *parent_class;        /* Version pure du parent      */
+
+    view = GTK_BUFFER_VIEW(widget);
+    widget = GTK_WIDGET(view);
+    pview = GTK_VIEW_PANEL(widget);
+
+    drawable = GDK_DRAWABLE(event->window);
+
+    gdk_window_begin_paint_region(drawable, event->region);
+
+    gdk_gc_set_clip_region(pview->gc, event->region);
+
+    style = gtk_widget_get_style(GTK_WIDGET(view));
+
+    fake_x = 0;
+    fake_y = 0;
+    //gtk_block_view_compute_fake_coord(view, &fake_x, &fake_y);
+
+    /* Dessin de la marge gauche */
+
+    gdk_gc_set_foreground(pview->gc, &style->mid[GTK_WIDGET_STATE(widget)]);
+
+    gdk_draw_rectangle(drawable, pview->gc, TRUE,
+                       fake_x, event->area.y, view->left_margin, event->area.y + event->area.height);
+
+    gdk_gc_set_foreground(pview->gc, &style->dark[GTK_WIDGET_STATE(widget)]);
+
+    gdk_draw_line(drawable, pview->gc,
+                  fake_x + view->left_margin, event->area.y,
+                  fake_x + view->left_margin, event->area.y + event->area.height);
+
+    /* Eventuelle bordure globale */
+
+    parent_class = g_type_class_peek(g_type_parent(GTK_TYPE_BUFFER_VIEW));
+
+    GTK_WIDGET_CLASS(parent_class)->expose_event(widget, event);
+
+    /* Impression du désassemblage */
+
+    if (view->buffer_view != NULL)
+        g_buffer_view_draw(view->buffer_view, event, pview->gc, fake_x, fake_y);
+
+    gdk_window_end_paint(drawable);
+
+    return TRUE;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : view   = composant GTK à mettre à jour.                      *
+*                buffer = tampon de lignes à encadrer.                        *
+*                                                                             *
+*  Description : Prend acte de l'association d'un tampon de lignes.           *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+void gtk_buffer_view_attach_buffer(GtkBufferView *view, GCodeBuffer *buffer)
+{
+    gint width;                             /* Largeur de l'objet actuelle */
+    gint height;                            /* Hauteur de l'objet actuelle */
+
+    if (view->buffer != NULL)
+    {
+        g_object_unref(G_OBJECT(view->buffer));
+        g_object_unref(G_OBJECT(view->buffer_view));
+    }
+
+    view->buffer = buffer;
+    g_object_ref(G_OBJECT(view->buffer));
+
+    view->buffer_view = g_buffer_view_new(view->buffer);
+
+    //gdk_threads_enter();
+
+    /* Taille des marges */
+
+    view->line_height = g_buffer_view_get_line_height(view->buffer_view);
+    view->left_margin = 2 * view->line_height;
+    view->left_text = -2.5 * view->line_height;
+
+    /* Validation finale */
+
+    g_buffer_view_get_size(view->buffer_view, &width, &height);
+
+    width += -view->left_text + 1;
+    height += 1;
+
+    gtk_widget_set_size_request(GTK_WIDGET(view), width, height);
+
+    gtk_widget_queue_draw(GTK_WIDGET(view));
+
+    //gdk_flush ();
+    //gdk_threads_leave();
+
+}
diff --git a/src/gtkext/gtkbufferview.h b/src/gtkext/gtkbufferview.h
new file mode 100644
index 0000000..ab7a746
--- /dev/null
+++ b/src/gtkext/gtkbufferview.h
@@ -0,0 +1,59 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkbufferview.h - prototypes pour l'affichage de tampons de lignes
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GTK_BUFFERVIEW_H
+#define _GTK_BUFFERVIEW_H
+
+
+#include <glib-object.h>
+#include <gtk/gtkwidget.h>
+
+
+#include "../glibext/gcodebuffer.h"
+
+
+
+#define GTK_TYPE_BUFFER_VIEW                  (gtk_buffer_view_get_type())
+#define GTK_BUFFER_VIEW(obj)                  (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_BUFFER_VIEW, GtkBufferView))
+#define GTK_BUFFER_VIEW_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_BUFFER_VIEW, GtkBufferViewClass))
+#define GTK_IS_BUFFER_VIEW(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_BUFFER_VIEW))
+#define GTK_IS_BUFFER_VIEW_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_BUFFER_VIEW))
+#define GTK_BUFFER_VIEW_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_BUFFER_VIEW, GtkBufferViewClass))
+
+
+/* Composant d'affichage de tampon de lignes (instance) */
+typedef struct _GtkBufferView GtkBufferView;
+
+/* Composant d'affichage de tampon de lignes (classe) */
+typedef struct _GtkBufferViewClass GtkBufferViewClass;
+
+
+/* Détermine le type du composant d'affichage de tampon de lignes. */
+GType gtk_buffer_view_get_type(void);
+
+/* Prend acte de l'association d'un tampon de lignes. */
+void gtk_buffer_view_attach_buffer(GtkBufferView *, GCodeBuffer *);
+
+
+
+#endif  /* _GTK_BUFFERVIEW_H */
diff --git a/src/gtkext/gtksourceview.c b/src/gtkext/gtksourceview.c
index 63f2926..c44b41f 100644
--- a/src/gtkext/gtksourceview.c
+++ b/src/gtkext/gtksourceview.c
@@ -24,7 +24,7 @@
 #include "gtksourceview.h"
 
 
-#include "gtkviewpanel-int.h"
+#include "gtkbufferview-int.h"
 
 
 
@@ -34,21 +34,14 @@
 /* Composant d'affichage de code source (instance) */
 struct _GtkSourceView
 {
-    GtkViewPanel parent;                    /* A laisser en premier        */
-
-    GCodeBuffer *buffer;                    /* Code sous forme de texte    */
-    GBufferView *buffer_view;               /* Affichage de cette forme    */
-
-    gint line_height;                       /* Hauteur maximale des lignes */
-    gint left_margin;                       /* Marge gauche + espace       */
-    gint left_text;                         /* Début d'impression du code  */
+    GtkBufferView parent;                   /* A laisser en premier        */
 
 };
 
 /* Composant d'affichage de code source (classe) */
 struct _GtkSourceViewClass
 {
-    GtkViewPanelClass parent;               /* A laisser en premier        */
+    GtkBufferViewClass parent;              /* A laisser en premier        */
 
 };
 
@@ -59,29 +52,18 @@ static void gtk_source_view_class_init(GtkSourceViewClass *);
 /* Procède à l'initialisation de l'afficheur de code source. */
 static void gtk_source_view_init(GtkSourceView *);
 
-/*Encadre la construction graphique initiale de la visualisat°. */
-static void gtk_source_view_realize(GtkWidget *);
-
-/* Fournit la taille de composant requise pour un plein rendu. */
-static void gtk_source_view_size_request(GtkWidget *, GtkRequisition *);
-
-/* S'adapte à la surface concédée par le composant parent. */
-static void gtk_source_view_size_allocate(GtkWidget *, GtkAllocation *);
-
-/* Met à jour l'affichage de la visualisation de code source. */
-static gboolean gtk_source_view_expose(GtkWidget *, GdkEventExpose *);
-
 /* Prend acte de l'association d'un binaire chargé. */
 static void gtk_source_view_attach_binary(GtkSourceView *, GOpenidaBinary *);
 
 
+
 /* ---------------------------------------------------------------------------------- */
 /*                            INTERACTION DIRECTE AVEC GTK                            */
 /* ---------------------------------------------------------------------------------- */
 
 
 /* Détermine le type du composant d'affichage de code source. */
-G_DEFINE_TYPE(GtkSourceView, gtk_source_view, GTK_TYPE_VIEW_PANEL)
+G_DEFINE_TYPE(GtkSourceView, gtk_source_view, GTK_TYPE_BUFFER_VIEW)
 
 
 /******************************************************************************
@@ -98,14 +80,6 @@ G_DEFINE_TYPE(GtkSourceView, gtk_source_view, GTK_TYPE_VIEW_PANEL)
 
 static void gtk_source_view_class_init(GtkSourceViewClass *class)
 {
-    GtkWidgetClass *widget_class;           /* Classe version Widget       */
-
-    widget_class = GTK_WIDGET_CLASS(class);
-
-    widget_class->realize = gtk_source_view_realize;
-    widget_class->size_request = gtk_source_view_size_request;
-    widget_class->size_allocate = gtk_source_view_size_allocate;
-    widget_class->expose_event = gtk_source_view_expose;
 
 }
 
@@ -135,201 +109,6 @@ static void gtk_source_view_init(GtkSourceView *view)
 
 /******************************************************************************
 *                                                                             *
-*  Paramètres  : widget = composant GTK à redessiner.                         *
-*                                                                             *
-*  Description : Encadre la construction graphique initiale de la visualisat°.*
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void gtk_source_view_realize(GtkWidget *widget)
-{
-    GtkViewPanelClass *parent_class;        /* Version pure du parent      */
-
-    parent_class = GTK_VIEW_PANEL_CLASS(g_type_class_peek_parent(GTK_SOURCE_VIEW_GET_CLASS(widget)));
-
-    GTK_WIDGET_CLASS(parent_class)->realize(widget);
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : widget      = composant GTK à consulter.                     *
-*                requisition = dimensions souhaitées. [OUT]                   *
-*                                                                             *
-*  Description : Fournit la taille de composant requise pour un plein rendu.  *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void gtk_source_view_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
-    if (GTK_SOURCE_VIEW(widget)->buffer_view != NULL)
-    {
-
-    g_buffer_view_get_size(GTK_SOURCE_VIEW(widget)->buffer_view,
-                           &requisition->width, &requisition->height);
-
-    printf(" === size req :: (%d ; %d)\n",
-           requisition->width, requisition->height);
-
-    }
-    else printf(" === size req :: ??\n");
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : view       = composant GTK à mettre à jour.                  *
-*                allocation = étendue accordée à la vue.                      *
-*                                                                             *
-*  Description : S'adapte à la surface concédée par le composant parent.      *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void gtk_source_view_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
-    GtkViewPanel *panel;                    /* Autre version du composant  */
-    gint width;                             /* Largeur de l'objet actuelle */
-    gint height;                            /* Hauteur de l'objet actuelle */
-    GtkAllocation valloc;                   /* Surface utilisable          */
-    gboolean changed;                       /* Changement de valeur ?      */
-
-    /* Mise à jour GTK */
-
-    widget->allocation = *allocation;
-
-    if (GTK_WIDGET_REALIZED(widget))
-        gdk_window_move_resize(widget->window,
-                               allocation->x, allocation->y,
-                               allocation->width, allocation->height);
-
-    panel = GTK_VIEW_PANEL(widget);
-
-    if (panel->hadjustment == NULL || panel->vadjustment == NULL)
-        return;
-
-    g_buffer_view_get_size(GTK_SOURCE_VIEW(widget)->buffer_view, &width, &height);
-
-    gtk_view_panel_compute_allocation(panel, &valloc);
-
-    /* Défilement horizontal */
-
-    panel->hadjustment->page_size = valloc.width;
-    panel->hadjustment->step_increment = valloc.width * 0.1;
-    panel->hadjustment->page_increment = valloc.width * 0.9;
-
-    panel->hadjustment->upper = MAX(width, valloc.width);
-
-    gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed);
-
-    gtk_adjustment_changed(panel->hadjustment);
-
-    if (changed)
-        gtk_adjustment_value_changed(panel->hadjustment);
-
-    /* Défilement vertical */
-
-    panel->vadjustment->page_size = valloc.height;
-    panel->vadjustment->step_increment = GTK_SOURCE_VIEW(widget)->line_height;
-    panel->vadjustment->page_increment = panel->vadjustment->step_increment * 10.0;
-
-    panel->vadjustment->upper = MAX(height, valloc.height);
-
-    gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed);
-
-    gtk_adjustment_changed(panel->vadjustment);
-
-    if (changed)
-        gtk_adjustment_value_changed(panel->vadjustment);
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : view  = composant GTK à redessiner.                          *
-*                event = informations liées à l'événement.                    *
-*                                                                             *
-*  Description : Met à jour l'affichage de la visualisation de code source.   *
-*                                                                             *
-*  Retour      : FALSE pour poursuivre la propagation de l'événement.         *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static gboolean gtk_source_view_expose(GtkWidget *widget, GdkEventExpose *event)
-{
-    GtkSourceView *view;                    /* Autre version du composant  */
-    GtkViewPanel *pview;                    /* Autre version du composant  */
-    GtkStyle *style;                        /* Style associé au composant  */
-    GdkDrawable *drawable;                  /* Surface de dessin           */
-    gint fake_x;                            /* Abscisse virtuelle          */
-    gint fake_y;                            /* Ordonnée virtuelle          */
-    GtkViewPanelClass *parent_class;        /* Version pure du parent      */
-
-    view = GTK_SOURCE_VIEW(widget);
-    widget = GTK_WIDGET(view);
-    pview = GTK_VIEW_PANEL(widget);
-
-    drawable = GDK_DRAWABLE(event->window);
-
-    gdk_window_begin_paint_region(drawable, event->region);
-
-    gdk_gc_set_clip_region(pview->gc, event->region);
-
-    style = gtk_widget_get_style(GTK_WIDGET(view));
-
-    fake_x = 0;
-    fake_y = 0;
-    //gtk_block_view_compute_fake_coord(view, &fake_x, &fake_y);
-
-    /* Dessin de la marge gauche */
-
-    gdk_gc_set_foreground(pview->gc, &style->mid[GTK_WIDGET_STATE(widget)]);
-
-    gdk_draw_rectangle(drawable, pview->gc, TRUE,
-                       fake_x, event->area.y, view->left_margin, event->area.y + event->area.height);
-
-    gdk_gc_set_foreground(pview->gc, &style->dark[GTK_WIDGET_STATE(widget)]);
-
-    gdk_draw_line(drawable, pview->gc,
-                  fake_x + view->left_margin, event->area.y,
-                  fake_x + view->left_margin, event->area.y + event->area.height);
-
-    /* Eventuelle bordure globale */
-
-    parent_class = GTK_VIEW_PANEL_CLASS(g_type_class_peek_parent(GTK_SOURCE_VIEW_GET_CLASS(view)));
-
-    GTK_WIDGET_CLASS(parent_class)->expose_event(widget, event);
-
-    /* Impression du désassemblage */
-
-    if (view->buffer_view != NULL)
-        g_buffer_view_draw(view->buffer_view, event, pview->gc, fake_x, fake_y);
-
-    gdk_window_end_paint(drawable);
-
-    return TRUE;
-
-}
-
-
-/******************************************************************************
-*                                                                             *
 *  Paramètres  : -                                                            *
 *                                                                             *
 *  Description : Crée un nouveau composant pour l'affichage de code source.   *
@@ -366,43 +145,10 @@ GtkWidget *gtk_source_view_new(void)
 
 static void gtk_source_view_attach_binary(GtkSourceView *view, GOpenidaBinary *binary)
 {
+    GCodeBuffer *buffer;                    /* Tampon par défaut           */
 
+    buffer = g_openida_binary_get_decompiled_buffer(binary, -1);
 
-
-
-
-    gint width;                             /* Largeur de l'objet actuelle */
-    gint height;                            /* Hauteur de l'objet actuelle */
-
-
-    view->buffer = g_openida_binary_get_decompiled_buffer(binary, NULL);
-
-
-    view->buffer_view = g_buffer_view_new(view->buffer);
-
-
-
-
-    gdk_threads_enter();
-
-    /* Taille des marges */
-
-    view->line_height = g_buffer_view_get_line_height(view->buffer_view);
-    view->left_margin = 2 * view->line_height;
-    view->left_text = -2.5 * view->line_height;
-
-    /* Validation finale */
-
-    g_buffer_view_get_size(view->buffer_view, &width, &height);
-
-    width += -view->left_text + 1;
-    height += 1;
-
-    gtk_widget_set_size_request(GTK_WIDGET(view), width, height);
-
-
-    gdk_flush ();
-    gdk_threads_leave();
-
+    gtk_buffer_view_attach_buffer(GTK_BUFFER_VIEW(view), buffer);
 
 }
diff --git a/src/gtkext/gtksourceview.h b/src/gtkext/gtksourceview.h
index 3e78a20..e6cf37b 100644
--- a/src/gtkext/gtksourceview.h
+++ b/src/gtkext/gtksourceview.h
@@ -25,7 +25,6 @@
 #define _GTK_SOURCEVIEW_H
 
 
-
 #include <glib-object.h>
 #include <gtk/gtkwidget.h>
 
diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am
new file mode 100644
index 0000000..801ee73
--- /dev/null
+++ b/src/gui/Makefile.am
@@ -0,0 +1,20 @@
+
+noinst_LTLIBRARIES  = libgui.la
+
+libgui_la_SOURCES =						\
+	editem-int.h						\
+	editem.h editem.c
+
+libgui_la_LIBADD =						\
+	tb/libguitb.la
+
+libgui_la_LDFLAGS = 
+
+
+INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
+
+AM_CPPFLAGS = 
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
+
+SUBDIRS = tb
diff --git a/src/gui/editem-int.h b/src/gui/editem-int.h
new file mode 100644
index 0000000..cdc53ea
--- /dev/null
+++ b/src/gui/editem-int.h
@@ -0,0 +1,77 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * editem-int.h - prototypes pour les définitions internes liées aux éléments réactifs de l'éditeur
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _GUI_EDITEM_INT_H
+#define _GUI_EDITEM_INT_H
+
+
+#include "editem.h"
+
+
+#include <gtk/gtkwidget.h>
+
+
+#include "../common/dllist.h"
+
+
+
+/* Réagit à un changement du binaire courant. */
+typedef void (* update_item_binary_fc) (GEditorItem *, GOpenidaBinary *);
+
+/* Réagit à un changement d'affichage principal de contenu. */
+typedef void (* update_item_view_fc) (GEditorItem *, GtkViewPanel *);
+
+
+/* Elément réactif quelconque de l'éditeur (instance) */
+struct _GEditorItem
+{
+    GObject parent;                         /* A laisser en premier        */
+
+    DL_LIST_ITEM(link);                     /* Maillon de liste chaînée    */
+
+    GObject *ref;                           /* Espce de référencement      */
+
+    const char *name;                       /* Nom du panneau              */
+    GtkWidget *widget;                      /* Composant GTK d'affichage   */
+
+    update_item_binary_fc update_binary;    /* Changement de binaire       */
+    update_item_view_fc update_view;        /* Rechargement dû à une vue   */
+
+};
+
+
+/* Elément réactif quelconque de l'éditeur (classe) */
+struct _GEditorItemClass
+{
+    GObjectClass parent;                    /* A laisser en premier        */
+
+};
+
+
+#define editem_list_add_tail(new, head) dl_list_add_tail(new, head, GEditorItem, link) 
+#define editem_list_for_each(pos, head) dl_list_for_each(pos, head, GEditorItem, link) 
+
+
+
+#endif  /* _GUI_EDITEM_INT_H */
diff --git a/src/gui/editem.c b/src/gui/editem.c
new file mode 100644
index 0000000..694591b
--- /dev/null
+++ b/src/gui/editem.c
@@ -0,0 +1,171 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * editem.c - gestion des différents éléments réactifs de l'éditeurs
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "editem.h"
+
+
+#include "editem-int.h"
+
+
+
+/* ------------------------- ELEMENT INDIVIDUEL D'INTERFACE ------------------------- */
+
+
+/* Initialise la classe des éléments réactifs de l'éditeur. */
+static void g_editor_item_class_init(GEditorItemClass *);
+
+/* Initialise une instance d'élément réactif pour l'éditeur. */
+static void g_editor_item_init(GEditorItem *);
+
+
+
+/* ---------------------------- MANIPULATION D'ENSEMBLES ---------------------------- */
+
+
+/* liste des éléments enregistrés */
+static GEditorItem *_editem_list = NULL;
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/*                           ELEMENT INDIVIDUEL D'INTERFACE                           */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Indique le type défini pour un élément réactif d'éditeur. */
+G_DEFINE_TYPE(GEditorItem, g_editor_item, G_TYPE_OBJECT);
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : klass = classe à initialiser.                                *
+*                                                                             *
+*  Description : Initialise la classe des éléments réactifs de l'éditeur.     *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_editor_item_class_init(GEditorItemClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item = instance à initialiser.                               *
+*                                                                             *
+*  Description : Initialise une instance d'élément réactif pour l'éditeur.    *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_editor_item_init(GEditorItem *item)
+{
+    DL_LIST_ITEM_INIT(&item->link);
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/*                              MANIPULATION D'ENSEMBLES                              */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : -                                                            *
+*                                                                             *
+*  Description : Procède à l'enregistrement d'un élément reactif de l'éditeur.*
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+void register_editor_item(GEditorItem *item)
+{
+    editem_list_add_tail(item, &_editem_list);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : ref    = espace de référencement global.                     *
+*                binary = nouvelle instance de binaire analysé.               *
+*                                                                             *
+*  Description : Lance une actualisation du fait d'un changement de binaire.  *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+void change_editor_items_current_binary(GObject *ref, GOpenidaBinary *binary)
+{
+    GEditorItem *iter;                     /* Boucle de parcours          */
+
+    g_object_set_data(ref, "current_binary", binary);
+
+    editem_list_for_each(iter, _editem_list)
+        if (iter->update_binary != NULL)
+            iter->update_binary(iter, binary);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : ref  = espace de référencement global.                       *
+*                view = nouveau panneau d'affichage actif.                    *
+*                                                                             *
+*  Description : Lance une actualisation du fait d'un changement de vue.      *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+void change_editor_items_current_view(GObject *ref, GtkViewPanel *view)
+{
+    GEditorItem *iter;                     /* Boucle de parcours          */
+
+    g_object_set_data(ref, "current_view", view);
+
+    editem_list_for_each(iter, _editem_list)
+        if (iter->update_binary != NULL)
+            iter->update_view(iter, view);
+
+}
diff --git a/src/gui/editem.h b/src/gui/editem.h
new file mode 100644
index 0000000..e991630
--- /dev/null
+++ b/src/gui/editem.h
@@ -0,0 +1,74 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * editem.h - prototypes pour la gestion des différents éléments réactifs de l'éditeurs
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _GUI_EDITEM_H
+#define _GUI_EDITEM_H
+
+
+#include <glib-object.h>
+
+
+#include "../analysis/binary.h"
+#include "../gtkext/gtkviewpanel.h"
+
+
+
+/* ------------------------- ELEMENT INDIVIDUEL D'INTERFACE ------------------------- */
+
+
+#define G_TYPE_EDITOR_ITEM               g_editor_item_get_type()
+#define G_EDITOR_ITEM(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_editor_item_get_type(), GEditorItem))
+#define G_IS_EDITOR_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_editor_item_get_type()))
+#define G_EDITOR_ITEM_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_EDITOR_ITEM, GEditorItemClass))
+#define G_IS_EDITOR_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_EDITOR_ITEM))
+#define G_EDITOR_ITEM_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_EDITOR_ITEM, GEditorItemClass))
+
+
+/* Elément réactif quelconque de l'éditeur (instance) */
+typedef struct _GEditorItem GEditorItem;
+
+/* Elément réactif quelconque de l'éditeur (classe) */
+typedef struct _GEditorItemClass GEditorItemClass;
+
+
+/* Indique le type défini pour un élément réactif d'éditeur. */
+GType g_editor_item_get_type(void);
+
+
+
+/* ---------------------------- MANIPULATION D'ENSEMBLES ---------------------------- */
+
+
+/* Procède à l'enregistrement d'un élément reactif de l'éditeur. */
+void register_editor_item(GEditorItem *);
+
+/* Lance une actualisation du fait d'un changement de binaire. */
+void change_editor_items_current_binary(GObject *, GOpenidaBinary *);
+
+/* Lance une actualisation du fait d'un changement de vue. */
+void change_editor_items_current_view(GObject *, GtkViewPanel *);
+
+
+
+#endif  /* _GUI_EDITEM_H */
diff --git a/src/gui/tb/Makefile.am b/src/gui/tb/Makefile.am
new file mode 100644
index 0000000..65679cb
--- /dev/null
+++ b/src/gui/tb/Makefile.am
@@ -0,0 +1,17 @@
+
+noinst_LTLIBRARIES  = libguitb.la
+
+libguitb_la_SOURCES =					\
+	source.h source.c					\
+	toolbar.h toolbar.c
+
+libguitb_la_LDFLAGS = 
+
+
+INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
+
+AM_CPPFLAGS = 
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
+
+SUBDIRS = 
diff --git a/src/gui/tb/source.c b/src/gui/tb/source.c
new file mode 100644
index 0000000..8750608
--- /dev/null
+++ b/src/gui/tb/source.c
@@ -0,0 +1,227 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * source.c - sélection du fichier ciblé lors d'une décompilation
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "source.h"
+
+
+#include <i18n.h>
+
+
+#include "toolbar.h"
+#include "../editem-int.h"
+#include "../../format/format.h"
+#include "../../gtkext/easygtk.h"
+#include "../../gtkext/gtkbufferview.h"
+#include "../../gtkext/gtksourceview.h"
+
+
+
+/* Construit l'élément GTK pour une barre d'outils. */
+static GtkWidget *build_source_tb_widget(GObject *);
+
+/* Réagit à un changement du binaire courant. */
+static void update_source_item_binary(GEditorItem *, GOpenidaBinary *);
+
+/* Réagit à un changement de panneau d'affichage courant. */
+static void update_source_item_view(GEditorItem *, GtkViewPanel *);
+
+/* Réagit à un changement de sélection de la source courante. */
+static void change_selected_source(GtkComboBox *, GObject *);
+
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : ref = espace de référencement global.                        *
+*                                                                             *
+*  Description : Construit l'élément GTK pour une barre d'outils.             *
+*                                                                             *
+*  Retour      : Adresse du composant mis en place.                           *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static GtkWidget *build_source_tb_widget(GObject *ref)
+{
+    GtkWidget *result;                      /* Composant à retourner       */
+    GtkWidget *handlebox;                   /* Support relocalisable       */
+    GtkWidget *hbox;                        /* Support interne             */
+    GtkWidget *label;                       /* Etiquette d'introduction    */
+    GtkWidget *comboboxentry;               /* Liste de fichiers           */
+
+    result = GTK_WIDGET(gtk_tool_item_new());
+    gtk_widget_show(result);
+
+    handlebox = gtk_handle_box_new();
+    gtk_widget_show(handlebox);
+    gtk_container_add(GTK_CONTAINER(result), handlebox);
+
+    hbox = gtk_hbox_new(FALSE, 0);
+    gtk_widget_show(hbox);
+    gtk_container_add(GTK_CONTAINER(handlebox), hbox);
+
+    label = qck_create_label(G_OBJECT(result), "label", _(" Source: "));
+    gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+
+    comboboxentry = qck_create_combobox(G_OBJECT(result), "combo",
+                                        G_CALLBACK(change_selected_source), ref);
+    gtk_box_pack_start(GTK_BOX(hbox), comboboxentry, TRUE, TRUE, 0);
+
+    return result;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : ref = espace de référencement global.                        *
+*                                                                             *
+*  Description : Crée une sélection de fichier réactive pour barre d'outils.  *
+*                                                                             *
+*  Retour      : Adresse de la structure d'encadrement mise en place.         *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+GEditorItem *create_source_tb_item(GObject *ref)
+{
+    GEditorItem *result;                    /* Structure à retourner       */
+    GtkWidget *widget;                      /* Composant affiché à l'écran */
+
+    widget = build_source_tb_widget(ref);
+
+    result = g_toolbar_item_new(ref, "source", widget, _("Source files"));
+
+    result->update_binary = update_source_item_binary;
+    result->update_view = update_source_item_view;
+
+    return result;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item   = élément réactif sollicité.                          *
+*                binary = binaire chargé nouvellement affiché.                *
+*                                                                             *
+*  Description : Réagit à un changement du binaire courant.                   *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void update_source_item_binary(GEditorItem *item, GOpenidaBinary *binary)
+{
+    GtkComboBox *combo;                     /* Liste de sélection          */
+    GtkTreeModel *model;                    /* Gestionnaire d'éléments     */
+    GtkTreeIter iter;                       /* Boucle de parcours #2       */
+    GExeFormat *format;                     /* Format d'exécutable associé */
+    size_t count;                           /* Quantité de fichiers        */
+    size_t defsrc;                          /* Fichier source principal    */
+    const char * const *files;              /* Liste de fichiers source    */
+    size_t i;                               /* Boucle de parcours #2       */
+
+    /* Réinitialisation */
+
+    combo = GTK_COMBO_BOX(g_object_get_data(G_OBJECT(item->widget), "combo"));
+
+    /* TODO : signal */
+
+    model = gtk_combo_box_get_model(combo);
+
+    while (gtk_tree_model_get_iter_first(model, &iter))
+        gtk_combo_box_remove_text(combo, 0);
+
+    /* Inscriptions */
+
+    format = g_openida_binary_get_format(binary);
+    files = g_binary_format_get_source_files(G_BIN_FORMAT(format), &count, &defsrc);
+
+    for (i = 0; i < count; i++)
+        gtk_combo_box_append_text(combo, files[i]);
+
+    /* Réactivation */
+
+    /* TODO : signal */
+
+    gtk_combo_box_set_active(combo, defsrc);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item = élément réactif sollicité.                            *
+*                view = nouveau panneau d'affichage actif.                    *
+*                                                                             *
+*  Description : Réagit à un changement de panneau d'affichage courant.       *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void update_source_item_view(GEditorItem *item, GtkViewPanel *view)
+{
+    gtk_widget_set_sensitive(item->widget, GTK_IS_SOURCE_VIEW(view));
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : widget = composant GTK en cause.                             *
+*                ref    = espace de référencement global.                     *
+*                                                                             *
+*  Description : Réagit à un changement de sélection de la source courante.   *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void change_selected_source(GtkComboBox *widget, GObject *ref)
+{
+    gint index;                             /* Nouvelle source ciblée      */
+    GOpenidaBinary *binary;                 /* Binaire chargé courant      */
+    GCodeBuffer *buffer;                    /* Nouveau tampon à présenter  */
+    GtkBufferView *view;                    /* Afficheur de tampons        */
+
+    index = gtk_combo_box_get_active(widget);
+
+    binary = G_OPENIDA_BINARY(g_object_get_data(ref, "current_binary"));
+    buffer = g_openida_binary_get_decompiled_buffer(binary, index);
+
+    view = GTK_BUFFER_VIEW(g_object_get_data(ref, "current_view"));
+    if (GTK_IS_BUFFER_VIEW(view))
+        gtk_buffer_view_attach_buffer(view, buffer);
+
+}
diff --git a/src/gui/tb/source.h b/src/gui/tb/source.h
new file mode 100644
index 0000000..ec8ea7f
--- /dev/null
+++ b/src/gui/tb/source.h
@@ -0,0 +1,38 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * source.h - prototypes pour la sélection du fichier ciblé lors d'une décompilation
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _GUI_TB_SOURCE_H
+#define _GUI_TB_SOURCE_H
+
+
+#include "../editem.h"
+
+
+
+/* Crée une sélection de fichier réactive pour barre d'outils. */
+GEditorItem *create_source_tb_item(GObject *ref);
+
+
+
+#endif  /* _GUI_TB_SOURCE_H */
diff --git a/src/gui/tb/toolbar.c b/src/gui/tb/toolbar.c
new file mode 100644
index 0000000..fda1b7b
--- /dev/null
+++ b/src/gui/tb/toolbar.c
@@ -0,0 +1,138 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * toolbar.c - gestion des éléments réactifs spécifiques à la barre d'outils
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "toolbar.h"
+
+
+#include "../editem-int.h"
+
+
+
+/* Elément réactif pour barre d'outils de l'éditeur (instance) */
+struct _GToolbarItem
+{
+    GEditorItem parent;                     /* A laisser en premier        */
+
+};
+
+
+/* Elément réactif pour barre d'outils de l'éditeur (classe) */
+struct _GToolbarItemClass
+{
+    GEditorItemClass parent;                /* A laisser en premier        */
+
+};
+
+
+/* Initialise la classe des éléments réactifs de l'éditeur. */
+static void g_toolbar_item_class_init(GToolbarItemClass *);
+
+/* Initialise une instance d'élément réactif pour l'éditeur. */
+static void g_toolbar_item_init(GToolbarItem *);
+
+
+
+/* Indique le type défini pour un élément destiné à une barre d'outils. */
+G_DEFINE_TYPE(GToolbarItem, g_toolbar_item, G_TYPE_EDITOR_ITEM);
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : klass = classe à initialiser.                                *
+*                                                                             *
+*  Description : Initialise la classe des éléments réactifs de l'éditeur.     *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_toolbar_item_class_init(GToolbarItemClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item = instance à initialiser.                               *
+*                                                                             *
+*  Description : Initialise une instance d'élément réactif pour l'éditeur.    *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_toolbar_item_init(GToolbarItem *item)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : ref    = espace de référencement global.                     *
+*                name   = nom associé à l'élément.                            *
+*                widget = composant à présenter à l'affichage.                *
+*                label  = étiquette destinée au menu.                         *
+*                                                                             *
+*  Description : Crée un élément de barre d'outils réactif.                   *
+*                                                                             *
+*  Retour      : Adresse de la structure mise en place.                       *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+GEditorItem *g_toolbar_item_new(GObject *ref, const char *name, GtkWidget *widget, const char *label)
+{
+    GToolbarItem *result;                   /* Structure à retourner       */
+    GEditorItem *item;                      /* Autre version de l'élément  */
+    GtkContainer *toolbar;                  /* Barre d'outils visée        */
+
+    result = g_object_new(G_TYPE_TOOLBAR_ITEM, NULL);
+
+    /* Initialisation générique */
+
+    item = G_EDITOR_ITEM(result);
+
+    g_object_ref(ref);
+    item->ref = ref;
+
+    item->name = name;
+
+    g_object_ref(widget);
+    item->widget = widget;
+
+    /* Intégration dans la barre */
+
+    toolbar = GTK_CONTAINER(g_object_get_data(ref, "toolbar"));
+    gtk_container_add(toolbar, widget);
+
+    return G_EDITOR_ITEM(result);
+
+}
diff --git a/src/gui/tb/toolbar.h b/src/gui/tb/toolbar.h
new file mode 100644
index 0000000..1384c05
--- /dev/null
+++ b/src/gui/tb/toolbar.h
@@ -0,0 +1,56 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * toolbar.h - prototypes pour la gestion des éléments réactifs spécifiques à la barre d'outils
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of OpenIDA.
+ *
+ *  OpenIDA is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  OpenIDA is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _GUI_TOOLBAR_H
+#define _GUI_TOOLBAR_H
+
+
+#include "../editem.h"
+
+
+
+#define G_TYPE_TOOLBAR_ITEM               g_toolbar_item_get_type()
+#define G_TOOLBAR_ITEM(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_toolbar_item_get_type(), GToolbarItem))
+#define G_IS_TOOLBAR_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_toolbar_item_get_type()))
+#define G_TOOLBAR_ITEM_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_TOOLBAR_ITEM, GToolbarItemClass))
+#define G_IS_TOOLBAR_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_TOOLBAR_ITEM))
+#define G_TOOLBAR_ITEM_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_TOOLBAR_ITEM, GToolbarItemClass))
+
+
+/* Elément réactif pour barre d'outils de l'éditeur (instance) */
+typedef struct _GToolbarItem GToolbarItem;
+
+/* Elément réactif pour barre d'outils de l'éditeur (classe) */
+typedef struct _GToolbarItemClass GToolbarItemClass;
+
+
+/* Indique le type défini pour un élément destiné à une barre d'outils. */
+GType g_toolbar_item_get_type(void);
+
+/* Crée un élément de barre d'outils réactif. */
+GEditorItem *g_toolbar_item_new(GObject *, const char *, GtkWidget *, const char *);
+
+
+
+#endif  /* _GUI_TOOLBAR_H */
-- 
cgit v0.11.2-87-g4458