summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/editem.c41
-rw-r--r--src/gui/menus/binary.c2
-rw-r--r--src/gui/menus/edition.c6
-rw-r--r--src/gui/panels/bookmarks.c4
-rw-r--r--src/gui/panels/strings.c6
-rw-r--r--src/gui/panels/symbols.c2
-rw-r--r--src/gui/tb/portions.c2
7 files changed, 52 insertions, 11 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);
diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c
index 8058799..cf9a9b7 100644
--- a/src/gui/menus/binary.c
+++ b/src/gui/menus/binary.c
@@ -128,7 +128,7 @@ static void mcb_binary_entry_points(GtkMenuItem *menuitem, GMenuBar *bar)
addr = get_address_from_gotox_dialog(dialog);
vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
- gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, addr);
delete_vmpa(addr);
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index 99ade8c..3be2a8e 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -335,7 +335,7 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
addr = get_address_from_goto_dialog(dialog);
vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
- gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, addr);
delete_vmpa(addr);
@@ -475,7 +475,7 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, GMenuBar *bar)
if (virt != VMPA_NO_VIRTUAL)
{
init_vmpa(&addr, VMPA_NO_PHYSICAL, virt);
- gtk_view_panel_scroll_to_address(vpanel, &addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, &addr);
}
g_object_unref(creator);
@@ -546,7 +546,7 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
{
addr = get_address_from_gotox_dialog(dialog);
- gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, addr);
delete_vmpa(addr);
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c
index 222176a..4dc1871 100644
--- a/src/gui/panels/bookmarks.c
+++ b/src/gui/panels/bookmarks.c
@@ -680,7 +680,7 @@ static void on_bookmarks_selection_change(GtkTreeSelection *selection, GBookmark
addr = g_db_bookmark_get_address(bookmark);
vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
- gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, addr);
g_object_unref(G_OBJECT(bookmark));
@@ -1071,7 +1071,7 @@ static gboolean on_button_press_over_bookmarks(GtkWidget *widget, GdkEventButton
addr = g_db_bookmark_get_address(bookmark);
vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
- gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, addr);
g_object_unref(G_OBJECT(bookmark));
diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c
index ae436cf..80706c2 100644
--- a/src/gui/panels/strings.c
+++ b/src/gui/panels/strings.c
@@ -594,7 +594,7 @@ static void on_strings_selection_change(GtkTreeSelection *selection, GStringsPan
addr = get_mrange_addr(g_binary_symbol_get_range(symbol));
vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
- gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, addr);
g_object_unref(G_OBJECT(symbol));
@@ -833,7 +833,7 @@ static gboolean on_button_event_over_strings(GtkWidget *widget, GdkEventButton *
addr = get_mrange_addr(g_binary_symbol_get_range(symbol));
vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
- gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, addr);
g_object_unref(G_OBJECT(symbol));
@@ -1059,7 +1059,7 @@ static void mcb_strings_panel_find_refs(GtkMenuItem *menuitem, GStringsPanel *pa
addr = get_address_from_gotox_dialog(dialog);
vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
- gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, addr);
delete_vmpa(addr);
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index 422c9b4..d1bca91 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -553,7 +553,7 @@ static void on_symbols_selection_change(GtkTreeSelection *selection, GSymbolsPan
range = g_binary_symbol_get_range(symbol);
vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
- gtk_view_panel_scroll_to_address(vpanel, get_mrange_addr(range), SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, get_mrange_addr(range));
g_object_unref(G_OBJECT(symbol));
diff --git a/src/gui/tb/portions.c b/src/gui/tb/portions.c
index 39537eb..8ff1d31 100644
--- a/src/gui/tb/portions.c
+++ b/src/gui/tb/portions.c
@@ -246,7 +246,7 @@ static void track_address_on_binary_strip(GtkBinaryStrip *strip, GEditorItem *it
addr = gtk_binary_strip_get_location(strip);
vpanel = g_editor_item_get_current_view(item);
- gtk_view_panel_scroll_to_address(vpanel, addr, SPT_CENTER);
+ gtk_view_panel_request_move(vpanel, addr);
focus_address_in_editor_items(g_editor_item_get_current_binary(item), addr, item);