File indexing completed on 2024-12-22 04:12:44

0001 /*
0002  * This file is part of the KDE project
0003  * SPDX-FileCopyrightText: 2019 Sharaf Zaman <sharafzaz121@gmail.com>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef KIS_ZOOM_AND_ROTATE_ACTION_H
0009 #define KIS_ZOOM_AND_ROTATE_ACTION_H
0010 
0011 #include "kis_abstract_input_action.h"
0012 #include <QScopedPointer>
0013 
0014 /**
0015  * @brief This class handles both rotation and zooming operation. This is
0016  * separate from Zoom and Rotate operation applied individually because the
0017  * order of transformation is different.
0018  */
0019 class KisZoomAndRotateAction : public KisAbstractInputAction
0020 {
0021 public:
0022     enum Shortcut {
0023         ContinuousRotateMode,
0024         DiscreteRotateMode,
0025     };
0026     KisZoomAndRotateAction();
0027     ~KisZoomAndRotateAction();
0028 
0029     int priority() const override;
0030 
0031     void activate(int shortcut) override;
0032     void deactivate(int shortcut) override;
0033     void begin(int shortcut, QEvent *event) override;
0034     void cursorMovedAbsolute(const QPointF &lastPos, const QPointF &pos) override;
0035     void inputEvent(QEvent* event) override;
0036 
0037     KisInputActionGroup inputActionGroup(int shortcut) const override;
0038 
0039 private:
0040     qreal canvasRotationAngle(QPointF p0, QPointF p1);
0041 
0042 private:
0043     class Private;
0044     const QScopedPointer<Private> d;
0045 };
0046 
0047 #endif // KIS_ZOOM_AND_ROTATE_ACTION_H