ooo-build r12101 - in trunk: . patches/src680



Author: kyoshida
Date: Thu Apr  3 23:49:33 2008
New Revision: 12101
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12101&view=rev

Log:
2008-04-03  Kohei Yoshida  <kyoshida novell com>

	* patches/src680/scroll-accel-sc.diff:
	* patches/src680/scroll-accel-vcl.diff: Adjust scroll speed when 
	extending cell range selection beyond visible sheet area.  For now, 
	only Calc will adjust scroll speed, but it could be done in the other
	applications too if needed (n#375909, i#71362).

	* patches/src680/apply: apply the above patches.


Added:
   trunk/patches/src680/scroll-accel-sc.diff
   trunk/patches/src680/scroll-accel-vcl.diff
Modified:
   trunk/ChangeLog
   trunk/patches/src680/apply

Modified: trunk/patches/src680/apply
==============================================================================
--- trunk/patches/src680/apply	(original)
+++ trunk/patches/src680/apply	Thu Apr  3 23:49:33 2008
@@ -788,6 +788,9 @@
 # always enable file save even when the document is not modified.
 sfx2-always-allow-save-document.diff, n#347423, i#5226, kohei
 
+# Adjust scroll speed while extending selection beyoud visible sheet area.
+scroll-accel-sc.diff, n#375909, i#71362, kohei
+scroll-accel-vcl.diff, n#375909, i#71362, kohei
 
 [ EasterEgg ]
 # go-oo.org people active in this release

Added: trunk/patches/src680/scroll-accel-sc.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/scroll-accel-sc.diff	Thu Apr  3 23:49:33 2008
@@ -0,0 +1,133 @@
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/inc/select.hxx sc/source/ui/inc/select.hxx
+--- sc.clean/source/ui/inc/select.hxx	2008-04-01 12:26:31.000000000 -0400
++++ sc/source/ui/inc/select.hxx	2008-04-03 18:13:14.000000000 -0400
+@@ -73,6 +73,9 @@ private:
+ 
+ 	ScSplitPos		GetWhich();
+ 
++    ULONG           CalcUpdateInterval( const Size& rWinSize, const Point& rEffPos, 
++                                        bool bLeftScroll, bool bTopScroll, bool bRightScroll, bool bBottomScroll );
++
+ public:
+ 					ScViewFunctionSet( ScViewData* pNewViewData );
+ 
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=sc.vpj sc.clean/source/ui/view/select.cxx sc/source/ui/view/select.cxx
+--- sc.clean/source/ui/view/select.cxx	2008-04-01 12:26:33.000000000 -0400
++++ sc/source/ui/view/select.cxx	2008-04-03 18:13:03.000000000 -0400
+@@ -42,6 +42,7 @@
+ 
+ #include <tools/urlobj.hxx>
+ #include <vcl/sound.hxx>
++#include <vcl/svapp.hxx>
+ #include <sfx2/docfile.hxx>
+ 
+ #include "select.hxx"
+@@ -85,6 +86,72 @@ ScSplitPos ScViewFunctionSet::GetWhich()
+ 		return pViewData->GetActivePart();
+ }
+ 
++ULONG ScViewFunctionSet::CalcUpdateInterval( const Size& rWinSize, const Point& rEffPos, 
++                                             bool bLeftScroll, bool bTopScroll, bool bRightScroll, bool bBottomScroll )
++{
++    ULONG nUpdateInterval = SELENG_AUTOREPEAT_INTERVAL_MAX;
++    Window* pWin = pEngine->GetWindow();
++    Rectangle aScrRect = pWin->GetDesktopRectPixel();
++    Point aRootPos = pWin->OutputToAbsoluteScreenPixel(Point(0,0));
++    if (bRightScroll)
++    {
++        double nWinRight = rWinSize.getWidth() + aRootPos.getX();
++        double nMarginRight = aScrRect.GetWidth() - nWinRight;
++        double nHOffset = rEffPos.X() - rWinSize.Width();
++        double nHAccelRate = nHOffset / nMarginRight;
++
++        if (nHAccelRate > 1.0)
++            nHAccelRate = 1.0;
++
++        nUpdateInterval = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nHAccelRate));
++    }
++
++    if (bLeftScroll)
++    {
++        double nMarginLeft = aRootPos.getX();
++        double nHOffset = -rEffPos.X();
++        double nHAccelRate = nHOffset / nMarginLeft;
++
++        if (nHAccelRate > 1.0)
++            nHAccelRate = 1.0;
++
++        ULONG nTmp = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nHAccelRate));
++        if (nUpdateInterval > nTmp)
++            nUpdateInterval = nTmp;
++    }
++
++    if (bBottomScroll)
++    {
++        double nWinBottom = rWinSize.getHeight() + aRootPos.getY();
++        double nMarginBottom = aScrRect.GetHeight() - nWinBottom;
++        double nVOffset = rEffPos.Y() - rWinSize.Height();
++        double nVAccelRate = nVOffset / nMarginBottom;
++
++        if (nVAccelRate > 1.0)
++            nVAccelRate = 1.0;
++
++        ULONG nTmp = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nVAccelRate));
++        if (nUpdateInterval > nTmp)
++            nUpdateInterval = nTmp;
++    }
++
++    if (bTopScroll)
++    {
++        double nMarginTop = aRootPos.getY();
++        double nVOffset = -rEffPos.Y();
++        double nVAccelRate = nVOffset / nMarginTop;
++
++        if (nVAccelRate > 1.0)
++            nVAccelRate = 1.0;
++
++        ULONG nTmp = static_cast<ULONG>(SELENG_AUTOREPEAT_INTERVAL_MAX*(1.0 - nVAccelRate));
++        if (nUpdateInterval > nTmp)
++            nUpdateInterval = nTmp;
++    }
++
++    return nUpdateInterval;
++}
++
+ void ScViewFunctionSet::SetSelectionEngine( ScViewSelectionEngine* pSelEngine )
+ {
+ 	pEngine = pSelEngine;
+@@ -263,10 +330,11 @@ BOOL __EXPORT ScViewFunctionSet::SetCurs
+ 	//	Scrolling
+ 
+ 	Size aWinSize = pEngine->GetWindow()->GetOutputSizePixel();
+-	BOOL bRightScroll  = ( aEffPos.X() >= aWinSize.Width() );
+-	BOOL bBottomScroll = ( aEffPos.Y() >= aWinSize.Height() );
+-	BOOL bNegScroll    = ( aEffPos.X() < 0 || aEffPos.Y() < 0 );
+-	BOOL bScroll = bRightScroll || bBottomScroll || bNegScroll;
++	bool bRightScroll  = ( aEffPos.X() >= aWinSize.Width() );
++	bool bLeftScroll  = ( aEffPos.X() < 0 );
++	bool bBottomScroll = ( aEffPos.Y() >= aWinSize.Height() );
++	bool bTopScroll = ( aEffPos.Y() < 0 );
++	bool bScroll = bRightScroll || bBottomScroll || bLeftScroll || bTopScroll;
+ 
+ 	SCsCOL	nPosX;
+ 	SCsROW	nPosY;
+@@ -319,6 +387,19 @@ BOOL __EXPORT ScViewFunctionSet::SetCurs
+ 			}
+ 	}
+ 
++    if (bScroll)
++    {
++        // Adjust update interval based on how far the mouse pointer is from the edge.
++        ULONG nUpdateInterval = CalcUpdateInterval(
++            aWinSize, aEffPos, bLeftScroll, bTopScroll, bRightScroll, bBottomScroll);
++        pEngine->SetUpdateInterval(nUpdateInterval);
++    }
++    else
++    {
++        // Don't forget to reset the interval when not scrolling!
++        pEngine->SetUpdateInterval(SELENG_AUTOREPEAT_INTERVAL);
++    }
++
+ 	pViewData->ResetOldCursor();
+ 	return SetCursorAtCell( nPosX, nPosY, bScroll );
+ }

