summaryrefslogtreecommitdiff
path: root/src/gtkext
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-01-26 23:00:18 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-01-26 23:00:18 (GMT)
commit84790a5b420d0a9ce658013573b180ce059db325 (patch)
tree5000d25a0d5ede63e671364e1e017fbb6674b5f5 /src/gtkext
parentabb191e42e356914bd09176a6d6c5bf89ec50bbf (diff)
Saved the first steps of the migration to GTK+ v3.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@367 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext')
-rw-r--r--src/gtkext/graph/edge.c29
-rw-r--r--src/gtkext/graph/edge.h5
-rw-r--r--src/gtkext/graph/layout.c28
-rw-r--r--src/gtkext/graph/layout.h5
-rw-r--r--src/gtkext/gtkbinarystrip.c55
-rw-r--r--src/gtkext/gtkblockview.h2
-rw-r--r--src/gtkext/gtkbufferview.c182
-rw-r--r--src/gtkext/gtkbufferview.h2
-rw-r--r--src/gtkext/gtkdockstation.c6
-rw-r--r--src/gtkext/gtkdockstation.h8
-rw-r--r--src/gtkext/gtkgraphview.c154
-rw-r--r--src/gtkext/gtkgraphview.h2
-rw-r--r--src/gtkext/gtklinkrenderer.c14
-rw-r--r--src/gtkext/gtklinkrenderer.h6
-rw-r--r--src/gtkext/gtksourceview.h2
-rw-r--r--src/gtkext/gtkviewpanel-int.h3
-rw-r--r--src/gtkext/gtkviewpanel.c84
17 files changed, 318 insertions, 269 deletions
diff --git a/src/gtkext/graph/edge.c b/src/gtkext/graph/edge.c
index 4aedbde..8540c19 100644
--- a/src/gtkext/graph/edge.c
+++ b/src/gtkext/graph/edge.c
@@ -401,33 +401,6 @@ void g_graph_edge_compute(GGraphEdge *edge, GGraphRanks *ranks)
/******************************************************************************
* *
-* Paramètres : edge = ligne de rendu à manipuler. *
-* drawable = surface de rendu à utiliser. *
-* gc = contexte graphique du dessin. *
-* *
-* Description : Dessine les liens graphiques enregistrés dans le moteur. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_graph_edge_draw(const GGraphEdge *edge, GdkDrawable *drawable, GdkGC *gc)
-{
- cairo_t *cairo; /* Gestionnaire de rendu */
-
- cairo = gdk_cairo_create(drawable);
-
- _g_graph_edge_draw(edge, cairo, true);
-
- cairo_destroy(cairo);
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : edge = ligne de rendu à manipuler. *
* cairo = assistant pour le rendu graphique. *
* arrow = indique le besoin en flèche à l'arrivée. *
@@ -440,7 +413,7 @@ void g_graph_edge_draw(const GGraphEdge *edge, GdkDrawable *drawable, GdkGC *gc)
* *
******************************************************************************/
-void _g_graph_edge_draw(const GGraphEdge *edge, cairo_t *cairo, bool arrow)
+void g_graph_edge_draw(const GGraphEdge *edge, cairo_t *cairo, bool arrow)
{
size_t i; /* Boucle de parcours */
diff --git a/src/gtkext/graph/edge.h b/src/gtkext/graph/edge.h
index 12dcfdc..f6f0acf 100644
--- a/src/gtkext/graph/edge.h
+++ b/src/gtkext/graph/edge.h
@@ -77,10 +77,7 @@ void g_graph_edge_reserve_horizontal_space(GGraphEdge *, GGraphRanks *);
void g_graph_edge_compute(GGraphEdge *, GGraphRanks *);
/* Dessine les liens graphiques enregistrés dans le moteur. */
-void g_graph_edge_draw(const GGraphEdge *, GdkDrawable *, GdkGC *);
-
-/* Dessine les liens graphiques enregistrés dans le moteur. */
-void _g_graph_edge_draw(const GGraphEdge *, cairo_t *, bool);
+void g_graph_edge_draw(const GGraphEdge *, cairo_t *, bool);
diff --git a/src/gtkext/graph/layout.c b/src/gtkext/graph/layout.c
index 9ac3ee3..0d4f7b3 100644
--- a/src/gtkext/graph/layout.c
+++ b/src/gtkext/graph/layout.c
@@ -789,30 +789,6 @@ void g_graph_layout_size_request(const GGraphLayout *layout, GtkRequisition *req
/******************************************************************************
* *
-* Paramètres : layout = graphique à représenter. *
-* drawable = surface de rendu à utiliser. *
-* gc = contexte graphique du dessin. *
-* *
-* Description : Dessine les liens graphiques enregistrés dans le moteur. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void g_graph_layout_draw(const GGraphLayout *layout, GdkDrawable *drawable, GdkGC *gc)
-{
- size_t i; /* Boucle de parcours */
-
- for (i = 0; i < layout->edges_count; i++)
- g_graph_edge_draw(layout->edges[i], drawable, gc);
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : layout = graphique à représenter. *
* cairo = assistant pour le rendu graphique. *
* arrow = indique le besoin en flèche à l'arrivée. *
@@ -825,11 +801,11 @@ void g_graph_layout_draw(const GGraphLayout *layout, GdkDrawable *drawable, GdkG
* *
******************************************************************************/
-void _g_graph_layout_draw(const GGraphLayout *layout, cairo_t *cairo, bool arrow)
+void g_graph_layout_draw(const GGraphLayout *layout, cairo_t *cairo, bool arrow)
{
size_t i; /* Boucle de parcours */
for (i = 0; i < layout->edges_count; i++)
- _g_graph_edge_draw(layout->edges[i], cairo, arrow);
+ g_graph_edge_draw(layout->edges[i], cairo, arrow);
}
diff --git a/src/gtkext/graph/layout.h b/src/gtkext/graph/layout.h
index 8aade99..6055a04 100644
--- a/src/gtkext/graph/layout.h
+++ b/src/gtkext/graph/layout.h
@@ -79,10 +79,7 @@ void g_graph_layout_place(GGraphLayout *, GtkGraphView *);
void g_graph_layout_size_request(const GGraphLayout *, GtkRequisition *);
/* Dessine les liens graphiques enregistrés dans le moteur. */
-void g_graph_layout_draw(const GGraphLayout *, GdkDrawable *, GdkGC *);
-
-/* Dessine les liens graphiques enregistrés dans le moteur. */
-void _g_graph_layout_draw(const GGraphLayout *, cairo_t *, bool);
+void g_graph_layout_draw(const GGraphLayout *, cairo_t *, bool);
diff --git a/src/gtkext/gtkbinarystrip.c b/src/gtkext/gtkbinarystrip.c
index 3f4a6a6..3b36c8b 100644
--- a/src/gtkext/gtkbinarystrip.c
+++ b/src/gtkext/gtkbinarystrip.c
@@ -71,7 +71,7 @@ static void gtk_binary_strip_size_allocate(GtkWidget *, GtkAllocation *);
static gboolean gtk_binary_strip_button_release(GtkWidget *, GdkEventButton *);
/* Met à jour l'affichage du composant d'affichage. */
-static gboolean gtk_binary_strip_expose(GtkWidget *, GdkEventExpose *);
+static gboolean gtk_binary_strip_draw(GtkWidget *, cairo_t *);
/* Prépare l'affichage d'une astuce. */
static gboolean gtk_binary_strip_query_tooltip(GtkWidget *, gint, gint, gboolean, GtkTooltip *);
@@ -103,7 +103,7 @@ static void gtk_binary_strip_class_init(GtkBinaryStripClass *class)
widget_class->realize = gtk_binary_strip_realize;
widget_class->size_allocate = gtk_binary_strip_size_allocate;
widget_class->button_release_event = gtk_binary_strip_button_release;
- widget_class->expose_event = gtk_binary_strip_expose;
+ widget_class->draw = gtk_binary_strip_draw;
widget_class->query_tooltip = gtk_binary_strip_query_tooltip;
g_signal_new("select-address",
@@ -186,8 +186,8 @@ static void gtk_binary_strip_realize(GtkWidget *widget)
GTK_WIDGET_CLASS(gtk_binary_strip_parent_class)->realize(widget);
cursor = gdk_cursor_new(GDK_HAND1);
- gdk_window_set_cursor(widget->window, cursor);
- gdk_cursor_unref(cursor);
+ gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
+ g_object_unref(cursor);
gtk_widget_add_events(widget, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
@@ -250,6 +250,8 @@ static void gtk_binary_strip_size_allocate(GtkWidget *widget, GtkAllocation *all
static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButton *event)
{
+ gint width; /* Laugeur du composant */
+ gint height; /* Hauteur du composant */
GtkBinaryStrip *strip; /* Autre version du composant */
GExeFormat *format; /* Format du binaire */
GBinPortion *portions; /* Portions binaires à dessiner*/
@@ -258,7 +260,11 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto
if (event->x < 0 || event->y < 0)
return FALSE;
- if (event->x >= widget->allocation.width || event->y >= widget->allocation.height)
+
+ width = gtk_widget_get_allocated_width(widget);
+ height = gtk_widget_get_allocated_height(widget);
+
+ if (event->x >= width || event->y >= height)
return FALSE;
strip = GTK_BINARY_STRIP(widget);
@@ -267,8 +273,8 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto
area.x = 0;
area.y = 0;
- area.width = widget->allocation.width;
- area.height = widget->allocation.height;
+ area.width = width;
+ area.height = height;
if (g_binary_portion_get_addr_from_pos(portions, event->x, &area, &addr))
{
@@ -289,7 +295,7 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto
/******************************************************************************
* *
* Paramètres : widget = composant GTK à redessiner. *
-* event = informations liées à l'événement. *
+* cr = contexte graphique associé à l'événement. *
* *
* Description : Met à jour l'affichage du composant d'affichage. *
* *
@@ -299,13 +305,13 @@ static gboolean gtk_binary_strip_button_release(GtkWidget *widget, GdkEventButto
* *
******************************************************************************/
-static gboolean gtk_binary_strip_expose(GtkWidget *widget, GdkEventExpose *event)
+static gboolean gtk_binary_strip_draw(GtkWidget *widget, cairo_t *cr)
{
GtkBinaryStrip *strip; /* Autre vision du composant */
- cairo_t *cr; /* Contexte graphique */
GExeFormat *format; /* Format du binaire */
GBinPortion *portions; /* Portions binaires à dessiner*/
GdkRectangle full; /* Taille totale de la surface */
+ GdkRGBA *color; /* Couleur du curseur */
strip = GTK_BINARY_STRIP(widget);
@@ -315,19 +321,12 @@ static gboolean gtk_binary_strip_expose(GtkWidget *widget, GdkEventExpose *event
format = g_loaded_binary_get_format(strip->binary);
portions = g_exe_format_get_portions(format);
- cr = gdk_cairo_create(widget->window);
-
- cairo_rectangle(cr,
- event->area.x, event->area.y,
- event->area.width, event->area.height);
- cairo_clip(cr);
-
/* Dessin des portions de binaire */
full.x = 0;
full.y = 1;
- full.width = widget->allocation.width;
- full.height = widget->allocation.height - 1;
+ full.width = gtk_widget_get_allocated_width(widget);
+ full.height = gtk_widget_get_allocated_height(widget) - 1;
g_binary_portion_draw(portions, cr, &full);
@@ -337,10 +336,12 @@ static gboolean gtk_binary_strip_expose(GtkWidget *widget, GdkEventExpose *event
{
cairo_set_line_width(cr, 1);
- cairo_set_source_rgb(cr,
- (1.0 * widget->style->bg[GTK_STATE_NORMAL].red) / USHRT_MAX,
- (1.0 * widget->style->bg[GTK_STATE_NORMAL].green) / USHRT_MAX,
- (1.0 * widget->style->bg[GTK_STATE_NORMAL].blue )/ USHRT_MAX);
+ gtk_style_context_get(gtk_widget_get_style_context(widget), GTK_STATE_FLAG_NORMAL,
+ GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color, NULL);
+
+ cairo_set_source_rgb(cr, color->red, color->green, color->blue);
+
+ gdk_rgba_free(color);
cairo_move_to(cr, strip->cursor_pos, STRIP_MARKER_SIZE);
cairo_line_to(cr, strip->cursor_pos + STRIP_MARKER_SIZE, 0);
@@ -356,10 +357,6 @@ static gboolean gtk_binary_strip_expose(GtkWidget *widget, GdkEventExpose *event
}
- /* Clôture */
-
- cairo_destroy (cr);
-
return FALSE;
}
@@ -400,8 +397,8 @@ static gboolean gtk_binary_strip_query_tooltip(GtkWidget *widget, gint x, gint y
area.x = 0;
area.y = 0;
- area.width = widget->allocation.width;
- area.height = widget->allocation.height;
+ area.width = gtk_widget_get_allocated_width(widget);
+ area.height = gtk_widget_get_allocated_height(widget);
result = g_binary_portion_query_tooltip(portions, x, y, &area, tooltip);
diff --git a/src/gtkext/gtkblockview.h b/src/gtkext/gtkblockview.h
index c3e04ed..e67b8d5 100644
--- a/src/gtkext/gtkblockview.h
+++ b/src/gtkext/gtkblockview.h
@@ -26,7 +26,7 @@
#include <glib-object.h>
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
diff --git a/src/gtkext/gtkbufferview.c b/src/gtkext/gtkbufferview.c
index 7cb1e9b..877b041 100644
--- a/src/gtkext/gtkbufferview.c
+++ b/src/gtkext/gtkbufferview.c
@@ -46,14 +46,17 @@ static gboolean gtk_buffer_view_focus(GtkWidget *, GtkDirectionType);
/* Assure la gestion des clics de souris sur le composant. */
static gboolean gtk_buffer_view_button_press(GtkWidget *, GdkEventButton *);
-/* Fournit la taille de composant requise pour un plein rendu. */
-static void gtk_buffer_view_size_request(GtkWidget *, GtkRequisition *);
+/* Fournit la hauteur de composant requise pour un plein rendu. */
+static void gtk_buffer_view_get_preferred_height(GtkWidget *, gint *, gint *);
+
+/* Fournit la largeur de composant requise pour un plein rendu. */
+static void gtk_buffer_view_get_preferred_width(GtkWidget *, gint *, gint *);
/* 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 *);
+static gboolean gtk_buffer_view_draw(GtkWidget *, cairo_t *);
/* Prend en compte une frappe de touche sur le composant. */
static gboolean gtk_buffer_view_key_press(GtkWidget *, GdkEventKey *);
@@ -109,9 +112,10 @@ static void gtk_buffer_view_class_init(GtkBufferViewClass *class)
widget_class->focus = gtk_buffer_view_focus;
widget_class->button_press_event = gtk_buffer_view_button_press;
- widget_class->size_request = gtk_buffer_view_size_request;
+ widget_class->get_preferred_height = gtk_buffer_view_get_preferred_height;
+ widget_class->get_preferred_width = gtk_buffer_view_get_preferred_width;
widget_class->size_allocate = gtk_buffer_view_size_allocate;
- widget_class->expose_event = gtk_buffer_view_expose;
+ widget_class->draw = gtk_buffer_view_draw;
widget_class->key_press_event = gtk_buffer_view_key_press;
g_signal_new("caret-moved",
@@ -301,10 +305,11 @@ void gtk_buffer_view_compute_real_coord(GtkBufferView *view, gint *x, gint *y)
/******************************************************************************
* *
-* Paramètres : widget = composant GTK à consulter. *
-* requisition = dimensions souhaitées. [OUT] *
+* Paramètres : widget = composant GTK à consulter. *
+* minimal = taille minimale. [OUT] *
+* natural = taille idéale. [OUT] *
* *
-* Description : Fournit la taille de composant requise pour un plein rendu. *
+* Description : Fournit la hauteur de composant requise pour un plein rendu. *
* *
* Retour : - *
* *
@@ -312,17 +317,50 @@ void gtk_buffer_view_compute_real_coord(GtkBufferView *view, gint *x, gint *y)
* *
******************************************************************************/
-static void gtk_buffer_view_size_request(GtkWidget *widget, GtkRequisition *requisition)
+static void gtk_buffer_view_get_preferred_height(GtkWidget *widget, gint *minimal, gint *natural)
{
GtkBufferView *view; /* Autre version du composant */
view = GTK_BUFFER_VIEW(widget);
if (view->buffer_view != NULL)
- g_buffer_view_get_size(view->buffer_view,
- &requisition->width, &requisition->height,
- *GTK_VIEW_PANEL(view)->display_addr,
- *GTK_VIEW_PANEL(view)->display_code);
+ *minimal = g_buffer_view_get_height(view->buffer_view);
+ else
+ *minimal = 0;
+
+ *natural = *minimal;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : widget = composant GTK à consulter. *
+* minimal = taille minimale. [OUT] *
+* natural = taille idéale. [OUT] *
+* *
+* Description : Fournit la largeur de composant requise pour un plein rendu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_buffer_view_get_preferred_width(GtkWidget *widget, gint *minimal, gint *natural)
+{
+ GtkBufferView *view; /* Autre version du composant */
+
+ view = GTK_BUFFER_VIEW(widget);
+
+ if (view->buffer_view != NULL)
+ *minimal = g_buffer_view_get_width(view->buffer_view,
+ *GTK_VIEW_PANEL(view)->display_addr,
+ *GTK_VIEW_PANEL(view)->display_code);
+ else
+ *minimal = 0;
+
+ *natural = *minimal;
}
@@ -351,10 +389,10 @@ static void gtk_buffer_view_size_allocate(GtkWidget *widget, GtkAllocation *allo
/* Mise à jour GTK */
- widget->allocation = *allocation;
+ gtk_widget_set_allocation(widget, allocation);
if (gtk_widget_get_realized(widget))
- gdk_window_move_resize(widget->window,
+ gdk_window_move_resize(gtk_widget_get_window(widget),
allocation->x, allocation->y,
allocation->width, allocation->height);
@@ -365,18 +403,18 @@ static void gtk_buffer_view_size_allocate(GtkWidget *widget, GtkAllocation *allo
view = GTK_BUFFER_VIEW(widget);
- g_buffer_view_get_size(view->buffer_view, &width, &height,
- *panel->display_addr, *panel->display_code);
+ width = g_buffer_view_get_width(view->buffer_view, *panel->display_addr, *panel->display_code);
+ height = g_buffer_view_get_height(view->buffer_view);
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;
+ gtk_adjustment_set_page_size(panel->hadjustment, valloc.width);
+ gtk_adjustment_set_step_increment(panel->hadjustment, valloc.width * 0.1);
+ gtk_adjustment_set_page_increment(panel->hadjustment, valloc.width * 0.9);
- panel->hadjustment->upper = MAX(width, valloc.width);
+ gtk_adjustment_set_upper(panel->hadjustment, MAX(width, valloc.width));
gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed);
@@ -387,11 +425,11 @@ static void gtk_buffer_view_size_allocate(GtkWidget *widget, GtkAllocation *allo
/* Défilement vertical */
- panel->vadjustment->page_size = valloc.height;
- panel->vadjustment->step_increment = view->line_height;
- panel->vadjustment->page_increment = panel->vadjustment->step_increment * 10.0;
+ gtk_adjustment_set_page_size(panel->vadjustment, valloc.height);
+ gtk_adjustment_set_step_increment(panel->vadjustment, view->line_height);
+ gtk_adjustment_set_page_increment(panel->vadjustment, view->line_height * 10.0);
- panel->vadjustment->upper = MAX(height, valloc.height);
+ gtk_adjustment_set_upper(panel->vadjustment, MAX(height, valloc.height));
gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed);
@@ -405,8 +443,8 @@ static void gtk_buffer_view_size_allocate(GtkWidget *widget, GtkAllocation *allo
/******************************************************************************
* *
-* Paramètres : view = composant GTK à redessiner. *
-* event = informations liées à l'événement. *
+* Paramètres : widget = composant GTK à redessiner. *
+* cr = contexte graphique associé à l'événement. *
* *
* Description : Met à jour l'affichage de la visualisation de code buffer. *
* *
@@ -416,62 +454,75 @@ static void gtk_buffer_view_size_allocate(GtkWidget *widget, GtkAllocation *allo
* *
******************************************************************************/
-static gboolean gtk_buffer_view_expose(GtkWidget *widget, GdkEventExpose *event)
+static gboolean gtk_buffer_view_draw(GtkWidget *widget, cairo_t *cr)
{
GtkBufferView *view; /* Autre version du composant */
GtkViewPanel *pview; /* Autre version du composant */
- GtkStyle *style; /* Style associé au composant */
- GdkDrawable *drawable; /* Surface de dessin */
+ cairo_region_t *region; /* Région visible à redessiner */
+ cairo_rectangle_int_t area; /* Surface correspondante */
gint fake_x; /* Abscisse virtuelle */
gint fake_y; /* Ordonnée virtuelle */
- GtkStateType state; /* Etat du composant */
- GtkViewPanelClass *parent_class; /* Version pure du parent */
+ GtkStateFlags state; /* Etat du composant */
+ GdkRGBA *color; /* Couleur du curseur */
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));
+ region = gdk_window_get_visible_region(gtk_widget_get_window(widget));
+ cairo_region_get_extents(region, &area);
+ cairo_region_destroy(region);
fake_x = 0;
fake_y = 0;
gtk_buffer_view_compute_fake_coord(view, &fake_x, &fake_y);
+
+ do
+ {
+
+
+ GtkStyleContext *context;
+
+
+ context = gtk_widget_get_style_context(widget);
+
+ gtk_render_background(context, cr, 0, 0, 250, 250);
+
+ printf("Passage!\n");
+
+
+ } while (0);
+
+
+
/* Dessin de la marge gauche */
- state = gtk_widget_get_state(widget);
+ state = gtk_widget_get_state_flags(widget);
- gdk_gc_set_foreground(pview->gc, &style->mid[state]);
+ gtk_style_context_get(gtk_widget_get_style_context(widget), state,
+ GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &color, NULL);
- gdk_draw_rectangle(drawable, pview->gc, TRUE,
- fake_x, event->area.y, view->left_margin, event->area.y + event->area.height);
+ cairo_rectangle(cr, fake_x, area.y,view->left_margin, area.y + area.height);
+ cairo_fill(cr);
- gdk_gc_set_foreground(pview->gc, &style->dark[state]);
+ gtk_style_context_get(gtk_widget_get_style_context(widget), state,
+ GTK_STYLE_PROPERTY_BORDER_COLOR, &color, NULL);
- 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);
+ cairo_move_to(cr, fake_x + view->left_margin, area.y);
+ cairo_line_to(cr, fake_x + view->left_margin, area.y + area.height);
+ cairo_fill(cr);
/* 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);
+ GTK_WIDGET_CLASS(gtk_buffer_view_parent_class)->draw(widget, cr);
/* Impression du désassemblage */
if (view->buffer_view != NULL)
- g_buffer_view_draw(view->buffer_view, event, pview->gc, fake_x, fake_y,
+ g_buffer_view_draw(view->buffer_view, cr, fake_x, fake_y, &area,
*pview->display_addr, *pview->display_code);
- gdk_window_end_paint(drawable);
-
return TRUE;
}
@@ -633,7 +684,8 @@ void gtk_buffer_view_attach_buffer(GtkBufferView *view, GBufferView *buffer, boo
/* Validation finale */
- g_buffer_view_get_size(view->buffer_view, &width, &height, *addr, *code);
+ width = g_buffer_view_get_width(view->buffer_view, *addr, *code);
+ height = g_buffer_view_get_height(view->buffer_view);
width += -view->left_text + 1;
height += 1;
@@ -754,10 +806,8 @@ static gboolean gtk_buffer_view_refresh_caret(GtkBufferView *view)
{
GtkWidget *widget; /* Autre version du composant */
GdkRectangle area; /* Région adaptée à traiter */
- GdkDrawable *drawable; /* Surface de dessin */
- GtkStyle *style; /* Style associé au composant */
- GtkStateType state; /* Etat du composant */
- GdkGC *gc; /* Contexte graphique */
+ cairo_t *cr; /* Contexte graphique */
+ GdkRGBA *color; /* Couleur du curseur */
widget = GTK_WIDGET(view);
@@ -776,16 +826,18 @@ static gboolean gtk_buffer_view_refresh_caret(GtkBufferView *view)
{
view->show_caret = true;
- drawable = GDK_DRAWABLE(widget->window);
- state = gtk_widget_get_state(widget);
- style = gtk_widget_get_style(widget);
+ cr = gdk_cairo_create(gtk_widget_get_window(widget));
+
+ gtk_style_context_get(gtk_widget_get_style_context(widget),
+ gtk_widget_get_state_flags(widget),
+ GTK_STYLE_PROPERTY_COLOR, &color, NULL);
- gc = gdk_gc_new(drawable);
- gdk_gc_set_foreground(gc, &style->text[state]);
+ cairo_set_source_rgb(cr, color->red, color->green, color->blue);
- gdk_draw_rectangle(drawable, gc, TRUE, area.x, area.y, area.width, area.height);
+ cairo_rectangle(cr, area.x, area.y, area.width, area.height);
+ cairo_fill(cr);
- gdk_gc_destroy(gc);
+ cairo_destroy(cr);
}
diff --git a/src/gtkext/gtkbufferview.h b/src/gtkext/gtkbufferview.h
index df34b72..6b95a4c 100644
--- a/src/gtkext/gtkbufferview.h
+++ b/src/gtkext/gtkbufferview.h
@@ -26,7 +26,7 @@
#include <glib-object.h>
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
#include "../glibext/gcodebuffer.h"
diff --git a/src/gtkext/gtkdockstation.c b/src/gtkext/gtkdockstation.c
index e087377..532ea2b 100644
--- a/src/gtkext/gtkdockstation.c
+++ b/src/gtkext/gtkdockstation.c
@@ -47,7 +47,7 @@ static gboolean gtk_dock_station_switch_panel(GtkNotebook *, gpointer *, guint,
/* Détermine le type du composant d'affichage concentré. */
-G_DEFINE_TYPE(GtkDockStation, gtk_dock_station, GTK_TYPE_VBOX)
+G_DEFINE_TYPE(GtkDockStation, gtk_dock_station, GTK_TYPE_BOX)
/******************************************************************************
@@ -110,11 +110,13 @@ static void gtk_dock_station_init(GtkDockStation *station)
GtkWidget *button; /* Bouton de contrôle */
GtkWidget *image; /* Image associée */
+ gtk_orientable_set_orientation(GTK_ORIENTABLE(station), GTK_ORIENTATION_VERTICAL);
+
eventbox = gtk_event_box_new();
gtk_widget_show(eventbox);
gtk_box_pack_start(GTK_BOX(station), eventbox, FALSE, TRUE, 0);
- hbox = gtk_hbox_new(FALSE, 0);
+ hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show(hbox);
gtk_container_add(GTK_CONTAINER(eventbox), hbox);
diff --git a/src/gtkext/gtkdockstation.h b/src/gtkext/gtkdockstation.h
index 192fdf2..add421a 100644
--- a/src/gtkext/gtkdockstation.h
+++ b/src/gtkext/gtkdockstation.h
@@ -28,7 +28,7 @@
#include <gtk/gtk.h>
-G_BEGIN_DECLS
+//G_BEGIN_DECLS
#define GTK_TYPE_DOCK_STATION (gtk_dock_station_get_type())
@@ -47,7 +47,7 @@ typedef struct _GtkDockStationClass GtkDockStationClass;
/* Station de réception pour concentration d'éléments (instance) */
struct _GtkDockStation
{
- GtkVBox vbox; /* Présence obligatoire en 1er */
+ GtkBox vbox; /* Présence obligatoire en 1er */
GtkLabel *title; /* Title du support principal */
GtkNotebook *notebook; /* Support à onglets */
@@ -57,7 +57,7 @@ struct _GtkDockStation
/* Station de réception pour concentration d'éléments (classe) */
struct _GtkDockStationClass
{
- GtkVBoxClass parent_class; /* Présence obligatoire en 1er */
+ GtkBoxClass parent_class; /* Présence obligatoire en 1er */
/* Signaux */
@@ -92,7 +92,7 @@ GtkWidget *gtk_dock_panel_get_widget(GtkDockStation *, gint);
-G_END_DECLS
+//G_END_DECLS
diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c
index 52d718b..817c311 100644
--- a/src/gtkext/gtkgraphview.c
+++ b/src/gtkext/gtkgraphview.c
@@ -69,14 +69,17 @@ static void gtk_graph_view_class_init(GtkGraphViewClass *);
/* Initialise une instance d'afficheur de code en graphique. */
static void gtk_graph_view_init(GtkGraphView *);
-/* Fournit la taille de composant requise pour un plein rendu. */
-static void gtk_graph_view_size_request(GtkWidget *, GtkRequisition *);
+/* Fournit la hauteur de composant requise pour un plein rendu. */
+static void gtk_graph_view_get_preferred_height(GtkWidget *, gint *, gint *);
+
+/* Fournit la largeur de composant requise pour un plein rendu. */
+static void gtk_graph_view_get_preferred_width(GtkWidget *, gint *, gint *);
/* S'adapte à la surface concédée par le composant parent. */
static void gtk_graph_view_size_allocate(GtkWidget *, GtkAllocation *);
/* Met à jour l'affichage de la vue sous forme graphique. */
-static gboolean gtk_graph_view_expose(GtkWidget *, GdkEventExpose *, GtkGraphView *);
+static gboolean gtk_graph_view_draw(GtkWidget *, cairo_t *, GtkGraphView *);
/* Réagit à la sélection externe d'une adresse. */
static void gtk_graph_view_define_main_address(GtkGraphView *, vmpa_t);
@@ -125,7 +128,8 @@ static void gtk_graph_view_class_init(GtkGraphViewClass *klass)
widget_class = (GtkWidgetClass *)klass;
- widget_class->size_request = gtk_graph_view_size_request;
+ widget_class->get_preferred_height = gtk_graph_view_get_preferred_height;
+ widget_class->get_preferred_width = gtk_graph_view_get_preferred_width;
widget_class->size_allocate = gtk_graph_view_size_allocate;
}
@@ -166,13 +170,15 @@ static void gtk_graph_view_init(GtkGraphView *view)
view->support = GTK_FIXED(gtk_fixed_new());
gtk_widget_set_has_window(GTK_WIDGET(view->support), TRUE);
- g_signal_connect(G_OBJECT(view->support), "expose-event",
- G_CALLBACK(gtk_graph_view_expose), view);
+ g_signal_connect(G_OBJECT(view->support), "draw",
+ G_CALLBACK(gtk_graph_view_draw), view);
gtk_widget_show(GTK_WIDGET(view->support));
+ /*
gdk_color_white(gtk_widget_get_colormap(GTK_WIDGET(view->support)), &white);
gtk_widget_modify_bg(GTK_WIDGET(view->support), GTK_STATE_NORMAL, &white);
+ */
gtk_fixed_put(GTK_FIXED(view), GTK_WIDGET(view->support), 0, 0);
@@ -182,12 +188,23 @@ static void gtk_graph_view_init(GtkGraphView *view)
}
+
+
+
+
+
+
+
+
+
+
/******************************************************************************
* *
-* Paramètres : widget = composant GTK à consulter. *
-* requisition = dimensions souhaitées. [OUT] *
+* Paramètres : widget = composant GTK à consulter. *
+* minimal = taille minimale. [OUT] *
+* natural = taille idéale. [OUT] *
* *
-* Description : Fournit la taille de composant requise pour un plein rendu. *
+* Description : Fournit la hauteur de composant requise pour un plein rendu. *
* *
* Retour : - *
* *
@@ -195,63 +212,74 @@ static void gtk_graph_view_init(GtkGraphView *view)
* *
******************************************************************************/
-static void gtk_graph_view_size_request(GtkWidget *widget, GtkRequisition *requisition)
+static void gtk_graph_view_get_preferred_height(GtkWidget *widget, gint *minimal, gint *natural)
{
- gpointer fixed_class; /* Classe parente */
GtkGraphView *view; /* Autre vision du composant */
- size_t i; /* Boucle de parcours */
- gint left_corner; /* Abscisse minimale */
- gint top_corner; /* Ordonnée minimale */
-
- fixed_class = g_type_class_peek_parent(GTK_GRAPH_VIEW_GET_CLASS(widget));
- fixed_class = g_type_class_peek_parent(fixed_class);
-
- GTK_WIDGET_CLASS(fixed_class)->size_request(widget, requisition);
+ GtkRequisition requisition; /* Taille requise */
+ gpointer fixed_class; /* Classe parente */
view = GTK_GRAPH_VIEW(widget);
if (view->layout != NULL)
- g_graph_layout_size_request(view->layout, requisition);
+ {
+ g_graph_layout_size_request(view->layout, &requisition);
+ *minimal = requisition.height;
+ *natural = *minimal;
+ }
- //requisition->width += 65;
- //requisition->height += 65;
+ else
+ {
+ fixed_class = g_type_class_peek_parent(GTK_GRAPH_VIEW_GET_CLASS(widget));
+ fixed_class = g_type_class_peek_parent(fixed_class);
- view = GTK_GRAPH_VIEW(widget);
+ GTK_WIDGET_CLASS(fixed_class)->get_preferred_height(widget, minimal, natural);
- /*
- requisition->width += GTK_VIEW_PANEL(widget)->hadjustment->value;
- requisition->height += GTK_VIEW_PANEL(widget)->vadjustment->value;
- */
+ }
-#if 0
- /**
- * On s'assure de ne couper aucun lien.
- */
+}
- /*
- for (i = 0; i < view->links_count; i++)
- gtk_link_renderer_size_request(view->links[i], requisition);
- */
- /**
- * Traitement purement cosmétique : on ajoute la même bordure aux bords
- * droit et bas.
- */
+/******************************************************************************
+* *
+* Paramètres : widget = composant GTK à consulter. *
+* minimal = taille minimale. [OUT] *
+* natural = taille idéale. [OUT] *
+* *
+* Description : Fournit la largeur de composant requise pour un plein rendu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_graph_view_get_preferred_width(GtkWidget *widget, gint *minimal, gint *natural)
+{
+ GtkGraphView *view; /* Autre vision du composant */
+ GtkRequisition requisition; /* Taille requise */
+ gpointer fixed_class; /* Classe parente */
- left_corner = G_MAXINT;
- top_corner = G_MAXINT;
+ view = GTK_GRAPH_VIEW(widget);
- for (i = 0; i < view->children_count; i++)
+ if (view->layout != NULL)
{
- left_corner = MIN(left_corner, view->allocs[i].x);
- top_corner = MIN(top_corner, view->allocs[i].y);
+ g_graph_layout_size_request(view->layout, &requisition);
+
+ *minimal = requisition.width;
+ *natural = *minimal;
+
}
- if (left_corner != G_MAXINT) requisition->width += left_corner;
- if (top_corner != G_MAXINT) requisition->height += top_corner;
-#endif
+ else
+ {
+ fixed_class = g_type_class_peek_parent(GTK_GRAPH_VIEW_GET_CLASS(widget));
+ fixed_class = g_type_class_peek_parent(fixed_class);
+
+ GTK_WIDGET_CLASS(fixed_class)->get_preferred_width(widget, minimal, natural);
+
+ }
}
@@ -293,23 +321,23 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
gtk_view_panel_compute_allocation(panel, &valloc);
- gtk_widget_size_request(widget, &req);
+ gtk_widget_get_preferred_size(widget, NULL, &req);
/* Correction de la taille du support */
view = GTK_GRAPH_VIEW(widget);
- window = GTK_WIDGET(view->support)->window;
+ window = gtk_widget_get_window(GTK_WIDGET(view->support));
if (gdk_window_get_width(window) != req.width || gdk_window_get_height(window) != req.height)
gdk_window_resize(window, req.width, req.height);
/* 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;
+ gtk_adjustment_set_page_size(panel->hadjustment, valloc.width);
+ gtk_adjustment_set_step_increment(panel->hadjustment, valloc.width * 0.1);
+ gtk_adjustment_set_page_increment(panel->hadjustment, valloc.width * 0.9);
- panel->hadjustment->upper = MAX(req.width, valloc.width);
+ gtk_adjustment_set_upper(panel->hadjustment, MAX(req.width, valloc.width));
gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed);
@@ -320,11 +348,11 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
/* Défilement vertical */
- panel->vadjustment->page_size = valloc.height;
- panel->vadjustment->step_increment = valloc.width * 0.1;
- panel->vadjustment->page_increment = valloc.width * 0.9;
+ gtk_adjustment_set_page_size(panel->vadjustment, valloc.width);
+ gtk_adjustment_set_step_increment(panel->vadjustment, valloc.width * 0.1);
+ gtk_adjustment_set_page_increment(panel->vadjustment, valloc.width * 0.9);
- panel->vadjustment->upper = MAX(req.height, valloc.height);
+ gtk_adjustment_set_upper(panel->vadjustment, MAX(req.height, valloc.height));
gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed);
@@ -339,7 +367,7 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
/******************************************************************************
* *
* Paramètres : widget = composant GTK à redessiner. *
-* event = informations liées à l'événement. *
+* cr = contexte graphique associé à l'événement. *
* view = support maître à consulter. *
* *
* Description : Met à jour l'affichage de la vue sous forme graphique. *
@@ -350,10 +378,10 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
* *
******************************************************************************/
-static gboolean gtk_graph_view_expose(GtkWidget *widget, GdkEventExpose *event, GtkGraphView *view)
+static gboolean gtk_graph_view_draw(GtkWidget *widget, cairo_t *cr, GtkGraphView *view)
{
if (view->layout != NULL)
- g_graph_layout_draw(view->layout, GDK_DRAWABLE(widget->window), GTK_VIEW_PANEL(view)->gc);
+ g_graph_layout_draw(view->layout, cr, true);
return FALSE;
@@ -508,8 +536,8 @@ static bool gtk_graph_view_get_address_coordinates(const GtkGraphView *view, vmp
static void gtk_graph_view_scroll(GtkGraphView *view)
{
gtk_fixed_move(GTK_FIXED(view), GTK_WIDGET(view->support),
- -GTK_VIEW_PANEL(view)->hadjustment->value,
- -GTK_VIEW_PANEL(view)->vadjustment->value);
+ -gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->hadjustment),
+ -gtk_adjustment_get_value(GTK_VIEW_PANEL(view)->vadjustment));
}
@@ -548,7 +576,7 @@ static void gtk_graph_view_cache_glance(GtkGraphView *view, cairo_t *cairo, cons
cairo_scale(cairo, scale, scale);
if (view->layout != NULL)
- _g_graph_layout_draw(view->layout, cairo, false);
+ g_graph_layout_draw(view->layout, cairo, false);
}
diff --git a/src/gtkext/gtkgraphview.h b/src/gtkext/gtkgraphview.h
index ca164e8..85371f7 100644
--- a/src/gtkext/gtkgraphview.h
+++ b/src/gtkext/gtkgraphview.h
@@ -25,7 +25,7 @@
#define _GTKEXT_GTKGRAPHVIEW_H
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
#include "gtklinkrenderer.h"
diff --git a/src/gtkext/gtklinkrenderer.c b/src/gtkext/gtklinkrenderer.c
index 7ef1c37..cb24b64 100644
--- a/src/gtkext/gtklinkrenderer.c
+++ b/src/gtkext/gtklinkrenderer.c
@@ -31,7 +31,7 @@
/* Lien entre morceaux de code (instance) */
struct _GtkLinkRenderer
{
- GtkObject parent; /* A laisser en premier */
+ GtkWidget/*Object*/ parent; /* A laisser en premier */
LinkColor color; /* Couleur d'impression */
GdkPoint *points; /* Points de la ligne dessinée */
@@ -43,7 +43,7 @@ struct _GtkLinkRenderer
/* Lien entre morceaux de code (classe) */
struct _GtkLinkRendererClass
{
- GtkObjectClass parent; /* A laisser en premier */
+ GtkWidgetClass/*ObjectClass*/ parent; /* A laisser en premier */
};
@@ -64,7 +64,7 @@ static void draw_link_arrow(cairo_t *, gint, gint, gint, gint);
/* Détermine le type du moteur de rendu pour les liens graphiques. */
-G_DEFINE_TYPE(GtkLinkRenderer, gtk_link_renderer, GTK_TYPE_OBJECT)
+G_DEFINE_TYPE(GtkLinkRenderer, gtk_link_renderer, GTK_TYPE_WIDGET/*OBJECT*/)
/******************************************************************************
@@ -117,7 +117,7 @@ static void gtk_link_renderer_init(GtkLinkRenderer *view)
* *
******************************************************************************/
-GtkObject *gtk_link_renderer_new(LinkColor color, GdkPoint *points, size_t count)
+void/*GtkObject*/ *gtk_link_renderer_new(LinkColor color, GdkPoint *points, size_t count)
{
GtkLinkRenderer *result; /* Moteur de rendu à retourner */
@@ -127,7 +127,7 @@ GtkObject *gtk_link_renderer_new(LinkColor color, GdkPoint *points, size_t count
result->points = points;
result->count = count;
- return GTK_OBJECT(result);
+ return /*GTK_OBJECT*/(result);
}
@@ -157,7 +157,7 @@ void gtk_link_renderer_size_request(const GtkLinkRenderer *renderer, GtkRequisit
}
-
+#if 0
/******************************************************************************
* *
* Paramètres : renderer = moteur de rendu à manipuler. *
@@ -259,7 +259,7 @@ void _gtk_link_renderer_draw(const GtkLinkRenderer *renderer, cairo_t *cairo, bo
renderer->points[renderer->count - 1].y);
}
-
+#endif
/******************************************************************************
* *
diff --git a/src/gtkext/gtklinkrenderer.h b/src/gtkext/gtklinkrenderer.h
index 7b78e5e..165c3b6 100644
--- a/src/gtkext/gtklinkrenderer.h
+++ b/src/gtkext/gtklinkrenderer.h
@@ -64,17 +64,17 @@ typedef enum _LinkColor
GType gtk_link_renderer_get_type(void);
/* Crée un nouveau moteur de rendu pour les liens graphiques. */
-GtkObject *gtk_link_renderer_new(LinkColor, GdkPoint *, size_t);
+void/*GtkObject*/ *gtk_link_renderer_new(LinkColor, GdkPoint *, size_t);
/* S'assure qu'une zone sera assez grande pour tout contenir. */
void gtk_link_renderer_size_request(const GtkLinkRenderer *, GtkRequisition *);
-
+#if 0
/* Dessine les liens graphiques enregistrés dans le moteur. */
void gtk_link_renderer_draw(const GtkLinkRenderer *, GdkDrawable *, GdkGC *);
/* Dessine les liens graphiques enregistrés dans le moteur. */
void _gtk_link_renderer_draw(const GtkLinkRenderer *, cairo_t *, bool);
-
+#endif
#endif /* _GTKEXT_GTKLINKRENDERER_H */
diff --git a/src/gtkext/gtksourceview.h b/src/gtkext/gtksourceview.h
index e6cf37b..4ca9a9f 100644
--- a/src/gtkext/gtksourceview.h
+++ b/src/gtkext/gtksourceview.h
@@ -26,7 +26,7 @@
#include <glib-object.h>
-#include <gtk/gtkwidget.h>
+#include <gtk/gtk.h>
diff --git a/src/gtkext/gtkviewpanel-int.h b/src/gtkext/gtkviewpanel-int.h
index ee69673..e664d61 100644
--- a/src/gtkext/gtkviewpanel-int.h
+++ b/src/gtkext/gtkviewpanel-int.h
@@ -29,7 +29,7 @@
#include <stdbool.h>
-#include <gtk/gtkfixed.h>
+#include <gtk/gtk.h>
@@ -61,7 +61,6 @@ struct _GtkViewPanel
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 ? */
GLoadedBinary *binary; /* Binaire à visualiser */
diff --git a/src/gtkext/gtkviewpanel.c b/src/gtkext/gtkviewpanel.c
index ef1f94d..ebcd941 100644
--- a/src/gtkext/gtkviewpanel.c
+++ b/src/gtkext/gtkviewpanel.c
@@ -45,7 +45,7 @@ static void gtk_view_panel_adj_value_changed(GtkAdjustment *, GtkViewPanel *);
static void gtk_view_panel_realize(GtkWidget *);
/* Met à jour l'affichage du composant d'affichage. */
-static gboolean gtk_view_panel_expose(GtkWidget *, GdkEventExpose *);
+static gboolean gtk_view_panel_draw(GtkWidget *, cairo_t *);
@@ -72,10 +72,11 @@ static void gtk_view_panel_class_init(GtkViewPanelClass *class)
widget_class = GTK_WIDGET_CLASS(class);
widget_class->realize = gtk_view_panel_realize;
- widget_class->expose_event = gtk_view_panel_expose;
+ widget_class->draw = gtk_view_panel_draw;
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,
@@ -86,6 +87,7 @@ static void gtk_view_panel_class_init(GtkViewPanelClass *class)
G_TYPE_NONE, 2,
GTK_TYPE_ADJUSTMENT,
GTK_TYPE_ADJUSTMENT);
+ */
}
@@ -184,13 +186,13 @@ void gtk_view_panel_reclamp_adjustment(GtkAdjustment *adj, gboolean *changed)
{
gdouble value; /* Valeur actuelle */
- value = adj->value;
+ value = gtk_adjustment_get_value(adj);
- value = CLAMP(value, 0, adj->upper - adj->page_size);
+ value = CLAMP(value, 0, gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj));
- if (value != adj->value)
+ if (value != gtk_adjustment_get_value(adj))
{
- adj->value = value;
+ gtk_adjustment_set_value(adj, value);
*changed = TRUE;
}
else *changed = FALSE;
@@ -214,12 +216,12 @@ void gtk_view_panel_reclamp_adjustment(GtkAdjustment *adj, gboolean *changed)
void gtk_view_panel_compute_allocation(GtkViewPanel *panel, GtkAllocation *alloc)
{
GtkWidget *widget; /* Autre version de la vue */
- GtkAllocation *allocation; /* Raccourci d'utilisation #1 */
+ 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;
+ gtk_widget_get_allocation(widget, &allocation);
+ border_width = gtk_container_get_border_width(GTK_CONTAINER(panel));
alloc->x = 0;
alloc->y = 0;
@@ -232,8 +234,8 @@ void gtk_view_panel_compute_allocation(GtkViewPanel *panel, GtkAllocation *alloc
}
*/
- alloc->width = MAX(1, allocation->width - alloc->x * 2 - border_width * 2);
- alloc->height = MAX(1, allocation->height - alloc->y * 2 - border_width * 2);
+ alloc->width = MAX(1, allocation.width - alloc->x * 2 - border_width * 2);
+ alloc->height = MAX(1, allocation.height - alloc->y * 2 - border_width * 2);
}
@@ -252,17 +254,21 @@ void gtk_view_panel_compute_allocation(GtkViewPanel *panel, GtkAllocation *alloc
static void gtk_view_panel_realize(GtkWidget *widget)
{
+ GtkAllocation allocation; /* Disposition du composant */
GdkWindowAttr attributes; /* Propriétés du composant */
guint attributes_mask; /* Masque de prise en compte */
- GdkColor white; /* Couleur de fond normale */
+ GdkWindow *window; /* Fenêtre du composant */
+ GdkRGBA white; /* Couleur de fond normale */
+
+ gtk_widget_get_allocation(widget, &allocation);
gtk_widget_set_realized(widget, TRUE);
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.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.event_mask = gtk_widget_get_events(widget)
@@ -270,10 +276,17 @@ static void gtk_view_panel_realize(GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y;
- widget->window = gdk_window_new(gtk_widget_get_parent_window(widget),
- &attributes, attributes_mask);
+ window = gdk_window_new(gtk_widget_get_parent_window(widget),
+ &attributes, attributes_mask);
+
+ gtk_widget_set_window(widget, window);
- gdk_window_set_user_data(widget->window, widget);
+ gdk_window_set_user_data(window, widget);
+
+ gdk_rgba_parse(&white, "white");
+ gtk_widget_override_background_color(widget, GTK_STATE_FLAG_NORMAL, &white);
+
+ /*
widget->style = gtk_style_attach(widget->style, widget->window);
@@ -281,6 +294,7 @@ static void gtk_view_panel_realize(GtkWidget *widget)
gtk_widget_modify_bg(widget, GTK_STATE_NORMAL, &white);
GTK_VIEW_PANEL(widget)->gc = gdk_gc_new(GDK_DRAWABLE(widget->window));
+ */
}
@@ -288,7 +302,7 @@ static void gtk_view_panel_realize(GtkWidget *widget)
/******************************************************************************
* *
* Paramètres : widget = composant GTK à redessiner. *
-* event = informations liées à l'événement. *
+* cr = contexte graphique associé à l'événement. *
* *
* Description : Met à jour l'affichage du composant d'affichage. *
* *
@@ -298,18 +312,29 @@ static void gtk_view_panel_realize(GtkWidget *widget)
* *
******************************************************************************/
-static gboolean gtk_view_panel_expose(GtkWidget *widget, GdkEventExpose *event)
+static gboolean gtk_view_panel_draw(GtkWidget *widget, cairo_t *cr)
{
- GtkViewPanel *panel;
+ GtkViewPanel *panel; /* Autre version du composant */
+#if 0
GdkGCValues values; /* Propriétés du contexte */
GtkStyle *style; /* Style associé au composant */
GtkRequisition req; /* Taille allouée à l'élément */
GtkStateType state; /* Etat du composant */
-
+#endif
panel = GTK_VIEW_PANEL(widget);
if (panel->show_border)
{
+ GtkStyleContext *context;
+
+
+ context = gtk_widget_get_style_context(widget);
+
+ gtk_render_background(context, cr, 0, 0, 250, 250);
+
+ printf("Passage!\n");
+
+ /*
gdk_gc_get_values(panel->gc, &values);
style = gtk_widget_get_style(widget);
@@ -322,7 +347,7 @@ static gboolean gtk_view_panel_expose(GtkWidget *widget, GdkEventExpose *event)
FALSE, 0, 0, req.width - 1, req.height - 1);
gdk_gc_set_foreground(panel->gc, &values.foreground);
-
+ */
}
return FALSE;
@@ -539,6 +564,7 @@ void gtk_view_panel_scroll_to_address(GtkViewPanel *panel, vmpa_t addr)
gint x; /* Abscisse à garantir */
gint y; /* Ordonnée à garantir */
GtkAdjustment *adj; /* Défilement à mettre à jour */
+ double limit; /* Limite à ne pas dépasser */
if (panel->define != NULL)
panel->define(panel, addr);
@@ -546,16 +572,18 @@ void gtk_view_panel_scroll_to_address(GtkViewPanel *panel, vmpa_t addr)
if (panel->get_coordinates(panel, addr, &x, &y))
{
adj = panel->hadjustment;
+ limit = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj);
- if (x > (adj->upper - adj->page_size))
- x = adj->upper - adj->page_size;
+ if (x > limit)
+ x = limit;
gtk_adjustment_set_value(adj, x);
adj = panel->vadjustment;
+ limit = gtk_adjustment_get_upper(adj) - gtk_adjustment_get_page_size(adj);
- if (y > (adj->upper - adj->page_size))
- y = adj->upper - adj->page_size;
+ if (y > limit)
+ y = limit;
gtk_adjustment_set_value(adj, y);