summaryrefslogtreecommitdiff
path: root/src/gtkext/gtkbinview.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtkext/gtkbinview.c')
-rw-r--r--src/gtkext/gtkbinview.c433
1 files changed, 0 insertions, 433 deletions
diff --git a/src/gtkext/gtkbinview.c b/src/gtkext/gtkbinview.c
deleted file mode 100644
index 2fe88ad..0000000
--- a/src/gtkext/gtkbinview.c
+++ /dev/null
@@ -1,433 +0,0 @@
-
-/* OpenIDA - Outil d'analyse de fichiers binaires
- * gtkbinview.c - affichage d'un ou de plusieurs morceaux de code
- *
- * Copyright (C) 2008-2010 Cyrille Bagard
- *
- * This file is part of OpenIDA.
- *
- * OpenIDA is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * OpenIDA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include "gtkbinview.h"
-
-
-#include "gtkbinview-int.h"
-
-
-
-/* Acquitement d'une fin d'attachement */
-typedef struct _bv_loading_ack
-{
- bool lines_set; /* Construction complète */
- GMutex *mutex; /* Accès à la variable */
- GCond *cond; /* Attente de changement */
-
-} bv_loading_ack;
-
-
-/* Prend acte de l'association d'un binaire chargé. */
-static void gtk_bin_view_attach_binary(GtkBinView *, GLoadedBinary *);
-
-/* Prend note de la fin d'une construction d'une visualisation. */
-static void ack_loaded_lines_for_bin_view(GtkBinView *, bv_loading_ack *);
-
-
-
-
-
-
-/* Détermine le type du composant d'affichage des morceaux. */
-G_DEFINE_TYPE(GtkBinView, gtk_binview, GTK_TYPE_VIEW_PANEL)
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : class = classe GTK à initialiser. *
-* *
-* Description : Procède à l'initialisation de l'afficheur de morceaux. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void gtk_binview_class_init(GtkBinViewClass *class)
-{
- g_signal_new("lines-set",
- GTK_TYPE_BIN_VIEW,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GtkBinViewClass, lines_set),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à initialiser. *
-* *
-* Description : Procède à l'initialisation de l'afficheur de morceaux. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void gtk_binview_init(GtkBinView *view)
-{
- GtkViewPanel *panel; /* Instance parente */
-
- panel = GTK_VIEW_PANEL(view);
-
- panel->attach = (attach_binary_fc)gtk_bin_view_attach_binary;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Crée un nouveau composant pour l'affichage de morceaux. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GtkWidget* gtk_binview_new(void)
-{
- return g_object_new(GTK_TYPE_BIN_VIEW, NULL);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à mettre à jour. *
-* binary = binaire associé à intégrer. *
-* *
-* Description : Prend acte de l'association d'un binaire chargé. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void gtk_bin_view_attach_binary(GtkBinView *view, GLoadedBinary *binary)
-{
- bv_loading_ack ack; /* Informations d'acquitement */
-
- ack.lines_set = false;
- ack.mutex = g_mutex_new();
- ack.cond = g_cond_new();
-
- g_signal_connect(view, "lines-set", G_CALLBACK(ack_loaded_lines_for_bin_view), &ack);
-
- /*
- gtk_bin_view_set_rendering_lines(view, binary,
- g_loaded_binary_get_lines(binary), NULL);
- */
-
- /* Attente de la fin de construction */
- g_mutex_lock(ack.mutex);
- while (!ack.lines_set)
- g_cond_wait(ack.cond, ack.mutex);
- g_mutex_unlock(ack.mutex);
-
- g_signal_handlers_disconnect_by_func(view, G_CALLBACK(ack_loaded_lines_for_bin_view), &ack);
-
- g_mutex_free(ack.mutex);
- g_cond_free(ack.cond);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant d'affichage prêt à utilisation. *
-* ack = paramètres nécessaires à l'acquitement. *
-* *
-* Description : Prend note de la fin d'une construction d'une visualisation. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void ack_loaded_lines_for_bin_view(GtkBinView *view, bv_loading_ack *ack)
-{
- g_mutex_lock(ack->mutex);
-
- ack->lines_set = true;
-
- g_cond_signal(ack->cond);
- g_mutex_unlock(ack->mutex);
-
-}
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à mettre à jour. *
-* show = état de l'affichage auquel parvenir. *
-* *
-* Description : Définit si une bordure est à afficher. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void gtk_bin_view_show_border(GtkBinView *view, bool show)
-{
- /* FIXME : à déplacer vers GtkViewPanel */
- GTK_VIEW_PANEL(view)->show_border = show;
-
-}
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à mettre à jour. *
-* binary = contenu binaire dont les lignes sont issues. *
-* lines = informations à intégrer. *
-* last = dernière ligne à intégrer ou NULL pour toutes. *
-* *
-* Description : Définit les lignes à associer à la représentation. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void gtk_bin_view_set_rendering_lines(GtkBinView *view, GLoadedBinary *binary, GRenderingLine *lines, GRenderingLine *last)
-{
- view->binary = binary;
-
- view->lines = lines;
- view->last = last;
-
- view->set_lines(view, lines, last);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à consulter. *
-* *
-* Description : Fournit la liste des lignes associées à la représentation. *
-* *
-* Retour : Ligne de représentation. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *gtk_bin_view_get_lines(const GtkBinView *view)
-{
- return view->lines;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à consulter. *
-* *
-* Description : Fournit la dernière ligne associée à la représentation. *
-* *
-* Retour : Ligne de représentation. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GRenderingLine *gtk_bin_view_get_last_line(const GtkBinView *view)
-{
- return view->last; /* FIXME last == NULL */
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : binview = composant GTK à manipuler. *
-* show = état de l'affichage auquel parvenir. *
-* *
-* Description : Choisit d'afficher les adresses virtuelles ou non. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void gtk_binview_show_vaddress(GtkBinView *binview, gboolean show)
-{
- GList *list; /* Ensemble des enfants */
- GList *iter; /* Boucle de parcours */
-
- list = gtk_container_get_children(GTK_CONTAINER(binview));
-
- for (iter = g_list_first(list); iter != NULL; iter = g_list_next(iter))
- /*gtk_snippet_show_vaddress(GTK_SNIPPET(iter->data), show)*/;
-
- g_list_free(list);
-
-}
-
-
-
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : binview = composant GTK à manipuler. *
-* show = état de l'affichage auquel parvenir. *
-* *
-* Description : Choisit d'afficher le code brut ou non. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void gtk_binview_show_code(GtkBinView *binview, gboolean show)
-{
- GList *list; /* Ensemble des enfants */
- GList *iter; /* Boucle de parcours */
-
- list = gtk_container_get_children(GTK_CONTAINER(binview));
-
- for (iter = g_list_first(list); iter != NULL; iter = g_list_next(iter))
- /*gtk_snippet_show_code(GTK_SNIPPET(iter->data), show)*/;
-
- g_list_free(list);
-
-}
-
-
-
-
-
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à manipuler. *
-* addr = adresse à rechercher. *
-* *
-* Description : Indique si la vue contient une addrese donnée. *
-* *
-* Retour : true si l'adresse est présente, false sinon. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-bool gtk_bin_view_contain_address(const GtkBinView *view, vmpa_t addr)
-{
- gint dummy_x; /* Abscisse pour l'appel */
- gint dummy_y; /* Ordonnée pour l'appel */
-
- return view->get_coordinates(view, addr, &dummy_x, &dummy_y);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à manipuler. *
-* addr = adresse à présenter à l'écran. *
-* *
-* Description : S'assure qu'une adresse donnée est visible à l'écran. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void gtk_bin_view_scroll_to_address(GtkBinView *view, vmpa_t addr)
-{
- /* FIXME */
-#if 0
- gint x; /* Abscisse à garantir */
- gint y; /* Ordonnée à garantir */
- GtkAdjustment *adj; /* Défilement à mettre à jour */
-
- if (view->define_address != NULL)
- view->define_address(view, addr);
-
- if (view->get_coordinates(view, addr, &x, &y))
- {
- adj = view->hadjustment;
-
- if (x > (adj->upper - adj->page_size))
- x = adj->upper - adj->page_size;
-
- gtk_adjustment_set_value(adj, x);
-
- adj = view->vadjustment;
-
- if (y > (adj->upper - adj->page_size))
- y = adj->upper - adj->page_size;
-
- gtk_adjustment_set_value(adj, y);
-
- }
-#endif
-}