@@ -759,8 +759,6 @@ public int FirstVisibleRow
759759 _programmaticallyUpdatingScrollBarValues = false ;
760760 }
761761 }
762- _programmaticallyChangingRow = false ;
763- PointMouseToNewCell ( ) ;
764762 }
765763 }
766764
@@ -833,8 +831,6 @@ private int LastVisibleRow
833831 }
834832 while ( ( lastVisible - value < 0 || _lagFrames [ VisibleRows - halfRow ] < lastVisible - value ) && FirstVisibleRow != 0 ) ;
835833 }
836- _programmaticallyChangingRow = false ;
837- PointMouseToNewCell ( ) ;
838834 }
839835 }
840836
@@ -945,21 +941,15 @@ public void ScrollToIndex(int index)
945941 }
946942 }
947943 }
948- _programmaticallyChangingRow = false ;
949- PointMouseToNewCell ( ) ;
950944 }
951945
952- public bool _programmaticallyChangingRow = false ;
953-
954946 /// <summary>
955947 /// Scrolls so that the given index is visible, if it isn't already; doesn't use scroll settings.
956948 /// </summary>
957949 public void MakeIndexVisible ( int index )
958950 {
959951 if ( ! IsVisible ( index ) )
960952 {
961- _programmaticallyChangingRow = true ;
962-
963953 if ( FirstVisibleRow > index )
964954 {
965955 FirstVisibleRow = index ;
@@ -1017,32 +1007,16 @@ public IEnumerable<ToolStripItem> GenerateContextMenuItems()
10171007 private bool _columnDownMoved ;
10181008 private int _previousX ; // TODO: move me
10191009
1020- // It's necessary to call this anytime the control is programmatically scrolled
1021- // Since the mouse may not be pointing to the same cell anymore
1022- public void PointMouseToNewCell ( )
1010+ public bool SuppressCellChange ;
1011+
1012+ private void PointMouseToNewCell ( )
10231013 {
1014+ if ( SuppressCellChange ) return ;
1015+
10241016 if ( _currentX . HasValue && _currentY . HasValue )
10251017 {
10261018 var newCell = CalculatePointedCell ( _currentX . Value , _currentY . Value ) ;
1027- if ( CurrentCell != newCell )
1028- {
1029- if ( QueryFrameLag != null && newCell . RowIndex . HasValue )
1030- {
1031- newCell . RowIndex += CountLagFramesDisplay ( newCell . RowIndex . Value ) ;
1032- }
1033-
1034- newCell . RowIndex += FirstVisibleRow ;
1035- if ( newCell . RowIndex < 0 )
1036- {
1037- newCell . RowIndex = 0 ;
1038- }
1039-
1040- if ( _programmaticallyChangingRow )
1041- {
1042- _programmaticallyChangingRow = false ;
1043- CellChanged ( newCell ) ;
1044- }
1045- }
1019+ CellChanged ( newCell ) ;
10461020 }
10471021 }
10481022
@@ -1073,18 +1047,6 @@ protected override void OnMouseMove(MouseEventArgs e)
10731047
10741048 Cell newCell = CalculatePointedCell ( _currentX . Value , _currentY . Value ) ;
10751049
1076- // SuuperW: Hide lag frames
1077- if ( QueryFrameLag != null && newCell . RowIndex . HasValue )
1078- {
1079- newCell . RowIndex += CountLagFramesDisplay ( newCell . RowIndex . Value ) ;
1080- }
1081-
1082- newCell . RowIndex += FirstVisibleRow ;
1083- if ( newCell . RowIndex < 0 )
1084- {
1085- newCell . RowIndex = 0 ;
1086- }
1087-
10881050 if ( ! newCell . Equals ( CurrentCell ) )
10891051 {
10901052 CellChanged ( newCell ) ;
@@ -1654,6 +1616,7 @@ private void VerticalBar_ValueChanged(object sender, EventArgs e)
16541616 Refresh ( ) ;
16551617 }
16561618
1619+ PointMouseToNewCell ( ) ;
16571620 if ( _horizontalOrientation )
16581621 {
16591622 ColumnScroll ? . Invoke ( this , e ) ;
@@ -1671,6 +1634,7 @@ private void HorizontalBar_ValueChanged(object sender, EventArgs e)
16711634 Refresh ( ) ;
16721635 }
16731636
1637+ PointMouseToNewCell ( ) ;
16741638 if ( _horizontalOrientation )
16751639 {
16761640 RowScroll ? . Invoke ( this , e ) ;
@@ -1930,6 +1894,18 @@ private Cell CalculatePointedCell(int x, int y)
19301894 if ( ! ( IsPaintDown || rightButton ) && newCell . RowIndex <= - 1 ) // -2 if we're entering from the top
19311895 {
19321896 newCell . RowIndex = null ;
1897+ return newCell ;
1898+ }
1899+
1900+ if ( QueryFrameLag != null )
1901+ {
1902+ newCell . RowIndex += CountLagFramesDisplay ( newCell . RowIndex . Value ) ;
1903+ }
1904+
1905+ newCell . RowIndex += FirstVisibleRow ;
1906+ if ( newCell . RowIndex < 0 )
1907+ {
1908+ newCell . RowIndex = 0 ;
19331909 }
19341910
19351911 return newCell ;
0 commit comments