diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2018-12-21 09:36:52 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2018-12-21 09:36:52 (GMT) |
commit | 3c183ee3be9cd5756bbefe688936fbab370e3840 (patch) | |
tree | 8968b218e532b439de3a5e7059194cee2818a884 /src/gui/menus | |
parent | cffbe4839da452af215f05dfb7cc6c9304c1285e (diff) |
Used only abstract cursors in views high API.
Diffstat (limited to 'src/gui/menus')
-rw-r--r-- | src/gui/menus/edition.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c index 1742616..b1ac0ad 100644 --- a/src/gui/menus/edition.c +++ b/src/gui/menus/edition.c @@ -464,7 +464,8 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, gpointer u ImmOperandDisplay display; /* Type de basculement */ GLoadedPanel *panel; /* Afficheur effectif de code */ GObject *creator; /* Créateur à l'orgine du seg. */ - const vmpa2t *addr; /* Position courante */ + GLineCursor *cursor; /* Position courante */ + vmpa2t addr; /* Adresse courante */ GLoadedBinary *binary; /* Binaire en cours d'étude */ GArchProcessor *proc; /* Propriétaire d'instructions */ GArchInstruction *instr; /* Instruction liée à la ligne */ @@ -478,12 +479,14 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, gpointer u creator = gtk_display_panel_get_active_object(GTK_DISPLAY_PANEL(panel)); assert(G_IS_IMM_OPERAND(creator)); - addr = gtk_display_panel_get_caret_location(GTK_DISPLAY_PANEL(panel)); + cursor = g_loaded_panel_get_cursor(panel); + g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr); + g_object_unref(G_OBJECT(cursor)); binary = G_LOADED_BINARY(get_current_content()); proc = g_loaded_binary_get_processor(binary); - instr = g_arch_processor_find_instr_by_address(proc, addr); + instr = g_arch_processor_find_instr_by_address(proc, &addr); assert(instr != NULL); switcher = g_db_switcher_new(instr, G_IMM_OPERAND(creator), display); @@ -601,7 +604,8 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused) static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) { GLoadedPanel *panel; /* Afficheur effectif de code */ - const vmpa2t *addr; /* Position courante */ + GLineCursor *cursor; /* Position courante */ + vmpa2t addr; /* Adresse courante */ GLoadedBinary *binary; /* Représentation binaire */ GArchProcessor *proc; /* Processeur de l'architecture*/ GArchInstruction *instr; /* Point de croisements */ @@ -612,7 +616,9 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) panel = get_current_view(); assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel)); - addr = gtk_display_panel_get_caret_location(GTK_DISPLAY_PANEL(panel)); + cursor = g_loaded_panel_get_cursor(panel); + g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr); + g_object_unref(G_OBJECT(cursor)); binary = G_LOADED_BINARY(get_current_content()); proc = g_loaded_binary_get_processor(binary); @@ -625,7 +631,7 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) * Il faut ainsi être plus souple, et se baser sur l'espace couvert par * une ligne mais sur l'adresse uniquement. */ - instr = g_arch_processor_find_instr_by_address(proc, addr); + instr = g_arch_processor_find_instr_by_address(proc, &addr); if (instr != NULL) { @@ -673,7 +679,8 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) { GLoadedPanel *panel; /* Vue offrant l'affichage */ - const vmpa2t *curloc; /* Localisation d'un curseur */ + GLineCursor *cursor; /* Position courante */ + vmpa2t addr; /* Adresse courante */ GLoadedBinary *binary; /* Binaire en cours d'étude */ GDbCollection *collec; /* Collection à manipuler */ GDbItem *exist; /* Sens du basculement courant */ @@ -688,7 +695,9 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) panel = get_current_view(); assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel)); - curloc = gtk_display_panel_get_caret_location(GTK_DISPLAY_PANEL(panel)); + cursor = g_loaded_panel_get_cursor(panel); + g_binary_cursor_get_info(G_BINARY_CURSOR(cursor), &addr); + g_object_unref(G_OBJECT(cursor)); /* Accès à la collection */ @@ -704,10 +713,7 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) * peut de plus modifier la position pendant la définition. */ - if (curloc == NULL) - exist = NULL; - else - exist = NULL;//g_db_collection_has_key(collec, curloc); + exist = NULL;//g_db_collection_has_key(collec, &addr); if (exist != NULL) g_loaded_binary_remove_from_collection(binary, DBF_BOOKMARKS, exist); @@ -722,7 +728,7 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) if (ret == GTK_RESPONSE_OK) { - bookmark = get_item_from_bookmark_dialog(builder, curloc); + bookmark = get_item_from_bookmark_dialog(builder, &addr); g_db_collection_wlock(G_DB_COLLECTION(collec)); |