summaryrefslogtreecommitdiff
path: root/src/gui/editem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/editem.c')
-rw-r--r--src/gui/editem.c63
1 files changed, 62 insertions, 1 deletions
diff --git a/src/gui/editem.c b/src/gui/editem.c
index e4c74a9..9f10bec 100644
--- a/src/gui/editem.c
+++ b/src/gui/editem.c
@@ -26,6 +26,7 @@
#include "editem-int.h"
+#include "../gtkext/gtkblockview.h"
@@ -43,9 +44,16 @@ static void g_editor_item_init(GEditorItem *);
/* ---------------------------- MANIPULATION D'ENSEMBLES ---------------------------- */
-/* liste des éléments enregistrés */
+/* Liste des éléments enregistrés */
static GEditorItem *_editem_list = NULL;
+/* Suivi des changements de position */
+static GObject *_caret_instance = NULL;
+
+
+/* Suit les changements de position dans du code d'assembleur. */
+static void track_caret_address_on_buffer_views(GtkBufferView *, const vmpa2t *, void *);
+
/* ---------------------------------------------------------------------------------- */
@@ -252,6 +260,36 @@ void manage_editor_items_view(GtkViewPanel *view, bool created)
if (klass->manage_view != NULL)
klass->manage_view(iter, view, created);
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : view = composant d'affichage parcouru. *
+* addr = nouvelle adresse du curseur courant. *
+* data = adresse non utilisée ici. *
+* *
+* Description : Suit les changements de position dans du code d'assembleur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void track_caret_address_on_buffer_views(GtkBufferView *view, const vmpa2t *addr, void *data)
+{
+ GEditorItem *iter; /* Boucle de parcours */
+ GEditorItemClass *klass; /* Classe correspondante */
+
+ editem_list_for_each(iter, _editem_list)
+ {
+ klass = G_EDITOR_ITEM_GET_CLASS(iter);
+
+ if (klass->track_caret != NULL)
+ klass->track_caret(iter, view, addr);
}
@@ -285,6 +323,29 @@ void change_editor_items_current_view(GObject *ref, GtkViewPanel *view)
if (klass->update_view != NULL)
klass->update_view(iter, view);
+ }
+
+ if (_caret_instance != NULL)
+ {
+ g_signal_handlers_disconnect_by_func(_caret_instance,
+ G_CALLBACK(track_caret_address_on_buffer_views),
+ NULL);
+ g_object_unref(_caret_instance);
+ _caret_instance = NULL;
+ }
+
+ if (view != NULL)
+ {
+ if (GTK_IS_BLOCK_VIEW(view))
+ {
+ g_signal_connect(view, "caret-moved",
+ G_CALLBACK(track_caret_address_on_buffer_views),
+ NULL);
+
+ _caret_instance = G_OBJECT(view);
+ g_object_ref(_caret_instance);
+
+ }
}