[Libreoffice-commits] core.git: include/touch include/vcl sc/source sw/source vcl/inc vcl/source

Caolán McNamara caolanm at redhat.com
Tue May 16 20:18:29 UTC 2017


 include/touch/touch.h                |   19 ---------------
 include/vcl/commandevent.hxx         |    3 --
 sc/source/ui/view/tabview.cxx        |   17 ++++---------
 sw/source/uibase/uiview/viewport.cxx |   43 -----------------------------------
 vcl/inc/salwtype.hxx                 |    2 -
 vcl/source/window/winproc.cxx        |   40 +++-----------------------------
 6 files changed, 10 insertions(+), 114 deletions(-)

New commits:
commit f0eec7572dfa630f903e91ac44a41f3503112846
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue May 16 10:42:49 2017 +0100

    ExternalZoom and ExternalScroll are unused
    
    which leads to CommandWheelMode::ZOOM_SCALE becoming unused
    
    and so touch/touch.h is unnecessary
    
    Change-Id: I7cb9a4f6af2719deb0d768e35d514b59010daf79
    Reviewed-on: https://gerrit.libreoffice.org/37671
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/touch/touch.h b/include/touch/touch.h
deleted file mode 100644
index e20fe3fe5a3e..000000000000
--- a/include/touch/touch.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#ifndef INCLUDED_TOUCH_TOUCH_H
-#define INCLUDED_TOUCH_TOUCH_H
-
-#define MOBILE_MAX_ZOOM_IN 600
-#define MOBILE_MAX_ZOOM_OUT 80
-#define MOBILE_ZOOM_SCALE_MULTIPLIER 10000
-
-#endif // INCLUDED_TOUCH_TOUCH_H
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/vcl/commandevent.hxx b/include/vcl/commandevent.hxx
index 68ea0c5184d7..778348b3d1a3 100644
--- a/include/vcl/commandevent.hxx
+++ b/include/vcl/commandevent.hxx
@@ -129,8 +129,7 @@ enum class CommandWheelMode
     NONE              = 0,
     SCROLL            = 1,
     ZOOM              = 2,
-    ZOOM_SCALE        = 3,
-    DATAZOOM          = 4
+    DATAZOOM          = 3
 };
 
 // Magic value used in mnLines field in CommandWheelData
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 7610296acd76..2510be1f891a 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -968,8 +968,7 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
 
     bool bDone = false;
     const CommandWheelData* pData = rCEvt.GetWheelData();
