summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog48
-rw-r--r--plugins/pychrysa/glibext/Makefile.am1
-rw-r--r--plugins/pychrysa/glibext/loadedpanel.c166
-rw-r--r--plugins/pychrysa/glibext/loadedpanel.h42
-rw-r--r--plugins/pychrysa/glibext/module.c2
-rw-r--r--src/analysis/db/items/move.c4
-rw-r--r--src/glibext/Makefile.am2
-rw-r--r--src/glibext/gloadedpanel-int.h51
-rw-r--r--src/glibext/gloadedpanel.c81
-rw-r--r--src/glibext/gloadedpanel.h56
-rw-r--r--src/glibext/linegen.h2
-rw-r--r--src/gtkext/gtkdisplaypanel-int.h2
-rw-r--r--src/gtkext/gtkdisplaypanel.c34
-rw-r--r--src/gtkext/gtkdisplaypanel.h11
-rw-r--r--src/gtkext/gtkgraphdisplay.c5
-rw-r--r--src/gui/core/global.c8
-rw-r--r--src/gui/core/global.h6
-rw-r--r--src/gui/core/items.c67
-rw-r--r--src/gui/core/items.h6
-rw-r--r--src/gui/editem-int.h4
-rw-r--r--src/gui/editem.c25
-rw-r--r--src/gui/editem.h6
-rw-r--r--src/gui/editor.c2
-rw-r--r--src/gui/menus/binary.c7
-rw-r--r--src/gui/menus/edition.c35
-rw-r--r--src/gui/menus/menubar.c2
-rw-r--r--src/gui/menus/view.c2
-rw-r--r--src/gui/panels/bintree.c11
-rw-r--r--src/gui/panels/bookmarks.c18
-rw-r--r--src/gui/panels/errors.c11
-rw-r--r--src/gui/panels/glance.c46
-rw-r--r--src/gui/panels/strings.c25
-rw-r--r--src/gui/panels/symbols.c11
-rw-r--r--src/gui/tb/portions.c5
34 files changed, 675 insertions, 129 deletions
diff --git a/ChangeLog b/ChangeLog
index eb5c3c2..5c44bdf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+17-11-12 Cyrille Bagard <nocbos@gmail.com>
+
+ * plugins/pychrysa/glibext/Makefile.am:
+ Add the 'loadedpanel.[ch]' files to libpychrysaglibext_la_SOURCES.
+
+ * plugins/pychrysa/glibext/loadedpanel.c:
+ * plugins/pychrysa/glibext/loadedpanel.h:
+ New entries: extend the Python bindings.
+
+ * plugins/pychrysa/glibext/module.c:
+ * src/analysis/db/items/move.c:
+
+ * src/glibext/Makefile.am:
+ Add the 'gloadedpanel*[ch]' files to libglibext_la_SOURCES.
+
+ * src/glibext/gloadedpanel-int.h:
+ * src/glibext/gloadedpanel.c:
+ * src/glibext/gloadedpanel.h:
+ New entries: define a new interface for displaying loaded contents.
+
+ * src/glibext/linegen.h:
+ Typo.
+
+ * src/gtkext/gtkdisplaypanel-int.h:
+ * src/gtkext/gtkdisplaypanel.c:
+ * src/gtkext/gtkdisplaypanel.h:
+ * src/gtkext/gtkgraphdisplay.c:
+ * src/gui/core/global.c:
+ * src/gui/core/global.h:
+ * src/gui/core/items.c:
+ * src/gui/core/items.h:
+ * src/gui/editem-int.h:
+ * src/gui/editem.c:
+ * src/gui/editem.h:
+ * src/gui/editor.c:
+ * src/gui/menus/binary.c:
+ * src/gui/menus/edition.c:
+ * src/gui/menus/menubar.c:
+ * src/gui/menus/view.c:
+ * src/gui/panels/bintree.c:
+ * src/gui/panels/bookmarks.c:
+ * src/gui/panels/errors.c:
+ * src/gui/panels/glance.c:
+ * src/gui/panels/strings.c:
+ * src/gui/panels/symbols.c:
+ * src/gui/tb/portions.c:
+ Update code.
+
17-10-25 Cyrille Bagard <nocbos@gmail.com>
* plugins/pychrysa/pychrysa.c:
diff --git a/plugins/pychrysa/glibext/Makefile.am b/plugins/pychrysa/glibext/Makefile.am
index d1b2569..e4d5243 100644
--- a/plugins/pychrysa/glibext/Makefile.am
+++ b/plugins/pychrysa/glibext/Makefile.am
@@ -6,6 +6,7 @@ libpychrysaglibext_la_SOURCES = \
bufferline.h bufferline.c \
configuration.h configuration.c \
linegen.h linegen.c \
+ loadedpanel.h loadedpanel.c \
module.h module.c
diff --git a/plugins/pychrysa/glibext/loadedpanel.c b/plugins/pychrysa/glibext/loadedpanel.c
new file mode 100644
index 0000000..f831607
--- /dev/null
+++ b/plugins/pychrysa/glibext/loadedpanel.c
@@ -0,0 +1,166 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * loadedpanel.c - équivalent Python du fichier "glibext/gloadedpanel.h"
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 "loadedpanel.h"
+
+
+#include <pygobject.h>
+
+
+#include <glibext/gloadedpanel.h>
+
+
+
+
+/* Retrouve l'emplacement correspondant à une position donnée. */
+//static PyObject *py_loaded_panel_compute_addr(PyObject *, PyObject *);
+
+
+
+
+#if 0
+
+
+/******************************************************************************
+* *
+* Paramètres : self = classe représentant un générateur à manipuler. *
+* args = arguments fournis à l'appel. *
+* *
+* Description : Retrouve l'emplacement correspondant à une position donnée. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_loaded_panel_compute_addr(PyObject *self, PyObject *args)
+{
+ PyObject *result; /* Localisation à retourner */
+ GLineGenerator *generator; /* Version native */
+ gint x; /* Position géographique */
+ size_t index; /* Indice dans le tampon */
+ size_t repeat; /* Utilisations successives */
+ int ret; /* Bilan de lecture des args. */
+ vmpa2t addr; /* Adresse visée par l'opérat° */
+
+ generator = G_LOADED_PANEL(pygobject_get(self));
+
+ ret = PyArg_ParseTuple(args, "ikk", &x, &index, &repeat);
+ if (!ret) return NULL;
+
+ g_loaded_panel_compute_addr(generator, x, &addr, index, repeat);
+
+ result = build_from_internal_vmpa(&addr);
+
+ return result;
+
+}
+
+#endif
+
+
+
+
+
+
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit un accès à une définition de type à diffuser. *
+* *
+* Retour : Définition d'objet pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyTypeObject *get_python_loaded_panel_type(void)
+{
+ static PyMethodDef py_loaded_panel_methods[] = {
+ /*
+ {
+ "compute_addr", py_loaded_panel_compute_addr,
+ METH_VARARGS,
+ "compute_addr($self, x, index, repeat, /)\n--\n\nReturn the position at a given location."
+ },
+ */
+ { NULL }
+ };
+
+ static PyGetSetDef py_loaded_panel_getseters[] = {
+ { NULL }
+ };
+
+ static PyTypeObject py_loaded_panel_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.glibext.LoadedPanel",
+ //.tp_basicsize = sizeof(PyGObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+
+ .tp_doc = "PyChrysalide loaded panel",
+
+ .tp_methods = py_loaded_panel_methods,
+ .tp_getset = py_loaded_panel_getseters,
+
+ };
+
+ return &py_loaded_panel_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide.glibext.LoadedPanel'. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool register_python_loaded_panel(PyObject *module)
+{
+ PyTypeObject *py_loaded_panel_type; /* Type Python 'LineGenerator' */
+ PyObject *dict; /* Dictionnaire du module */
+
+ py_loaded_panel_type = get_python_loaded_panel_type();
+
+ dict = PyModule_GetDict(module);
+ pyg_register_interface(dict, "LoadedPanel", G_TYPE_LOADED_PANEL, py_loaded_panel_type);
+
+ return true;
+
+}
diff --git a/plugins/pychrysa/glibext/loadedpanel.h b/plugins/pychrysa/glibext/loadedpanel.h
new file mode 100644
index 0000000..a133983
--- /dev/null
+++ b/plugins/pychrysa/glibext/loadedpanel.h
@@ -0,0 +1,42 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * loadedpanel.h - prototypes pour l'équivalent Python du fichier "glibext/gloadedpanel.h"
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 _PLUGINS_PYCHRYSA_GLIBEXT_LOADEDPANEL_H
+#define _PLUGINS_PYCHRYSA_GLIBEXT_LOADEDPANEL_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_loaded_panel_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.glibext.LoadedPanel'. */
+bool register_python_loaded_panel(PyObject *);
+
+
+
+#endif /* _PLUGINS_PYCHRYSA_GLIBEXT_LOADEDPANEL_H */
diff --git a/plugins/pychrysa/glibext/module.c b/plugins/pychrysa/glibext/module.c
index 01a2cc8..a3b0a25 100644
--- a/plugins/pychrysa/glibext/module.c
+++ b/plugins/pychrysa/glibext/module.c
@@ -32,6 +32,7 @@
#include "bufferline.h"
#include "configuration.h"
#include "linegen.h"
+#include "loadedpanel.h"
#include "../access.h"
@@ -88,6 +89,7 @@ bool add_glibext_module_to_python_module(PyObject *super)
result &= register_python_config_param_iterator(module);
result &= register_python_generic_config(module);
result &= register_python_line_generator(module);
+ result &= register_python_loaded_panel(module);
if (result)
register_access_to_python_module("pychrysalide.glibext", module);
diff --git a/src/analysis/db/items/move.c b/src/analysis/db/items/move.c
index 562d749..4162e9f 100644
--- a/src/analysis/db/items/move.c
+++ b/src/analysis/db/items/move.c
@@ -447,11 +447,11 @@ static bool g_db_move_run(const GDbMove *move, const vmpa2t *addr)
panel = get_current_view();
- if (panel != NULL)
+ if (GTK_IS_DISPLAY_PANEL(panel))
{
params = (move_params *)calloc(1, sizeof(move_params));
- params->panel = panel;
+ params->panel = GTK_DISPLAY_PANEL(panel);
copy_vmpa(&params->addr, addr);
diff --git a/src/glibext/Makefile.am b/src/glibext/Makefile.am
index fe7565a..9fdc09b 100644
--- a/src/glibext/Makefile.am
+++ b/src/glibext/Makefile.am
@@ -12,6 +12,8 @@ libglibext_la_SOURCES = \
gbuffercache.h gbuffercache.c \
gbufferline.h gbufferline.c \
gbufferview.h gbufferview.c \
+ gloadedpanel-int.h \
+ gloadedpanel.h gloadedpanel.c \
gnhash.h gnhash.c \
gwidthtracker.h gwidthtracker.c \
linecolumn.h linecolumn.c \
diff --git a/src/glibext/gloadedpanel-int.h b/src/glibext/gloadedpanel-int.h
new file mode 100644
index 0000000..8686d1b
--- /dev/null
+++ b/src/glibext/gloadedpanel-int.h
@@ -0,0 +1,51 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * gloadedpanel-int.h - définitions internes propres à l'affichage de contenus chargés
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 _GLIBEXT_GLOADEDPANEL_INT_H
+#define _GLIBEXT_GLOADEDPANEL_INT_H
+
+
+#include "gloadedpanel.h"
+
+
+
+/* Place en cache un rendu destiné à l'aperçu graphique rapide. */
+typedef void (* cache_loaded_glance_fc) (GLoadedPanel *, cairo_t *, const GtkAllocation *, double);
+
+
+/* Intermédiaire pour la génération de lignes (interface) */
+struct _GLoadedPanelIface
+{
+ GTypeInterface base_iface; /* A laisser en premier */
+
+ cache_loaded_glance_fc cache_glance; /* Cache de la mignature */
+
+};
+
+
+/* Redéfinition */
+typedef GLoadedPanelIface GLoadedPanelInterface;
+
+
+
+#endif /* _GLIBEXT_GLOADEDPANEL_INT_H */
diff --git a/src/glibext/gloadedpanel.c b/src/glibext/gloadedpanel.c
new file mode 100644
index 0000000..fa12ec7
--- /dev/null
+++ b/src/glibext/gloadedpanel.c
@@ -0,0 +1,81 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * gloadedpanel.c - affichage de contenus chargés
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 "gloadedpanel.h"
+
+
+#include "gloadedpanel-int.h"
+
+
+
+/* Procède à l'initialisation de l'interface d'affichage. */
+static void g_loaded_panel_default_init(GLoadedPanelInterface *);
+
+
+
+/* Détermine le type du composant d'affichage basique. */
+G_DEFINE_INTERFACE(GLoadedPanel, g_loaded_panel, G_TYPE_OBJECT)
+
+
+/******************************************************************************
+* *
+* Paramètres : iface = interface GLib à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'interface d'affichage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_loaded_panel_default_init(GLoadedPanelInterface *iface)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = composant GTK à manipuler. *
+* cairo = assistant pour la création de rendus. *
+* area = taille de la surface réduite à disposition. *
+* scale = échelle vis à vis de la taille réelle. *
+* *
+* Description : Place en cache un rendu destiné à l'aperçu graphique rapide. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_loaded_panel_cache_glance(GLoadedPanel *panel, cairo_t *cairo, const GtkAllocation *area, double scale)
+{
+ GLoadedPanelIface *iface; /* Interface utilisée */
+
+ iface = G_LOADED_PANEL_GET_IFACE(panel);
+
+ iface->cache_glance(panel, cairo, area, scale);
+
+}
diff --git a/src/glibext/gloadedpanel.h b/src/glibext/gloadedpanel.h
new file mode 100644
index 0000000..51f4f36
--- /dev/null
+++ b/src/glibext/gloadedpanel.h
@@ -0,0 +1,56 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * gloadedpanel.h - prototypes pour l'affichage de contenus chargés
+ *
+ * Copyright (C) 2017 Cyrille Bagard
+ *
+ * This file is part of Chrysalide.
+ *
+ * Chrysalide 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.
+ *
+ * Chrysalide 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 _GLIBEXT_LOADEDPANEL_H
+#define _GLIBEXT_LOADEDPANEL_H
+
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+
+
+#define G_TYPE_LOADED_PANEL (g_loaded_panel_get_type())
+#define G_LOADED_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_LOADED_PANEL, GLoadedPanel))
+#define G_LOADED_PANEL_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST((vtable), G_TYPE_LOADED_PANEL, GLoadedPanelIface))
+#define GTK_IS_LOADED_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_LOADED_PANEL))
+#define GTK_IS_LOADED_PANEL_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE((vtable), G_TYPE_LOADED_PANEL))
+#define G_LOADED_PANEL_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE((inst), G_TYPE_LOADED_PANEL, GLoadedPanelIface))
+
+
+/* Composant d'affichage basique (coquille vide) */
+typedef struct _GLoadedPanel GLoadedPanel;
+
+/* Composant d'affichage basique (interface) */
+typedef struct _GLoadedPanelIface GLoadedPanelIface;
+
+
+/* Détermine le type d'une interface pour la mise en place de lignes. */
+GType g_loaded_panel_get_type(void) G_GNUC_CONST;
+
+/* Place en cache un rendu destiné à l'aperçu graphique rapide. */
+void g_loaded_panel_cache_glance(GLoadedPanel *, cairo_t *, const GtkAllocation *, double);
+
+
+
+#endif /* _GLIBEXT_LOADEDPANEL_H */
diff --git a/src/glibext/linegen.h b/src/glibext/linegen.h
index 2045cb8..22b964f 100644
--- a/src/glibext/linegen.h
+++ b/src/glibext/linegen.h
@@ -25,6 +25,8 @@
#define _GLIBEXT_LINEGEN_H
+#include <glib-object.h>
+
#include "gbufferline.h"
#include "../analysis/content.h"
diff --git a/src/gtkext/gtkdisplaypanel-int.h b/src/gtkext/gtkdisplaypanel-int.h
index 38c76b4..a2170e7 100644
--- a/src/gtkext/gtkdisplaypanel-int.h
+++ b/src/gtkext/gtkdisplaypanel-int.h
@@ -1,6 +1,6 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
- * gtkdisplaypanel-int.h - définitions internes propre à l'affichage de contenu de binaire
+ * gtkdisplaypanel-int.h - définitions internes propres à l'affichage de contenus de binaire
*
* Copyright (C) 2016-2017 Cyrille Bagard
*
diff --git a/src/gtkext/gtkdisplaypanel.c b/src/gtkext/gtkdisplaypanel.c
index be84006..003ac5f 100644
--- a/src/gtkext/gtkdisplaypanel.c
+++ b/src/gtkext/gtkdisplaypanel.c
@@ -1,6 +1,6 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
- * gtkdisplaypanel.c - affichage de contenu de binaire
+ * gtkdisplaypanel.c - affichage de contenus de binaire
*
* Copyright (C) 2016-2017 Cyrille Bagard
*
@@ -28,6 +28,8 @@
#include "gtkdisplaypanel-int.h"
+#include "../glibext/gloadedpanel-int.h"
+
/* Amplitude de l'arrondi pour les coins */
@@ -40,6 +42,9 @@ static void gtk_display_panel_class_init(GtkDisplayPanelClass *);
/* Procède à l'initialisation de l'afficheur générique. */
static void gtk_display_panel_init(GtkDisplayPanel *);
+/* Procède à l'initialisation de l'interface d'affichage. */
+static void gtk_display_panel_loaded_interface_init(GLoadedPanelInterface *);
+
/* Définit une propriété du composant d'affichage. */
static void gtk_display_panel_set_property(GObject *, guint, const GValue *, GParamSpec *);
@@ -82,11 +87,15 @@ static void gtk_display_panel_adjustment_value_changed(GtkAdjustment *, GtkDispl
/* Réagit à un changement des règles d'affichage. */
static void on_view_panel_binary_display_change(GLoadedBinary *, BinaryView, BufferLineColumn, GtkDisplayPanel *);
+/* Place en cache un rendu destiné à l'aperçu graphique rapide. */
+static void gtk_display_panel_cache_glance(GtkDisplayPanel *, cairo_t *, const GtkAllocation *, double);
+
/* Détermine le type du composant d'affichage générique. */
G_DEFINE_TYPE_WITH_CODE(GtkDisplayPanel, gtk_display_panel, GTK_TYPE_FIXED,
- G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, NULL))
+ G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, NULL)
+ G_IMPLEMENT_INTERFACE(G_TYPE_LOADED_PANEL, gtk_display_panel_loaded_interface_init));
/******************************************************************************
@@ -169,6 +178,25 @@ static void gtk_display_panel_init(GtkDisplayPanel *panel)
/******************************************************************************
* *
+* Paramètres : iface = interface GLib à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'interface d'affichage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_display_panel_loaded_interface_init(GLoadedPanelInterface *iface)
+{
+ iface->cache_glance = (cache_loaded_glance_fc)gtk_display_panel_cache_glance;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : object = instance de composant GTK à manipuler. *
* prop_id = identifiant de la propriété concernée. *
* value = valeur attribuée. *
@@ -1052,7 +1080,7 @@ bool gtk_display_panel_get_position(const GtkDisplayPanel *panel, GBufferLine **
* *
******************************************************************************/
-void gtk_display_panel_cache_glance(GtkDisplayPanel *panel, cairo_t *cairo, const GtkAllocation *area, double scale)
+static void gtk_display_panel_cache_glance(GtkDisplayPanel *panel, cairo_t *cairo, const GtkAllocation *area, double scale)
{
if (GTK_DISPLAY_PANEL_GET_CLASS(panel)->cache_glance != NULL)
GTK_DISPLAY_PANEL_GET_CLASS(panel)->cache_glance(panel, cairo, area, scale);
diff --git a/src/gtkext/gtkdisplaypanel.h b/src/gtkext/gtkdisplaypanel.h
index 7cb2aeb..3ea967a 100644
--- a/src/gtkext/gtkdisplaypanel.h
+++ b/src/gtkext/gtkdisplaypanel.h
@@ -1,6 +1,6 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
- * gtkdisplaypanel.h - prototypes pour l'affichage de contenu de binaire
+ * gtkdisplaypanel.h - prototypes pour l'affichage de contenus de binaire
*
* Copyright (C) 2016-2017 Cyrille Bagard
*
@@ -21,8 +21,8 @@
*/
-#ifndef _GTK_DISPLAYPANEL_H
-#define _GTK_DISPLAYPANEL_H
+#ifndef _GTKEXT_DISPLAYPANEL_H
+#define _GTKEXT_DISPLAYPANEL_H
#include <glib-object.h>
@@ -97,9 +97,6 @@ void gtk_display_panel_request_move(GtkDisplayPanel *, const vmpa2t *);
/* Fournit des éléments liés à la position courante dans la vue. */
bool gtk_display_panel_get_position(const GtkDisplayPanel *, GBufferLine **, GObject **);
-/* Place en cache un rendu destiné à l'aperçu graphique rapide. */
-void gtk_display_panel_cache_glance(GtkDisplayPanel *, cairo_t *, const GtkAllocation *, double);
-
-#endif /* _GTK_DISPLAYPANEL_H */
+#endif /* _GTKEXT_DISPLAYPANEL_H */
diff --git a/src/gtkext/gtkgraphdisplay.c b/src/gtkext/gtkgraphdisplay.c
index 4d11050..9c6933e 100644
--- a/src/gtkext/gtkgraphdisplay.c
+++ b/src/gtkext/gtkgraphdisplay.c
@@ -33,6 +33,7 @@
#include "graph/cluster.h"
#include "../analysis/routine.h"
#include "../format/format.h"
+#include "../glibext/gloadedpanel.h"
#include "../gui/core/items.h"
@@ -683,7 +684,7 @@ static void gtk_graph_display_define_main_address(GtkGraphDisplay *display, cons
ggddma_done:
- change_editor_items_current_view_content(GTK_DISPLAY_PANEL(display));
+ change_editor_items_current_view_content(G_LOADED_PANEL(display));
g_object_unref(G_OBJECT(format));
@@ -823,7 +824,7 @@ static void gtk_graph_display_cache_glance(GtkGraphDisplay *display, cairo_t *cr
sub_area.width = sub_area.width * scale + 1;
sub_area.height = sub_area.height * scale + 1;
- gtk_display_panel_cache_glance(GTK_DISPLAY_PANEL(child), cr, &sub_area, scale);
+ g_loaded_panel_cache_glance(G_LOADED_PANEL(child), cr, &sub_area, scale);
}
diff --git a/src/gui/core/global.c b/src/gui/core/global.c
index b4001c6..0d0ec92 100644
--- a/src/gui/core/global.c
+++ b/src/gui/core/global.c
@@ -37,7 +37,7 @@ static GLoadedBinary *_current_binary = NULL;
G_LOCK_DEFINE_STATIC(_cb_mutex);
/* Suivi du panneau d'affichage courant ou NULL */
-static GtkDisplayPanel *_current_view = NULL;
+static GLoadedPanel *_current_view = NULL;
G_LOCK_DEFINE_STATIC(_cv_mutex);
@@ -192,7 +192,7 @@ GLoadedBinary *get_current_binary(void)
* *
******************************************************************************/
-void set_current_view(GtkDisplayPanel *view)
+void set_current_view(GLoadedPanel *view)
{
G_LOCK(_cv_mutex);
@@ -218,9 +218,9 @@ void set_current_view(GtkDisplayPanel *view)
* *
******************************************************************************/
-GtkDisplayPanel *get_current_view(void)
+GLoadedPanel *get_current_view(void)
{
- GtkDisplayPanel *result; /* Instance à retourner */
+ GLoadedPanel *result; /* Instance à retourner */
G_LOCK(_cv_mutex);
diff --git a/src/gui/core/global.h b/src/gui/core/global.h
index e69f743..68aeb8a 100644
--- a/src/gui/core/global.h
+++ b/src/gui/core/global.h
@@ -26,7 +26,7 @@
#include "../../analysis/binary.h"
-#include "../../gtkext/gtkdisplaypanel.h"
+#include "../../glibext/gloadedpanel.h"
#include "../../gtkext/gtkstatusstack.h"
@@ -50,10 +50,10 @@ void set_current_binary(GLoadedBinary *);
GLoadedBinary *get_current_binary(void);
/* Définit l'affichage de binaire courant. */
-void set_current_view(GtkDisplayPanel *);
+void set_current_view(GLoadedPanel *);
/* Fournit l'affichage de binaire courant. */
-GtkDisplayPanel *get_current_view(void);
+GLoadedPanel *get_current_view(void);
/* Définit le support contenant la position active. */
void set_caret_instance(GObject *);
diff --git a/src/gui/core/items.c b/src/gui/core/items.c
index 923a565..ce60bcb 100644
--- a/src/gui/core/items.c
+++ b/src/gui/core/items.c
@@ -35,7 +35,7 @@ static GEditorItem *_editem_list = NULL;
/* Suit les changements de focus des panneaux d'affichage. */
-static gboolean notify_view_panel_focus_change(GtkDisplayPanel *, GdkEventFocus *, gpointer);
+static gboolean notify_view_panel_focus_change(GLoadedPanel *, GdkEventFocus *, gpointer);
/* Lance une procédure de déplacement de la position courante. */
static void start_moving_to_address_in_view_panel(GtkDisplayPanel *, const vmpa2t *, gpointer);
@@ -109,18 +109,13 @@ void change_editor_items_current_binary(GLoadedBinary *binary)
* *
******************************************************************************/
-static gboolean notify_view_panel_focus_change(GtkDisplayPanel *panel, GdkEventFocus *event, gpointer unused)
+static gboolean notify_view_panel_focus_change(GLoadedPanel *panel, GdkEventFocus *event, gpointer unused)
{
GEditorItem *iter; /* Boucle de parcours */
- GEditorItemClass *klass; /* Classe correspondante */
editem_list_for_each(iter, _editem_list)
{
- klass = G_EDITOR_ITEM_GET_CLASS(iter);
-
- if (klass->notify_focus != NULL)
- klass->notify_focus(iter, event->in ? panel : NULL);
-
+ notify_focus_change_for_editor_item(iter, event->in ? panel : NULL);
}
return FALSE;
@@ -210,9 +205,9 @@ static void track_caret_address_on_view_panel(GtkDisplayPanel *panel, const vmpa
* *
******************************************************************************/
-void change_editor_items_current_view(GtkDisplayPanel *panel)
+void change_editor_items_current_view(GLoadedPanel *panel)
{
- GtkDisplayPanel *view; /* Affichage actif */
+ GLoadedPanel *view; /* Affichage actif */
GEditorItem *iter; /* Boucle de parcours */
GEditorItemClass *klass; /* Classe correspondante */
GObject *caret; /* Support du curseur actif */
@@ -249,36 +244,40 @@ void change_editor_items_current_view(GtkDisplayPanel *panel)
/* Suivi du curseur */
- caret = get_caret_instance();
-
- if (caret != NULL)
+ if (GTK_IS_DISPLAY_PANEL(panel))
{
- g_signal_handlers_disconnect_by_func(caret,
- G_CALLBACK(start_moving_to_address_in_view_panel),
- NULL);
- g_signal_handlers_disconnect_by_func(caret,
- G_CALLBACK(track_caret_address_on_view_panel),
- NULL);
+ caret = get_caret_instance();
- set_caret_instance(NULL);
- g_object_unref(caret);
+ if (caret != NULL)
+ {
+ g_signal_handlers_disconnect_by_func(caret,
+ G_CALLBACK(start_moving_to_address_in_view_panel),
+ NULL);
+ g_signal_handlers_disconnect_by_func(caret,
+ G_CALLBACK(track_caret_address_on_view_panel),
+ NULL);
- }
+ set_caret_instance(NULL);
+ g_object_unref(caret);
- if (panel != NULL)
- {
- g_signal_connect(panel, "move-request",
- G_CALLBACK(start_moving_to_address_in_view_panel),
- NULL);
+ }
+
+ if (panel != NULL)
+ {
+ g_signal_connect(panel, "move-request",
+ G_CALLBACK(start_moving_to_address_in_view_panel),
+ NULL);
+
+ g_signal_connect(panel, "caret-moved",
+ G_CALLBACK(track_caret_address_on_view_panel),
+ NULL);
- g_signal_connect(panel, "caret-moved",
- G_CALLBACK(track_caret_address_on_view_panel),
- NULL);
+ caret = G_OBJECT(panel);
- caret = G_OBJECT(panel);
+ g_object_ref(caret);
+ set_caret_instance(caret);
- g_object_ref(caret);
- set_caret_instance(caret);
+ }
}
@@ -297,7 +296,7 @@ void change_editor_items_current_view(GtkDisplayPanel *panel)
* *
******************************************************************************/
-void change_editor_items_current_view_content(GtkDisplayPanel *panel)
+void change_editor_items_current_view_content(GLoadedPanel *panel)
{
GEditorItem *iter; /* Boucle de parcours */
GEditorItemClass *klass; /* Classe correspondante */
diff --git a/src/gui/core/items.h b/src/gui/core/items.h
index fc73b5e..13c3d9c 100644
--- a/src/gui/core/items.h
+++ b/src/gui/core/items.h
@@ -28,7 +28,7 @@
#include "../editem.h"
#include "../../analysis/binary.h"
#include "../../analysis/project.h"
-#include "../../gtkext/gtkdisplaypanel.h"
+#include "../../glibext/gloadedpanel.h"
@@ -39,10 +39,10 @@ void register_editor_item(GEditorItem *);
void change_editor_items_current_binary(GLoadedBinary *);
/* Lance une actualisation du fait d'un changement de vue. */
-void change_editor_items_current_view(GtkDisplayPanel *);
+void change_editor_items_current_view(GLoadedPanel *);
/* Lance une actualisation du fait d'un changement de contenu. */
-void change_editor_items_current_view_content(GtkDisplayPanel *);
+void change_editor_items_current_view_content(GLoadedPanel *);
/* Concentre l'attention de l'ensemble sur une adresse donnée. */
void focus_address_in_editor_items(GLoadedBinary *, const vmpa2t *, GEditorItem *);
diff --git a/src/gui/editem-int.h b/src/gui/editem-int.h
index 69b0181..a70cc87 100644
--- a/src/gui/editem-int.h
+++ b/src/gui/editem-int.h
@@ -41,10 +41,10 @@
typedef void (* update_item_binary_fc) (GEditorItem *, GLoadedBinary *);
/* Réagit à un changement d'affichage principal de contenu. */
-typedef void (* update_item_view_fc) (GEditorItem *, GtkDisplayPanel *);
+typedef void (* update_item_view_fc) (GEditorItem *, GLoadedPanel *);
/* Réagit à un changement de focus des panneaux d'affichage. */
-typedef void (* notify_focus_change_fc) (GEditorItem *, GtkDisplayPanel *);
+typedef void (* notify_focus_change_fc) (GEditorItem *, GLoadedPanel *);
/* Suit les changements de position dans du code d'assembleur. */
typedef void (* track_caret_in_view_fc) (GEditorItem *, GtkDisplayPanel *, const vmpa2t *);
diff --git a/src/gui/editem.c b/src/gui/editem.c
index 4848cc9..bf3dfa6 100644
--- a/src/gui/editem.c
+++ b/src/gui/editem.c
@@ -132,3 +132,28 @@ GtkWidget *g_editor_item_get_widget(const GEditorItem *item)
return item->widget;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : bar = instance à actualiser. *
+* panel = composant d'affichage concerné par l'opération. *
+* *
+* Description : Réagit à un changement de focus des panneaux d'affichage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void notify_focus_change_for_editor_item(GEditorItem *item, GLoadedPanel *panel)
+{
+ GEditorItemClass *klass; /* Classe correspondante */
+
+ klass = G_EDITOR_ITEM_GET_CLASS(item);
+
+ if (klass->notify_focus != NULL)
+ klass->notify_focus(item, panel);
+
+}
diff --git a/src/gui/editem.h b/src/gui/editem.h
index 476299b..f102d5c 100644
--- a/src/gui/editem.h
+++ b/src/gui/editem.h
@@ -30,6 +30,9 @@
#include <gtk/gtk.h>
+#include "../glibext/gloadedpanel.h"
+
+
#define G_TYPE_EDITOR_ITEM g_editor_item_get_type()
#define G_EDITOR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_editor_item_get_type(), GEditorItem))
@@ -58,6 +61,9 @@ const char *g_editor_item_get_name(const GEditorItem *);
/* Fournit le composant GTK associé à l'élément réactif. */
GtkWidget *g_editor_item_get_widget(const GEditorItem *);
+/* Réagit à un changement de focus des panneaux d'affichage. */
+void notify_focus_change_for_editor_item(GEditorItem *, GLoadedPanel *);
+
#endif /* _GUI_EDITEM_H */
diff --git a/src/gui/editor.c b/src/gui/editor.c
index d44d2af..2488a27 100644
--- a/src/gui/editor.c
+++ b/src/gui/editor.c
@@ -1385,7 +1385,7 @@ static void on_dock_item_switch(GtkDockStation *station, GtkWidget *widget, gpoi
g_object_unref(G_OBJECT(old_binary));
g_object_ref(G_OBJECT(widget));
- change_editor_items_current_view(GTK_DISPLAY_PANEL(widget));
+ change_editor_items_current_view(G_LOADED_PANEL(widget));
}
diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c
index e67c377..b7be1b9 100644
--- a/src/gui/menus/binary.c
+++ b/src/gui/menus/binary.c
@@ -160,7 +160,7 @@ static void mcb_binary_entry_points(GtkMenuItem *menuitem, GMenuBar *bar)
GLoadedBinary *binary; /* Binaire présenté à l'écran */
GtkWidget *dialog; /* Boîte de dialogue à montrer */
vmpa2t *addr; /* Adresse de destination */
- GtkDisplayPanel *panel; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
item = G_EDITOR_ITEM(bar);
@@ -174,7 +174,10 @@ static void mcb_binary_entry_points(GtkMenuItem *menuitem, GMenuBar *bar)
addr = get_address_from_gotox_dialog(dialog);
panel = get_current_view();
- gtk_display_panel_request_move(panel, addr);
+
+ if (GTK_IS_DISPLAY_PANEL(panel))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
+
g_object_unref(G_OBJECT(panel));
delete_vmpa(addr);
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index 2491e3d..848d04c 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -313,7 +313,7 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
GObject *ref; /* Espace de référencements */
GtkWidget *dialog; /* Boîte de dialogue à montrer */
vmpa2t *addr; /* Adresse de destination */
- GtkDisplayPanel *panel; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar));
dialog = create_goto_dialog(GTK_WINDOW(ref));
@@ -323,7 +323,10 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
addr = get_address_from_goto_dialog(dialog);
panel = get_current_view();
- gtk_display_panel_request_move(panel, addr);
+
+ if (GTK_IS_DISPLAY_PANEL(panel))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
+
g_object_unref(G_OBJECT(panel));
delete_vmpa(addr);
@@ -351,7 +354,7 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, gpointer unused)
{
ImmOperandDisplay display; /* Type de basculement */
- GtkDisplayPanel *panel; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
GBufferLine *line; /* Ligne de position courante */
GObject *creator; /* Créateur à l'orgine du seg. */
GDbSwitcher *switcher; /* Bascule à mettre en place */
@@ -364,7 +367,8 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, gpointer u
panel = get_current_view();
- if (gtk_display_panel_get_position(panel, &line, &creator))
+ if (GTK_IS_DISPLAY_PANEL(panel)
+ && gtk_display_panel_get_position(GTK_DISPLAY_PANEL(panel), &line, &creator))
{
assert(G_IS_IMM_OPERAND(creator));
@@ -429,7 +433,7 @@ static void mcb_edition_go_back(GtkMenuItem *menuitem, GMenuBar *bar)
static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused)
{
- GtkDisplayPanel *panel; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
GBufferLine *line; /* Ligne de position courante */
GObject *creator; /* Créateur à l'orgine du seg. */
bool defined; /* Adresse définie ? */
@@ -438,7 +442,8 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused)
panel = get_current_view();
- if (gtk_display_panel_get_position(panel, &line, &creator))
+ if (GTK_IS_DISPLAY_PANEL(panel)
+ && gtk_display_panel_get_position(GTK_DISPLAY_PANEL(panel), &line, &creator))
{
assert(creator != NULL);
@@ -460,7 +465,7 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused)
}
if (defined)
- gtk_display_panel_request_move(panel, &addr);
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), &addr);
g_object_unref(creator);
g_object_unref(G_OBJECT(line));
@@ -487,7 +492,7 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused)
static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
{
- GtkDisplayPanel *panel; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
GBufferLine *line; /* Ligne de position courante */
const mrange_t *range; /* Couverture en mémoire */
GLoadedBinary *binary; /* Représentation binaire */
@@ -499,7 +504,8 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
panel = get_current_view();
- if (gtk_display_panel_get_position(panel, &line, NULL))
+ if (GTK_IS_DISPLAY_PANEL(panel)
+ && gtk_display_panel_get_position(GTK_DISPLAY_PANEL(panel), &line, NULL))
{
range = g_buffer_line_get_range(line);
@@ -524,7 +530,7 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
{
addr = get_address_from_gotox_dialog(dialog);
- gtk_display_panel_request_move(panel, addr);
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
delete_vmpa(addr);
@@ -562,7 +568,7 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar)
{
- GtkDisplayPanel *panel; /* Vue offrant l'affichage */
+ GLoadedPanel *panel; /* Vue offrant l'affichage */
const vmpa2t *curloc; /* Localisation d'un curseur */
GLoadedBinary *binary; /* Binaire en cours d'étude */
GDbCollection *collec; /* Collection à manipuler */
@@ -576,7 +582,10 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar)
panel = get_current_view();
- curloc = gtk_display_panel_get_caret_location(panel);
+ if (!GTK_IS_DISPLAY_PANEL(panel))
+ goto done_with_panel;
+
+ curloc = gtk_display_panel_get_caret_location(GTK_DISPLAY_PANEL(panel));
/* Accès à la collection */
@@ -638,6 +647,8 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar)
g_object_unref(G_OBJECT(collec));
g_object_unref(G_OBJECT(binary));
+ done_with_panel:
+
g_object_unref(G_OBJECT(panel));
}
diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c
index 56540e9..32a8f20 100644
--- a/src/gui/menus/menubar.c
+++ b/src/gui/menus/menubar.c
@@ -295,7 +295,7 @@ static void update_menu_bar_for_view(GMenuBar *bar, GtkDisplayPanel *panel)
/******************************************************************************
* *
-* Paramètres : bar = barre de menus à actualiser. *
+* Paramètres : bar = barre de menus à actualiser. *
* panel = composant d'affichage concerné par l'opération. *
* *
* Description : Réagit à un changement de focus des panneaux d'affichage. *
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index 5298af3..4298805 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -494,7 +494,7 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, gpointer unused)
gtk_dock_panel_change_active_widget(station, scroll);
- change_editor_items_current_view(new);
+ change_editor_items_current_view(G_LOADED_PANEL(new));
g_object_unref(G_OBJECT(panel));
diff --git a/src/gui/panels/bintree.c b/src/gui/panels/bintree.c
index b7c31c1..89e2ae1 100644
--- a/src/gui/panels/bintree.c
+++ b/src/gui/panels/bintree.c
@@ -703,7 +703,7 @@ static void on_bintree_selection_changed(GtkTreeSelection *selection, gpointer u
GtkTreeModel *model; /* Modèle de gestion */
GBinPortion *portion; /* Portion à traiter */
const mrange_t *range; /* Couverture dudit symbole */
- GtkDisplayPanel *display; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
@@ -713,9 +713,12 @@ static void on_bintree_selection_changed(GtkTreeSelection *selection, gpointer u
{
range = g_binary_portion_get_range(portion);
- display = get_current_view();
- gtk_display_panel_request_move(display, get_mrange_addr(range));
- g_object_unref(G_OBJECT(display));
+ panel = get_current_view();
+
+ if (GTK_IS_DISPLAY_PANEL(panel))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), get_mrange_addr(range));
+
+ g_object_unref(G_OBJECT(panel));
g_object_unref(G_OBJECT(portion));
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c
index 20d2bd0..27655cd 100644
--- a/src/gui/panels/bookmarks.c
+++ b/src/gui/panels/bookmarks.c
@@ -663,7 +663,7 @@ static void on_bookmarks_selection_change(GtkTreeSelection *selection, gpointer
GtkTreeModel *model; /* Modèle de gestion */
GDbBookmark *bookmark; /* Signet en cours d'étude */
const vmpa2t *addr; /* Adressse associée au signet */
- GtkDisplayPanel *display; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
@@ -671,9 +671,12 @@ static void on_bookmarks_selection_change(GtkTreeSelection *selection, gpointer
addr = g_db_bookmark_get_address(bookmark);
- display = get_current_view();
- gtk_display_panel_request_move(display, addr);
- g_object_unref(G_OBJECT(display));
+ panel = get_current_view();
+
+ if (GTK_IS_DISPLAY_PANEL(panel))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
+
+ g_object_unref(G_OBJECT(panel));
g_object_unref(G_OBJECT(bookmark));
@@ -1049,7 +1052,7 @@ static gboolean on_button_press_over_bookmarks(GtkWidget *widget, GdkEventButton
GtkTreeModel *model; /* Modèle de gestion */
GDbBookmark *bookmark; /* Signet en cours d'étude */
const vmpa2t *addr; /* Adressse associée au signet */
- GtkDisplayPanel *display; /* Afficheur effectif de code */
+ GLoadedPanel *display; /* Afficheur effectif de code */
switch (event->button)
{
@@ -1064,7 +1067,10 @@ static gboolean on_button_press_over_bookmarks(GtkWidget *widget, GdkEventButton
addr = g_db_bookmark_get_address(bookmark);
display = get_current_view();
- gtk_display_panel_request_move(display, addr);
+
+ if (GTK_IS_DISPLAY_PANEL(display))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(display), addr);
+
g_object_unref(G_OBJECT(display));
g_object_unref(G_OBJECT(bookmark));
diff --git a/src/gui/panels/errors.c b/src/gui/panels/errors.c
index 1c2c54f..57fedaf 100644
--- a/src/gui/panels/errors.c
+++ b/src/gui/panels/errors.c
@@ -950,7 +950,7 @@ static void on_error_selection_changed(GtkTreeSelection *selection, gpointer unu
GtkTreeIter iter; /* Point de sélection */
GtkTreeModel *model; /* Modèle de gestion */
vmpa2t *addr; /* Localisation à suivre */
- GtkDisplayPanel *display; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
@@ -958,9 +958,12 @@ static void on_error_selection_changed(GtkTreeSelection *selection, gpointer unu
if (addr != NULL)
{
- display = get_current_view();
- gtk_display_panel_request_move(display, addr);
- g_object_unref(G_OBJECT(display));
+ panel = get_current_view();
+
+ if (GTK_IS_DISPLAY_PANEL(panel))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
+
+ g_object_unref(G_OBJECT(panel));
delete_vmpa(addr);
diff --git a/src/gui/panels/glance.c b/src/gui/panels/glance.c
index 27d3b46..c58f3b6 100644
--- a/src/gui/panels/glance.c
+++ b/src/gui/panels/glance.c
@@ -38,7 +38,7 @@ struct _GGlancePanel
{
GPanelItem parent; /* A laisser en premier */
- GtkDisplayPanel *display; /* Vue à représenter */
+ GLoadedPanel *view; /* Vue à représenter */
GtkRequisition req; /* Pleine taille de la source */
GtkScrolledWindow *support; /* Support défilant associé */
@@ -87,7 +87,7 @@ static void g_glance_panel_dispose(GGlancePanel *);
static void g_glance_panel_finalize(GGlancePanel *);
/* Lance une actualisation du fait d'un changement de support. */
-static void update_glance_panel_for_view(GGlancePanel *, GtkDisplayPanel *);
+static void update_glance_panel_for_view(GGlancePanel *, GLoadedPanel *);
/* Réagit à la préparation du défilement du support original. */
static void on_view_scroll_setup(GtkAdjustment *, GGlancePanel *);
@@ -102,7 +102,7 @@ static void on_glance_resize(GtkWidget *, GdkRectangle *, GGlancePanel *);
static void compute_glance_scale(GGlancePanel *);
/* Lance une actualisation du fait d'un changement de vue. */
-static void update_glance_panel_for_view_content(GGlancePanel *, GtkDisplayPanel *);
+static void update_glance_panel_for_view_content(GGlancePanel *, GLoadedPanel *);
/* Met à jour l'affichage de l'aperçu rapide à présenter. */
static gboolean redraw_glance_area(GtkWidget *, cairo_t *, GGlancePanel *);
@@ -281,8 +281,8 @@ GPanelItem *g_glance_panel_new(void)
/******************************************************************************
* *
-* Paramètres : panel = panneau à actualiser. *
-* display = nouveau panneau d'affichage actif. *
+* Paramètres : panel = panneau à actualiser. *
+* view = nouveau panneau d'affichage actif. *
* *
* Description : Lance une actualisation du fait d'un changement de support. *
* *
@@ -292,15 +292,15 @@ GPanelItem *g_glance_panel_new(void)
* *
******************************************************************************/
-static void update_glance_panel_for_view(GGlancePanel *panel, GtkDisplayPanel *display)
+static void update_glance_panel_for_view(GGlancePanel *panel, GLoadedPanel *view)
{
GtkWidget *parent; /* Support défilant de la vue */
GtkAdjustment *adj; /* Gestionnaire du défilement */
- if (panel->display != NULL)
+ if (panel->view != NULL)
{
- g_object_unref(panel->display);
- panel->display = NULL;
+ g_object_unref(panel->view);
+ panel->view = NULL;
g_object_unref(panel->support);
panel->support = NULL;
@@ -318,11 +318,11 @@ static void update_glance_panel_for_view(GGlancePanel *panel, GtkDisplayPanel *d
* de la fonction mcb_view_change_support().
*/
- parent = gtk_widget_get_parent(GTK_WIDGET(display));
+ parent = gtk_widget_get_parent(GTK_WIDGET(view));
if (!GTK_IS_SCROLLED_WINDOW(parent)) return;
- panel->display = display;
- g_object_ref(panel->display);
+ panel->view = view;
+ g_object_ref(panel->view);
panel->support = GTK_SCROLLED_WINDOW(parent);
g_object_ref(panel->support);
@@ -362,13 +362,13 @@ static void on_view_scroll_setup(GtkAdjustment *adj, GGlancePanel *panel)
if (gtk_adjustment_get_page_size(hadj) == 0 || gtk_adjustment_get_page_size(vadj) == 0)
return;
- gtk_widget_get_preferred_size(GTK_WIDGET(panel->display), NULL, &panel->req);
+ gtk_widget_get_preferred_size(GTK_WIDGET(panel->view), NULL, &panel->req);
compute_glance_scale(panel);
on_view_scrolled(adj, panel);
- update_glance_panel_for_view_content(panel, panel->display);
+ update_glance_panel_for_view_content(panel, panel->view);
}
@@ -423,10 +423,10 @@ static void on_view_scrolled(GtkAdjustment *adj, GGlancePanel *panel)
static void on_glance_resize(GtkWidget *widget, GdkRectangle *allocation, GGlancePanel *panel)
{
- if (panel->display != NULL)
+ if (panel->view != NULL)
{
on_view_scroll_setup(NULL, panel);
- update_glance_panel_for_view_content(panel, panel->display);
+ update_glance_panel_for_view_content(panel, panel->view);
}
}
@@ -508,8 +508,8 @@ static void compute_glance_scale(GGlancePanel *panel)
/******************************************************************************
* *
-* Paramètres : panel = panneau à actualiser. *
-* display = nouveau panneau d'affichage actif. *
+* Paramètres : panel = panneau à actualiser. *
+* view = nouveau panneau d'affichage actif. *
* *
* Description : Lance une actualisation du fait d'un changement de vue. *
* *
@@ -519,7 +519,7 @@ static void compute_glance_scale(GGlancePanel *panel)
* *
******************************************************************************/
-static void update_glance_panel_for_view_content(GGlancePanel *panel, GtkDisplayPanel *display)
+static void update_glance_panel_for_view_content(GGlancePanel *panel, GLoadedPanel *view)
{
cairo_t *cairo; /* Assistant pour le dessin */
GtkAllocation area; /* Dimension de la surface */
@@ -542,7 +542,7 @@ static void update_glance_panel_for_view_content(GGlancePanel *panel, GtkDisplay
area.width = panel->painting.width;
area.height = panel->painting.height;
- gtk_display_panel_cache_glance(display, cairo, &area, panel->scale);
+ g_loaded_panel_cache_glance(view, cairo, &area, panel->scale);
cairo_destroy(cairo);
@@ -708,7 +708,7 @@ static gboolean on_button_press_over_glance(GtkWidget *widget, GdkEventButton *e
GtkAdjustment *vadj; /* Gestionnaire du défilement */
GdkCursor *cursor; /* Pointeur pour la surface */
- if (panel->display != NULL && event->button == 1)
+ if (panel->view != NULL && event->button == 1)
{
panel->start_x = event->x;
panel->start_y = event->y;
@@ -754,7 +754,7 @@ static gboolean on_button_press_over_glance(GtkWidget *widget, GdkEventButton *e
static gboolean on_button_release_over_glance(GtkWidget *widget, GdkEventButton *event, GGlancePanel *panel)
{
- if (panel->display != NULL && event->button == 1)
+ if (panel->view != NULL && event->button == 1)
{
if (panel->valid)
gdk_window_set_cursor(gtk_widget_get_window(widget), NULL);
@@ -788,7 +788,7 @@ static gboolean on_mouse_motion_over_glance(GtkWidget *widget, GdkEventMotion *e
GtkAdjustment *vadj; /* Gestionnaire du défilement */
gdouble value; /* Nouvelle valeur bornée */
- if (panel->display != NULL && event->state & GDK_BUTTON1_MASK && panel->valid)
+ if (panel->view != NULL && event->state & GDK_BUTTON1_MASK && panel->valid)
{
diff_x = (event->x - panel->start_x) / panel->scale;
diff_y = (event->y - panel->start_y) / panel->scale;
diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c
index 6ae44b1..23383a1 100644
--- a/src/gui/panels/strings.c
+++ b/src/gui/panels/strings.c
@@ -589,7 +589,7 @@ static void on_strings_selection_change(GtkTreeSelection *selection, gpointer un
GtkTreeModel *model; /* Modèle de gestion */
GBinSymbol *symbol; /* Symbole en cours d'étude */
const vmpa2t *addr; /* Adressse associée au signet */
- GtkDisplayPanel *display; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
@@ -597,9 +597,12 @@ static void on_strings_selection_change(GtkTreeSelection *selection, gpointer un
addr = get_mrange_addr(g_binary_symbol_get_range(symbol));
- display = get_current_view();
- gtk_display_panel_request_move(display, addr);
- g_object_unref(G_OBJECT(display));
+ panel = get_current_view();
+
+ if (GTK_IS_DISPLAY_PANEL(panel))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
+
+ g_object_unref(G_OBJECT(panel));
g_object_unref(G_OBJECT(symbol));
@@ -820,7 +823,7 @@ static gboolean on_button_event_over_strings(GtkWidget *widget, GdkEventButton *
GtkTreeModel *model; /* Modèle de gestion */
GBinSymbol *symbol; /* Symbole en cours d'étude */
const vmpa2t *addr; /* Adressse associée au signet */
- GtkDisplayPanel *display; /* Afficheur effectif de code */
+ GLoadedPanel *display; /* Afficheur effectif de code */
switch (event->button)
{
@@ -838,7 +841,10 @@ static gboolean on_button_event_over_strings(GtkWidget *widget, GdkEventButton *
addr = get_mrange_addr(g_binary_symbol_get_range(symbol));
display = get_current_view();
- gtk_display_panel_request_move(display, addr);
+
+ if (GTK_IS_DISPLAY_PANEL(display))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(display), addr);
+
g_object_unref(G_OBJECT(display));
g_object_unref(G_OBJECT(symbol));
@@ -1038,7 +1044,7 @@ static void mcb_strings_panel_find_refs(GtkMenuItem *menuitem, GStringsPanel *pa
GObject *ref; /* Espace de référencements */
GtkWidget *dialog; /* Boîte de dialogue à montrer */
vmpa2t *addr; /* Adresse de destination */
- GtkDisplayPanel *display; /* Afficheur effectif de code */
+ GLoadedPanel *display; /* Afficheur effectif de code */
symbol = get_selected_panel_symbol(panel->treeview, NULL);
if (symbol == NULL) return;
@@ -1063,7 +1069,10 @@ static void mcb_strings_panel_find_refs(GtkMenuItem *menuitem, GStringsPanel *pa
addr = get_address_from_gotox_dialog(dialog);
display = get_current_view();
- gtk_display_panel_request_move(display, addr);
+
+ if (GTK_IS_DISPLAY_PANEL(display))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(display), addr);
+
g_object_unref(G_OBJECT(display));
delete_vmpa(addr);
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index 5bd4eae..3b01f24 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -548,7 +548,7 @@ static void on_symbols_selection_change(GtkTreeSelection *selection, gpointer un
GtkTreeModel *model; /* Modèle de gestion */
GBinSymbol *symbol; /* Symbole à traiter */
const mrange_t *range; /* Couverture dudit symbole */
- GtkDisplayPanel *display; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
if (gtk_tree_selection_get_selected(selection, &model, &iter))
{
@@ -558,9 +558,12 @@ static void on_symbols_selection_change(GtkTreeSelection *selection, gpointer un
{
range = g_binary_symbol_get_range(symbol);
- display = get_current_view();
- gtk_display_panel_request_move(display, get_mrange_addr(range));
- g_object_unref(G_OBJECT(display));
+ panel = get_current_view();
+
+ if (GTK_IS_DISPLAY_PANEL(panel))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), get_mrange_addr(range));
+
+ g_object_unref(G_OBJECT(panel));
g_object_unref(G_OBJECT(symbol));
diff --git a/src/gui/tb/portions.c b/src/gui/tb/portions.c
index 685f5ba..f60f83c 100644
--- a/src/gui/tb/portions.c
+++ b/src/gui/tb/portions.c
@@ -243,7 +243,7 @@ static void update_portions_item_binary(GEditorItem *item, GLoadedBinary *binary
static void track_address_on_binary_strip(GtkBinaryStrip *strip, GEditorItem *item)
{
const vmpa2t *addr; /* Nouvelle destination */
- GtkDisplayPanel *panel; /* Afficheur effectif de code */
+ GLoadedPanel *panel; /* Afficheur effectif de code */
GLoadedBinary *binary; /* Binaire chargé et actif */
addr = gtk_binary_strip_get_location(strip);
@@ -251,7 +251,8 @@ static void track_address_on_binary_strip(GtkBinaryStrip *strip, GEditorItem *it
panel = get_current_view();
binary = get_current_binary();
- gtk_display_panel_request_move(panel, addr);
+ if (GTK_IS_DISPLAY_PANEL(panel))
+ gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr);
focus_address_in_editor_items(binary, addr, item);