Added: trunk/patches/src680/scroll-accel-vcl.diff
==============================================================================
--- (empty file)
+++ trunk/patches/src680/scroll-accel-vcl.diff	Thu Apr  3 23:49:33 2008
@@ -0,0 +1,102 @@
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=vcl.vpj vcl.clean/inc/vcl/seleng.hxx vcl/inc/vcl/seleng.hxx
+--- vcl.clean/inc/vcl/seleng.hxx	2008-04-01 19:28:32.000000000 -0400
++++ vcl/inc/vcl/seleng.hxx	2008-04-03 17:57:26.000000000 -0400
+@@ -54,6 +54,7 @@ class CommandEvent;
+ // Timerticks
+ #define SELENG_DRAGDROP_TIMEOUT     400
+ #define SELENG_AUTOREPEAT_INTERVAL  50
++#define SELENG_AUTOREPEAT_INTERVAL_MAX 300
+ 
+ enum SelectionMode { NO_SELECTION, SINGLE_SELECTION, RANGE_SELECTION, MULTIPLE_SELECTION };
+ 
+@@ -103,6 +104,7 @@ private:
+     Timer               aWTimer; // erzeugt kuenstliche Mouse-Moves
+     MouseEvent          aLastMove;
+     SelectionMode       eSelMode;
++    ULONG               nUpdateInterval;
+     // Stufigkeit fuer Mausbewegungen waehrend einer Selektion
+     USHORT              nMouseSensitivity;
+     USHORT              nLockedMods;
+@@ -116,7 +118,8 @@ private:
+ public:
+ 
+                         SelectionEngine( Window* pWindow,
+-                                         FunctionSet* pFunctions = NULL );
++                                         FunctionSet* pFunctions = NULL,
++                                         ULONG nAutoRepeatInterval = SELENG_AUTOREPEAT_INTERVAL );
+                         ~SelectionEngine();
+ 
+     // TRUE: Event wurde von Selection-Engine verarbeitet.
+@@ -175,6 +178,8 @@ public:
+     BOOL                HasAnchor() const;
+     void                SetAnchor( BOOL bAnchor );
+ 
++    void                SetUpdateInterval( ULONG nInterval );
++
+ 	// wird im Ctor eingeschaltet
+ 	void				ExpandSelectionOnMouseMove( BOOL bExpand = TRUE )
+ 						{
+diff -urp --exclude=CVS --exclude=unxlngi6.pro --exclude=vcl.vpj vcl.clean/source/window/seleng.cxx vcl/source/window/seleng.cxx
+--- vcl.clean/source/window/seleng.cxx	2008-04-01 19:28:36.000000000 -0400
++++ vcl/source/window/seleng.cxx	2008-04-03 18:24:56.000000000 -0400
+@@ -41,7 +41,7 @@
+ #include <vcl/seleng.hxx>
+ #include <tools/debug.hxx>
+ 
+-
++#include <stdio.h>
+ 
+ 
+ inline BOOL SelectionEngine::ShouldDeselect( BOOL bModifierKey1 ) const
+@@ -63,8 +63,10 @@ inline BOOL SelectionEngine::ShouldDesel
+ |*
+ *************************************************************************/
+ 
+-SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet ) :
+-                    pWin( pWindow )
++SelectionEngine::SelectionEngine( Window* pWindow, FunctionSet* pFuncSet, 
++                                  ULONG nAutoRepeatInterval ) :
++    pWin( pWindow ),
++    nUpdateInterval( nAutoRepeatInterval )
+ {
+     eSelMode = SINGLE_SELECTION;
+     pFunctionSet = pFuncSet;
+@@ -72,7 +74,7 @@ SelectionEngine::SelectionEngine( Window
+     nLockedMods = 0;
+ 
+     aWTimer.SetTimeoutHdl( LINK( this, SelectionEngine, ImpWatchDog ) );
+-    aWTimer.SetTimeout( SELENG_AUTOREPEAT_INTERVAL );
++    aWTimer.SetTimeout( nUpdateInterval );
+ }
+ 
+ /*************************************************************************
+@@ -397,7 +399,7 @@ BOOL SelectionEngine::SelMouseMove( cons
+     if( aWTimer.IsActive() && !aArea.IsInside( rMEvt.GetPosPixel() ))
+         return TRUE;
+ 
+-
++    aWTimer.SetTimeout( nUpdateInterval );
+     aWTimer.Start();
+     if ( eSelMode != SINGLE_SELECTION )
+     {
+@@ -493,3 +495,20 @@ void SelectionEngine::Command( const Com
+             nFlags &= ~SELENG_CMDEVT;
+     }
+ }
++
++void SelectionEngine::SetUpdateInterval( ULONG nInterval )
++{
++    if (nUpdateInterval == nInterval)
++        // no update needed.
++        return;
++
++    nUpdateInterval = nInterval;
++
++    if (aWTimer.IsActive())
++    {
++        // reset the timer right away on interval change.
++        aWTimer.Stop();
++        aWTimer.SetTimeout(nUpdateInterval);
++        aWTimer.Start();
++    }
++}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]