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 canvasmode_editweldpoint.h - description 17 ------------------- 18 begin : Sun Okt 23 2011 19 copyright : (C) 2011 by Franz Schmid 20 email : Franz.Schmid@altmuehlnet.de 21 ***************************************************************************/ 22 23 #ifndef CANVASMODE_EDITWELDPOINT_H 24 #define CANVASMODE_EDITWELDPOINT_H 25 26 #include <QObject> 27 #include <QTime> 28 29 #include "canvasmode.h" 30 #include "fpointarray.h" 31 #include "ui/weldedit.h" 32 33 class PageItem; 34 class PageItem_TextFrame; 35 class ScribusMainWindow; 36 class ScribusView; 37 38 39 // This class encapsulate the old code for mouse interaction from scribusview.cpp 40 41 class CanvasMode_EditWeldPoint : public CanvasMode 42 { 43 Q_OBJECT 44 public: 45 explicit CanvasMode_EditWeldPoint(ScribusView* view); 46 ~CanvasMode_EditWeldPoint() override = default; 47 48 void enterEvent(QEvent *) override; 49 void leaveEvent(QEvent *) override; 50 51 void activate(bool) override; 52 void deactivate(bool) override; 53 void mouseDoubleClickEvent(QMouseEvent *m) override; 54 void mouseReleaseEvent(QMouseEvent *m) override; 55 void mouseMoveEvent(QMouseEvent *m) override; 56 void mousePressEvent(QMouseEvent *m) override; 57 void keyPressEvent(QKeyEvent *e) override; 58 void drawControls(QPainter* p) override; 59 void drawControlsWeldPoint(QPainter* psx, PageItem* currItem); 60 61 private: 62 void snapToEdgePoints(double &x, double &y); 63 QRectF getUpdateRect(); 64 65 inline bool GetItem(PageItem** pi); 66 67 PageItem *m_currItem {nullptr}; 68 QList<PageItem*> m_weldToList; 69 ScribusMainWindow* m_ScMW {nullptr}; 70 WeldEditDialog* m_ModeDialog {nullptr}; 71 bool m_editWeldMode {true}; 72 bool m_keyRepeat {false}; 73 double m_Mxp {-1.0}; 74 double m_Myp {-1.0}; 75 int m_selectedPoint {-1}; 76 77 private slots: 78 void endEditing(bool active); 79 void endEditing(); 80 void setWeldMode(); 81 void setObjectMode(); 82 }; 83 84 #endif 85