summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-08-26 22:15:05 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-08-26 22:15:05 (GMT)
commit8ca477e012b11a19363542d171b8e973d637641c (patch)
tree94a4fcde1779f031946eff7a36075f41a17cd73b /src
parent4fb2ac107092671fe27fc3ebf9fc86dff7c3ec19 (diff)
Removed most of the functions using the editor items as global access to active items.
Diffstat (limited to 'src')
-rw-r--r--src/analysis/db/items/move.c5
-rw-r--r--src/analysis/project.c3
-rw-r--r--src/gtkext/gtkgraphdisplay.c2
-rwxr-xr-xsrc/gui/core/Makefile.am1
-rw-r--r--src/gui/core/global.c185
-rw-r--r--src/gui/core/global.h20
-rw-r--r--src/gui/core/items.c374
-rw-r--r--src/gui/core/items.h55
-rw-r--r--src/gui/core/panels.c1
-rw-r--r--src/gui/editem.c404
-rw-r--r--src/gui/editem.h38
-rw-r--r--src/gui/editor.c54
-rw-r--r--src/gui/menus/binary.c16
-rw-r--r--src/gui/menus/binary.h1
-rw-r--r--src/gui/menus/edition.c59
-rw-r--r--src/gui/menus/view.c66
-rw-r--r--src/gui/menus/view.h1
-rw-r--r--src/gui/panels/bintree.c10
-rw-r--r--src/gui/panels/bookmarks.c15
-rw-r--r--src/gui/panels/errors.c10
-rw-r--r--src/gui/panels/strings.c21
-rw-r--r--src/gui/panels/symbols.c12
-rw-r--r--src/gui/panels/welcome.c1
-rw-r--r--src/gui/status.c7
-rw-r--r--src/gui/tb/portions.c14
25 files changed, 809 insertions, 566 deletions
diff --git a/src/analysis/db/items/move.c b/src/analysis/db/items/move.c
index 4fd1667..562d749 100644
--- a/src/analysis/db/items/move.c
+++ b/src/analysis/db/items/move.c
@@ -35,7 +35,7 @@
#include "../collection-int.h"
#include "../item-int.h"
-#include "../../../gui/editem.h"
+#include "../../../gui/core/global.h"
#include "../../../gtkext/gtkdisplaypanel.h"
@@ -445,14 +445,13 @@ static bool g_db_move_run(const GDbMove *move, const vmpa2t *addr)
/* Lancement de l'opération */
- panel = g_editor_item_get_current_view(NULL);
+ panel = get_current_view();
if (panel != NULL)
{
params = (move_params *)calloc(1, sizeof(move_params));
params->panel = panel;
- g_object_ref(G_OBJECT(panel));
copy_vmpa(&params->addr, addr);
diff --git a/src/analysis/project.c b/src/analysis/project.c
index 83b1ee4..9377247 100644
--- a/src/analysis/project.c
+++ b/src/analysis/project.c
@@ -1029,6 +1029,9 @@ GtkDisplayPanel *get_alt_view_for_view_panel(GtkDisplayPanel *panel, BinaryView
break;
}
+ if (result != NULL)
+ g_object_ref(G_OBJECT(result));
+
return result;
}
diff --git a/src/gtkext/gtkgraphdisplay.c b/src/gtkext/gtkgraphdisplay.c
index 1d88e42..4d11050 100644
--- a/src/gtkext/gtkgraphdisplay.c
+++ b/src/gtkext/gtkgraphdisplay.c
@@ -33,7 +33,7 @@
#include "graph/cluster.h"
#include "../analysis/routine.h"
#include "../format/format.h"
-#include "../gui/editem.h"
+#include "../gui/core/items.h"
diff --git a/src/gui/core/Makefile.am b/src/gui/core/Makefile.am
index 85aaacf..3f73c6c 100755
--- a/src/gui/core/Makefile.am
+++ b/src/gui/core/Makefile.am
@@ -4,6 +4,7 @@ noinst_LTLIBRARIES = libguicore.la
libguicore_la_SOURCES = \
core.h core.c \
global.h global.c \
+ items.h items.c \
panels.h panels.c \
theme.h theme.c
diff --git a/src/gui/core/global.c b/src/gui/core/global.c
index c030623..1eb8672 100644
--- a/src/gui/core/global.c
+++ b/src/gui/core/global.c
@@ -28,6 +28,21 @@
/* Barre de statut principale */
static GtkStatusStack *_status = NULL;
+/* Binaire en cours d'étude ou NULL */
+static GLoadedBinary *_current_binary = NULL;
+
+G_LOCK_DEFINE_STATIC(_cb_mutex);
+
+/* Suivi du panneau d'affichage courant ou NULL */
+static GtkDisplayPanel *_current_view = NULL;
+
+G_LOCK_DEFINE_STATIC(_cv_mutex);
+
+/* Suivi des changements de position ou NULL */
+static GObject *_caret_instance = NULL;
+
+G_LOCK_DEFINE_STATIC(_ci_mutex);
+
/******************************************************************************
@@ -55,7 +70,7 @@ void set_global_status(GtkStatusStack *status)
* *
* Description : Fournit l'adresse de la barre de statut principale. *
* *
-* Retour : barre de statut à tenir informée. *
+* Retour : Barre de statut à tenir informée. *
* *
* Remarques : - *
* *
@@ -66,3 +81,171 @@ GtkStatusStack *get_global_status(void)
return _status;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : binary = instance de binaire chargé. *
+* *
+* Description : Définit le binaire actif en cours d'étude. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void set_current_binary(GLoadedBinary *binary)
+{
+ G_LOCK(_cb_mutex);
+
+ if (_current_binary != NULL)
+ g_object_unref(G_OBJECT(_current_binary));
+
+ _current_binary = binary;
+
+ G_UNLOCK(_cb_mutex);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit le binaire actif en cours d'étude. *
+* *
+* Retour : Instance courante de binaire étudié ou NULL. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GLoadedBinary *get_current_binary(void)
+{
+ GLoadedBinary *result; /* Instance à retourner */
+
+ G_LOCK(_cb_mutex);
+
+ result = _current_binary;
+
+ if (result != NULL)
+ g_object_ref(G_OBJECT(result));
+
+ G_UNLOCK(_cb_mutex);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : view = représentation courante de binaire. *
+* *
+* Description : Définit l'affichage de binaire courant. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void set_current_view(GtkDisplayPanel *view)
+{
+ G_LOCK(_cv_mutex);
+
+ if (_current_view != NULL)
+ g_object_unref(G_OBJECT(_current_view));
+
+ _current_view = view;
+
+ G_UNLOCK(_cv_mutex);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit l'affichage de binaire courant. *
+* *
+* Retour : Instance en place ou NULL si aucune. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkDisplayPanel *get_current_view(void)
+{
+ GtkDisplayPanel *result; /* Instance à retourner */
+
+ G_LOCK(_cv_mutex);
+
+ result = _current_view;
+
+ if (result != NULL)
+ g_object_ref(G_OBJECT(result));
+
+ G_UNLOCK(_cv_mutex);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : caret = instance graphique à mémoriser. *
+* *
+* Description : Définit le support contenant la position active. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void set_caret_instance(GObject *caret)
+{
+ G_LOCK(_ci_mutex);
+
+ if (_caret_instance != NULL)
+ g_object_unref(_caret_instance);
+
+ _caret_instance = caret;
+
+ G_UNLOCK(_ci_mutex);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit le support contenant la position active. *
+* *
+* Retour : Instance en place ou NULL si aucune. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GObject *get_caret_instance(void)
+{
+ GObject *result; /* Instance à retourner */
+
+ G_LOCK(_ci_mutex);
+
+ result = _caret_instance;
+
+ if (result != NULL)
+ g_object_ref(result);
+
+ G_UNLOCK(_ci_mutex);
+
+ return result;
+
+}
diff --git a/src/gui/core/global.h b/src/gui/core/global.h
index 2306438..33225e3 100644
--- a/src/gui/core/global.h
+++ b/src/gui/core/global.h
@@ -25,6 +25,8 @@
#define _GUI_CORE_GLOBAL_H
+#include "../../analysis/binary.h"
+#include "../../gtkext/gtkdisplaypanel.h"
#include "../../gtkext/gtkstatusstack.h"
@@ -35,6 +37,24 @@ void set_global_status(GtkStatusStack *);
/* Fournit l'adresse de la barre de statut principale. */
GtkStatusStack *get_global_status(void);
+/* Définit le binaire actif en cours d'étude. */
+void set_current_binary(GLoadedBinary *);
+
+/* Fournit le binaire actif en cours d'étude. */
+GLoadedBinary *get_current_binary(void);
+
+/* Définit l'affichage de binaire courant. */
+void set_current_view(GtkDisplayPanel *);
+
+/* Fournit l'affichage de binaire courant. */
+GtkDisplayPanel *get_current_view(void);
+
+/* Définit le support contenant la position active. */
+void set_caret_instance(GObject *);
+
+/* Fournit le support contenant la position active. */
+GObject *get_caret_instance(void);
+
#endif /* _GUI_CORE_GLOBAL_H */
diff --git a/src/gui/core/items.c b/src/gui/core/items.c
new file mode 100644
index 0000000..923a565
--- /dev/null
+++ b/src/gui/core/items.c
@@ -0,0 +1,374 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * items.c - manipulation de l'ensemble des composants graphiques actifs
+ *
+ * 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 "items.h"
+
+
+#include "global.h"
+#include "../editem-int.h"
+#include "../../analysis/db/items/move.h"
+
+
+
+/* Liste des éléments enregistrés */
+static GEditorItem *_editem_list = NULL;
+
+
+/* Suit les changements de focus des panneaux d'affichage. */
+static gboolean notify_view_panel_focus_change(GtkDisplayPanel *, 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);
+
+/* Suit les changements de position dans du code d'assembleur. */
+static void track_caret_address_on_view_panel(GtkDisplayPanel *, const vmpa2t *, gpointer);
+
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Procède à l'enregistrement d'un élément reactif de l'éditeur.*
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void register_editor_item(GEditorItem *item)
+{
+ editem_list_add_tail(item, &_editem_list);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : binary = nouvelle instance de binaire analysé. *
+* *
+* Description : Lance une actualisation du fait d'un changement de binaire. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void change_editor_items_current_binary(GLoadedBinary *binary)
+{
+ GEditorItem *iter; /* Boucle de parcours */
+ GEditorItemClass *klass; /* Classe correspondante */
+
+ set_current_binary(binary);
+
+ editem_list_for_each(iter, _editem_list)
+ {
+ klass = G_EDITOR_ITEM_GET_CLASS(iter);
+
+ if (klass->update_binary != NULL)
+ klass->update_binary(iter, binary);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = composant d'affichage concerné par l'opération. *
+* event = informations liées à l'événement. *
+* unused = adresse non utilisée ici. *
+* *
+* Description : Suit les changements de focus des panneaux d'affichage. *
+* *
+* Retour : FALSE pour continuer la propagation. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static gboolean notify_view_panel_focus_change(GtkDisplayPanel *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);
+
+ }
+
+ return FALSE;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = composant d'affichage parcouru. *
+* addr = adresse de destination du curseur souhaitée. *
+* unused = adresse non utilisée ici. *
+* *
+* Description : Lance une procédure de déplacement de la position courante. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void start_moving_to_address_in_view_panel(GtkDisplayPanel *panel, const vmpa2t *addr, gpointer unused)
+{
+ const vmpa2t *src; /* Position courante de curseur*/
+ GDbMove *move; /* Déplacement à organiser */
+ GLoadedBinary *binary; /* Binaire en cours d'étude */
+
+ src = gtk_display_panel_get_caret_location(panel);
+
+ /* S'il n'y a pas de passif, pas besoin d'historique */
+ if (src == NULL)
+ gtk_display_panel_scroll_to_address(panel, addr, SPT_CENTER);
+
+ else
+ {
+ move = g_db_move_new(src, addr);
+
+ binary = gtk_display_panel_get_binary(panel);
+ g_loaded_binary_add_to_collection(binary, G_DB_ITEM(move));
+ g_object_unref(G_OBJECT(binary));
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = composant d'affichage parcouru. *
+* addr = nouvelle adresse du curseur courant. *
+* unused = adresse non utilisée ici. *
+* *
+* Description : Suit les changements de position dans du code d'assembleur. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void track_caret_address_on_view_panel(GtkDisplayPanel *panel, const vmpa2t *addr, 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->track_caret != NULL)
+ klass->track_caret(iter, panel, addr);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = nouveau panneau d'affichage actif. *
+* *
+* Description : Lance une actualisation du fait d'un changement de vue. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void change_editor_items_current_view(GtkDisplayPanel *panel)
+{
+ GtkDisplayPanel *view; /* Affichage actif */
+ GEditorItem *iter; /* Boucle de parcours */
+ GEditorItemClass *klass; /* Classe correspondante */
+ GObject *caret; /* Support du curseur actif */
+
+ /* Suivi des affichages */
+
+ view = get_current_view();
+
+ if (view != NULL)
+ {
+ g_signal_handlers_disconnect_by_func(view, G_CALLBACK(notify_view_panel_focus_change), NULL);
+ g_signal_handlers_disconnect_by_func(view, G_CALLBACK(notify_view_panel_focus_change), NULL);
+
+ g_object_unref(view);
+
+ }
+
+ set_current_view(panel);
+
+ editem_list_for_each(iter, _editem_list)
+ {
+ klass = G_EDITOR_ITEM_GET_CLASS(iter);
+
+ if (klass->update_view != NULL)
+ klass->update_view(iter, panel);
+
+ }
+
+ if (panel != NULL)
+ {
+ g_signal_connect(panel, "focus-in-event", G_CALLBACK(notify_view_panel_focus_change), NULL);
+ g_signal_connect(panel, "focus-out-event", G_CALLBACK(notify_view_panel_focus_change), NULL);
+ }
+
+ /* Suivi du curseur */
+
+ caret = get_caret_instance();
+
+ 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);
+
+ g_signal_connect(panel, "caret-moved",
+ G_CALLBACK(track_caret_address_on_view_panel),
+ NULL);
+
+ caret = G_OBJECT(panel);
+
+ g_object_ref(caret);
+ set_caret_instance(caret);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = nouveau panneau d'affichage actif. *
+* *
+* Description : Lance une actualisation du fait d'un changement de contenu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void change_editor_items_current_view_content(GtkDisplayPanel *panel)
+{
+ 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->update_content != NULL)
+ klass->update_content(iter, panel);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : binary = binaire contenant l'adresse à représenter. *
+* addr = adresse mémoire à mettre en avant. *
+* source = composant à l'origine du changement. *
+* *
+* Description : Concentre l'attention de l'ensemble sur une adresse donnée. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void focus_address_in_editor_items(GLoadedBinary *binary, const vmpa2t *addr, GEditorItem *source)
+{
+ 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->focus_addr != NULL && iter != source)
+ klass->focus_addr(iter, binary, addr);
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : project = projet concerné par l'évolution. *
+* *
+* Description : Lance une actualisation relative à l'étendue du projet. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_project_area(GStudyProject *project)
+{
+ 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->update_project != NULL)
+ klass->update_project(iter, project);
+
+ }
+
+}
diff --git a/src/gui/core/items.h b/src/gui/core/items.h
new file mode 100644
index 0000000..fc73b5e
--- /dev/null
+++ b/src/gui/core/items.h
@@ -0,0 +1,55 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * items.h - prototypes pour la manipulation de l'ensemble des composants graphiques actifs
+ *
+ * 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 _GUI_CORE_ITEMS_H
+#define _GUI_CORE_ITEMS_H
+
+
+#include "../editem.h"
+#include "../../analysis/binary.h"
+#include "../../analysis/project.h"
+#include "../../gtkext/gtkdisplaypanel.h"
+
+
+
+/* Procède à l'enregistrement d'un élément reactif de l'éditeur. */
+void register_editor_item(GEditorItem *);
+
+/* Lance une actualisation du fait d'un changement de binaire. */
+void change_editor_items_current_binary(GLoadedBinary *);
+
+/* Lance une actualisation du fait d'un changement de vue. */
+void change_editor_items_current_view(GtkDisplayPanel *);
+
+/* Lance une actualisation du fait d'un changement de contenu. */
+void change_editor_items_current_view_content(GtkDisplayPanel *);
+
+/* Concentre l'attention de l'ensemble sur une adresse donnée. */
+void focus_address_in_editor_items(GLoadedBinary *, const vmpa2t *, GEditorItem *);
+
+/* Lance une actualisation relative à l'étendue du projet. */
+void update_project_area(GStudyProject *);
+
+
+
+#endif /* _GUI_CORE_ITEMS_H */
diff --git a/src/gui/core/panels.c b/src/gui/core/panels.c
index 38a2c43..5a1beb1 100644
--- a/src/gui/core/panels.c
+++ b/src/gui/core/panels.c
@@ -25,6 +25,7 @@
#include "panels.h"
+#include "items.h"
#include "../panels/bintree.h"
#include "../panels/bookmarks.h"
#include "../panels/errors.h"
diff --git a/src/gui/editem.c b/src/gui/editem.c
index 0eead32..4848cc9 100644
--- a/src/gui/editem.c
+++ b/src/gui/editem.c
@@ -26,13 +26,9 @@
#include "editem-int.h"
-#include "../analysis/db/items/move.h"
-/* ------------------------- ELEMENT INDIVIDUEL D'INTERFACE ------------------------- */
-
-
/* Initialise la classe des éléments réactifs de l'éditeur. */
static void g_editor_item_class_init(GEditorItemClass *);
@@ -40,36 +36,6 @@ static void g_editor_item_class_init(GEditorItemClass *);
static void g_editor_item_init(GEditorItem *);
-
-/* ---------------------------- MANIPULATION D'ENSEMBLES ---------------------------- */
-
-
-/* Liste des éléments enregistrés */
-static GEditorItem *_editem_list = NULL;
-
-/* Suivi du panneau d'affichage courant */
-static GtkDisplayPanel *_current_view = NULL;
-
-/* Suivi des changements de position */
-static GObject *_caret_instance = NULL;
-
-
-/* Suit les changements de focus des panneaux d'affichage. */
-static gboolean notify_view_panel_focus_change(GtkDisplayPanel *, GdkEventFocus *, void *);
-
-/* Lance une procédure de déplacement de la position courante. */
-static void start_moving_to_address_in_view_panel(GtkDisplayPanel *, const vmpa2t *, void *);
-
-/* Suit les changements de position dans du code d'assembleur. */
-static void track_caret_address_on_view_panel(GtkDisplayPanel *, const vmpa2t *, void *);
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* ELEMENT INDIVIDUEL D'INTERFACE */
-/* ---------------------------------------------------------------------------------- */
-
-
/* Indique le type défini pour un élément réactif d'éditeur. */
G_DEFINE_TYPE(GEditorItem, g_editor_item, G_TYPE_OBJECT);
@@ -166,373 +132,3 @@ GtkWidget *g_editor_item_get_widget(const GEditorItem *item)
return item->widget;
}
-
-
-/******************************************************************************
-* *
-* Paramètres : item = instance à consulter. *
-* *
-* Description : Fournit le gestionnaire du binaire courant. *
-* *
-* Retour : Instance en place ou NULL si aucune. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GLoadedBinary *g_editor_item_get_current_binary(const GEditorItem *item)
-{
- return g_object_get_data(item->ref, "current_binary");
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : item = instance à consulter. *
-* *
-* Description : Fournit l'affichage de binaire courant. *
-* *
-* Retour : Instance en place ou NULL si aucune. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GtkDisplayPanel *g_editor_item_get_current_view(const GEditorItem *item)
-{
- return _current_view;
-
-}
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* MANIPULATION D'ENSEMBLES */
-/* ---------------------------------------------------------------------------------- */
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Procède à l'enregistrement d'un élément reactif de l'éditeur.*
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void register_editor_item(GEditorItem *item)
-{
- editem_list_add_tail(item, &_editem_list);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* binary = nouvelle instance de binaire analysé. *
-* *
-* Description : Lance une actualisation du fait d'un changement de binaire. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void change_editor_items_current_binary(GObject *ref, GLoadedBinary *binary)
-{
- GEditorItem *iter; /* Boucle de parcours */
- GEditorItemClass *klass; /* Classe correspondante */
-
- if (binary == NULL)
- g_object_set_data(ref, "current_binary", NULL);
-
- else
- {
- g_object_ref(G_OBJECT(binary));
- g_object_set_data_full(ref, "current_binary", binary, g_object_unref);
- }
-
- editem_list_for_each(iter, _editem_list)
- {
- klass = G_EDITOR_ITEM_GET_CLASS(iter);
-
- if (klass->update_binary != NULL)
- klass->update_binary(iter, binary);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : panel = composant d'affichage concerné par l'opération. *
-* event = informations liées à l'événement. *
-* data = adresse non utilisée ici. *
-* *
-* Description : Suit les changements de focus des panneaux d'affichage. *
-* *
-* Retour : FALSE pour continuer la propagation. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static gboolean notify_view_panel_focus_change(GtkDisplayPanel *panel, GdkEventFocus *event, void *data)
-{
- 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);
-
- }
-
- return FALSE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : panel = composant d'affichage parcouru. *
-* addr = adresse de destination du curseur souhaitée. *
-* data = adresse non utilisée ici. *
-* *
-* Description : Lance une procédure de déplacement de la position courante. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void start_moving_to_address_in_view_panel(GtkDisplayPanel *panel, const vmpa2t *addr, void *data)
-{
- const vmpa2t *src; /* Position courante de curseur*/
- GDbMove *move; /* Déplacement à organiser */
- GLoadedBinary *binary; /* Binaire en cours d'étude */
-
- src = gtk_display_panel_get_caret_location(panel);
-
- /* S'il n'y a pas de passif, pas besoin d'historique */
- if (src == NULL)
- gtk_display_panel_scroll_to_address(panel, addr, SPT_CENTER);
-
- else
- {
- move = g_db_move_new(src, addr);
-
- binary = gtk_display_panel_get_binary(panel);
- g_loaded_binary_add_to_collection(binary, G_DB_ITEM(move));
- g_object_unref(G_OBJECT(binary));
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : panel = composant d'affichage parcouru. *
-* addr = nouvelle adresse du curseur courant. *
-* data = adresse non utilisée ici. *
-* *
-* Description : Suit les changements de position dans du code d'assembleur. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void track_caret_address_on_view_panel(GtkDisplayPanel *panel, const vmpa2t *addr, void *data)
-{
- 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->track_caret != NULL)
- klass->track_caret(iter, panel, addr);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* panel = nouveau panneau d'affichage actif. *
-* *
-* Description : Lance une actualisation du fait d'un changement de vue. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void change_editor_items_current_view(GObject *ref, GtkDisplayPanel *panel)
-{
- GEditorItem *iter; /* Boucle de parcours */
- GEditorItemClass *klass; /* Classe correspondante */
-
- /* Suivi des affichages */
-
- if (_current_view != NULL)
- {
- g_signal_handlers_disconnect_by_func(_current_view, G_CALLBACK(notify_view_panel_focus_change), NULL);
- g_signal_handlers_disconnect_by_func(_current_view, G_CALLBACK(notify_view_panel_focus_change), NULL);
- }
-
- _current_view = panel;
-
- editem_list_for_each(iter, _editem_list)
- {
- klass = G_EDITOR_ITEM_GET_CLASS(iter);
-
- if (klass->update_view != NULL)
- klass->update_view(iter, panel);
-
- }
-
- if (panel != NULL)
- {
- g_signal_connect(panel, "focus-in-event", G_CALLBACK(notify_view_panel_focus_change), NULL);
- g_signal_connect(panel, "focus-out-event", G_CALLBACK(notify_view_panel_focus_change), NULL);
- }
-
- /* Suivi du curseur */
-
- if (_caret_instance != NULL)
- {
- g_signal_handlers_disconnect_by_func(_caret_instance,
- G_CALLBACK(start_moving_to_address_in_view_panel),
- NULL);
- g_signal_handlers_disconnect_by_func(_caret_instance,
- G_CALLBACK(track_caret_address_on_view_panel),
- NULL);
- g_object_unref(_caret_instance);
- _caret_instance = 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);
-
- _caret_instance = G_OBJECT(panel);
- g_object_ref(_caret_instance);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* panel = nouveau panneau d'affichage actif. *
-* *
-* Description : Lance une actualisation du fait d'un changement de contenu. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void change_editor_items_current_view_content(GtkDisplayPanel *panel)
-{
- 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->update_content != NULL)
- klass->update_content(iter, panel);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : binary = binaire contenant l'adresse à représenter. *
-* addr = adresse mémoire à mettre en avant. *
-* source = composant à l'origine du changement. *
-* *
-* Description : Concentre l'attention de l'ensemble sur une adresse donnée. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void focus_address_in_editor_items(GLoadedBinary *binary, const vmpa2t *addr, GEditorItem *source)
-{
- 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->focus_addr != NULL && iter != source)
- klass->focus_addr(iter, binary, addr);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : project = projet concerné par l'évolution. *
-* *
-* Description : Lance une actualisation relative à l'étendue du projet. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void update_project_area(GStudyProject *project)
-{
- 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->update_project != NULL)
- klass->update_project(iter, project);
-
- }
-
-}
diff --git a/src/gui/editem.h b/src/gui/editem.h
index 21de088..476299b 100644
--- a/src/gui/editem.h
+++ b/src/gui/editem.h
@@ -27,16 +27,9 @@
#include <glib-object.h>
+#include <gtk/gtk.h>
-#include "../analysis/binary.h"
-#include "../analysis/project.h"
-#include "../gtkext/gtkdisplaypanel.h"
-
-
-
-/* ------------------------- ELEMENT INDIVIDUEL D'INTERFACE ------------------------- */
-
#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))
@@ -65,35 +58,6 @@ 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 *);
-/* Fournit le gestionnaire du binaire courant. */
-GLoadedBinary *g_editor_item_get_current_binary(const GEditorItem *);
-
-/* Fournit l'affichage de binaire courant. */
-GtkDisplayPanel *g_editor_item_get_current_view(const GEditorItem *);
-
-
-
-/* ---------------------------- MANIPULATION D'ENSEMBLES ---------------------------- */
-
-
-/* Procède à l'enregistrement d'un élément reactif de l'éditeur. */
-void register_editor_item(GEditorItem *);
-
-/* Lance une actualisation du fait d'un changement de binaire. */
-void change_editor_items_current_binary(GObject *, GLoadedBinary *);
-
-/* Lance une actualisation du fait d'un changement de vue. */
-void change_editor_items_current_view(GObject *, GtkDisplayPanel *);
-
-/* Lance une actualisation du fait d'un changement de contenu. */
-void change_editor_items_current_view_content(GtkDisplayPanel *);
-
-/* Concentre l'attention de l'ensemble sur une adresse donnée. */
-void focus_address_in_editor_items(GLoadedBinary *, const vmpa2t *, GEditorItem *);
-
-/* Lance une actualisation relative à l'étendue du projet. */
-void update_project_area(GStudyProject *);
-
#endif /* _GUI_EDITEM_H */
diff --git a/src/gui/editor.c b/src/gui/editor.c
index d042acd..a3055c7 100644
--- a/src/gui/editor.c
+++ b/src/gui/editor.c
@@ -38,6 +38,8 @@
#include "menus/menubar.h"
#include "core/core.h"
#include "core/panels.h"
+#include "core/global.h"
+#include "core/items.h"
#include "panels/panel.h"
#include "panels/welcome.h"
#include "tb/portions.h"
@@ -147,7 +149,6 @@ typedef struct _panel_node
/* Support de fond pour les composants. */
-static GObject *_global_ref = NULL;
static GtkWidget *_support = NULL;
static panel_node *_nodes = NULL;
@@ -185,22 +186,22 @@ static void delete_panel_node(panel_node *);
/* Réagit à une demande de placement d'un panneau d'affichage. */
-void on_panel_item_dock_request(GPanelItem *, void *);
+void on_panel_item_dock_request(GPanelItem *, gpointer);
/* Réagit à une demande de suppression d'un panneau d'affichage. */
-void on_panel_item_undock_request(GPanelItem *, void *);
+void on_panel_item_undock_request(GPanelItem *, gpointer);
/* Réagit au changement d'onglet d'un panneau quelconque. */
-static void on_dock_item_switch(GtkDockStation *, GtkWidget *, GObject *);
+static void on_dock_item_switch(GtkDockStation *, GtkWidget *, gpointer);
/* Encastre comme demandé un panneau dans l'éditeur. */
static void dock_panel_into_current_station(GtkCheckMenuItem *, GPanelItem *);
/* Réagit à une demande de menu pour rajouter des panneaux. */
-static void on_dock_menu_request(GtkDockStation *, GtkWidget *, GObject *);
+static void on_dock_menu_request(GtkDockStation *, GtkWidget *, gpointer);
/* Réagit à une demande de fermeture du panneau courant. */
-static void on_dock_close_request(GtkDockStation *, GtkWidget *, GObject *);
+static void on_dock_close_request(GtkDockStation *, GtkWidget *, gpointer);
/* Réagit à une variation dans une séparation de panneaux. */
static void notify_paned_handle_position_change(GObject *, GParamSpec *, gpointer);
@@ -338,7 +339,6 @@ GtkWidget *create_editor(void)
do
{
- _global_ref = ref;
_support = gtk_event_box_new();
gtk_widget_show(_support);
@@ -370,7 +370,7 @@ GtkWidget *create_editor(void)
/* Actualisation des contenus */
- change_editor_items_current_binary(ref, NULL);
+ change_editor_items_current_binary(NULL);
@@ -702,9 +702,9 @@ static panel_node *create_simple_panel_node_for_item(GPanelItem *item, const cha
/* Partie graphique */
station = gtk_dock_station_new();
- g_signal_connect(station, "switch-widget", G_CALLBACK(on_dock_item_switch), _global_ref);
- g_signal_connect(station, "menu-requested", G_CALLBACK(on_dock_menu_request), _global_ref);
- g_signal_connect(station, "close-requested", G_CALLBACK(on_dock_close_request), _global_ref);
+ g_signal_connect(station, "switch-widget", G_CALLBACK(on_dock_item_switch), NULL);
+ g_signal_connect(station, "menu-requested", G_CALLBACK(on_dock_menu_request), NULL);
+ g_signal_connect(station, "close-requested", G_CALLBACK(on_dock_close_request), NULL);
gtk_widget_show(station);
gtk_dock_station_add_dockable(GTK_DOCK_STATION(station), GTK_DOCKABLE(item));
@@ -1234,7 +1234,7 @@ static void delete_panel_node(panel_node *node)
* *
******************************************************************************/
-void on_panel_item_dock_request(GPanelItem *panel, void *unused)
+void on_panel_item_dock_request(GPanelItem *panel, gpointer unused)
{
const char *path; /* Chemin d'accès */
panel_node *node; /* Noeud à supprimer */
@@ -1291,7 +1291,7 @@ void on_panel_item_dock_request(GPanelItem *panel, void *unused)
* *
******************************************************************************/
-void on_panel_item_undock_request(GPanelItem *panel, void *unused)
+void on_panel_item_undock_request(GPanelItem *panel, gpointer unused)
{
GtkWidget *station; /* Support courant */
GtkNotebook *notebook; /* Version parente de station */
@@ -1346,7 +1346,7 @@ void on_panel_item_undock_request(GPanelItem *panel, void *unused)
* *
* Paramètres : station = panneau de support des éléments concerné. *
* item = nouvel élément présenté à l'affichage. *
-* ref = adresse de l'espace de référencement global. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit au changement d'onglet d'un panneau quelconque. *
* *
@@ -1356,7 +1356,7 @@ void on_panel_item_undock_request(GPanelItem *panel, void *unused)
* *
******************************************************************************/
-static void on_dock_item_switch(GtkDockStation *station, GtkWidget *widget, GObject *ref)
+static void on_dock_item_switch(GtkDockStation *station, GtkWidget *widget, gpointer unused)
{
GLoadedBinary *old_binary; /* Ancien binaire édité */
GLoadedBinary *binary; /* Binaire en cours d'édition */
@@ -1371,20 +1371,18 @@ static void on_dock_item_switch(GtkDockStation *station, GtkWidget *widget, GObj
{
/* Changement de binaire ? */
- old_binary = G_LOADED_BINARY(g_object_get_data(ref, "current_binary"));
+ old_binary = get_current_binary();
binary = gtk_display_panel_get_binary(GTK_DISPLAY_PANEL(widget));
if (old_binary != binary)
- {
- //notify_panels_of_binary_change(binary);
- change_editor_items_current_binary(ref, binary);
- }
-
- change_editor_items_current_view(ref, GTK_DISPLAY_PANEL(widget));
+ change_editor_items_current_binary(binary);
+ else
+ g_object_unref(G_OBJECT(binary));
- //notify_panels_of_view_change(GTK_DISPLAY_PANEL(widget), false);
+ g_object_unref(G_OBJECT(old_binary));
- g_object_unref(G_OBJECT(binary));
+ g_object_ref(G_OBJECT(widget));
+ change_editor_items_current_view(GTK_DISPLAY_PANEL(widget));
}
@@ -1424,7 +1422,7 @@ static void dock_panel_into_current_station(GtkCheckMenuItem *menuitem, GPanelIt
* *
* Paramètres : station = panneau de support des éléments concerné. *
* button = bouton à l'origine de la procédure. *
-* ref = adresse de l'espace de référencement global. *
+* unsued = adresse non utilisée ici. *
* *
* Description : Réagit à une demande de menu pour rajouter des panneaux. *
* *
@@ -1434,7 +1432,7 @@ static void dock_panel_into_current_station(GtkCheckMenuItem *menuitem, GPanelIt
* *
******************************************************************************/
-static void on_dock_menu_request(GtkDockStation *station, GtkWidget *button, GObject *ref)
+static void on_dock_menu_request(GtkDockStation *station, GtkWidget *button, gpointer unused)
{
GtkWidget *active; /* Composant actif modèle */
GPanelItem *model; /* Panneau encapsulé */
@@ -1512,7 +1510,7 @@ static void on_dock_menu_request(GtkDockStation *station, GtkWidget *button, GOb
* *
* Paramètres : station = panneau de support des éléments concerné. *
* button = bouton à l'origine de la procédure. *
-* ref = adresse de l'espace de référencement global. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit à une demande de fermeture du panneau courant. *
* *
@@ -1522,7 +1520,7 @@ static void on_dock_menu_request(GtkDockStation *station, GtkWidget *button, GOb
* *
******************************************************************************/
-static void on_dock_close_request(GtkDockStation *station, GtkWidget *button, GObject *ref)
+static void on_dock_close_request(GtkDockStation *station, GtkWidget *button, gpointer unused)
{
gint index; /* Indice de la page courante */
GtkWidget *active; /* Composant actif modèle */
diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c
index 0eb28fe..e67c377 100644
--- a/src/gui/menus/binary.c
+++ b/src/gui/menus/binary.c
@@ -29,6 +29,7 @@
#include "../editem-int.h"
+#include "../core/global.h"
#include "../dialogs/export.h"
#include "../dialogs/gotox.h"
#include "../dialogs/storage.h"
@@ -164,7 +165,7 @@ static void mcb_binary_entry_points(GtkMenuItem *menuitem, GMenuBar *bar)
item = G_EDITOR_ITEM(bar);
ref = g_editor_item_get_global_ref(item);
- binary = g_editor_item_get_current_binary(item);
+ binary = get_current_binary();
dialog = create_gotox_dialog_for_entry_points(GTK_WINDOW(ref), binary);
@@ -172,8 +173,9 @@ static void mcb_binary_entry_points(GtkMenuItem *menuitem, GMenuBar *bar)
{
addr = get_address_from_gotox_dialog(dialog);
- panel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
+ panel = get_current_view();
gtk_display_panel_request_move(panel, addr);
+ g_object_unref(G_OBJECT(panel));
delete_vmpa(addr);
@@ -181,6 +183,8 @@ static void mcb_binary_entry_points(GtkMenuItem *menuitem, GMenuBar *bar)
gtk_widget_destroy(dialog);
+ g_object_unref(G_OBJECT(binary));
+
}
@@ -223,7 +227,7 @@ static void mcb_binary_storage(GtkMenuItem *menuitem, GMenuBar *bar)
GtkBuilder *builder; /* Constructeur utilisé */
GtkWidget *dialog; /* Boîte de dialogue à montrer */
- binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar));
+ binary = get_current_binary();
ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar));
dialog = create_storage_dialog(binary, GTK_WINDOW(ref), &builder);
@@ -234,6 +238,8 @@ static void mcb_binary_storage(GtkMenuItem *menuitem, GMenuBar *bar)
g_object_unref(G_OBJECT(builder));
+ g_object_unref(G_OBJECT(binary));
+
}
@@ -254,8 +260,10 @@ static void mcb_binary_export(GtkMenuItem *menuitem, GMenuBar *bar)
{
GLoadedBinary *binary; /* Edition courante */
- binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar));
+ binary = get_current_binary();
run_export_assistant(binary, GTK_WINDOW(G_EDITOR_ITEM(bar)->ref));
+ g_object_unref(G_OBJECT(binary));
+
}
diff --git a/src/gui/menus/binary.h b/src/gui/menus/binary.h
index 7662293..a66fe26 100644
--- a/src/gui/menus/binary.h
+++ b/src/gui/menus/binary.h
@@ -30,6 +30,7 @@
#include "menubar.h"
+#include "../../gtkext/gtkdisplaypanel.h"
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index f41111d..2491e3d 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -31,6 +31,7 @@
#include <i18n.h>
+#include "../core/global.h"
#include "../dialogs/bookmark.h"
#include "../dialogs/goto.h"
#include "../dialogs/gotox.h"
@@ -44,13 +45,13 @@
static void mcb_edition_goto(GtkMenuItem *, GMenuBar *);
/* Réagit avec le menu "Edition -> Operande numérique -> ...". */
-static void mcb_edition_switch_numeric_operand(GtkMenuItem *, GMenuBar *);
+static void mcb_edition_switch_numeric_operand(GtkMenuItem *, gpointer);
/* Réagit avec le menu "Edition -> Revenir en arrière". */
static void mcb_edition_go_back(GtkMenuItem *, GMenuBar *);
/* Réagit avec le menu "Edition -> Suivre la référence". */
-static void mcb_edition_follow_ref(GtkMenuItem *, GMenuBar *);
+static void mcb_edition_follow_ref(GtkMenuItem *, gpointer);
/* Réagit avec le menu "Edition -> Lister toutes les réfs...". */
static void mcb_edition_list_xrefs(GtkMenuItem *, GMenuBar *);
@@ -116,25 +117,25 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem));
deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_hex", _("Hexadecimal"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
add_accelerator_to_menu_item(deepmenuitem, "H", accgroup);
g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_HEX));
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_dec", _("Decimal"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
add_accelerator_to_menu_item(deepmenuitem, "D", accgroup);
g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_DEC));
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_oct", _("Octal"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
add_accelerator_to_menu_item(deepmenuitem, "O", accgroup);
g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_OCT));
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_bin", _("Binary"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
add_accelerator_to_menu_item(deepmenuitem, "B", accgroup);
g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_BIN));
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
@@ -143,7 +144,7 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_def", _("Default"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), bar);
+ G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_COUNT));
gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
@@ -160,7 +161,7 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
submenuitem = qck_create_menu_item(ref, "mnu_edit_follow_ref", _("Follow the reference"),
- G_CALLBACK(mcb_edition_follow_ref), bar);
+ G_CALLBACK(mcb_edition_follow_ref), NULL);
add_accelerator_to_menu_item(submenuitem, "Return", accgroup);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -321,8 +322,9 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
{
addr = get_address_from_goto_dialog(dialog);
- panel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
+ panel = get_current_view();
gtk_display_panel_request_move(panel, addr);
+ g_object_unref(G_OBJECT(panel));
delete_vmpa(addr);
@@ -336,7 +338,7 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
/******************************************************************************
* *
* Paramètres : menuitem = élément de menu sélectionné. *
-* bar = barre de menu parente. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit avec le menu "Edition -> Operande numérique -> ...". *
* *
@@ -346,10 +348,9 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar)
* *
******************************************************************************/
-static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, GMenuBar *bar)
+static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, gpointer unused)
{
ImmOperandDisplay display; /* Type de basculement */
- GEditorItem *editem; /* Autre version de la barre */
GtkDisplayPanel *panel; /* Afficheur effectif de code */
GBufferLine *line; /* Ligne de position courante */
GObject *creator; /* Créateur à l'orgine du seg. */
@@ -361,9 +362,7 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, GMenuBar *
display = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(menuitem), "kind_of_switch"));
- editem = G_EDITOR_ITEM(bar);
-
- panel = g_editor_item_get_current_view(editem);
+ panel = get_current_view();
if (gtk_display_panel_get_position(panel, &line, &creator))
{
@@ -371,7 +370,7 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, GMenuBar *
range = g_buffer_line_get_range(line);
- binary = g_editor_item_get_current_binary(editem);
+ binary = get_current_binary();
proc = g_loaded_binary_get_processor(binary);
instr = g_arch_processor_find_instr_by_address(proc, get_mrange_addr(range));
@@ -384,12 +383,15 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, GMenuBar *
g_loaded_binary_add_to_collection(binary, G_DB_ITEM(switcher));
g_object_unref(G_OBJECT(proc));
+ g_object_unref(G_OBJECT(binary));
g_object_unref(creator);
g_object_unref(G_OBJECT(line));
}
+ g_object_unref(G_OBJECT(panel));
+
}
@@ -415,7 +417,7 @@ static void mcb_edition_go_back(GtkMenuItem *menuitem, GMenuBar *bar)
/******************************************************************************
* *
* Paramètres : menuitem = élément de menu sélectionné. *
-* bar = barre de menu parente. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit avec le menu "Edition -> Suivre la référence". *
* *
@@ -425,7 +427,7 @@ static void mcb_edition_go_back(GtkMenuItem *menuitem, GMenuBar *bar)
* *
******************************************************************************/
-static void mcb_edition_follow_ref(GtkMenuItem *menuitem, GMenuBar *bar)
+static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused)
{
GtkDisplayPanel *panel; /* Afficheur effectif de code */
GBufferLine *line; /* Ligne de position courante */
@@ -434,7 +436,7 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, GMenuBar *bar)
vmpa2t addr; /* Adresse de destination */
virt_t virt; /* Adresse virtuelle */
- panel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
+ panel = get_current_view();
if (gtk_display_panel_get_position(panel, &line, &creator))
{
@@ -465,6 +467,8 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, GMenuBar *bar)
}
+ g_object_unref(G_OBJECT(panel));
+
}
@@ -493,13 +497,13 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
GtkWidget *dialog; /* Boîte de dialogue à montrer */
vmpa2t *addr; /* Adresse de destination */
- panel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
+ panel = get_current_view();
if (gtk_display_panel_get_position(panel, &line, NULL))
{
range = g_buffer_line_get_range(line);
- binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar));
+ binary = get_current_binary();
proc = g_loaded_binary_get_processor(binary);
/**
@@ -532,11 +536,14 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
g_object_unref(G_OBJECT(instr));
g_object_unref(G_OBJECT(proc));
+ g_object_unref(G_OBJECT(binary));
g_object_unref(G_OBJECT(line));
}
+ g_object_unref(G_OBJECT(panel));
+
}
@@ -555,7 +562,6 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar)
static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar)
{
- GEditorItem *editem; /* Autre version de la barre */
GtkDisplayPanel *panel; /* Vue offrant l'affichage */
const vmpa2t *curloc; /* Localisation d'un curseur */
GLoadedBinary *binary; /* Binaire en cours d'étude */
@@ -566,17 +572,15 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar)
GDbItem *bookmark; /* Nouveau signet défini */
gint ret; /* Retour de confirmation */
- editem = G_EDITOR_ITEM(bar);
-
/* Détermination de l'adresse visée */
- panel = g_editor_item_get_current_view(editem);
+ panel = get_current_view();
curloc = gtk_display_panel_get_caret_location(panel);
/* Accès à la collection */
- binary = g_editor_item_get_current_binary(editem);
+ binary = get_current_binary();
collec = g_loaded_binary_find_collection(binary, DBF_BOOKMARKS);
/**
@@ -632,6 +636,9 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar)
}
g_object_unref(G_OBJECT(collec));
+ g_object_unref(G_OBJECT(binary));
+
+ g_object_unref(G_OBJECT(panel));
}
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index a00c614..5298af3 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -32,6 +32,8 @@
#include "../editem-int.h"
+#include "../core/global.h"
+#include "../core/items.h"
#include "../core/panels.h"
#include "../../analysis/project.h"
#include "../../gtkext/easygtk.h"
@@ -47,10 +49,10 @@ static void mcb_view_update_side_panels_list(GtkMenuItem *, GMenuBar *);
static void mcb_view_change_panel_docking(GtkCheckMenuItem *, GPanelItem *);
/* Réagit avec le menu "Affichage -> Vue xxx". */
-static void mcb_view_change_support(GtkRadioMenuItem *, GMenuBar *);
+static void mcb_view_change_support(GtkRadioMenuItem *, gpointer);
/* Réagit avec le menu "Affichage -> (colonne xxx)". */
-static void mcb_view_display_column(GtkCheckMenuItem *, GMenuBar *);
+static void mcb_view_display_column(GtkCheckMenuItem *, gpointer);
/* Réagit avec le menu "Affichage -> Plein écran". */
static void mcb_view_show_full_screen(GtkCheckMenuItem *, GMenuBar *);
@@ -99,7 +101,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
/* Types de panneau de code */
submenuitem = qck_create_radio_menu_item(ref, "mnu_view_switch_textview", NULL, _("Text view"),
- G_CALLBACK(mcb_view_change_support), bar);
+ G_CALLBACK(mcb_view_change_support), NULL);
add_accelerator_to_menu_item(submenuitem, "F3", accgroup);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_BLOCK));
g_object_set_data(G_OBJECT(submenuitem), "kind_of_display", GSIZE_TO_POINTER(GTK_TYPE_BLOCK_DISPLAY));
@@ -108,7 +110,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
rgroup = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(submenuitem));
submenuitem = qck_create_radio_menu_item(ref, "mnu_view_switch_graphview", rgroup, _("Graph view"),
- G_CALLBACK(mcb_view_change_support), bar);
+ G_CALLBACK(mcb_view_change_support), NULL);
add_accelerator_to_menu_item(submenuitem, "F4", accgroup);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_GRAPH));
g_object_set_data(G_OBJECT(submenuitem), "kind_of_display", GSIZE_TO_POINTER(GTK_TYPE_GRAPH_DISPLAY));
@@ -122,17 +124,17 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar)
/* Affichage des données */
submenuitem = qck_create_check_menu_item(ref, "mnu_view_display_off", _("Physical offset"),
- G_CALLBACK(mcb_view_display_column), bar);
+ G_CALLBACK(mcb_view_display_column), NULL);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_col", GUINT_TO_POINTER(BLC_PHYSICAL));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
submenuitem = qck_create_check_menu_item(ref, "mnu_view_display_addr", _("Virtual address"),
- G_CALLBACK(mcb_view_display_column), bar);
+ G_CALLBACK(mcb_view_display_column), NULL);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_col", GUINT_TO_POINTER(BLC_VIRTUAL));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
submenuitem = qck_create_check_menu_item(ref, "mnu_view_display_code", _("Binary code"),
- G_CALLBACK(mcb_view_display_column), bar);
+ G_CALLBACK(mcb_view_display_column), NULL);
g_object_set_data(G_OBJECT(submenuitem), "kind_of_col", GUINT_TO_POINTER(BLC_BINARY));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -173,8 +175,8 @@ void update_menu_view_for_view(GtkWidget *widget, GtkDisplayPanel *panel, GMenuB
GtkRadioMenuItem *item; /* Elément de menu arbitraire */
GSList *radios; /* Liste des menus d'affichage */
GSList *found; /* Elément de menu à activer */
- GLoadedBinary *binary; /* Binaire courant */
BinaryView content; /* Type de vue active */
+ GLoadedBinary *binary; /* Binaire courant */
const bool *display; /* Règles d'affichage courantes*/
GtkWidget *submenuitem; /* Sous-élément de menu */
bool status; /* Consigne d'affichage */
@@ -189,7 +191,7 @@ void update_menu_view_for_view(GtkWidget *widget, GtkDisplayPanel *panel, GMenuB
void disconnect_display_radio(GtkWidget *wgt, gpointer unused)
{
- g_signal_handlers_disconnect_by_func(wgt, G_CALLBACK(mcb_view_change_support), bar);
+ g_signal_handlers_disconnect_by_func(wgt, G_CALLBACK(mcb_view_change_support), NULL);
}
@@ -216,7 +218,7 @@ void update_menu_view_for_view(GtkWidget *widget, GtkDisplayPanel *panel, GMenuB
void reconnect_display_radio(GtkWidget *wgt, gpointer unused)
{
- g_signal_connect(wgt, "toggled", G_CALLBACK(mcb_view_change_support), bar);
+ g_signal_connect(wgt, "toggled", G_CALLBACK(mcb_view_change_support), NULL);
}
@@ -224,44 +226,46 @@ void update_menu_view_for_view(GtkWidget *widget, GtkDisplayPanel *panel, GMenuB
/* - */
- binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar));
-
content = gtk_display_panel_describe_content(panel);
+ binary = get_current_binary();
+
display = g_loaded_binary_get_column_display(binary, content);
+ g_object_unref(G_OBJECT(binary));
+
/* Positions physiques */
submenuitem = g_object_get_data(ref, "mnu_view_display_off");
- g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), bar);
+ g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), NULL);
status = display[BLC_PHYSICAL];
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(submenuitem), status);
- g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_display_column), bar);
+ g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_display_column), NULL);
/* Adresses virtuelles */
submenuitem = g_object_get_data(ref, "mnu_view_display_addr");
- g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), bar);
+ g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), NULL);
status = display[BLC_VIRTUAL];
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(submenuitem), status);
- g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_display_column), bar);
+ g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_display_column), NULL);
/* Code binaire */
submenuitem = g_object_get_data(ref, "mnu_view_display_code");
- g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), bar);
+ g_signal_handlers_disconnect_by_func(submenuitem, G_CALLBACK(mcb_view_display_column), NULL);
status = display[BLC_BINARY];
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(submenuitem), status);
- g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_display_column), bar);
+ g_signal_connect(submenuitem, "toggled", G_CALLBACK(mcb_view_display_column), NULL);
}
@@ -447,7 +451,7 @@ static void mcb_view_change_panel_docking(GtkCheckMenuItem *menuitem, GPanelItem
/******************************************************************************
* *
* Paramètres : menuitem = élément de menu ayant basculé. *
-* bar = barre de menu parente. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit avec le menu "Affichage -> Vue xxx". *
* *
@@ -457,7 +461,7 @@ static void mcb_view_change_panel_docking(GtkCheckMenuItem *menuitem, GPanelItem
* *
******************************************************************************/
-static void mcb_view_change_support(GtkRadioMenuItem *menuitem, GMenuBar *bar)
+static void mcb_view_change_support(GtkRadioMenuItem *menuitem, gpointer unused)
{
GSList *group; /* Liste de menus radio */
GSList *iter; /* Boucle de parcours */
@@ -465,6 +469,7 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, GMenuBar *bar)
GtkDisplayPanel *panel; /* Afficheur effectif de code */
GtkDockStation *station; /* Base du remplacement */
GtkWidget *scroll; /* Nouveau support à utiliser */
+ GtkDisplayPanel *new; /* Nouvel afficheur de code */
/* On ne traite qu'une seule fois ! */
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
@@ -477,19 +482,21 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, GMenuBar *bar)
wanted = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(iter->data), "kind_of_view"));
- panel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
+ panel = get_current_view();
station = get_dock_station_for_view_panel(panel);
/* En vue du retrait de la station d'accueil... */
scroll = get_scroll_window_for_view_panel(panel);
g_object_ref(G_OBJECT(scroll));
- panel = get_alt_view_for_view_panel(panel, wanted);
- scroll = get_scroll_window_for_view_panel(panel);
+ new = get_alt_view_for_view_panel(panel, wanted);
+ scroll = get_scroll_window_for_view_panel(new);
gtk_dock_panel_change_active_widget(station, scroll);
- change_editor_items_current_view(G_EDITOR_ITEM(bar)->ref, panel);
+ change_editor_items_current_view(new);
+
+ g_object_unref(G_OBJECT(panel));
}
@@ -499,7 +506,7 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, GMenuBar *bar)
/******************************************************************************
* *
* Paramètres : menuitem = élément de menu ayant basculé. *
-* bar = barre de menu parente. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit avec le menu "Affichage -> (colonne xxx)". *
* *
@@ -509,7 +516,7 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, GMenuBar *bar)
* *
******************************************************************************/
-static void mcb_view_display_column(GtkCheckMenuItem *menuitem, GMenuBar *bar)
+static void mcb_view_display_column(GtkCheckMenuItem *menuitem, gpointer unused)
{
BufferLineColumn col; /* Colonne à traiter */
GLoadedBinary *binary; /* Binaire courant */
@@ -519,15 +526,18 @@ static void mcb_view_display_column(GtkCheckMenuItem *menuitem, GMenuBar *bar)
col = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(menuitem), "kind_of_col"));
- binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(bar));
+ binary = get_current_binary();
- panel = g_editor_item_get_current_view(G_EDITOR_ITEM(bar));
+ panel = get_current_view();
view = gtk_display_panel_describe_content(panel);
+ g_object_unref(G_OBJECT(panel));
active = gtk_check_menu_item_get_active(menuitem);
g_loaded_binary_set_column_display(binary, view, col, active);
+ g_object_unref(G_OBJECT(binary));
+
}
diff --git a/src/gui/menus/view.h b/src/gui/menus/view.h
index 65c57f7..d42bbc6 100644
--- a/src/gui/menus/view.h
+++ b/src/gui/menus/view.h
@@ -30,6 +30,7 @@
#include "menubar.h"
+#include "../../gtkext/gtkdisplaypanel.h"
diff --git a/src/gui/panels/bintree.c b/src/gui/panels/bintree.c
index 1fa0cfe..b7c31c1 100644
--- a/src/gui/panels/bintree.c
+++ b/src/gui/panels/bintree.c
@@ -33,6 +33,7 @@
#include "panel-int.h"
+#include "../core/global.h"
#include "../../gtkext/tmgt.h"
@@ -114,7 +115,7 @@ static void on_search_entry_changed(GtkSearchEntry *, GBintreePanel *);
static void apply_filter_on_portions(GtkTreeStore *);
/* Réagit au changement de sélection des portions. */
-static void on_bintree_selection_changed(GtkTreeSelection *, GBintreePanel *);
+static void on_bintree_selection_changed(GtkTreeSelection *, gpointer);
@@ -686,7 +687,7 @@ static void apply_filter_on_portions(GtkTreeStore *store)
/******************************************************************************
* *
* Paramètres : selection = sélection modifiée. *
-* panel = structure contenant les informations maîtresses. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit au changement de sélection des portions. *
* *
@@ -696,7 +697,7 @@ static void apply_filter_on_portions(GtkTreeStore *store)
* *
******************************************************************************/
-static void on_bintree_selection_changed(GtkTreeSelection *selection, GBintreePanel *panel)
+static void on_bintree_selection_changed(GtkTreeSelection *selection, gpointer unused)
{
GtkTreeIter iter; /* Point de sélection */
GtkTreeModel *model; /* Modèle de gestion */
@@ -712,8 +713,9 @@ static void on_bintree_selection_changed(GtkTreeSelection *selection, GBintreePa
{
range = g_binary_portion_get_range(portion);
- display = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
+ display = get_current_view();
gtk_display_panel_request_move(display, get_mrange_addr(range));
+ g_object_unref(G_OBJECT(display));
g_object_unref(G_OBJECT(portion));
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c
index 9b360f3..20d2bd0 100644
--- a/src/gui/panels/bookmarks.c
+++ b/src/gui/panels/bookmarks.c
@@ -36,6 +36,7 @@
#include "panel-int.h"
+#include "../core/global.h"
#include "../../analysis/db/items/bookmark.h"
#include "../../common/cpp.h"
#include "../../common/extstr.h"
@@ -119,7 +120,7 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *, GLoadedBinary *);
static void on_collection_content_changed(GDbCollection *, DBAction, GDbBookmark *, GBookmarksPanel *);
/* Réagit au changement de sélection des signets. */
-static void on_bookmarks_selection_change(GtkTreeSelection *, GBookmarksPanel *);
+static void on_bookmarks_selection_change(GtkTreeSelection *, gpointer);
@@ -337,7 +338,7 @@ static void g_bookmarks_panel_init(GBookmarksPanel *panel)
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
- g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(on_bookmarks_selection_change), panel);
+ g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(on_bookmarks_selection_change), NULL);
/* Préparation du menu contextuel */
@@ -646,7 +647,7 @@ static void on_collection_content_changed(GDbCollection *collec, DBAction action
/******************************************************************************
* *
* Paramètres : selection = sélection modifiée. *
-* panel = structure contenant les informations maîtresses. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit au changement de sélection des signets. *
* *
@@ -656,7 +657,7 @@ static void on_collection_content_changed(GDbCollection *collec, DBAction action
* *
******************************************************************************/
-static void on_bookmarks_selection_change(GtkTreeSelection *selection, GBookmarksPanel *panel)
+static void on_bookmarks_selection_change(GtkTreeSelection *selection, gpointer unused)
{
GtkTreeIter iter; /* Point de sélection */
GtkTreeModel *model; /* Modèle de gestion */
@@ -670,8 +671,9 @@ static void on_bookmarks_selection_change(GtkTreeSelection *selection, GBookmark
addr = g_db_bookmark_get_address(bookmark);
- display = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
+ display = get_current_view();
gtk_display_panel_request_move(display, addr);
+ g_object_unref(G_OBJECT(display));
g_object_unref(G_OBJECT(bookmark));
@@ -1061,8 +1063,9 @@ static gboolean on_button_press_over_bookmarks(GtkWidget *widget, GdkEventButton
addr = g_db_bookmark_get_address(bookmark);
- display = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
+ display = get_current_view();
gtk_display_panel_request_move(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 842f0ec..67965b5 100644
--- a/src/gui/panels/errors.c
+++ b/src/gui/panels/errors.c
@@ -34,6 +34,7 @@
#include "panel-int.h"
+#include "../core/global.h"
#include "../../core/global.h"
#include "../../format/format.h"
#include "../../gtkext/support.h"
@@ -140,7 +141,7 @@ static void filter_error_panel(GErrorPanel *, GtkStatusStack *, activity_id_t);
static void update_error_panel_summary(GPanelUpdate *, GErrorPanel *);
/* Réagit au changement de sélection des portions. */
-static void on_error_selection_changed(GtkTreeSelection *, GErrorPanel *);
+static void on_error_selection_changed(GtkTreeSelection *, gpointer);
@@ -925,7 +926,7 @@ static void update_error_panel_summary(GPanelUpdate *update, GErrorPanel *panel)
/******************************************************************************
* *
* Paramètres : selection = sélection modifiée. *
-* panel = structure contenant les informations maîtresses. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit au changement de sélection des portions. *
* *
@@ -935,7 +936,7 @@ static void update_error_panel_summary(GPanelUpdate *update, GErrorPanel *panel)
* *
******************************************************************************/
-static void on_error_selection_changed(GtkTreeSelection *selection, GErrorPanel *panel)
+static void on_error_selection_changed(GtkTreeSelection *selection, gpointer unused)
{
GtkTreeIter iter; /* Point de sélection */
GtkTreeModel *model; /* Modèle de gestion */
@@ -946,8 +947,9 @@ static void on_error_selection_changed(GtkTreeSelection *selection, GErrorPanel
{
gtk_tree_model_get(model, &iter, ETC_ADDR, &addr, -1);
- display = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
+ display = get_current_view();
gtk_display_panel_request_move(display, addr);
+ g_object_unref(G_OBJECT(display));
delete_vmpa(addr);
diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c
index 8e7c702..c9d971e 100644
--- a/src/gui/panels/strings.c
+++ b/src/gui/panels/strings.c
@@ -30,6 +30,7 @@
#include "panel-int.h"
+#include "../core/global.h"
#include "../dialogs/gotox.h"
#include "../../common/extstr.h"
#include "../../core/params.h"
@@ -105,7 +106,7 @@ static void g_strings_panel_finalize(GStringsPanel *);
static void change_strings_panel_current_binary(GStringsPanel *, GLoadedBinary *);
/* Réagit au changement de sélection des chaînes textuelles. */
-static void on_strings_selection_change(GtkTreeSelection *, GStringsPanel *);
+static void on_strings_selection_change(GtkTreeSelection *, gpointer);
/* Etablit une comparaison entre deux chaînes de caractères. */
static gint compare_strings_list_columns(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *, gpointer);
@@ -338,7 +339,7 @@ static void g_strings_panel_init(GStringsPanel *panel)
g_generic_config_get_value(get_main_configuration(), MPK_DISPLAY_ON_SEL, &display);
if (display)
- g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(on_strings_selection_change), panel);
+ g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(on_strings_selection_change), NULL);
/* Préparation du menu contextuel */
@@ -572,7 +573,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin
/******************************************************************************
* *
* Paramètres : selection = sélection modifiée. *
-* panel = structure contenant les informations maîtresses. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit au changement de sélection des chaînes textuelles. *
* *
@@ -582,7 +583,7 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin
* *
******************************************************************************/
-static void on_strings_selection_change(GtkTreeSelection *selection, GStringsPanel *panel)
+static void on_strings_selection_change(GtkTreeSelection *selection, gpointer unused)
{
GtkTreeIter iter; /* Point de sélection */
GtkTreeModel *model; /* Modèle de gestion */
@@ -596,8 +597,9 @@ static void on_strings_selection_change(GtkTreeSelection *selection, GStringsPan
addr = get_mrange_addr(g_binary_symbol_get_range(symbol));
- display = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
+ display = get_current_view();
gtk_display_panel_request_move(display, addr);
+ g_object_unref(G_OBJECT(display));
g_object_unref(G_OBJECT(symbol));
@@ -835,8 +837,9 @@ static gboolean on_button_event_over_strings(GtkWidget *widget, GdkEventButton *
addr = get_mrange_addr(g_binary_symbol_get_range(symbol));
- display = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
+ display = get_current_view();
gtk_display_panel_request_move(display, addr);
+ g_object_unref(G_OBJECT(display));
g_object_unref(G_OBJECT(symbol));
@@ -1042,7 +1045,7 @@ static void mcb_strings_panel_find_refs(GtkMenuItem *menuitem, GStringsPanel *pa
range = g_binary_symbol_get_range(symbol);
- binary = g_editor_item_get_current_binary(G_EDITOR_ITEM(panel));
+ binary = get_current_binary();
proc = g_loaded_binary_get_processor(binary);
/**
@@ -1059,8 +1062,9 @@ static void mcb_strings_panel_find_refs(GtkMenuItem *menuitem, GStringsPanel *pa
{
addr = get_address_from_gotox_dialog(dialog);
- display = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
+ display = get_current_view();
gtk_display_panel_request_move(display, addr);
+ g_object_unref(G_OBJECT(display));
delete_vmpa(addr);
@@ -1072,6 +1076,7 @@ static void mcb_strings_panel_find_refs(GtkMenuItem *menuitem, GStringsPanel *pa
g_object_unref(G_OBJECT(instr));
g_object_unref(G_OBJECT(proc));
+ g_object_unref(G_OBJECT(binary));
g_object_unref(G_OBJECT(symbol));
diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c
index e73a847..5bd4eae 100644
--- a/src/gui/panels/symbols.c
+++ b/src/gui/panels/symbols.c
@@ -37,6 +37,7 @@
#include "panel-int.h"
+#include "../core/global.h"
#include "../../format/format.h"
#include "../../gtkext/easygtk.h"
#include "../../gtkext/support.h"
@@ -107,7 +108,7 @@ static void g_symbols_panel_finalize(GSymbolsPanel *);
static void on_symbols_display_change(GtkToggleToolButton *, GSymbolsPanel *);
/* Réagit au changement de sélection des symboles. */
-static void on_symbols_selection_change(GtkTreeSelection *, GSymbolsPanel *);
+static void on_symbols_selection_change(GtkTreeSelection *, gpointer);
/* Réagit à un changement d'affichage principal de contenu. */
static void change_symbols_panel_current_binary(GSymbolsPanel *, GLoadedBinary *);
@@ -387,7 +388,7 @@ static void g_symbols_panel_init(GSymbolsPanel *panel)
select = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
- g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(on_symbols_selection_change), panel);
+ g_signal_connect(G_OBJECT(select), "changed", G_CALLBACK(on_symbols_selection_change), NULL);
}
@@ -531,7 +532,7 @@ static void on_symbols_display_change(GtkToggleToolButton *button, GSymbolsPanel
/******************************************************************************
* *
* Paramètres : selection = sélection modifiée. *
-* panel = structure contenant les informations maîtresses. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit au changement de sélection des symboles. *
* *
@@ -541,7 +542,7 @@ static void on_symbols_display_change(GtkToggleToolButton *button, GSymbolsPanel
* *
******************************************************************************/
-static void on_symbols_selection_change(GtkTreeSelection *selection, GSymbolsPanel *panel)
+static void on_symbols_selection_change(GtkTreeSelection *selection, gpointer unused)
{
GtkTreeIter iter; /* Point de sélection */
GtkTreeModel *model; /* Modèle de gestion */
@@ -557,8 +558,9 @@ static void on_symbols_selection_change(GtkTreeSelection *selection, GSymbolsPan
{
range = g_binary_symbol_get_range(symbol);
- display = g_editor_item_get_current_view(G_EDITOR_ITEM(panel));
+ display = get_current_view();
gtk_display_panel_request_move(display, get_mrange_addr(range));
+ g_object_unref(G_OBJECT(display));
g_object_unref(G_OBJECT(symbol));
diff --git a/src/gui/panels/welcome.c b/src/gui/panels/welcome.c
index a20810c..44ff517 100644
--- a/src/gui/panels/welcome.c
+++ b/src/gui/panels/welcome.c
@@ -37,6 +37,7 @@
#include "panel-int.h"
+#include "../../analysis/project.h"
#include "../../common/cpp.h"
#include "../../common/io.h"
#include "../../common/net.h"
diff --git a/src/gui/status.c b/src/gui/status.c
index 5043a9b..bd52310 100644
--- a/src/gui/status.c
+++ b/src/gui/status.c
@@ -222,15 +222,14 @@ GEditorItem *g_status_info_new(GObject *ref)
static void track_caret_address_for_status_info(GStatusInfo *info, GtkBufferDisplay *display, const vmpa2t *addr)
{
- GEditorItem *item; /* Autre version de l'élément */
GLoadedBinary *binary; /* Binaire courant */
- item = G_EDITOR_ITEM(info);
-
- binary = g_editor_item_get_current_binary(item);
+ binary = get_current_binary();
focus_address_in_status_info(info, binary, addr);
+ g_object_unref(G_OBJECT(binary));
+
}
diff --git a/src/gui/tb/portions.c b/src/gui/tb/portions.c
index f9d400d..685f5ba 100644
--- a/src/gui/tb/portions.c
+++ b/src/gui/tb/portions.c
@@ -29,6 +29,8 @@
#include "tbitem-int.h"
+#include "../core/global.h"
+#include "../core/items.h"
#include "../../format/format.h"
#include "../../gtkext/gtkbinarystrip.h"
@@ -228,7 +230,7 @@ static void update_portions_item_binary(GEditorItem *item, GLoadedBinary *binary
* *
* Paramètres : strip = composant d'affichage parcouru. *
* addr = nouvelle adresse du curseur courant. *
-* ref = espace de référencement global. *
+* item = élément d'éditeur représenté ici. *
* *
* Description : Fait suivre un changement d'adresse dans la barre. *
* *
@@ -242,12 +244,18 @@ static void track_address_on_binary_strip(GtkBinaryStrip *strip, GEditorItem *it
{
const vmpa2t *addr; /* Nouvelle destination */
GtkDisplayPanel *panel; /* Afficheur effectif de code */
+ GLoadedBinary *binary; /* Binaire chargé et actif */
addr = gtk_binary_strip_get_location(strip);
- panel = g_editor_item_get_current_view(item);
+ panel = get_current_view();
+ binary = get_current_binary();
+
gtk_display_panel_request_move(panel, addr);
- focus_address_in_editor_items(g_editor_item_get_current_binary(item), addr, item);
+ focus_address_in_editor_items(binary, addr, item);
+
+ g_object_unref(G_OBJECT(binary));
+ g_object_unref(G_OBJECT(panel));
}