summaryrefslogtreecommitdiff
path: root/src/gtkext/gtkgraphview.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2010-10-24 12:58:53 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2010-10-24 12:58:53 (GMT)
commit6ab5a66388182e6cb9a49b8d6e54a9348de4f264 (patch)
tree5dfdd4d9125423226cd44cc6e6c18502f362fbd2 /src/gtkext/gtkgraphview.c
parent7e53295ae7e67c8473aca2974e519aa0a593788e (diff)
Introduced new views for rendering source code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@184 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gtkext/gtkgraphview.c')
-rw-r--r--src/gtkext/gtkgraphview.c51
1 files changed, 29 insertions, 22 deletions
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);
}