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 18 #ifndef CANVAS_MODE_EDIT_H 19 #define CANVAS_MODE_EDIT_H 20 21 #include <QElapsedTimer> 22 #include <QObject> 23 24 #include "canvasmode.h" 25 #include "fpointarray.h" 26 27 class PageItem; 28 class PageItem_TextFrame; 29 class QTimer; 30 class ScribusMainWindow; 31 class ScribusView; 32 33 // This class encapsulate the old code for mouse interaction from scribusview.cpp 34 35 class CanvasMode_Edit : public CanvasMode 36 { 37 Q_OBJECT 38 39 public: 40 explicit CanvasMode_Edit(ScribusView* view); 41 ~CanvasMode_Edit() override = default; 42 43 void enterEvent(QEvent *) override; 44 void leaveEvent(QEvent *) override; 45 46 void activate(bool) override; 47 void deactivate(bool) override; 48 49 void mouseDoubleClickEvent(QMouseEvent *m) override; 50 void mouseReleaseEvent(QMouseEvent *m) override; 51 void mouseMoveEvent(QMouseEvent *m) override; 52 void mousePressEvent(QMouseEvent *m) override; 53 54 void keyPressEvent(QKeyEvent *e) override; 55 56 void drawControls(QPainter* p) override; 57 58 // protected: 59 // void setResizeCursor(int how, double rot = 0.0); 60 61 private: 62 inline bool GetItem(PageItem** pi); 63 void drawTextCursor(QPainter* p, PageItem_TextFrame* textframe); 64 bool SeleItem(QMouseEvent *m); 65 void createContextMenu(PageItem *currItem, double mx, double my); 66 67 QElapsedTimer m_blinkTime; 68 QTimer* m_blinker; 69 ScribusMainWindow* m_ScMW {nullptr}; 70 bool m_cursorVisible {false}; 71 bool m_keyRepeat {false}; 72 bool m_longCursorTime {false}; 73 double Dxp {-1}; 74 double Dyp {-1}; 75 double Mxp {-1}; 76 double Myp {-1}; 77 double SeRx {-1}; 78 double SeRy {-1}; 79 double mRulerGuide {-1.0}; 80 int Cp {-1}; 81 int frameResizeHandle {-1}; 82 int oldCp {-1}; 83 84 private slots: 85 void blinkTextCursor(); 86 void rulerPreview(double base, double xp); 87 }; 88 89 90 #endif 91