-    if ( pData && (pData->GetMode() == CommandWheelMode::ZOOM ||
-                   pData->GetMode() == CommandWheelMode::ZOOM_SCALE ) )
+    if (pData && pData->GetMode() == CommandWheelMode::ZOOM)
     {
         if ( !aViewData.GetViewShell()->GetViewFrame()->GetFrame().IsInPlace() )
         {
@@ -979,16 +978,10 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos )
             const Fraction& rOldY = aViewData.GetZoomY();
             long nOld = (long)(( rOldY.GetNumerator() * 100 ) / rOldY.GetDenominator());
             long nNew;
-            if ( pData->GetMode() == CommandWheelMode::ZOOM_SCALE )
-            {
-                nNew = 100 * (long) ((nOld / 100.0) * (pData->GetDelta() / 100.0));
-            } else
-            {
-                if ( pData->GetDelta() < 0 )
-                    nNew = std::max( (long) MINZOOM, basegfx::zoomtools::zoomOut( nOld ));
-                else
-                    nNew = std::min( (long) MAXZOOM, basegfx::zoomtools::zoomIn( nOld ));
-            }
+            if ( pData->GetDelta() < 0 )
+                nNew = std::max( (long) MINZOOM, basegfx::zoomtools::zoomOut( nOld ));
+            else
+                nNew = std::min( (long) MAXZOOM, basegfx::zoomtools::zoomIn( nOld ));
             if ( nNew != nOld )
             {
                 // scroll wheel doesn't set the AppOptions default
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index e56fcd6c330c..c909c1dd8835 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -41,7 +41,6 @@
 #include <usrpref.hxx>
 #include <pagedesc.hxx>
 #include <workctrl.hxx>
-#include <touch/touch.h>
 
 #include <PostItMgr.hxx>
 
@@ -1217,48 +1216,6 @@ bool SwView::HandleWheelCommands( const CommandEvent& rCEvt )
         SetZoom( SvxZoomType::PERCENT, nFact );
         bOk = true;
     }
-    else if (pWData && CommandWheelMode::ZOOM_SCALE == pWData->GetMode())
-    {
-        // mobile touch zoom (pinch) section
-        // remember the center location to reach in logic
-
-        Size winSize = GetViewFrame()->GetWindow().GetOutputSizePixel();
-        Point centerInPixels(winSize.getWidth() / 2, winSize.getHeight() / 2);
-        const Point & preZoomTargetCenterInLogic = GetEditWin().PixelToLogic(centerInPixels);
-
-        double scale = double(pWData->GetDelta()) / double(MOBILE_ZOOM_SCALE_MULTIPLIER);
-
-        int preZoomByVCL = m_pWrtShell->GetViewOptions()->GetZoom();
-
-        // each zooming event is scaling the initial zoom
-        int zoomTarget = int(preZoomByVCL * scale);
-
-        // thresholding the zoom
-        zoomTarget = std::max( MOBILE_MAX_ZOOM_OUT, std::min( MOBILE_MAX_ZOOM_IN, zoomTarget ) );
-
-        // no point zooming if the target zoom is the same as the current zoom
-        if(zoomTarget!=preZoomByVCL)
-        {
-
-            SetZoom( SvxZoomType::PERCENT, zoomTarget );
-        }
-        // we move to the center, and add additional tilt from center
-        const Point & postZoomTargetCenterInPixels = GetEditWin().LogicToPixel(preZoomTargetCenterInLogic);
-        long deltaX = rCEvt.GetMousePosPixel().X() + centerInPixels.X() - postZoomTargetCenterInPixels.X();
-        long deltaY = rCEvt.GetMousePosPixel().Y() + centerInPixels.Y() - postZoomTargetCenterInPixels.Y();
-
-        if((deltaX!=0) || (deltaY!=0))
-        {
-
-            // scrolling the deltaX deltaY
-            Point deltaPoint( deltaX, deltaY );
-            CommandWheelData cmd( 0, 0, 0, CommandWheelMode::SCROLL, 0, false, true);
-            CommandEvent event(deltaPoint , CommandEventId::Wheel, true, &cmd );
-            m_pEditWin->HandleScrollCommand(event, m_pHScrollbar, m_pVScrollbar);
-        }
-
-        bOk = true;
-    }
     else
     {
         if (pWData && pWData->GetMode()==CommandWheelMode::SCROLL)
diff --git a/vcl/inc/salwtype.hxx b/vcl/inc/salwtype.hxx
index 605e26c94774..12ed894b67f3 100644
--- a/vcl/inc/salwtype.hxx
+++ b/vcl/inc/salwtype.hxx
@@ -79,8 +79,6 @@ enum class SalEvent {
     SurroundingTextRequest,
     SurroundingTextSelectionChange,
     StartReconversion,
-    ExternalZoom,
-    ExternalScroll,
     QueryCharPosition,
     Swipe,
     LongPress
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index cc7798a042a7..c66a2c91af47 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -37,7 +37,6 @@
 #include <vcl/menu.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/lazydelete.hxx>
-#include <touch/touch.h>
 #include <vcl/uitest/logger.hxx>
 
 #include <svdata.hxx>
@@ -1441,16 +1440,14 @@ class HandleWheelEvent : public HandleGestureEventBase
 private:
     CommandWheelData m_aWheelData;
 public:
-    HandleWheelEvent(vcl::Window *pWindow, const SalWheelMouseEvent& rEvt, bool bScaleDirectly)
+    HandleWheelEvent(vcl::Window *pWindow, const SalWheelMouseEvent& rEvt)
         : HandleGestureEventBase(pWindow, Point(rEvt.mnX, rEvt.mnY))
     {
         CommandWheelMode nMode;
         sal_uInt16 nCode = rEvt.mnCode;
         bool bHorz = rEvt.mbHorz;
         bool bPixel = rEvt.mbDeltaIsPixel;
-        if (bScaleDirectly)
-            nMode = CommandWheelMode::ZOOM_SCALE;
-        else if ( nCode & KEY_MOD1 )
+        if ( nCode & KEY_MOD1 )
             nMode = CommandWheelMode::ZOOM;
         else if ( nCode & KEY_MOD2 )
             nMode = CommandWheelMode::DATAZOOM;
@@ -1518,9 +1515,9 @@ bool HandleGestureEvent::HandleEvent()
     return bHandled;
 }
 
-static bool ImplHandleWheelEvent( vcl::Window* pWindow, const SalWheelMouseEvent& rEvt, bool scaleDirectly = false )
+static bool ImplHandleWheelEvent(vcl::Window* pWindow, const SalWheelMouseEvent& rEvt)
 {
-    HandleWheelEvent aHandler(pWindow, rEvt, scaleDirectly);
+    HandleWheelEvent aHandler(pWindow, rEvt);
     return aHandler.HandleEvent(rEvt);
 }
 
@@ -2537,35 +2534,6 @@ bool ImplWindowFrameProc( vcl::Window* _pWindow, SalEvent nEvent, const void* pE
         case SalEvent::StartReconversion:
             ImplHandleStartReconversion( pWindow );
             break;
-        case SalEvent::ExternalZoom:
-            {
-            SalWheelMouseEvent aSalWheelMouseEvent;
-            aSalWheelMouseEvent.mnTime = tools::Time::GetSystemTicks();
-            aSalWheelMouseEvent.mnX = 0;
-            aSalWheelMouseEvent.mnY = 0;
-            // Pass on the scale as a percentage * 100 of current zoom factor
-            // so to assure zoom granularity
-            aSalWheelMouseEvent.mnDelta = long(MOBILE_ZOOM_SCALE_MULTIPLIER);
-            // Other SalWheelMouseEvent fields ignored when the
-            // scaleDirectly parameter to ImplHandleWheelEvent() is
-            // true.
-            bRet = ImplHandleWheelEvent( pWindow, aSalWheelMouseEvent, true );
-            }
-            break;
-        case SalEvent::ExternalScroll:
-            {
-            SalWheelMouseEvent aSalWheelMouseEvent;
-            aSalWheelMouseEvent.mnTime = tools::Time::GetSystemTicks();
-            aSalWheelMouseEvent.mbDeltaIsPixel = true;
-            // event location holds delta values instead
-            aSalWheelMouseEvent.mnX = 0;
-            aSalWheelMouseEvent.mnY = 0;
-            aSalWheelMouseEvent.mnScrollLines = 0;
-            if (aSalWheelMouseEvent.mnX != 0 || aSalWheelMouseEvent.mnY != 0)
-            {
-                bRet = ImplHandleWheelEvent( pWindow, aSalWheelMouseEvent );
-            }
-        }
         break;
         case SalEvent::QueryCharPosition:
             ImplHandleSalQueryCharPosition( pWindow, const_cast<SalQueryCharPositionEvent *>(static_cast<SalQueryCharPositionEvent const *>(pEvent)) );


More information about the Libreoffice-commits mailing list