1 diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/inc/select.hxx sc/source/ui/inc/select.hxx
2 --- sc.clean/source/ui/inc/select.hxx 2008-04-01 12:26:31.000000000 -0400
3 +++ sc/source/ui/inc/select.hxx 2008-04-03 18:13:14.000000000 -0400
4 @@ -73,6 +73,9 @@ private:
8 + ULONG CalcUpdateInterval( const Size& rWinSize, const Point& rEffPos,
9 + bool bLeftScroll, bool bTopScroll, bool bRightScroll, bool bBottomScroll );
12 ScViewFunctionSet( ScViewData* pNewViewData );
14 diff --git sc/source/ui/view/select.cxx sc/source/ui/view/select.cxx
15 index 26305d8..d337f50 100644
16 --- sc/source/ui/view/select.cxx
17 +++ sc/source/ui/view/select.cxx
20 #include <tools/urlobj.hxx>
21 #include <vcl/sound.hxx>
22 +#include <vcl/svapp.hxx>
23 #include <sfx2/docfile.hxx>
28 #include "tabprotection.hxx"
30 +#define SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN 65
32 extern USHORT nScFillModeMouseModifier; // global.cxx
34 using namespace com::sun::star;
35 @@ -81,6 +84,83 @@ ScSplitPos ScViewFunctionSet::GetWhich()
36 return pViewData->GetActivePart();
39 +ULONG ScViewFunctionSet::CalcUpdateInterval( const Size& rWinSize, const Point& rEffPos,
40 + bool bLeftScroll, bool bTopScroll, bool bRightScroll, bool bBottomScroll )
42 + ULONG nUpdateInterval = SELENG_AUTOREPEAT_INTERVAL_MAX;
43 + Window* pWin = pEngine->GetWindow();
44 + Rectangle aScrRect = pWin->GetDesktopRectPixel();
45 + Point aRootPos = pWin->OutputToAbsoluteScreenPixel(Point(0,0));
48 + double nWinRight = rWinSize.getWidth() + aRootPos.getX();
49 + double nMarginRight = aScrRect.GetWidth() - nWinRight;
50 + double nHOffset = rEffPos.X() - rWinSize.Width();
51 + double nHAccelRate = nHOffset / nMarginRight;
53 + if (nHAccelRate > 1.0)
56 + nUpdateInterval = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nHAccelRate));
61 + double nMarginLeft = aRootPos.getX();
62 + double nHOffset = -rEffPos.X();
63 + double nHAccelRate = nHOffset / nMarginLeft;
65 + if (nHAccelRate > 1.0)
68 + ULONG nTmp = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nHAccelRate));
69 + if (nUpdateInterval > nTmp)
70 + nUpdateInterval = nTmp;
75 + double nWinBottom = rWinSize.getHeight() + aRootPos.getY();
76 + double nMarginBottom = aScrRect.GetHeight() - nWinBottom;
77 + double nVOffset = rEffPos.Y() - rWinSize.Height();
78 + double nVAccelRate = nVOffset / nMarginBottom;
80 + if (nVAccelRate > 1.0)
83 + ULONG nTmp = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nVAccelRate));
84 + if (nUpdateInterval > nTmp)
85 + nUpdateInterval = nTmp;
90 + double nMarginTop = aRootPos.getY();
91 + double nVOffset = -rEffPos.Y();
92 + double nVAccelRate = nVOffset / nMarginTop;
94 + if (nVAccelRate > 1.0)
97 + ULONG nTmp = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nVAccelRate));
98 + if (nUpdateInterval > nTmp)
99 + nUpdateInterval = nTmp;
103 + ScTabViewShell* pViewShell = pViewData->GetViewShell();
104 + bool bRefMode = pViewShell && pViewShell->IsRefInputMode();
105 + if (bRefMode && nUpdateInterval < SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN)
106 + // Lower the update interval during ref mode, because re-draw can be
107 + // expensive on Windows. Making this interval too small would queue up
108 + // the scroll/paint requests which would cause semi-infinite
109 + // scrolls even after the mouse cursor is released. We don't have
110 + // this problem on Linux.
111 + nUpdateInterval = SC_SELENG_REFMODE_UPDATE_INTERVAL_MIN;
113 + return nUpdateInterval;
116 void ScViewFunctionSet::SetSelectionEngine( ScViewSelectionEngine* pSelEngine )
118 pEngine = pSelEngine;
119 @@ -263,10 +330,11 @@ BOOL __EXPORT ScViewFunctionSet::SetCurs
122 Size aWinSize = pEngine->GetWindow()->GetOutputSizePixel();
123 - BOOL bRightScroll = ( aEffPos.X() >= aWinSize.Width() );
124 - BOOL bBottomScroll = ( aEffPos.Y() >= aWinSize.Height() );
125 - BOOL bNegScroll = ( aEffPos.X() < 0 || aEffPos.Y() < 0 );
126 - BOOL bScroll = bRightScroll || bBottomScroll || bNegScroll;
127 + bool bRightScroll = ( aEffPos.X() >= aWinSize.Width() );
128 + bool bLeftScroll = ( aEffPos.X() < 0 );
129 + bool bBottomScroll = ( aEffPos.Y() >= aWinSize.Height() );
130 + bool bTopScroll = ( aEffPos.Y() < 0 );
131 + bool bScroll = bRightScroll || bBottomScroll || bLeftScroll || bTopScroll;
135 @@ -319,6 +387,19 @@ BOOL __EXPORT ScViewFunctionSet::SetCurs
141 + // Adjust update interval based on how far the mouse pointer is from the edge.
142 + ULONG nUpdateInterval = CalcUpdateInterval(
143 + aWinSize, aEffPos, bLeftScroll, bTopScroll, bRightScroll, bBottomScroll);
144 + pEngine->SetUpdateInterval(nUpdateInterval);
148 + // Don't forget to reset the interval when not scrolling!
149 + pEngine->SetUpdateInterval(SELENG_AUTOREPEAT_INTERVAL);
152 pViewData->ResetOldCursor();
153 return SetCursorAtCell( nPosX, nPosY, bScroll );