Commit 7583e817 authored by claes's avatar claes

Fix in scroll

parent ee67737f
/* /*
* Proview $Id: flow_widget_gtk.cpp,v 1.5 2007-10-17 07:19:57 claes Exp $ * Proview $Id: flow_widget_gtk.cpp,v 1.6 2007-11-22 09:02:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -145,7 +145,7 @@ static gboolean scroll_callback_cb( void *d) ...@@ -145,7 +145,7 @@ static gboolean scroll_callback_cb( void *d)
gtk_adjustment_changed( ((GtkScrollbar *)scroll_data->scroll_h)->range.adjustment); gtk_adjustment_changed( ((GtkScrollbar *)scroll_data->scroll_h)->range.adjustment);
} }
else { else {
gtk_range_set_value( GTK_RANGE(scroll_data->scroll_v), (gdouble)data->offset_y); gtk_range_set_value( GTK_RANGE(scroll_data->scroll_h), (gdouble)data->offset_x);
} }
((FlowWidgetGtk *)scroll_data->flow)->scroll_h_value = (gdouble)data->offset_x; ((FlowWidgetGtk *)scroll_data->flow)->scroll_h_value = (gdouble)data->offset_x;
((FlowWidgetGtk *)scroll_data->flow)->scroll_h_pagesize = data->window_width; ((FlowWidgetGtk *)scroll_data->flow)->scroll_h_pagesize = data->window_width;
......
/* /*
* Proview $Id: glow_curvewidget_gtk.cpp,v 1.3 2007-02-06 15:13:34 claes Exp $ * Proview $Id: glow_curvewidget_gtk.cpp,v 1.4 2007-11-22 09:02:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -59,6 +59,14 @@ struct _CurveWidgetGtk { ...@@ -59,6 +59,14 @@ struct _CurveWidgetGtk {
GtkWidget *form; GtkWidget *form;
int scroll_h_ignore; int scroll_h_ignore;
int scroll_v_ignore; int scroll_v_ignore;
gdouble scroll_h_value;
gdouble scroll_v_value;
int scroll_h_pagesize;
int scroll_v_pagesize;
int scroll_h_upper;
int scroll_v_upper;
gint scroll_timerid;
glow_sScroll scroll_data;
}; };
struct _CurveWidgetGtkClass { struct _CurveWidgetGtkClass {
...@@ -66,12 +74,24 @@ struct _CurveWidgetGtkClass { ...@@ -66,12 +74,24 @@ struct _CurveWidgetGtkClass {
}; };
G_DEFINE_TYPE( CurveWidgetGtk, curvewidgetgtk, GTK_TYPE_DRAWING_AREA); G_DEFINE_TYPE( CurveWidgetGtk, curvewidgetgtk, GTK_TYPE_DRAWING_AREA);
static gboolean scroll_callback_cb( void *d);
static void scroll_callback( glow_sScroll *data) static void scroll_callback( glow_sScroll *data)
{ {
curvewidget_sScroll *scroll_data; curvewidget_sScroll *scroll_data = (curvewidget_sScroll *) data->scroll_data;
if ( ((CurveWidgetGtk *)scroll_data->curve)->scroll_timerid)
g_source_remove( ((CurveWidgetGtk *)scroll_data->curve)->scroll_timerid);
((CurveWidgetGtk *)scroll_data->curve)->scroll_timerid =
g_timeout_add( 200, scroll_callback_cb, scroll_data->curve);
((CurveWidgetGtk *)scroll_data->curve)->scroll_data = *data;
}
scroll_data = (curvewidget_sScroll *) data->scroll_data; static gboolean scroll_callback_cb( void *d)
{
glow_sScroll *data = &((CurveWidgetGtk *)d)->scroll_data;
curvewidget_sScroll *scroll_data = (curvewidget_sScroll *) data->scroll_data;
if ( data->total_width <= data->window_width) { if ( data->total_width <= data->window_width) {
if ( data->offset_x == 0) if ( data->offset_x == 0)
...@@ -115,6 +135,29 @@ static void scroll_callback( glow_sScroll *data) ...@@ -115,6 +135,29 @@ static void scroll_callback( glow_sScroll *data)
if ( data->window_height < 1) if ( data->window_height < 1)
data->window_height = 1; data->window_height = 1;
if ( scroll_data->scroll_v_managed) {
((CurveWidgetGtk *)scroll_data->curve)->scroll_v_ignore = 1;
if ( data->window_height != ((CurveWidgetGtk *)scroll_data->curve)->scroll_v_pagesize ||
data->total_height != ((CurveWidgetGtk *)scroll_data->curve)->scroll_v_upper) {
g_object_set( ((GtkScrollbar *)scroll_data->scroll_v)->range.adjustment,
"upper", (gdouble)data->total_height,
"page-size", (gdouble)data->window_height,
"value", (gdouble)data->offset_y,
NULL);
gtk_adjustment_changed( ((GtkScrollbar *)scroll_data->scroll_v)->range.adjustment);
}
else {
g_object_set( ((GtkScrollbar *)scroll_data->scroll_v)->range.adjustment,
"value", (gdouble)data->offset_y,
NULL);
gtk_adjustment_value_changed( ((GtkScrollbar *)scroll_data->scroll_v)->range.adjustment);
}
((CurveWidgetGtk *)scroll_data->curve)->scroll_v_value = (gdouble)data->offset_y;
((CurveWidgetGtk *)scroll_data->curve)->scroll_h_pagesize = data->window_width;
((CurveWidgetGtk *)scroll_data->curve)->scroll_h_upper = data->total_width;
}
return FALSE;
#if 0
if ( scroll_data->scroll_h_managed) { if ( scroll_data->scroll_h_managed) {
((CurveWidgetGtk *)scroll_data->curve)->scroll_h_ignore = 1; ((CurveWidgetGtk *)scroll_data->curve)->scroll_h_ignore = 1;
g_object_set( ((GtkScrollbar *)scroll_data->scroll_h)->range.adjustment, g_object_set( ((GtkScrollbar *)scroll_data->scroll_h)->range.adjustment,
...@@ -136,6 +179,7 @@ static void scroll_callback( glow_sScroll *data) ...@@ -136,6 +179,7 @@ static void scroll_callback( glow_sScroll *data)
gtk_adjustment_changed( gtk_adjustment_changed(
((GtkScrollbar *)scroll_data->scroll_v)->range.adjustment); ((GtkScrollbar *)scroll_data->scroll_v)->range.adjustment);
} }
#endif
} }
static void scroll_h_action( GtkWidget *w, static void scroll_h_action( GtkWidget *w,
......
/* /*
* Proview $Id: glow_growwidget_gtk.cpp,v 1.5 2007-10-17 07:19:57 claes Exp $ * Proview $Id: glow_growwidget_gtk.cpp,v 1.6 2007-11-22 09:02:10 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -148,7 +148,7 @@ static gboolean scroll_callback_cb( void *d) ...@@ -148,7 +148,7 @@ static gboolean scroll_callback_cb( void *d)
gtk_adjustment_changed( ((GtkScrollbar *)scroll_data->scroll_h)->range.adjustment); gtk_adjustment_changed( ((GtkScrollbar *)scroll_data->scroll_h)->range.adjustment);
} }
else { else {
gtk_range_set_value( GTK_RANGE(scroll_data->scroll_v), (gdouble)data->offset_y); gtk_range_set_value( GTK_RANGE(scroll_data->scroll_h), (gdouble)data->offset_x);
} }
((GrowWidgetGtk *)scroll_data->grow)->scroll_h_value = (gdouble)data->offset_x; ((GrowWidgetGtk *)scroll_data->grow)->scroll_h_value = (gdouble)data->offset_x;
((GrowWidgetGtk *)scroll_data->grow)->scroll_h_pagesize = data->window_width; ((GrowWidgetGtk *)scroll_data->grow)->scroll_h_pagesize = data->window_width;
...@@ -292,7 +292,7 @@ static void growwidgetgtk_destroy( GtkObject *object) ...@@ -292,7 +292,7 @@ static void growwidgetgtk_destroy( GtkObject *object)
if ( grow->scroll_timerid) if ( grow->scroll_timerid)
g_source_remove( grow->scroll_timerid); g_source_remove( grow->scroll_timerid);
if ( grow->is_navigator) { if ( grow->is_navigator && grow->grow_ctx) {
((GrowCtx *)grow->grow_ctx)->no_nav = 1; ((GrowCtx *)grow->grow_ctx)->no_nav = 1;
} }
GTK_OBJECT_CLASS( growwidgetgtk_parent_class)->destroy( object); GTK_OBJECT_CLASS( growwidgetgtk_parent_class)->destroy( object);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment