On Mon, 2002-10-21 at 05:21, John Levon wrote:
> On Mon, Oct 21, 2002 at 05:16:40AM +0930, Darren Freeman wrote:
> 
> > I assume for the moment it is measured in lines. 
> 
> I don't think so. default is 100, that's a lot of lines. I do not know
> its units.
> 
> > I get this from the lines in text3.C: 
> > text3.C:                        bv->scroll(-lyxrc.wheel_jump); 
> > text3.C:                        bv->scroll(lyxrc.wheel_jump); 
> 
> Right.
> 
> > So I will hack scroll() do do the right thing in this case. I hope it
> > doesn't get called anywhere else =) I grepped for it and I don't think
> > so. 
> 
> It doesn't.
> 
> > Shit, this is the second time LyX locked up my machine, requiring a hard
> > reset.
> 
> Whuuh ?? Sounds like your X version has some bugs :)

Dunno... pretty upsetting anyways.. printing a 50 page document last
time it happened =)
 
> > Anyway, some observations. scrollDocView() handles scrolling ofthe
> > bottom of the document fine, drawing a border and grey below. But off
> > the top and it displays repetitions of the first few lines of the
> > document. Personally I would like to be able to scroll the document
> > until the last line is just visible. This is handy when you can't see
> > part of the window due to covering up the window for some reason. You
> > want to be able to move the last line all the way to the wrong edge.
> 
> You probably have to pin the value between 0 and bv_->text->height.

I chose 0 and by_->text->height - 4 * defaultHeight()

It looks OK.
 
> > I now have working mouse wheel support, but the scroll rate varies
> > depending upon the content I'm viewing. Please check the patch and tell
> > me why...
> 
> Do you mean the length of the content ?

No I mean that as I turn the wheel, the scroll rate changes as I go
past, say, lots of headings or bigger writing.

I'm simply scrolling by offset * defaultHeight()

Does defaultHeight() change as the document scrolls? Is there a better
thing to multiply by?

> > Since I'm new at this, please tell me how to generate a patch for you from CVS.
> > 
> > I've modified my anonymously checked-out version of 3 files. I'd like to create
> > one of those diff-patch thingies that everyone seems to like =)
>  
> cvs diff -u >lyx.diff

Doing... done!

I don't know why so many files are mentioned at the start of the diff,
but the files I actually changed are listed correctly.

So now how do I refresh my view of the tree after you've sorted through
it?

Just delete my directory and re-check-out?
 
> > I'm going to bed now, but rest assured that this time tomorrow you will have a
> > patch for mousewheel support..

Now I'm really going to bed =)

> Great. Thanks for spending time on this.

Well I'm helping myself out aren't I =) And whoever started the thread.

But yes, you're welcome.

Plus I've wanted to get into CVS for at least a year but never had the
time. Plus my Internet provider didn't like Linux so I couldn't talk to
the servers at Uni anyway.

> regards
> john


Have fun,
Darren
? src/temp.C
Index: po/POTFILES.in
===================================================================
RCS file: /cvs/lyx/lyx-devel/po/POTFILES.in,v
retrieving revision 1.299
diff -u -r1.299 POTFILES.in
--- po/POTFILES.in	2002/10/09 14:38:17	1.299
+++ po/POTFILES.in	2002/10/20 20:03:08
@@ -1,20 +1,16 @@
-src/BufferView.C
-src/BufferView_pimpl.C
-src/Chktex.C
-src/CutAndPaste.C
-src/LColor.C
-src/LaTeX.C
-src/LyXAction.C
-src/MenuBackend.C
 src/buffer.C
 src/bufferlist.C
+src/BufferView.C
 src/bufferview_funcs.C
+src/BufferView_pimpl.C
+src/Chktex.C
 src/converter.C
+src/CutAndPaste.C
 src/debug.C
 src/exporter.C
