summaryrefslogtreecommitdiff
path: root/src/gui/menus
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-07-22 21:23:49 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-07-22 21:23:49 (GMT)
commit21537636cd8318cf5a720211619ad3c3023b52e9 (patch)
tree93380a9152f18e39cf0ba427ede96533c5c6f16a /src/gui/menus
parent361a0953c73635c6c383516280a8d634768f8226 (diff)
Fortified the client/server protocol and first exchanges.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@554 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gui/menus')
-rw-r--r--src/gui/menus/edition.c108
1 files changed, 107 insertions, 1 deletions
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index 040c8ab..d49f794 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -25,9 +25,13 @@
#include "edition.h"
+#include <assert.h>
+
+
#include <i18n.h>
+#include "../../analysis/db/items/switcher.h"
#include "../../arch/target.h"
#include "../../dialogs/bookmark.h"
#include "../../dialogs/goto.h"
@@ -40,6 +44,9 @@
/* Réagit avec le menu "Edition -> Aller à l'adresse...". */
static void mcb_edition_goto(GtkMenuItem *, GMenuBar *);
+/* Réagit avec le menu "Edition -> Operande numérique -> ...". */
+static void mcb_edition_switch_numeric_operand(GtkMenuItem *, GMenuBar *);
+
/* Réagit avec le menu "Edition -> Suivre la référence". */
static void mcb_edition_follow_ref(GtkMenuItem *, GMenuBar *);
@@ -87,6 +94,47 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+ submenuitem = qck_create_menu_item(NULL, NULL, _("Numeric operand"), NULL, NULL);
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
+ deepmenubar = gtk_menu_new();
+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(submenuitem), deepmenubar);
+
+ deepmenuitem = qck_create_menu_item(NULL, NULL, _("Hexadecimal"),
+ G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ add_accelerator_to_menu_item(deepmenuitem, "H", accgroup);
+ g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IST_HEXDECIMAL));
+ gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
+
+ deepmenuitem = qck_create_menu_item(NULL, NULL, _("Decimal"),
+ G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ add_accelerator_to_menu_item(deepmenuitem, "D", accgroup);
+ g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IST_DECIMAL));
+ gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
+
+ deepmenuitem = qck_create_menu_item(NULL, NULL, _("Octal"),
+ G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ add_accelerator_to_menu_item(deepmenuitem, "O", accgroup);
+ g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IST_OCTAL));
+ gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
+
+ deepmenuitem = qck_create_menu_item(NULL, NULL, _("Binary"),
+ G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ add_accelerator_to_menu_item(deepmenuitem, "B", accgroup);
+ g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IST_BINARY));
+ gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
+
+ deepmenuitem = qck_create_menu_separator();
+ gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
+
+ deepmenuitem = qck_create_menu_item(NULL, NULL, _("Default"),
+ G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IST_DEFAULT));
+ gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
+
+ submenuitem = qck_create_menu_separator();
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
submenuitem = qck_create_menu_item(ref, "mnu_edit_follow_ref", _("Follow the reference"),
G_CALLBACK(mcb_edition_follow_ref), bar);
add_accelerator_to_menu_item(submenuitem, "Return", accgroup);
@@ -111,7 +159,6 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
add_accelerator_to_menu_item(deepmenuitem, "<Ctrl>D", accgroup);
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
return result;
}
@@ -161,6 +208,65 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
* Paramètres : menuitem = élément de menu sélectionné. *
* bar = barre de menu parente. *
* *
+* Description : Réagit avec le menu "Edition -> Operande numérique -> ...". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, GMenuBar *bar)
+{
+ ImmSwitchType type; /* Type de basculement */
+ GtkViewPanel *vpanel; /* Afficheur effectif de code */
+ GBufferLine *line; /* Ligne de position courante */
+ GBufferSegment *segment; /* Segment actif s'il existe */
+ GObject *creator; /* Créateur à l'orgine du seg. */
+ virt_t virt; /* Adresse virtuelle */
+ vmpa2t addr; /* Adresse de destination */
+
+ type = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(menuitem), "kind_of_switch"));
+
+ vpanel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
+
+ if (gtk_view_panel_get_position(vpanel, &line, &segment))
+ {
+ if (segment != NULL)
+ creator = g_buffer_segment_get_creator(segment);
+ else
+ creator = NULL;
+
+ if (creator != NULL)
+ {
+ assert(G_IS_TARGET_OPERAND(creator));
+
+
+
+
+
+
+
+
+
+ g_object_unref(creator);
+
+ }
+
+ if (segment != NULL) g_object_unref(G_OBJECT(segment));
+ g_object_unref(G_OBJECT(line));
+
+ }
+
+}
+
+
+
+/******************************************************************************
+* *
+* Paramètres : menuitem = élément de menu sélectionné. *
+* bar = barre de menu parente. *
+* *
* Description : Réagit avec le menu "Edition -> Suivre la référence". *
* *
* Retour : - *