[Libreoffice-commits] .: sc/source sd/source svx/inc svx/source sw/source

Jan Holesovsky kendy at kemper.freedesktop.org
Fri Jan 13 14:04:33 PST 2012


 sc/source/ui/view/prevwsh.cxx          |    7 +++----
 sc/source/ui/view/tabview.cxx          |    9 ++++-----
 sd/source/ui/view/viewshel.cxx         |    8 ++++----
 svx/inc/svx/zoom_def.hxx               |    3 +++
 svx/source/stbctrls/zoomsliderctrl.cxx |    6 ++++--
 sw/source/ui/uiview/viewport.cxx       |    6 ++++--
 6 files changed, 22 insertions(+), 17 deletions(-)

New commits:
commit 022ce7d362f146ed69f54aae20cf2b8c582e9f8d
Author: Tim Hardeck <thardeck at suse.com>
Date:   Fri Jan 13 18:22:46 2012 +0100

    fdo#44173: use a geometric progression for zooming
    
    Zooming does now base on a geometric progression instead of an
    arithmetic one.
    Since the zoom factor is not only used in Draw but for all other
    applications 1.2 seems like a good choice.

diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx
index d76622a..b25a464 100644
--- a/sc/source/ui/view/prevwsh.cxx
+++ b/sc/source/ui/view/prevwsh.cxx
@@ -79,8 +79,7 @@
 
 #include "sc.hrc"
 #include "scabstdlg.hxx"
-//  fuer Rad-Maus
-#define SC_DELTA_ZOOM   10
+//  for mouse wheel
 #define MINZOOM_SLIDER 10
 #define MAXZOOM_SLIDER 400
 
@@ -449,9 +448,9 @@ sal_Bool ScPreviewShell::ScrollCommand( const CommandEvent& rCEvt )
         long nOld = pPreview->GetZoom();
         long nNew = nOld;
         if ( pData->GetDelta() < 0 )
-            nNew = Max( (long) MINZOOM, (long)( nOld - SC_DELTA_ZOOM ) );
+            nNew = Max( (long) MINZOOM, (long)round( nOld / ZOOM_FACTOR ));
         else
