Kaydet (Commit) f0eec757 authored tarafından Caolán McNamara's avatar Caolán McNamara

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/37671Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 4e52299a
/* -*- 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: */
......@@ -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
......
......@@ -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
......
......@@ -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)
......
......@@ -79,8 +79,6 @@ enum class SalEvent {
SurroundingTextRequest,
SurroundingTextSelectionChange,
StartReconversion,
ExternalZoom,
ExternalScroll,
QueryCharPosition,
Swipe,
LongPress
......
......@@ -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)) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment