summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/menus/binary.c38
-rw-r--r--src/gui/menus/binary.h3
-rw-r--r--src/gui/menus/menubar.c8
-rw-r--r--src/gui/menus/view.c74
-rw-r--r--src/gui/menus/view.h3
5 files changed, 116 insertions, 10 deletions
diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c
index 2c349e4..ab8c54a 100644
--- a/src/gui/menus/binary.c
+++ b/src/gui/menus/binary.c
@@ -73,7 +73,7 @@ GtkWidget *build_menu_binary(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *ba
menubar = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(result), menubar);
- submenuitem = qck_create_menu_item(NULL, NULL, _("Entry points"),
+ submenuitem = qck_create_menu_item(ref, "mnu_binary_epoints", _("Entry points"),
G_CALLBACK(mcb_binary_entry_points), bar);
add_accelerator_to_menu_item(submenuitem, "<Ctrl>E", accgroup);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -96,6 +96,42 @@ GtkWidget *build_menu_binary(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *ba
/******************************************************************************
* *
+* Paramètres : ref = espace de référencements à consulter. *
+* vpanel = panneau d'affichage actif ou NULL si aucun. *
+* *
+* Description : Met à jour les accès du menu "Binaire" selon le contenu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_access_in_menu_binary(GObject *ref, GtkViewPanel *vpanel)
+{
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ /* Préliminaire */
+
+ access = (vpanel != NULL);
+
+ /* Menus */
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_binary_epoints"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_binary_storage"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_binary_export"));
+ gtk_widget_set_sensitive(item, access);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : menuitem = élément de menu sélectionné. *
* bar = barre de menu parente. *
* *
diff --git a/src/gui/menus/binary.h b/src/gui/menus/binary.h
index e7a3bab..b671bc7 100644
--- a/src/gui/menus/binary.h
+++ b/src/gui/menus/binary.h
@@ -36,6 +36,9 @@
/* 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 *, GtkViewPanel *);
+
#endif /* _GUI_MENUS_BINARY_H */
diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c
index e2ad155..dbfb995 100644
--- a/src/gui/menus/menubar.c
+++ b/src/gui/menus/menubar.c
@@ -257,6 +257,10 @@ 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);
}
@@ -317,6 +321,10 @@ static void notify_focus_change_for_menu_bar(GMenuBar *bar, GtkViewPanel *panel)
update_access_in_menu_edition(item->ref, panel, addr);
+ update_access_in_menu_view(item->ref, panel);
+
+ update_access_in_menu_binary(item->ref, panel);
+
if (line != NULL)
g_object_unref(G_OBJECT(line));
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index d3bebc3..43c1a69 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -95,7 +95,9 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- submenuitem = qck_create_radio_menu_item(ref, "textview", NULL, _("Text view"),
+ /* Types de panneau de code */
+
+ submenuitem = qck_create_radio_menu_item(ref, "mnu_view_switch_textview", NULL, _("Text view"),
G_CALLBACK(mcb_view_change_support), bar);
add_accelerator_to_menu_item(submenuitem, "F2", accgroup);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_BLOCK));
@@ -103,7 +105,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
rgroup = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(submenuitem));
- submenuitem = qck_create_radio_menu_item(ref, "graphview", rgroup, _("Graph view"),
+ submenuitem = qck_create_radio_menu_item(ref, "mnu_view_switch_graphview", rgroup, _("Graph view"),
G_CALLBACK(mcb_view_change_support), bar);
add_accelerator_to_menu_item(submenuitem, "F3", accgroup);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_GRAPH));
@@ -111,26 +113,30 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
rgroup = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(submenuitem));
- submenuitem = qck_create_radio_menu_item(ref, "sourceview", rgroup, _("Source code"),
+ submenuitem = qck_create_radio_menu_item(ref, "mnu_view_switch_sourceview", rgroup, _("Source code"),
G_CALLBACK(mcb_view_change_support), bar);
add_accelerator_to_menu_item(submenuitem, "F4", accgroup);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_SOURCE));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+ /* - */
+
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- submenuitem = qck_create_check_menu_item(G_OBJECT(result), "off", _("Physical offset"),
+ /* Affichage des données */
+
+ submenuitem = qck_create_check_menu_item(ref, "mnu_view_display_off", _("Physical offset"),
G_CALLBACK(mcb_view_display_column), bar);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_col", GUINT_TO_POINTER(BLC_PHYSICAL));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- submenuitem = qck_create_check_menu_item(G_OBJECT(result), "addr", _("Virtual address"),
+ submenuitem = qck_create_check_menu_item(ref, "mnu_view_display_addr", _("Virtual address"),
G_CALLBACK(mcb_view_display_column), bar);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_col", GUINT_TO_POINTER(BLC_VIRTUAL));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- submenuitem = qck_create_check_menu_item(G_OBJECT(result), "code", _("Binary code"),
+ submenuitem = qck_create_check_menu_item(ref, "mnu_view_display_code", _("Binary code"),
G_CALLBACK(mcb_view_display_column), bar);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_col", GUINT_TO_POINTER(BLC_BINARY));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -168,12 +174,15 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
void update_menu_view_for_view(GtkWidget *widget, GtkViewPanel *view, GMenuBar *bar)
{
+ GObject *ref; /* Espace de référencements */
GLoadedBinary *binary; /* Binaire courant */
BinaryView content; /* Type de vue active */
const bool *display; /* Règles d'affichage courantes*/
GtkWidget *submenuitem; /* Sous-élément de menu */
bool status; /* Consigne d'affichage */
+ ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar));
+
binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar));
content = gtk_view_panel_describe_content(view);
@@ -182,7 +191,7 @@ void update_menu_view_for_view(GtkWidget *widget, GtkViewPanel *view, GMenuBar *
/* Positions physiques */
- submenuitem = g_object_get_data(G_OBJECT(widget), "off");
+ submenuitem = g_object_get_data(ref, "mnu_view_display_off");
g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), bar);
@@ -193,7 +202,7 @@ void update_menu_view_for_view(GtkWidget *widget, GtkViewPanel *view, GMenuBar *
/* Adresses virtuelles */
- submenuitem = g_object_get_data(G_OBJECT(widget), "addr");
+ submenuitem = g_object_get_data(ref, "mnu_view_display_addr");
g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), bar);
@@ -204,7 +213,7 @@ void update_menu_view_for_view(GtkWidget *widget, GtkViewPanel *view, GMenuBar *
/* Code binaire */
- submenuitem = g_object_get_data(G_OBJECT(widget), "code");
+ submenuitem = g_object_get_data(ref, "mnu_view_display_code");
g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), bar);
@@ -218,6 +227,53 @@ void update_menu_view_for_view(GtkWidget *widget, GtkViewPanel *view, GMenuBar *
/******************************************************************************
* *
+* Paramètres : ref = espace de référencements à consulter. *
+* vpanel = panneau d'affichage actif ou NULL si aucun. *
+* *
+* Description : Met à jour les accès du menu "Affichage" selon le contenu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_access_in_menu_view(GObject *ref, GtkViewPanel *vpanel)
+{
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ /* Préliminaire */
+
+ access = (vpanel != NULL);
+
+ /* Types de panneau de code */
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_switch_textview"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_switch_graphview"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_switch_sourceview"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Affichage des données */
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_display_off"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_display_addr"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_display_code"));
+ gtk_widget_set_sensitive(item, access);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : menuitem = élément de menu sélectionné. *
* bar = barre de menu parente. *
* *
diff --git a/src/gui/menus/view.h b/src/gui/menus/view.h
index bc4b4cc..46cc16d 100644
--- a/src/gui/menus/view.h
+++ b/src/gui/menus/view.h
@@ -39,6 +39,9 @@ GtkWidget *build_menu_view(GObject *, GtkAccelGroup *, GMenuBar *);
/* Lance une actualisation du fait d'un changement de vue. */
void update_menu_view_for_view(GtkWidget *, GtkViewPanel *, GMenuBar *);
+/* Met à jour les accès du menu "Affichage" selon le contenu. */
+void update_access_in_menu_view(GObject *, GtkViewPanel *);
+
#endif /* _GUI_MENUS_VIEW_H */