diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/menus/view.c | 87 |
1 files changed, 47 insertions, 40 deletions
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c index 511d9db..9abcbd3 100644 --- a/src/gui/menus/view.c +++ b/src/gui/menus/view.c @@ -38,11 +38,8 @@ /* Réagit avec le menu "Affichage -> Vue xxx". */ static void mcb_view_change_support(GtkRadioMenuItem *, GMenuBar *); -/* Réagit avec le menu "Affichage -> Adresse virtuelle". */ -static void mcb_view_addresses(GtkCheckMenuItem *, GMenuBar *); - -/* Réagit avec le menu "Affichage -> code binaire". */ -static void mcb_view_code(GtkCheckMenuItem *, GMenuBar *); +/* Réagit avec le menu "Affichage -> (colonne xxx)". */ +static void mcb_view_display_column(GtkCheckMenuItem *, GMenuBar *); @@ -98,12 +95,19 @@ 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_check_menu_item(G_OBJECT(result), "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"), - G_CALLBACK(mcb_view_addresses), bar); + 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"), - G_CALLBACK(mcb_view_code), bar); + 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); submenuitem = qck_create_menu_separator(); @@ -130,30 +134,50 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar) void update_menu_view_for_view(GtkWidget *widget, GtkViewPanel *view, GMenuBar *bar) { + 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 */ + binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar)); + + content = gtk_view_panel_describe_content(view); + + display = g_loaded_binary_get_column_display(binary, content); + + /* Positions physiques */ + + submenuitem = g_object_get_data(G_OBJECT(widget), "off"); + + g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), bar); + + status = display[BLC_PHYSICAL]; + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(submenuitem), status); + + g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_display_column), bar); + /* Adresses virtuelles */ submenuitem = g_object_get_data(G_OBJECT(widget), "addr"); - g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_addresses), bar); + g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), bar); - status = gtk_view_panel_get_addresses_display(view); + status = display[BLC_VIRTUAL]; gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(submenuitem), status); - g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_addresses), bar); + g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_display_column), bar); /* Code binaire */ submenuitem = g_object_get_data(G_OBJECT(widget), "code"); - g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_code), bar); + g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), bar); - status = gtk_view_panel_get_code_display(view); + status = display[BLC_BINARY]; gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(submenuitem), status); - g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_code), bar); + g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_display_column), bar); } @@ -227,7 +251,7 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, GMenuBar *bar) * Paramètres : menuitem = élément de menu ayant basculé. * * bar = barre de menu parente. * * * -* Description : Réagit avec le menu "Affichage -> Adresse virtuelle". * +* Description : Réagit avec le menu "Affichage -> (colonne xxx)". * * * * Retour : - * * * @@ -235,40 +259,23 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, GMenuBar *bar) * * ******************************************************************************/ -static void mcb_view_addresses(GtkCheckMenuItem *menuitem, GMenuBar *bar) +static void mcb_view_display_column(GtkCheckMenuItem *menuitem, GMenuBar *bar) { + BufferLineColumn col; /* Colonne à traiter */ + GLoadedBinary *binary; /* Binaire courant */ GtkViewPanel *panel; /* Affichage courant */ + BinaryView view; /* Type de vue représentée */ gboolean active; /* Etat de sélection du menu */ - panel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar)); - active = gtk_check_menu_item_get_active(menuitem); - - gtk_view_panel_set_addresses_display(panel, active); - -} - + col = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(menuitem), "kind_of_col")); -/****************************************************************************** -* * -* Paramètres : menuitem = élément de menu ayant basculé. * -* bar = barre de menu parente. * -* * -* Description : Réagit avec le menu "Affichage -> code binaire". * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void mcb_view_code(GtkCheckMenuItem *menuitem, GMenuBar *bar) -{ - GtkViewPanel *panel; /* Affichage courant */ - gboolean active; /* Etat de sélection du menu */ + binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar)); panel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar)); + view = gtk_view_panel_describe_content(panel); + active = gtk_check_menu_item_get_active(menuitem); - gtk_view_panel_set_code_display(panel, active); + g_loaded_binary_set_column_display(binary, view, col, active); } |