diff options
Diffstat (limited to 'src/gtkext')
-rw-r--r-- | src/gtkext/Makefile.am | 2 | ||||
-rw-r--r-- | src/gtkext/gtkbufferview-int.h | 58 | ||||
-rw-r--r-- | src/gtkext/gtkbufferview.c | 323 | ||||
-rw-r--r-- | src/gtkext/gtkbufferview.h | 59 | ||||
-rw-r--r-- | src/gtkext/gtksourceview.c | 270 | ||||
-rw-r--r-- | src/gtkext/gtksourceview.h | 1 |
6 files changed, 450 insertions, 263 deletions
diff --git a/src/gtkext/Makefile.am b/src/gtkext/Makefile.am index d253edc..47d4e41 100644 --- a/src/gtkext/Makefile.am +++ b/src/gtkext/Makefile.am @@ -9,6 +9,8 @@ libgtkext_la_SOURCES = \ gtkbinview-int.h \ gtkbinview.h gtkbinview.c \ gtkblockview.h gtkblockview.c \ + gtkbufferview-int.h \ + gtkbufferview.h gtkbufferview.c \ gtkdockitem.h gtkdockitem.c \ gtkdockpanel.h gtkdockpanel.c \ gtkdropwindow.h gtkdropwindow.c \ diff --git a/src/gtkext/gtkbufferview-int.h b/src/gtkext/gtkbufferview-int.h new file mode 100644 index 0000000..936e31d --- /dev/null +++ b/src/gtkext/gtkbufferview-int.h @@ -0,0 +1,58 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * gtkbufferview.h - prototypes pour l'affichage de tampons de lignes + * + * 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_BUFFERVIEW_INT_H +#define _GTK_BUFFERVIEW_INT_H + + +#include "gtkbufferview.h" + + +#include "gtkviewpanel-int.h" + + + +/* Composant d'affichage de tampon de lignes (instance) */ +struct _GtkBufferView +{ + GtkViewPanel parent; /* A laisser en premier */ + + GCodeBuffer *buffer; /* Code sous forme de texte */ + GBufferView *buffer_view; /* Affichage de cette forme */ + + gint line_height; /* Hauteur maximale des lignes */ + gint left_margin; /* Marge gauche + espace */ + gint left_text; /* Début d'impression du code */ + +}; + +/* Composant d'affichage de tampon de lignes (classe) */ +struct _GtkBufferViewClass +{ + GtkViewPanelClass parent; /* A laisser en premier */ + +}; + + + +#endif /* _GTK_BUFFERVIEW_INT_H */ diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c new file mode 100644 index 0000000..81fb998 --- /dev/null +++ b/src/gtkext/gtkbufferview.c @@ -0,0 +1,323 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * gtkbufferview.c - affichage de tampons de lignes + * + * 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 "gtkbufferview-int.h" + + + +/* -------------------------- INTERACTION DIRECTE AVEC GTK -------------------------- */ + + +/* Procède à l'initialisation de l'afficheur de tampons. */ +static void gtk_buffer_view_class_init(GtkBufferViewClass *); + +/* Procède à l'initialisation de l'afficheur de tampons. */ +static void gtk_buffer_view_init(GtkBufferView *); + +/* Fournit la taille de composant requise pour un plein rendu. */ +static void gtk_buffer_view_size_request(GtkWidget *, GtkRequisition *); + +/* S'adapte à la surface concédée par le composant parent. */ +static void gtk_buffer_view_size_allocate(GtkWidget *, GtkAllocation *); + +/* Met à jour l'affichage de la visualisation de code buffer. */ +static gboolean gtk_buffer_view_expose(GtkWidget *, GdkEventExpose *); + + + +/* ---------------------------------------------------------------------------------- */ +/* INTERACTION DIRECTE AVEC GTK */ +/* ---------------------------------------------------------------------------------- */ + + +/* Détermine le type du composant d'affichage de tampon de lignes. */ +G_DEFINE_TYPE(GtkBufferView, gtk_buffer_view, GTK_TYPE_VIEW_PANEL) + + +/****************************************************************************** +* * +* Paramètres : class = classe GTK à initialiser. * +* * +* Description : Procède à l'initialisation de l'afficheur de tampons. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_buffer_view_class_init(GtkBufferViewClass *class) +{ + GtkWidgetClass *widget_class; /* Classe version Widget */ + + widget_class = GTK_WIDGET_CLASS(class); + + widget_class->size_request = gtk_buffer_view_size_request; + widget_class->size_allocate = gtk_buffer_view_size_allocate; + widget_class->expose_event = gtk_buffer_view_expose; + +} + + +/****************************************************************************** +* * +* Paramètres : view = composant GTK à initialiser. * +* * +* Description : Procède à l'initialisation de l'afficheur de tampons. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_buffer_view_init(GtkBufferView *view) +{ + +} + + +/****************************************************************************** +* * +* Paramètres : widget = composant GTK à consulter. * +* requisition = dimensions souhaitées. [OUT] * +* * +* Description : Fournit la taille de composant requise pour un plein rendu. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_buffer_view_size_request(GtkWidget *widget, GtkRequisition *requisition) +{ + if (GTK_BUFFER_VIEW(widget)->buffer_view != NULL) + { + + g_buffer_view_get_size(GTK_BUFFER_VIEW(widget)->buffer_view, + &requisition->width, &requisition->height); + + printf(" === size req :: (%d ; %d)\n", + requisition->width, requisition->height); + + } + else printf(" === size req :: ??\n"); + +} + + +/****************************************************************************** +* * +* Paramètres : view = composant GTK à mettre à jour. * +* allocation = étendue accordée à la vue. * +* * +* Description : S'adapte à la surface concédée par le composant parent. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_buffer_view_size_allocate(GtkWidget *widget, GtkAllocation *allocation) +{ + GtkViewPanel *panel; /* Autre version du composant */ + gint width; /* Largeur de l'objet actuelle */ + gint height; /* Hauteur de l'objet actuelle */ + GtkAllocation valloc; /* Surface utilisable */ + gboolean changed; /* Changement de valeur ? */ + + /* Mise à jour GTK */ + + widget->allocation = *allocation; + + if (GTK_WIDGET_REALIZED(widget)) + gdk_window_move_resize(widget->window, + allocation->x, allocation->y, + allocation->width, allocation->height); + + panel = GTK_VIEW_PANEL(widget); + + if (panel->hadjustment == NULL || panel->vadjustment == NULL) + return; + + g_buffer_view_get_size(GTK_BUFFER_VIEW(widget)->buffer_view, &width, &height); + + gtk_view_panel_compute_allocation(panel, &valloc); + + /* Défilement horizontal */ + + panel->hadjustment->page_size = valloc.width; + panel->hadjustment->step_increment = valloc.width * 0.1; + panel->hadjustment->page_increment = valloc.width * 0.9; + + panel->hadjustment->upper = MAX(width, valloc.width); + + gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed); + + gtk_adjustment_changed(panel->hadjustment); + + if (changed) + gtk_adjustment_value_changed(panel->hadjustment); + + /* Défilement vertical */ + + panel->vadjustment->page_size = valloc.height; + panel->vadjustment->step_increment = GTK_BUFFER_VIEW(widget)->line_height; + panel->vadjustment->page_increment = panel->vadjustment->step_increment * 10.0; + + panel->vadjustment->upper = MAX(height, valloc.height); + + gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed); + + gtk_adjustment_changed(panel->vadjustment); + + if (changed) + gtk_adjustment_value_changed(panel->vadjustment); + +} + + +/****************************************************************************** +* * +* Paramètres : view = composant GTK à redessiner. * +* event = informations liées à l'événement. * +* * +* Description : Met à jour l'affichage de la visualisation de code buffer. * +* * +* Retour : FALSE pour poursuivre la propagation de l'événement. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static gboolean gtk_buffer_view_expose(GtkWidget *widget, GdkEventExpose *event) +{ + GtkBufferView *view; /* 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 */ + gint fake_y; /* Ordonnée virtuelle */ + GtkViewPanelClass *parent_class; /* Version pure du parent */ + + view = GTK_BUFFER_VIEW(widget); + widget = GTK_WIDGET(view); + pview = GTK_VIEW_PANEL(widget); + + drawable = GDK_DRAWABLE(event->window); + + gdk_window_begin_paint_region(drawable, event->region); + + gdk_gc_set_clip_region(pview->gc, event->region); + + style = gtk_widget_get_style(GTK_WIDGET(view)); + + fake_x = 0; + fake_y = 0; + //gtk_block_view_compute_fake_coord(view, &fake_x, &fake_y); + + /* Dessin de la marge gauche */ + + gdk_gc_set_foreground(pview->gc, &style->mid[GTK_WIDGET_STATE(widget)]); + + 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(pview->gc, &style->dark[GTK_WIDGET_STATE(widget)]); + + 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); + + /* Eventuelle bordure globale */ + + parent_class = g_type_class_peek(g_type_parent(GTK_TYPE_BUFFER_VIEW)); + + GTK_WIDGET_CLASS(parent_class)->expose_event(widget, event); + + /* Impression du désassemblage */ + + if (view->buffer_view != NULL) + g_buffer_view_draw(view->buffer_view, event, pview->gc, fake_x, fake_y); + + gdk_window_end_paint(drawable); + + return TRUE; + +} + + +/****************************************************************************** +* * +* Paramètres : view = composant GTK à mettre à jour. * +* buffer = tampon de lignes à encadrer. * +* * +* Description : Prend acte de l'association d'un tampon de lignes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void gtk_buffer_view_attach_buffer(GtkBufferView *view, GCodeBuffer *buffer) +{ + gint width; /* Largeur de l'objet actuelle */ + gint height; /* Hauteur de l'objet actuelle */ + + if (view->buffer != NULL) + { + g_object_unref(G_OBJECT(view->buffer)); + g_object_unref(G_OBJECT(view->buffer_view)); + } + + view->buffer = buffer; + g_object_ref(G_OBJECT(view->buffer)); + + view->buffer_view = g_buffer_view_new(view->buffer); + + //gdk_threads_enter(); + + /* Taille des marges */ + + view->line_height = g_buffer_view_get_line_height(view->buffer_view); + view->left_margin = 2 * view->line_height; + view->left_text = -2.5 * view->line_height; + + /* Validation finale */ + + g_buffer_view_get_size(view->buffer_view, &width, &height); + + width += -view->left_text + 1; + height += 1; + + gtk_widget_set_size_request(GTK_WIDGET(view), width, height); + + gtk_widget_queue_draw(GTK_WIDGET(view)); + + //gdk_flush (); + //gdk_threads_leave(); + +} diff --git a/src/gtkext/gtkbufferview.h b/src/gtkext/gtkbufferview.h new file mode 100644 index 0000000..ab7a746 --- /dev/null +++ b/src/gtkext/gtkbufferview.h @@ -0,0 +1,59 @@ + +/* OpenIDA - Outil d'analyse de fichiers binaires + * gtkbufferview.h - prototypes pour l'affichage de tampons de lignes + * + * 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_BUFFERVIEW_H +#define _GTK_BUFFERVIEW_H + + +#include <glib-object.h> +#include <gtk/gtkwidget.h> + + +#include "../glibext/gcodebuffer.h" + + + +#define GTK_TYPE_BUFFER_VIEW (gtk_buffer_view_get_type()) +#define GTK_BUFFER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GTK_TYPE_BUFFER_VIEW, GtkBufferView)) +#define GTK_BUFFER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GTK_TYPE_BUFFER_VIEW, GtkBufferViewClass)) +#define GTK_IS_BUFFER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GTK_TYPE_BUFFER_VIEW)) +#define GTK_IS_BUFFER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GTK_TYPE_BUFFER_VIEW)) +#define GTK_BUFFER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_BUFFER_VIEW, GtkBufferViewClass)) + + +/* Composant d'affichage de tampon de lignes (instance) */ +typedef struct _GtkBufferView GtkBufferView; + +/* Composant d'affichage de tampon de lignes (classe) */ +typedef struct _GtkBufferViewClass GtkBufferViewClass; + + +/* Détermine le type du composant d'affichage de tampon de lignes. */ +GType gtk_buffer_view_get_type(void); + +/* Prend acte de l'association d'un tampon de lignes. */ +void gtk_buffer_view_attach_buffer(GtkBufferView *, GCodeBuffer *); + + + +#endif /* _GTK_BUFFERVIEW_H */ diff --git a/src/gtkext/gtksourceview.c b/src/gtkext/gtksourceview.c index 63f2926..c44b41f 100644 --- a/src/gtkext/gtksourceview.c +++ b/src/gtkext/gtksourceview.c @@ -24,7 +24,7 @@ #include "gtksourceview.h" -#include "gtkviewpanel-int.h" +#include "gtkbufferview-int.h" @@ -34,21 +34,14 @@ /* Composant d'affichage de code source (instance) */ struct _GtkSourceView { - GtkViewPanel parent; /* A laisser en premier */ - - GCodeBuffer *buffer; /* Code sous forme de texte */ - GBufferView *buffer_view; /* Affichage de cette forme */ - - gint line_height; /* Hauteur maximale des lignes */ - gint left_margin; /* Marge gauche + espace */ - gint left_text; /* Début d'impression du code */ + GtkBufferView parent; /* A laisser en premier */ }; /* Composant d'affichage de code source (classe) */ struct _GtkSourceViewClass { - GtkViewPanelClass parent; /* A laisser en premier */ + GtkBufferViewClass parent; /* A laisser en premier */ }; @@ -59,29 +52,18 @@ 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 *); -/*Encadre la construction graphique initiale de la visualisat°. */ -static void gtk_source_view_realize(GtkWidget *); - -/* Fournit la taille de composant requise pour un plein rendu. */ -static void gtk_source_view_size_request(GtkWidget *, GtkRequisition *); - -/* S'adapte à la surface concédée par le composant parent. */ -static void gtk_source_view_size_allocate(GtkWidget *, GtkAllocation *); - -/* Met à jour l'affichage de la visualisation de code source. */ -static gboolean gtk_source_view_expose(GtkWidget *, GdkEventExpose *); - /* 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) +G_DEFINE_TYPE(GtkSourceView, gtk_source_view, GTK_TYPE_BUFFER_VIEW) /****************************************************************************** @@ -98,14 +80,6 @@ G_DEFINE_TYPE(GtkSourceView, gtk_source_view, GTK_TYPE_VIEW_PANEL) static void gtk_source_view_class_init(GtkSourceViewClass *class) { - GtkWidgetClass *widget_class; /* Classe version Widget */ - - widget_class = GTK_WIDGET_CLASS(class); - - widget_class->realize = gtk_source_view_realize; - widget_class->size_request = gtk_source_view_size_request; - widget_class->size_allocate = gtk_source_view_size_allocate; - widget_class->expose_event = gtk_source_view_expose; } @@ -135,201 +109,6 @@ static void gtk_source_view_init(GtkSourceView *view) /****************************************************************************** * * -* Paramètres : widget = composant GTK à redessiner. * -* * -* Description : Encadre la construction graphique initiale de la visualisat°.* -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void gtk_source_view_realize(GtkWidget *widget) -{ - GtkViewPanelClass *parent_class; /* Version pure du parent */ - - parent_class = GTK_VIEW_PANEL_CLASS(g_type_class_peek_parent(GTK_SOURCE_VIEW_GET_CLASS(widget))); - - GTK_WIDGET_CLASS(parent_class)->realize(widget); - -} - - -/****************************************************************************** -* * -* Paramètres : widget = composant GTK à consulter. * -* requisition = dimensions souhaitées. [OUT] * -* * -* Description : Fournit la taille de composant requise pour un plein rendu. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void gtk_source_view_size_request(GtkWidget *widget, GtkRequisition *requisition) -{ - if (GTK_SOURCE_VIEW(widget)->buffer_view != NULL) - { - - g_buffer_view_get_size(GTK_SOURCE_VIEW(widget)->buffer_view, - &requisition->width, &requisition->height); - - printf(" === size req :: (%d ; %d)\n", - requisition->width, requisition->height); - - } - else printf(" === size req :: ??\n"); - -} - - -/****************************************************************************** -* * -* Paramètres : view = composant GTK à mettre à jour. * -* allocation = étendue accordée à la vue. * -* * -* Description : S'adapte à la surface concédée par le composant parent. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void gtk_source_view_size_allocate(GtkWidget *widget, GtkAllocation *allocation) -{ - GtkViewPanel *panel; /* Autre version du composant */ - gint width; /* Largeur de l'objet actuelle */ - gint height; /* Hauteur de l'objet actuelle */ - GtkAllocation valloc; /* Surface utilisable */ - gboolean changed; /* Changement de valeur ? */ - - /* Mise à jour GTK */ - - widget->allocation = *allocation; - - if (GTK_WIDGET_REALIZED(widget)) - gdk_window_move_resize(widget->window, - allocation->x, allocation->y, - allocation->width, allocation->height); - - panel = GTK_VIEW_PANEL(widget); - - if (panel->hadjustment == NULL || panel->vadjustment == NULL) - return; - - g_buffer_view_get_size(GTK_SOURCE_VIEW(widget)->buffer_view, &width, &height); - - gtk_view_panel_compute_allocation(panel, &valloc); - - /* Défilement horizontal */ - - panel->hadjustment->page_size = valloc.width; - panel->hadjustment->step_increment = valloc.width * 0.1; - panel->hadjustment->page_increment = valloc.width * 0.9; - - panel->hadjustment->upper = MAX(width, valloc.width); - - gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed); - - gtk_adjustment_changed(panel->hadjustment); - - if (changed) - gtk_adjustment_value_changed(panel->hadjustment); - - /* Défilement vertical */ - - panel->vadjustment->page_size = valloc.height; - panel->vadjustment->step_increment = GTK_SOURCE_VIEW(widget)->line_height; - panel->vadjustment->page_increment = panel->vadjustment->step_increment * 10.0; - - panel->vadjustment->upper = MAX(height, valloc.height); - - gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed); - - gtk_adjustment_changed(panel->vadjustment); - - if (changed) - gtk_adjustment_value_changed(panel->vadjustment); - -} - - -/****************************************************************************** -* * -* Paramètres : view = composant GTK à redessiner. * -* event = informations liées à l'événement. * -* * -* Description : Met à jour l'affichage de la visualisation de code source. * -* * -* Retour : FALSE pour poursuivre la propagation de l'événement. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static gboolean gtk_source_view_expose(GtkWidget *widget, GdkEventExpose *event) -{ - GtkSourceView *view; /* 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 */ - gint fake_y; /* Ordonnée virtuelle */ - GtkViewPanelClass *parent_class; /* Version pure du parent */ - - view = GTK_SOURCE_VIEW(widget); - widget = GTK_WIDGET(view); - pview = GTK_VIEW_PANEL(widget); - - drawable = GDK_DRAWABLE(event->window); - - gdk_window_begin_paint_region(drawable, event->region); - - gdk_gc_set_clip_region(pview->gc, event->region); - - style = gtk_widget_get_style(GTK_WIDGET(view)); - - fake_x = 0; - fake_y = 0; - //gtk_block_view_compute_fake_coord(view, &fake_x, &fake_y); - - /* Dessin de la marge gauche */ - - gdk_gc_set_foreground(pview->gc, &style->mid[GTK_WIDGET_STATE(widget)]); - - 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(pview->gc, &style->dark[GTK_WIDGET_STATE(widget)]); - - 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); - - /* Eventuelle bordure globale */ - - parent_class = GTK_VIEW_PANEL_CLASS(g_type_class_peek_parent(GTK_SOURCE_VIEW_GET_CLASS(view))); - - GTK_WIDGET_CLASS(parent_class)->expose_event(widget, event); - - /* Impression du désassemblage */ - - if (view->buffer_view != NULL) - g_buffer_view_draw(view->buffer_view, event, pview->gc, fake_x, fake_y); - - gdk_window_end_paint(drawable); - - return TRUE; - -} - - -/****************************************************************************** -* * * Paramètres : - * * * * Description : Crée un nouveau composant pour l'affichage de code source. * @@ -366,43 +145,10 @@ GtkWidget *gtk_source_view_new(void) static void gtk_source_view_attach_binary(GtkSourceView *view, GOpenidaBinary *binary) { + GCodeBuffer *buffer; /* Tampon par défaut */ + buffer = g_openida_binary_get_decompiled_buffer(binary, -1); - - - - gint width; /* Largeur de l'objet actuelle */ - gint height; /* Hauteur de l'objet actuelle */ - - - view->buffer = g_openida_binary_get_decompiled_buffer(binary, NULL); - - - view->buffer_view = g_buffer_view_new(view->buffer); - - - - - gdk_threads_enter(); - - /* Taille des marges */ - - view->line_height = g_buffer_view_get_line_height(view->buffer_view); - view->left_margin = 2 * view->line_height; - view->left_text = -2.5 * view->line_height; - - /* Validation finale */ - - g_buffer_view_get_size(view->buffer_view, &width, &height); - - width += -view->left_text + 1; - height += 1; - - gtk_widget_set_size_request(GTK_WIDGET(view), width, height); - - - gdk_flush (); - gdk_threads_leave(); - + gtk_buffer_view_attach_buffer(GTK_BUFFER_VIEW(view), buffer); } diff --git a/src/gtkext/gtksourceview.h b/src/gtkext/gtksourceview.h index 3e78a20..e6cf37b 100644 --- a/src/gtkext/gtksourceview.h +++ b/src/gtkext/gtksourceview.h @@ -25,7 +25,6 @@ #define _GTK_SOURCEVIEW_H - #include <glib-object.h> #include <gtk/gtkwidget.h> |