summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-09-13 23:11:24 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-09-13 23:11:24 (GMT)
commit1c4da24a1d4b96d58fee08e2be21198b22e7eef6 (patch)
treea0723bd1948395413fa5a7a37a9405567e32c015
parent18134387d5cb025703af8e1d07e0152784e31efc (diff)
Improved the editor window refreshing when several binaries are loaded.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@114 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog69
-rw-r--r--configure.ac4
-rw-r--r--src/Makefile.am6
-rw-r--r--src/analysis/binary.c2
-rw-r--r--src/analysis/line.c1
-rw-r--r--src/debug/ptrace/ptrace.c2
-rw-r--r--src/editor.c129
-rw-r--r--src/format/elf/elf.c2
-rw-r--r--src/format/elf/symbols.c2
-rw-r--r--src/format/format.c2
-rw-r--r--src/gtkext/gtkbinview.c19
-rw-r--r--src/gtkext/gtkbinview.h3
-rw-r--r--src/gtkext/gtkdockitem.c23
-rw-r--r--src/gtkext/gtkdockitem.h4
-rw-r--r--src/gtkext/gtkdockpanel.c116
-rw-r--r--src/gtkext/gtkdockpanel.h9
-rw-r--r--src/main.c3
-rwxr-xr-xsrc/panels/Makefile.am22
-rw-r--r--src/panels/glimpse.c131
-rw-r--r--src/panels/glimpse.h60
-rw-r--r--src/panels/log.c220
-rw-r--r--src/panels/log.h56
-rw-r--r--src/panels/panel-int.h70
-rw-r--r--src/panels/panel.c257
-rw-r--r--src/panels/panel.h116
-rw-r--r--src/panels/registers.c236
-rw-r--r--src/panels/registers.h47
-rw-r--r--src/panels/strings.c150
-rw-r--r--src/panels/strings.h44
-rw-r--r--src/panels/symbols.c284
-rw-r--r--src/panels/symbols.h60
-rw-r--r--src/project.c30
32 files changed, 2103 insertions, 76 deletions
diff --git a/ChangeLog b/ChangeLog
index b9ced69..4dad565 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,72 @@
+09-09-14 Cyrille Bagard <nocbos@gmail.com>
+
+ * configure.ac:
+ Extend the list of GLib marshals and replace panel by panels in AC_CONFIG_FILES.
+
+ * src/analysis/binary.c:
+ Update the included headers.
+
+ * src/analysis/line.c:
+ Typo.
+
+ * src/debug/ptrace/ptrace.c:
+ Update the included headers.
+
+ * src/editor.c:
+ Improve the editor window when several binaries are loaded.
+
+ * src/format/elf/elf.c:
+ * src/format/elf/symbols.c:
+ * src/format/format.c:
+ Update the included headers.
+
+ * src/gtkext/gtkbinview.c:
+ * src/gtkext/gtkbinview.h:
+ Provide the registered binary.
+
+ * src/gtkext/gtkdockitem.c:
+ * src/gtkext/gtkdockitem.h:
+ Emit a signal when changing the content.
+
+ * src/gtkext/gtkdockpanel.c:
+ * src/gtkext/gtkdockpanel.h:
+ Emit a signal when switching. Take care of items changing their content.
+ Improve the code and fix bugs/mistakes.
+
+ * src/main.c:
+ Load all the internal panels using the new way.
+
+ * src/Makefile.am:
+ Rename panel(s)/panel(s).
+
+ * src/panels/glimpse.c:
+ * src/panels/glimpse.h:
+ New entries: quite empty for now.
+
+ * src/panels/log.c:
+ Update the included headers.
+
+ * src/panels/Makefile.am:
+ Change the name of the library. Add glimpse.[ch] and panel-int.h to
+ libpanels_la_SOURCES ; rename panels.[ch] to panel.[ch].
+
+ * src/panels/panel.c:
+ * src/panels/panel.h:
+ * src/panels/panel-int.h:
+ New entries: begin to move to a new way of panel managing using GLib
+ objects and functions to handle all panels.
+
+ * src/panels/panels.c:
+ * src/panels/panels.h:
+ Move entries: see src/panels/panel.[ch].
+
+ * src/panels/symbols.c:
+ * src/panels/symbols.h:
+ Update and improve the panel showing the current symbols.
+
+ * src/project.c:
+ Update the included headers. Do not update the editor anymore (see
+
09-09-09 Cyrille Bagard <nocbos@gmail.com>
* src/analysis/line.c:
diff --git a/configure.ac b/configure.ac
index 1050be1..dc2f498 100644
--- a/configure.ac
+++ b/configure.ac
@@ -227,7 +227,7 @@ AC_SUBST(LIBGRAPH_LIBS)
AC_CONFIG_FILES([stamp-h po/Makefile.in], [echo timestamp > stamp-h])
-AC_CONFIG_COMMANDS([marshal], [echo -e "VOID:UINT64,UINT64\nVOID:OBJECT,OBJECT" > src/gtkext/iodamarshal.list])
+AC_CONFIG_COMMANDS([marshal], [echo -e "VOID:UINT64,UINT64\nVOID:OBJECT\nVOID:OBJECT,OBJECT" > src/gtkext/iodamarshal.list])
AC_CONFIG_FILES([Makefile
pixmaps/Makefile
@@ -252,7 +252,7 @@ AC_CONFIG_FILES([Makefile
src/glibext/Makefile
src/graph/Makefile
src/gtkext/Makefile
- src/panel/Makefile
+ src/panels/Makefile
src/plugins/Makefile
src/plugins/overjump/Makefile
src/plugins/pyoida/Makefile])
diff --git a/src/Makefile.am b/src/Makefile.am
index 737609f..ea03c36 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,7 +52,7 @@ liboidagui_la_LDFLAGS = $(LIBGTK_LIBS) \
-L.libs -loidagtkext
liboidagui_la_LIBADD = \
- panel/libpanel.la
+ panels/libpanels.la
#--- liboidaplugin
@@ -93,7 +93,7 @@ AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
openida_LDFLAGS = $(LIBGTK_LIBS) -L/usr/X11R6/lib -ldl -lm $(LIBXML_LIBS) `pkg-config --libs gthread-2.0` $(LIBPYTHON_LIBS) $(LIBVTE_LIBS) \
-L.libs -loidadisass -loidagtkext \
-Lcommon/.libs -lcommon \
- -Lpanel/.libs -lpanel \
+ -Lpanels/.libs -lpanels \
-Lplugins/.libs -lplugins
@@ -110,4 +110,4 @@ openida_LDADD = $(LIBINTL) \
# gtkext doit être traité en premier, à cause des marshals GLib
-SUBDIRS = glibext gtkext analysis arch format common debug graph panel plugins
+SUBDIRS = glibext gtkext analysis arch format common debug graph panels plugins
diff --git a/src/analysis/binary.c b/src/analysis/binary.c
index 8cec72a..4e63cbe 100644
--- a/src/analysis/binary.c
+++ b/src/analysis/binary.c
@@ -43,7 +43,7 @@
#include "../common/extstr.h"
#include "../glibext/delayed.h"
#include "../format/format.h"
-#include "../panel/log.h"
+#include "../panels/log.h"
#include "../plugins/pglist.h"
diff --git a/src/analysis/line.c b/src/analysis/line.c
index cdef634..a810b1f 100644
--- a/src/analysis/line.c
+++ b/src/analysis/line.c
@@ -105,7 +105,6 @@ static void g_rendering_line_init(GRenderingLine *line)
{
DL_LIST_ITEM_INIT(&line->link);
-
}
diff --git a/src/debug/ptrace/ptrace.c b/src/debug/ptrace/ptrace.c
index a5c065e..7b1ebbc 100644
--- a/src/debug/ptrace/ptrace.c
+++ b/src/debug/ptrace/ptrace.c
@@ -32,7 +32,7 @@
#include "options.h"
#include "../debugger-int.h"
-#include "../../panel/log.h"
+#include "../../panels/log.h"
diff --git a/src/editor.c b/src/editor.c
index c026426..942e6f4 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -45,10 +45,11 @@
#include "gtkext/easygtk.h"
#include "gtkext/gtkextstatusbar.h"
#include "gtkext/gtkbinview.h"
+#include "gtkext/gtkblockview.h"
#include "gtkext/gtkdockpanel.h"
#include "debug/debuggers.h"
-#include "panel/panels.h"
+#include "panels/panel.h"
@@ -135,11 +136,11 @@ void update_debug_menu_items(GObject *, gboolean);
+/* Réagit au changement d'onglet d'un panneau quelconque. */
+static void on_dock_item_switch(GtkDockPanel *, GtkDockItem *, GObject *);
-
-
-
-
+/* Met en concordance les menus avec l'édition courante. */
+static void refresh_editor_menus(GObject *, GOpenidaBinary *, GtkBinView *);
@@ -267,13 +268,13 @@ GtkWidget *create_editor(void)
menubar = gtk_menu_new();
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), menubar);
- submenuitem = qck_create_radio_menu_item(NULL, NULL, NULL, _("Text view"), G_CALLBACK(mcb_view_change_support), result);
+ submenuitem = qck_create_radio_menu_item(ref, "textview", NULL, _("Text view"), G_CALLBACK(mcb_view_change_support), result);
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(NULL, NULL, rgroup, _("Graph view"), G_CALLBACK(mcb_view_change_support), result);
+ submenuitem = qck_create_radio_menu_item(ref, "graphview", rgroup, _("Graph view"), G_CALLBACK(mcb_view_change_support), result);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_GRAPH));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -383,6 +384,12 @@ GtkWidget *create_editor(void)
g_object_set_data(G_OBJECT(result), "binpanel", dpanel);
gtk_widget_show(dpanel);
+
+
+ g_signal_connect(dpanel, "switch-item", G_CALLBACK(on_dock_item_switch), ref);
+
+
+
gtk_paned_pack1(GTK_PANED(hpaned1), dpanel, TRUE, TRUE);
#if 0
@@ -440,11 +447,13 @@ GtkWidget *create_editor(void)
dpanel = gtk_dock_panel_new();
gtk_widget_show(dpanel);
+ g_signal_connect(dpanel, "switch-item", G_CALLBACK(on_dock_item_switch), ref);
+
gtk_paned_pack2(GTK_PANED(hpaned1), dpanel, TRUE, TRUE);
- ditem = gtk_dock_item_new(_("Symbols"), get_panel(PNT_SYMBOLS));
- gtk_dock_panel_add_item(dpanel, ditem);
+ place_all_panels_in_editor(dpanel);
+
ditem = gtk_dock_item_new(_("Registers"), get_panel(PNT_REGISTERS));
gtk_dock_panel_add_item(dpanel, ditem);
@@ -452,8 +461,6 @@ GtkWidget *create_editor(void)
-
-
/* Panneau inférieur */
@@ -785,7 +792,9 @@ void mcb_view_change_support(GtkRadioMenuItem *menuitem, GObject *ref)
title = g_openida_binary_to_string(binary);
ditem = gtk_dock_panel_item_from_name(dpanel, strrchr(title, '/') + 1);
- gtk_dock_panel_replace_item_content(dpanel, ditem, panel);
+ gtk_dock_item_set_panel(ditem, panel);
+
+ notify_panels_of_view_change(binview, true);
}
@@ -1223,3 +1232,99 @@ void update_debug_menu_items(GObject *ref, gboolean stopped)
gtk_widget_set_sensitive(submenuitem, stopped);
}
+
+
+
+
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = panneau de support des éléments concerné. *
+* item = nouvel élément présenté à l'affichage. *
+* ref = adresse de l'espace de référencement global. *
+* *
+* Description : Réagit au changement d'onglet d'un panneau quelconque. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void on_dock_item_switch(GtkDockPanel *panel, GtkDockItem *item, GObject *ref)
+{
+ GtkWidget *widget; /* Support réel à traiter */
+ GOpenidaBinary *binary; /* Binaire en cours d'édition */
+
+ widget = gtk_dock_item_get_panel(item);
+
+ if (GTK_IS_SCROLLED_WINDOW(widget))
+ widget = gtk_bin_get_child(GTK_BIN(widget));
+
+ if (GTK_IS_VIEWPORT(widget))
+ widget = gtk_bin_get_child(GTK_BIN(widget));
+
+ if (GTK_IS_BIN_VIEW(widget))
+ {
+ binary = gtk_bin_view_get_binary(GTK_BIN_VIEW(widget));
+
+ g_object_set_data(ref, "current_binary", binary);
+ g_object_set_data(ref, "binview", widget);
+
+ refresh_editor_menus(ref, binary, GTK_BIN_VIEW(widget));
+
+ notify_panels_of_view_change(GTK_BIN_VIEW(widget), false);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = adresse de l'espace de référencement global. *
+* binary = représentation de contenu binaire active. *
+* view = type de visualisation courante. *
+* *
+* Description : Met en concordance les menus avec l'édition courante. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void refresh_editor_menus(GObject *ref, GOpenidaBinary *binary, GtkBinView *view)
+{
+ GtkCheckMenuItem *menuitem; /* Menu à coche à traiter */
+
+ /* Affichage : type de vue */
+
+ menuitem = GTK_CHECK_MENU_ITEM(g_object_get_data(ref, "textview"));
+ g_signal_handlers_disconnect_by_func(menuitem, G_CALLBACK(mcb_view_change_support), ref);
+
+ menuitem = GTK_CHECK_MENU_ITEM(g_object_get_data(ref, "graphview"));
+ g_signal_handlers_disconnect_by_func(menuitem, G_CALLBACK(mcb_view_change_support), ref);
+
+ if (GTK_IS_BLOCK_VIEW(view))
+ {
+ menuitem = GTK_CHECK_MENU_ITEM(g_object_get_data(ref, "textview"));
+ gtk_check_menu_item_set_active(menuitem, TRUE);
+ }
+ else
+ {
+ menuitem = GTK_CHECK_MENU_ITEM(g_object_get_data(ref, "graphview"));
+ gtk_check_menu_item_set_active(menuitem, TRUE);
+ }
+
+ menuitem = GTK_CHECK_MENU_ITEM(g_object_get_data(ref, "textview"));
+ g_signal_connect(menuitem, "toggled", G_CALLBACK(mcb_view_change_support), ref);
+
+ menuitem = GTK_CHECK_MENU_ITEM(g_object_get_data(ref, "graphview"));
+ g_signal_connect(menuitem, "toggled", G_CALLBACK(mcb_view_change_support), ref);
+
+}
diff --git a/src/format/elf/elf.c b/src/format/elf/elf.c
index d24a89e..e2bf37a 100644
--- a/src/format/elf/elf.c
+++ b/src/format/elf/elf.c
@@ -32,7 +32,7 @@
#include "section.h"
#include "strings.h"
#include "symbols.h"
-#include "../../panel/log.h"
+#include "../../panels/log.h"
diff --git a/src/format/elf/symbols.c b/src/format/elf/symbols.c
index 97b6ff2..5dd45dc 100644
--- a/src/format/elf/symbols.c
+++ b/src/format/elf/symbols.c
@@ -31,7 +31,7 @@
#include "elf-int.h"
#include "helper_x86.h"
#include "section.h"
-#include "../../panel/log.h"
+#include "../../panels/log.h"
diff --git a/src/format/format.c b/src/format/format.c
index 912cdd7..0ffbfe0 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -30,7 +30,7 @@
#include "format-int.h"
#include "dwarf/dwarf.h"
#include "elf/elf.h"
-#include "../panel/log.h"
+#include "../panels/log.h"
diff --git a/src/gtkext/gtkbinview.c b/src/gtkext/gtkbinview.c
index f049470..696799b 100644
--- a/src/gtkext/gtkbinview.c
+++ b/src/gtkext/gtkbinview.c
@@ -251,6 +251,25 @@ void gtk_bin_view_set_rendering_lines(GtkBinView *view, GOpenidaBinary *binary,
* *
* Paramètres : view = composant GTK à consulter. *
* *
+* Description : Fournit le binaire associé à la représentation. *
+* *
+* Retour : Représentation de contenu binaire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GOpenidaBinary *gtk_bin_view_get_binary(const GtkBinView *view)
+{
+ return view->binary;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : view = composant GTK à consulter. *
+* *
* Description : Fournit la liste des lignes associées à la représentation. *
* *
* Retour : Ligne de représentation. *
diff --git a/src/gtkext/gtkbinview.h b/src/gtkext/gtkbinview.h
index 945eefb..2dae0eb 100644
--- a/src/gtkext/gtkbinview.h
+++ b/src/gtkext/gtkbinview.h
@@ -59,6 +59,9 @@ void gtk_bin_view_show_border(GtkBinView *, bool);
/* Définit les lignes à associer à la représentation. */
void gtk_bin_view_set_rendering_lines(GtkBinView *, GOpenidaBinary *, GRenderingLine *, GRenderingLine *);
+/* Fournit le binaire associé à la représentation. */
+GOpenidaBinary *gtk_bin_view_get_binary(const GtkBinView *);
+
/* Fournit la liste des lignes associées à la représentation. */
GRenderingLine *gtk_bin_view_get_lines(const GtkBinView *);
diff --git a/src/gtkext/gtkdockitem.c b/src/gtkext/gtkdockitem.c
index fcef31d..89d606c 100644
--- a/src/gtkext/gtkdockitem.c
+++ b/src/gtkext/gtkdockitem.c
@@ -24,13 +24,15 @@
#include "gtkdockitem.h"
+#include "iodamarshal.h"
+
+
/* Détermine le type d'un panneau dockable. */
G_DEFINE_TYPE(GtkDockItem, gtk_dock_item, GTK_TYPE_OBJECT)
-
/******************************************************************************
* *
* Paramètres : class = classe GTK à initialiser. *
@@ -45,7 +47,13 @@ G_DEFINE_TYPE(GtkDockItem, gtk_dock_item, GTK_TYPE_OBJECT)
static void gtk_dock_item_class_init(GtkDockItemClass *class)
{
-
+ g_signal_new("content-changed",
+ GTK_TYPE_DOCK_ITEM,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(GtkDockItemClass, content_changed),
+ NULL, NULL,
+ g_cclosure_user_marshal_VOID__OBJECT_OBJECT,
+ G_TYPE_NONE, 2, GTK_TYPE_WIDGET, GTK_TYPE_WIDGET);
}
@@ -204,12 +212,19 @@ const gchar *gtk_dock_item_get_desc(GtkDockItem *ditem)
void gtk_dock_item_set_panel(GtkDockItem *ditem, GtkWidget *panel)
{
- if (ditem->panel != NULL)
- gtk_widget_unref(ditem->panel);
+ GtkWidget *old; /* Ancien panneau remplacé */
+
+ old = ditem->panel;
ditem->panel = panel;
gtk_widget_ref(panel);
+ if (old != NULL)
+ {
+ g_signal_emit_by_name(ditem, "content-changed", old, panel);
+ gtk_widget_unref(old);
+ }
+
}
diff --git a/src/gtkext/gtkdockitem.h b/src/gtkext/gtkdockitem.h
index 906973c..851d8de 100644
--- a/src/gtkext/gtkdockitem.h
+++ b/src/gtkext/gtkdockitem.h
@@ -58,6 +58,10 @@ struct _GtkDockItemClass
{
GtkVBoxClass parent_class; /* Présence obligatoire en 1er */
+ /* Signaux */
+
+ void (* content_changed) (GtkDockItem *, GtkWidget *, GtkWidget *);
+
};
diff --git a/src/gtkext/gtkdockpanel.c b/src/gtkext/gtkdockpanel.c
index 536d21b..1d9548f 100644
--- a/src/gtkext/gtkdockpanel.c
+++ b/src/gtkext/gtkdockpanel.c
@@ -29,6 +29,7 @@
#include "gtkdropwindow.h"
+#include "iodamarshal.h"
@@ -54,7 +55,16 @@ static void gtk_dock_panel_drag_data_get_cb(GtkDockPanel *, GdkDragContext *, Gt
static void gtk_dock_panel_drag_end_cb(GtkDockPanel *, GdkDragContext *, gpointer);
/* Nettoie les traces d'un "Drag and drop". */
-static void gtk_dock_panel_drag_data_delete_cb(GtkDockPanel *, GdkDragContext *, gpointer);
+//static void gtk_dock_panel_drag_data_delete_cb(GtkDockPanel *, GdkDragContext *, gpointer);
+
+/* Ajoute un paquet d'informations à la station dockable. */
+static void _gtk_dock_panel_add_item(GtkDockPanel *, GtkDockItem *, gint);
+
+/* Remplace le panneau d'un membre actuellement affiché. */
+static void on_dock_item_content_changed(GtkDockItem *, GtkWidget *, GtkWidget *, GtkDockPanel *);
+
+/* Supprime un paquet d'informations à la station dockable. */
+static void _gtk_dock_panel_remove_item(GtkDockPanel *, GtkDockItem *, GtkWidget *);
/* Met à jour le titre du support de panneaux dockables. */
static gboolean gtk_dock_panel_update_title(GtkNotebook *, GtkNotebookPage *, guint, gpointer);
@@ -114,7 +124,13 @@ G_DEFINE_TYPE(GtkDockPanel, gtk_dock_panel, GTK_TYPE_VBOX)
static void gtk_dock_panel_class_init(GtkDockPanelClass *class)
{
-
+ g_signal_new("switch-item",
+ GTK_TYPE_DOCK_PANEL,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(GtkDockPanelClass, switch_item),
+ NULL, NULL,
+ g_cclosure_user_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1, GTK_TYPE_DOCK_ITEM);
}
@@ -231,7 +247,6 @@ static void gtk_dock_panel_init(GtkDockPanel *dpanel)
dpanel->dropwin = gtk_drop_window_new();
-
/* Make the "well label" a DnD destination. */
gtk_drag_dest_set
(
@@ -562,31 +577,51 @@ GtkDockItem *gtk_dock_panel_item_from_name(GtkDockPanel *dpanel, const char *nam
void gtk_dock_panel_add_item(GtkDockPanel *dpanel, GtkDockItem *ditem)
{
+ _gtk_dock_panel_add_item(dpanel, ditem, -1);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant GTK à compléter. *
+* ditem = nouvel élément à intégrer. *
+* position = point d'insertion (-1 pour la fin). *
+* *
+* Description : Ajoute un paquet d'informations à la station dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void _gtk_dock_panel_add_item(GtkDockPanel *dpanel, GtkDockItem *ditem, gint position)
+{
GtkWidget *label; /* Etiquette d'onglet */
- dpanel->ditems = g_list_append(dpanel->ditems, ditem);
+ dpanel->ditems = g_list_insert(dpanel->ditems, ditem, position);
printf("[add %p to %p] list len :: %u\n", ditem, dpanel, g_list_length(dpanel->ditems));
- gtk_container_add(GTK_CONTAINER(dpanel->notebook), gtk_dock_item_get_panel(ditem));
-
label = gtk_label_new(gtk_dock_item_get_name(ditem));
gtk_widget_show(label);
- gtk_notebook_set_tab_label(dpanel->notebook,
- gtk_notebook_get_nth_page(dpanel->notebook, gtk_notebook_get_n_pages(dpanel->notebook) - 1),
- label);
+ gtk_notebook_insert_page(dpanel->notebook, gtk_dock_item_get_panel(ditem), label, position);
gtk_notebook_set_show_tabs(dpanel->notebook, g_list_length(dpanel->ditems) > 1);
+ g_signal_connect(ditem, "content-changed", G_CALLBACK(on_dock_item_content_changed), dpanel);
+
}
/******************************************************************************
* *
-* Paramètres : dpanel = composant GTK à mettre à jour. *
-* ditem = nouvel élément à sortir. *
-* panel = nouveau panneau à présenter. *
+* Paramètres : ditem = composant GTK déjà mis à jour. *
+* old = ancien panneau retiré. *
+* new = nouveau panneau présenté. *
+* dpanel = composant GTK à mettre à jour. *
* *
* Description : Remplace le panneau d'un membre actuellement affiché. *
* *
@@ -596,14 +631,21 @@ void gtk_dock_panel_add_item(GtkDockPanel *dpanel, GtkDockItem *ditem)
* *
******************************************************************************/
-void gtk_dock_panel_replace_item_content(GtkDockPanel *dpanel, GtkDockItem *ditem, GtkWidget *panel)
+static void on_dock_item_content_changed(GtkDockItem *ditem, GtkWidget *old, GtkWidget *new, GtkDockPanel *dpanel)
{
- gtk_widget_ref(gtk_dock_item_get_panel(ditem));
- gtk_container_remove(GTK_CONTAINER(dpanel->notebook), gtk_dock_item_get_panel(ditem));
+ gint position; /* Position de l'onglet à maj */
+
+ position = gtk_notebook_page_num(dpanel->notebook, old);
+
+ g_signal_handlers_disconnect_by_func(dpanel->notebook, G_CALLBACK(gtk_dock_panel_update_title), dpanel);
- gtk_dock_item_set_panel(ditem, panel);
+ _gtk_dock_panel_remove_item(dpanel, ditem, old);
+ _gtk_dock_panel_add_item(dpanel, ditem, position);
+
+ gtk_notebook_set_current_page(dpanel->notebook, position);
+
+ g_signal_connect(dpanel->notebook, "switch-page", G_CALLBACK(gtk_dock_panel_update_title), dpanel);
- gtk_container_add(GTK_CONTAINER(dpanel->notebook), gtk_dock_item_get_panel(ditem));
}
@@ -625,6 +667,8 @@ void gtk_dock_panel_remove_item(GtkDockPanel *dpanel, GtkDockItem *ditem)
{
gint pos; /* Position de l'élément visé */
+ g_signal_handlers_disconnect_by_func(ditem, G_CALLBACK(on_dock_item_content_changed), dpanel);
+
pos = g_list_index(dpanel->ditems, ditem);
dpanel->ditems = g_list_remove(dpanel->ditems, ditem);
@@ -643,6 +687,42 @@ void gtk_dock_panel_remove_item(GtkDockPanel *dpanel, GtkDockItem *ditem)
/******************************************************************************
* *
+* Paramètres : dpanel = composant GTK à mettre à jour. *
+* ditem = nouvel élément à sortir. *
+* panel = panneau GTK de l'élément à supprimer. *
+* *
+* Description : Supprime un paquet d'informations à la station dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void _gtk_dock_panel_remove_item(GtkDockPanel *dpanel, GtkDockItem *ditem, GtkWidget *panel)
+{
+ gint pos; /* Position de l'élément visé */
+
+ g_signal_handlers_disconnect_by_func(ditem, G_CALLBACK(on_dock_item_content_changed), dpanel);
+
+ pos = g_list_index(dpanel->ditems, ditem);
+
+ dpanel->ditems = g_list_remove(dpanel->ditems, ditem);
+
+ printf("[rem %p from %p] list len :: %u\n", ditem, dpanel, g_list_length(dpanel->ditems));
+
+ gtk_widget_ref(panel);
+ gtk_container_remove(GTK_CONTAINER(dpanel->notebook), panel);
+
+ //gtk_notebook_remove_page(dpanel->notebook, pos);
+
+ gtk_notebook_set_show_tabs(dpanel->notebook, g_list_length(dpanel->ditems) > 1);
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : notebook = support à l'origine de la mise à jour. *
* page = onglet mis en avant. *
* index = indice de l'onglet actuellement actif. *
@@ -685,6 +765,8 @@ static gboolean gtk_dock_panel_update_title(GtkNotebook *notebook, GtkNotebookPa
free(str);
+ g_signal_emit_by_name(GTK_DOCK_PANEL(data), "switch-item", ditem);
+
return TRUE;
}
diff --git a/src/gtkext/gtkdockpanel.h b/src/gtkext/gtkdockpanel.h
index 037ee26..2c0cda9 100644
--- a/src/gtkext/gtkdockpanel.h
+++ b/src/gtkext/gtkdockpanel.h
@@ -46,6 +46,8 @@ typedef struct _GtkDockPanel GtkDockPanel;
typedef struct _GtkDockPanelClass GtkDockPanelClass;
+#include <stdbool.h>
+
struct _GtkDockPanel
{
@@ -64,6 +66,10 @@ struct _GtkDockPanelClass
{
GtkVBoxClass parent_class; /* Présence obligatoire en 1er */
+ /* Signaux */
+
+ void (* switch_item) (GtkDockPanel *, GtkDockItem *);
+
};
@@ -79,9 +85,6 @@ GtkDockItem *gtk_dock_panel_item_from_name(GtkDockPanel *, const char *);
/* Ajoute un paquet d'informations à la station dockable. */
void gtk_dock_panel_add_item(GtkDockPanel *, GtkDockItem *);
-/* Remplace le panneau d'un membre actuellement affiché. */
-void gtk_dock_panel_replace_item_content(GtkDockPanel *, GtkDockItem *, GtkWidget *);
-
/* Supprime un paquet d'informations à la station dockable. */
void gtk_dock_panel_remove_item(GtkDockPanel *, GtkDockItem *);
diff --git a/src/main.c b/src/main.c
index a4424cd..41ea7ce 100644
--- a/src/main.c
+++ b/src/main.c
@@ -106,6 +106,9 @@ int main(int argc, char **argv)
_get_gtk_tag_table(gtk_text_tag_table_new());
/* Création de l'interface */
+
+ init_internal_panels();
+
editor = create_editor();
gtk_widget_show(editor);
diff --git a/src/panels/Makefile.am b/src/panels/Makefile.am
new file mode 100755
index 0000000..2ab4bad
--- /dev/null
+++ b/src/panels/Makefile.am
@@ -0,0 +1,22 @@
+
+noinst_LTLIBRARIES = libpanels.la
+
+libpanels_la_SOURCES = \
+ glimpse.h glimpse.c \
+ log.h log.c \
+ panel-int.h \
+ panel.h panel.c \
+ registers.h registers.c \
+ strings.h strings.c \
+ symbols.h symbols.c
+
+libpanels_la_LDFLAGS =
+
+
+INCLUDES = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS)
+
+AM_CPPFLAGS =
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS) $(COMPLIANCE_FLAGS)
+
+SUBDIRS =
diff --git a/src/panels/glimpse.c b/src/panels/glimpse.c
new file mode 100644
index 0000000..c284238
--- /dev/null
+++ b/src/panels/glimpse.c
@@ -0,0 +1,131 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * glimpse.c - panneau d'aperçu de graphiques
+ *
+ * Copyright (C) 2009 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 "glimpse.h"
+
+
+#include "panel-int.h"
+
+
+
+
+#define _(str) str
+
+
+
+
+/* Panneau d'aperçu de graphiques (instance) */
+struct _GGlimpsePanel
+{
+ GEditorPanel parent; /* A laisser en premier */
+
+};
+
+
+
+/* Panneau d'aperçu de graphiques (classe) */
+struct _GGlimpsePanelClass
+{
+ GEditorPanelClass parent; /* A laisser en premier */
+
+};
+
+
+
+/* Initialise la classe des panneaux d'aperçu de graphiques. */
+static void g_glimpse_panel_class_init(GGlimpsePanelClass *);
+
+/* Initialise une instance de panneau d'aperçu de graphiques. */
+static void g_glimpse_panel_init(GGlimpsePanel *);
+
+
+
+
+/* Indique le type définit pour un panneau d'aperçu de graphiques. */
+G_DEFINE_TYPE(GGlimpsePanel, g_glimpse_panel, G_TYPE_EDITOR_PANEL);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des panneaux d'aperçu de graphiques. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_glimpse_panel_class_init(GGlimpsePanelClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = instance à initialiser. *
+* *
+* Description : Initialise une instance de panneau d'aperçu de graphiques. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_glimpse_panel_init(GGlimpsePanel *panel)
+{
+ GEditorPanel *base; /* Version basique d'instance */
+
+ base = G_EDITOR_PANEL(panel);
+
+ base->name = _("Glimpse");
+ base->widget = qck_create_button(NULL, NULL, "test", NULL, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un panneau d'aperçu de graphiques. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GEditorPanel *g_glimpse_panel_new(void)
+{
+ GEditorPanel *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_GLIMPSE_PANEL, NULL);
+
+ return G_EDITOR_PANEL(result);
+
+}
diff --git a/src/panels/glimpse.h b/src/panels/glimpse.h
new file mode 100644
index 0000000..5370569
--- /dev/null
+++ b/src/panels/glimpse.h
@@ -0,0 +1,60 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * glimpse.h - prototypes pour le panneau d'aperçu de graphiques
+ *
+ * Copyright (C) 2009 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 _PANEL_GLIMPSE_H
+#define _PANEL_GLIMPSE_H
+
+
+#include <glib-object.h>
+
+
+#include "panel.h"
+
+
+
+#define G_TYPE_GLIMPSE_PANEL g_glimpse_panel_get_type()
+#define G_GLIMPSE_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_glimpse_panel_get_type(), GGlimpsePanel))
+#define G_IS_GLIMPSE_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_glimpse_panel_get_type()))
+#define G_GLIMPSE_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_GLIMPSE_PANEL, GGlimpsePanelClass))
+#define G_IS_GLIMPSE_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_GLIMPSE_PANEL))
+#define G_GLIMPSE_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_GLIMPSE_PANEL, GGlimpsePanelClass))
+
+
+/* Panneau d'aperçu de graphiques (instance) */
+typedef struct _GGlimpsePanel GGlimpsePanel;
+
+/* Panneau d'aperçu de graphiques (classe) */
+typedef struct _GGlimpsePanelClass GGlimpsePanelClass;
+
+
+
+/* Indique le type définit pour un panneau d'aperçu de graphiques. */
+GType g_glimpse_panel_get_type(void);
+
+/* Crée un panneau d'aperçu de graphiques. */
+GEditorPanel *g_glimpse_panel_new(void);
+
+
+
+#endif /* _PANEL_GLIMPSE_H */
diff --git a/src/panels/log.c b/src/panels/log.c
new file mode 100644
index 0000000..b13119a
--- /dev/null
+++ b/src/panels/log.c
@@ -0,0 +1,220 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * log.c - panneau d'affichage des messages système
+ *
+ * Copyright (C) 2006-2007 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 "log.h"
+
+
+#include <malloc.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+
+#include "panel.h"
+
+
+
+/* Colonnes de la liste des messages */
+typedef enum _LogColumn
+{
+ LGC_PICTURE, /* Image de représentation */
+ LGC_STRING, /* Chaîne de caractères */
+
+ LGC_COUNT /* Nombre de colonnes */
+
+} LogColumn;
+
+
+#define _(str) str
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit le panneau d'affichage des messages système. *
+* *
+* Retour : Adresse du panneau mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *build_log_panel(void)
+{
+ GtkWidget *result; /* Panneau à retourner */
+ GtkTreeStore *store; /* Modèle de gestion */
+ GtkWidget *treeview; /* Affichage de la liste */
+ GtkCellRenderer *renderer; /* Moteur de rendu de colonne */
+ GtkTreeViewColumn *column; /* Colonne de la liste */
+
+ result = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(result);
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN);
+
+ store = gtk_tree_store_new(LGC_COUNT, G_TYPE_STRING, G_TYPE_STRING);
+ g_object_set_data(G_OBJECT(result), "store", store);
+
+ treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
+ gtk_widget_show(treeview);
+ gtk_container_add(GTK_CONTAINER(result), treeview);
+
+ g_object_unref(G_OBJECT(store));
+
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_visible(column, FALSE);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+ gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column);
+
+ column = gtk_tree_view_column_new();
+
+ renderer = gtk_cell_renderer_pixbuf_new();
+ gtk_tree_view_column_pack_start(column, renderer, FALSE);
+ gtk_tree_view_column_add_attribute(column, renderer, "stock-id", LGC_PICTURE);
+
+ renderer = gtk_cell_renderer_text_new();
+ gtk_tree_view_column_pack_start(column, renderer, TRUE);
+ gtk_tree_view_column_add_attribute(column, renderer, "text", LGC_STRING);
+
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = espèce du message à ajouter. *
+* msg = message à faire apparaître à l'écran. *
+* *
+* Description : Affiche un message dans le journal des messages système. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void log_simple_message(LogMessageType type, const char *msg)
+{
+ GtkWidget *panel; /* Panneau à traiter */
+ GtkTreeStore *store; /* Modèle de gestion */
+ GtkTreeIter iter; /* Point d'insertion */
+
+ panel = get_panel(PNT_LOG);
+ store = g_object_get_data(G_OBJECT(panel), "store");
+
+ gtk_tree_store_append(store, &iter, NULL);
+
+ switch (type)
+ {
+ case LMT_INFO:
+ gtk_tree_store_set(store, &iter,
+ LGC_PICTURE, "gtk-info",
+ LGC_STRING, msg,
+ -1);
+ break;
+
+ case LMT_BAD_BINARY:
+ gtk_tree_store_set(store, &iter,
+ LGC_PICTURE, "gtk-dialog-warning",
+ LGC_STRING, msg,
+ -1);
+ break;
+
+ case LMT_PROCESS:
+ gtk_tree_store_set(store, &iter,
+ LGC_PICTURE, "gtk-execute",
+ LGC_STRING, msg,
+ -1);
+ break;
+
+ default:
+ gtk_tree_store_set(store, &iter,
+ LGC_STRING, msg,
+ -1);
+ break;
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : type = espèce du message à ajouter. *
+* fmt = format du message à faire apparaître à l'écran. *
+* ... = éventuels arguments venant compléter le message. *
+* *
+* Description : Affiche un message dans le journal des messages système. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void log_variadic_message(LogMessageType type, const char *fmt, ...)
+{
+ size_t len; /* Taille tampon disponible */
+ char *buffer; /* Tampon du msg reconstitué */
+ int ret; /* Bilan d'une impression */
+ char *ptr; /* Nouvelle allocation */
+ va_list ap; /* Liste d'arguments variable */
+
+ len = 100;
+ buffer = calloc(len, sizeof(char));
+
+ while (buffer != NULL)
+ {
+ va_start(ap, fmt);
+ ret = vsnprintf(buffer, len, fmt, ap);
+ va_end(ap);
+
+ if (ret >= 0 && ret < len) break;
+
+ else
+ {
+ if (ret > -1) len += 1; /* glibc 2.1 */
+ else len *= 2; /* glibc 2.0 */
+
+ if ((ptr = realloc(buffer, len)) == NULL)
+ {
+ free(buffer);
+ buffer = NULL;
+ }
+ else buffer = ptr;
+
+ }
+
+ }
+
+ log_simple_message(type, buffer);
+
+ free(buffer);
+
+}
diff --git a/src/panels/log.h b/src/panels/log.h
new file mode 100644
index 0000000..5ea95cc
--- /dev/null
+++ b/src/panels/log.h
@@ -0,0 +1,56 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * log.h - prototypes pour le panneau d'affichage des messages système
+ *
+ * Copyright (C) 2006-2007 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 _PANEL_LOG_H
+#define _PANEL_LOG_H
+
+
+#include <gtk/gtk.h>
+
+
+
+/* Type de messages disponibles */
+typedef enum _LogMessageType
+{
+ LMT_INFO, /* Information sur l'exécution */
+ LMT_BAD_BINARY, /* Binaire malformé */
+ LMT_PROCESS, /* Début de tâche quelconque */
+
+ LMT_COUNT
+
+} LogMessageType;
+
+
+/* Construit le panneau d'affichage des messages système. */
+GtkWidget *build_log_panel(void);
+
+/* Affiche un message dans le journal des messages système. */
+void log_simple_message(LogMessageType, const char *);
+
+/* Affiche un message dans le journal des messages système. */
+void log_variadic_message(LogMessageType, const char *, ...);
+
+
+
+#endif /* _PANEL_LOG_H */
diff --git a/src/panels/panel-int.h b/src/panels/panel-int.h
new file mode 100644
index 0000000..417665f
--- /dev/null
+++ b/src/panels/panel-int.h
@@ -0,0 +1,70 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * panels.h - prototypes pour les définitions internes liées aux panneaux
+ *
+ * Copyright (C) 2009 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 _PANEL_PANELS_INT_H
+#define _PANEL_PANELS_INT_H
+
+
+#include "panel.h"
+
+
+
+#include "../common/dllist.h"
+
+
+
+/* Réagit à un changement d'affichage principal de contenu. */
+typedef void (* reload_for_new_view_fc) (GEditorPanel *, GtkBinView *, bool);
+
+
+/* Panneaux à présenter dans l'éditeur (instance) */
+struct _GEditorPanel
+{
+ GObject parent; /* A laisser en premier */
+
+ DL_LIST_ITEM(link); /* Maillon de liste chaînée */
+
+ const char *name; /* Nom du panneau */
+
+ reload_for_new_view_fc reload_view; /* Rechargement dû à une vue */
+
+ GtkWidget *widget; /* Composant GTK d'affichage */
+
+};
+
+
+#define panels_list_add_tail(new, head) dl_list_add_tail(new, head, GEditorPanel, link)
+#define panels_list_for_each(pos, head) dl_list_for_each(pos, head, GEditorPanel, link)
+
+
+/* Panneaux à présenter dans l'éditeur (classe) */
+struct _GEditorPanelClass
+{
+ GObjectClass parent; /* A laisser en premier */
+
+};
+
+
+
+#endif /* _PANEL_PANELS_INT_H */
diff --git a/src/panels/panel.c b/src/panels/panel.c
new file mode 100644
index 0000000..6258de8
--- /dev/null
+++ b/src/panels/panel.c
@@ -0,0 +1,257 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * panels.h - gestion des différents panneaux
+ *
+ * Copyright (C) 2006-2007 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 "panel.h"
+
+
+#include "glimpse.h"
+#include "panel-int.h"
+#include "symbols.h"
+#include "../gtkext/gtkdockpanel.h"
+
+
+
+
+
+/* Initialise la classe des panneaux d'éditeur. */
+static void g_editor_panel_class_init(GEditorPanelClass *);
+
+/* Initialise une instance de panneau d'éditeur. */
+static void g_editor_panel_init(GEditorPanel *);
+
+
+/* -------------- */
+
+
+static GEditorPanel *panels_list = NULL;
+
+
+
+
+/* Indique le type défini pour un panneau d'éditeur. */
+G_DEFINE_TYPE(GEditorPanel, g_editor_panel, G_TYPE_OBJECT);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des panneaux d'éditeur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_editor_panel_class_init(GEditorPanelClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = instance à initialiser. *
+* *
+* Description : Initialise une instance de panneau d'éditeur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_editor_panel_init(GEditorPanel *panel)
+{
+ DL_LIST_ITEM_INIT(&panel->link);
+
+}
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = espace de référencements global. *
+* binary = nouveau binaire actif. *
+* *
+* Description : Répercute sur les panneaux un nouveau binaire actif. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void change_current_binary_in_panels(GObject *ref, GOpenidaBinary *binary)
+{
+
+
+}
+
+
+
+
+
+
+
+
+/* -------------- */
+/* -------------- */
+/* -------------- */
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Procède au chargement de tous les panneaux internes. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void init_internal_panels(void)
+{
+ GEditorPanel *panel; /* Nouveau panneau chargé */
+
+ panel = g_symbols_panel_new();
+ panels_list_add_tail(panel, &panels_list);
+
+ panel = g_glimpse_panel_new();
+ panels_list_add_tail(panel, &panels_list);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : top = espace courant d'affichage principal. *
+* *
+* Description : Incruste tous les panneaux dans la fenêtre de l'éditeur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void place_all_panels_in_editor(GtkWidget *top)
+{
+ GEditorPanel *iter; /* Boucle de parcours */
+ GtkDockItem *ditem; /* Panneau avec ses infos. */
+
+ panels_list_for_each(iter, panels_list)
+ {
+ ditem = gtk_dock_item_new(iter->name, iter->widget);
+ gtk_dock_panel_add_item(GTK_DOCK_PANEL(top), ditem);
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : view = nouvelle visualisation de désassemblage. *
+* same = changement de binaire ou de vue ? *
+* *
+* Description : Lance une actualisation du fait d'un changement de vue. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void notify_panels_of_view_change(GtkBinView *view, bool same)
+{
+ GEditorPanel *iter; /* Boucle de parcours */
+
+ panels_list_for_each(iter, panels_list)
+ if (iter->reload_view != NULL)
+ iter->reload_view(iter, view, same);
+
+}
+
+
+
+
+
+
+
+#include "log.h"
+#include "registers.h"
+#include "strings.h"
+
+
+
+static GtkWidget *panel_list[PNT_COUNT];
+
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = espace de référencements global. *
+* *
+* Description : Procède au chargement de tous les panneaux. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void init_panels(GObject *ref)
+{
+ panel_list[PNT_LOG] = build_log_panel();
+ panel_list[PNT_REGISTERS] = build_registers_panel();
+ panel_list[PNT_STRINGS] = build_strings_panel(ref);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : id = identifiant du panneau visé. *
+* *
+* Description : Fournit la référence d'un panneau donné. *
+* *
+* Retour : Adresse du composant GTK en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *get_panel(PanelType id)
+{
+ return (id < PNT_COUNT ? panel_list[id] : NULL);
+
+}
diff --git a/src/panels/panel.h b/src/panels/panel.h
new file mode 100644
index 0000000..1a94ebc
--- /dev/null
+++ b/src/panels/panel.h
@@ -0,0 +1,116 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * panels.h - prototypes pour la gestion des différents panneaux
+ *
+ * Copyright (C) 2006-2007 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 _PANEL_PANELS_H
+#define _PANEL_PANELS_H
+
+
+#include <glib-object.h>
+#include <gtk/gtkwidget.h>
+
+
+#include "../analysis/binary.h"
+#include "../gtkext/gtkbinview.h"
+
+
+
+
+
+
+
+
+#define G_TYPE_EDITOR_PANEL g_editor_panel_get_type()
+#define G_EDITOR_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_editor_panel_get_type(), GEditorPanel))
+#define G_IS_EDITOR_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_editor_panel_get_type()))
+#define G_EDITOR_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_EDITOR_PANEL, GEditorPanelClass))
+#define G_IS_EDITOR_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_EDITOR_PANEL))
+#define G_EDITOR_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_EDITOR_PANEL, GEditorPanelClass))
+
+
+/* Panneaux à présenter dans l'éditeur (instance) */
+typedef struct _GEditorPanel GEditorPanel;
+
+/* Panneaux à présenter dans l'éditeur (classe) */
+typedef struct _GEditorPanelClass GEditorPanelClass;
+
+
+
+/* Indique le type défini pour un panneau d'éditeur. */
+GType g_editor_panel_get_type(void);
+
+
+
+
+
+/* Répercute sur les panneaux un nouveau binaire actif. */
+void change_current_binary_in_panels(GObject *, GOpenidaBinary *);
+
+
+
+
+
+/* Procède au chargement de tous les panneaux internes. */
+void init_internal_panels(void);
+
+/* Incruste tous les panneaux dans la fenêtre de l'éditeur. */
+void place_all_panels_in_editor(GtkWidget *);
+
+/* Lance une actualisation du fait d'un changement de vue. */
+void notify_panels_of_view_change(GtkBinView *, bool);
+
+
+
+
+
+
+
+
+
+
+#include <gtk/gtk.h>
+
+
+
+/* Liste de tous les panneaux */
+typedef enum _PanelType
+{
+ PNT_LOG, /* Messages système */
+ PNT_REGISTERS, /* Registres d'architecture */
+ PNT_STRINGS, /* Chaînes de carac. trouvées */
+ PNT_GLIMPSE, /* Aperçu d'un graphique */
+
+ PNT_COUNT
+
+} PanelType;
+
+
+/* Procède au chargement de tous les panneaux. */
+void init_panels(GObject *);
+
+/* Fournit la référence d'un panneau donné. */
+GtkWidget *get_panel(PanelType);
+
+
+
+#endif /* _PANEL_PANELS_H */
diff --git a/src/panels/registers.c b/src/panels/registers.c
new file mode 100644
index 0000000..1f9c8e5
--- /dev/null
+++ b/src/panels/registers.c
@@ -0,0 +1,236 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * registers.c - panneau d'affichage des registres d'architecture
+ *
+ * Copyright (C) 2006-2007 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 "registers.h"
+
+
+#include "../gtkext/easygtk.h"
+
+
+
+#define _(str) str
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Construit le panneau d'affichage des registres. *
+* *
+* Retour : Adresse du panneau mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *build_registers_panel(void)
+{
+ GtkWidget *result; /* Panneau à retourner */
+
+
+ GtkWidget *vbox1;
+ GtkWidget *label1;
+ GtkWidget *table1;
+ GtkWidget *label3;
+ GtkWidget *label4;
+ GtkWidget *label5;
+ GtkWidget *label6;
+ GtkWidget *label7;
+ GtkWidget *label8;
+ GtkWidget *label9;
+ GtkWidget *label10;
+ GtkWidget *label11;
+ GtkWidget *label12;
+ GtkWidget *label13;
+ GtkWidget *label14;
+ GtkWidget *label15;
+ GtkWidget *label16;
+ GtkWidget *entry1;
+ GtkWidget *entry2;
+ GtkWidget *entry3;
+ GtkWidget *entry4;
+ GtkWidget *entry6;
+ GtkWidget *entry5;
+ GtkWidget *entry7;
+ GtkWidget *label2;
+
+ GtkWidget *label; /* Etiquette textuelle */
+ GtkWidget *alignment; /* Décallage de contenu */
+ GtkWidget *entry; /* Zone de saisie */
+
+
+
+ result = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(result);
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN);
+
+
+
+
+ vbox1 = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox1);
+ gtk_container_add (GTK_CONTAINER (result), vbox1);
+
+ label1 = gtk_label_new (_("Registers:"));
+ gtk_widget_show (label1);
+ gtk_box_pack_start (GTK_BOX (vbox1), label1, FALSE, FALSE, 0);
+ gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
+
+
+ alignment = qck_create_padded_alignment(0, 0, 8, 0);
+ gtk_box_pack_start(GTK_BOX(vbox1), alignment, FALSE, TRUE, 0);
+
+ table1 = gtk_table_new(7, 3, FALSE);
+ gtk_widget_show(table1);
+ gtk_container_add(GTK_CONTAINER(alignment), table1);
+
+ label = qck_create_label(NULL, NULL, "eax: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "eax", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "ebx: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "ebx", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "ecx: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "ecx", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "edx: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "edx", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 3, 4, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "esi: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 4, 5, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "esi", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 4, 5, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "edi: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 5, 6, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "edi", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 5, 6, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "ebp: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 6, 7, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "ebp", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 6, 7, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "esp: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 7, 8, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "esp", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 7, 8, GTK_FILL, 0, 0, 0);
+
+ label = qck_create_label(NULL, NULL, "eip: ");
+ gtk_table_attach(GTK_TABLE(table1), label, 0, 1, 8, 9, GTK_FILL, 0, 0, 0);
+
+ entry = qck_create_entry(G_OBJECT(result), "eip", NULL);
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 8);
+ gtk_table_attach(GTK_TABLE(table1), entry, 1, 2, 8, 9, GTK_FILL, 0, 0, 0);
+
+
+
+
+ label2 = gtk_label_new (_("Segments:"));
+ gtk_widget_show (label2);
+ gtk_box_pack_start (GTK_BOX (vbox1), label2, FALSE, FALSE, 0);
+ gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
+
+
+
+
+ return result;
+
+}
+
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = panneau contenant les champs utiles. *
+* values = liste des registres avec leur valeur. *
+* count = taille de cette liste. *
+* *
+* Description : Met à jour l'affichage des valeurs de registre. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void refresh_registers_panel_with_registers(GtkWidget *panel, register_value *values, size_t count)
+{
+ GObject *ref; /* Espace de référencement */
+ size_t i; /* Boucle de parcours */
+ GtkEntry *entry; /* Zone de texte */
+ char buffer[32];
+
+ ref = G_OBJECT(panel);
+
+ for (i = 0; i < count; i++)
+ {
+ entry = GTK_ENTRY(g_object_get_data(ref, values[i].name));
+ if (entry == NULL) continue;
+
+ snprintf(buffer, 32, "%08llx", values[i].value);
+
+ gtk_entry_set_text(entry, buffer);
+
+
+
+
+
+ }
+
+
+
+}
diff --git a/src/panels/registers.h b/src/panels/registers.h
new file mode 100644
index 0000000..7110414
--- /dev/null
+++ b/src/panels/registers.h
@@ -0,0 +1,47 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * registers.h - prototypes pour le panneau d'affichage des registres d'architecture
+ *
+ * Copyright (C) 2006-2007 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 _PANEL_REGISTERS_H
+#define _PANEL_REGISTERS_H
+
+
+#include <gtk/gtk.h>
+
+
+#include "../debug/debuggers.h"
+
+
+
+/* Construit le panneau d'affichage des registres. */
+GtkWidget *build_registers_panel(void);
+
+
+
+/* Met à jour l'affichage des valeurs de registre. */
+void refresh_registers_panel_with_registers(GtkWidget *, register_value *, size_t);
+
+
+
+
+#endif /* _PANEL_REGISTERS_H */
diff --git a/src/panels/strings.c b/src/panels/strings.c
new file mode 100644
index 0000000..1d09593
--- /dev/null
+++ b/src/panels/strings.c
@@ -0,0 +1,150 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * strings.c - panneau d'affichage des chaînes de caractères
+ *
+ * Copyright (C) 2006-2007 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 "strings.h"
+
+
+#include "../format/format.h"
+
+
+
+/* Colonnes de la liste des symboles */
+typedef enum _StringsColumn
+{
+ STC_ADDRESS, /* Adresse mémoire du symbole */
+ STC_STRING, /* Désignation humaine */
+
+ STC_COUNT /* Nombre de colonnes */
+
+} StringsColumn;
+
+
+#define _(str) str
+
+
+/******************************************************************************
+* *
+* Paramètres : ref = adresse de l'espace de référencements. *
+* *
+* Description : Construit le panneau d'affichage des symboles. *
+* *
+* Retour : Adresse du panneau mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *build_strings_panel(GObject *ref)
+{
+ GtkWidget *result; /* Panneau à retourner */
+ GtkTreeStore *store; /* Modèle de gestion */
+ GtkWidget *treeview; /* Affichage de la liste */
+ GtkCellRenderer *renderer; /* Moteur de rendu de colonne */
+ GtkTreeViewColumn *column; /* Colonne de la liste */
+ GtkTreeSelection *select; /* Sélection dans la liste */
+
+ result = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(result);
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(result), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(result), GTK_SHADOW_IN);
+
+ store = gtk_tree_store_new(STC_COUNT, G_TYPE_STRING, G_TYPE_STRING);
+ g_object_set_data(G_OBJECT(result), "store", store);
+
+ treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+ gtk_widget_show(treeview);
+ gtk_container_add(GTK_CONTAINER(result), treeview);
+
+ g_object_unref(G_OBJECT(store));
+
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+ gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("Address"), renderer, "text", STC_ADDRESS, NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes(_("String"), renderer, "text", STC_STRING, NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+
+ /*
+ select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+ gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
+ g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(change_symbols_selection), ref);
+ */
+
+
+
+ return result;
+
+}
+
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = panneau à mettre à jour. *
+* format = données sur l'exécutable à représenter. *
+* *
+* Description : Affiche la liste des symboles présents dans un exécutable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void handle_new_exe_on_strings_panel(GtkWidget *panel, const GExeFormat *format)
+{
+ GtkTreeStore *store; /* Modèle de gestion */
+ size_t count; /* Nombre des chaînes */
+ GBinSymbol **symbols; /* Liste des chaînes trouvées */
+ size_t i; /* Boucle de parcours */
+ char address[11]; /* Conversion de l'adresse */
+ GtkTreeIter iter; /* Point d'insertion */
+
+ store = g_object_get_data(G_OBJECT(panel), "store");
+
+ symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count);
+
+ for (i = 0; i < count; i++)
+ {
+ if (g_binary_symbol_get_target_type(symbols[i]) != STP_STRING) continue;
+
+ /* FIXME : adresses autres que 32 bits */
+ snprintf(address, 11, "0x%08llx", g_binary_symbol_get_address(symbols[i]));
+
+ gtk_tree_store_append(store, &iter, NULL);
+ gtk_tree_store_set(store, &iter,
+ STC_ADDRESS, address,
+ STC_STRING, g_binary_symbol_to_string(symbols[i]),
+ -1);
+
+ }
+
+}
diff --git a/src/panels/strings.h b/src/panels/strings.h
new file mode 100644
index 0000000..8227e89
--- /dev/null
+++ b/src/panels/strings.h
@@ -0,0 +1,44 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * strings.h - prototypes pour le panneau d'affichage des chaînes de caractères
+ *
+ * Copyright (C) 2006-2007 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 _PANEL_STRINGS_H
+#define _PANEL_STRINGS_H
+
+
+#include <gtk/gtk.h>
+
+
+#include "../format/executable.h"
+
+
+
+/* Construit le panneau d'affichage des symboles. */
+GtkWidget *build_strings_panel(GObject *);
+
+/* Affiche la liste des symboles présents dans un exécutable. */
+void handle_new_exe_on_strings_panel(GtkWidget *, const GExeFormat *);
+
+
+
+#endif /* _PANEL_STRINGS_H */
diff --git a/src/panels/symbols.c b/src/panels/symbols.c
new file mode 100644
index 0000000..c7c8369
--- /dev/null
+++ b/src/panels/symbols.c
@@ -0,0 +1,284 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * symbols.c - panneau d'affichage des symboles
+ *
+ * Copyright (C) 2006-2007 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 "symbols.h"
+
+
+#include <gtk/gtk.h>
+
+
+#include "panel-int.h"
+#include "../format/format.h"
+
+
+
+#define _(str) str
+
+
+
+
+/* Panneau d'aperçu de graphiques (instance) */
+struct _GSymbolsPanel
+{
+ GEditorPanel parent; /* A laisser en premier */
+
+ GtkTreeStore *store; /* Modèle de gestion */
+
+ GtkBinView *binview; /* Affichage à faire défiler */
+
+};
+
+
+
+/* Panneau d'aperçu de graphiques (classe) */
+struct _GSymbolsPanelClass
+{
+ GEditorPanelClass parent; /* A laisser en premier */
+
+};
+
+
+/* Colonnes de la liste des symboles */
+typedef enum _SymbolsColumn
+{
+ SBC_ADDRESS, /* Adresse mémoire du symbole */
+ SBC_NAME, /* Désignation humaine */
+
+ SBC_COUNT /* Nombre de colonnes */
+
+} SymbolsColumn;
+
+
+
+/* Initialise la classe des panneaux d'aperçu de graphiques. */
+static void g_symbols_panel_class_init(GSymbolsPanelClass *);
+
+/* Initialise une instance de panneau d'aperçu de graphiques. */
+static void g_symbols_panel_init(GSymbolsPanel *);
+
+/* Réagit au changement de sélection des symboles. */
+static void on_symbols_selection_change(GtkTreeSelection *, GSymbolsPanel *);
+
+/* Réagit à un changement d'affichage principal de contenu. */
+static void reload_symbols_for_new_view(GSymbolsPanel *, GtkBinView *, bool);
+
+
+
+/* Indique le type définit pour un panneau d'aperçu de graphiques. */
+G_DEFINE_TYPE(GSymbolsPanel, g_symbols_panel, G_TYPE_EDITOR_PANEL);
+
+
+/******************************************************************************
+* *
+* Paramètres : klass = classe à initialiser. *
+* *
+* Description : Initialise la classe des panneaux d'aperçu de graphiques. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_symbols_panel_class_init(GSymbolsPanelClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = instance à initialiser. *
+* *
+* Description : Initialise une instance de panneau d'aperçu de graphiques. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_symbols_panel_init(GSymbolsPanel *panel)
+{
+ GEditorPanel *base; /* Version basique d'instance */
+ GtkWidget *treeview; /* Affichage de la liste */
+ GtkCellRenderer *renderer; /* Moteur de rendu de colonne */
+ GtkTreeViewColumn *column; /* Colonne de la liste */
+ GtkTreeSelection *select; /* Sélection dans la liste */
+
+ base = G_EDITOR_PANEL(panel);
+
+ base->name = _("Symbols");
+ base->reload_view = (reload_for_new_view_fc)reload_symbols_for_new_view;
+
+ base->widget = gtk_scrolled_window_new(NULL, NULL);
+ gtk_widget_show(base->widget);
+
+ gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(base->widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(base->widget), GTK_SHADOW_IN);
+
+ panel->store = gtk_tree_store_new(SBC_COUNT, G_TYPE_STRING, G_TYPE_STRING);
+
+ treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(panel->store));
+ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
+ gtk_widget_show(treeview);
+ gtk_container_add(GTK_CONTAINER(base->widget), treeview);
+
+ g_object_unref(G_OBJECT(panel->store));
+
+ column = gtk_tree_view_column_new();
+ gtk_tree_view_column_set_visible(column, FALSE);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+ gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Address", renderer, "text", SBC_ADDRESS, NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ renderer = gtk_cell_renderer_text_new();
+ column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text", SBC_NAME, NULL);
+ gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
+
+ select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
+ gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
+ g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(on_symbols_selection_change), panel);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un panneau d'aperçu de graphiques. *
+* *
+* Retour : Adresse de la structure mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GEditorPanel *g_symbols_panel_new(void)
+{
+ GEditorPanel *result; /* Structure à retourner */
+
+ result = g_object_new(G_TYPE_SYMBOLS_PANEL, NULL);
+
+ return G_EDITOR_PANEL(result);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : selection = sélection modifiée. *
+* panel = structure contenant les informations maîtresses. *
+* *
+* Description : Réagit au changement de sélection des symboles. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void on_symbols_selection_change(GtkTreeSelection *selection, GSymbolsPanel *panel)
+{
+ GtkTreeIter iter; /* Point de sélection */
+ GtkTreeModel *model; /* Modèle de gestion */
+ gchar *string; /* Chaîne sélectionnée */
+ vmpa_t address; /* Adresse à rejoindre */
+
+ if (gtk_tree_selection_get_selected(selection, &model, &iter))
+ {
+ gtk_tree_model_get(model, &iter, SBC_ADDRESS, &string, -1);
+ address = strtoll(string, NULL, 16); /* FIXME */
+ g_free(string);
+
+ gtk_bin_view_scroll_to_address(panel->binview, address);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = panneau à mettre à jour. *
+* view = nouvelle visualisation de désassemblage. *
+* same = changement de binaire ou de vue ? *
+* *
+* Description : Réagit à un changement d'affichage principal de contenu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void reload_symbols_for_new_view(GSymbolsPanel *panel, GtkBinView *view, bool same)
+{
+ GOpenidaBinary *binary; /* Binaire en cours d'édition */
+ GExeFormat *format; /* Format associé au binaire */
+ GBinSymbol **symbols; /* Symboles trouvés */
+ size_t count; /* Nombre de ces symboles */
+ GArchProcessor *proc; /* Architecture utilisée */
+ size_t i; /* Boucle de parcours */
+ vmpa_t address; /* Adresse associée au symbole */
+ char tmp[VMPA_MAX_SIZE]; /* Version humainement lisible */
+ GtkTreeIter iter; /* Point d'insertion */
+
+ panel->binview = view;
+
+ if (same) return;
+
+ gtk_tree_store_clear(panel->store);
+
+ binary = gtk_bin_view_get_binary(view);
+ format = g_openida_binary_get_format(binary);
+ symbols = g_binary_format_get_symbols(G_BIN_FORMAT(format), &count);
+
+ if (symbols != NULL)
+ {
+ proc = get_arch_processor_from_format(format);
+
+ for (i = 0; i < count; i++)
+ {
+ if (g_binary_symbol_get_target_type(symbols[i]) == STP_STRING)
+ continue;
+
+ address = g_binary_symbol_get_address(symbols[i]);
+ vmpa_to_string(address, g_arch_processor_get_memory_size(proc), tmp);
+
+ gtk_tree_store_append(panel->store, &iter, NULL);
+ gtk_tree_store_set(panel->store, &iter,
+ SBC_ADDRESS, tmp,
+ SBC_NAME, g_binary_symbol_to_string(symbols[i]),
+ -1);
+
+ }
+
+ }
+
+}
diff --git a/src/panels/symbols.h b/src/panels/symbols.h
new file mode 100644
index 0000000..7978b30
--- /dev/null
+++ b/src/panels/symbols.h
@@ -0,0 +1,60 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * pan_symbols.h - prototypes pour le panneau d'affichage des symboles
+ *
+ * Copyright (C) 2006-2007 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 _PAN_SYMBOLS_H
+#define _PAN_SYMBOLS_H
+
+
+#include <glib-object.h>
+
+
+#include "panel.h"
+
+
+
+#define G_TYPE_SYMBOLS_PANEL g_symbols_panel_get_type()
+#define G_SYMBOLS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_symbols_panel_get_type(), GSymbolsPanel))
+#define G_IS_SYMBOLS_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_symbols_panel_get_type()))
+#define G_SYMBOLS_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SYMBOLS_PANEL, GSymbolsPanelClass))
+#define G_IS_SYMBOLS_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SYMBOLS_PANEL))
+#define G_SYMBOLS_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SYMBOLS_PANEL, GSymbolsPanelClass))
+
+
+/* Panneau d'affichage des symboles (instance) */
+typedef struct _GSymbolsPanel GSymbolsPanel;
+
+/* Panneau d'affichage des symboles (classe) */
+typedef struct _GSymbolsPanelClass GSymbolsPanelClass;
+
+
+
+/* Indique le type définit pour un panneau d'affichage des symboles. */
+GType g_symbols_panel_get_type(void);
+
+/* Crée un panneau d'affichage des symboles. */
+GEditorPanel *g_symbols_panel_new(void);
+
+
+
+#endif /* _PAN_SYMBOLS_H */
diff --git a/src/project.c b/src/project.c
index fd9d7ea..06059ed 100644
--- a/src/project.c
+++ b/src/project.c
@@ -34,7 +34,7 @@
#include "gtkext/gtkblockview.h"
#include "gtkext/gtkdockpanel.h"
#include "gtkext/gtkgraphview.h"
-#include "panel/panels.h"
+#include "panels/panel.h"
@@ -654,22 +654,6 @@ void display_openida_project(const openida_project *project, GObject *ref)
}
-
- if (i > 0)
- {
- g_object_set_data(ref, "current_binary", binary);
-
-
- get_view_for_openida_project_binary(project, binary, BVW_BLOCK, &binview);
- g_object_set_data(ref, "binview", binview);
-
-
- reload_symbols_panel_content(get_panel(PNT_SYMBOLS), g_openida_binary_get_format(binary));
- handle_new_exe_on_strings_panel(get_panel(PNT_STRINGS), g_openida_binary_get_format(binary));
-
- }
-
-
}
@@ -713,16 +697,4 @@ void display_new_binary_of_openida_project(GOpenidaBinary *binary, openida_proje
- g_object_set_data(project->ref, "current_binary", binary);
-
-
- get_view_for_openida_project_binary(project, binary, BVW_BLOCK, &binview);
- g_object_set_data(project->ref, "binview", binview);
-
-
- reload_symbols_panel_content(get_panel(PNT_SYMBOLS), g_openida_binary_get_format(binary));
-
-
-
-
}