summaryrefslogtreecommitdiff
path: root/src/gui/menus
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-07-16 20:11:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-07-16 20:11:21 (GMT)
commitf6e56cebfa878dd32a2405fd0c916a40140a1ff0 (patch)
tree3e364d2e2b2de19b85ab6d14f856d4b8db11737a /src/gui/menus
parente0d03e3eddb9d240cc21ac1b7a7ade915fd17942 (diff)
Applied a new GUI update with the new loaded panels features.
Diffstat (limited to 'src/gui/menus')
-rw-r--r--src/gui/menus/binary.c32
-rw-r--r--src/gui/menus/binary.h6
-rw-r--r--src/gui/menus/edition.c289
-rw-r--r--src/gui/menus/edition.h7
-rw-r--r--src/gui/menus/menubar.c69
-rw-r--r--src/gui/menus/view.c14
-rw-r--r--src/gui/menus/view.h6
7 files changed, 253 insertions, 170 deletions
diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c
index b7be1b9..1360011 100644
--- a/src/gui/menus/binary.c
+++ b/src/gui/menus/binary.c
@@ -34,6 +34,7 @@
#include "../dialogs/gotox.h"
#include "../dialogs/storage.h"
#include "../../gtkext/easygtk.h"
+#include "../../gtkext/gtkdisplaypanel.h"
@@ -106,10 +107,9 @@ GtkWidget *build_menu_binary(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *ba
/******************************************************************************
* *
-* Paramètres : ref = espace de référencements à consulter. *
-* panel = panneau d'affichage actif ou NULL si aucun. *
+* Paramètres : new = nouveau contenu chargé à analyser. *
* *
-* Description : Met à jour les accès du menu "Binaire" selon le contenu. *
+* Description : Réagit à un changement d'affichage principal de contenu. *
* *
* Retour : - *
* *
@@ -117,14 +117,17 @@ GtkWidget *build_menu_binary(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *ba
* *
******************************************************************************/
-void update_access_in_menu_binary(GObject *ref, GtkDisplayPanel *panel)
+void update_access_for_content_in_menu_binary(GLoadedContent *new)
{
+ GObject *ref; /* Espace de référencements */
gboolean access; /* Accès à déterminer */
GtkWidget *item; /* Elément de menu à traiter */
/* Préliminaire */
- access = (panel != NULL);
+ ref = get_global_ref();
+
+ access = G_IS_LOADED_BINARY(new);
/* Menus */
@@ -155,19 +158,14 @@ void update_access_in_menu_binary(GObject *ref, GtkDisplayPanel *panel)
static void mcb_binary_entry_points(GtkMenuItem *menuitem, GMenuBar *bar)
{
- GEditorItem *item; /* Elément d'éditeur graphique */
- GObject *ref; /* Espace de référencements */
GLoadedBinary *binary; /* Binaire présenté à l'écran */
GtkWidget *dialog; /* Boîte de dialogue à montrer */
vmpa2t *addr; /* Adresse de destination */
GLoadedPanel *panel; /* Afficheur effectif de code */
- item = G_EDITOR_ITEM(bar);
+ binary = G_LOADED_BINARY(get_current_content());
- ref = g_editor_item_get_global_ref(item);
- binary = get_current_binary();
-
- dialog = create_gotox_dialog_for_entry_points(GTK_WINDOW(ref), binary);
+ dialog = create_gotox_dialog_for_entry_points(get_editor_window(), binary);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
{
@@ -226,14 +224,12 @@ static void mcb_binary_attach_debugger(GtkMenuItem *menuitem, GMenuBar *bar)
static void mcb_binary_storage(GtkMenuItem *menuitem, GMenuBar *bar)
{
GLoadedBinary *binary; /* Edition courante */
- GObject *ref; /* Espace de référencements */
GtkBuilder *builder; /* Constructeur utilisé */
GtkWidget *dialog; /* Boîte de dialogue à montrer */
- binary = get_current_binary();
- ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar));
+ binary = G_LOADED_BINARY(get_current_content());
- dialog = create_storage_dialog(binary, GTK_WINDOW(ref), &builder);
+ dialog = create_storage_dialog(binary, get_editor_window(), &builder);
gtk_dialog_run(GTK_DIALOG(dialog));
@@ -263,9 +259,9 @@ static void mcb_binary_export(GtkMenuItem *menuitem, GMenuBar *bar)
{
GLoadedBinary *binary; /* Edition courante */
- binary = get_current_binary();
+ binary = G_LOADED_BINARY(get_current_content());
- run_export_assistant(binary, GTK_WINDOW(G_EDITOR_ITEM(bar)->ref));
+ run_export_assistant(binary, get_editor_window());
g_object_unref(G_OBJECT(binary));
diff --git a/src/gui/menus/binary.h b/src/gui/menus/binary.h
index a66fe26..45140b6 100644
--- a/src/gui/menus/binary.h
+++ b/src/gui/menus/binary.h
@@ -30,15 +30,15 @@
#include "menubar.h"
-#include "../../gtkext/gtkdisplaypanel.h"
+#include "../../analysis/loaded.h"
/* Construit le menu "Binaire". */
GtkWidget *build_menu_binary(GObject *, GtkAccelGroup *, GMenuBar *);
-/* Met à jour les accès du menu "Binaire" selon le contenu. */
-void update_access_in_menu_binary(GObject *, GtkDisplayPanel *);
+/* Réagit à un changement d'affichage principal de contenu. */
+void update_access_for_content_in_menu_binary(GLoadedContent *);
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index 08745b6..4a24d33 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -37,7 +37,11 @@
#include "../dialogs/gotox.h"
#include "../../analysis/db/items/switcher.h"
#include "../../arch/target.h"
+#include "../../glibext/gbinarycursor.h"
#include "../../gtkext/easygtk.h"
+#include "../../gtkext/gtkblockdisplay.h"
+#include "../../gtkext/gtkdisplaypanel.h"
+#include "../../gtkext/gtkgraphdisplay.h"
@@ -103,14 +107,20 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
menubar = qck_create_menu(GTK_MENU_ITEM(result));
- submenuitem = qck_create_menu_item(NULL, NULL, _("Go to address..."),
+ /* Déplacements ciblés */
+
+ submenuitem = qck_create_menu_item(ref, "mnu_edit_goto", _("Go to address..."),
G_CALLBACK(mcb_edition_goto), bar);
add_accelerator_to_menu_item(submenuitem, "<Ctrl>G", accgroup);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+ /* Séparation */
+
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+ /* Bascule des opérandes numériques */
+
submenuitem = qck_create_menu_item(NULL, NULL, _("Numeric operand"), NULL, NULL);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -153,7 +163,7 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- /* Déplacements */
+ /* Suivi de cibles */
submenuitem = qck_create_menu_item(ref, "mnu_edit_go_back", _("Go back"),
G_CALLBACK(mcb_edition_go_back), bar);
@@ -182,12 +192,12 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem));
- deepmenuitem = qck_create_menu_item(NULL, NULL, _("Toggle at current location"),
+ deepmenuitem = qck_create_menu_item(ref, "mnu_edit_toggle_bmark", _("Toggle at current location"),
G_CALLBACK(mcb_edition_bookmarks_toggle), bar);
add_accelerator_to_menu_item(deepmenuitem, "<Ctrl>D", accgroup);
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
- deepmenuitem = qck_create_menu_item(NULL, NULL, _("Delete all bookmarks"),
+ deepmenuitem = qck_create_menu_item(ref, "mnu_edit_delete_bmarks", _("Delete all bookmarks"),
G_CALLBACK(mcb_edition_bookmarks_delete_all), bar);
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
@@ -198,22 +208,22 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem));
- deepmenuitem = qck_create_menu_item(NULL, NULL, _("Enter a comment..."),
+ deepmenuitem = qck_create_menu_item(ref, "mnu_edit_enter_comment", _("Enter a comment..."),
G_CALLBACK(mcb_edition_comment_enter), bar);
add_accelerator_to_menu_item(deepmenuitem, "semicolon", accgroup);
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
- deepmenuitem = qck_create_menu_item(NULL, NULL, _("Enter a repeatable comment..."),
+ deepmenuitem = qck_create_menu_item(ref, "mnu_edit_enter_rep_comment", _("Enter a repeatable comment..."),
G_CALLBACK(mcb_edition_comment_enter_repeatable), bar);
add_accelerator_to_menu_item(deepmenuitem, "colon", accgroup);
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
- deepmenuitem = qck_create_menu_item(NULL, NULL, _("Enter a comment in the previous line..."),
+ deepmenuitem = qck_create_menu_item(ref, "mnu_edit_enter_prev", _("Enter a comment in the previous line..."),
G_CALLBACK(mcb_edition_comment_enter_previous), bar);
add_accelerator_to_menu_item(deepmenuitem, "Insert", accgroup);
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
- deepmenuitem = qck_create_menu_item(NULL, NULL, _("Enter a comment in the next line..."),
+ deepmenuitem = qck_create_menu_item(ref, "mnu_edit_enter_next", _("Enter a comment in the next line..."),
G_CALLBACK(mcb_edition_comment_enter_next), bar);
add_accelerator_to_menu_item(deepmenuitem, "<Shift>Insert", accgroup);
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
@@ -225,9 +235,96 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
/******************************************************************************
* *
-* Paramètres : ref = espace de référencements à consulter. *
-* panel = panneau d'affichage actif ou NULL si aucun. *
-* addr = nouvelle adresse du curseur courant. *
+* Paramètres : new = nouvelle vue du contenu chargé analysé. *
+* *
+* Description : Lance une actualisation du fait d'un changement de support. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_access_for_view_in_menu_edition(GLoadedPanel *new)
+{
+ GObject *ref; /* Espace de référencements */
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ ref = get_global_ref();
+
+ /* Déplacements ciblés */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_goto"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Bascule des opérandes numériques */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_hex"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_dec"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_oct"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_bin"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_def"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Suivi de cibles */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_go_back"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_follow_ref"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_list_xrefs"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Signets */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_toggle_bmark"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_delete_bmarks"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Commentaires */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_enter_comment"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_enter_rep_comment"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_enter_prev"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_enter_next"));
+ gtk_widget_set_sensitive(item, access);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = vue d'affichage active ou NULL si aucune. *
+* cursor = suivi des positions à consulter. *
* *
* Description : Met à jour les accès du menu "Edition" selon une position. *
* *
@@ -237,19 +334,35 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
* *
******************************************************************************/
-void update_access_in_menu_edition(GObject *ref, GtkDisplayPanel *panel, const vmpa2t *addr)
+void update_access_for_cursor_in_menu_edition(GLoadedPanel *panel, const GLineCursor *cursor)
{
+ GObject *ref; /* Espace de référencements */
GObject *creator; /* Créateur à l'orgine du seg. */
gboolean access; /* Accès à déterminer */
GtkWidget *item; /* Elément de menu à traiter */
+ ref = get_global_ref();
+
/* Préliminaire */
- if (panel == NULL || addr == NULL)
- creator = NULL;
+ /**
+ * Seuls les affichages de blocs (en graphique ou non) distribuent ce
+ * genre de curseur. Donc on valide dans le même temps la nature de la vue.
+ */
+
+ if (G_IS_BINARY_CURSOR(cursor))
+ {
+ assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
+
+ if (g_line_cursor_is_valid(cursor))
+ creator = gtk_display_panel_get_active_object(GTK_DISPLAY_PANEL(panel));
+ else
+ cursor = NULL;
+
+ }
else
- creator = gtk_display_panel_get_active_object(panel);
+ creator = NULL;
/* Bascule des opérandes numériques */
@@ -277,14 +390,15 @@ void update_access_in_menu_edition(GObject *ref, GtkDisplayPanel *panel, const v
item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_follow_ref"));
gtk_widget_set_sensitive(item, access);
- access = (addr != NULL);;
+ access = g_line_cursor_is_valid(cursor);
item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_list_xrefs"));
gtk_widget_set_sensitive(item, access);
/* Nettoyage et sortie finale */
- if (creator != NULL) g_object_unref(G_OBJECT(creator));
+ if (creator != NULL)
+ g_object_unref(G_OBJECT(creator));
}
@@ -317,9 +431,9 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
addr = get_address_from_goto_dialog(dialog);
panel = get_current_view();
+ assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
- if (GTK_IS_DISPLAY_PANEL(panel))
- gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
g_object_unref(G_OBJECT(panel));
@@ -359,32 +473,29 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, gpointer u
display = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(menuitem), "kind_of_switch"));
panel = get_current_view();
+ assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
- if (GTK_IS_DISPLAY_PANEL(panel))
- {
- creator = gtk_display_panel_get_active_object(GTK_DISPLAY_PANEL(panel));
- assert(G_IS_IMM_OPERAND(creator));
+ 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));
+ addr = gtk_display_panel_get_caret_location(GTK_DISPLAY_PANEL(panel));
- binary = get_current_binary();
- proc = g_loaded_binary_get_processor(binary);
+ binary = G_LOADED_BINARY(get_current_content());
+ proc = g_loaded_binary_get_processor(binary);
- instr = g_arch_processor_find_instr_by_address(proc, addr);
- assert(instr != NULL);
+ instr = g_arch_processor_find_instr_by_address(proc, addr);
+ assert(instr != NULL);
- switcher = g_db_switcher_new(instr, G_IMM_OPERAND(creator), display);
+ switcher = g_db_switcher_new(instr, G_IMM_OPERAND(creator), display);
- g_object_unref(G_OBJECT(instr));
+ g_object_unref(G_OBJECT(instr));
- g_loaded_binary_add_to_collection(binary, G_DB_ITEM(switcher));
+ g_loaded_binary_add_to_collection(binary, G_DB_ITEM(switcher));
- g_object_unref(G_OBJECT(proc));
- g_object_unref(G_OBJECT(binary));
-
- g_object_unref(creator);
+ g_object_unref(G_OBJECT(proc));
+ g_object_unref(G_OBJECT(binary));
- }
+ g_object_unref(creator);
g_object_unref(G_OBJECT(panel));
@@ -432,35 +543,32 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused)
virt_t virt; /* Adresse virtuelle */
panel = get_current_view();
+ assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
- if (GTK_IS_DISPLAY_PANEL(panel))
- {
- creator = gtk_display_panel_get_active_object(GTK_DISPLAY_PANEL(panel));
- assert(creator != NULL);
+ creator = gtk_display_panel_get_active_object(GTK_DISPLAY_PANEL(panel));
+ assert(creator != NULL);
- defined = false;
+ defined = false;
- if (G_IS_TARGET_OPERAND(creator))
- {
- g_target_operand_get_addr(G_TARGET_OPERAND(creator), &addr);
- defined = true;
- }
+ if (G_IS_TARGET_OPERAND(creator))
+ {
+ g_target_operand_get_addr(G_TARGET_OPERAND(creator), &addr);
+ defined = true;
+ }
- else if (G_IS_IMM_OPERAND(creator))
+ else if (G_IS_IMM_OPERAND(creator))
+ {
+ if (g_imm_operand_to_virt_t(G_IMM_OPERAND(creator), &virt))
{
- if (g_imm_operand_to_virt_t(G_IMM_OPERAND(creator), &virt))
- {
- init_vmpa(&addr, VMPA_NO_PHYSICAL, virt);
- defined = true;
- }
+ init_vmpa(&addr, VMPA_NO_PHYSICAL, virt);
+ defined = true;
}
+ }
- if (defined)
- gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), &addr);
+ if (defined)
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), &addr);
- g_object_unref(creator);
-
- }
+ g_object_unref(creator);
g_object_unref(G_OBJECT(panel));
@@ -492,51 +600,48 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
vmpa2t *dest; /* Adresse de destination */
panel = get_current_view();
+ assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
- if (GTK_IS_DISPLAY_PANEL(panel))
- {
- addr = gtk_display_panel_get_caret_location(GTK_DISPLAY_PANEL(panel));
-
- binary = get_current_binary();
- proc = g_loaded_binary_get_processor(binary);
-
- /**
- * On ne peut pas se reposer sur l'espace couvert par une ligne, car il peut
- * être de taille nulle (cas d'une étiquette, par exemple), à la différence
- * de la taille d'une instruction.
- *
- * 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);
-
- if (instr != NULL)
- {
- ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar));
+ addr = gtk_display_panel_get_caret_location(GTK_DISPLAY_PANEL(panel));
- dialog = create_gotox_dialog_for_cross_references(GTK_WINDOW(ref), binary, instr, true);
+ binary = G_LOADED_BINARY(get_current_content());
+ proc = g_loaded_binary_get_processor(binary);
- if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
- {
- dest = get_address_from_gotox_dialog(dialog);
+ /**
+ * On ne peut pas se reposer sur l'espace couvert par une ligne, car il peut
+ * être de taille nulle (cas d'une étiquette, par exemple), à la différence
+ * de la taille d'une instruction.
+ *
+ * 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);
- gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), dest);
+ if (instr != NULL)
+ {
+ ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar));
- delete_vmpa(dest);
+ dialog = create_gotox_dialog_for_cross_references(GTK_WINDOW(ref), binary, instr, true);
- }
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
+ {
+ dest = get_address_from_gotox_dialog(dialog);
- gtk_widget_destroy(dialog);
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), dest);
- g_object_unref(G_OBJECT(instr));
+ delete_vmpa(dest);
}
- g_object_unref(G_OBJECT(proc));
- g_object_unref(G_OBJECT(binary));
+ gtk_widget_destroy(dialog);
+
+ g_object_unref(G_OBJECT(instr));
}
+ g_object_unref(G_OBJECT(proc));
+ g_object_unref(G_OBJECT(binary));
+
g_object_unref(G_OBJECT(panel));
}
@@ -570,15 +675,13 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar)
/* Détermination de l'adresse visée */
panel = get_current_view();
-
- if (!GTK_IS_DISPLAY_PANEL(panel))
- goto done_with_panel;
+ assert(GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
curloc = gtk_display_panel_get_caret_location(GTK_DISPLAY_PANEL(panel));
/* Accès à la collection */
- binary = get_current_binary();
+ binary = G_LOADED_BINARY(get_current_content());
collec = g_loaded_binary_find_collection(binary, DBF_BOOKMARKS);
/**
@@ -636,8 +739,6 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar)
g_object_unref(G_OBJECT(collec));
g_object_unref(G_OBJECT(binary));
- done_with_panel:
-
g_object_unref(G_OBJECT(panel));
}
diff --git a/src/gui/menus/edition.h b/src/gui/menus/edition.h
index f863568..a49e320 100644
--- a/src/gui/menus/edition.h
+++ b/src/gui/menus/edition.h
@@ -30,15 +30,18 @@
#include "menubar.h"
-#include "../../gtkext/gtkdisplaypanel.h"
+#include "../../glibext/gloadedpanel.h"
/* Construit le menu "Edition". */
GtkWidget *build_menu_edition(GObject *, GtkAccelGroup *, GMenuBar *);
+/* Lance une actualisation du fait d'un changement de support. */
+void update_access_for_view_in_menu_edition(GLoadedPanel *);
+
/* Met à jour les accès du menu "Edition" selon une position. */
-void update_access_in_menu_edition(GObject *, GtkDisplayPanel *, const vmpa2t *);
+void update_access_for_cursor_in_menu_edition(GLoadedPanel *, const GLineCursor *);
diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c
index 989d964..7bc7e85 100644
--- a/src/gui/menus/menubar.c
+++ b/src/gui/menus/menubar.c
@@ -76,14 +76,14 @@ static void g_menu_bar_dispose(GMenuBar *);
/* Procède à la libération totale de la mémoire. */
static void g_menu_bar_finalize(GMenuBar *);
-/* Lance une actualisation du fait d'un changement de vue. */
-static void update_menu_bar_for_view(GMenuBar *, GtkDisplayPanel *);
+/* Réagit à un changement d'affichage principal de contenu. */
+static void change_menubar_current_content(GMenuBar *, GLoadedContent *, GLoadedContent *);
-/* Réagit à un changement de focus des panneaux d'affichage. */
-static void notify_focus_change_for_menu_bar(GMenuBar *, GtkDisplayPanel *);
+/* Lance une actualisation du fait d'un changement de support. */
+static void change_menubar_current_view(GMenuBar *, GLoadedPanel *, GLoadedPanel *);
/* Met à jour les accès aux menus en fonction de la position. */
-static void track_caret_address_for_menu_bar(GMenuBar *, GtkDisplayPanel *, const vmpa2t *);
+static void track_caret_address_for_menu_bar(GMenuBar *, GLoadedPanel *, const GLineCursor *);
/* Lance une actualisation relative à l'étendue du projet. */
static void update_menu_bar_for_project(GMenuBar *, GStudyProject *);
@@ -118,9 +118,9 @@ static void g_menu_bar_class_init(GMenuBarClass *klass)
editem = G_EDITOR_ITEM_CLASS(klass);
- editem->update_view = (update_item_view_fc)update_menu_bar_for_view;
- editem->notify_focus = (notify_focus_change_fc)notify_focus_change_for_menu_bar;
- editem->track_caret = (track_caret_in_view_fc)track_caret_address_for_menu_bar;
+ editem->change_content = (change_item_content_fc)change_menubar_current_content;
+ editem->change_view = (change_item_view_fc)change_menubar_current_view;
+ editem->track_cursor = (track_cursor_in_view_fc)track_caret_address_for_menu_bar;
editem->update_project = (update_project_fc)update_menu_bar_for_project;
}
@@ -264,10 +264,6 @@ GEditorItem *g_menu_bar_new(GObject *ref, GtkAccelGroup *accgroup)
result->help = build_menu_help(ref, accgroup);
gtk_container_add(GTK_CONTAINER(item->widget), result->help);
- /* Finalisation générique */
-
- notify_focus_change_for_menu_bar(result, NULL);
-
return G_EDITOR_ITEM(result);
}
@@ -275,10 +271,11 @@ GEditorItem *g_menu_bar_new(GObject *ref, GtkAccelGroup *accgroup)
/******************************************************************************
* *
-* Paramètres : bar = barre de menus à actualiser. *
-* panel = nouveau panneau d'affichage actif. *
+* Paramètres : bar = barre de menus à mettre à jour. *
+* old = ancien contenu chargé analysé. *
+* new = nouveau contenu chargé à analyser. *
* *
-* Description : Lance une actualisation du fait d'un changement de vue. *
+* Description : Réagit à un changement d'affichage principal de contenu. *
* *
* Retour : - *
* *
@@ -286,19 +283,20 @@ GEditorItem *g_menu_bar_new(GObject *ref, GtkAccelGroup *accgroup)
* *
******************************************************************************/
-static void update_menu_bar_for_view(GMenuBar *bar, GtkDisplayPanel *panel)
+static void change_menubar_current_content(GMenuBar *bar, GLoadedContent *old, GLoadedContent *new)
{
- update_menu_view_for_view(bar->view, panel, bar);
+ update_access_for_content_in_menu_binary(new);
}
/******************************************************************************
* *
-* Paramètres : bar = barre de menus à actualiser. *
-* panel = composant d'affichage concerné par l'opération. *
+* Paramètres : bar = barre de menus à mettre à jour. *
+* old = ancienne vue du contenu chargé analysé. *
+* new = nouvelle vue du contenu chargé analysé. *
* *
-* Description : Réagit à un changement de focus des panneaux d'affichage. *
+* Description : Lance une actualisation du fait d'un changement de support. *
* *
* Retour : - *
* *
@@ -306,23 +304,12 @@ static void update_menu_bar_for_view(GMenuBar *bar, GtkDisplayPanel *panel)
* *
******************************************************************************/
-static void notify_focus_change_for_menu_bar(GMenuBar *bar, GtkDisplayPanel *panel)
+static void change_menubar_current_view(GMenuBar *bar, GLoadedPanel *old, GLoadedPanel *new)
{
- const vmpa2t *addr; /* Position courante */
- GEditorItem *item; /* Autre version de l'élément */
-
- if (panel != NULL)
- addr = gtk_display_panel_get_caret_location(panel);
- else
- addr = NULL;
-
- item = G_EDITOR_ITEM(bar);
-
- update_access_in_menu_edition(item->ref, panel, addr);
+ update_access_for_view_in_menu_edition(new);
- update_access_in_menu_view(item->ref, panel);
-
- update_access_in_menu_binary(item->ref, panel);
+ rebuild_menu_view(bar->view, new, bar);
+ update_access_for_view_in_menu_view(G_EDITOR_ITEM(bar)->ref, new);
}
@@ -330,8 +317,8 @@ static void notify_focus_change_for_menu_bar(GMenuBar *bar, GtkDisplayPanel *pan
/******************************************************************************
* *
* Paramètres : bar = barre de menus à actualiser. *
-* panel = panneau d'affichage actif ou NULL si aucun. *
-* addr = nouvelle adresse du curseur courant. *
+* panel = composant d'affichage parcouru. *
+* cursor = nouvel emplacement du curseur courant. *
* *
* Description : Met à jour les accès aux menus en fonction de la position. *
* *
@@ -341,13 +328,9 @@ static void notify_focus_change_for_menu_bar(GMenuBar *bar, GtkDisplayPanel *pan
* *
******************************************************************************/
-static void track_caret_address_for_menu_bar(GMenuBar *bar, GtkDisplayPanel *panel, const vmpa2t *addr)
+static void track_caret_address_for_menu_bar(GMenuBar *bar, GLoadedPanel *panel, const GLineCursor *cursor)
{
- GEditorItem *item; /* Autre version de l'élément */
-
- item = G_EDITOR_ITEM(bar);
-
- update_access_in_menu_edition(item->ref, panel, addr);
+ update_access_for_cursor_in_menu_edition(panel, cursor);
}
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index dfbf152..f0e7450 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -105,7 +105,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
qck_create_menu(GTK_MENU_ITEM(submenuitem));
- /* - */
+ /* Séparation */
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -138,7 +138,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
add_accelerator_to_menu_item(submenuitem, "<Shift>Tab", accgroup);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- /* - */
+ /* Séparation */
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -160,7 +160,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
g_object_set_data(G_OBJECT(submenuitem), "kind_of_opt", GUINT_TO_POINTER(BLC_BINARY));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- /* - */
+ /* Séparation */
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -191,7 +191,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
* *
******************************************************************************/
-void update_menu_view_for_view(GtkWidget *widget, GtkDisplayPanel *panel, GMenuBar *bar)
+void rebuild_menu_view(GtkWidget *widget, GLoadedPanel *panel, GMenuBar *bar)
{
GObject *ref; /* Espace de référencements */
GtkRadioMenuItem *item; /* Elément de menu arbitraire */
@@ -246,9 +246,9 @@ void update_menu_view_for_view(GtkWidget *widget, GtkDisplayPanel *panel, GMenuB
g_slist_foreach(radios, (GFunc)reconnect_display_radio, NULL);
- /* - */
+ /* Séparation */
- content = g_loaded_panel_get_content(G_LOADED_PANEL(panel));
+ content = g_loaded_panel_get_content(panel);
view_index = g_loaded_content_get_view_index(content, GTK_WIDGET(panel));
@@ -305,7 +305,7 @@ void update_menu_view_for_view(GtkWidget *widget, GtkDisplayPanel *panel, GMenuB
* *
******************************************************************************/
-void update_access_in_menu_view(GObject *ref, GtkDisplayPanel *panel)
+void update_access_for_view_in_menu_view(GObject *ref, GLoadedPanel *panel)
{
gboolean access; /* Accès à déterminer */
GtkWidget *item; /* Elément de menu à traiter */
diff --git a/src/gui/menus/view.h b/src/gui/menus/view.h
index d42bbc6..5216bcb 100644
--- a/src/gui/menus/view.h
+++ b/src/gui/menus/view.h
@@ -30,7 +30,7 @@
#include "menubar.h"
-#include "../../gtkext/gtkdisplaypanel.h"
+#include "../../glibext/gloadedpanel.h"
@@ -38,10 +38,10 @@
GtkWidget *build_menu_view(GObject *, GtkAccelGroup *, GMenuBar *);
/* Lance une actualisation du fait d'un changement de vue. */
-void update_menu_view_for_view(GtkWidget *, GtkDisplayPanel *, GMenuBar *);
+void rebuild_menu_view(GtkWidget *, GLoadedPanel *, GMenuBar *);
/* Met à jour les accès du menu "Affichage" selon le contenu. */
-void update_access_in_menu_view(GObject *, GtkDisplayPanel *);
+void update_access_for_view_in_menu_view(GObject *, GLoadedPanel *);