Hi all,
After tracing through the calls of the display object of Dia, finally I
find out what exactly is making troubles with the scrolling of the
diagram window.
Currently (lastest CVS) scrolling can *only* be done by using the scroll
bar and the scroll tool on the tools panel. In addition, if you try to
use the scroll tool, you will never reach the end of each side (top,
left, right, bottom). The use of arrow keys to scroll the display is
also broken.
The problems is in ddisplay_update_scrollbars() in display.c, an extra
area (namely 'extra_border_x' and 'extra_border_y' is added to the
entire scrollable (by scroll bar) area (all 4 side). However with key
scrolling it won't work because it never take those extra area into
account. Since this extra area break a lot of scrolling function of
Dia, I would to suggest to take it off for now until we can better
define the scrollable area, drawing area, and viewing area (since this
could affect a lot of code on display.c and some other files; and may
also affect objects in Dia).
Below is two patches to fix the scrolling problem, one is remove the
extra area, the other one is to add support for mouse wheel to scroll up
and down.
Patrick
==
*mouse wheel fix
Index: dia/app/disp_callbacks.c
===================================================================
RCS file: /cvs/gnome/dia/app/disp_callbacks.c,v
retrieving revision 1.34
diff -u -r1.34 disp_callbacks.c
--- dia/app/disp_callbacks.c 2001/05/16 13:35:24 1.34
+++ dia/app/disp_callbacks.c 2001/05/20 06:41:50
@@ -482,7 +482,15 @@
else {
popup_object_menu(ddisp, bevent);
break;
- }
+ }
+ case 4: /* for wheel mouse; button 4 and 5 */
+ ddisplay_scroll_up(ddisp);
+ ddisplay_flush(ddisp);
+ break;
+ case 5:
+ ddisplay_scroll_down(ddisp);
+ ddisplay_flush(ddisp);
+ break;
default:
break;
}
*extra area fix
Index: dia/app/display.c
===================================================================
RCS file: /cvs/gnome/dia/app/display.c,v
retrieving revision 1.49
diff -u -r1.49 display.c
--- dia/app/display.c 2001/05/16 13:35:24 1.49
+++ dia/app/display.c 2001/05/20 06:41:50
@@ -552,15 +552,11 @@
Rectangle *extents = &ddisp->diagram->data->extents;
Rectangle *visible = &ddisp->visible;
GtkAdjustment *hsbdata, *vsbdata;
- real extra_border_x, extra_border_y;
-
- extra_border_x = (visible->right - visible->left);
- extra_border_y = (visible->bottom - visible->top);
hsbdata = ddisp->hsbdata;
/* Horizontal: */
- hsbdata->lower = MIN(extents->left, visible->left) - extra_border_x;
- hsbdata->upper = MAX(extents->right, visible->right) + extra_border_x;
+ hsbdata->lower = MIN(extents->left, visible->left);
+ hsbdata->upper = MAX(extents->right, visible->right);
hsbdata->page_size = visible->right - visible->left - 0.0001;
/* remove some to fix strange behaviour in gtk_range_adjustment_changed */
hsbdata->page_increment = (visible->right - visible->left) / 2.0;
@@ -571,8 +567,8 @@
/* Vertical: */
vsbdata = ddisp->vsbdata;
- vsbdata->lower = MIN(extents->top, visible->top) - extra_border_y;
- vsbdata->upper = MAX(extents->bottom, visible->bottom) + extra_border_y;
+ vsbdata->lower = MIN(extents->top, visible->top);
+ vsbdata->upper = MAX(extents->bottom, visible->bottom);
vsbdata->page_size = visible->bottom - visible->top - 0.00001;
/* remove some to fix strange behaviour in gtk_range_adjustment_changed */
vsbdata->page_increment = (visible->bottom - visible->top) / 2.0;