summaryrefslogtreecommitdiffstats
path: root/scribus/canvasgesture_rulermove.h
diff options
context:
space:
mode:
authorcraig <craig@11d20701-8431-0410-a711-e3c959e3b870>2012-01-01 11:40:09 +0000
committercraig <craig@11d20701-8431-0410-a711-e3c959e3b870>2012-01-01 11:40:09 +0000
commit7ed83b6c6666eb8b6b104c211ae7e52907350372 (patch)
tree4430b556abac0ad660a0aacf1887d77f85d8be02 /scribus/canvasgesture_rulermove.h
downloadscribus-7ed83b6c6666eb8b6b104c211ae7e52907350372.tar.gz
scribus-7ed83b6c6666eb8b6b104c211ae7e52907350372.tar.xz
scribus-7ed83b6c6666eb8b6b104c211ae7e52907350372.zip
Branch 1.3.5 tree to 1.4.x tree, goodbye 1.3.x
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17163 11d20701-8431-0410-a711-e3c959e3b870
Diffstat (limited to 'scribus/canvasgesture_rulermove.h')
-rw-r--r--scribus/canvasgesture_rulermove.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/scribus/canvasgesture_rulermove.h b/scribus/canvasgesture_rulermove.h
new file mode 100644
index 0000000..5821e28
--- /dev/null
+++ b/scribus/canvasgesture_rulermove.h
@@ -0,0 +1,98 @@
+/*
+ For general Scribus (>=1.3.2) copyright and licensing information please refer
+ to the COPYING file provided with the program. Following this notice may exist
+ a copyright and/or license notice that predates the release of Scribus 1.3.2
+ for which a new license (GPL+exception) is in place.
+ */
+/***************************************************************************
+* *
+* This program is free software; you can redistribute it and/or modify *
+* it under the terms of the GNU General Public License as published by *
+* the Free Software Foundation; either version 2 of the License, or *
+* (at your option) any later version. *
+* *
+***************************************************************************/
+
+
+
+#ifndef CANVAS_GESTURE_RULERMOVE_H
+#define CANVAS_GESTURE_RULERMOVE_H
+
+#include <QPoint>
+
+#include "scribusapi.h"
+#include "canvas.h"
+#include "canvasgesture.h"
+#include "canvasmode.h"
+#include "scribusview.h"
+
+class QCursor;
+class QDragEnterEvent;
+class QDragMoveEvent;
+class QDragLeaveEvent;
+class QDropEvent;
+class QEvent;
+class QInputMethodEvent;
+class QMouseEvent;
+class QKeyEvent;
+class QPainter;
+class ScribusMainWindow;
+
+/**
+ This class realizes the moving of guides and the moving of the ruler origin
+ */
+class SCRIBUS_API RulerGesture : public CanvasGesture
+{
+ Q_OBJECT
+public:
+ enum Mode { HORIZONTAL, VERTICAL, ORIGIN };
+ RulerGesture (ScribusView* view, Mode mode) :
+ CanvasGesture(view), m_ScMW(m_view->m_ScMW), m_mode(mode), m_haveGuide(false), m_haveCursor(false), m_xy(0,0) {};
+
+ /**
+ Prepares the gesture for 'mode' without using an existing guide. If 'mode' is HORIZONTAL
+ or VERTICAL, a new guide will be created when the mouse is moved over a page.
+ */
+ void prepare(Mode mode);
+ void clear();
+
+ virtual void drawControls(QPainter* p);
+ virtual void activate(bool);
+ virtual void deactivate(bool);
+ virtual void mouseReleaseEvent(QMouseEvent *m);
+ virtual void mouseMoveEvent(QMouseEvent *m);
+ /**
+ This method should be called when the mousebutton is pressed.
+ If there's a moveable guide near this position, it prepares the gesture for moving this guide.
+ */
+ virtual void mousePressEvent(QMouseEvent *m);
+
+ Mode getMode() { return m_mode; }
+ /**
+ Use this to test if there's a moveable guide near this position.
+ It prepares the gesture for moving this guide.
+ */
+ bool mouseHitsGuide(FPoint mousePointDoc);
+ /**
+ It tests for a guide near position, that guide being moveable or not.
+ If the test results in success, emits guideInfo;
+ */
+ void mouseSelectGuide(QMouseEvent *m);
+private:
+ ScribusMainWindow* m_ScMW;
+ Mode m_mode;
+ bool m_haveGuide;
+ int m_page;
+ double m_guide;
+ double m_currentGuide;
+ bool m_haveCursor;
+ QCursor m_cursor;
+ QPoint m_xy;
+ void movePoint(QMouseEvent *m, bool mouseRelease);
+
+ signals:
+ void guideInfo(int /*direction*/, qreal /*position*/);
+};
+
+
+#endif