summaryrefslogtreecommitdiff
path: root/src/gui/menus
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/menus')
-rw-r--r--src/gui/menus/project.c41
-rw-r--r--src/gui/menus/view.c66
2 files changed, 58 insertions, 49 deletions
diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c
index c46c017..5d027a0 100644
--- a/src/gui/menus/project.c
+++ b/src/gui/menus/project.c
@@ -46,8 +46,8 @@ static void mcb_project_add_shellcode(GtkMenuItem *, GMenuBar *);
/* Affiche la boîte d'ajout d'un binaire au projet courant. */
static void mcb_project_add_binary_file(GtkMenuItem *, GMenuBar *);
-/* Retire un binaire du projet indiqué. */
-static void mcb_project_remove_binary(GtkMenuItem *, GStudyProject *);
+/* Retire un contenu du projet indiqué. */
+static void mcb_project_remove_content(GtkMenuItem *, GStudyProject *);
@@ -122,8 +122,8 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project,
GtkWidget *menubar; /* Support pour éléments */
GList *list; /* Liste des éléments en place */
GList *iter; /* Boucle de parcours #1 */
- size_t count; /* Nombre de binaires attachés */
- GLoadedBinary **binaries; /* Liste de ces binaires */
+ size_t count; /* Nombre de contenus attachés */
+ GLoadedContent **contents; /* Liste de ces contenus */
size_t i; /* Boucle de parcours #2 */
const char *desc; /* Description à afficher */
GtkWidget *submenuitem; /* Sous-menu à ajouter */
@@ -142,23 +142,26 @@ void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project,
/* Ajout des entrées */
- binaries = g_study_project_get_binaries(project, &count);
+ contents = g_study_project_get_contents(project, &count);
for (i = 0; i < count; i++)
{
- desc = g_loaded_binary_get_name(binaries[i], true);
+ desc = g_loaded_content_describe(contents[i], true);
submenuitem = qck_create_menu_item(NULL, NULL, desc,
- G_CALLBACK(mcb_project_remove_binary), project);
- g_object_set_data(G_OBJECT(submenuitem), "binary", binaries[i]);
+ G_CALLBACK(mcb_project_remove_content), project);
+ g_object_set_data_full(G_OBJECT(submenuitem), "content", contents[i], g_object_unref);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- g_object_unref(G_OBJECT(binaries[i]));
+ /**
+ * Note : l'appel à g_object_unref() est réalisé lorsque la référence
+ * est retirée du menu.
+ */
}
- if (binaries != NULL)
- free(binaries);
+ if (contents != NULL)
+ free(contents);
gtk_widget_set_sensitive(menuitem, count > 0);
@@ -304,7 +307,7 @@ static void mcb_project_add_binary_file(GtkMenuItem *menuitem, GMenuBar *bar)
* Paramètres : menuitem = élément de menu sélectionné. *
* project = projet d'appartenance du binaire à traiter. *
* *
-* Description : Retire un binaire du projet indiqué. *
+* Description : Retire un contenu du projet indiqué. *
* *
* Retour : - *
* *
@@ -312,13 +315,17 @@ static void mcb_project_add_binary_file(GtkMenuItem *menuitem, GMenuBar *bar)
* *
******************************************************************************/
-static void mcb_project_remove_binary(GtkMenuItem *menuitem, GStudyProject *project)
+static void mcb_project_remove_content(GtkMenuItem *menuitem, GStudyProject *project)
{
- GLoadedBinary *binary; /* Binaire à retirer */
+ GObject *ref; /* Espace de référencement */
+ GLoadedContent *content; /* Contenu à retirer */
- binary = G_LOADED_BINARY(g_object_get_data(G_OBJECT(menuitem), "binary"));
+ ref = G_OBJECT(menuitem);
- g_study_project_detach_binary(project, binary);
- g_object_unref(G_OBJECT(binary));
+ content = G_LOADED_CONTENT(g_object_get_data(ref, "content"));
+
+ g_study_project_detach_content(project, content);
+
+ g_object_set_data(ref, "content", NULL);
}
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index 4298805..81b06d6 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -35,7 +35,7 @@
#include "../core/global.h"
#include "../core/items.h"
#include "../core/panels.h"
-#include "../../analysis/project.h"
+#include "../../analysis/loaded.h"
#include "../../gtkext/easygtk.h"
#include "../../gtkext/gtkblockdisplay.h"
#include "../../gtkext/gtkgraphdisplay.h"
@@ -125,17 +125,17 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
submenuitem = qck_create_check_menu_item(ref, "mnu_view_display_off", _("Physical offset"),
G_CALLBACK(mcb_view_display_column), NULL);
- g_object_set_data(G_OBJECT(submenuitem), "kind_of_col", GUINT_TO_POINTER(BLC_PHYSICAL));
+ g_object_set_data(G_OBJECT(submenuitem), "kind_of_opt", GUINT_TO_POINTER(BLC_PHYSICAL));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
submenuitem = qck_create_check_menu_item(ref, "mnu_view_display_addr", _("Virtual address"),
G_CALLBACK(mcb_view_display_column), NULL);
- g_object_set_data(G_OBJECT(submenuitem), "kind_of_col", GUINT_TO_POINTER(BLC_VIRTUAL));
+ g_object_set_data(G_OBJECT(submenuitem), "kind_of_opt", GUINT_TO_POINTER(BLC_VIRTUAL));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
submenuitem = qck_create_check_menu_item(ref, "mnu_view_display_code", _("Binary code"),
G_CALLBACK(mcb_view_display_column), NULL);
- g_object_set_data(G_OBJECT(submenuitem), "kind_of_col", GUINT_TO_POINTER(BLC_BINARY));
+ g_object_set_data(G_OBJECT(submenuitem), "kind_of_opt", GUINT_TO_POINTER(BLC_BINARY));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
/* - */
@@ -175,8 +175,8 @@ void update_menu_view_for_view(GtkWidget *widget, GtkDisplayPanel *panel, GMenuB
GtkRadioMenuItem *item; /* Elément de menu arbitraire */
GSList *radios; /* Liste des menus d'affichage */
GSList *found; /* Elément de menu à activer */
- BinaryView content; /* Type de vue active */
- GLoadedBinary *binary; /* Binaire courant */
+ GLoadedContent *content; /* Contenu global représenté */
+ unsigned int view_index; /* Indice de représentation */
const bool *display; /* Règles d'affichage courantes*/
GtkWidget *submenuitem; /* Sous-élément de menu */
bool status; /* Consigne d'affichage */
@@ -226,13 +226,13 @@ void update_menu_view_for_view(GtkWidget *widget, GtkDisplayPanel *panel, GMenuB
/* - */
- content = gtk_display_panel_describe_content(panel);
+ content = g_loaded_panel_get_content(G_LOADED_PANEL(panel));
- binary = get_current_binary();
+ view_index = g_loaded_content_get_view_index(content, GTK_WIDGET(panel));
- display = g_loaded_binary_get_column_display(binary, content);
+ display = g_loaded_content_get_all_display_options(content, view_index);
- g_object_unref(G_OBJECT(binary));
+ g_object_unref(G_OBJECT(content));
/* Positions physiques */
@@ -465,11 +465,12 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, gpointer unused)
{
GSList *group; /* Liste de menus radio */
GSList *iter; /* Boucle de parcours */
- BinaryView wanted; /* Nouvelle vue à présenter */
- GtkDisplayPanel *panel; /* Afficheur effectif de code */
+ unsigned int wanted; /* Nouvelle vue à présenter */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
GtkDockStation *station; /* Base du remplacement */
- GtkWidget *scroll; /* Nouveau support à utiliser */
- GtkDisplayPanel *new; /* Nouvel afficheur de code */
+ GLoadedContent *content; /* Contenu représenté */
+ GtkWidget *support; /* Nouvel afficheur généraliste*/
+ GtkWidget *new; /* Panneau encapsulé */
/* On ne traite qu'une seule fois ! */
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
@@ -483,16 +484,17 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, gpointer unused)
wanted = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(iter->data), "kind_of_view"));
panel = get_current_view();
- station = get_dock_station_for_view_panel(panel);
+ station = get_dock_station_for_view_panel(GTK_WIDGET(panel));
- /* En vue du retrait de la station d'accueil... */
- scroll = get_scroll_window_for_view_panel(panel);
- g_object_ref(G_OBJECT(scroll));
+ content = g_loaded_panel_get_content(panel);
- new = get_alt_view_for_view_panel(panel, wanted);
- scroll = get_scroll_window_for_view_panel(new);
+ support = g_loaded_content_build_view(content, wanted);
- gtk_dock_panel_change_active_widget(station, scroll);
+ g_object_unref(G_OBJECT(content));
+
+ gtk_dock_panel_change_active_widget(station, support);
+
+ new = get_loaded_panel_from_built_view(support);
change_editor_items_current_view(G_LOADED_PANEL(new));
@@ -518,25 +520,25 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, gpointer unused)
static void mcb_view_display_column(GtkCheckMenuItem *menuitem, gpointer unused)
{
- BufferLineColumn col; /* Colonne à traiter */
- GLoadedBinary *binary; /* Binaire courant */
- GtkDisplayPanel *panel; /* Affichage courant */
- BinaryView view; /* Type de vue représentée */
+ unsigned int option; /* Paramètre à traiter */
gboolean active; /* Etat de sélection du menu */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
+ GLoadedContent *content; /* Contenu représenté */
+ unsigned int index; /* Indice de la vue courante */
- col = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(menuitem), "kind_of_col"));
+ option = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(menuitem), "kind_of_opt"));
- binary = get_current_binary();
+ active = gtk_check_menu_item_get_active(menuitem);
panel = get_current_view();
- view = gtk_display_panel_describe_content(panel);
- g_object_unref(G_OBJECT(panel));
+ content = g_loaded_panel_get_content(panel);
- active = gtk_check_menu_item_get_active(menuitem);
+ index = g_loaded_content_get_view_index(content, GTK_WIDGET(panel));
- g_loaded_binary_set_column_display(binary, view, col, active);
+ g_loaded_content_set_display_option(content, index, option, active);
- g_object_unref(G_OBJECT(binary));
+ g_object_unref(G_OBJECT(content));
+ g_object_unref(G_OBJECT(panel));
}