summaryrefslogtreecommitdiff
path: root/src/gtkext/gtkblockview.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-12-30 10:38:52 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-12-30 10:38:52 (GMT)
commit932ea7c83c07d3982fee605c6dd9895fd2753874 (patch)
tree766ad53bab9e3e3005334c30e823493de8e84168 /src/gtkext/gtkblockview.c
parent1b5d39bfbc48c33a0ea0924b60e48448c8b45dd4 (diff)
Rewritten the line buffers using generators and on-demand building to save memory.
Diffstat (limited to 'src/gtkext/gtkblockview.c')
-rw-r--r--src/gtkext/gtkblockview.c289
1 files changed, 0 insertions, 289 deletions
diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c
deleted file mode 100644
index 82743b0..0000000
--- a/src/gtkext/gtkblockview.c
+++ /dev/null
@@ -1,289 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * gtkblockview.c - affichage d'un fragment de code d'assemblage
- *
- * Copyright (C) 2008-2012 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 "gtkblockview.h"
-
-
-#include "gtkbufferview-int.h"
-
-
-
-/* -------------------------- INTERACTION DIRECTE AVEC GTK -------------------------- */
-
-
-/* Composant d'affichage de bloc d'assembleur (instance) */
-struct _GtkBlockView
-{
- GtkBufferView parent; /* A laisser en premier */
-
-};
-
-/* Composant d'affichage de code d'assembleur (classe) */
-struct _GtkBlockViewClass
-{
- GtkBufferViewClass parent; /* A laisser en premier */
-
- /* Signaux */
-
- void (* highlight_changed) (GtkBlockView *);
-
-};
-
-
-/* Procède à l'initialisation des afficheurs de bloc assembleur. */
-static void gtk_block_view_class_init(GtkBlockViewClass *);
-
-/* Procède à l'initialisation de l'afficheur de bloc assembleur. */
-static void gtk_block_view_init(GtkBlockView *);
-
-/* Réagit à un déplacement de curseur. */
-static bool gtk_block_view_notify_caret_relocation(GtkBlockView *, const GdkRectangle *, const vmpa2t *);
-
-/* Assure la gestion des clics de souris sur le composant. */
-static gboolean gtk_block_view_button_press_event(GtkBlockView *, GdkEventButton *, gpointer);
-
-/* Redessine l'affichage suite à un changement visuel. */
-static gboolean gtk_block_view_need_redraw(GBufferView *, GtkBlockView *);
-
-/* Prend acte de l'association d'un binaire chargé. */
-static void gtk_block_view_attach_binary(GtkBlockView *, GLoadedBinary *);
-
-
-
-/* ---------------------------------------------------------------------------------- */
-/* INTERACTION DIRECTE AVEC GTK */
-/* ---------------------------------------------------------------------------------- */
-
-
-/* Détermine le type du composant d'affichage de bloc en langage d'assemblage. */
-G_DEFINE_TYPE(GtkBlockView, gtk_block_view, GTK_TYPE_BUFFER_VIEW)
-
-
-/******************************************************************************
-* *
-* Paramètres : class = classe GTK à initialiser. *
-* *
-* Description : Procède à l'initialisation des afficheurs de bloc assembleur.*
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void gtk_block_view_class_init(GtkBlockViewClass *class)
-{
- GtkDisplayPanelClass *panel_class; /* Classe parente */
- GtkBufferViewClass *buffer_class; /* Classe supérieure */
-
- panel_class = GTK_DISPLAY_PANEL_CLASS(class);
- buffer_class = GTK_BUFFER_VIEW_CLASS(class);
-
- panel_class->attach = (attach_binary_fc)gtk_block_view_attach_binary;
-
- buffer_class->notify_caret = (notify_caret_relocation_fc)gtk_block_view_notify_caret_relocation;
-
- g_signal_new("highlight-changed",
- GTK_TYPE_BLOCK_VIEW,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET(GtkBlockViewClass, highlight_changed),
- 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 bloc assembleur.*
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void gtk_block_view_init(GtkBlockView *view)
-{
-
-
- /*
- g_signal_connect(G_OBJECT(view), "button_press_event",
- G_CALLBACK(gtk_block_view_button_press_event), NULL);
- */
-
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à manipuler. *
-* area = emplacement pour le dessin d'un curseur. *
-* addr = position dans la mémoire représentée du curseur. *
-* *
-* Description : Réagit à un déplacement de curseur. *
-* *
-* Retour : true si un changement a été opéré. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static bool gtk_block_view_notify_caret_relocation(GtkBlockView *view, const GdkRectangle *area, const vmpa2t *addr)
-{
- bool result; /* Bilan à retourner */
-
- result = g_buffer_view_highlight_segments(GTK_BUFFER_VIEW(view)->buffer_view, area->x, area->y,
- GTK_DISPLAY_PANEL(view)->display);
-
- if (result)
- g_signal_emit_by_name(view, "highlight-changed");
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : - *
-* *
-* Description : Crée un nouveau composant pour l'affichage de bloc en ASM. *
-* *
-* Retour : Composant GTK créé. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GtkWidget *gtk_block_view_new(void)
-{
- GtkBlockView *result; /* Composant à retourner */
-
- result = g_object_new(GTK_TYPE_BLOCK_VIEW, NULL);
-
- return GTK_WIDGET(result);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK visé par l'opération. *
-* event = informations liées à l'événement. *
-* data = donnée non utilisée ici. *
-* *
-* Description : Assure la gestion des clics de souris sur le composant. *
-* *
-* Retour : FALSE pour poursuivre la propagation de l'événement. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static gboolean gtk_block_view_button_press_event(GtkBlockView *view, GdkEventButton *event, gpointer data)
-{
- GtkBufferView *bview; /* Autre vision du composant */
- gint real_x; /* Abscisse absolue réelle */
- gint real_y; /* Ordonnée absolue réelle */
-
- if (event->type == GDK_2BUTTON_PRESS)
- {
-
-
-
- printf("I feel %s clicked with button %d\n",
- event->type == GDK_2BUTTON_PRESS ? "double" : "triple",
- event->button);
-
- bview = GTK_BUFFER_VIEW(view);
-
- real_x = event->x;
- real_y = event->y;
-
- gtk_display_panel_compute_real_coord(GTK_DISPLAY_PANEL(bview), &real_x, &real_y);
-
- g_buffer_view_highlight_segments(gtk_buffer_view_get_buffer(bview), real_x, real_y, NULL);
-
-
-
- }
-
- return FALSE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GLib interne. *
-* block = composant GTK d'affichage. *
-* *
-* Description : Redessine l'affichage suite à un changement visuel. *
-* *
-* Retour : FALSE pour poursuivre la propagation de l'événement. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static gboolean gtk_block_view_need_redraw(GBufferView *view, GtkBlockView *block)
-{
- gtk_widget_queue_draw(GTK_WIDGET(block));
-
- return FALSE;
-
-}
-
-
-/******************************************************************************
-* *
-* 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_block_view_attach_binary(GtkBlockView *view, GLoadedBinary *binary)
-{
- GCodeBuffer *buffer; /* Tampon par défaut */
- GBufferView *bview; /* Vue sur ce même tampon */
-
- buffer = g_loaded_binary_get_disassembled_buffer(binary);
- bview = g_buffer_view_new(buffer, NULL);
-
- gtk_buffer_view_attach_buffer(GTK_BUFFER_VIEW(view), bview);
-
- g_signal_connect(G_OBJECT(bview), "need-redraw",
- G_CALLBACK(gtk_block_view_need_redraw), view);
-
-}