summaryrefslogtreecommitdiff
path: root/src/gui/editem.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-03-16 23:32:29 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-03-16 23:32:29 (GMT)
commit4021e5f02ce71b35423852cd89fb6f0f2776f7b8 (patch)
tree8f0bbd1632d05d586f7d4af71a80a02906efd5c3 /src/gui/editem.c
parentb94be85e00d7770af4de93bbba91b421cfb6faea (diff)
Created a new feature and stored all main moves in the database.
Diffstat (limited to 'src/gui/editem.c')
-rw-r--r--src/gui/editem.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gui/editem.c b/src/gui/editem.c
index f4d9d71..c4295b6 100644
--- a/src/gui/editem.c
+++ b/src/gui/editem.c
@@ -26,6 +26,7 @@
#include "editem-int.h"
+#include "../analysis/db/items/move.h"
#include "../gtkext/gtkblockview.h"
@@ -57,6 +58,9 @@ static GObject *_caret_instance = NULL;
/* Suit les changements de focus des panneaux d'affichage. */
static gboolean notify_view_panel_focus_change(GtkViewPanel *, GdkEventFocus *, void *);
+/* Lance une procédure de déplacement de la position courante. */
+static void start_moving_to_address_in_view_panel(GtkViewPanel *, const vmpa2t *, void *);
+
/* Suit les changements de position dans du code d'assembleur. */
static void track_caret_address_on_view_panel(GtkViewPanel *, const vmpa2t *, void *);
@@ -296,6 +300,36 @@ static gboolean notify_view_panel_focus_change(GtkViewPanel *vpanel, GdkEventFoc
/******************************************************************************
* *
* Paramètres : vpanel = composant d'affichage parcouru. *
+* addr = adresse de destination du curseur souhaitée. *
+* data = adresse non utilisée ici. *
+* *
+* Description : Lance une procédure de déplacement de la position courante. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void start_moving_to_address_in_view_panel(GtkViewPanel *vpanel, const vmpa2t *addr, void *data)
+{
+ const vmpa2t *src; /* Position courante de curseur*/
+ GDbMove *move; /* Déplacement à organiser */
+ GLoadedBinary *binary; /* Binaire en cours d'étude */
+
+ src = gtk_view_panel_get_caret_location(vpanel);
+
+ move = g_db_move_new(src, addr);
+
+ binary = gtk_view_panel_get_binary(vpanel);
+ g_loaded_binary_add_to_collection(binary, DBF_MOVES, G_DB_ITEM(move));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : vpanel = composant d'affichage parcouru. *
* addr = nouvelle adresse du curseur courant. *
* data = adresse non utilisée ici. *
* *
@@ -372,6 +406,9 @@ void change_editor_items_current_view(GObject *ref, GtkViewPanel *vpanel)
if (_caret_instance != NULL)
{
g_signal_handlers_disconnect_by_func(_caret_instance,
+ G_CALLBACK(start_moving_to_address_in_view_panel),
+ NULL);
+ g_signal_handlers_disconnect_by_func(_caret_instance,
G_CALLBACK(track_caret_address_on_view_panel),
NULL);
g_object_unref(_caret_instance);
@@ -380,6 +417,10 @@ void change_editor_items_current_view(GObject *ref, GtkViewPanel *vpanel)
if (vpanel != NULL)
{
+ g_signal_connect(vpanel, "move-request",
+ G_CALLBACK(start_moving_to_address_in_view_panel),
+ NULL);
+
g_signal_connect(vpanel, "caret-moved",
G_CALLBACK(track_caret_address_on_view_panel),
NULL);