diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-03-18 09:00:20 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-03-18 09:00:55 (GMT) |
commit | 43d57853c6f2c59197c7dc20ff61f3f2eacc2445 (patch) | |
tree | 3dcb5ad426c7e5d4159d95f7e9e5e80eef45bfe0 /src/gui/menus | |
parent | f65f83fd222d14934b527152899359327813128e (diff) |
Exported graph views using Cairo.
Diffstat (limited to 'src/gui/menus')
-rw-r--r-- | src/gui/menus/binary.c | 104 | ||||
-rw-r--r-- | src/gui/menus/binary.h | 3 | ||||
-rw-r--r-- | src/gui/menus/menubar.c | 2 |
3 files changed, 99 insertions, 10 deletions
diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c index c4c4e22..3a143da 100644 --- a/src/gui/menus/binary.c +++ b/src/gui/menus/binary.c @@ -31,11 +31,13 @@ #include "../agroup.h" #include "../editem-int.h" #include "../core/global.h" -#include "../dialogs/export.h" +#include "../dialogs/export_disass.h" +#include "../dialogs/export_graph.h" #include "../dialogs/gotox.h" #include "../dialogs/storage.h" #include "../../gtkext/easygtk.h" #include "../../gtkext/gtkdisplaypanel.h" +#include "../../gtkext/gtkgraphdisplay.h" @@ -48,8 +50,11 @@ static void mcb_binary_attach_debugger(GtkMenuItem *, GMenuBar *); /* Réagit au menu "Binaire -> Enregistrements...". */ static void mcb_binary_storage(GtkMenuItem *, GMenuBar *); -/* Réagit au menu "Binaire -> Exporter...". */ -static void mcb_binary_export(GtkMenuItem *, GMenuBar *); +/* Réagit au menu "Binaire -> Exporter -> Désassemblage". */ +static void mcb_binary_export_disass(GtkMenuItem *, gpointer); + +/* Réagit au menu "Binaire -> Exporter -> Vue graphique". */ +static void mcb_binary_export_graph(GtkMenuItem *, gpointer); @@ -70,7 +75,9 @@ GtkWidget *build_menu_binary(GObject *ref, GMenuBar *bar) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ - GtkWidget *submenuitem; /* Sous-élément de menu */ + GtkWidget *submenuitem; /* Sous-élément de menu #1 */ + GtkWidget *deepmenubar; /* Support pour éléments #2 */ + GtkWidget *deepmenuitem; /* Sous-élément de menu #2 */ result = gtk_menu_item_new_with_mnemonic(_("_Binary")); gtk_widget_show(result); @@ -96,10 +103,26 @@ GtkWidget *build_menu_binary(GObject *ref, GMenuBar *bar) G_CALLBACK(mcb_binary_storage), bar); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); - submenuitem = qck_create_menu_item(ref, "mnu_binary_export", _("Export..."), - G_CALLBACK(mcb_binary_export), bar); + /* Séparation */ + + submenuitem = qck_create_menu_separator(); + gtk_container_add(GTK_CONTAINER(menubar), submenuitem); + + /* Exportations */ + + submenuitem = qck_create_menu_item(NULL, NULL, _("Export"), NULL, NULL); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); + deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem)); + + deepmenuitem = qck_create_menu_item(ref, "mnu_binary_export_disass", _("Disassembly"), + G_CALLBACK(mcb_binary_export_disass), bar); + gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem); + + deepmenuitem = qck_create_menu_item(ref, "mnu_binary_export_graph", _("Graph view"), + G_CALLBACK(mcb_binary_export_graph), NULL); + gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem); + return result; } @@ -137,7 +160,37 @@ void update_access_for_content_in_menu_binary(GLoadedContent *new) 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")); + item = GTK_WIDGET(g_object_get_data(ref, "mnu_binary_export_disass")); + gtk_widget_set_sensitive(item, access); + +} + + +/****************************************************************************** +* * +* 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_binary(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(); + + /* Exportation de graphiques */ + + access = GTK_IS_GRAPH_DISPLAY(new); + + item = GTK_WIDGET(g_object_get_data(ref, "mnu_binary_export_graph")); gtk_widget_set_sensitive(item, access); } @@ -249,9 +302,9 @@ static void mcb_binary_storage(GtkMenuItem *menuitem, GMenuBar *bar) /****************************************************************************** * * * Paramètres : menuitem = élément de menu sélectionné. * -* bar = barre de menu parente. * +* unused = adresse non utilisée ici. * * * -* Description : Réagit au menu "Binaire -> Exporter...". * +* Description : Réagit au menu "Binaire -> Exporter -> Désassemblage". * * * * Retour : - * * * @@ -259,7 +312,7 @@ static void mcb_binary_storage(GtkMenuItem *menuitem, GMenuBar *bar) * * ******************************************************************************/ -static void mcb_binary_export(GtkMenuItem *menuitem, GMenuBar *bar) +static void mcb_binary_export_disass(GtkMenuItem *menuitem, gpointer unused) { GLoadedBinary *binary; /* Edition courante */ @@ -270,3 +323,34 @@ static void mcb_binary_export(GtkMenuItem *menuitem, GMenuBar *bar) g_object_unref(G_OBJECT(binary)); } + + +/****************************************************************************** +* * +* Paramètres : menuitem = élément de menu sélectionné. * +* unused = adresse non utilisée ici. * +* * +* Description : Réagit au menu "Binaire -> Exporter -> Vue graphique". * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void mcb_binary_export_graph(GtkMenuItem *menuitem, gpointer unused) +{ + GtkGraphDisplay *panel; /* Panneau de code courant */ + GLoadedBinary *binary; /* Edition courante */ + + binary = G_LOADED_BINARY(get_current_content()); + + panel = GTK_GRAPH_DISPLAY(get_current_view()); + + run_graph_export_assistant(binary, panel, get_editor_window()); + + g_object_unref(G_OBJECT(panel)); + + g_object_unref(G_OBJECT(binary)); + +} diff --git a/src/gui/menus/binary.h b/src/gui/menus/binary.h index c68b67c..a752626 100644 --- a/src/gui/menus/binary.h +++ b/src/gui/menus/binary.h @@ -40,6 +40,9 @@ GtkWidget *build_menu_binary(GObject *, GMenuBar *); /* Réagit à un changement d'affichage principal de contenu. */ void update_access_for_content_in_menu_binary(GLoadedContent *); +/* Lance une actualisation du fait d'un changement de support. */ +void update_access_for_view_in_menu_binary(GLoadedPanel *); + #endif /* _GUI_MENUS_BINARY_H */ diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c index 886387c..aa89a13 100644 --- a/src/gui/menus/menubar.c +++ b/src/gui/menus/menubar.c @@ -311,6 +311,8 @@ static void change_menubar_current_view(GMenuBar *bar, GLoadedPanel *old, GLoade update_access_for_view_in_menu_view(G_EDITOR_ITEM(bar)->ref, new); + update_access_for_view_in_menu_binary(new); + } |