-            nNew = Min( (long) MAXZOOM, (long)( nOld + SC_DELTA_ZOOM ) );
+            nNew = Min( (long) MAXZOOM, (long)round( nOld * ZOOM_FACTOR ));
 
         if ( nNew != nOld )
         {
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index a5fdf31..738aeec 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -149,15 +149,14 @@
 #include <string>
 #include <algorithm>
 
+#include <svx/zoom_def.hxx>
+
 #define SPLIT_MARGIN    30
 #define SC_ICONSIZE     36
 
 #define SC_SCROLLBAR_MIN    30
 #define SC_TABBAR_MIN       6
 
-//  fuer Rad-Maus
-#define SC_DELTA_ZOOM   10
-
 using namespace ::com::sun::star;
 
 // STATIC DATA -----------------------------------------------------------
@@ -1060,9 +1059,9 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
             long nOld = (long)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
             long nNew = nOld;
             if ( pData->GetDelta() < 0 )
-                nNew = Max( (long) MINZOOM, (long)( nOld - SC_DELTA_ZOOM ) );
+                nNew = Max( (long) MINZOOM, (long)round( nOld / ZOOM_FACTOR ));
             else
-                nNew = Min( (long) MAXZOOM, (long)( nOld + SC_DELTA_ZOOM ) );
+                nNew = Min( (long) MAXZOOM, (long)round( nOld * ZOOM_FACTOR ));
 
             if ( nNew != nOld )
             {
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 68ebe72..6c79ec2 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -82,6 +82,8 @@
 #include <sfx2/request.hxx>
 #include "SpellDialogChildWindow.hxx"
 
+#include <svx/zoom_def.hxx>
+
 #include "Window.hxx"
 #include "fupoor.hxx"
 
@@ -125,8 +127,6 @@ private:
 
 namespace sd {
 
-static const int DELTA_ZOOM = 10;
-
 sal_Bool ViewShell::IsPageFlipMode(void) const
 {
     return this->ISA(DrawViewShell) && mpContentWindow.get() != NULL &&
@@ -718,9 +718,9 @@ bool ViewShell::HandleScrollCommand(const CommandEvent& rCEvt, ::sd::Window* pWi
                         long        nNewZoom;
 
                         if( pData->GetDelta() < 0L )
-                            nNewZoom = Max( (long) pWin->GetMinZoom(), (long)(nOldZoom - DELTA_ZOOM) );
+                            nNewZoom = Max( (long) pWin->GetMinZoom(), (long)round( nOldZoom / ZOOM_FACTOR ));
                         else
-                            nNewZoom = Min( (long) pWin->GetMaxZoom(), (long)(nOldZoom + DELTA_ZOOM) );
+                            nNewZoom = Min( (long) pWin->GetMaxZoom(), (long)round( nOldZoom * ZOOM_FACTOR ));
 
                         SetZoom( nNewZoom );
                         Invalidate( SID_ATTR_ZOOM );
diff --git a/svx/inc/svx/zoom_def.hxx b/svx/inc/svx/zoom_def.hxx
index 0a24476..e194493 100644
--- a/svx/inc/svx/zoom_def.hxx
+++ b/svx/inc/svx/zoom_def.hxx
@@ -8,4 +8,7 @@
 
 #endif
 
+// zoom factor for Calc, Writer, Draw and Impress
+#define ZOOM_FACTOR    1.2
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx
index aa8ae8a..b270480 100644
--- a/svx/source/stbctrls/zoomsliderctrl.cxx
+++ b/svx/source/stbctrls/zoomsliderctrl.cxx
@@ -36,6 +36,8 @@
 #include <svx/dialmgr.hxx>
 #include <svx/dialogs.hrc>
 
+#include <svx/zoom_def.hxx>
+
 #include <set>
 
 // -----------------------------------------------------------------------
@@ -357,11 +359,11 @@ sal_Bool SvxZoomSliderControl::MouseButtonDown( const MouseEvent & rEvt )
 
     // click to - button
     if ( nXDiff >= nButtonLeftOffset && nXDiff <= nButtonRightOffset )
-        mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom - 5;
+        mpImpl->mnCurrentZoom = round( mpImpl->mnCurrentZoom / ZOOM_FACTOR );
     // click to + button
     else if ( nXDiff >= aControlRect.GetWidth() - nSliderXOffset + nButtonLeftOffset &&
               nXDiff <= aControlRect.GetWidth() - nSliderXOffset + nButtonRightOffset )
-        mpImpl->mnCurrentZoom = mpImpl->mnCurrentZoom + 5;
+        mpImpl->mnCurrentZoom = round( mpImpl->mnCurrentZoom * ZOOM_FACTOR );
     // click to slider
     else if( nXDiff >= nSliderXOffset && nXDiff <= aControlRect.GetWidth() - nSliderXOffset )
         mpImpl->mnCurrentZoom = Offset2Zoom( nXDiff );
diff --git a/sw/source/ui/uiview/viewport.cxx b/sw/source/ui/uiview/viewport.cxx
index e4fc725..6bbb5d6 100644
--- a/sw/source/ui/uiview/viewport.cxx
+++ b/sw/source/ui/uiview/viewport.cxx
@@ -52,6 +52,8 @@
 
 #include <IDocumentSettingAccess.hxx>
 
+#include <svx/zoom_def.hxx>
+
 //Das SetVisArea der DocShell darf nicht vom InnerResizePixel gerufen werden.
 //Unsere Einstellungen muessen aber stattfinden.
 #ifndef WB_RIGHT_ALIGNED
@@ -1309,9 +1311,9 @@ sal_Bool SwView::HandleWheelCommands( const CommandEvent& rCEvt )
     {
         sal_uInt16 nFact = pWrtShell->GetViewOptions()->GetZoom();
         if( 0L > pWData->GetDelta() )
-            nFact = static_cast< sal_uInt16 >(Max( 20, nFact - 10 ));
+            nFact = static_cast< sal_uInt16 >(Max( 20, (int)round( nFact / ZOOM_FACTOR )));
         else
-            nFact = static_cast< sal_uInt16 >(Min( 600, nFact + 10 ));
+            nFact = static_cast< sal_uInt16 >(Min( 600, (int)round( nFact * ZOOM_FACTOR )));
 
         SetZoom( SVX_ZOOM_PERCENT, nFact );
         bOk = sal_True;


More information about the Libreoffice-commits mailing list