-src/ext_l10n.h
-src/frontends/LyXView.C
+src/frontends/controllers/biblio.C
 src/frontends/controllers/ButtonController.h
+src/frontends/controllers/character.C
 src/frontends/controllers/ControlAboutlyx.C
 src/frontends/controllers/ControlBibtex.C
 src/frontends/controllers/ControlCharacter.C
@@ -29,13 +25,13 @@
 src/frontends/controllers/ControlSpellchecker.C
 src/frontends/controllers/ControlThesaurus.C
 src/frontends/controllers/ControlVCLog.C
-src/frontends/controllers/biblio.C
-src/frontends/controllers/character.C
 src/frontends/controllers/frnt_lang.C
 src/frontends/controllers/helper_funcs.C
 src/frontends/gnome/GLog.C
+src/frontends/LyXView.C
 src/frontends/qt2/Alert_pimpl.C
 src/frontends/qt2/FileDialog.C
+src/frontends/qt2/lengthcombo.C
 src/frontends/qt2/QAbout.C
 src/frontends/qt2/QBibitem.C
 src/frontends/qt2/QBibtex.C
@@ -47,8 +43,8 @@
 src/frontends/qt2/QDelimiterDialog.C
 src/frontends/qt2/QDocument.C
 src/frontends/qt2/QDocumentDialog.C
-src/frontends/qt2/QERT.C
 src/frontends/qt2/QError.C
+src/frontends/qt2/QERT.C
 src/frontends/qt2/QExternal.C
 src/frontends/qt2/QExternalDialog.C
 src/frontends/qt2/QFloat.C
@@ -65,6 +61,7 @@
 src/frontends/qt2/QPrintDialog.C
 src/frontends/qt2/QRef.C
 src/frontends/qt2/QSearch.C
+src/frontends/qt2/QSendto.C
 src/frontends/qt2/QShowFile.C
 src/frontends/qt2/QSpellchecker.C
 src/frontends/qt2/QTabularCreate.C
@@ -74,9 +71,9 @@
 src/frontends/qt2/QURL.C
 src/frontends/qt2/QVCLog.C
 src/frontends/qt2/QWrap.C
-src/frontends/qt2/lengthcombo.C
 src/frontends/xforms/Alert_pimpl.C
 src/frontends/xforms/ColorHandler.C
+src/frontends/xforms/combox.C
 src/frontends/xforms/FeedbackController.C
 src/frontends/xforms/FileDialog.C
 src/frontends/xforms/FormAboutlyx.C
@@ -85,8 +82,8 @@
 src/frontends/xforms/FormCharacter.C
 src/frontends/xforms/FormCitation.C
 src/frontends/xforms/FormDocument.C
-src/frontends/xforms/FormERT.C
 src/frontends/xforms/FormError.C
+src/frontends/xforms/FormERT.C
 src/frontends/xforms/FormExternal.C
 src/frontends/xforms/FormFiledialog.C
 src/frontends/xforms/FormFloat.C
@@ -119,15 +116,14 @@
 src/frontends/xforms/FormUrl.C
 src/frontends/xforms/FormVCLog.C
 src/frontends/xforms/FormWrap.C
-src/frontends/xforms/Menubar_pimpl.C
-src/frontends/xforms/XMiniBuffer.C
-src/frontends/xforms/combox.C
 src/frontends/xforms/input_validators.C
+src/frontends/xforms/Menubar_pimpl.C
 src/frontends/xforms/xforms_helpers.C
+src/frontends/xforms/XMiniBuffer.C
 src/gettext.h
 src/importer.C
-src/insets/inset.C
 src/insets/insetbib.C
+src/insets/inset.C
 src/insets/insetcaption.C
 src/insets/inseterror.C
 src/insets/insetert.C
@@ -154,11 +150,14 @@
 src/insets/insetwrap.C
 src/kbsequence.C
 src/language.C
+src/LaTeX.C
+src/LColor.C
+src/LyXAction.C
 src/lyx_cb.C
