Subversion Repositories Scribus

Rev

Rev 23614 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20593 jghali 1
/*
2
 For general Scribus (>=1.3.2) copyright and licensing information please refer
3
 to the COPYING file provided with the program. Following this notice may exist
4
 a copyright and/or license notice that predates the release of Scribus 1.3.2
5
 for which a new license (GPL+exception) is in place.
6
 */
7
/***************************************************************************
8
*                                                                         *
9
*   This program is free software; you can redistribute it and/or modify  *
10
*   it under the terms of the GNU General Public License as published by  *
11
*   the Free Software Foundation; either version 2 of the License, or     *
12
*   (at your option) any later version.                                   *
13
*                                                                         *
14
***************************************************************************/
15
 
16
 
17
 
21946 craig 18
#ifndef CANVASMODE_NORMAL_H
19
#define CANVASMODE_NORMAL_H
20593 jghali 20
 
21
#include <QObject>
22
#include <QTime>
23
 
24
#include "canvasmode.h"
25
#include "fpointarray.h"
26
 
27
class LineMove;
28
class PageItem;
29
class ResizeGesture;
30
class RulerGesture;
31
class ScribusMainWindow;
32
class ScribusView;
33
 
34
 
35
// This class encapsulate the old code for mouse interaction from scribusview.cpp
36
 
37
class CanvasMode_Normal :  public CanvasMode
38
{
39
        Q_OBJECT
40
 
41
public:
42
        explicit CanvasMode_Normal(ScribusView* view);
23017 craig 43
        ~CanvasMode_Normal() override = default;
20593 jghali 44
 
22951 craig 45
        void enterEvent(QEvent *) override;
46
        void leaveEvent(QEvent *) override;
20593 jghali 47
 
22951 craig 48
        void activate(bool) override;
49
        void deactivate(bool) override;
24003 jghali 50
 
51
        void keyPressEvent(QKeyEvent *e) override;
52
        void keyReleaseEvent(QKeyEvent *e) override;
53
 
22951 craig 54
        void mouseDoubleClickEvent(QMouseEvent *m) override;
55
        void mouseReleaseEvent(QMouseEvent *m) override;
56
        void mouseMoveEvent(QMouseEvent *m) override;
57
        void mousePressEvent(QMouseEvent *m) override;
58
        void drawControls(QPainter* p) override;
20593 jghali 59
 
60
private:
23420 jghali 61
        const unsigned SELECT_IN_GROUP { Qt::AltModifier }; // Qt::MetaModifier;
62
        const unsigned SELECT_MULTIPLE { Qt::ShiftModifier };
63
        const unsigned SELECT_BENEATH{ Qt::ControlModifier };
64
 
20593 jghali 65
        inline bool GetItem(PageItem** pi);
66
        void handleCheckBoxPress(PageItem* currItem);
67
        void handlePushButtonPress(PageItem* currItem);
68
        void handleRadioButtonPress(PageItem* currItem);
69
        void handleCheckBoxRelease(PageItem* currItem);
70
        void handlePushButtonRelease(PageItem* currItem);
71
        void handleRadioButtonRelease(PageItem* currItem);
72
        void handleJavaAction(PageItem* currItem, int event);
73
        void handleNamedAction(PageItem* currItem);
74
        void handleLinkAnnotation(PageItem* currItem);
75
        void handleFocusOut(PageItem* currItem);
76
        void handleFocusIn(PageItem* currItem);
77
        void handleMouseLeave(PageItem* currItem);
78
        void handleMouseEnter(PageItem* currItem);
79
        bool SeleItem(QMouseEvent *m);
80
        void createContextMenu(PageItem *currItem, double mx, double my);
81
 
82
        FPoint m_mousePressPoint;
83
        FPoint m_mouseCurrentPoint;
84
        FPoint m_mouseSavedPoint;
85
        FPoint m_objectDeltaPos;
86
 
23612 craig 87
        LineMove* m_lineMoveGesture {nullptr};
88
        PageItem* m_hoveredItem {nullptr};
89
        ResizeGesture* m_resizeGesture {nullptr};
90
        RulerGesture* m_guideMoveGesture {nullptr};
91
        ScribusMainWindow* m_ScMW {nullptr};
92
        bool m_lastPosWasOverGuide {false};
93
        bool m_shiftSelItems {false};
94
        int m_dragConstrainInitPtX {0};
95
        int m_dragConstrainInitPtY {0};
96
        int m_frameResizeHandle {-1};
20593 jghali 97
 
98
public slots:
99
        void importToPage();
100
};
101
 
102
 
103
#endif