diff options
Diffstat (limited to 'src/gui/core')
-rw-r--r-- | src/gui/core/items.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/gui/core/items.c b/src/gui/core/items.c index fd78b41..a25d1b9 100644 --- a/src/gui/core/items.c +++ b/src/gui/core/items.c @@ -38,7 +38,7 @@ static GEditorItem *_editem_list = NULL; static gboolean notify_view_panel_focus_change(GLoadedPanel *, GdkEventFocus *, gpointer); /* Lance une procédure de déplacement de la position courante. */ -static void start_moving_to_address_in_view_panel(GtkDisplayPanel *, const vmpa2t *, gpointer); +static void start_moving_to_cursor_in_loaded_panel(GLoadedPanel *, const GLineCursor *, gboolean, gpointer); /* Suit les changements de position dans du code d'assembleur. */ static void track_caret_address_on_view_panel(GtkDisplayPanel *, const vmpa2t *, gpointer); @@ -126,7 +126,8 @@ static gboolean notify_view_panel_focus_change(GLoadedPanel *panel, GdkEventFocu /****************************************************************************** * * * Paramètres : panel = composant d'affichage parcouru. * -* addr = adresse de destination du curseur souhaitée. * +* cursor = emplacement à cibler pour un déplacement. * +* save = le changement est-il majeur ? * * unused = adresse non utilisée ici. * * * * Description : Lance une procédure de déplacement de la position courante. * @@ -137,36 +138,29 @@ static gboolean notify_view_panel_focus_change(GLoadedPanel *panel, GdkEventFocu * * ******************************************************************************/ -static void start_moving_to_address_in_view_panel(GtkDisplayPanel *panel, const vmpa2t *addr, gpointer unused) +static void start_moving_to_cursor_in_loaded_panel(GLoadedPanel *panel, const GLineCursor *cursor, gboolean save, gpointer unused) { - const vmpa2t *src; /* Position courante de curseur*/ - GLineCursor *___tmp; + GLineCursor *src; /* Position courante de curseur*/ GDbMove *move; /* Déplacement à organiser */ GLoadedBinary *binary; /* Binaire en cours d'étude */ - src = gtk_display_panel_get_caret_location(panel); + src = g_loaded_panel_get_cursor(panel); - /* S'il n'y a pas de passif, pas besoin d'historique */ - if (src == NULL) + if (save && src != NULL) { - ___tmp = g_binary_cursor_new(); - g_binary_cursor_update(G_BINARY_CURSOR(___tmp), addr); + move = g_db_move_new(src, cursor); - gtk_display_panel_scroll_to_cursor(panel, ___tmp, SPT_CENTER); - - g_object_unref(G_OBJECT(___tmp)); + binary = G_LOADED_BINARY(g_loaded_panel_get_content(panel)); + g_loaded_binary_add_to_collection(binary, G_DB_ITEM(move)); + g_object_unref(G_OBJECT(binary)); } else - { - move = g_db_move_new(src, addr); + gtk_display_panel_scroll_to_cursor(panel, cursor, SPT_CENTER); - binary = gtk_display_panel_get_binary(panel); - g_loaded_binary_add_to_collection(binary, G_DB_ITEM(move)); - g_object_unref(G_OBJECT(binary)); - - } + if (src != NULL) + g_object_unref(G_OBJECT(src)); } @@ -260,7 +254,7 @@ void change_editor_items_current_view(GLoadedPanel *panel) if (caret != NULL) { g_signal_handlers_disconnect_by_func(caret, - G_CALLBACK(start_moving_to_address_in_view_panel), + G_CALLBACK(start_moving_to_cursor_in_loaded_panel), NULL); g_signal_handlers_disconnect_by_func(caret, G_CALLBACK(track_caret_address_on_view_panel), @@ -274,7 +268,7 @@ void change_editor_items_current_view(GLoadedPanel *panel) if (panel != NULL) { g_signal_connect(panel, "move-request", - G_CALLBACK(start_moving_to_address_in_view_panel), + G_CALLBACK(start_moving_to_cursor_in_loaded_panel), NULL); g_signal_connect(panel, "caret-moved", |