When
using SD 3.0 Beta 1 on Vista 32 with Microsoft Wireless Laser Mouse 5000/6000 models
(versions with smooth, clickless scrollwheels) I found I had to spin
the wheel extremely fast to get the editor to scroll at all. This
irritated me, because I love these mice, and anything that distracts me from programming is bad.
A quick look at TextAreaControl.cs turned up a variable called MAX_DELTA in HandleMouseWheel()
which is assigned a value of 120, and a 'Delta' property of
MouseEventArgs which together are used to calculate the distance to
scroll on the event. A comment on the variable states: "basically it's
constant now, but could be changed later by MS." Well, it's later.
Turns out that not all mice report the same Delta values, at
least in Vista; I'm guessing XP always reports (at least) 120 because
the same mouse scrolls SD normally on an XP machine.
In Vista my mouse reports the Delta in increments of 30 (+/-);
and System.Windows.Forms.SystemInformation.MouseWheelScrollLines = 4.
Bearing
in mind that I know next to nothing about mouse scrolling, I made the
following changes which work nicely on all my Vista and XP systems/mice.
From:
int multiplier = Math.Abs(e.Delta) / MAX_DELTA;
/* ... */
newValue
= this.vScrollBar.Value - (TextEditorProperties.MouseWheelScrollDown ?
1 : -1) * Math.Sign(e.Delta) *
System.Windows.Forms.SystemInformation.MouseWheelScrollLines *
vScrollBar.SmallChange * multiplier;
To:
int multiplier =
Convert.ToInt32(Math.Ceiling(System.Windows.Forms.SystemInformation.MouseWheelScrollLines
* ((float)Math.Abs(e.Delta) / MAX_DELTA)));
/* ... */
newValue = this.vScrollBar.Value -
(TextEditorProperties.MouseWheelScrollDown ? 1 : -1) *
Math.Sign(e.Delta) * vScrollBar.SmallChange * multiplier;
Now multiplier equals between 1 and 6, depending on how fast I spin the wheel. Using a different (Logitech) mouse on my Vista machine, multiplier always equals 4. On XP (with every mouse I own) multiplier = 3. So in addition to working properly on Vista with these mice, I believe the results in XP are consistent with the original algorithm. It should also work acceptably with nonstandard devices like the tablet mentioned here: http://www.mail-archive.com/allbugs@openoffice.org/msg347990.html -- You can see here: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=265810 that MS knows about the issue, but (shockingly) it's not high on their list of priorities.
No doubt a similar change will be needed in CodeCompletionWindow.cs, but I haven't tested it. The issue might also apply to SD 2, but I don't use it and I haven't looked.
May we find the wisdom to discover the right coffee, the will to choose it and the income to make it endure