summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-11-03 09:50:40 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-11-03 09:50:40 (GMT)
commitd88ad56a86f0e538795d3b075833d3665457c1d8 (patch)
treee8f589e1760e451192232ce13641873c592a9c40 /src/gui
parentdf579a2d535ce83ec4eab9ac05924f8c2dd0ffac (diff)
Prepared the capacity to display more than one view per binary.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/menus/view.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index 43c1a69..780f8c0 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -32,7 +32,6 @@
#include "../core/panels.h"
#include "../../analysis/project.h"
#include "../../gtkext/easygtk.h"
-#include "../../gtkext/gtkdockstation.h"
@@ -99,7 +98,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
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);
+ add_accelerator_to_menu_item(submenuitem, "F3", accgroup);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_BLOCK));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -107,7 +106,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
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);
+ add_accelerator_to_menu_item(submenuitem, "F4", accgroup);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_GRAPH));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -115,7 +114,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
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);
+ add_accelerator_to_menu_item(submenuitem, "F5", accgroup);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_SOURCE));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -431,10 +430,9 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, GMenuBar *bar)
{
GSList *group; /* Liste de menus radio */
GSList *iter; /* Boucle de parcours */
- BinaryView view; /* Nouvelle vue à présenter */
+ BinaryView wanted; /* Nouvelle vue à présenter */
GtkViewPanel *vpanel; /* Afficheur effectif de code */
- GtkWidget *station; /* Base du remplacement */
- GLoadedBinary *binary; /* Edition courante */
+ GtkDockStation *station; /* Base du remplacement */
GtkWidget *scroll; /* Nouveau support à utiliser */
/* On ne traite qu'une seule fois ! */
@@ -446,26 +444,18 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, GMenuBar *bar)
{
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(iter->data))) continue;
- view = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(iter->data), "kind_of_view"));
-
- /**
- * La hiérarchie des composants empilés est la suivante :
- *
- * - GtkBlockView / GtkGraphView / GtkSourceView (avec GtkViewport intégré)
- * - GtkScrolledWindow
- * - GtkDockStation
- *
- */
+ wanted = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(iter->data), "kind_of_view"));
vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
- station = gtk_widget_get_parent(GTK_WIDGET(vpanel)); /* ScrollWindow */
- station = gtk_widget_get_parent(station); /* DockStation */
+ station = get_dock_station_for_view_panel(vpanel);
+
+ /* En vue du retrait de la station d'accueil... */
+ g_object_ref(G_OBJECT(vpanel));
- binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar));
- scroll = g_study_project_get_view_for_binary(get_current_project(),
- binary, view, &vpanel);
+ vpanel = get_alt_view_for_view_panel(vpanel, wanted);
+ scroll = get_scroll_window_for_view_panel(vpanel);
- gtk_dock_panel_change_active_widget(GTK_DOCK_STATION(station), scroll);
+ gtk_dock_panel_change_active_widget(station, scroll);
change_editor_items_current_view(G_EDITOR_ITEM(bar)->ref, vpanel);