summaryrefslogtreecommitdiff
path: root/src/gui/menus/view.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-12-26 23:52:44 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-12-26 23:52:44 (GMT)
commit2c28d59fb3671c0fdd1987784076d4968c58b651 (patch)
treea301f6cd9c1fd9f92191fba7fe7b59a7e3a01b5a /src/gui/menus/view.c
parent67b4887317b7394d63b543aa48cb368406374103 (diff)
Created the GLoadedContent interface to load all kinds of content.
Diffstat (limited to 'src/gui/menus/view.c')
-rw-r--r--src/gui/menus/view.c66
1 files changed, 34 insertions, 32 deletions
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));
}