summaryrefslogtreecommitdiff
path: root/src/gui/tb/portions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/tb/portions.c')
-rw-r--r--src/gui/tb/portions.c33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/gui/tb/portions.c b/src/gui/tb/portions.c
index f60f83c..202cd43 100644
--- a/src/gui/tb/portions.c
+++ b/src/gui/tb/portions.c
@@ -32,7 +32,9 @@
#include "../core/global.h"
#include "../core/items.h"
#include "../../format/format.h"
+#include "../../glibext/gbinarycursor.h"
#include "../../gtkext/gtkbinarystrip.h"
+#include "../../gtkext/gtkdisplaypanel.h"
@@ -66,7 +68,7 @@ static void g_portions_tbitem_dispose(GPortionsTbItem *);
static void g_portions_tbitem_finalize(GPortionsTbItem *);
/* Réagit à un changement du binaire courant. */
-static void update_portions_item_binary(GEditorItem *, GLoadedBinary *);
+static void change_portions_tbitem_current_content(GEditorItem *, GLoadedContent *, GLoadedContent *);
/* Fait suivre un changement d'adresse dans la barre. */
static void track_address_on_binary_strip(GtkBinaryStrip *, GEditorItem *);
@@ -100,7 +102,7 @@ static void g_portions_tbitem_class_init(GPortionsTbItemClass *klass)
object->dispose = (GObjectFinalizeFunc/* ! */)g_portions_tbitem_dispose;
object->finalize = (GObjectFinalizeFunc)g_portions_tbitem_finalize;
- item->update_binary = update_portions_item_binary;
+ item->change_content = change_portions_tbitem_current_content;
}
@@ -204,8 +206,9 @@ GEditorItem *create_portions_tb_item(GObject *ref)
/******************************************************************************
* *
-* Paramètres : item = élément réactif sollicité. *
-* binary = binaire chargé nouvellement affiché. *
+* Paramètres : item = élément réactif sollicité. *
+* old = ancien contenu chargé analysé. *
+* new = nouveau contenu chargé à analyser. *
* *
* Description : Réagit à un changement du binaire courant. *
* *
@@ -215,10 +218,16 @@ GEditorItem *create_portions_tb_item(GObject *ref)
* *
******************************************************************************/
-static void update_portions_item_binary(GEditorItem *item, GLoadedBinary *binary)
+static void change_portions_tbitem_current_content(GEditorItem *item, GLoadedContent *old, GLoadedContent *new)
{
+ GLoadedBinary *binary; /* Autre version de l'instance */
GtkBinaryStrip *strip; /* Bande pour binaire */
+ if (G_IS_LOADED_BINARY(new))
+ binary = G_LOADED_BINARY(new);
+ else
+ binary = NULL;
+
strip = GTK_BINARY_STRIP(g_object_get_data(G_OBJECT(item->widget), "strip"));
gtk_binary_strip_attach(strip, binary);
@@ -244,19 +253,25 @@ static void track_address_on_binary_strip(GtkBinaryStrip *strip, GEditorItem *it
{
const vmpa2t *addr; /* Nouvelle destination */
GLoadedPanel *panel; /* Afficheur effectif de code */
- GLoadedBinary *binary; /* Binaire chargé et actif */
+ GLoadedContent *content; /* Contenu chargé et actif */
+ GLineCursor *cursor; /* Emplacement à afficher */
addr = gtk_binary_strip_get_location(strip);
panel = get_current_view();
- binary = get_current_binary();
+ content = get_current_content();
if (GTK_IS_DISPLAY_PANEL(panel))
gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
- focus_address_in_editor_items(binary, addr, item);
+ cursor = g_binary_cursor_new();
+ g_binary_cursor_update(G_BINARY_CURSOR(cursor), addr);
+
+ focus_cursor_in_editor_items(content, cursor, item);
+
+ g_object_unref(G_OBJECT(cursor));
- g_object_unref(G_OBJECT(binary));
+ g_object_unref(G_OBJECT(content));
g_object_unref(G_OBJECT(panel));
}