summaryrefslogtreecommitdiff
path: root/src/gtkext/gtkgraphview.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2014-09-10 21:02:04 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2014-09-10 21:02:04 (GMT)
commitbe1f2f147e8ce15f20ec4de439088714ffa50e8a (patch)
treeeab8ad76fa6f39781568fae13fb7967cdedbd45a /src/gtkext/gtkgraphview.c
parentc03635088f26a18cdbd42c2528f00b9ccd8591d9 (diff)
Fixed and improved the rendering of view panels.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@401 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/gtkgraphview.c')
-rw-r--r--src/gtkext/gtkgraphview.c159
1 files changed, 56 insertions, 103 deletions
diff --git a/src/gtkext/gtkgraphview.c b/src/gtkext/gtkgraphview.c
index f34cf21..7919b32 100644
--- a/src/gtkext/gtkgraphview.c
+++ b/src/gtkext/gtkgraphview.c
@@ -69,18 +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 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_draw(GtkWidget *, cairo_t *, GtkGraphView *);
+
+/* Indique les dimensions de travail du composant d'affichage. */
+static void gtk_graph_view_compute_requested_size(GtkGraphView *, gint *, gint *);
+
+
/* Réagit à la sélection externe d'une adresse. */
static void gtk_graph_view_define_main_address(GtkGraphView *, vmpa_t);
@@ -109,7 +108,7 @@ G_DEFINE_TYPE(GtkGraphView, gtk_graph_view, GTK_TYPE_VIEW_PANEL)
/******************************************************************************
* *
-* Paramètres : klass = classe GTK à initialiser. *
+* Paramètres : class = classe GTK à initialiser. *
* *
* Description : Initialise la classe générique des graphiques de code. *
* *
@@ -119,16 +118,18 @@ G_DEFINE_TYPE(GtkGraphView, gtk_graph_view, GTK_TYPE_VIEW_PANEL)
* *
******************************************************************************/
-static void gtk_graph_view_class_init(GtkGraphViewClass *klass)
+static void gtk_graph_view_class_init(GtkGraphViewClass *class)
{
GtkWidgetClass *widget_class; /* Classe version Widget */
+ GtkViewPanelClass *panel_class; /* Classe parente */
- widget_class = (GtkWidgetClass *)klass;
+ widget_class = GTK_WIDGET_CLASS(class);
+ panel_class = GTK_VIEW_PANEL_CLASS(class);
- 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;
+ panel_class->compute_size = (compute_requested_size)gtk_graph_view_compute_requested_size;
+
}
@@ -191,95 +192,6 @@ static void gtk_graph_view_init(GtkGraphView *view)
-
-
-
-/******************************************************************************
-* *
-* Paramètres : widget = composant GTK à consulter. *
-* minimal = taille minimale. [OUT] *
-* natural = taille idéale. [OUT] *
-* *
-* Description : Fournit la hauteur de composant requise pour un plein rendu. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void gtk_graph_view_get_preferred_height(GtkWidget *widget, gint *minimal, gint *natural)
-{
- GtkGraphView *view; /* Autre vision du composant */
- 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);
-
- *minimal = requisition.height;
- *natural = *minimal;
-
- }
-
- 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_height(widget, minimal, natural);
-
- }
-
-}
-
-
-/******************************************************************************
-* *
-* 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 */
-
- view = GTK_GRAPH_VIEW(widget);
-
- if (view->layout != NULL)
- {
- g_graph_layout_size_request(view->layout, &requisition);
-
- *minimal = requisition.width;
- *natural = *minimal;
-
- }
-
- 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);
-
- }
-
-}
-
-
/******************************************************************************
* *
* Paramètres : view = composant GTK à mettre à jour. *
@@ -303,6 +215,8 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
GdkWindow *window; /* Fenêtre associée au support */
gboolean changed; /* Changement de valeur ? */
+ return;
+
/* Mise à jour GTK */
fixed_class = g_type_class_peek_parent(GTK_GRAPH_VIEW_GET_CLASS(widget));
@@ -315,7 +229,7 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
if (panel->hadjustment == NULL || panel->vadjustment == NULL)
return;
- gtk_view_panel_compute_allocation(panel, &valloc);
+ // !!!! moved !!! gtk_view_panel_compute_allocation(panel, &valloc);
gtk_widget_get_preferred_size(widget, NULL, &req);
@@ -335,7 +249,7 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
gtk_adjustment_set_upper(panel->hadjustment, MAX(req.width, valloc.width));
- gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed);
+ // !!!! moved !!! gtk_view_panel_reclamp_adjustment(panel->hadjustment, &changed);
gtk_adjustment_changed(panel->hadjustment);
@@ -350,7 +264,7 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
gtk_adjustment_set_upper(panel->vadjustment, MAX(req.height, valloc.height));
- gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed);
+ // !!!! moved !!! gtk_view_panel_reclamp_adjustment(panel->vadjustment, &changed);
gtk_adjustment_changed(panel->vadjustment);
@@ -360,6 +274,45 @@ static void gtk_graph_view_size_allocate(GtkWidget *widget, GtkAllocation *alloc
}
+
+
+
+
+/******************************************************************************
+* *
+* Paramètres : view = composant GTK à consulter. *
+* width = largeur requise à renseigner ou NULL. [OUT] *
+* height = hauteur requise à renseigner ou NULL. [OUT] *
+* *
+* Description : Indique les dimensions de travail du composant d'affichage. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void gtk_graph_view_compute_requested_size(GtkGraphView *view, gint *width, gint *height)
+{
+ GtkRequisition requisition; /* Taille requise */
+
+ if (width != NULL && view->layout != NULL)
+ {
+ g_graph_layout_size_request(view->layout, &requisition);
+ *width = requisition.height;
+ }
+
+ if (height != NULL && view->layout != NULL)
+ {
+ g_graph_layout_size_request(view->layout, &requisition);
+ *height = requisition.height;
+ }
+
+}
+
+
+
+
/******************************************************************************
* *
* Paramètres : widget = composant GTK à redessiner. *