summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2009-02-16 22:05:28 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2009-02-16 22:05:28 (GMT)
commitd7765c0e6d2685b57625f607325f4a80eb28dbe5 (patch)
treeb590e3b4b28b28584fdade28d17059db1ad2bcac
parent14abff97c2ba0940c2dcf2e37eb080ebdb923c6f (diff)
Begun to add a real support of DragAndDropping for panels.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@48 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
-rw-r--r--ChangeLog54
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac4
-rw-r--r--pixmaps/Makefile.am8
-rw-r--r--pixmaps/drop_bottom.pngbin0 -> 596 bytes
-rw-r--r--pixmaps/drop_bottom_hover.pngbin0 -> 612 bytes
-rw-r--r--pixmaps/drop_center.pngbin0 -> 681 bytes
-rw-r--r--pixmaps/drop_center_hover.pngbin0 -> 693 bytes
-rw-r--r--pixmaps/drop_left.pngbin0 -> 603 bytes
-rw-r--r--pixmaps/drop_left_hover.pngbin0 -> 610 bytes
-rw-r--r--pixmaps/drop_right.pngbin0 -> 598 bytes
-rw-r--r--pixmaps/drop_right_hover.pngbin0 -> 598 bytes
-rw-r--r--pixmaps/drop_top.pngbin0 -> 568 bytes
-rw-r--r--pixmaps/drop_top_hover.pngbin0 -> 605 bytes
-rw-r--r--pixmaps/dropwin_back.pngbin0 -> 2578 bytes
-rw-r--r--src/Makefile.am14
-rw-r--r--src/binary.c3
-rw-r--r--src/easygtk.c40
-rw-r--r--src/easygtk.h3
-rw-r--r--src/editor.c67
-rw-r--r--src/format/elf/e_elf.c24
-rw-r--r--src/format/elf/e_elf.h2
-rw-r--r--src/gtkext/Makefile.am17
-rw-r--r--src/gtkext/gtkdockitem.c225
-rw-r--r--src/gtkext/gtkdockitem.h92
-rw-r--r--src/gtkext/gtkdockpanel.c652
-rw-r--r--src/gtkext/gtkdockpanel.h88
-rw-r--r--src/gtkext/gtkdropwindow.c150
-rw-r--r--src/gtkext/gtkdropwindow.h72
-rw-r--r--src/support.c92
-rw-r--r--src/support.h41
31 files changed, 1638 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 9aed5fd..490b0de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,57 @@
+2009-02-16 Cyrille Bagard <nocbos@gmail.com>
+
+ * configure.ac:
+ Add the new Makefiles from 'pixmaps/' and 'src/gtkext/' directories to
+ AC_CONFIG_FILES.
+
+ * Makefile.am:
+ Add pixmaps to SUBDIRS.
+
+ * pixmaps/drop_bottom_hover.png:
+ * pixmaps/drop_bottom.png:
+ * pixmaps/drop_center_hover.png:
+ * pixmaps/drop_center.png:
+ * pixmaps/drop_left_hover.png:
+ * pixmaps/drop_left.png:
+ * pixmaps/drop_right_hover.png:
+ * pixmaps/drop_right.png:
+ * pixmaps/drop_top_hover.png:
+ * pixmaps/drop_top.png:
+ * pixmaps/dropwin_back.png:
+ * pixmaps/Makefile.am:
+ Define pictures for the "Drag and Drop" window.
+
+ * src/binary.c:
+ Register the ELF format.
+
+ * src/easygtk.c:
+ * src/easygtk.h:
+ Quickly load an image widget.
+
+ * src/editor.c:
+ Use the new dock panels.
+
+ * src/format/elf/e_elf.c:
+ * src/format/elf/e_elf.h:
+ Check if a binary is matching the binary format.
+
+ * src/gtkext/gtkdockitem.c:
+ * src/gtkext/gtkdockitem.h:
+ * src/gtkext/gtkdockpanel.c:
+ * src/gtkext/gtkdockpanel.h:
+ * src/gtkext/gtkdropwindow.c:
+ * src/gtkext/gtkdropwindow.h:
+ * src/gtkext/Makefile.am:
+ Create new GTK widgets for handling "Drag and Drop" methods. The code is
+ still a little buggy/crappy and will be improved.
+
+ * src/Makefile.am:
+ Add support.[ch] to openida_SOURCES and gtkext/libgtkext.a to openida_LDADD.
+
+ * src/support.c:
+ * src/support.h:
+ Look for picture files.
+
2009-01-29 Cyrille Bagard <nocbos@gmail.com>
* configure.ac:
diff --git a/Makefile.am b/Makefile.am
index 2773ce2..dedd688 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
EXTRA_DIST = config.rpath config.rpath ChangeLog
-SUBDIRS = src
+SUBDIRS = pixmaps src
ACLOCAL_AMFLAGS = -I m4
diff --git a/configure.ac b/configure.ac
index 7ef720a..21362e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,6 +180,7 @@ AC_SUBST(LIBXML_LIBS)
AC_CONFIG_FILES([stamp-h po/Makefile.in], [echo timestamp > stamp-h])
AC_CONFIG_FILES([Makefile
+ pixmaps/Makefile
src/Makefile
src/arch/Makefile
src/arch/x86/Makefile
@@ -188,7 +189,8 @@ AC_CONFIG_FILES([Makefile
src/format/dwarf/Makefile
src/format/elf/Makefile
src/format/java/Makefile
- src/format/pe/Makefile])
+ src/format/pe/Makefile
+ src/gtkext/Makefile])
AC_OUTPUT
diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am
new file mode 100644
index 0000000..e725e15
--- /dev/null
+++ b/pixmaps/Makefile.am
@@ -0,0 +1,8 @@
+
+EXTRA_DIST = \
+ dropwin_back.png
+
+
+oidapixdir = $(datadir)/openida
+
+oidapix_DATA = $(EXTRA_DIST)
diff --git a/pixmaps/drop_bottom.png b/pixmaps/drop_bottom.png
new file mode 100644
index 0000000..e141d87
--- /dev/null
+++ b/pixmaps/drop_bottom.png
Binary files differ
diff --git a/pixmaps/drop_bottom_hover.png b/pixmaps/drop_bottom_hover.png
new file mode 100644
index 0000000..645b437
--- /dev/null
+++ b/pixmaps/drop_bottom_hover.png
Binary files differ
diff --git a/pixmaps/drop_center.png b/pixmaps/drop_center.png
new file mode 100644
index 0000000..a47901b
--- /dev/null
+++ b/pixmaps/drop_center.png
Binary files differ
diff --git a/pixmaps/drop_center_hover.png b/pixmaps/drop_center_hover.png
new file mode 100644
index 0000000..b589d50
--- /dev/null
+++ b/pixmaps/drop_center_hover.png
Binary files differ
diff --git a/pixmaps/drop_left.png b/pixmaps/drop_left.png
new file mode 100644
index 0000000..b4668ee
--- /dev/null
+++ b/pixmaps/drop_left.png
Binary files differ
diff --git a/pixmaps/drop_left_hover.png b/pixmaps/drop_left_hover.png
new file mode 100644
index 0000000..e240b49
--- /dev/null
+++ b/pixmaps/drop_left_hover.png
Binary files differ
diff --git a/pixmaps/drop_right.png b/pixmaps/drop_right.png
new file mode 100644
index 0000000..f46792b
--- /dev/null
+++ b/pixmaps/drop_right.png
Binary files differ
diff --git a/pixmaps/drop_right_hover.png b/pixmaps/drop_right_hover.png
new file mode 100644
index 0000000..102eb6c
--- /dev/null
+++ b/pixmaps/drop_right_hover.png
Binary files differ
diff --git a/pixmaps/drop_top.png b/pixmaps/drop_top.png
new file mode 100644
index 0000000..4435134
--- /dev/null
+++ b/pixmaps/drop_top.png
Binary files differ
diff --git a/pixmaps/drop_top_hover.png b/pixmaps/drop_top_hover.png
new file mode 100644
index 0000000..281e793
--- /dev/null
+++ b/pixmaps/drop_top_hover.png
Binary files differ
diff --git a/pixmaps/dropwin_back.png b/pixmaps/dropwin_back.png
new file mode 100644
index 0000000..bd962b9
--- /dev/null
+++ b/pixmaps/dropwin_back.png
Binary files differ
diff --git a/src/Makefile.am b/src/Makefile.am
index 8048f66..68345bf 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,6 +11,7 @@ openida_SOURCES = \
pan_strings.h pan_strings.c \
pan_symbols.h pan_symbols.c \
project.h project.c \
+ support.h support.c \
xdg.h xdg.c \
xml.h xml.c
@@ -25,7 +26,16 @@ AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS)
openida_LDFLAGS = $(LIBGTK_LIBS) -L/usr/X11R6/lib -ldl -lm $(LIBXML_LIBS) `pkg-config --libs gthread-2.0`
-openida_LDADD = $(LIBINTL) arch/libarch.a arch/x86/libarchx86.a format/libformat.a format/dwarf/libformatdwarf.a format/elf/libformatelf.a format/java/libformatjava.a format/pe/libformatpe.a common/libcommon.a
+openida_LDADD = $(LIBINTL) \
+ arch/libarch.a \
+ arch/x86/libarchx86.a \
+ format/libformat.a \
+ format/dwarf/libformatdwarf.a \
+ format/elf/libformatelf.a \
+ format/java/libformatjava.a \
+ format/pe/libformatpe.a \
+ gtkext/libgtkext.a \
+ common/libcommon.a
-SUBDIRS = arch common format
+SUBDIRS = arch common format gtkext
diff --git a/src/binary.c b/src/binary.c
index df64a1a..45dc0e0 100644
--- a/src/binary.c
+++ b/src/binary.c
@@ -392,6 +392,7 @@ void fill_snippet(GtkSnippet *snippet, GtkWidget *panel, GtkWidget *panel2)
len = 0x28;
+ register_exe_format(_("ELF"), elf_is_matching, load_elf);
register_exe_format(_("Java"), java_is_matching, load_java);
register_exe_format(_("Portable Executable"), pe_is_matching, load_pe);
@@ -414,7 +415,7 @@ void fill_snippet(GtkSnippet *snippet, GtkWidget *panel, GtkWidget *panel2)
return;
- format = load_elf(bin_data, length);
+ /////format = load_elf(bin_data, length);
dformat = load_dwarf(bin_data, length, format);
diff --git a/src/easygtk.c b/src/easygtk.c
index 04584b5..bcca8e4 100644
--- a/src/easygtk.c
+++ b/src/easygtk.c
@@ -127,6 +127,46 @@ GtkWidget *qck_create_notebook(GObject *object, const char *name)
/******************************************************************************
* *
+* Paramètres : object = espace dédié à l'inscription de références. *
+* name = nom à donner au nouveau composant. *
+* filename = chemin d'accès complet au fichier à afficher. *
+* *
+* Description : Crée un composant 'GtkImage'. *
+* *
+* Retour : Image mise en place. *
+* *
+* Remarques : Si le chemin est libérable, il est libéré de la mémoire. *
+* *
+******************************************************************************/
+
+GtkWidget *qck_create_image(GObject *object, const char *name, gchar *filename)
+{
+ GtkWidget *result; /* Résultat à renvoyer */
+
+ if (filename == NULL)
+ result = gtk_image_new();
+
+ else
+ {
+ result = gtk_image_new_from_file(filename);
+ g_free(filename);
+ }
+
+ if (G_IS_OBJECT(object) && name != NULL)
+ {
+ gtk_widget_ref(result);
+ g_object_set_data_full(object, name, result, (GtkDestroyNotify)gtk_widget_unref);
+ }
+
+ gtk_widget_show(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : object = espace dédié à l'inscription de références. *
* name = nom à donner au nouveau composant. *
* caption = intitulé apparaissant sur le composant. *
diff --git a/src/easygtk.h b/src/easygtk.h
index bde6332..7b4554b 100644
--- a/src/easygtk.h
+++ b/src/easygtk.h
@@ -38,6 +38,9 @@ GtkWidget *qck_create_frame(const char *, GtkWidget **, guint, guint, guint, gui
/* Met en place un support à onglets. */
GtkWidget *qck_create_notebook(GObject *, const char *);
+/* Crée un composant 'GtkImage'. */
+GtkWidget *qck_create_image(GObject *, const char *, gchar *);
+
/* Crée un composant 'GtkLabel'. */
GtkWidget *qck_create_label(GObject *, const char *, const char *);
diff --git a/src/editor.c b/src/editor.c
index dc9f524..7236735 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -56,6 +56,7 @@
#include "gtksnippet.h"
#include "pan_strings.h"
#include "pan_symbols.h"
+#include "gtkext/gtkdockpanel.h"
#define _(str) str
@@ -155,6 +156,9 @@ int main(int argc, char **argv)
*/
/*LIBXML_TEST_VERSION*/
+ add_pixmap_directory(PACKAGE_DATA_DIR);
+ add_pixmap_directory(PACKAGE_SOURCE_DIR G_DIR_SEPARATOR_S "pixmaps");
+
/* Initialisation du programme */
editor = create_editor();
gtk_widget_show(editor);
@@ -450,6 +454,10 @@ GtkWidget *create_editor(void)
openida_project *project;
+
+ GtkWidget *dpanel; /* Support de panneaux */
+ GtkDockItem *ditem; /* Panneau avec ses infos. */
+
GtkWidget *notebook; /* Support à onglets */
GtkWidget *label; /* Etiquette pour onglet */
@@ -580,13 +588,24 @@ GtkWidget *create_editor(void)
gtk_paned_pack1 (GTK_PANED (vpaned1), hpaned1, FALSE, TRUE);
gtk_paned_set_position (GTK_PANED (hpaned1), 600);
+
+
+
+ dpanel = gtk_dock_panel_new();
+ gtk_widget_show(dpanel);
+
+ gtk_paned_pack1(GTK_PANED(hpaned1), dpanel, TRUE, TRUE);
+
+
scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
gtk_widget_show (scrolledwindow2);
- gtk_paned_pack1 (GTK_PANED (hpaned1), scrolledwindow2, FALSE, TRUE);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_SHADOW_IN);
+ //gtk_paned_pack1 (GTK_PANED (hpaned1), scrolledwindow2, FALSE, TRUE);
+ ditem = gtk_dock_item_new(_("Binary code"), scrolledwindow2);
+ gtk_dock_panel_add_item(dpanel, ditem);
+
binview = gtk_binview_new();
g_object_set_data(G_OBJECT(result), "binview", binview);
@@ -624,13 +643,29 @@ GtkWidget *create_editor(void)
+
+
+ dpanel = gtk_dock_panel_new();
+ gtk_widget_show(dpanel);
+
+ gtk_paned_pack2(GTK_PANED(hpaned1), dpanel, TRUE, TRUE);
+
+ panel = build_symbols_panel(G_OBJECT(result));
+ _panel = panel;
+
+ ditem = gtk_dock_item_new(_("Symbols"), panel);
+ gtk_dock_panel_add_item(dpanel, ditem);
+
+
+
+
+
fixed1 = gtk_fixed_new ();
gtk_widget_show (fixed1);
- //gtk_paned_pack2 (GTK_PANED (hpaned1), fixed1, TRUE, TRUE);
- panel = build_symbols_panel(G_OBJECT(result));
- gtk_paned_pack2 (GTK_PANED (hpaned1), panel, TRUE, TRUE);
+
+ ditem = gtk_dock_item_new(_("Dbg"), fixed1);
+ gtk_dock_panel_add_item(dpanel, ditem);
- _panel = panel;
label1 = gtk_label_new (_("Registres :"));
@@ -802,6 +837,24 @@ GtkWidget *create_editor(void)
/* Panneau inférieur */
+
+
+ dpanel = gtk_dock_panel_new();
+ gtk_widget_show(dpanel);
+
+ printf("bottom :: %p\n", dpanel);
+
+ gtk_paned_pack2(GTK_PANED(vpaned1), dpanel, FALSE, FALSE);
+
+ panel = build_strings_panel(G_OBJECT(result));
+
+ ditem = gtk_dock_item_new(_("Strings"), panel);
+ gtk_dock_panel_add_item(dpanel, ditem);
+
+
+
+ /*
+
notebook = qck_create_notebook(NULL, NULL);
gtk_paned_pack2(GTK_PANED(vpaned1), notebook, FALSE, FALSE);
@@ -811,7 +864,7 @@ GtkWidget *create_editor(void)
label = qck_create_label(NULL, NULL, _("Strings"));
gtk_notebook_set_tab_label(GTK_NOTEBOOK(notebook), gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), 0), label);
-
+ */
diff --git a/src/format/elf/e_elf.c b/src/format/elf/e_elf.c
index 48b4455..a69be68 100644
--- a/src/format/elf/e_elf.c
+++ b/src/format/elf/e_elf.c
@@ -44,7 +44,31 @@ size_t get_elf_resolved_items(const elf_format *, char ***, ResolvedType **, uin
+/******************************************************************************
+* *
+* Paramètres : content = contenu binaire à parcourir. *
+* length = taille du contenu en question. *
+* *
+* Description : Indique si le format peut être pris en charge ici. *
+* *
+* Retour : true si la réponse est positive, false sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool elf_is_matching(const uint8_t *content, off_t length)
+{
+ bool result; /* Bilan à faire connaître */
+
+ result = false;
+ if (length >= 4)
+ result = (strncmp((const char *)content, "\x7f\x45\x4c\x46" /* .ELF */, 4) == 0);
+
+ return result;
+
+}
/******************************************************************************
diff --git a/src/format/elf/e_elf.h b/src/format/elf/e_elf.h
index b11fb24..fffeff2 100644
--- a/src/format/elf/e_elf.h
+++ b/src/format/elf/e_elf.h
@@ -38,6 +38,8 @@
typedef struct _elf_format elf_format;
+/* Indique si le format peut être pris en charge ici. */
+bool elf_is_matching(const uint8_t *, off_t);
/* Prend en charge un nouvel ELF. */
elf_format *load_elf(const uint8_t *, off_t);
diff --git a/src/gtkext/Makefile.am b/src/gtkext/Makefile.am
new file mode 100644
index 0000000..5afd881
--- /dev/null
+++ b/src/gtkext/Makefile.am
@@ -0,0 +1,17 @@
+
+lib_LIBRARIES = libgtkext.a
+
+libgtkext_a_SOURCES = \
+ gtkdockitem.h gtkdockitem.c \
+ gtkdockpanel.h gtkdockpanel.c \
+ gtkdropwindow.h gtkdropwindow.c
+
+libgtkext_a_CFLAGS = $(AM_CFLAGS)
+
+
+INCLUDES = $(LIBGTK_CFLAGS)
+
+AM_CPPFLAGS =
+
+AM_CFLAGS = $(DEBUG_CFLAGS) $(WARNING_FLAGS)
+
diff --git a/src/gtkext/gtkdockitem.c b/src/gtkext/gtkdockitem.c
new file mode 100644
index 0000000..c031c7f
--- /dev/null
+++ b/src/gtkext/gtkdockitem.c
@@ -0,0 +1,225 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkdockitem.c - mémorisation des propriétés d'un panneau dockable
+ *
+ * Copyright (C) 2008 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "gtkdockitem.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. *
+* *
+* Description : Procède à l'initialisation d'un panneau dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_item_class_init(GtkDockItemClass *class)
+{
+
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : ditem = composant GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation d'un panneau dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_item_init(GtkDockItem *ditem)
+{
+
+ ditem->name = NULL;
+
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : name = nouveau nom à prendre en compte. *
+* panel = nouveau panneau à prendre en compte. *
+* *
+* Description : Crée une nouvelle mémorisation de panneau dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkDockItem *gtk_dock_item_new(const gchar *name, GtkWidget *panel)
+{
+ GtkDockItem *result; /* Composant à retourner */
+
+ result = g_object_new(GTK_TYPE_DOCK_ITEM, NULL);
+
+ gtk_dock_item_set_name(result, name);
+ gtk_dock_item_set_panel(result, panel);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : ditem = composant GTK à modifier. *
+* name = nouveau nom à prendre en compte. *
+* *
+* Description : Change le nom du panneau dockable pour son onglet. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_dock_item_set_name(GtkDockItem *ditem, const gchar *name)
+{
+ if (ditem->name != NULL)
+ g_free(ditem->name);
+
+ ditem->name = g_strdup(name);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : ditem = composant GTK à modifier. *
+* *
+* Description : Fournit le nom du panneau dockable pour son onglet. *
+* *
+* Retour : Etiquette à faire apparaître sur un onglet. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const gchar *gtk_dock_item_get_name(GtkDockItem *ditem)
+{
+ return ditem->name;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : ditem = composant GTK à modifier. *
+* name = nouveau nom à prendre en compte. *
+* *
+* Description : Change la description du panneau dockable pour son titre. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_dock_item_set_desc(GtkDockItem *ditem, const gchar *name)
+{
+ if (ditem->name != NULL)
+ g_free(ditem->name);
+
+ ditem->name = g_strdup(name);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : ditem = composant GTK à modifier. *
+* *
+* Description : Fournit la description du panneau dockable pour son titre. *
+* *
+* Retour : Etiquette à faire apparaître sur un onglet. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+const gchar *gtk_dock_item_get_desc(GtkDockItem *ditem)
+{
+ return ditem->name;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : ditem = composant GTK à modifier. *
+* panel = nouveau panneau à prendre en compte. *
+* *
+* Description : Change le panneau dockable associé à l'élément. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_dock_item_set_panel(GtkDockItem *ditem, GtkWidget *panel)
+{
+ if (ditem->panel != NULL)
+ gtk_widget_unref(ditem->panel);
+
+ ditem->panel = panel;
+ gtk_widget_ref(panel);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : ditem = composant GTK à modifier. *
+* *
+* Description : Fournit le panneau dockable associé à l'élément. *
+* *
+* Retour : Panneau actuellement associé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *gtk_dock_item_get_panel(GtkDockItem *ditem)
+{
+ return ditem->panel;
+
+}
diff --git a/src/gtkext/gtkdockitem.h b/src/gtkext/gtkdockitem.h
new file mode 100644
index 0000000..21ca360
--- /dev/null
+++ b/src/gtkext/gtkdockitem.h
@@ -0,0 +1,92 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkdockitem.h - prototypes pour la mémorisation des propriétés d'un panneau dockable
+ *
+ * Copyright (C) 2008 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GTKEXT_GTKDOCKITEM_H
+#define _GTKEXT_GTKDOCKITEM_H
+
+
+#include <gtk/gtk.h>
+
+
+G_BEGIN_DECLS
+
+
+#define GTK_TYPE_DOCK_ITEM (gtk_dock_item_get_type())
+#define GTK_DOCK_ITEM(obj) GTK_CHECK_CAST(obj, gtk_dock_item_get_type (), GtkDockItem)
+#define GTK_DOCK_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, gtk_dock_item_get_type(), GtkDockItemClass)
+#define GTK_IS_DOCK_ITEM(obj) GTK_CHECK_TYPE(obj, gtk_dock_item_get_type())
+
+
+typedef struct _GtkDockItem GtkDockItem;
+typedef struct _GtkDockItemClass GtkDockItemClass;
+
+
+
+
+struct _GtkDockItem
+{
+ GtkObject object; /* Présence obligatoire en 1er */
+
+ gchar *name; /* Nom court pour onglet */
+ GtkWidget *panel; /* Pnneau construit associé */
+
+};
+
+struct _GtkDockItemClass
+{
+ GtkVBoxClass parent_class; /* Présence obligatoire en 1er */
+
+};
+
+
+/* Détermine le type d'un panneau dockable. */
+GtkType gtk_dock_item_get_type(void);
+
+/* Crée une nouvelle mémorisation de panneau dockable. */
+GtkDockItem *gtk_dock_item_new(const gchar *, GtkWidget *);
+
+/* Change le nom du panneau dockable pour son onglet. */
+void gtk_dock_item_set_name(GtkDockItem *, const gchar *);
+
+/* Fournit le nom du panneau dockable pour son onglet. */
+const gchar *gtk_dock_item_get_name(GtkDockItem *);
+
+/* Change la description du panneau dockable pour son titre. */
+void gtk_dock_item_set_desc(GtkDockItem *, const gchar *);
+
+/* Fournit la description du panneau dockable pour son titre. */
+const gchar *gtk_dock_item_get_desc(GtkDockItem *);
+
+/* Change le panneau dockable associé à l'élément. */
+void gtk_dock_item_set_panel(GtkDockItem *, GtkWidget *);
+
+/* Fournit le panneau dockable associé à l'élément. */
+GtkWidget *gtk_dock_item_get_panel(GtkDockItem *);
+
+
+
+G_END_DECLS
+
+
+
+#endif /* _GTKEXT_GTKDOCKITEM_H */
diff --git a/src/gtkext/gtkdockpanel.c b/src/gtkext/gtkdockpanel.c
new file mode 100644
index 0000000..f48f31a
--- /dev/null
+++ b/src/gtkext/gtkdockpanel.c
@@ -0,0 +1,652 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkdockpanel.c - manipulation et affichage de panneaux dockables
+ *
+ * Copyright (C) 2008 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "gtkdockpanel.h"
+
+
+#include <malloc.h>
+#include <string.h>
+
+
+#include "gtkdropwindow.h"
+
+
+
+/* Valide ou non le terme d'un "Drag and drop". */
+static gboolean gtk_dock_panel_drag_drop_cb(GtkDockPanel *, GdkDragContext *, gint, gint, guint, gpointer);
+
+/* Procède au "Drag and drop" effectif. */
+static void gtk_dock_panel_drag_data_received_cb(GtkDockPanel *, GdkDragContext *, gint, gint, GtkSelectionData *, guint, guint, gpointer);
+
+/* Accompagne le déplacement sur une cible de "Drag and drop". */
+static gboolean gtk_dock_panel_drag_motion_cb(GtkDockPanel *, GdkDragContext *, gint, gint, guint, gpointer);
+
+/* Note la fin des visites sur une cible de "Drag and drop". */
+static void gtk_dock_panel_drag_leave_cb(GtkDockPanel *, GdkDragContext *, guint, gpointer);
+
+/* Procède au démarrage d'un "Drag and drop". */
+static void gtk_dock_panel_drag_begin_cb(GtkDockPanel *, GdkDragContext *, gpointer);
+
+/* Procède à l'envoi depuis la source à la destination. */
+static void gtk_dock_panel_drag_data_get_cb(GtkDockPanel *, GdkDragContext *, GtkSelectionData *, guint, guint, gpointer );
+
+/* Marque l'arrêt d'un "Drag and drop". */
+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);
+
+/* Met à jour le titre du support de panneaux dockables. */
+static gboolean gtk_dock_panel_update_title(GtkNotebook *, GtkNotebookPage *, guint, gpointer);
+
+
+
+/******************************************************************************/
+#define _BYTE 8
+#define _WORD 16
+#define _DWORD 32
+
+
+/******************************************************************************/
+/* Define a list of data types called "targets" that a destination widget will
+ * accept. The string type is arbitrary, and negotiated between DnD widgets by
+ * the developer. An enum or GQuark can serve as the integer target id. */
+enum {
+ TARGET_INT32,
+ TARGET_STRING,
+ TARGET_DOCKITEM,
+ TARGET_ROOTWIN
+};
+
+/* datatype (string), restrictions on DnD (GtkTargetFlags), datatype (int) */
+static GtkTargetEntry target_list[] = {
+ { "INTEGER", 0, TARGET_INT32 },
+ { "STRING", 0, TARGET_STRING },
+ { "OpenIDA/dock-item", 0, TARGET_DOCKITEM },
+ { "application/x-rootwindow-drop", 0, TARGET_ROOTWIN }
+};
+
+static guint n_targets = G_N_ELEMENTS (target_list);
+
+
+
+
+
+
+
+/* Détermine le type du composant d'affichage des morceaux. */
+G_DEFINE_TYPE(GtkDockPanel, gtk_dock_panel, GTK_TYPE_VBOX)
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : class = classe GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'afficheur de morceaux. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_panel_class_init(GtkDockPanelClass *class)
+{
+
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de la station dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_panel_init(GtkDockPanel *dpanel)
+{
+
+ GtkWidget *eventbox1;
+ GtkWidget *hbox1;
+ GtkWidget *button1;
+ GtkWidget *image1;
+ GtkWidget *button2;
+ GtkWidget *image2;
+
+
+
+ eventbox1 = gtk_event_box_new ();
+ gtk_widget_show (eventbox1);
+ gtk_box_pack_start (GTK_BOX (dpanel), eventbox1, FALSE, TRUE, 0);
+
+ hbox1 = gtk_hbox_new (FALSE, 0);
+ gtk_widget_show (hbox1);
+ gtk_container_add (GTK_CONTAINER (eventbox1), hbox1);
+
+ dpanel->title = GTK_LABEL(gtk_label_new(("<b>titre</b>")));
+ gtk_widget_show(GTK_WIDGET(dpanel->title));
+ gtk_box_pack_start(GTK_BOX (hbox1), GTK_WIDGET(dpanel->title), TRUE, TRUE, 0);
+ gtk_label_set_use_markup(GTK_LABEL(dpanel->title), TRUE);
+ gtk_misc_set_alignment(GTK_MISC(dpanel->title), 0, 0.5);
+
+ button1 = gtk_button_new ();
+ gtk_widget_show (button1);
+ gtk_box_pack_start (GTK_BOX (hbox1), button1, FALSE, FALSE, 0);
+ gtk_button_set_relief (GTK_BUTTON (button1), GTK_RELIEF_NONE);
+
+ image1 = gtk_image_new_from_stock ("gtk-media-play", GTK_ICON_SIZE_MENU);
+ gtk_widget_show (image1);
+ gtk_container_add (GTK_CONTAINER (button1), image1);
+ gtk_widget_set_size_request (image1, 10, 10);
+
+ button2 = gtk_button_new ();
+ gtk_widget_show (button2);
+ gtk_box_pack_start (GTK_BOX (hbox1), button2, FALSE, FALSE, 0);
+ gtk_button_set_relief (GTK_BUTTON (button2), GTK_RELIEF_NONE);
+
+ image2 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU);
+ gtk_widget_show (image2);
+ gtk_container_add (GTK_CONTAINER (button2), image2);
+ gtk_widget_set_size_request (image2, 10, 10);
+
+ dpanel->notebook = gtk_notebook_new ();
+ gtk_widget_show (dpanel->notebook);
+ gtk_box_pack_start (GTK_BOX (dpanel), dpanel->notebook, TRUE, TRUE, 0);
+ gtk_notebook_set_show_border (GTK_NOTEBOOK (dpanel->notebook), FALSE);
+ gtk_notebook_set_tab_pos (GTK_NOTEBOOK (dpanel->notebook), GTK_POS_BOTTOM);
+ gtk_notebook_set_scrollable (GTK_NOTEBOOK (dpanel->notebook), TRUE);
+
+
+
+
+ /* Make the "well label" a DnD destination. */
+ gtk_drag_dest_set
+ (
+ GTK_WIDGET(dpanel), /* widget that will accept a drop */
+ GTK_DEST_DEFAULT_MOTION /* default actions for dest on DnD */
+ | GTK_DEST_DEFAULT_HIGHLIGHT,
+ target_list, /* lists of target to support */
+ n_targets, /* size of list */
+ GDK_ACTION_COPY /* what to do with data after dropped */
+ );
+
+ /* Make the "coin button" a DnD source. */
+ /* Why doesn't GtkLabel work here? */
+ gtk_drag_source_set
+ (
+ GTK_WIDGET(dpanel), /* widget will be drag-able */
+ GDK_BUTTON1_MASK, /* modifier that will start a drag */
+ target_list, /* lists of target to support */
+ n_targets, /* size of list */
+ GDK_ACTION_COPY /* what to do with data after dropped */
+ );
+
+
+ /* Côté destination */
+ g_signal_connect(dpanel, "drag-drop", G_CALLBACK(gtk_dock_panel_drag_drop_cb), NULL);
+ g_signal_connect(dpanel, "drag-data-received", G_CALLBACK(gtk_dock_panel_drag_data_received_cb), NULL);
+ g_signal_connect(dpanel, "drag-motion", G_CALLBACK(gtk_dock_panel_drag_motion_cb), NULL);
+ g_signal_connect(dpanel, "drag-leave", G_CALLBACK(gtk_dock_panel_drag_leave_cb), NULL);
+
+ /* Côté source */
+ g_signal_connect(dpanel, "drag-begin", G_CALLBACK(gtk_dock_panel_drag_begin_cb), NULL);
+ g_signal_connect(dpanel, "drag-data-get", G_CALLBACK(gtk_dock_panel_drag_data_get_cb), NULL);
+ g_signal_connect(dpanel, "drag-end", G_CALLBACK(gtk_dock_panel_drag_end_cb), NULL);
+ //g_signal_connect(dpanel, "drag-data-delete", G_CALLBACK(gtk_dock_panel_drag_data_delete_cb), NULL);
+
+
+ g_signal_connect(dpanel->notebook, "switch-page", G_CALLBACK(gtk_dock_panel_update_title), dpanel);
+
+
+
+
+ dpanel->dropwin = gtk_drop_window_new();
+
+
+
+ /* Make the "well label" a DnD destination. */
+ gtk_drag_dest_set
+ (
+ dpanel->dropwin, /* widget that will accept a drop */
+ GTK_DEST_DEFAULT_MOTION /* default actions for dest on DnD */
+ | GTK_DEST_DEFAULT_HIGHLIGHT,
+ target_list, /* lists of target to support */
+ n_targets, /* size of list */
+ GDK_ACTION_COPY /* what to do with data after dropped */
+ );
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un nouveau composant pour station dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *gtk_dock_panel_new(void)
+{
+ return g_object_new(GTK_TYPE_DOCK_PANEL, NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant à l'origine de la manoeuvre. *
+* context = contexte de l'opération de "Drag and drop". *
+* x = abscisse du pointeur relaché. *
+* y = ordonnée du pointeur relaché. *
+* time = date de l'opération. *
+* data = adresse non utilisée ici. *
+* *
+* Description : Valide ou non le terme d'un "Drag and drop". *
+* *
+* Retour : TRUE si l'opération peut continuer, FALSE sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static gboolean gtk_dock_panel_drag_drop_cb(GtkDockPanel *dpanel, GdkDragContext *context, gint x, gint y, guint time, gpointer data)
+{
+ gboolean result; /* Ordre à retourner */
+ GdkAtom target; /* Type d'élément à déplacer */
+
+ result = (context->targets != NULL);
+
+ printf(" ## DRAG DROP ## %p\n", dpanel);
+
+ if (context->targets != NULL)
+ {
+ target = GDK_POINTER_TO_ATOM(g_list_nth_data(context->targets, TARGET_DOCKITEM));
+ gtk_drag_get_data(GTK_WIDGET(dpanel), context, target, time);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant à l'origine de la manoeuvre. *
+* context = contexte de l'opération de "Drag and drop". *
+* x = abscisse du pointeur relaché. *
+* y = ordonnée du pointeur relaché. *
+* selection = réceptacle pour la transmission. *
+* target = type de données demandé. *
+* time = date de l'opération. *
+* data = adresse non utilisée ici. *
+* *
+* Description : Procède au "Drag and drop" effectif. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_panel_drag_data_received_cb(GtkDockPanel *dpanel, GdkDragContext *context, gint x, gint y, GtkSelectionData *selection, guint target, guint time, gpointer data)
+{
+ GtkDockItem *ditem; /* Elément transféré */
+ gboolean success; /* Bilan de l'opération */
+
+ success = FALSE;
+
+ if (selection != NULL && selection->length >= 0)
+ switch (target)
+ {
+ case TARGET_DOCKITEM:
+ success = (selection->length == sizeof(GtkDockItem *));
+
+ printf(" ## DRAG DATA RCV ## %p\n", dpanel);
+
+ printf(" -- source :: %p\n", gtk_drag_get_source_widget(context));
+ printf(" -- dest :: %p\n", dpanel);
+
+ if (success)
+ {
+ ditem = GTK_DOCK_ITEM(*((GtkDockItem **)selection->data));
+
+ printf(" :: get ? %p - %d\n", ditem, GTK_IS_DOCK_ITEM(ditem));
+
+ gtk_dock_panel_remove_item(gtk_drag_get_source_widget(context), ditem);
+ gtk_dock_panel_add_item(dpanel, ditem);
+
+ }
+
+ break;
+
+ }
+
+ gtk_drag_finish(context, success, context->action == GDK_ACTION_MOVE, time);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant à l'origine de la manoeuvre. *
+* context = contexte de l'opération de "Drag and drop". *
+* x = abscisse du pointeur relaché. *
+* y = ordonnée du pointeur relaché. *
+* time = date de l'opération. *
+* data = adresse non utilisée ici. *
+* *
+* Description : Accompagne le déplacement sur une cible de "Drag and drop". *
+* *
+* Retour : TRUE pour continuer la propagation, FALSE sinon. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static gboolean gtk_dock_panel_drag_motion_cb(GtkDockPanel *dpanel, GdkDragContext *context, gint x, gint y, guint time, gpointer data)
+{
+ gint new_x; /* Abscisse de la fenêtre */
+ gint new_y; /* Ordonnée de la fenêtre */
+ GtkRequisition req; /* Taille actuelle du panneau */
+
+ if (!GTK_WIDGET_VISIBLE(dpanel->dropwin))
+ {
+ gdk_window_get_origin(GTK_WIDGET(dpanel)->window, &new_x, &new_y);
+
+ new_x += GTK_WIDGET(dpanel)->allocation.x + (GTK_WIDGET(dpanel)->allocation.width - 89) / 2;
+ new_y += GTK_WIDGET(dpanel)->allocation.y + (GTK_WIDGET(dpanel)->allocation.height - 89) / 2;
+
+ gtk_widget_set_uposition(dpanel->dropwin, new_x, new_y);
+
+ gtk_widget_show(dpanel->dropwin);
+
+ }
+
+ return FALSE;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant à l'origine de la manoeuvre. *
+* context = contexte de l'opération de "Drag and drop". *
+* x = abscisse du pointeur relaché. *
+* y = ordonnée du pointeur relaché. *
+* time = date de l'opération. *
+* data = adresse non utilisée ici. *
+* *
+* Description : Note la fin des visites sur une cible de "Drag and drop". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_panel_drag_leave_cb(GtkDockPanel *dpanel, GdkDragContext *context, guint time, gpointer data)
+{
+ gtk_widget_hide(dpanel->dropwin);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant à l'origine de la manoeuvre. *
+* context = contexte de l'opération de "Drag and drop". *
+* data = adresse non utilisée ici. *
+* *
+* Description : Procède au démarrage d'un "Drag and drop". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_panel_drag_begin_cb(GtkDockPanel *dpanel, GdkDragContext *context, gpointer data)
+{
+ printf(" ## DRAG BEGIN ## %p\n", dpanel);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant à l'origine de la manoeuvre. *
+* context = contexte de l'opération de "Drag and drop". *
+* selection = réceptacle pour la transmission. *
+* target = type de données demandé. *
+* time = date de l'opération. *
+* data = adresse non utilisée ici. *
+* *
+* Description : Procède à l'envoi depuis la source à la destination. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_panel_drag_data_get_cb(GtkDockPanel *dpanel, GdkDragContext *context, GtkSelectionData *selection, guint target, guint time, gpointer data)
+{
+ gint current; /* Indice de l'onglet courant */
+ GtkDockItem *ditem; /* Elément à transférer */
+
+ switch (target)
+ {
+ case TARGET_DOCKITEM:
+
+ printf(" ## DRAG GET DATA ## %p\n", dpanel);
+
+ current = gtk_notebook_get_current_page(dpanel->notebook);
+
+ ditem = GTK_DOCK_ITEM(g_list_nth_data(dpanel->ditems, current));
+
+ printf(" %d nth item is %p\n", current, ditem);
+
+ printf(" :: set ? %p - %d\n", ditem, GTK_IS_DOCK_ITEM(ditem));
+
+ gtk_selection_data_set(selection, selection->target,
+ 32, (guchar *)&ditem, sizeof(GtkDockItem *));
+
+ break;
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant à l'origine de la manoeuvre. *
+* context = contexte de l'opération de "Drag and drop". *
+* data = adresse non utilisée ici. *
+* *
+* Description : Marque l'arrêt d'un "Drag and drop". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_panel_drag_end_cb(GtkDockPanel *dpanel, GdkDragContext *context, gpointer data)
+{
+ printf(" ## DRAG END ## %p\n", dpanel);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant à l'origine de la manoeuvre. *
+* context = contexte de l'opération de "Drag and drop". *
+* data = adresse non utilisée ici. *
+* *
+* Description : Nettoie les traces d'un "Drag and drop". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_dock_panel_drag_data_delete_cb(GtkDockPanel *dpanel, GdkDragContext *context, gpointer data)
+{
+
+
+
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant GTK à compléter. *
+* ditem = nouvel élément à intégrer. *
+* *
+* Description : Ajoute un paquet d'informations à la station dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_dock_panel_add_item(GtkDockPanel *dpanel, GtkDockItem *ditem)
+{
+ GtkWidget *label; /* Etiquette d'onglet */
+
+ dpanel->ditems = g_list_append(dpanel->ditems, ditem);
+
+ 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_set_show_tabs(dpanel->notebook, g_list_length(dpanel->ditems) > 1);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dpanel = composant GTK à mettre à jour. *
+* ditem = nouvel élément à sortir. *
+* *
+* Description : Supprime un paquet d'informations à la station dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_dock_panel_remove_item(GtkDockPanel *dpanel, GtkDockItem *ditem)
+{
+ gint pos; /* Position de l'élément visé */
+
+ 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_container_remove(GTK_CONTAINER(dpanel->notebook), gtk_dock_item_get_panel(ditem));
+
+ //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. *
+* data = adresse du conteneur supérieur. *
+* *
+* Description : Met à jour le titre du support de panneaux dockables. *
+* *
+* Retour : TRUE ? *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static gboolean gtk_dock_panel_update_title(GtkNotebook *notebook, GtkNotebookPage *page, guint index, gpointer data)
+{
+ GtkDockItem *ditem; /* Elément nouvellement actif */
+ const gchar *desc; /* Description à afficher */
+ char *str; /* Valeur finale reconstituée */
+
+
+ printf("[%p] list len :: %u / %u\n", data, index, g_list_length(GTK_DOCK_PANEL(data)->ditems));
+
+ if (index >= g_list_length(GTK_DOCK_PANEL(data)->ditems)) return FALSE;
+
+ printf(" >> ditem = %p\n", g_list_nth_data(GTK_DOCK_PANEL(data)->ditems, index));
+
+ printf(" >> index :: %u vs %d\n", index, gtk_notebook_get_current_page(GTK_DOCK_PANEL(data)->notebook));
+
+ ditem = GTK_DOCK_ITEM(g_list_nth_data(GTK_DOCK_PANEL(data)->ditems, index));
+
+ desc = gtk_dock_item_get_desc(ditem);
+ if (desc == NULL) desc = gtk_dock_item_get_name(ditem);
+
+ str = calloc(strlen("<b>") + strlen(desc) + strlen("</b>") + 1, sizeof(char));
+
+ strcpy(str, "<b>");
+ strcat(str, desc);
+ strcat(str, "</b>");
+
+ gtk_label_set_markup(GTK_DOCK_PANEL(data)->title, str);
+
+ free(str);
+
+ return TRUE;
+
+}
diff --git a/src/gtkext/gtkdockpanel.h b/src/gtkext/gtkdockpanel.h
new file mode 100644
index 0000000..140f812
--- /dev/null
+++ b/src/gtkext/gtkdockpanel.h
@@ -0,0 +1,88 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkdockpanel.h - prototypes pour la manipulation et l'affichage de panneaux dockables
+ *
+ * Copyright (C) 2008 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GTKEXT_GTKDOCKPANEL_H
+#define _GTKEXT_GTKDOCKPANEL_H
+
+
+#include <gtk/gtk.h>
+
+
+#include "gtkdockitem.h"
+
+
+
+G_BEGIN_DECLS
+
+
+
+#define GTK_TYPE_DOCK_PANEL (gtk_dock_panel_get_type())
+#define GTK_DOCK_PANEL(obj) GTK_CHECK_CAST(obj, gtk_dock_panel_get_type (), GtkDockPanel)
+#define GTK_DOCK_PANEL_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, gtk_dock_panel_get_type(), GtkDockPanelClass)
+#define GTK_IS_DOCK_PANEL(obj) GTK_CHECK_TYPE(obj, gtk_dock_panel_get_type())
+
+
+typedef struct _GtkDockPanel GtkDockPanel;
+typedef struct _GtkDockPanelClass GtkDockPanelClass;
+
+
+
+struct _GtkDockPanel
+{
+ GtkVBox vbox; /* Présence obligatoire en 1er */
+
+ GtkLabel *title; /* Title du support principal */
+
+ GtkNotebook *notebook; /* Support à onglets */
+ GList *ditems; /* Panneaux intégrés */
+
+ GtkWidget *dropwin; /* Destination des Drag'n Drop */
+
+};
+
+struct _GtkDockPanelClass
+{
+ GtkVBoxClass parent_class; /* Présence obligatoire en 1er */
+
+};
+
+
+/* Détermine le type du composant d'affichage des morceaux. */
+GtkType gtk_dock_panel_get_type(void);
+
+/* Crée un nouveau composant pour station dockable. */
+GtkWidget *gtk_dock_panel_new(void);
+
+/* Ajoute un paquet d'informations à la station dockable. */
+void gtk_dock_panel_add_item(GtkDockPanel *, GtkDockItem *);
+
+/* Supprime un paquet d'informations à la station dockable. */
+void gtk_dock_panel_remove_item(GtkDockPanel *, GtkDockItem *);
+
+
+
+G_END_DECLS
+
+
+
+#endif /* _GTKEXT_GTKDOCKPANEL_H */
diff --git a/src/gtkext/gtkdropwindow.c b/src/gtkext/gtkdropwindow.c
new file mode 100644
index 0000000..b2013f4
--- /dev/null
+++ b/src/gtkext/gtkdropwindow.c
@@ -0,0 +1,150 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkdropwindow.c - fenêtre de sélection de zone de destination pour dock
+ *
+ * Copyright (C) 2008 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "gtkdropwindow.h"
+
+
+
+
+
+/* Accompagne le premier affichage de la fenêtre d'affichage. */
+static void gtk_drop_window_realize_cb(GtkDropWindow *, gpointer);
+
+
+
+
+/* Détermine le type de fenêtre d'affichage pour destination de DnD. */
+G_DEFINE_TYPE(GtkDropWindow, gtk_drop_window, GTK_TYPE_WINDOW)
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : class = classe GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de la fenêtre d'affichage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_drop_window_class_init(GtkDropWindowClass *class)
+{
+
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dropwin = composant GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de la fenêtre d'affichage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_drop_window_init(GtkDropWindow *dropwin)
+{
+ gtk_widget_set_size_request(GTK_WIDGET(dropwin), 89, 89);
+ gtk_window_set_decorated(GTK_WINDOW(dropwin), FALSE);
+
+ g_signal_connect(dropwin, "realize", G_CALLBACK(gtk_drop_window_realize_cb), NULL);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : dropwin = composant GTK à initialiser. *
+* data = adresse non utilisée ici. *
+* *
+* Description : Accompagne le premier affichage de la fenêtre d'affichage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_drop_window_realize_cb(GtkDropWindow *dropwin, gpointer data)
+{
+ gchar *filename; /* Fichier d'image à charger */
+ GdkPixbuf *pixbuf; /* Données de l'image de fond */
+ GdkPixmap *pixmap; /* Données de l'image à rendre */
+ GdkBitmap *mask; /* Zone utile de l'image */
+ GtkStyle *style; /* Apparence de la fenêtre */
+
+ gdk_window_set_opacity(GTK_WIDGET(dropwin)->window, 0.5);
+
+ filename = find_pixmap_file("dropwin_back.png");
+
+ if (filename != NULL)
+ {
+ pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
+
+ if (GDK_IS_PIXBUF(pixbuf))
+ {
+ gdk_pixbuf_render_pixmap_and_mask(pixbuf, &pixmap, &mask, 1);
+
+ style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(dropwin)));
+ style->bg_pixmap[GTK_STATE_NORMAL] = pixmap;
+ gtk_widget_set_style(GTK_WIDGET(dropwin), style);
+
+ gdk_window_shape_combine_mask(GTK_WIDGET(dropwin)->window, mask, 0, 0);
+
+ }
+
+ g_free(filename);
+
+ }
+
+ gdk_window_clear(GTK_WIDGET(dropwin)->window);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un nouveau composant pour station dockable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *gtk_drop_window_new(void)
+{
+ return g_object_new(GTK_TYPE_DROP_WINDOW, NULL);
+
+}
diff --git a/src/gtkext/gtkdropwindow.h b/src/gtkext/gtkdropwindow.h
new file mode 100644
index 0000000..c74a18d
--- /dev/null
+++ b/src/gtkext/gtkdropwindow.h
@@ -0,0 +1,72 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkdropwindow.h - prototypes pour la fenêtre de sélection de zone de destination pour dock
+ *
+ * Copyright (C) 2008 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 Foobar. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GTKEXT_GTKDROPWINDOW_H
+#define _GTKEXT_GTKDROPWINDOW_H
+
+
+#include <gtk/gtk.h>
+
+
+
+G_BEGIN_DECLS
+
+
+
+#define GTK_TYPE_DROP_WINDOW (gtk_drop_window_get_type())
+#define GTK_DROP_WINDOW(obj) GTK_CHECK_CAST(obj, gtk_drop_window_get_type (), GtkDropWindow)
+#define GTK_DROP_WINDOW_CLASS(klass) GTK_CHECK_CLASS_CAST(klass, gtk_drop_window_get_type(), GtkDropWindowClass)
+#define GTK_IS_DROP_WINDOW(obj) GTK_CHECK_TYPE(obj, gtk_drop_window_get_type())
+
+
+typedef struct _GtkDropWindow GtkDropWindow;
+typedef struct _GtkDropWindowClass GtkDropWindowClass;
+
+
+
+struct _GtkDropWindow
+{
+ GtkWindow window; /* Présence obligatoire en 1er */
+
+};
+
+struct _GtkDropWindowClass
+{
+ GtkWindowClass parent_class; /* Présence obligatoire en 1er */
+
+};
+
+
+/* Détermine le type de fenêtre d'affichage pour destination de DnD. */
+GtkType gtk_drop_window_get_type(void);
+
+/* Crée un nouveau composant pour station dockable. */
+GtkWidget *gtk_drop_window_new(void);
+
+
+
+G_END_DECLS
+
+
+
+#endif /* _GTKEXT_GTKDROPWINDOW_H */
diff --git a/src/support.c b/src/support.c
new file mode 100644
index 0000000..67e7605
--- /dev/null
+++ b/src/support.c
@@ -0,0 +1,92 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * support.c - recherche des chemins d'accès aux fichiers
+ *
+ * Copyright (C) 2008-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 "support.h"
+
+
+#include <glib.h>
+#include <string.h>
+
+
+
+/* Liste des répertoires contenant des images */
+static GList *pixmaps_directories = NULL;
+
+
+
+/******************************************************************************
+* *
+* Paramètres : directory = nouveau répertoire à parcourir. *
+* *
+* Description : Ajoute un répertoire à la liste des répertoires d'images. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void add_pixmap_directory(const char *directory)
+{
+ pixmaps_directories = g_list_prepend(pixmaps_directories,
+ strdup(directory));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : filename = nom de fichier seul comme indice. *
+* *
+* Description : Trouve le chemin d'accès complet à un fichier donné. *
+* *
+* Retour : Chemin trouvé à libérer de la mémoire ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+gchar *find_pixmap_file(const char *filename)
+{
+ gchar *result; /* Trouvaille à renvoyer */
+ GList *iter; /* Boucle de parcours */
+
+ result = NULL;
+
+ for (iter = pixmaps_directories; iter != NULL && result == NULL; iter = iter->next)
+ {
+ result = g_strdup_printf("%s%s%s", (gchar *)iter->data,
+ G_DIR_SEPARATOR_S, filename);
+
+ if (!g_file_test(result, G_FILE_TEST_EXISTS))
+ {
+ g_free(result);
+ result = NULL;
+ }
+
+ }
+
+ return result;
+
+}
diff --git a/src/support.h b/src/support.h
new file mode 100644
index 0000000..9d3373b
--- /dev/null
+++ b/src/support.h
@@ -0,0 +1,41 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * support.h - prototypes pour la recherche des chemins d'accès aux fichiers
+ *
+ * Copyright (C) 2008-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 _SUPPORT_H
+#define _SUPPORT_H
+
+
+#include <gtk/gtk.h>
+
+
+
+/* Ajoute un répertoire à la liste des répertoires d'images. */
+void add_pixmap_directory(const char *);
+
+/* Trouve le chemin d'accès complet à un fichier donné. */
+gchar *find_pixmap_file(const char *);
+
+
+
+#endif /* _SUPPORT_H */