From a174ee784f5d9e554ed09181b8e6d8c0205f8ef5 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Sun, 25 Mar 2012 12:36:16 +0000
Subject: Scrolled to the selected symbol.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@241 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog                       | 48 ++++++++++++++++++++++++++++++++++++++
 src/arch/dalvik/pseudo/fill.c   |  4 ++--
 src/arch/dalvik/pseudo/switch.c |  4 ++--
 src/arch/instruction.c          |  4 ++--
 src/decomp/expr/block.c         |  4 ++--
 src/decomp/instruction.c        |  4 ++--
 src/decomp/lang/asm.c           |  6 ++---
 src/decomp/lang/java.c          | 18 +++++++--------
 src/editor.c                    |  2 +-
 src/format/dex/class.c          |  4 ++--
 src/glibext/gbufferline.c       | 28 +++++++++++++++++++---
 src/glibext/gbufferline.h       |  5 +++-
 src/glibext/gcodebuffer.c       | 51 ++++++++++++++++++++++++++++++++++++++---
 src/glibext/gcodebuffer.h       |  8 ++++++-
 src/gtkext/gtkbinview-int.h     |  4 ++--
 src/gtkext/gtkbufferview.c      | 26 +++++++++++++++++++++
 src/gtkext/gtkdockstation.c     |  2 ++
 src/gtkext/gtkviewpanel-int.h   |  4 ++++
 src/gtkext/gtkviewpanel.c       | 47 ++++++++++++++++++++++++++++++++++++-
 src/gtkext/gtkviewpanel.h       |  3 +++
 src/gui/panels/panel-int.h      |  2 +-
 src/gui/panels/panel.c          | 13 +++++++----
 src/gui/panels/panel.h          |  2 +-
 src/gui/panels/symbols.c        | 33 ++++++++++++++++----------
 src/gui/panels/symbols.h        |  4 ++--
 25 files changed, 273 insertions(+), 57 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f6a478b..a0d988b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+12-03-25  Cyrille Bagard <nocbos@gmail.com>
+
+	* src/arch/dalvik/pseudo/fill.c:
+	* src/arch/dalvik/pseudo/switch.c:
+	* src/arch/instruction.c:
+	Update all g_code_buffer_append_new_line() calls.
+
+	* src/decomp/expr/block.c:
+	* src/decomp/instruction.c:
+	* src/decomp/lang/asm.c:
+	* src/decomp/lang/java.c:
+	Mark g_code_buffer_append_new_line() call as "to fix".
+
+	* src/editor.c:
+	Provide the reference pointer to panels.
+
+	* src/format/dex/class.c:
+	Mark g_code_buffer_append_new_line() call as "to fix".
+
+	* src/glibext/gbufferline.c:
+	* src/glibext/gbufferline.h:
+	* src/glibext/gcodebuffer.c:
+	* src/glibext/gcodebuffer.h:
+	Scroll to a given address.
+
+	* src/gtkext/gtkbinview-int.h:
+	Disable get_addr_coordinates_fc() definition here.
+
+	* src/gtkext/gtkbufferview.c:
+	Scroll to a given address.
+
+	* src/gtkext/gtkdockstation.c:
+	Restore previous selected tab when changing content.
+
+	* src/gtkext/gtkviewpanel.c:
+	* src/gtkext/gtkviewpanel.h:
+	* src/gtkext/gtkviewpanel-int.h:
+	Scroll to a given address.
+
+	* src/gui/panels/panel.c:
+	* src/gui/panels/panel.h:
+	* src/gui/panels/panel-int.h:
+	Memorize the global reference pointer.
+
+	* src/gui/panels/symbols.c:
+	* src/gui/panels/symbols.h:
+	Scroll to the selected symbol. Handle a reference pointer.
+
 12-03-17  Cyrille Bagard <nocbos@gmail.com>
 
 	* configure.ac:
diff --git a/src/arch/dalvik/pseudo/fill.c b/src/arch/dalvik/pseudo/fill.c
index 9573000..4582f6c 100644
--- a/src/arch/dalvik/pseudo/fill.c
+++ b/src/arch/dalvik/pseudo/fill.c
@@ -2,7 +2,7 @@
 /* OpenIDA - Outil d'analyse de fichiers binaires
  * fill.c - prise en charge de l'instruction spéciale fill-array-data
  *
- * Copyright (C) 2011 Cyrille Bagard
+ * Copyright (C) 2011-2012 Cyrille Bagard
  *
  *  This file is part of OpenIDA.
  *
@@ -179,7 +179,7 @@ static void g_dalvik_fill_instr_print(const GDalvikFillInstr *instr, GCodeBuffer
 
     base = G_ARCH_INSTRUCTION(instr);
 
-    line = g_code_buffer_append_new_line(buffer);
+    line = g_code_buffer_append_new_line(buffer, base->address);
 
     /* Adresse virtuelle ou physique */
 
