summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editor.c77
-rw-r--r--src/gtkext/Makefile.am3
-rw-r--r--src/gtkext/gtkbinview-int.h18
-rw-r--r--src/gtkext/gtkbinview.c267
-rw-r--r--src/gtkext/gtkbinview.h3
-rw-r--r--src/gtkext/gtkblockview.c80
-rw-r--r--src/gtkext/gtkgraphview.c51
-rw-r--r--src/gtkext/gtksourceview.c147
-rw-r--r--src/gtkext/gtksourceview.h57
-rw-r--r--src/gtkext/gtkviewpanel-int.h81
-rw-r--r--src/gtkext/gtkviewpanel.c361
-rw-r--r--src/gtkext/gtkviewpanel.h61
-rw-r--r--src/panels/panel-int.h2
-rw-r--r--src/panels/panel.c8
-rw-r--r--src/panels/panel.h4
-rw-r--r--src/panels/symbols.c21
-rw-r--r--src/project.c91
-rw-r--r--src/project.h7
18 files changed, 908 insertions, 431 deletions
diff --git a/src/editor.c b/src/editor.c
index 59401d9..a2741ab 100644
--- a/src/editor.c
+++ b/src/editor.c
@@ -47,6 +47,7 @@
#include "gtkext/gtkbinview.h"
#include "gtkext/gtkblockview.h"
#include "gtkext/gtkdockpanel.h"
+#include "gtkext/gtkviewpanel.h"
#include "debug/debugger.h"
#include "dialogs/about.h"
@@ -310,6 +311,13 @@ GtkWidget *create_editor(void)
g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_GRAPH));
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+ rgroup = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(submenuitem));
+
+ submenuitem = qck_create_radio_menu_item(ref, "sourceview", rgroup, _("Source code"), G_CALLBACK(mcb_view_change_support), result);
+ add_accelerator_to_menu_item(submenuitem, "F4", accgroup);
+ g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_SOURCE));
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
submenuitem = qck_create_menu_separator();
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -452,53 +460,6 @@ GtkWidget *create_editor(void)
gtk_paned_pack1(GTK_PANED(hpaned1), dpanel, TRUE, TRUE);
-#if 0
-
- scrolledwindow2 = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow2), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_widget_show (scrolledwindow2);
- //gtk_paned_pack1 (GTK_PANED (hpaned1), scrolledwindow2, FALSE, TRUE);
-
-
- ditem = g_dock_item_new(_("Binary code"), scrolledwindow2);
- gtk_dock_panel_add_item(dpanel, ditem);
-
-
- view = gtk_graph_view_new();
- g_object_set_data(G_OBJECT(result), "grahview", view);
- //gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow2), binview);
- //gtk_container_add(GTK_CONTAINER(scrolledwindow2), binview);
-
-
- view = gtk_binview_new();
- g_object_set_data(G_OBJECT(result), "binview", view);
-
- snippet = gtk_snippet_new();
- g_object_set_data(G_OBJECT(result), "snippet", snippet);
- gtk_widget_show(view);
- /*
- snippet = gtk_text_view_new ();
- */
- gtk_widget_show (snippet);
- /*gtk_container_add (GTK_CONTAINER (scrolledwindow2), snippet);*/
- //gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow2), snippet);
-
- gtk_container_add(GTK_CONTAINER(view), snippet);
-
-
-
-
-
- //binview = gtk_fixed_new();
- gtk_widget_show(view);
- //g_object_set_data(G_OBJECT(result), "binview", binview);
- gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow2), view);
- //gtk_container_add(GTK_CONTAINER(scrolledwindow2), binview);
-
-
-#endif
-
-
@@ -899,7 +860,7 @@ void mcb_view_change_support(GtkRadioMenuItem *menuitem, GObject *ref)
GSList *iter; /* Boucle de parcours */
BinaryView view; /* Nouvelle vue à présenter */
GOpenidaBinary *binary; /* Edition courante */
- GtkBinView *binview; /* Afficheur effectif de code */
+ GtkViewPanel *pview; /* Afficheur effectif de code */
GtkWidget *panel; /* Nouveau support à utiliser */
GDockItem *ditem; /* Panneau avec ses infos. */
@@ -915,15 +876,15 @@ void mcb_view_change_support(GtkRadioMenuItem *menuitem, GObject *ref)
view = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(iter->data), "kind_of_view"));
binary = (GOpenidaBinary *)g_object_get_data(ref, "current_binary");
- panel = get_view_for_openida_project_binary(get_current_openida_project(), binary, view, &binview);
+ panel = get_view_for_openida_project_binary(get_current_openida_project(), binary, view, &pview);
- g_object_set_data(ref, "binview", binview);
+ g_object_set_data(ref, "current_view", pview);
ditem = gtk_dock_panel_get_item_from_binary(get_current_openida_project(), binary);
g_dock_item_set_panel(ditem, panel);
- notify_panels_of_view_change(binview, true);
+ notify_panels_of_view_change(pview, true);
}
@@ -948,6 +909,9 @@ void mcb_view_vaddress(GtkCheckMenuItem *menuitem, gpointer data)
GtkBinView *binview; /* Zone de code principale */
gboolean active; /* Etat de sélection du menu */
+ /* FIXME : "binview" -> "current_view" */
+ return;
+
binview = GTK_BIN_VIEW(g_object_get_data(G_OBJECT(data), "binview"));
active = gtk_check_menu_item_get_active(menuitem);
@@ -974,6 +938,9 @@ void mcb_view_code(GtkCheckMenuItem *menuitem, gpointer data)
GtkBinView *binview; /* Zone de code principale */
gboolean active; /* Etat de sélection du menu */
+ /* FIXME : "binview" -> "current_view" */
+ return;
+
binview = GTK_BIN_VIEW(g_object_get_data(G_OBJECT(data), "binview"));
active = gtk_check_menu_item_get_active(menuitem);
@@ -1479,12 +1446,12 @@ static void on_dock_item_switch(GtkDockPanel *panel, GDockItem *item, GObject *r
if (GTK_IS_VIEWPORT(widget))
widget = gtk_bin_get_child(GTK_BIN(widget));
- if (GTK_IS_BIN_VIEW(widget))
+ if (GTK_IS_VIEW_PANEL(widget))
{
/* Changement de binaire ? */
old_binary = G_OPENIDA_BINARY(g_object_get_data(ref, "current_binary"));
- binary = gtk_bin_view_get_binary(GTK_BIN_VIEW(widget));
+ binary = gtk_view_panel_get_binary(GTK_VIEW_PANEL(widget));
if (old_binary != binary)
{
@@ -1492,11 +1459,11 @@ static void on_dock_item_switch(GtkDockPanel *panel, GDockItem *item, GObject *r
notify_panels_of_binary_change(binary);
}
- g_object_set_data(ref, "binview", widget);
+ g_object_set_data(ref, "current_view", widget);
refresh_editor_menus(ref, binary, GTK_BIN_VIEW(widget));
- notify_panels_of_view_change(GTK_BIN_VIEW(widget), false);
+ notify_panels_of_view_change(GTK_VIEW_PANEL(widget), false);
}
diff --git a/src/gtkext/Makefile.am b/src/gtkext/Makefile.am
index fbfa0b6..d253edc 100644
--- a/src/gtkext/Makefile.am
+++ b/src/gtkext/Makefile.am
@@ -14,6 +14,9 @@ libgtkext_la_SOURCES = \
gtkdropwindow.h gtkdropwindow.c \
gtkgraphview.h gtkgraphview.c \
gtklinkrenderer.h gtklinkrenderer.c \
+ gtksourceview.h gtksourceview.c \
+ gtkviewpanel-int.h \
+ gtkviewpanel.h gtkviewpanel.c \
iodamarshal.h iodamarshal.c \
support.h support.c
diff --git a/src/gtkext/gtkbinview-int.h b/src/gtkext/gtkbinview-int.h
index ab72a84..51bc786 100644
--- a/src/gtkext/gtkbinview-int.h
+++ b/src/gtkext/gtkbinview-int.h
@@ -26,6 +26,7 @@
#include "gtkbinview.h"
+#include "gtkviewpanel-int.h"
#include <stdbool.h>
@@ -33,9 +34,6 @@
-/* Réagit à un défilement quelconque. */
-typedef void (* scroll_fc) (GtkBinView *);
-
/* Définit les lignes à associer à la représentation. */
typedef void (* set_rendering_lines_fc) (GtkBinView *, GRenderingLine *, GRenderingLine *);
@@ -48,21 +46,13 @@ typedef bool (* get_addr_coordinates_fc) (const GtkBinView *, vmpa_t, gint *, gi
struct _GtkBinView
{
- GtkFixed parent; /* A laisser en premier */
-
- GtkAdjustment *hadjustment; /* Barre de défilement horiz. */
- GtkAdjustment *vadjustment; /* Barre de défilement vert. */
-
- GdkGC *gc; /* Contexte graphique du rendu */
-
- bool show_border; /* Affichage d'une bordure ? */
+ GtkViewPanel parent; /* A laisser en premier */
GOpenidaBinary *binary; /* Contenu binaire affiché */
GRenderingLine *lines; /* Contenu à représenter */
GRenderingLine *last; /* Dernière ligne associée */
- scroll_fc scroll; /* Défilement du contenu */
set_rendering_lines_fc set_lines; /* Association des lignes */
define_main_address_fc define_address; /* Sélection externe d'adresse */
get_addr_coordinates_fc get_coordinates;/* Conversion adresse <-> pos. */
@@ -71,12 +61,10 @@ struct _GtkBinView
struct _GtkBinViewClass
{
- GtkFixedClass parent; /* A laisser en premier */
+ GtkViewPanelClass parent; /* A laisser en premier */
/* Signaux */
- void (* set_scroll_adjustments) (GtkBinView *, GtkAdjustment *, GtkAdjustment *);
-
void (* lines_set) (GtkBinView *);
};
diff --git a/src/gtkext/gtkbinview.c b/src/gtkext/gtkbinview.c
index 0a9ce6e..46fc9ce 100644
--- a/src/gtkext/gtkbinview.c
+++ b/src/gtkext/gtkbinview.c
@@ -25,27 +25,32 @@
#include "gtkbinview-int.h"
-#include "iodamarshal.h"
-/* Enregistrement les défilements à associer au composant GTK. */
-static void gtk_binview_set_scroll_adjustments(GtkBinView *, GtkAdjustment *, GtkAdjustment *);
+/* 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 *, GOpenidaBinary *);
-/* Encadre la construction graphique initiale de la visualisation. */
-static void gtk_bin_view_realize(GtkWidget *);
+/* Prend note de la fin d'une construction d'une visualisation. */
+static void ack_loaded_lines_for_bin_view(GtkBinView *, bv_loading_ack *);
-/* Met à jour l'affichage de la visualisation de code binaire. */
-static gboolean gtk_bin_view_expose(GtkBinView *, GdkEventExpose *);
-/* Prend acte d'un nouveau défilement. */
-static void gtk_bin_view_adj_value_changed(GtkAdjustment *, GtkBinView *);
/* Détermine le type du composant d'affichage des morceaux. */
-G_DEFINE_TYPE(GtkBinView, gtk_binview, GTK_TYPE_FIXED)
+G_DEFINE_TYPE(GtkBinView, gtk_binview, GTK_TYPE_VIEW_PANEL)
@@ -66,26 +71,6 @@ G_DEFINE_TYPE(GtkBinView, gtk_binview, GTK_TYPE_FIXED)
static void gtk_binview_class_init(GtkBinViewClass *class)
{
- GtkWidgetClass *widget_class; /* Classe de haut niveau */
-
- widget_class = GTK_WIDGET_CLASS(class);
-
- widget_class->realize = gtk_bin_view_realize;
- widget_class->expose_event = gtk_bin_view_expose;
-
- class->set_scroll_adjustments = gtk_binview_set_scroll_adjustments;
-
- widget_class->set_scroll_adjustments_signal =
- g_signal_new(("set_scroll_adjustments"),
- GTK_TYPE_BIN_VIEW,
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET(GtkBinViewClass, set_scroll_adjustments),
- NULL, NULL,
- g_cclosure_user_marshal_VOID__OBJECT_OBJECT,
- G_TYPE_NONE, 2,
- GTK_TYPE_ADJUSTMENT,
- GTK_TYPE_ADJUSTMENT);
-
g_signal_new("lines-set",
GTK_TYPE_BIN_VIEW,
G_SIGNAL_RUN_LAST,
@@ -99,34 +84,6 @@ static void gtk_binview_class_init(GtkBinViewClass *class)
/******************************************************************************
* *
-* Paramètres : view = vue à compléter. *
-* hadjustment = nouveau défilement horizontal à intégrer. *
-* vadjustment = nouveau défilement vertical à intégrer. *
-* *
-* Description : Enregistrement les défilements à associer au composant GTK. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void gtk_binview_set_scroll_adjustments(GtkBinView *view, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment)
-{
- view->hadjustment = hadjustment;
- view->vadjustment = vadjustment;
-
- g_signal_connect(hadjustment, "value_changed",
- G_CALLBACK(gtk_bin_view_adj_value_changed), view);
-
- g_signal_connect(vadjustment, "value_changed",
- G_CALLBACK(gtk_bin_view_adj_value_changed), view);
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : view = composant GTK à initialiser. *
* *
* Description : Procède à l'initialisation de l'afficheur de morceaux. *
@@ -139,7 +96,11 @@ static void gtk_binview_set_scroll_adjustments(GtkBinView *view, GtkAdjustment *
static void gtk_binview_init(GtkBinView *view)
{
- gtk_fixed_set_has_window(GTK_FIXED(view), TRUE);
+ GtkViewPanel *panel; /* Instance parente */
+
+ panel = GTK_VIEW_PANEL(view);
+
+ panel->attach = (attach_binary_fc)gtk_bin_view_attach_binary;
}
@@ -165,9 +126,10 @@ GtkWidget* gtk_binview_new(void)
/******************************************************************************
* *
-* Paramètres : widget = composant GTK à redessiner. *
+* Paramètres : view = composant GTK à mettre à jour. *
+* binary = binaire associé à intégrer. *
* *
-* Description : Encadre la construction graphique initiale de la visualisat°.*
+* Description : Prend acte de l'association d'un binaire chargé. *
* *
* Retour : - *
* *
@@ -175,88 +137,39 @@ GtkWidget* gtk_binview_new(void)
* *
******************************************************************************/
-static void gtk_bin_view_realize(GtkWidget *widget)
+static void gtk_bin_view_attach_binary(GtkBinView *view, GOpenidaBinary *binary)
{
- GdkWindowAttr attributes; /* Propriétés du composant */
- guint attributes_mask; /* Masque de prise en compte */
- GdkColor white; /* Couleur de fond normale */
-
- GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+ bv_loading_ack ack; /* Informations d'acquitement */
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ ack.lines_set = false;
+ ack.mutex = g_mutex_new();
+ ack.cond = g_cond_new();
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.event_mask = gtk_widget_get_events(widget)
- | GDK_BUTTON_PRESS_MASK | GDK_EXPOSURE_MASK;
+ g_signal_connect(view, "lines-set", G_CALLBACK(ack_loaded_lines_for_bin_view), &ack);
- attributes_mask = GDK_WA_X | GDK_WA_Y;
+ gtk_bin_view_set_rendering_lines(view, binary,
+ g_openida_binary_get_lines(binary), NULL);
- widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
- &attributes, attributes_mask);
+ /* 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);
- gdk_window_set_user_data(widget->window, widget);
+ g_signal_handlers_disconnect_by_func(view, G_CALLBACK(ack_loaded_lines_for_bin_view), &ack);
- widget->style = gtk_style_attach(widget->style, widget->window);
-
- gdk_color_white(gtk_widget_get_colormap(widget), &white);
- gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &white);
-
- GTK_BIN_VIEW(widget)->gc = gdk_gc_new(GDK_DRAWABLE(widget->window));
+ g_mutex_free(ack.mutex);
+ g_cond_free(ack.cond);
}
/******************************************************************************
* *
-* Paramètres : view = composant GTK à redessiner. *
-* event = informations liées à l'événement. *
-* *
-* Description : Met à jour l'affichage de la visualisation de code binaire. *
+* Paramètres : view = composant d'affichage prêt à utilisation. *
+* ack = paramètres nécessaires à l'acquitement. *
* *
-* Retour : FALSE pour poursuivre la propagation de l'événement. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static gboolean gtk_bin_view_expose(GtkBinView *view, GdkEventExpose *event)
-{
- GdkGCValues values; /* Propriétés du contexte */
- GtkStyle *style; /* Style associé au composant */
- int width; /* Largeur de l'élément */
- int height; /* Hauteur de l'élément */
-
- if (view->show_border)
- {
- gdk_gc_get_values(view->gc, &values);
- style = gtk_widget_get_style(GTK_WIDGET(view));
-
- gtk_widget_get_size_request(GTK_WIDGET(view), &width, &height);
-
- gdk_gc_set_foreground(view->gc, &style->dark[GTK_WIDGET_STATE(GTK_WIDGET(view))]);
-
- gdk_draw_rectangle(GDK_DRAWABLE(GTK_WIDGET(view)->window), view->gc,
- FALSE, 0, 0, width - 1, height - 1);
-
- gdk_gc_set_foreground(view->gc, &values.foreground);
-
- }
-
- return FALSE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à consulter. *
-* alloc = étendue à accorder à la vue. *
-* *
-* Description : Calcule la surface pleine utilisable pour la vue. *
+* Description : Prend note de la fin d'une construction d'une visualisation. *
* *
* Retour : - *
* *
@@ -264,82 +177,22 @@ static gboolean gtk_bin_view_expose(GtkBinView *view, GdkEventExpose *event)
* *
******************************************************************************/
-void gtk_bin_view_compute_allocation(GtkBinView *view, GtkAllocation *alloc)
+static void ack_loaded_lines_for_bin_view(GtkBinView *view, bv_loading_ack *ack)
{
- GtkWidget *widget; /* Autre version de la vue */
- GtkAllocation *allocation; /* Raccourci d'utilisation #1 */
- gint border_width; /* Raccourci d'utilisation #2 */
-
- widget = GTK_WIDGET(view);
- allocation = &widget->allocation;
- border_width = GTK_CONTAINER(view)->border_width;
+ g_mutex_lock(ack->mutex);
- alloc->x = 0;
- alloc->y = 0;
-
- /*
- if (viewport->shadow_type != GTK_SHADOW_NONE)
- {
- alloc->x = widget->style->xthickness;
- alloc->y = widget->style->ythickness;
- }
- */
+ ack->lines_set = true;
- alloc->width = MAX(1, allocation->width - alloc->x * 2 - border_width * 2);
- alloc->height = MAX(1, allocation->height - alloc->y * 2 - border_width * 2);
+ g_cond_signal(ack->cond);
+ g_mutex_unlock(ack->mutex);
}
-/******************************************************************************
-* *
-* Paramètres : adj = valeurs de défilement à consulter. *
-* changed = note une mise à jour de valeur. [OUT] *
-* *
-* Description : S'assure que la valeur de défilement actuelle est valable. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-void gtk_bin_view_reclamp_adjustment(GtkAdjustment *adj, gboolean *changed)
-{
- gdouble value; /* Valeur actuelle */
- value = adj->value;
-
- value = CLAMP(value, 0, adj->upper - adj->page_size);
- if (value != adj->value)
- {
- adj->value = value;
- *changed = TRUE;
- }
- else *changed = FALSE;
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : adj = défilement à l'origine de l'action. *
-* view = composant GTK à redessiner. *
-* *
-* Description : Prend acte d'un nouveau défilement. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void gtk_bin_view_adj_value_changed(GtkAdjustment *adj, GtkBinView *view)
-{
- view->scroll(view);
-
-}
/******************************************************************************
@@ -357,7 +210,8 @@ static void gtk_bin_view_adj_value_changed(GtkAdjustment *adj, GtkBinView *view)
void gtk_bin_view_show_border(GtkBinView *view, bool show)
{
- view->show_border = show;
+ /* FIXME : à déplacer vers GtkViewPanel */
+ GTK_VIEW_PANEL(view)->show_border = show;
}
@@ -395,25 +249,6 @@ void gtk_bin_view_set_rendering_lines(GtkBinView *view, GOpenidaBinary *binary,
* *
* Paramètres : view = composant GTK à consulter. *
* *
-* Description : Fournit le binaire associé à la représentation. *
-* *
-* Retour : Représentation de contenu binaire. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GOpenidaBinary *gtk_bin_view_get_binary(const GtkBinView *view)
-{
- return view->binary;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : view = composant GTK à consulter. *
-* *
* Description : Fournit la liste des lignes associées à la représentation. *
* *
* Retour : Ligne de représentation. *
@@ -566,6 +401,8 @@ bool gtk_bin_view_contain_address(const GtkBinView *view, vmpa_t addr)
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 */
@@ -590,5 +427,5 @@ void gtk_bin_view_scroll_to_address(GtkBinView *view, vmpa_t addr)
gtk_adjustment_set_value(adj, y);
}
-
+#endif
}
diff --git a/src/gtkext/gtkbinview.h b/src/gtkext/gtkbinview.h
index 2dae0eb..945eefb 100644
--- a/src/gtkext/gtkbinview.h
+++ b/src/gtkext/gtkbinview.h
@@ -59,9 +59,6 @@ void gtk_bin_view_show_border(GtkBinView *, bool);
/* Définit les lignes à associer à la représentation. */
void gtk_bin_view_set_rendering_lines(GtkBinView *, GOpenidaBinary *, GRenderingLine *, GRenderingLine *);
-/* Fournit le binaire associé à la représentation. */
-GOpenidaBinary *gtk_bin_view_get_binary(const GtkBinView *);
-
/* Fournit la liste des lignes associées à la représentation. */
GRenderingLine *gtk_bin_view_get_lines(const GtkBinView *);
diff --git a/src/gtkext/gtkblockview.c b/src/gtkext/gtkblockview.c
index a19c17a..66177b8 100644
--- a/src/gtkext/gtkblockview.c
+++ b/src/gtkext/gtkblockview.c
@@ -501,18 +501,20 @@ static void gtk_block_view_class_init(GtkBlockViewClass *klass)
static void gtk_block_view_init(GtkBlockView *view)
{
- GtkBinView *binview; /* Instance parente */
+ GtkViewPanel *viewpanel; /* Instance parente #1 */
+ GtkBinView *binview; /* Instance parente #2 */
+
+ viewpanel = GTK_VIEW_PANEL(view);
+
+ viewpanel->scroll = (scroll_fc)gtk_block_view_scroll;
binview = GTK_BIN_VIEW(view);
- binview->scroll = (scroll_fc)gtk_block_view_scroll;
binview->set_lines = (set_rendering_lines_fc)gtk_block_view_set_rendering_lines;
binview->get_coordinates = (get_addr_coordinates_fc)gtk_block_view_get_address_coordinates;
-
view->_buffer = g_code_buffer_new();
-
}
@@ -578,7 +580,7 @@ static void gtk_block_view_size_request(GtkWidget *widget, GtkRequisition *requi
static void gtk_block_view_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
- GtkBinView *view; /* Autre version du composant */
+ GtkViewPanel *panel; /* Autre version du composant */
gint width; /* Largeur de l'objet actuelle */
gint height; /* Hauteur de l'objet actuelle */
GtkAllocation valloc; /* Surface utilisable */
@@ -593,44 +595,44 @@ static void gtk_block_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
allocation->x, allocation->y,
allocation->width, allocation->height);
- view = GTK_BIN_VIEW(widget);
+ panel = GTK_VIEW_PANEL(widget);
- if (view->hadjustment == NULL || view->vadjustment == NULL)
+ if (panel->hadjustment == NULL || panel->vadjustment == NULL)
return;
- g_buffer_view_get_size(GTK_BLOCK_VIEW(view)->buffer_view, &width, &height);
+ g_buffer_view_get_size(GTK_BLOCK_VIEW(widget)->buffer_view, &width, &height);
- gtk_bin_view_compute_allocation(view, &valloc);
+ gtk_view_panel_compute_allocation(panel, &valloc);
/* Défilement horizontal */
- view->hadjustment->page_size = valloc.width;
- view->hadjustment->step_increment = valloc.width * 0.1;
- view->hadjustment->page_increment = valloc.width * 0.9;
+ panel->hadjustment->page_size = valloc.width;
+ panel->hadjustment->step_increment = valloc.width * 0.1;
+ panel->hadjustment->page_increment = valloc.width * 0.9;
- view->hadjustment->upper = MAX(width, valloc.width);
+ panel->hadjustment->upper = MAX(width, valloc.width);
- gtk_bin_view_reclamp_adjustment(view->hadjustment, &changed);
+ gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed);
- gtk_adjustment_changed(view->hadjustment);
+ gtk_adjustment_changed(panel->hadjustment);
if (changed)
- gtk_adjustment_value_changed(view->hadjustment);
+ gtk_adjustment_value_changed(panel->hadjustment);
/* Défilement vertical */
- view->vadjustment->page_size = valloc.height;
- view->vadjustment->step_increment = GTK_BLOCK_VIEW(view)->line_height;
- view->vadjustment->page_increment = view->vadjustment->step_increment * 10.0;
+ panel->vadjustment->page_size = valloc.height;
+ panel->vadjustment->step_increment = GTK_BLOCK_VIEW(widget)->line_height;
+ panel->vadjustment->page_increment = panel->vadjustment->step_increment * 10.0;
- view->vadjustment->upper = MAX(height, valloc.height);
+ panel->vadjustment->upper = MAX(height, valloc.height);
- gtk_bin_view_reclamp_adjustment(view->vadjustment, &changed);
+ gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed);
- gtk_adjustment_changed(view->vadjustment);
+ gtk_adjustment_changed(panel->vadjustment);
if (changed)
- gtk_adjustment_value_changed(view->vadjustment);
+ gtk_adjustment_value_changed(panel->vadjustment);
}
@@ -723,11 +725,11 @@ void gtk_block_view_update_margin(GRenderingLine *line, GtkBlockView *view)
static void gtk_block_view_compute_fake_coord(GtkBlockView *view, gint *x, gint *y)
{
- if (GTK_BIN_VIEW(view)->hadjustment != NULL)
- *x -= gtk_adjustment_get_value(GTK_BIN_VIEW(view)->hadjustment);
+ if (GTK_VIEW_PANEL(view)->hadjustment != NULL)
+ *x -= gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->hadjustment);
- if (GTK_BIN_VIEW(view)->vadjustment != NULL)
- *y += gtk_adjustment_get_value(GTK_BIN_VIEW(view)->vadjustment);
+ if (GTK_VIEW_PANEL(view)->vadjustment != NULL)
+ *y += gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->vadjustment);
}
@@ -747,11 +749,11 @@ static void gtk_block_view_compute_fake_coord(GtkBlockView *view, gint *x, gint
static void gtk_block_view_compute_real_coord(GtkBlockView *view, gint *x, gint *y)
{
- if (x != NULL && GTK_BIN_VIEW(view)->hadjustment != NULL)
- *x += gtk_adjustment_get_value(GTK_BIN_VIEW(view)->hadjustment);
+ if (x != NULL && GTK_VIEW_PANEL(view)->hadjustment != NULL)
+ *x += gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->hadjustment);
- if (y != NULL && GTK_BIN_VIEW(view)->vadjustment != NULL)
- *y += gtk_adjustment_get_value(GTK_BIN_VIEW(view)->vadjustment);
+ if (y != NULL && GTK_VIEW_PANEL(view)->vadjustment != NULL)
+ *y += gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->vadjustment);
}
@@ -840,7 +842,7 @@ static void gtk_block_view_draw_line_extra(GBufferLine *line, GdkDrawable *drawa
static gboolean gtk_block_view_expose(GtkWidget *widget, GdkEventExpose *event)
{
GtkBlockView *view; /* Autre version du composant */
- GtkBinView *bview; /* Autre version du composant */
+ GtkViewPanel *pview; /* Autre version du composant */
GtkStyle *style; /* Style associé au composant */
GdkDrawable *drawable; /* Surface de dessin */
gint fake_x; /* Abscisse virtuelle */
@@ -849,13 +851,13 @@ static gboolean gtk_block_view_expose(GtkWidget *widget, GdkEventExpose *event)
view = GTK_BLOCK_VIEW(widget);
widget = GTK_WIDGET(view);
- bview = GTK_BIN_VIEW(widget);
+ pview = GTK_VIEW_PANEL(widget);
drawable = GDK_DRAWABLE(event->window);
gdk_window_begin_paint_region(drawable, event->region);
- gdk_gc_set_clip_region(bview->gc, event->region);
+ gdk_gc_set_clip_region(pview->gc, event->region);
style = gtk_widget_get_style(GTK_WIDGET(view));
@@ -865,14 +867,14 @@ static gboolean gtk_block_view_expose(GtkWidget *widget, GdkEventExpose *event)
/* Dessin de la marge gauche */
- gdk_gc_set_foreground(bview->gc, &style->mid[GTK_WIDGET_STATE(widget)]);
+ gdk_gc_set_foreground(pview->gc, &style->mid[GTK_WIDGET_STATE(widget)]);
- gdk_draw_rectangle(drawable, bview->gc, TRUE,
+ gdk_draw_rectangle(drawable, pview->gc, TRUE,
fake_x, event->area.y, view->left_margin, event->area.y + event->area.height);
- gdk_gc_set_foreground(bview->gc, &style->dark[GTK_WIDGET_STATE(widget)]);
+ gdk_gc_set_foreground(pview->gc, &style->dark[GTK_WIDGET_STATE(widget)]);
- gdk_draw_line(drawable, bview->gc,
+ gdk_draw_line(drawable, pview->gc,
fake_x + view->left_margin, event->area.y,
fake_x + view->left_margin, event->area.y + event->area.height);
@@ -884,7 +886,7 @@ static gboolean gtk_block_view_expose(GtkWidget *widget, GdkEventExpose *event)
/* Impression du désassemblage */
- g_buffer_view_draw(view->buffer_view, event, bview->gc, fake_x, fake_y);
+ g_buffer_view_draw(view->buffer_view, event, pview->gc, fake_x, fake_y);
gdk_window_end_paint(drawable);
diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c
index 34e0e80..756c00a 100644
--- a/src/gtkext/gtkgraphview.c
+++ b/src/gtkext/gtkgraphview.c
@@ -144,12 +144,16 @@ static void gtk_graph_view_class_init(GtkGraphViewClass *klass)
static void gtk_graph_view_init(GtkGraphView *view)
{
- GtkBinView *binview; /* Instance parente */
+ GtkViewPanel *viewpanel; /* Instance parente #1 */
+ GtkBinView *binview; /* Instance parente #2 */
GdkColor white; /* Couleur de fond normale */
+ viewpanel = GTK_VIEW_PANEL(view);
+
+ viewpanel->scroll = (scroll_fc)gtk_graph_view_scroll;
+
binview = GTK_BIN_VIEW(view);
- binview->scroll = (scroll_fc)gtk_graph_view_scroll;
binview->set_lines = (set_rendering_lines_fc)gtk_graph_view_set_rendering_lines;
binview->define_address = (define_main_address_fc)gtk_graph_view_define_main_address;
binview->get_coordinates = (get_addr_coordinates_fc)gtk_graph_view_get_address_coordinates;
@@ -218,7 +222,7 @@ static void gtk_graph_view_size_request(GtkWidget *widget, GtkRequisition *requi
static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
{
gpointer fixed_class; /* Classe parente */
- GtkBinView *view; /* Autre version du composant */
+ GtkViewPanel *panel; /* Autre version du composant */
GtkAllocation valloc; /* Surface utilisable */
gboolean changed; /* Changement de valeur ? */
@@ -228,39 +232,42 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
GTK_WIDGET_CLASS(fixed_class)->size_allocate(GTK_FIXED(widget), allocation);
- view = GTK_BIN_VIEW(widget);
+ panel = GTK_VIEW_PANEL(widget);
+
+ if (panel->hadjustment == NULL || panel->vadjustment == NULL)
+ return;
- gtk_bin_view_compute_allocation(view, &valloc);
+ gtk_view_panel_compute_allocation(panel, &valloc);
/* Défilement horizontal */
- view->hadjustment->page_size = valloc.width;
- view->hadjustment->step_increment = valloc.width * 0.1;
- view->hadjustment->page_increment = valloc.width * 0.9;
+ panel->hadjustment->page_size = valloc.width;
+ panel->hadjustment->step_increment = valloc.width * 0.1;
+ panel->hadjustment->page_increment = valloc.width * 0.9;
- view->hadjustment->upper = MAX(GTK_GRAPH_VIEW(view)->requisition.width, valloc.width);
+ panel->hadjustment->upper = MAX(GTK_GRAPH_VIEW(widget)->requisition.width, valloc.width);
- gtk_bin_view_reclamp_adjustment(view->hadjustment, &changed);
+ gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed);
- gtk_adjustment_changed(view->hadjustment);
+ gtk_adjustment_changed(panel->hadjustment);
if (changed)
- gtk_adjustment_value_changed(view->hadjustment);
+ gtk_adjustment_value_changed(panel->hadjustment);
/* Défilement vertical */
- view->vadjustment->page_size = valloc.height;
- view->vadjustment->step_increment = valloc.width * 0.1;
- view->vadjustment->page_increment = valloc.width * 0.9;
+ panel->vadjustment->page_size = valloc.height;
+ panel->vadjustment->step_increment = valloc.width * 0.1;
+ panel->vadjustment->page_increment = valloc.width * 0.9;
- view->vadjustment->upper = MAX(GTK_GRAPH_VIEW(view)->requisition.height, valloc.height);
+ panel->vadjustment->upper = MAX(GTK_GRAPH_VIEW(widget)->requisition.height, valloc.height);
- gtk_bin_view_reclamp_adjustment(view->vadjustment, &changed);
+ gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed);
- gtk_adjustment_changed(view->vadjustment);
+ gtk_adjustment_changed(panel->vadjustment);
if (changed)
- gtk_adjustment_value_changed(view->vadjustment);
+ gtk_adjustment_value_changed(panel->vadjustment);
}
@@ -310,7 +317,7 @@ static gboolean gtk_graph_view_expose(GtkWidget *widget, GdkEventExpose *event,
for (i = 0; i < view->links_count; i++)
gtk_link_renderer_draw(view->links[i],
GDK_DRAWABLE(widget->window),
- GTK_BIN_VIEW(view)->gc);
+ GTK_VIEW_PANEL(view)->gc);
return FALSE;
@@ -387,8 +394,8 @@ static void gtk_graph_view_reset(GtkGraphView *view)
static void gtk_graph_view_scroll(GtkGraphView *view)
{
gtk_fixed_move(GTK_FIXED(view), GTK_WIDGET(view->support),
- -GTK_BIN_VIEW(view)->hadjustment->value,
- -GTK_BIN_VIEW(view)->vadjustment->value);
+ -GTK_VIEW_PANEL(view)->hadjustment->value,
+ -GTK_VIEW_PANEL(view)->vadjustment->value);
}
diff --git a/src/gtkext/gtksourceview.c b/src/gtkext/gtksourceview.c
new file mode 100644
index 0000000..14f7f95
--- /dev/null
+++ b/src/gtkext/gtksourceview.c
@@ -0,0 +1,147 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtksourceview.c - affichage de code source
+ *
+ * Copyright (C) 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 "gtksourceview.h"
+
+
+#include "gtkviewpanel-int.h"
+
+
+
+/* -------------------------- INTERACTION DIRECTE AVEC GTK -------------------------- */
+
+
+/* Composant d'affichage de code source (instance) */
+struct _GtkSourceView
+{
+ GtkViewPanel parent; /* A laisser en premier */
+
+};
+
+/* Composant d'affichage de code source (classe) */
+struct _GtkSourceViewClass
+{
+ GtkViewPanelClass parent; /* A laisser en premier */
+
+};
+
+
+/* Procède à l'initialisation de l'afficheur de code source. */
+static void gtk_source_view_class_init(GtkSourceViewClass *);
+
+/* Procède à l'initialisation de l'afficheur de code source. */
+static void gtk_source_view_init(GtkSourceView *);
+
+/* Prend acte de l'association d'un binaire chargé. */
+static void gtk_source_view_attach_binary(GtkSourceView *, GOpenidaBinary *);
+
+
+/* ---------------------------------------------------------------------------------- */
+/* INTERACTION DIRECTE AVEC GTK */
+/* ---------------------------------------------------------------------------------- */
+
+
+/* Détermine le type du composant d'affichage de code source. */
+G_DEFINE_TYPE(GtkSourceView, gtk_source_view, GTK_TYPE_VIEW_PANEL)
+
+
+/******************************************************************************
+* *
+* Paramètres : class = classe GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'afficheur de code source. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_source_view_class_init(GtkSourceViewClass *class)
+{
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : view = composant GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'afficheur de code source. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_source_view_init(GtkSourceView *view)
+{
+ GtkViewPanel *panel; /* Instance parente */
+
+ panel = GTK_VIEW_PANEL(view);
+
+ panel->attach = (attach_binary_fc)gtk_source_view_attach_binary;
+
+}
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Crée un nouveau composant pour l'affichage de code source. *
+* *
+* Retour : Composant GTK créé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *gtk_source_view_new(void)
+{
+ GtkSourceView *result;
+
+ result = gtk_type_new(GTK_TYPE_SOURCE_VIEW);
+
+ return GTK_WIDGET(result);
+
+}
+
+
+/******************************************************************************
+* *
+* 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_source_view_attach_binary(GtkSourceView *view, GOpenidaBinary *binary)
+{
+
+}
diff --git a/src/gtkext/gtksourceview.h b/src/gtkext/gtksourceview.h
new file mode 100644
index 0000000..3e78a20
--- /dev/null
+++ b/src/gtkext/gtksourceview.h
@@ -0,0 +1,57 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtksourceview.h - prototypes pour l'affichage de code source
+ *
+ * Copyright (C) 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/>.
+ */
+
+
+#ifndef _GTK_SOURCEVIEW_H
+#define _GTK_SOURCEVIEW_H
+
+
+
+#include <glib-object.h>
+#include <gtk/gtkwidget.h>
+
+
+
+#define GTK_TYPE_SOURCE_VIEW (gtk_source_view_get_type())
+#define GTK_SOURCE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_SOURCE_VIEW, GtkSourceView))
+#define GTK_SOURCE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_SOURCE_VIEW, GtkSourceViewClass))
+#define GTK_IS_SOURCE_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_SOURCE_VIEW))
+#define GTK_IS_SOURCE_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_SOURCE_VIEW))
+#define GTK_SOURCE_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_SOURCE_VIEW, GtkSourceViewClass))
+
+
+/* Composant d'affichage de code source (instance) */
+typedef struct _GtkSourceView GtkSourceView;
+
+/* Composant d'affichage de code source (classe) */
+typedef struct _GtkSourceViewClass GtkSourceViewClass;
+
+
+/* Détermine le type du composant d'affichage de code source. */
+GType gtk_source_view_get_type(void);
+
+/* Crée un nouveau composant pour l'affichage de code source. */
+GtkWidget *gtk_source_view_new(void);
+
+
+
+#endif /* _GTK_SOURCEVIEW_H */
diff --git a/src/gtkext/gtkviewpanel-int.h b/src/gtkext/gtkviewpanel-int.h
new file mode 100644
index 0000000..7480807
--- /dev/null
+++ b/src/gtkext/gtkviewpanel-int.h
@@ -0,0 +1,81 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkviewpanel-int.h - définitions internes propre à l'affichage de contenu de binaire
+ *
+ * Copyright (C) 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/>.
+ */
+
+
+#ifndef _GTK_VIEWPANEL_INT_H
+#define _GTK_VIEWPANEL_INT_H
+
+
+#include "gtkviewpanel.h"
+
+
+#include <stdbool.h>
+#include <gtk/gtkfixed.h>
+
+
+
+/* Prend acte de l'association d'un binaire chargé. */
+typedef void (* attach_binary_fc) (GtkViewPanel *, GOpenidaBinary *);
+
+/* Réagit à un défilement quelconque. */
+typedef void (* scroll_fc) (GtkViewPanel *);
+
+
+/* Composant d'affichage générique (instance) */
+struct _GtkViewPanel
+{
+ GtkFixed parent; /* A laisser en premier */
+
+ GtkAdjustment *hadjustment; /* Barre de défilement horiz. */
+ GtkAdjustment *vadjustment; /* Barre de défilement vert. */
+
+ GdkGC *gc; /* Contexte graphique du rendu */
+ bool show_border; /* Affichage d'une bordure ? */
+
+ GOpenidaBinary *binary; /* Binaire à visualiser */
+
+ attach_binary_fc attach; /* Association avec un binaire */
+ scroll_fc scroll; /* Défilement du contenu */
+
+};
+
+/* Composant d'affichage générique (classe) */
+struct _GtkViewPanelClass
+{
+ GtkFixedClass parent; /* A laisser en premier */
+
+ /* Signaux */
+
+ void (* set_scroll_adjustments) (GtkViewPanel *, GtkAdjustment *, GtkAdjustment *);
+
+};
+
+
+/* S'assure que la valeur de défilement actuelle est valable. */
+void gtk_view_panel_reclamp_adjustment(GtkAdjustment *, gboolean *);
+
+/* Calcule la surface pleine utilisable pour le panneau. */
+void gtk_view_panel_compute_allocation(GtkViewPanel *, GtkAllocation *);
+
+
+
+#endif /* _GTK_VIEWPANEL_INT_H */
diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c
new file mode 100644
index 0000000..03279b2
--- /dev/null
+++ b/src/gtkext/gtkviewpanel.c
@@ -0,0 +1,361 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkviewpanel.c - affichage de contenu de binaire
+ *
+ * Copyright (C) 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 "gtkviewpanel.h"
+
+
+#include "gtkviewpanel-int.h"
+#include "iodamarshal.h"
+
+
+
+/* Procède à l'initialisation de l'afficheur générique. */
+static void gtk_view_panel_class_init(GtkViewPanelClass *);
+
+/* Procède à l'initialisation de l'afficheur générique. */
+static void gtk_view_panel_init(GtkViewPanel *);
+
+/* Enregistre les défilements à associer au composant GTK. */
+static void gtk_view_panel_set_scroll_adjustments(GtkViewPanel *, GtkAdjustment *, GtkAdjustment *);
+
+/* Prend acte d'un nouveau défilement. */
+static void gtk_view_panel_adj_value_changed(GtkAdjustment *, GtkViewPanel *);
+
+/* Encadre la construction graphique initiale de l'affichage. */
+static void gtk_view_panel_realize(GtkWidget *);
+
+/* Met à jour l'affichage du composant d'affichage. */
+static gboolean gtk_view_panel_expose(GtkWidget *, GdkEventExpose *);
+
+
+
+/* Détermine le type du composant d'affichage générique. */
+G_DEFINE_TYPE(GtkViewPanel, gtk_view_panel, GTK_TYPE_FIXED)
+
+
+/******************************************************************************
+* *
+* Paramètres : class = classe GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'afficheur générique. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_view_panel_class_init(GtkViewPanelClass *class)
+{
+ GtkWidgetClass *widget_class; /* Classe de haut niveau */
+
+ widget_class = GTK_WIDGET_CLASS(class);
+
+ widget_class->realize = gtk_view_panel_realize;
+ widget_class->expose_event = gtk_view_panel_expose;
+
+ class->set_scroll_adjustments = gtk_view_panel_set_scroll_adjustments;
+
+ widget_class->set_scroll_adjustments_signal =
+ g_signal_new(("set_scroll_adjustments"),
+ GTK_TYPE_VIEW_PANEL,
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET(GtkViewPanelClass, set_scroll_adjustments),
+ NULL, NULL,
+ g_cclosure_user_marshal_VOID__OBJECT_OBJECT,
+ G_TYPE_NONE, 2,
+ GTK_TYPE_ADJUSTMENT,
+ GTK_TYPE_ADJUSTMENT);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : view = composant GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'afficheur générique. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_view_panel_init(GtkViewPanel *panel)
+{
+ gtk_fixed_set_has_window(GTK_FIXED(panel), TRUE);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = vue à compléter. *
+* hadjustment = nouveau défilement horizontal à intégrer. *
+* vadjustment = nouveau défilement vertical à intégrer. *
+* *
+* Description : Enregistre les défilements à associer au composant GTK. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_view_panel_set_scroll_adjustments(GtkViewPanel *panel, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment)
+{
+ panel->hadjustment = hadjustment;
+ panel->vadjustment = vadjustment;
+
+ g_signal_connect(hadjustment, "value_changed",
+ G_CALLBACK(gtk_view_panel_adj_value_changed), panel);
+
+ g_signal_connect(vadjustment, "value_changed",
+ G_CALLBACK(gtk_view_panel_adj_value_changed), panel);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : adj = défilement à l'origine de l'action. *
+* panel = composant GTK à redessiner. *
+* *
+* Description : Prend acte d'un nouveau défilement. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_view_panel_adj_value_changed(GtkAdjustment *adj, GtkViewPanel *panel)
+{
+ panel->scroll(panel);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : adj = valeurs de défilement à consulter. *
+* changed = note une mise à jour de valeur. [OUT] *
+* *
+* Description : S'assure que la valeur de défilement actuelle est valable. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_view_panel_reclamp_adjustment(GtkAdjustment *adj, gboolean *changed)
+{
+ gdouble value; /* Valeur actuelle */
+
+ value = adj->value;
+
+ value = CLAMP(value, 0, adj->upper - adj->page_size);
+
+ if (value != adj->value)
+ {
+ adj->value = value;
+ *changed = TRUE;
+ }
+ else *changed = FALSE;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = composant GTK à consulter. *
+* alloc = étendue à accorder à la vue. *
+* *
+* Description : Calcule la surface pleine utilisable pour le panneau. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_view_panel_compute_allocation(GtkViewPanel *panel, GtkAllocation *alloc)
+{
+ GtkWidget *widget; /* Autre version de la vue */
+ GtkAllocation *allocation; /* Raccourci d'utilisation #1 */
+ gint border_width; /* Raccourci d'utilisation #2 */
+
+ widget = GTK_WIDGET(panel);
+ allocation = &widget->allocation;
+ border_width = GTK_CONTAINER(panel)->border_width;
+
+ alloc->x = 0;
+ alloc->y = 0;
+
+ /*
+ if (viewport->shadow_type != GTK_SHADOW_NONE)
+ {
+ alloc->x = widget->style->xthickness;
+ alloc->y = widget->style->ythickness;
+ }
+ */
+
+ alloc->width = MAX(1, allocation->width - alloc->x * 2 - border_width * 2);
+ alloc->height = MAX(1, allocation->height - alloc->y * 2 - border_width * 2);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : widget = composant GTK à préparer. *
+* *
+* Description : Encadre la construction graphique initiale de l'affichage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_view_panel_realize(GtkWidget *widget)
+{
+ GdkWindowAttr attributes; /* Propriétés du composant */
+ guint attributes_mask; /* Masque de prise en compte */
+ GdkColor white; /* Couleur de fond normale */
+
+ GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+
+ attributes.window_type = GDK_WINDOW_CHILD;
+ attributes.x = widget->allocation.x;
+ attributes.y = widget->allocation.y;
+ attributes.width = widget->allocation.width;
+ attributes.height = widget->allocation.height;
+
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.event_mask = gtk_widget_get_events(widget)
+ | GDK_BUTTON_PRESS_MASK | GDK_EXPOSURE_MASK;
+
+ attributes_mask = GDK_WA_X | GDK_WA_Y;
+
+ widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
+ &attributes, attributes_mask);
+
+ gdk_window_set_user_data(widget->window, widget);
+
+ widget->style = gtk_style_attach(widget->style, widget->window);
+
+ gdk_color_white(gtk_widget_get_colormap(widget), &white);
+ gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &white);
+
+ GTK_VIEW_PANEL(widget)->gc = gdk_gc_new(GDK_DRAWABLE(widget->window));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : widget = composant GTK à redessiner. *
+* event = informations liées à l'événement. *
+* *
+* Description : Met à jour l'affichage du composant d'affichage. *
+* *
+* Retour : FALSE pour poursuivre la propagation de l'événement. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static gboolean gtk_view_panel_expose(GtkWidget *widget, GdkEventExpose *event)
+{
+ GtkViewPanel *panel;
+ GdkGCValues values; /* Propriétés du contexte */
+ GtkStyle *style; /* Style associé au composant */
+ int width; /* Largeur de l'élément */
+ int height; /* Hauteur de l'élément */
+
+ panel = GTK_VIEW_PANEL(widget);
+
+ if (panel->show_border)
+ {
+ gdk_gc_get_values(panel->gc, &values);
+ style = gtk_widget_get_style(widget);
+
+ gtk_widget_get_size_request(widget, &width, &height);
+
+ gdk_gc_set_foreground(panel->gc, &style->dark[GTK_WIDGET_STATE(widget)]);
+
+ gdk_draw_rectangle(GDK_DRAWABLE(widget->window), panel->gc,
+ FALSE, 0, 0, width - 1, height - 1);
+
+ gdk_gc_set_foreground(panel->gc, &values.foreground);
+
+ }
+
+ return FALSE;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = composant GTK à mettre à jour. *
+* binary = binaire associé à intégrer. *
+* *
+* Description : Associe à un panneau d'affichage un binaire chargé. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void gtk_view_panel_attach_binary(GtkViewPanel *panel, GOpenidaBinary *binary)
+{
+ g_object_ref(G_OBJECT(binary));
+ panel->binary = binary;
+
+ panel->attach(panel, binary);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : panel = composant GTK à consulter. *
+* *
+* Description : Fournit le binaire associé à la représentation. *
+* *
+* Retour : Représentation de contenu binaire. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GOpenidaBinary *gtk_view_panel_get_binary(const GtkViewPanel *panel)
+{
+ return panel->binary;
+
+}
diff --git a/src/gtkext/gtkviewpanel.h b/src/gtkext/gtkviewpanel.h
new file mode 100644
index 0000000..ad6cc46
--- /dev/null
+++ b/src/gtkext/gtkviewpanel.h
@@ -0,0 +1,61 @@
+
+/* OpenIDA - Outil d'analyse de fichiers binaires
+ * gtkviewpanel.h - prototypes pour l'affichage de contenu de binaire
+ *
+ * Copyright (C) 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/>.
+ */
+
+
+#ifndef _GTK_VIEWPANEL_H
+#define _GTK_VIEWPANEL_H
+
+
+#include <glib-object.h>
+
+
+#include "../analysis/binary.h"
+
+
+
+#define GTK_TYPE_VIEW_PANEL (gtk_view_panel_get_type())
+#define GTK_VIEW_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_VIEW_PANEL, GtkViewPanel))
+#define GTK_VIEW_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_VIEW_PANEL, GtkViewPanelClass))
+#define GTK_IS_VIEW_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_VIEW_PANEL))
+#define GTK_IS_VIEW_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_VIEW_PANEL))
+#define GTK_VIEW_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_VIEW_PANEL, GtkViewPanelClass))
+
+
+/* Composant d'affichage générique (instance) */
+typedef struct _GtkViewPanel GtkViewPanel;
+
+/* Composant d'affichage générique (classe) */
+typedef struct _GtkViewPanelClass GtkViewPanelClass;
+
+
+/* Détermine le type du composant d'affichage générique. */
+GType gtk_view_panel_get_type(void);
+
+/* Associe à un panneau d'affichage un binaire chargé. */
+void gtk_view_panel_attach_binary(GtkViewPanel *, GOpenidaBinary *);
+
+/* Fournit le binaire associé à la représentation. */
+GOpenidaBinary *gtk_view_panel_get_binary(const GtkViewPanel *);
+
+
+
+#endif /* _GTK_VIEWPANEL_H */
diff --git a/src/panels/panel-int.h b/src/panels/panel-int.h
index 0048d19..bc052ff 100644
--- a/src/panels/panel-int.h
+++ b/src/panels/panel-int.h
@@ -38,7 +38,7 @@
typedef void (* reload_for_new_binary_fc) (GEditorPanel *, GOpenidaBinary *);
/* Réagit à un changement d'affichage principal de contenu. */
-typedef void (* reload_for_new_view_fc) (GEditorPanel *, GtkBinView *, bool);
+typedef void (* reload_for_new_view_fc) (GEditorPanel *, GtkViewPanel *, bool);
/* Panneaux à présenter dans l'éditeur (instance) */
diff --git a/src/panels/panel.c b/src/panels/panel.c
index c9acac9..8b22f14 100644
--- a/src/panels/panel.c
+++ b/src/panels/panel.c
@@ -207,8 +207,8 @@ void notify_panels_of_binary_change(GOpenidaBinary *binary)
/******************************************************************************
* *
-* Paramètres : view = nouvelle visualisation de désassemblage. *
-* same = changement de binaire ou de vue ? *
+* Paramètres : panel = nouvelle visualisation de désassemblage. *
+* same = changement de binaire ou de vue ? *
* *
* Description : Lance une actualisation du fait d'un changement de vue. *
* *
@@ -218,13 +218,13 @@ void notify_panels_of_binary_change(GOpenidaBinary *binary)
* *
******************************************************************************/
-void notify_panels_of_view_change(GtkBinView *view, bool same)
+void notify_panels_of_view_change(GtkViewPanel *panel, bool same)
{
GEditorPanel *iter; /* Boucle de parcours */
panels_list_for_each(iter, panels_list)
if (iter->reload_view != NULL)
- iter->reload_view(iter, view, same);
+ iter->reload_view(iter, panel, same);
}
diff --git a/src/panels/panel.h b/src/panels/panel.h
index 38eeb79..a5c9f7c 100644
--- a/src/panels/panel.h
+++ b/src/panels/panel.h
@@ -31,7 +31,7 @@
#include "../analysis/binary.h"
-#include "../gtkext/gtkbinview.h"
+#include "../gtkext/gtkviewpanel.h"
@@ -80,7 +80,7 @@ void place_all_panels_in_editor(GtkWidget *);
void notify_panels_of_binary_change(GOpenidaBinary *);
/* Lance une actualisation du fait d'un changement de vue. */
-void notify_panels_of_view_change(GtkBinView *, bool);
+void notify_panels_of_view_change(GtkViewPanel *, bool);
diff --git a/src/panels/symbols.c b/src/panels/symbols.c
index e3c9bd4..484ee97 100644
--- a/src/panels/symbols.c
+++ b/src/panels/symbols.c
@@ -50,7 +50,7 @@ struct _GSymbolsPanel
GtkTreeView *treeview; /* Composant d'affichage */
GtkTreeStore *store; /* Modèle de gestion */
- GtkBinView *binview; /* Affichage à faire défiler */
+ GtkViewPanel *view; /* Affichage à faire défiler */
};
@@ -88,7 +88,7 @@ static void g_symbols_panel_init(GSymbolsPanel *);
static void on_symbols_selection_change(GtkTreeSelection *, GSymbolsPanel *);
/* Réagit à un changement d'affichage principal de contenu. */
-static void reload_symbols_for_new_view(GSymbolsPanel *, GtkBinView *, bool);
+static void reload_symbols_for_new_view(GSymbolsPanel *, GtkViewPanel *, bool);
@@ -337,7 +337,8 @@ static void on_symbols_selection_change(GtkTreeSelection *selection, GSymbolsPan
address = strtoll(string, NULL, 16); /* FIXME */
g_free(string);
- gtk_bin_view_scroll_to_address(panel->binview, address);
+ /* FIXME */
+ //gtk_bin_view_scroll_to_address(panel->binview, address);
}
@@ -358,11 +359,15 @@ static void on_symbols_selection_change(GtkTreeSelection *selection, GSymbolsPan
* *
******************************************************************************/
-static void reload_symbols_for_new_view(GSymbolsPanel *panel, GtkBinView *view, bool same)
+static void reload_symbols_for_new_view(GSymbolsPanel *panel, GtkViewPanel *view, bool same)
{
GtkToggleToolButton *button; /* Mode de représentation */
- panel->binview = view;
+ if (panel->view != NULL)
+ g_object_unref(G_OBJECT(panel->view));
+
+ panel->view = view;
+ g_object_ref(G_OBJECT(view));
if (same) return;
@@ -408,7 +413,7 @@ static void reload_symbols_for_new_list_view(GSymbolsPanel *panel)
char tmp[VMPA_MAX_SIZE]; /* Version humainement lisible */
GtkTreeIter iter; /* Point d'insertion */
- binary = gtk_bin_view_get_binary(panel->binview);
+ binary = gtk_view_panel_get_binary(panel->view);
format = g_openida_binary_get_format(binary);
routines = g_binary_format_get_routines(G_BIN_FORMAT(format), &routines_count);
@@ -563,7 +568,7 @@ static void reload_symbols_for_new_tree_view(GSymbolsPanel *panel)
GtkTreeIter iter; /* Point d'insertion */
GdkPixbuf *pixbuf; /* Icone pour l'élément inséré */
- binary = gtk_bin_view_get_binary(panel->binview);
+ binary = gtk_view_panel_get_binary(panel->view);
format = g_openida_binary_get_format(binary);
routines = g_binary_format_get_routines(G_BIN_FORMAT(format), &routines_count);
@@ -708,6 +713,6 @@ static void modify_types_in_symbols_tree_view(GtkToggleToolButton *button, GObje
panel = (GSymbolsPanel *)g_object_get_data(ref, "panel");
- reload_symbols_for_new_view(panel, panel->binview, false);
+ reload_symbols_for_new_view(panel, panel->view, false);
}
diff --git a/src/project.c b/src/project.c
index 5bb7b56..2fa2750 100644
--- a/src/project.c
+++ b/src/project.c
@@ -34,36 +34,34 @@
#include "gtkext/gtkblockview.h"
#include "gtkext/gtkdockpanel.h"
#include "gtkext/gtkgraphview.h"
+#include "gtkext/gtkviewpanel.h"
#include "panels/panel.h"
+/* ----------------------- CACHE INTERMEDIAIRE D'ASSOCIATIONS ----------------------- */
+
/* Conservation d'un binaire chargé */
typedef struct _loaded_binary
{
GOpenidaBinary *binary; /* Binaire en question */
-
- bool lines_set; /* Construction complète */
- GMutex *mutex; /* Accès à la variable */
- GCond *cond; /* Attente de changement */
-
GtkWidget *views[BVW_COUNT]; /* Composants pour l'affichage */
} loaded_binary;
/* Met en place un nouveau binaire pour un projet. */
-loaded_binary *load_openida_binary(GOpenidaBinary *);
-
-/* Prend note de la fin d'une construction d'une visualisation. */
-static void notify_loaded_binary(GtkBinView *, loaded_binary *);
+static loaded_binary *load_openida_binary(GOpenidaBinary *);
/* Fournit un support d'affichage donné pour un binaire chargé. */
GtkWidget *get_loaded_binary_view(const loaded_binary *, BinaryView);
+/* --------------------------- GESTION D'UN PROJET ENTIER --------------------------- */
+
+
/* Propriétés d'un ensemble de fichiers ouverts */
@@ -91,6 +89,9 @@ void display_new_binary_of_openida_project(GOpenidaBinary *, openida_project *);
+/* ---------------------------------------------------------------------------------- */
+/* CACHE INTERMEDIAIRE D'ASSOCIATIONS */
+/* ---------------------------------------------------------------------------------- */
/******************************************************************************
@@ -105,68 +106,55 @@ void display_new_binary_of_openida_project(GOpenidaBinary *, openida_project *);
* *
******************************************************************************/
-loaded_binary *load_openida_binary(GOpenidaBinary *binary)
+static loaded_binary *load_openida_binary(GOpenidaBinary *binary)
{
loaded_binary *result; /* Structure à renvoyer */
BinaryView i; /* Boucle de parcours */
- GtkWidget *scrolledwindow; /* Surface d'exposition */
GtkWidget *view; /* Affichage du binaire */
+ GtkWidget *scrolledwindow; /* Surface d'exposition */
result = (loaded_binary *)calloc(1, sizeof(loaded_binary));
result->binary = binary;
- result->mutex = g_mutex_new();
- result->cond = g_cond_new();
-
for (i = 0; i < BVW_COUNT; i++)
{
/* Préparation du support */
gdk_threads_enter();
- scrolledwindow = qck_create_scrolled_window(NULL, NULL);
-
switch (i)
{
- default: /* GCC ! */
case BVW_BLOCK:
view = gtk_block_view_new(MRD_BLOCK);
break;
case BVW_GRAPH:
view = gtk_graph_view_new();
break;
+ case BVW_SOURCE:
+ view = gtk_source_view_new();
+ break;
+ default: /* GCC ! */
+ break;
}
- gdk_flush ();
- gdk_threads_leave();
-
- result->lines_set = false;
-
- g_signal_connect(view, "lines-set", G_CALLBACK(notify_loaded_binary), result);
-
- gtk_bin_view_set_rendering_lines(GTK_BIN_VIEW(view), binary,
- g_openida_binary_get_lines(binary), NULL);
+ gtk_widget_show(view);
- /* Attente de la fin de construction */
- g_mutex_lock(result->mutex);
- while (!result->lines_set)
- g_cond_wait(result->cond, result->mutex);
- g_mutex_unlock(result->mutex);
+ gdk_flush();
+ gdk_threads_leave();
- g_signal_handlers_disconnect_by_func(view, G_CALLBACK(notify_loaded_binary), result);
+ gtk_view_panel_attach_binary(GTK_VIEW_PANEL(view), binary);
/* Intégration finale */
gdk_threads_enter();
- gtk_widget_show(view);
-
+ scrolledwindow = qck_create_scrolled_window(NULL, NULL);
gtk_container_add(GTK_CONTAINER(scrolledwindow), view);
result->views[i] = scrolledwindow;
- gdk_flush ();
+ gdk_flush();
gdk_threads_leave();
}
@@ -176,29 +164,6 @@ loaded_binary *load_openida_binary(GOpenidaBinary *binary)
}
-/******************************************************************************
-* *
-* Paramètres : view = composant d'affichage prêt à utilisation. *
-* binary = binaire chargé et encadré. *
-* *
-* Description : Prend note de la fin d'une construction d'une visualisation. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void notify_loaded_binary(GtkBinView *view, loaded_binary *binary)
-{
- g_mutex_lock(binary->mutex);
-
- binary->lines_set = true;
-
- g_cond_signal(binary->cond);
- g_mutex_unlock(binary->mutex);
-
-}
@@ -591,7 +556,7 @@ GDockItem *gtk_dock_panel_get_item_from_binary(const openida_project *project, G
* Paramètres : project = projet à consulter. *
* binary = binaire chargé, encadré et concerné. *
* view = type d'affichage requis. *
-* binview = afficheur effectif de code binaire. [OUT] *
+* panel = afficheur effectif quelconque. [OUT] *
* *
* Description : Fournit un support d'affichage donné pour un binaire chargé. *
* *
@@ -601,7 +566,7 @@ GDockItem *gtk_dock_panel_get_item_from_binary(const openida_project *project, G
* *
******************************************************************************/
-GtkWidget *get_view_for_openida_project_binary(const openida_project *project, const GOpenidaBinary *binary, BinaryView view, GtkBinView **binview)
+GtkWidget *get_view_for_openida_project_binary(const openida_project *project, const GOpenidaBinary *binary, BinaryView view, GtkViewPanel **panel)
{
GtkWidget *result; /* Composant GTK à retourner */
size_t i; /* Boucle de parcours */
@@ -612,7 +577,7 @@ GtkWidget *get_view_for_openida_project_binary(const openida_project *project, c
if (project->binaries[i]->binary == binary)
{
result = get_loaded_binary_view(project->binaries[i], view);
- *binview = GTK_BIN_VIEW(gtk_bin_get_child(result));
+ *panel = GTK_VIEW_PANEL(gtk_bin_get_child(result));
break;
}
@@ -799,10 +764,9 @@ void display_openida_project(const openida_project *project, GObject *ref)
{
GtkDockPanel *dpanel; /* Support de panneaux */
size_t i; /* Boucle de parcours */
- GOpenidaBinary *binary;
+ GOpenidaBinary *binary; /* Binaire chargé */
GtkWidget *view; /* Affichage du code binaire */
GDockItem *ditem; /* Panneau avec ses infos. */
- GtkBinView *binview; /* Affichage à faire défiler */
dpanel = GTK_DOCK_PANEL(g_object_get_data(ref, "binpanel"));
@@ -840,7 +804,6 @@ void display_new_binary_of_openida_project(GOpenidaBinary *binary, openida_proje
GtkWidget *view; /* Affichage du code binaire */
char *title; /* Titre associé au binaire */
GDockItem *ditem; /* Panneau avec ses infos. */
- GtkBinView *binview; /* Affichage à faire défiler */
index = attach_binary_to_openida_project(project, binary);
diff --git a/src/project.h b/src/project.h
index 1314b1d..7f45c28 100644
--- a/src/project.h
+++ b/src/project.h
@@ -29,7 +29,7 @@
#include "analysis/binary.h"
-#include "gtkext/gtkbinview.h"
+#include "gtkext/gtkviewpanel.h"
#include "gtkext/gtkdockitem.h"
@@ -38,7 +38,8 @@
typedef enum _BinaryView
{
BVW_BLOCK, /* Version basique */
- BVW_GRAPH, /* Affichage en graphqie */
+ BVW_GRAPH, /* Affichage en graphique */
+ BVW_SOURCE, /* Code décompilé */
BVW_COUNT
@@ -86,7 +87,7 @@ void detach_binary_to_openida_project(openida_project *, GOpenidaBinary *);
GDockItem *gtk_dock_panel_get_item_from_binary(const openida_project *, GOpenidaBinary *);
/* Fournit un support d'affichage donné pour un binaire chargé. */
-GtkWidget *get_view_for_openida_project_binary(const openida_project *, const GOpenidaBinary *, BinaryView, GtkBinView **);
+GtkWidget *get_view_for_openida_project_binary(const openida_project *, const GOpenidaBinary *, BinaryView, GtkViewPanel **);
/* Fournit l'ensemble des binaires associés à un projet. */
const GOpenidaBinary **get_openida_project_binaries(const openida_project *, size_t *);