summaryrefslogtreecommitdiff
path: root/src/gui/tb
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/tb')
-rw-r--r--src/gui/tb/Makefile.am1
-rw-r--r--src/gui/tb/portions.c162
-rw-r--r--src/gui/tb/portions.h38
3 files changed, 201 insertions, 0 deletions
diff --git a/src/gui/tb/Makefile.am b/src/gui/tb/Makefile.am
index 65679cb..5cd46a8 100644
--- a/src/gui/tb/Makefile.am
+++ b/src/gui/tb/Makefile.am
@@ -2,6 +2,7 @@
noinst_LTLIBRARIES = libguitb.la
libguitb_la_SOURCES = \
+ portions.h portions.c \
source.h source.c \
toolbar.h toolbar.c
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);
+
+}
diff --git a/src/gui/tb/portions.h b/src/gui/tb/portions.h
new file mode 100644
index 0000000..a2a2041
--- /dev/null
+++ b/src/gui/tb/portions.h
@@ -0,0 +1,38 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * portions.h - prototypes pour la 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
+ */
+
+
+#ifndef _GUI_TB_PORTIONS_H
+#define _GUI_TB_PORTIONS_H
+
+
+#include "../editem.h"
+
+
+
+/* Crée une sélection de fichier réactive pour barre d'outils. */
+GEditorItem *create_portions_tb_item(GObject *ref);
+
+
+
+#endif /* _GUI_TB_PORTIONS_H */