summaryrefslogtreecommitdiff
path: root/src/gui/core/global.c
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/gui/core/global.c
parent4fb2ac107092671fe27fc3ebf9fc86dff7c3ec19 (diff)
Removed most of the functions using the editor items as global access to active items.
Diffstat (limited to 'src/gui/core/global.c')
-rw-r--r--src/gui/core/global.c185
1 files changed, 184 insertions, 1 deletions
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;
+
+}