please apply

regards
john

-- 
"Way back at the beginning of time around 1970 the first man page was
 handed down from on high. Every one since is an edited copy."
        - John Hasler <[EMAIL PROTECTED]>
Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.644
diff -u -r1.644 ChangeLog
--- src/ChangeLog       22 Mar 2002 15:13:35 -0000      1.644
+++ src/ChangeLog       25 Mar 2002 14:57:15 -0000
@@ -1,3 +1,8 @@
+2002-03-25  John Levon  <[EMAIL PROTECTED]>
+
+       * BufferView_pimpl.C (updateScrollbar): update on buffer switch
+         properly
+ 
 2002-03-22  Angus Leeming  <[EMAIL PROTECTED]>
 
        * PrinterParams.h: #include "lyxrc.h" and remove that bloody irritating
Index: src/BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.218
diff -u -r1.218 BufferView_pimpl.C
--- src/BufferView_pimpl.C      21 Mar 2002 17:25:06 -0000      1.218
+++ src/BufferView_pimpl.C      25 Mar 2002 14:57:20 -0000
@@ -397,10 +402,8 @@
 
 void BufferView::Pimpl::updateScrollbar()
 {
-       /* If the text is smaller than the working area, the scrollbar
-        * maximum must be the working area height. No scrolling will
-        * be possible */
        if (!bv_->text) {
+               lyxerr[Debug::GUI] << "no text in updateScrollbar" << endl;
                workarea_.setScrollbar(0, 1.0);
                return;
        }
@@ -408,42 +411,36 @@
        long const text_height = bv_->text->height;
        long const work_height = workarea_.height();
 
+       double const lineh = bv_->text->defaultHeight();
+       double const slider_size =
+               (text_height == 0) ? 1.0 : 1.0 / double(text_height);
+
+       lyxerr[Debug::GUI] << "text_height now " << text_height << endl;
+       lyxerr[Debug::GUI] << "work_height " << work_height << endl;
+ 
+       /* If the text is smaller than the working area, the scrollbar
+        * maximum must be the working area height. No scrolling will
+        * be possible */
        if (text_height <= work_height) {
+               lyxerr[Debug::GUI] << "doc smaller than workarea !" << endl;
                workarea_.setScrollbarBounds(0.0, 0.0);
                current_scrollbar_value = bv_->text->first_y;
                workarea_.setScrollbar(current_scrollbar_value, 1.0);
                return;
        }
 
-       double const lineh = bv_->text->defaultHeight();
-       double const slider_size =
-               (text_height == 0) ? 1.0 : 1.0 / double(text_height);
-
-       static long old_text_height;
-       static double old_lineh;
-       static double old_slider_size;
-
-       if (text_height != old_text_height) {
-               workarea_.setScrollbarBounds(0.0,
-                                            text_height - work_height);
-               old_text_height = text_height;
-       }
-       if (lineh != old_lineh) {
-               workarea_.setScrollbarIncrements(lineh);
-               old_lineh = lineh;
-       }
-       if (current_scrollbar_value != bv_->text->first_y
-           || slider_size != old_slider_size) {
-               current_scrollbar_value = bv_->text->first_y;
-               workarea_.setScrollbar(current_scrollbar_value, slider_size);
-               old_slider_size = slider_size;
-       }
+       workarea_.setScrollbarBounds(0.0, text_height - work_height);
+       workarea_.setScrollbarIncrements(lineh);
+       current_scrollbar_value = bv_->text->first_y;
+       workarea_.setScrollbar(current_scrollbar_value, slider_size);
 }
 
 
 // Callback for scrollbar slider
 void BufferView::Pimpl::scrollCB(double value)
 {
+       lyxerr[Debug::GUI] << "scrollCB of " << value << endl;
+ 
        if (!buffer_) return;
 
        current_scrollbar_value = long(value);

Reply via email to