Scribus
Open source desktop publishing at your fingertips
canvasmode_edit.h
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 <QObject>
22 #include <QTime>
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 
36 {
37  Q_OBJECT
38 
39 public:
40  explicit CanvasMode_Edit(ScribusView* view);
41  virtual ~CanvasMode_Edit() {}
42 
43  virtual void enterEvent(QEvent *);
44  virtual void leaveEvent(QEvent *);
45 
46  virtual void activate(bool);
47  virtual void deactivate(bool);
48 
49  virtual void mouseDoubleClickEvent(QMouseEvent *m);
50  virtual void mouseReleaseEvent(QMouseEvent *m);
51  virtual void mouseMoveEvent(QMouseEvent *m);
52  virtual void mousePressEvent(QMouseEvent *m);
53 
54  virtual bool handleKeyEvents() { return true; }
55  virtual void keyPressEvent(QKeyEvent *e);
56 
57  virtual void drawControls(QPainter* p);
58 
59 // protected:
60 // void setResizeCursor(int how, double rot = 0.0);
61 
62 private:
63  inline bool GetItem(PageItem** pi);
64  void drawTextCursor(QPainter* p, PageItem_TextFrame* textframe);
65  bool SeleItem(QMouseEvent *m);
66  void createContextMenu(PageItem *currItem, double mx, double my);
67 
68  int Cp, oldCp;
69  int frameResizeHandle;
70  int dragConstrainInitPtX, dragConstrainInitPtY;
71  double Mxp, Myp, Dxp, Dyp;
72  double SeRx, SeRy;
73  ScribusMainWindow* m_ScMW;
74  bool m_cursorVisible;
75  QTime m_blinkTime;
76  QTimer* m_blinker;
77  bool m_lastPosWasOverGuide;
78  double mRulerGuide;
79  bool m_longCursorTime;
80  bool m_keyRepeat;
81 
82 private slots:
83  void blinkTextCursor();
84  void rulerPreview(double base, double xp);
85 };
86 
87 
88 #endif
Definition: canvasmode_edit.h:35
Definition: pageitem_textframe.h:45
virtual void activate(bool)
Definition: canvasmode_edit.cpp:269
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
virtual void deactivate(bool)
Definition: canvasmode_edit.cpp:305
virtual void drawControls(QPainter *p)
Definition: canvasmode_edit.cpp:178
Definition: canvasmode.h:72
Definition: pageitem.h:92
Definition: scribusview.h:87