summaryrefslogtreecommitdiff
path: root/src/gui/menus
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-01-23 01:05:58 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-01-23 01:05:58 (GMT)
commitd761eddfd4b5a27620aaa5e67a0e2e2bc5d55cb1 (patch)
treedc0d69813fef1b982c3a0fbdc25a00a6183b0852 /src/gui/menus
parentd487ea54850c85ea22df22af3b21b57d9ad0fd2f (diff)
Added menus to change the current displayed view. Do not try the source view.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@228 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gui/menus')
-rw-r--r--src/gui/menus/view.c81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index 85e65f7..273b41b 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -28,10 +28,16 @@
#include <i18n.h>
+#include "../editem-int.h"
+#include "../../project.h"
#include "../../gtkext/easygtk.h"
+#include "../../gtkext/gtkdockstation.h"
+/* 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 *);
@@ -59,6 +65,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
GtkWidget *result; /* Support à retourner */
GtkWidget *menubar; /* Support pour éléments */
GtkWidget *submenuitem; /* Sous-élément de menu */
+ GSList *rgroup; /* Groupe des boutons radio */
result = gtk_menu_item_new_with_mnemonic(_("_View"));
gtk_widget_show(result);
@@ -66,6 +73,28 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
menubar = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(result), menubar);
+ submenuitem = qck_create_radio_menu_item(ref, "textview", NULL, _("Text view"),
+ G_CALLBACK(mcb_view_change_support), bar);
+ add_accelerator_to_menu_item(submenuitem, "F2", accgroup);
+ g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_BLOCK));
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
+ rgroup = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(submenuitem));
+
+ submenuitem = qck_create_radio_menu_item(ref, "graphview", rgroup, _("Graph view"),
+ G_CALLBACK(mcb_view_change_support), bar);
+ add_accelerator_to_menu_item(submenuitem, "F3", accgroup);
+ g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_GRAPH));
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
+ rgroup = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(submenuitem));
+
+ submenuitem = qck_create_radio_menu_item(ref, "sourceview", rgroup, _("Source code"),
+ G_CALLBACK(mcb_view_change_support), bar);
+ add_accelerator_to_menu_item(submenuitem, "F4", accgroup);
+ g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_SOURCE));
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -134,6 +163,58 @@ void update_menu_view_for_view(GtkWidget *widget, GtkViewPanel *view, GMenuBar *
* Paramètres : menuitem = élément de menu ayant basculé. *
* bar = barre de menu parente. *
* *
+* Description : Réagit avec le menu "Affichage -> Vue xxx". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+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 */
+ GtkViewPanel *vpanel; /* Afficheur effectif de code */
+ GtkWidget *station; /* Base du remplacement */
+ GOpenidaBinary *binary; /* Edition courante */
+ GtkWidget *scroll; /* Nouveau support à utiliser */
+
+ /* On ne traite qu'une seule fois ! */
+ if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
+
+ group = gtk_radio_menu_item_get_group(menuitem);
+
+ for (iter = group; iter != NULL; iter = g_slist_next(iter))
+ {
+ 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"));
+
+ 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); /* NoteBook */
+ station = gtk_widget_get_parent(station); /* DockStation */
+
+ binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar));
+ scroll = get_view_for_openida_project_binary(get_current_openida_project(),
+ binary, view, &vpanel);
+
+ gtk_dock_panel_change_active_widget(GTK_DOCK_STATION(station), scroll);
+
+ change_editor_items_current_view(G_EDITOR_ITEM(bar)->ref, vpanel);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : menuitem = élément de menu ayant basculé. *
+* bar = barre de menu parente. *
+* *
* Description : Réagit avec le menu "Affichage -> Adresse virtuelle". *
* *
* Retour : - *