diff --git a/src/arch/dalvik/pseudo/switch.c b/src/arch/dalvik/pseudo/switch.c
index 30511ac..0a84e9a 100644
--- a/src/arch/dalvik/pseudo/switch.c
+++ b/src/arch/dalvik/pseudo/switch.c
@@ -2,7 +2,7 @@
 /* OpenIDA - Outil d'analyse de fichiers binaires
  * switch.c - prise en charge des instructions spéciales (packed|sparse)switch
  *
- * Copyright (C) 2011 Cyrille Bagard
+ * Copyright (C) 2011-2012 Cyrille Bagard
  *
  *  This file is part of OpenIDA.
  *
@@ -182,7 +182,7 @@ static void g_dalvik_switch_instr_print(const GDalvikSwitchInstr *instr, GCodeBu
 
     base = G_ARCH_INSTRUCTION(instr);
 
-    line = g_code_buffer_append_new_line(buffer);
+    line = g_code_buffer_append_new_line(buffer, base->address);
 
     /* Adresse virtuelle ou physique */
 
diff --git a/src/arch/instruction.c b/src/arch/instruction.c
index cfc6e20..6bb10e8 100644
--- a/src/arch/instruction.c
+++ b/src/arch/instruction.c
@@ -2,7 +2,7 @@
 /* OpenIDA - Outil d'analyse de fichiers binaires
  * instruction.c - gestion générique des instructions
  *
- * Copyright (C) 2008-2011 Cyrille Bagard
+ * Copyright (C) 2008-2012 Cyrille Bagard
  *
  *  This file is part of OpenIDA.
  *
@@ -609,7 +609,7 @@ static void _g_arch_instruction_print(const GArchInstruction *instr, GCodeBuffer
     size_t klen;                            /* Taille de ce mot clef       */
     size_t j;                               /* Boucle de parcours #2       */
 
-    line = g_code_buffer_append_new_line(buffer);
+    line = g_code_buffer_append_new_line(buffer, instr->address);
 
     /* Adresse virtuelle ou physique */
 
diff --git a/src/decomp/expr/block.c b/src/decomp/expr/block.c
index c14e169..1ec15a7 100644
--- a/src/decomp/expr/block.c
+++ b/src/decomp/expr/block.c
@@ -2,7 +2,7 @@
 /* OpenIDA - Outil d'analyse de fichiers binaires
  * block.c - regroupement d'un lot d'instructions
  *
- * Copyright (C) 2010 Cyrille Bagard
+ * Copyright (C) 2010-2012 Cyrille Bagard
  *
  *  This file is part of OpenIDA.
  *
@@ -154,7 +154,7 @@ static void g_expr_block_print(const GExprBlock *block, GCodeBuffer *buffer, GBu
     for (i = 0; i < block->count; i++)
     {
         if (i > 0)
-            line = g_code_buffer_append_new_line(buffer);   /* FIXME : n° de ligne */
+            line = g_code_buffer_append_new_line_fixme(buffer);   /* FIXME : n° de ligne */
 
         g_dec_instruction_print(block->list[i], buffer, line, output);
 
diff --git a/src/decomp/instruction.c b/src/decomp/instruction.c
index 96411f5..c1afa44 100644
--- a/src/decomp/instruction.c
+++ b/src/decomp/instruction.c
@@ -2,7 +2,7 @@
 /* OpenIDA - Outil d'analyse de fichiers binaires
  * instruction.c - gestion des instructions décompilées
  *
- * Copyright (C) 2010 Cyrille Bagard
+ * Copyright (C) 2010-2012 Cyrille Bagard
  *
  *  This file is part of OpenIDA.
  *
@@ -94,7 +94,7 @@ static void g_dec_instruction_init(GDecInstruction *instr)
 void g_dec_instruction_print(const GDecInstruction *instr, GCodeBuffer *buffer, GBufferLine *line, GLangOutput *output)
 {
     if (line == NULL)
-        line = g_code_buffer_append_new_line(buffer);   /* FIXME : n° de ligne */
+        line = g_code_buffer_append_new_line_fixme(buffer);   /* FIXME : n° de ligne */
 
     instr->print(instr, buffer, line, output);
 
diff --git a/src/decomp/lang/asm.c b/src/decomp/lang/asm.c
index 276d323..9ee8729 100644
--- a/src/decomp/lang/asm.c
+++ b/src/decomp/lang/asm.c
@@ -2,7 +2,7 @@
 /* OpenIDA - Outil d'analyse de fichiers binaires
  * asm.c - sorties en langage d'assemblage
  *
- * Copyright (C) 2010 Cyrille Bagard
+ * Copyright (C) 2010-2012 Cyrille Bagard
  *
  *  This file is part of OpenIDA.
  *
@@ -157,7 +157,7 @@ static GBufferLine *g_asm_output_write_comments(GAsmOutput *output, GCodeBuffer
 {
     GBufferLine *result;                    /* Adresse nouvelle à remonter */
 