-src/lyx_main.C
 src/lyxfind.C
 src/lyxfont.C
 src/lyxfunc.C
+src/lyx_main.C
 src/lyxrc.C
 src/lyxtextclasslist.C
 src/lyxvc.C
@@ -168,10 +167,11 @@
 src/mathed/math_hullinset.C
 src/mathed/math_parboxinset.C
 src/mathed/ref_inset.C
+src/MenuBackend.C
 src/paragraph.C
 src/support/filetools.C
 src/tabular.C
-src/text.C
 src/text2.C
 src/text3.C
+src/text.C
 src/ext_l10n.h
Index: src/BufferView.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/BufferView.C,v
retrieving revision 1.111
diff -u -r1.111 BufferView.C
--- src/BufferView.C	2002/09/25 12:19:12	1.111
+++ src/BufferView.C	2002/10/20 20:03:15
@@ -260,7 +260,7 @@
 
 int BufferView::scroll(long time)
 {
-	return pimpl_->scroll(time);
+	return pimpl_->scroll(time); // note that time is now called offsetLines - DF
 }
 
 
Index: src/BufferView_pimpl.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.312
diff -u -r1.312 BufferView_pimpl.C
--- src/BufferView_pimpl.C	2002/10/11 12:18:53	1.312
+++ src/BufferView_pimpl.C	2002/10/20 20:03:25
@@ -384,18 +384,64 @@
 }
 
 
-int BufferView::Pimpl::scroll(long time)
+//
+// Wheel mouse scroll, move by offsetLines multiples of text->defaultHeight().
+// Observing hard-coded boundaries to prevent scrolling off the document.
+//
+// Mostly redone by Darren Freeman, not 100% sure what I'm doing yet.
+//
+
+int BufferView::Pimpl::scroll(signed long offsetLines)
 {
-	if (!buffer_)
+	if(!buffer_)
+	{
 		return 0;
+	}
+
+
+	LyXText const *t = bv_->text;
+
+	int lineHeight = t->defaultHeight();
+
+
+	//
+	// Multiply the offset (time for now) by the height of one line.
+	//
+
+	signed int disp = offsetLines * lineHeight;
+
 
-	LyXText const * t = bv_->text;
+	//
+	// Scroll by the desired displacement, observing the document limits.
+	//
 
-	double const diff = t->defaultHeight()
-		+ double(time) * double(time) * 0.125;
+	signed int newFirstY = t->first_y + disp;
+	signed int minFirstY = 0;
+	signed int maxFirstY = t->height - 4 * lineHeight; // hard-coded for now
 
-	scrollDocView(int(diff));
+	if(newFirstY < minFirstY)
+	{
+		newFirstY = minFirstY;
+	}
+	else if(newFirstY > maxFirstY )
+	{
+		newFirstY = maxFirstY;
+	}
+
+	scrollDocView(newFirstY);
+
+
+	//
+	// Update the document scrollbar.
+	//
+
 	workarea().setScrollbarParams(t->height, t->first_y, t->defaultHeight());
+
+
+	//
+	// Done.
+	//
+
 	return 0;
 }
 
Index: src/BufferView_pimpl.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/BufferView_pimpl.h,v
retrieving revision 1.80
diff -u -r1.80 BufferView_pimpl.h
--- src/BufferView_pimpl.h	2002/09/03 11:54:41	1.80
+++ src/BufferView_pimpl.h	2002/10/20 20:03:26
@@ -60,8 +60,11 @@
 	void updateScrollbar();
 	///
 	void scrollDocView(int value);
-	/// wheel mouse scroll
-	int scroll(long time);
+	/**
+	 * Wheel mouse scroll, move by offsetLines multiples of text->defaultHeight().
+	 * Observing hard-coded boundaries to prevent scrolling off the document.
+	 */
+	int scroll(long offsetLines);
 	///
 	void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
 	///

Reply via email to