summaryrefslogtreecommitdiff
path: root/src/gui/tb/portions.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2013-08-31 15:56:10 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2013-08-31 15:56:10 (GMT)
commited4bb73e5d68c1f81b8e0c3210aa221ec6f2675b (patch)
tree006a4641fc7a5c820d6a4253ff75e79ef01e368b /src/gui/tb/portions.c
parent4658d4fa406bad4abe36a76746412cf02c984af0 (diff)
Loaded a binary strip into the editor.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@358 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gui/tb/portions.c')
-rw-r--r--src/gui/tb/portions.c162
1 files changed, 162 insertions, 0 deletions
diff --git a/src/gui/tb/portions.c b/src/gui/tb/portions.c
new file mode 100644
index 0000000..c53a3ea
--- /dev/null
+++ b/src/gui/tb/portions.c
@@ -0,0 +1,162 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * portions.c - navigation dans les portions de binaire
+ *
+ * Copyright (C) 2013 Cyrille Bagard
+ *
+ * This file is part of OpenIDA.
+ *
+ * OpenIDA is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * OpenIDA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include "portions.h"
+
+
+#include <i18n.h>
+
+
+#include "toolbar.h"
+#include "../editem-int.h"
+#include "../../format/format.h"
+#include "../../gtkext/gtkbinarystrip.h"
+
+
+
+/* Construit l'élément GTK pour une barre d'outils. */
+static GtkWidget *build_portions_tb_widget(GObject *);
+
+/* Fait suivre un changement d'adresse dans la barre. */
+static void track_address_on_binary_strip(GtkBinaryStrip *, vmpa_t, GObject *);
+
+/* Réagit à un changement du binaire courant. */
+static void update_portions_item_binary(GEditorItem *, GLoadedBinary *);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = espace de référencement global. *
+* *
+* Description : Construit l'élément GTK pour une barre d'outils. *
+* *
+* Retour : Adresse du composant mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GtkWidget *build_portions_tb_widget(GObject *ref)
+{
+ GtkWidget *result; /* Composant à retourner */
+ GtkWidget *handlebox; /* Support relocalisable */
+ GtkWidget *strip; /* Bande pour binaire */
+
+ result = GTK_WIDGET(gtk_tool_item_new());
+ gtk_tool_item_set_expand(GTK_TOOL_ITEM(result), TRUE);
+ gtk_widget_show(result);
+
+ handlebox = gtk_handle_box_new();
+ gtk_widget_show(handlebox);
+ gtk_container_add(GTK_CONTAINER(result), handlebox);
+
+ strip = gtk_binary_strip_new();
+ gtk_widget_show(strip);
+ gtk_container_add(GTK_CONTAINER(handlebox), strip);
+
+ g_object_set_data(G_OBJECT(result), "strip", strip);
+
+ g_signal_connect(strip, "select-address",
+ G_CALLBACK(track_address_on_binary_strip),
+ ref);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : strip = composant d'affichage parcouru. *
+* addr = nouvelle adresse du curseur courant. *
+* ref = espace de référencement global. *
+* *
+* Description : Fait suivre un changement d'adresse dans la barre. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void track_address_on_binary_strip(GtkBinaryStrip *strip, vmpa_t addr, GObject *ref)
+{
+
+ printf("===> CHANGE TO 0x%08llx\n", addr);
+
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = espace de référencement global. *
+* *
+* Description : Crée une sélection de fichier réactive pour barre d'outils. *
+* *
+* Retour : Adresse de la structure d'encadrement mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GEditorItem *create_portions_tb_item(GObject *ref)
+{
+ GEditorItem *result; /* Structure à retourner */
+ GtkWidget *widget; /* Composant affiché à l'écran */
+
+ widget = build_portions_tb_widget(ref);
+
+ result = g_toolbar_item_new(ref, "portions", widget, _("Portions"));
+
+ result->update_binary = update_portions_item_binary;
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = élément réactif sollicité. *
+* binary = binaire chargé nouvellement affiché. *
+* *
+* Description : Réagit à un changement du binaire courant. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void update_portions_item_binary(GEditorItem *item, GLoadedBinary *binary)
+{
+ GtkBinaryStrip *strip; /* Bande pour binaire */
+
+ strip = GTK_BINARY_STRIP(g_object_get_data(G_OBJECT(item->widget), "strip"));
+
+ gtk_binary_strip_attach(strip, binary);
+
+}