-    result = g_code_buffer_append_new_line(buffer);
+    result = g_code_buffer_append_new_line_fixme(buffer);
 
     g_buffer_line_insert_text(result, BLC_COMMENTS, "; ", 2, RTT_COMMENT);
 
@@ -235,7 +235,7 @@ static GBufferLine *g_asm_output_start_routine_prototype(GAsmOutput *output, GCo
 {
     GBufferLine *result;                    /* Adresse nouvelle à remonter */
 
-    result = g_code_buffer_append_new_line(buffer);
+    result = g_code_buffer_append_new_line_fixme(buffer);
 
     /* TODO */
     g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "XXX", 3, RTT_RAW);
diff --git a/src/decomp/lang/java.c b/src/decomp/lang/java.c
index 471b63c..7c5750b 100644
--- a/src/decomp/lang/java.c
+++ b/src/decomp/lang/java.c
@@ -2,7 +2,7 @@
 /* OpenIDA - Outil d'analyse de fichiers binaires
  * java.c - sorties en langage Java
  *
- * Copyright (C) 2010 Cyrille Bagard
+ * Copyright (C) 2010-2012 Cyrille Bagard
  *
  *  This file is part of OpenIDA.
  *
@@ -184,7 +184,7 @@ static GBufferLine *g_java_output_start_comments(GJavaOutput *output, GCodeBuffe
 {
     GBufferLine *result;                    /* Nouvelle ligne à retourner  */
 
-    result = g_code_buffer_append_new_line(buffer);
+    result = g_code_buffer_append_new_line_fixme(buffer);
 
     g_buffer_line_insert_text(result, BLC_COMMENTS, "/**", 3, RTT_COMMENT);
 
@@ -212,7 +212,7 @@ static GBufferLine *g_java_output_continue_comments(GJavaOutput *output, GCodeBu
 {
     GBufferLine *result;                    /* Adresse nouvelle à remonter */
 
-    result = g_code_buffer_append_new_line(buffer);
+    result = g_code_buffer_append_new_line_fixme(buffer);
 
     g_buffer_line_insert_text(result, BLC_COMMENTS, " * ", 3, RTT_COMMENT);
 
@@ -241,7 +241,7 @@ static GBufferLine *g_java_output_end_comments(GJavaOutput *output, GCodeBuffer
 {
     GBufferLine *result;                    /* Nouvelle ligne à retourner  */
 
-    result = g_code_buffer_append_new_line(buffer);
+    result = g_code_buffer_append_new_line_fixme(buffer);
 
     g_buffer_line_insert_text(result, BLC_COMMENTS, " */", 3, RTT_COMMENT);
 
@@ -269,7 +269,7 @@ static GBufferLine *g_java_output_write_comments(GJavaOutput *output, GCodeBuffe
 {
     GBufferLine *result;                    /* Adresse nouvelle à remonter */
 
-    result = g_code_buffer_append_new_line(buffer);
+    result = g_code_buffer_append_new_line_fixme(buffer);
 
     g_buffer_line_insert_text(result, BLC_COMMENTS, "// ", 3, RTT_COMMENT);
 
@@ -347,7 +347,7 @@ static GBufferLine *g_java_output_start_class(GJavaOutput *output, GCodeBuffer *
 {
     GBufferLine *result;                    /* Adresse nouvelle à remonter */
 
-    result = g_code_buffer_append_new_line(buffer);
+    result = g_code_buffer_append_new_line_fixme(buffer);
 
     g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "class", 5, RTT_KEY_WORD);
     g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, " ", 1, RTT_RAW);
@@ -380,7 +380,7 @@ static void g_java_output_end_class(GJavaOutput *output, GCodeBuffer *buffer)
 {
     GBufferLine *result;                    /* Adresse nouvelle à remonter */
 
-    result = g_code_buffer_append_new_line(buffer);
+    result = g_code_buffer_append_new_line_fixme(buffer);
 
     g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "}", 1, RTT_HOOK);
 
@@ -407,7 +407,7 @@ static GBufferLine *g_java_output_start_routine_prototype(GJavaOutput *output, G
 {
     GBufferLine *result;                    /* Adresse nouvelle à remonter */
 
-    result = g_code_buffer_append_new_line(buffer);
+    result = g_code_buffer_append_new_line_fixme(buffer);
 
     /* TODO */
     g_buffer_line_insert_text(result, BLC_ASSEMBLY_HEAD, "XXX", 3, RTT_RAW);
@@ -477,7 +477,7 @@ static void g_java_output_end_routine_body(GJavaOutput *output, GCodeBuffer *buf
 {
     GBufferLine *line;                      /* Nouvelle ligne à constituer */
 
-    line = g_code_buffer_append_new_line(buffer);
+    line = g_code_buffer_append_new_line_fixme(buffer);
 
     g_buffer_line_insert_text(line, BLC_ASSEMBLY_HEAD, "}", 1, RTT_HOOK);
 
diff --git a/src/editor.c b/src/editor.c
index d40f9ae..6f45fec 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -386,7 +386,7 @@ GtkWidget *create_editor(void)
         support = init_panels2(G_CALLBACK(on_dock_item_switch), ref);
         gtk_box_pack_start(GTK_BOX(vbox1), support, TRUE, TRUE, 0);
 
-        load_main_panels();
+        load_main_panels(ref);
 
 
     } while(0);
diff --git a/src/format/dex/class.c b/src/format/dex/class.c
index 168d45d..d08c8e2 100644
--- a/src/format/dex/class.c
+++ b/src/format/dex/class.c
@@ -370,13 +370,13 @@ GBufferLine *line, GLangOutput *output)
     for (i = 0; i < class->vmethods_count; i++)
     {
         g_dex_method_decompile(class->virtual_methods[i], lang, buffer);
-        g_code_buffer_append_new_line(buffer);
+        g_code_buffer_append_new_line_fixme(buffer);
     }
 
     for (i = 0; i < class->dmethods_count; i++)
     {
         g_dex_method_decompile(class->direct_methods[i], lang, buffer);
-        g_code_buffer_append_new_line(buffer);
+        g_code_buffer_append_new_line_fixme(buffer);
     }
 
 
diff --git a/src/glibext/gbufferline.c b/src/glibext/gbufferline.c
index 6017bdd..e32e450 100644
--- a/src/glibext/gbufferline.c
+++ b/src/glibext/gbufferline.c
@@ -64,6 +64,8 @@ struct _GBufferLine
 {
     GObject parent;                         /* A laisser en premier        */
 
+    vmpa_t addr;                            /* Adresse geographique        */
+
     buffer_line_column columns[BLC_COUNT];  /* Répartition du texte        */
     BufferLineColumn merge_start;           /* Début de la zone globale    */
 
@@ -399,7 +401,7 @@ static void g_buffer_line_init(GBufferLine *line)
 
 /******************************************************************************
 *                                                                             *
-*  Paramètres  : -                                                            *
+*  Paramètres  : addr = adresse où va se situer la ligne.                     *
 *                                                                             *
 *  Description : Crée une nouvelle représentation de fragments de texte.      *
 *                                                                             *
@@ -409,12 +411,13 @@ static void g_buffer_line_init(GBufferLine *line)
 *                                                                             *
 ******************************************************************************/
 
-GBufferLine *g_buffer_line_new(void)
+GBufferLine *g_buffer_line_new(vmpa_t addr)
 {
     GBufferLine *result;                    /* Composant à retourner       */
 
     result = g_object_new(G_TYPE_BUFFER_LINE, NULL);
-    //result = g_new0(GBufferLine, 1);
+
+    result->addr = addr;
 
     return result;
 
@@ -423,6 +426,25 @@ GBufferLine *g_buffer_line_new(void)
 
 /******************************************************************************
 *                                                                             *
+*  Paramètres  : line = ligne à venir consulter.                              *
+*                                                                             *
+*  Description : Indique l'adresse à laquelle se situe la ligne.              *
+*                                                                             *
+*  Retour      : Adresse mémoire ou physique.                                 *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+vmpa_t g_buffer_line_get_address(const GBufferLine *line)
+{
+    return line->addr;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
 *  Paramètres  : line    = ligne à venir compléter.                           *
 *                index   = index de la colonne visée par la procédure.        *
 *                segment = fragment de texte à ajouter à la colonne.          *
diff --git a/src/glibext/gbufferline.h b/src/glibext/gbufferline.h
index b5de831..1e115cd 100644
--- a/src/glibext/gbufferline.h
+++ b/src/glibext/gbufferline.h
@@ -110,7 +110,10 @@ typedef void (* buffer_line_draw_fc) (GBufferLine *, GdkDrawable *, GdkGC *, gin
 GType g_buffer_line_get_type(void);
 
 /* Crée une nouvelle représentation de fragments de texte. */
-GBufferLine *g_buffer_line_new(void);
+GBufferLine *g_buffer_line_new(vmpa_t);
+
+/* Indique l'adresse à laquelle se situe la ligne. */
+vmpa_t g_buffer_line_get_address(const GBufferLine *);
 
 /* Ajoute un fragment de texte à une colonne de ligne. */
 void g_buffer_line_add_segment(GBufferLine *, BufferLineColumn, GBufferSegment *);
diff --git a/src/glibext/gcodebuffer.c b/src/glibext/gcodebuffer.c
index 8ebc284..3dfb10e 100644
--- a/src/glibext/gcodebuffer.c
+++ b/src/glibext/gcodebuffer.c
@@ -370,6 +370,7 @@ GCodeBuffer *g_code_buffer_new(void)
 /******************************************************************************
 *                                                                             *
 *  Paramètres  : buffer = composant GTK à mettre à jour.                      *
+*                addr   = adresse où va se situer la ligne.                   *
 *                                                                             *
 *  Description : Ajoute une nouvelle ligne à un tampon pour code désassemblé. *
 *                                                                             *
@@ -379,7 +380,7 @@ GCodeBuffer *g_code_buffer_new(void)
 *                                                                             *
 ******************************************************************************/
 
-GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *buffer)
+GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *buffer, vmpa_t addr)
 {
     GBufferLine *result;                    /* Instance à retourner        */
 
@@ -390,7 +391,7 @@ GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *buffer)
                                                 buffer->count * sizeof(GBufferLine *));
     }
 
-    result = g_buffer_line_new();
+    result = g_buffer_line_new(addr);
     buffer->lines[buffer->used++] = result;
 
     return result;
@@ -736,7 +737,51 @@ GBufferLine *g_buffer_view_find_line_at(GBufferView *view, gint y)
     lheight = g_buffer_view_get_line_height(view);
     index = y / lheight;
 
-    /* FIXME : à placer côté tampon ? */
     return (index < view->buffer->used ? view->buffer->lines[index] : NULL);
 
 }
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : view = composant GTK à consulter.                            *
+*                addr = adresse à présenter à l'écran.                        *
+*                x    = position horizontale au sein du composant. [OUT]      *
+*                y    = position verticale au sein du composant. [OUT]        *
+*                                                                             *
+*  Description : Indique la position d'affichage d'une adresse donnée.        *
+*                                                                             *
+*  Retour      : true si l'adresse fait partie du composant, false sinon.     *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+bool g_buffer_view_get_address_coordinates(GBufferView *view, vmpa_t addr, gint *x, gint *y)
+{
+    gint lheight;                           /* Hauteur d'une ligne         */
+    size_t i;                               /* Boucle de parcours          */
+    vmpa_t current;                         /* Adresse parcourue           */
+
+    *x = 0;
+    *y = 0;
+
+    lheight = g_buffer_view_get_line_height(view);
+
+    for (i = 0; i < view->buffer->used; i++)
+    {
+        current = g_buffer_line_get_address(view->buffer->lines[i]);
+
+        if (current == addr)
+            break;
+
+        if (current > addr)
+            return false;
+
+        *y += lheight;
+
+    }
+
+    return true;
+
+}
diff --git a/src/glibext/gcodebuffer.h b/src/glibext/gcodebuffer.h
index dee114e..74e376c 100644
--- a/src/glibext/gcodebuffer.h
+++ b/src/glibext/gcodebuffer.h
@@ -56,8 +56,11 @@ GType g_code_buffer_get_type(void);
 /* Crée un nouveau composant de tampon pour code désassemblé. */
 GCodeBuffer *g_code_buffer_new(void);
 
+/* FIXME */
+#define g_code_buffer_append_new_line_fixme(b) g_code_buffer_append_new_line(b, 0ull)
+
 /* Ajoute une nouvelle ligne à un tampon pour code désassemblé. */
-GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *);
+GBufferLine *g_code_buffer_append_new_line(GCodeBuffer *, vmpa_t);
 
 /* Traitement d'une ligne parcourue. */
 typedef bool (* process_line_fc) (GCodeBuffer *, GBufferLine *, void *);
@@ -106,6 +109,9 @@ void g_buffer_view_draw(const GBufferView *, const GdkEventExpose *, GdkGC *, gi
 /* Fournit la ligne présente à une ordonnée donnée. */
 GBufferLine *g_buffer_view_find_line_at(GBufferView *, gint);
 
+/* Indique la position d'affichage d'une adresse donnée. */
+bool g_buffer_view_get_address_coordinates(GBufferView *, vmpa_t, gint *, gint *);
+
 
 
 #endif  /* _GLIBEXT_GCODEBUFFER_H */
diff --git a/src/gtkext/gtkbinview-int.h b/src/gtkext/gtkbinview-int.h
index d1acde0..94d406f 100644
--- a/src/gtkext/gtkbinview-int.h
+++ b/src/gtkext/gtkbinview-int.h
@@ -2,7 +2,7 @@
 /* OpenIDA - Outil d'analyse de fichiers binaires
  * gtkbinview-int.h - définitions internes propre à l'affichage d'un ou plusieurs morceaux de code
  *
- * Copyright (C) 2009-2010 Cyrille Bagard
+ * Copyright (C) 2009-2012 Cyrille Bagard
  *
  *  This file is part of OpenIDA.
  *
@@ -41,7 +41,7 @@ typedef void (* set_rendering_lines_fc) (GtkBinView *, GRenderingLine *, GRender
 typedef void (* define_main_address_fc) (GtkBinView *, vmpa_t);
 
 /* Indique la position d'affichage d'une adresse donnée. */
-typedef bool (* get_addr_coordinates_fc) (const GtkBinView *, vmpa_t, gint *, gint *);
+//typedef bool (* get_addr_coordinates_fc) (const GtkBinView *, vmpa_t, gint *, gint *);
 
 
 struct _GtkBinView
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c
index 186b53f..c3457e9 100644
--- a/src/gtkext/gtkbufferview.c
+++ b/src/gtkext/gtkbufferview.c
@@ -49,6 +49,9 @@ 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 *);
 
+/* Indique la position d'affichage d'une adresse donnée. */
+static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *, vmpa_t, gint *, gint *);
+
 /* Réagit à un défilement quelconque. */
 static void gtk_buffer_view_scroll(GtkBufferView *);
 
@@ -106,6 +109,7 @@ static void gtk_buffer_view_init(GtkBufferView *view)
 
     viewpanel = GTK_VIEW_PANEL(view);
 
+    viewpanel->get_coordinates = (get_addr_coordinates_fc)gtk_buffer_view_get_address_coordinates;
     viewpanel->scroll = (scroll_fc)gtk_buffer_view_scroll;
 
 }
@@ -339,6 +343,28 @@ static gboolean gtk_buffer_view_expose(GtkWidget *widget, GdkEventExpose *event)
 
 /******************************************************************************
 *                                                                             *
+*  Paramètres  : view = composant GTK à consulter.                            *
+*                addr = adresse à présenter à l'écran.                        *
+*                x    = position horizontale au sein du composant. [OUT]      *
+*                y    = position verticale au sein du composant. [OUT]        *
+*                                                                             *
+*  Description : Indique la position d'affichage d'une adresse donnée.        *
+*                                                                             *
+*  Retour      : true si l'adresse fait partie du composant, false sinon.     *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static bool gtk_buffer_view_get_address_coordinates(const GtkBufferView *view, vmpa_t addr, gint *x, gint *y)
+{
+    return g_buffer_view_get_address_coordinates(view->buffer_view, addr, x, y);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
 *  Paramètres  : view  = composant GTK à mettre à jour.                       *
 *                                                                             *
 *  Description : Réagit à un défilement quelconque.                           *
diff --git a/src/gtkext/gtkdockstation.c b/src/gtkext/gtkdockstation.c
index 3e33f2b..d85d11e 100644
--- a/src/gtkext/gtkdockstation.c
+++ b/src/gtkext/gtkdockstation.c
@@ -263,6 +263,8 @@ void gtk_dock_panel_change_active_widget(GtkDockStation *station, GtkWidget *wid
 
     gtk_widget_unref(label);
 
+    gtk_notebook_set_current_page(station->notebook, index);
+
     g_signal_connect(station->notebook, "switch-page",
                      G_CALLBACK(gtk_dock_station_switch_panel), station);
 
diff --git a/src/gtkext/gtkviewpanel-int.h b/src/gtkext/gtkviewpanel-int.h
index 79f6f4c..446d182 100644
--- a/src/gtkext/gtkviewpanel-int.h
+++ b/src/gtkext/gtkviewpanel-int.h
@@ -36,6 +36,9 @@
 /* Prend acte de l'association d'un binaire chargé. */
 typedef void (* attach_binary_fc) (GtkViewPanel *, GOpenidaBinary *, bool *, bool *);
 
+/* Indique la position d'affichage d'une adresse donnée. */
+typedef bool (* get_addr_coordinates_fc) (const GtkViewPanel *, vmpa_t, gint *, gint *);
+
 /* Réagit à un défilement quelconque. */
 typedef void (* scroll_fc) (GtkViewPanel *);
 
@@ -54,6 +57,7 @@ struct _GtkViewPanel
     GOpenidaBinary *binary;                 /* Binaire à visualiser        */
 
     attach_binary_fc attach;                /* Association avec un binaire */
+    get_addr_coordinates_fc get_coordinates;/* Conversion adresse <-> pos. */
     scroll_fc scroll;                       /* Défilement du contenu       */
 
     bool *display_addr;                     /* Affichage des adresses ?    */
diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c
index 43ab569..35cfa5c 100644
--- a/src/gtkext/gtkviewpanel.c
+++ b/src/gtkext/gtkviewpanel.c
@@ -104,7 +104,7 @@ static void gtk_view_panel_class_init(GtkViewPanelClass *class)
 
 static void gtk_view_panel_init(GtkViewPanel *panel)
 {
-    gtk_fixed_set_has_window(GTK_FIXED(panel), TRUE);
+    gtk_widget_set_has_window(GTK_WIDGET(panel), TRUE);
 
 }
 
@@ -453,3 +453,48 @@ GOpenidaBinary *gtk_view_panel_get_binary(const GtkViewPanel *panel)
     return panel->binary;
 
 }
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : panel = composant GTK à manipuler.                           *
+*                addr = adresse à présenter à l'écran.                        *
+*                                                                             *
+*  Description : S'assure qu'une adresse donnée est visible à l'écran.        *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+void gtk_view_panel_scroll_to_address(const GtkViewPanel *panel, vmpa_t addr)
+{
+    gint x;                                 /* Abscisse à garantir         */
+    gint y;                                 /* Ordonnée à garantir         */
+    GtkAdjustment *adj;                     /* Défilement à mettre à jour  */
+
+    /* TODO
+    if (panel->define_address != NULL)
+        panel->define_address(panel, addr);
+    */
+
+    if (panel->get_coordinates(panel, addr, &x, &y))
+    {
+        adj = panel->hadjustment;
+
+        if (x > (adj->upper - adj->page_size))
+            x = adj->upper - adj->page_size;
+
+        gtk_adjustment_set_value(adj, x);
+
+        adj = panel->vadjustment;
+
+        if (y > (adj->upper - adj->page_size))
+            y = adj->upper - adj->page_size;
+
+        gtk_adjustment_set_value(adj, y);
+
+    }
+
+}
diff --git a/src/gtkext/gtkviewpanel.h b/src/gtkext/gtkviewpanel.h
index 6edee69..ccac08b 100644
--- a/src/gtkext/gtkviewpanel.h
+++ b/src/gtkext/gtkviewpanel.h
@@ -68,6 +68,9 @@ void gtk_view_panel_set_code_display(const GtkViewPanel *, bool);
 /* Fournit le binaire associé à la représentation. */
 GOpenidaBinary *gtk_view_panel_get_binary(const GtkViewPanel *);
 
+/* S'assure qu'une adresse donnée est visible à l'écran. */
+void gtk_view_panel_scroll_to_address(const GtkViewPanel *, vmpa_t);
+
 
 
 #endif  /* _GTK_VIEWPANEL_H */
diff --git a/src/gui/panels/panel-int.h b/src/gui/panels/panel-int.h
index 186092d..133f1a3 100644
--- a/src/gui/panels/panel-int.h
+++ b/src/gui/panels/panel-int.h
@@ -66,7 +66,7 @@ struct _GPanelItemClass
 
 
 /* Initialise dynamique les propriétés de l'instance. */
-void g_panel_item_init_ext(GPanelItem *, const char *, const char *, GtkWidget *, const char *);
+void g_panel_item_init_ext(GPanelItem *, GObject *, const char *, const char *, GtkWidget *, const char *);
 
 
 
diff --git a/src/gui/panels/panel.c b/src/gui/panels/panel.c
index 584ec09..a12c675 100644
--- a/src/gui/panels/panel.c
+++ b/src/gui/panels/panel.c
@@ -129,12 +129,15 @@ static void g_panel_item_init(GPanelItem *item)
 *                                                                             *
 ******************************************************************************/
 
-void g_panel_item_init_ext(GPanelItem *item, const char *name, const char *lname, GtkWidget *widget, const char *path)
+void g_panel_item_init_ext(GPanelItem *item, GObject *ref, const char *name, const char *lname, GtkWidget *widget, const char *path)
 {
     GEditorItem *parent;                    /* Autre version de l'élément  */
 
     parent = G_EDITOR_ITEM(item);
 
+    g_object_ref(ref);
+    parent->ref = ref;
+
     parent->name = name;
     item->lname = lname;
 
@@ -171,7 +174,7 @@ GEditorItem *g_panel_item_new(const char *name, const char *lname, GtkWidget *wi
 
     result = g_object_new(G_TYPE_PANEL_ITEM, NULL);
 
-    g_panel_item_init_ext(result, name, lname, widget, path);
+    g_panel_item_init_ext(result, NULL/* FIXME */, name, lname, widget, path);
 
     return G_EDITOR_ITEM(result);
 
@@ -647,7 +650,7 @@ GtkWidget *init_panels2(GCallback handler, gpointer data)
 
 /******************************************************************************
 *                                                                             *
-*  Paramètres  : -                                                            *
+*  Paramètres  : ref = espace de référencement global.                        *
 *                                                                             *
 *  Description : Charge les principaux panneaux de l'éditeur.                 *
 *                                                                             *
@@ -657,14 +660,14 @@ GtkWidget *init_panels2(GCallback handler, gpointer data)
 *                                                                             *
 ******************************************************************************/
 
-void load_main_panels(void)
+void load_main_panels(GObject *ref)
 {
     GPanelItem *item;                       /* Panneau de base à charger   */
 
     item = create_log_panel();
     g_panel_item_dock(item);
 
-    item = create_symbols_panel();
+    item = create_symbols_panel(ref);
     g_panel_item_dock(item);
 
 }
diff --git a/src/gui/panels/panel.h b/src/gui/panels/panel.h
index dd9ae5e..9c6fa89 100644
--- a/src/gui/panels/panel.h
+++ b/src/gui/panels/panel.h
@@ -66,7 +66,7 @@ void g_panel_item_dock(GPanelItem *);
 GtkWidget *init_panels2(GCallback, gpointer);
 
 /* Charge les principaux panneaux de l'éditeur. */
-void load_main_panels(void);
+void load_main_panels(GObject *);
 
 
 
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index c0d34a7..aea90fe 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -280,7 +280,7 @@ static void g_symbols_panel_init(GSymbolsPanel *panel)
 
 /******************************************************************************
 *                                                                             *
-*  Paramètres  : -                                                            *
+*  Paramètres  : ref = espace de référencement global.                        *
 *                                                                             *
 *  Description : Crée un panneau d'affichage des symboles.                    *
 *                                                                             *
@@ -290,14 +290,14 @@ static void g_symbols_panel_init(GSymbolsPanel *panel)
 *                                                                             *
 ******************************************************************************/
 
-GEditorItem *g_symbols_panel_new(void)
+GEditorItem *g_symbols_panel_new(GObject *ref)
 {
     GEditorItem *result;                    /* Structure à retourner       */
 
     result = g_object_new(G_TYPE_SYMBOLS_PANEL, NULL);
 
-    g_panel_item_init_ext(G_PANEL_ITEM(result), PANEL_SYMBOL_ID, _("Binary symbols"),
-                          G_EDITOR_ITEM(result)->widget, "e");
+    g_panel_item_init_ext(G_PANEL_ITEM(result), ref, PANEL_SYMBOL_ID,
+                          _("Binary symbols"), G_EDITOR_ITEM(result)->widget, "e");
 
     return result;
 
@@ -306,7 +306,7 @@ GEditorItem *g_symbols_panel_new(void)
 
 /******************************************************************************
 *                                                                             *
-*  Paramètres  : -                                                            *
+*  Paramètres  : ref = espace de référencement global.                        *
 *                                                                             *
 *  Description : Construit et intègre un panneau d'affichage des symboles.    *
 *                                                                             *
@@ -316,11 +316,11 @@ GEditorItem *g_symbols_panel_new(void)
 *                                                                             *
 ******************************************************************************/
 
-GPanelItem *create_symbols_panel(void)
+GPanelItem *create_symbols_panel(GObject *ref)
 {
     GEditorItem *result;                    /* Elément réactif à renvoyer  */
 
-    result = g_symbols_panel_new();
+    result = g_symbols_panel_new(ref);
 
     /* Enregistre correctement le tout */
     result->update_binary = (update_item_binary_fc)change_symbols_panel_current_binary;
@@ -350,15 +350,20 @@ static void on_symbols_selection_change(GtkTreeSelection *selection, GSymbolsPan
     GtkTreeModel *model;                    /* Modèle de gestion           */
     gchar *string;                          /* Chaîne sélectionnée         */
     vmpa_t address;                         /* Adresse à rejoindre         */
-    return;
+
     if (gtk_tree_selection_get_selected(selection, &model, &iter))
     {
         gtk_tree_model_get(model, &iter, SBC_ADDRESS, &string, -1);
-        address = strtoll(string, NULL, 16);    /* FIXME */
-        g_free(string);
 
-        /* FIXME */
-        //gtk_bin_view_scroll_to_address(panel->binview, address);
+        if (string != NULL)
+        {
+            address = strtoll(string, NULL, 16);
+            g_free(string);
+
+            gtk_view_panel_scroll_to_address(g_editor_item_get_current_view(G_EDITOR_ITEM(panel)),
+                                             address);
+
+        }
 
     }
 
@@ -395,7 +400,10 @@ void change_symbols_panel_current_binary(GSymbolsPanel *panel, GOpenidaBinary *b
     if (gtk_toggle_tool_button_get_active(button))
         reload_symbols_for_new_list_view(panel);
     else
+    {
         reload_symbols_for_new_tree_view(panel);
+        reorganize_symbols_tree_view(NULL, G_OBJECT(G_EDITOR_ITEM(panel)->widget));
+    }
 
 }
 
@@ -622,6 +630,7 @@ static void reload_symbols_for_new_tree_view(GSymbolsPanel *panel)
 
             gtk_tree_store_set(panel->store, &iter,
                                SBC_ICON, pixbuf,
+                               SBC_ADDRESS, tmp,
                                SBC_NAME, _g_binary_routine_to_string(routines[i], options),
                                -1);
 
diff --git a/src/gui/panels/symbols.h b/src/gui/panels/symbols.h
index 72801d8..f18a2ea 100644
--- a/src/gui/panels/symbols.h
+++ b/src/gui/panels/symbols.h
@@ -55,10 +55,10 @@ typedef struct _GSymbolsPanelClass GSymbolsPanelClass;
 GType g_symbols_panel_get_type(void);
 
 /* Crée un panneau d'affichage des symboles. */
-GEditorItem *g_symbols_panel_new(void);
+GEditorItem *g_symbols_panel_new(GObject *);
 
 /* Construit et intègre un panneau d'affichage des symboles. */
-GPanelItem *create_symbols_panel(void);
+GPanelItem *create_symbols_panel(GObject *);
 
 
 
-- 
cgit v0.11.2-87-g4458