r23613 by jghali - #15231: While dragging a guide, pressing ESC should cancel the action

scribus-commit scribus-commit at lists.scribus.net
Tue Apr 14 16:07:24 UTC 2020


Author: jghali
Date: Tue Apr 14 16:07:24 2020
New Revision: 23613

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23613
Log:
#15231: While dragging a guide, pressing ESC should cancel the action

Modified:
    trunk/Scribus/scribus/canvasgesture_cellselect.cpp
    trunk/Scribus/scribus/canvasgesture_columnresize.h
    trunk/Scribus/scribus/canvasgesture_linemove.cpp
    trunk/Scribus/scribus/canvasgesture_pan.cpp
    trunk/Scribus/scribus/canvasgesture_rectselect.cpp
    trunk/Scribus/scribus/canvasgesture_resize.cpp
    trunk/Scribus/scribus/canvasgesture_rowresize.h
    trunk/Scribus/scribus/canvasgesture_rulermove.cpp
    trunk/Scribus/scribus/canvasgesture_rulermove.h
    trunk/Scribus/scribus/canvasgesture_tableresize.h
    trunk/Scribus/scribus/canvasmode.h
    trunk/Scribus/scribus/canvasmode_copyproperties.cpp
    trunk/Scribus/scribus/canvasmode_copyproperties.h
    trunk/Scribus/scribus/canvasmode_create.cpp
    trunk/Scribus/scribus/canvasmode_create.h
    trunk/Scribus/scribus/canvasmode_drawbezier.cpp
    trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
    trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
    trunk/Scribus/scribus/canvasmode_edit.cpp
    trunk/Scribus/scribus/canvasmode_editarc.cpp
    trunk/Scribus/scribus/canvasmode_editgradient.cpp
    trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
    trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp
    trunk/Scribus/scribus/canvasmode_editpolygon.cpp
    trunk/Scribus/scribus/canvasmode_editspiral.cpp
    trunk/Scribus/scribus/canvasmode_edittable.cpp
    trunk/Scribus/scribus/canvasmode_editweldpoint.cpp
    trunk/Scribus/scribus/canvasmode_eyedropper.cpp
    trunk/Scribus/scribus/canvasmode_framelinks.cpp
    trunk/Scribus/scribus/canvasmode_imageimport.cpp
    trunk/Scribus/scribus/canvasmode_magnifier.cpp
    trunk/Scribus/scribus/canvasmode_measurements.cpp
    trunk/Scribus/scribus/canvasmode_nodeedit.cpp
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/canvasmode_objimport.cpp
    trunk/Scribus/scribus/canvasmode_panning.cpp
    trunk/Scribus/scribus/canvasmode_rotate.cpp
    trunk/Scribus/scribus/ui/hruler.cpp
    trunk/Scribus/scribus/ui/vruler.cpp

Modified: trunk/Scribus/scribus/canvasgesture_cellselect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_cellselect.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_cellselect.cpp	(original)
+++ trunk/Scribus/scribus/canvasgesture_cellselect.cpp	Tue Apr 14 16:07:24 2020
@@ -26,14 +26,16 @@
 #include "tableutils.h"
 #include "ui/scmwmenumanager.h"
 
-void CellSelect::activate(bool /*fromGesture*/)
+void CellSelect::activate(bool fromGesture)
 {
+	CanvasGesture::activate(fromGesture);
 	m_view->setCursor(Qt::IBeamCursor);
 }
 
-void CellSelect::deactivate(bool /*forGesture*/)
+void CellSelect::deactivate(bool forGesture)
 {
 	table()->clearSelection();
+	CanvasGesture::deactivate(forGesture);
 }
 
 void CellSelect::keyPressEvent(QKeyEvent* event)

Modified: trunk/Scribus/scribus/canvasgesture_columnresize.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_columnresize.h
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_columnresize.h	(original)
+++ trunk/Scribus/scribus/canvasgesture_columnresize.h	Tue Apr 14 16:07:24 2020
@@ -34,8 +34,6 @@
 	explicit ColumnResize(CanvasMode* parent) : TableGesture(parent), m_column(0) {}
 	~ColumnResize() override = default;
 
-	void activate(bool fromGesture) override {};
-	void deactivate(bool forGesture) override {}
 	void keyPressEvent(QKeyEvent* event) override;
 	void keyReleaseEvent(QKeyEvent* event) override;
 	void mouseReleaseEvent(QMouseEvent* event) override;

Modified: trunk/Scribus/scribus/canvasgesture_linemove.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_linemove.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_linemove.cpp	(original)
+++ trunk/Scribus/scribus/canvasgesture_linemove.cpp	Tue Apr 14 16:07:24 2020
@@ -1,253 +1,254 @@
-/*
- 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.                                   *
-*                                                                         *
-***************************************************************************/
-
-#include "canvasgesture_linemove.h"
-
-//#include <QDebug>
-#include <QMouseEvent>
-#include <QPainter>
-#include <QPen>
-
-#include "canvas.h"
-#include "pageitem_line.h"
-#include "scribusview.h"
-#include "selection.h"
-#include "undomanager.h"
-#include "util_math.h"
-
-void LineMove::clear()
-{
-	m_haveLineItem = false;
+/*
+ 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.                                   *
+*                                                                         *
+***************************************************************************/
+
+#include "canvasgesture_linemove.h"
+
+//#include <QDebug>
+#include <QMouseEvent>
+#include <QPainter>
+#include <QPen>
+
+#include "canvas.h"
+#include "pageitem_line.h"
+#include "scribusview.h"
+#include "selection.h"
+#include "undomanager.h"
+#include "util_math.h"
+
+void LineMove::clear()
+{
+	m_haveLineItem = false;
 	if (m_transaction.isStarted())
 	{
 		m_transaction.cancel();
 		m_transaction.reset();
-	}
-}
-
-
-void LineMove::prepare(QPointF start, QPointF end)
-{
-	m_haveLineItem = false;
-	setStartPoint(start);
-	setStartPoint(end);
-}
-
-
-void LineMove::prepare(PageItem_Line* line, bool useOriginAsEndpoint)
-{
-	m_haveLineItem = (line != nullptr);
-	if (!m_haveLineItem)
-		return;
-	m_useOriginAsEndpoint = useOriginAsEndpoint;
-	m_line = line;
-	setStartPoint(QPointF(m_line->xPos(), m_line->yPos()));
-	setEndPoint(QPointF(m_line->xPos() + m_line->width(), m_line->yPos()));
-	setRotation(m_line->rotation());
-	if (m_useOriginAsEndpoint)
-	{
-		QPointF tmp = startPoint();
-		setStartPoint(endPoint());
-		setEndPoint(tmp);
-	}
-}
-
-
-double LineMove::rotation() const
-{
-	double rot = xy2Deg(m_bounds.width(), m_bounds.height());
-	if (rot < 0.0)
-		return 360 + rot;
-	return rot;
-}
-
-
-void LineMove::setRotation(double rot)
-{
-	m_bounds.setSize(length() * QSizeF(cosd(rot), sind(rot)));
-}
-
-
-double LineMove::length() const
-{
-	return qMax(0.01, distance(m_bounds.width(), m_bounds.height()));
-}
-
-
-void LineMove::setStartPoint(QPointF p)
-{
-	m_bounds.setTopLeft(p);
-}
-
-
-void LineMove::setEndPoint(QPointF p)
-{
-	m_bounds.setBottomRight(p);
-}
-
-
-void LineMove::activate(bool flag)
-{
-//	qDebug() << "LineMove::activate" << flag << m_bounds;	
-}
-
-
-
-void LineMove::deactivate(bool forGesture)
-{
-//	qDebug() << "LineMove::deactivate" << flag;
+	}
+}
+
+
+void LineMove::prepare(QPointF start, QPointF end)
+{
+	m_haveLineItem = false;
+	setStartPoint(start);
+	setStartPoint(end);
+}
+
+
+void LineMove::prepare(PageItem_Line* line, bool useOriginAsEndpoint)
+{
+	m_haveLineItem = (line != nullptr);
+	if (!m_haveLineItem)
+		return;
+	m_useOriginAsEndpoint = useOriginAsEndpoint;
+	m_line = line;
+	setStartPoint(QPointF(m_line->xPos(), m_line->yPos()));
+	setEndPoint(QPointF(m_line->xPos() + m_line->width(), m_line->yPos()));
+	setRotation(m_line->rotation());
+	if (m_useOriginAsEndpoint)
+	{
+		QPointF tmp = startPoint();
+		setStartPoint(endPoint());
+		setEndPoint(tmp);
+	}
+}
+
+
+double LineMove::rotation() const
+{
+	double rot = xy2Deg(m_bounds.width(), m_bounds.height());
+	if (rot < 0.0)
+		return 360 + rot;
+	return rot;
+}
+
+
+void LineMove::setRotation(double rot)
+{
+	m_bounds.setSize(length() * QSizeF(cosd(rot), sind(rot)));
+}
+
+
+double LineMove::length() const
+{
+	return qMax(0.01, distance(m_bounds.width(), m_bounds.height()));
+}
+
+
+void LineMove::setStartPoint(QPointF p)
+{
+	m_bounds.setTopLeft(p);
+}
+
+
+void LineMove::setEndPoint(QPointF p)
+{
+	m_bounds.setBottomRight(p);
+}
+
+
+void LineMove::activate(bool forGesture)
+{
+	CanvasGesture::activate(forGesture);
+}
+
+
+
+void LineMove::deactivate(bool forGesture)
+{
+//	qDebug() << "LineMove::deactivate" << flag;
 	if (!forGesture)
-		clear();
-}
-
-
-
-void LineMove::drawControls(QPainter* p) 
-{ 
-	p->save();
-	p->scale(m_canvas->scale(), m_canvas->scale());
-	p->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
-	p->setBrush(Qt::NoBrush);
-	p->setPen(QPen(Qt::black, 1.0 / m_canvas->scale(), Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
-	p->drawLine(m_bounds.topLeft(), m_bounds.bottomRight());
-	p->restore();
-}
-
-void LineMove::mousePressEvent(QMouseEvent *m)
-{
-	PageItem_Line* line = m_doc->m_Selection->count() == 1 ? m_doc->m_Selection->itemAt(0)->asLine() : nullptr;
-	if (line)
-	{
-		bool hitsOrigin = m_canvas->hitsCanvasPoint(m->globalPos(), line->xyPos());
-		prepare(line, hitsOrigin);
-		// now we also know the line's endpoint:
-		bool hitsEnd = m_canvas->hitsCanvasPoint(m->globalPos(), endPoint());
-		m_haveLineItem = hitsOrigin || hitsEnd;
-	}
-	else
-	{
-		FPoint point = m_canvas->globalToCanvas(m->globalPos());
-		setStartPoint(QPointF(point.x(), point.y()));
-		setEndPoint(QPointF(point.x(), point.y()));
-		m_haveLineItem = false;
-	}
-	if (m_haveLineItem)
-	{
+		clear();
+	CanvasGesture::deactivate(forGesture);
+}
+
+
+
+void LineMove::drawControls(QPainter* p) 
+{ 
+	p->save();
+	p->scale(m_canvas->scale(), m_canvas->scale());
+	p->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
+	p->setBrush(Qt::NoBrush);
+	p->setPen(QPen(Qt::black, 1.0 / m_canvas->scale(), Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+	p->drawLine(m_bounds.topLeft(), m_bounds.bottomRight());
+	p->restore();
+}
+
+void LineMove::mousePressEvent(QMouseEvent *m)
+{
+	PageItem_Line* line = m_doc->m_Selection->count() == 1 ? m_doc->m_Selection->itemAt(0)->asLine() : nullptr;
+	if (line)
+	{
+		bool hitsOrigin = m_canvas->hitsCanvasPoint(m->globalPos(), line->xyPos());
+		prepare(line, hitsOrigin);
+		// now we also know the line's endpoint:
+		bool hitsEnd = m_canvas->hitsCanvasPoint(m->globalPos(), endPoint());
+		m_haveLineItem = hitsOrigin || hitsEnd;
+	}
+	else
+	{
+		FPoint point = m_canvas->globalToCanvas(m->globalPos());
+		setStartPoint(QPointF(point.x(), point.y()));
+		setEndPoint(QPointF(point.x(), point.y()));
+		m_haveLineItem = false;
+	}
+	if (m_haveLineItem)
+	{
 		if (!m_transaction)
 		{
 			QString targetName = line->getUName();
 			QPixmap* targetIcon = line->getUPixmap();
 			m_transaction = Um::instance()->beginTransaction(targetName, targetIcon, Um::Resize, "", Um::IResize);
-		}	
-		adjustBounds(m, false);
-		m_initialBounds = m_bounds;
-		m->accept();
-	}
-}
-
-void LineMove::mouseMoveEvent(QMouseEvent *m)
-{
-	adjustBounds(m);
-	if (m_haveLineItem)
-	{
-		doResize();
-		double angle = rotation();
-		if (angle > 0)
-			angle = 360 - angle;
-		m_canvas->displaySizeHUD(m->globalPos(), length(), fabs(angle), true);
-	}
-	m->accept();
-	m_canvas->repaint();
-}
-
-void LineMove::mouseReleaseEvent(QMouseEvent *m)
-{
-	adjustBounds(m);
-	if (m_haveLineItem)
-	{
-		if (m_bounds != m_initialBounds)
-			doResize();
-		m_doc->setRedrawBounding(m_line);
-		m_view->resetMousePressed();
-		m_line->checkChanges();
-		m_line->update();
-	}
+		}	
+		adjustBounds(m, false);
+		m_initialBounds = m_bounds;
+		m->accept();
+	}
+}
+
+void LineMove::mouseMoveEvent(QMouseEvent *m)
+{
+	adjustBounds(m);
+	if (m_haveLineItem)
+	{
+		doResize();
+		double angle = rotation();
+		if (angle > 0)
+			angle = 360 - angle;
+		m_canvas->displaySizeHUD(m->globalPos(), length(), fabs(angle), true);
+	}
+	m->accept();
+	m_canvas->repaint();
+}
+
+void LineMove::mouseReleaseEvent(QMouseEvent *m)
+{
+	adjustBounds(m);
+	if (m_haveLineItem)
+	{
+		if (m_bounds != m_initialBounds)
+			doResize();
+		m_doc->setRedrawBounding(m_line);
+		m_view->resetMousePressed();
+		m_line->checkChanges();
+		m_line->update();
+	}
 	if (m_transaction.isStarted())
 	{
 		m_transaction.commit();
 		m_transaction.reset();
-	}
-	m->accept();
-	m_canvas->update();
-//	qDebug() << "LineMove::mouseRelease" << m_line->xPos() << "," << m_line->yPos() << "@" << m_line->rotation() << m_line->width() << "x" << m_line->height();
-	m_view->stopGesture();
-}
-
-
-void LineMove::doResize()
-{
-	if (m_useOriginAsEndpoint)
-	{
-		m_line->setXYPos(m_bounds.right(), m_bounds.bottom());
-		double rot = rotation();
-		m_line->setRotation(rot < 180? rot + 180 : rot - 180);
-	}
-	else
-	{
-		m_line->setXYPos(m_bounds.x(), m_bounds.y());
-		m_line->setRotation(rotation());
-	}
-	m_line->setWidth(length());
-	m_line->setHeight(1.0);
-	m_line->updateClip();
-//	qDebug() << "LineMove::doresize" << m_line->xPos() << "," << m_line->yPos() << "@" << m_line->rotation() << m_line->width() << "x" << m_line->height();
-}
-
-void LineMove::adjustBounds(QMouseEvent *m, bool updateCanvas)
-{
-	FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
-	bool constrainRatio = ((m->modifiers() & Qt::ControlModifier) != Qt::NoModifier);
-
-	double newX = mousePointDoc.x();
-	double newY = mousePointDoc.y();
-	
-	if (m_doc->SnapGrid)
-	{
-		newX = qRound(newX / m_doc->guidesPrefs().minorGridSpacing) * m_doc->guidesPrefs().minorGridSpacing;
-		newY = qRound(newY / m_doc->guidesPrefs().minorGridSpacing) * m_doc->guidesPrefs().minorGridSpacing;
-	}
-	//<<#8099
-	FPoint np2 = m_doc->ApplyGridF(FPoint(newX, newY));
-	double nx = np2.x();
-	double ny = np2.y();
-	m_doc->ApplyGuides(&nx, &ny);
-	m_doc->ApplyGuides(&nx, &ny,true);
-	newX = nx;
-	newY = ny;
-	//>>#8099
-
-	m_bounds.setBottomRight(QPointF(newX, newY));
-	//Constrain rotation angle, when the mouse is being dragged around for a new line
-	if (constrainRatio)
-	{
-		double newRot = rotation();
-		newRot = constrainAngle(newRot, m_doc->opToolPrefs().constrain);
-		setRotation(newRot);
-	}
-	if (updateCanvas)
-	{
-		m_view->updateCanvas(m_bounds.normalized().adjusted(-10, -10, 20, 20));
-	}
-}
+	}
+	m->accept();
+	m_canvas->update();
+//	qDebug() << "LineMove::mouseRelease" << m_line->xPos() << "," << m_line->yPos() << "@" << m_line->rotation() << m_line->width() << "x" << m_line->height();
+	m_view->stopGesture();
+}
+
+
+void LineMove::doResize()
+{
+	if (m_useOriginAsEndpoint)
+	{
+		m_line->setXYPos(m_bounds.right(), m_bounds.bottom());
+		double rot = rotation();
+		m_line->setRotation(rot < 180? rot + 180 : rot - 180);
+	}
+	else
+	{
+		m_line->setXYPos(m_bounds.x(), m_bounds.y());
+		m_line->setRotation(rotation());
+	}
+	m_line->setWidth(length());
+	m_line->setHeight(1.0);
+	m_line->updateClip();
+//	qDebug() << "LineMove::doresize" << m_line->xPos() << "," << m_line->yPos() << "@" << m_line->rotation() << m_line->width() << "x" << m_line->height();
+}
+
+void LineMove::adjustBounds(QMouseEvent *m, bool updateCanvas)
+{
+	FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+	bool constrainRatio = ((m->modifiers() & Qt::ControlModifier) != Qt::NoModifier);
+
+	double newX = mousePointDoc.x();
+	double newY = mousePointDoc.y();
+	
+	if (m_doc->SnapGrid)
+	{
+		newX = qRound(newX / m_doc->guidesPrefs().minorGridSpacing) * m_doc->guidesPrefs().minorGridSpacing;
+		newY = qRound(newY / m_doc->guidesPrefs().minorGridSpacing) * m_doc->guidesPrefs().minorGridSpacing;
+	}
+	//<<#8099
+	FPoint np2 = m_doc->ApplyGridF(FPoint(newX, newY));
+	double nx = np2.x();
+	double ny = np2.y();
+	m_doc->ApplyGuides(&nx, &ny);
+	m_doc->ApplyGuides(&nx, &ny,true);
+	newX = nx;
+	newY = ny;
+	//>>#8099
+
+	m_bounds.setBottomRight(QPointF(newX, newY));
+	//Constrain rotation angle, when the mouse is being dragged around for a new line
+	if (constrainRatio)
+	{
+		double newRot = rotation();
+		newRot = constrainAngle(newRot, m_doc->opToolPrefs().constrain);
+		setRotation(newRot);
+	}
+	if (updateCanvas)
+	{
+		m_view->updateCanvas(m_bounds.normalized().adjusted(-10, -10, 20, 20));
+	}
+}

Modified: trunk/Scribus/scribus/canvasgesture_pan.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_pan.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_pan.cpp	(original)
+++ trunk/Scribus/scribus/canvasgesture_pan.cpp	Tue Apr 14 16:07:24 2020
@@ -27,15 +27,17 @@
 {
 }
 
-void PanGesture::activate(bool /*fromGesture*/)
+void PanGesture::activate(bool fromGesture)
 {
+	CanvasGesture::activate(fromGesture);
 	m_cursor = m_view->cursor();
 	m_view->setCursor(IconManager::instance().loadCursor("handc.png"));
 }
 
-void PanGesture::deactivate(bool /*forgesture*/)
+void PanGesture::deactivate(bool forGesture)
 {
 	m_view->setCursor(m_cursor);
+	CanvasGesture::deactivate(forGesture);
 }
 
 void PanGesture::drawControls(QPainter* p)

Modified: trunk/Scribus/scribus/canvasgesture_rectselect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_rectselect.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rectselect.cpp	(original)
+++ trunk/Scribus/scribus/canvasgesture_rectselect.cpp	Tue Apr 14 16:07:24 2020
@@ -53,15 +53,17 @@
 }
 
 
-void RectSelect::activate(bool)
+void RectSelect::activate(bool fromGesture)
 {
+	CanvasGesture::activate(fromGesture);
 	prepare(m_start);
 	m_selectionRubberBand->show();
 }
 
-void RectSelect::deactivate(bool)
+void RectSelect::deactivate(bool fromGesture)
 {
 	m_selectionRubberBand->hide();
+	CanvasGesture::deactivate(fromGesture);
 }
 
 void RectSelect::setStart(QPoint globalPos)

Modified: trunk/Scribus/scribus/canvasgesture_resize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_resize.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_resize.cpp	(original)
+++ trunk/Scribus/scribus/canvasgesture_resize.cpp	Tue Apr 14 16:07:24 2020
@@ -107,19 +107,18 @@
 	}
 }
 
-void ResizeGesture::activate(bool flag)
-{
-}
-
-
-
-void ResizeGesture::deactivate(bool forgesture)
-{
-	if (!forgesture)
+void ResizeGesture::activate(bool fromGesture)
+{
+	CanvasGesture::activate(fromGesture);
+}
+
+
+void ResizeGesture::deactivate(bool forGesture)
+{
+	if (!forGesture)
 		clear();
-}
-
-
+	CanvasGesture::deactivate(forGesture);
+}
 
 void ResizeGesture::drawControls(QPainter* p) 
 {

Modified: trunk/Scribus/scribus/canvasgesture_rowresize.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_rowresize.h
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rowresize.h	(original)
+++ trunk/Scribus/scribus/canvasgesture_rowresize.h	Tue Apr 14 16:07:24 2020
@@ -34,8 +34,6 @@
 	explicit RowResize(CanvasMode* parent) : TableGesture(parent), m_row(0) {}
 	~RowResize() override = default;
 
-	void activate(bool fromGesture) override {};
-	void deactivate(bool forGesture) override {}
 	void keyPressEvent(QKeyEvent* event) override;
 	void keyReleaseEvent(QKeyEvent* event) override;
 	void mouseReleaseEvent(QMouseEvent* event) override;

Modified: trunk/Scribus/scribus/canvasgesture_rulermove.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_rulermove.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rulermove.cpp	(original)
+++ trunk/Scribus/scribus/canvasgesture_rulermove.cpp	Tue Apr 14 16:07:24 2020
@@ -72,22 +72,21 @@
 	p->restore();
 }
 
-
 void RulerGesture::clear()
 {
 	m_haveGuide = false;
 }
 
-
 void RulerGesture::prepare(Mode mode)
 {
 	m_haveGuide = false;
 	m_mode = mode;
 }
 
-
 void RulerGesture::activate(bool fromGesture)
 {
+	CanvasGesture::activate(fromGesture);
+
 	m_haveCursor = (qApp->overrideCursor() != nullptr);
 	if ( (!fromGesture) && qApp->overrideCursor())
 	{
@@ -113,11 +112,14 @@
 	emit guideInfo(m_mode, m_guide);
 }
 
-void RulerGesture::deactivate(bool)
+void RulerGesture::deactivate(bool fromGesture)
 {
 	if (m_haveCursor)
 		qApp->changeOverrideCursor(m_cursor);
 	m_haveGuide = false;
+	m_mousePoint = FPoint();
+
+	CanvasGesture::deactivate(fromGesture);
 }
 
 
@@ -330,6 +332,18 @@
 }
 
 
+void RulerGesture::keyPressEvent(QKeyEvent* e)
+{
+	e->accept();
+
+	if (e->key() == Qt::Key_Escape)
+	{
+		// Go back to normal mode.
+		m_view->stopGesture();
+		return;
+	}
+}
+
 void RulerGesture::mouseMoveEvent(QMouseEvent* m)
 {
 	m_mousePoint=m_canvas->globalToCanvas(m->globalPos());

Modified: trunk/Scribus/scribus/canvasgesture_rulermove.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_rulermove.h
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rulermove.h	(original)
+++ trunk/Scribus/scribus/canvasgesture_rulermove.h	Tue Apr 14 16:07:24 2020
@@ -1,102 +1,104 @@
-/*
- 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>
-
-class QCursor;
-class QDragEnterEvent;
-class QDragMoveEvent;
-class QDragLeaveEvent;
-class QDropEvent;
-class QEvent;
-class QInputMethodEvent;
-class QMouseEvent;
-class QKeyEvent;
-class QPainter;
-
-#include "scribusapi.h"
-#include "canvas.h"
-#include "canvasgesture.h"
-#include "canvasmode.h"
-#include "fpoint.h"
-
-class ScribusMainWindow;
-class ScribusView;
-
-/**
-  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);
-		~RulerGesture() override = default;
-
-		/**
-		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();
-
-		void drawControls(QPainter* p) override;
-		void activate(bool) override;
-		void deactivate(bool) override;
-		void mouseReleaseEvent(QMouseEvent *m) override;
-		void mouseMoveEvent(QMouseEvent *m) override;
-		/**
-	  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.
-	 */
-		void mousePressEvent(QMouseEvent *m) override;
-
-		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(const 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:
-		FPoint m_mousePoint;
-		Mode m_mode;
-		QCursor m_cursor;
-		QPoint m_xy;
-		ScribusMainWindow* m_ScMW {nullptr};
-		bool m_haveCursor {false};
-		bool m_haveGuide {false};
-		double m_currentGuide {0.0};
-		double m_guide {0.0};
-		int m_page {0};
-
-		void movePoint(QMouseEvent *m, bool mouseRelease);
-
-	signals:
-		void guideInfo(int /*direction*/, qreal /*position*/);
-};
-
-
-#endif
+/*
+ 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>
+
+class QCursor;
+class QDragEnterEvent;
+class QDragMoveEvent;
+class QDragLeaveEvent;
+class QDropEvent;
+class QEvent;
+class QInputMethodEvent;
+class QMouseEvent;
+class QKeyEvent;
+class QPainter;
+
+#include "scribusapi.h"
+#include "canvas.h"
+#include "canvasgesture.h"
+#include "canvasmode.h"
+#include "fpoint.h"
+
+class ScribusMainWindow;
+class ScribusView;
+
+/**
+  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);
+		~RulerGesture() override = default;
+
+		/**
+		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();
+
+		void drawControls(QPainter* p) override;
+		void activate(bool) override;
+		void deactivate(bool) override;
+		bool handleKeyEvents() override { return true; }
+		void keyPressEvent(QKeyEvent* event) override;
+		void mouseReleaseEvent(QMouseEvent *m) override;
+		void mouseMoveEvent(QMouseEvent *m) override;
+		/**
+	  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.
+	 */
+		void mousePressEvent(QMouseEvent *m) override;
+
+		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(const 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:
+		FPoint m_mousePoint;
+		Mode m_mode;
+		QCursor m_cursor;
+		QPoint m_xy;
+		ScribusMainWindow* m_ScMW {nullptr};
+		bool m_haveCursor {false};
+		bool m_haveGuide {false};
+		double m_currentGuide {0.0};
+		double m_guide {0.0};
+		int m_page {0};
+
+		void movePoint(QMouseEvent *m, bool mouseRelease);
+
+	signals:
+		void guideInfo(int /*direction*/, qreal /*position*/);
+};
+
+
+#endif

Modified: trunk/Scribus/scribus/canvasgesture_tableresize.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasgesture_tableresize.h
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_tableresize.h	(original)
+++ trunk/Scribus/scribus/canvasgesture_tableresize.h	Tue Apr 14 16:07:24 2020
@@ -34,8 +34,6 @@
 	explicit TableResize(CanvasMode* parent) : TableGesture(parent), m_minHeight(0.0), m_minWidth(0.0) {}
 	~TableResize() override = default;
 
-	void activate(bool fromGesture) override {};
-	void deactivate(bool forGesture) override {}
 	void keyPressEvent(QKeyEvent* event) override;
 	void mouseReleaseEvent(QMouseEvent* event) override;
 	void mouseMoveEvent(QMouseEvent* event) override;

Modified: trunk/Scribus/scribus/canvasmode.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode.h	(original)
+++ trunk/Scribus/scribus/canvasmode.h	Tue Apr 14 16:07:24 2020
@@ -83,12 +83,17 @@
 	  (fromgesture == false) or because a gesture completed and the canvas returns back to
 	  this mode (fromGesture == true)
 	 */
-	virtual void activate(bool fromGesture) {}
+	virtual void activate(bool fromGesture) { m_isActive = true; }
 	/**
 	  Is called when this mode becomes inactive, either because the canvas switches to
 	  another mode (forGesture == false) or because a gesture is activated (forGesture == true)
 	 */
-	virtual void deactivate(bool forGesture) {}
+	virtual void deactivate(bool forGesture) { m_isActive = false; }
+
+	/**
+	 Test if canvas mode is currently active
+	*/
+	virtual bool isActive() const { return m_isActive; }
 	
 	virtual void enterEvent(QEvent *) {}
 	virtual void leaveEvent(QEvent *) {}
@@ -153,6 +158,7 @@
 	ScribusDoc* const m_doc;
 	PanGesture* m_panGesture {nullptr};
 	UndoManager* undoManager;
+	bool   m_isActive { false };
 	double xSnap {0.0};
 	double ySnap {0.0};
 	

Modified: trunk/Scribus/scribus/canvasmode_copyproperties.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_copyproperties.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_copyproperties.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_copyproperties.cpp	Tue Apr 14 16:07:24 2020
@@ -68,6 +68,8 @@
 void CanvasMode_CopyProperties::activate(bool fromGesture)
 {
 //	qDebug() << "CanvasMode_CopyProperties::activate" << fromGesture;
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -85,10 +87,11 @@
 	}
 }
 
-void CanvasMode_CopyProperties::deactivate(bool  /*forGesture*/)
+void CanvasMode_CopyProperties::deactivate(bool forGesture)
 {
 //	qDebug() << "CanvasMode_CopyProperties::deactivate" << forGesture;
 	m_view->setRedrawMarkerShown(false);
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_CopyProperties::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_copyproperties.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_copyproperties.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_copyproperties.h	(original)
+++ trunk/Scribus/scribus/canvasmode_copyproperties.h	Tue Apr 14 16:07:24 2020
@@ -35,7 +35,7 @@
 	void enterEvent(QEvent *) override ;
 	void leaveEvent(QEvent *) override ;
 	
-	void activate(bool) override ;
+	void activate(bool) override;
 	void deactivate(bool) override ;
 	void mouseDoubleClickEvent(QMouseEvent *m) override ;
 	void mouseReleaseEvent(QMouseEvent *m) override ;

Modified: trunk/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_create.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_create.cpp	Tue Apr 14 16:07:24 2020
@@ -193,8 +193,10 @@
 
 void CreateMode::activate(bool fromGesture)
 {
+//	qDebug() << "CreateMode::activate" << fromGesture;
+	CanvasMode::activate(fromGesture);
+
 	PageItem* currItem;
-//	qDebug() << "CreateMode::activate" << fromGesture;
 	if (!fromGesture || !GetItem(&currItem) || !m_createTransaction)
 	{
 		if (m_createTransaction)
@@ -222,6 +224,8 @@
 			m_createTransaction.reset();
 		}
 	}
+
+	CanvasMode::deactivate(forGesture);
 }
 
 void CreateMode::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_create.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_create.h
==============================================================================
--- trunk/Scribus/scribus/canvasmode_create.h	(original)
+++ trunk/Scribus/scribus/canvasmode_create.h	Tue Apr 14 16:07:24 2020
@@ -38,16 +38,16 @@
 	explicit CreateMode(ScribusView* view);
 	~CreateMode() override  = default;
 
-	void enterEvent(QEvent *) override ;
-	void leaveEvent(QEvent *) override ;
+	void enterEvent(QEvent *) override;
+	void leaveEvent(QEvent *) override;
 	
-	void activate(bool) override ;
-	void deactivate(bool) override ;
-	void mouseDoubleClickEvent(QMouseEvent *m) override ;
-	void mouseReleaseEvent(QMouseEvent *m) override ;
-	void mouseMoveEvent(QMouseEvent *m) override ;
-	void mousePressEvent(QMouseEvent *m) override ;
-	void drawControls(QPainter* p) override ;
+	void activate(bool) override;
+	void deactivate(bool) override;
+	void mouseDoubleClickEvent(QMouseEvent *m) override;
+	void mouseReleaseEvent(QMouseEvent *m) override;
+	void mouseMoveEvent(QMouseEvent *m) override;
+	void mousePressEvent(QMouseEvent *m) override;
+	void drawControls(QPainter* p) override;
 	
 // protected:
 // 	void setResizeCursor(int);

Modified: trunk/Scribus/scribus/canvasmode_drawbezier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_drawbezier.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawbezier.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_drawbezier.cpp	Tue Apr 14 16:07:24 2020
@@ -112,22 +112,26 @@
 }
 
 
-void BezierMode::activate(bool /*flag*/)
+void BezierMode::activate(bool fromGesture)
 {
 //	qDebug() << "DrawBezierMode::activate" << flag;
+	CanvasMode::activate(fromGesture);
+
 	m_xp = m_yp = -1;
 	m_inItemCreation = false;
 	m_firstPoly = true;
 	setModeCursor();
 }
 
-void BezierMode::deactivate(bool /*flag*/)
+void BezierMode::deactivate(bool forGesture)
 {
 //	qDebug() << "BezierMode::deactivate" << flag;
 //	m_view->stopDragTimer();
+
+	CanvasMode::deactivate(forGesture);
+
+	//When only one node(size=2) was created; it's not a valid line(min valid PoLine size is 6), delete it
 	PageItem* currItem = m_doc->m_Selection->itemAt(0);
-
-	//When only one node(size=2) was created; it's not a valid line(min valid PoLine size is 6), delete it
 	if (currItem)
 	{
 		if (currItem->PoLine.size() % 4 != 0)

Modified: trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_drawcalligraphic.cpp	Tue Apr 14 16:07:24 2020
@@ -72,16 +72,19 @@
 }
 
 
-void CalligraphicMode::activate(bool flag)
-{
+void CalligraphicMode::activate(bool fromGesture)
+{
+	CanvasMode::activate(fromGesture);
+
 	m_xp = m_yp = -1;
 	m_mouseButtonPressed = false;
 	setModeCursor();
 }
 
-void CalligraphicMode::deactivate(bool flag)
+void CalligraphicMode::deactivate(bool forGesture)
 {
 	m_view->setRedrawMarkerShown(false);
+	CanvasMode::deactivate(forGesture);
 }
 
 void CalligraphicMode::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_drawfreehand.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawfreehand.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_drawfreehand.cpp	Tue Apr 14 16:07:24 2020
@@ -68,16 +68,18 @@
 }
 
 
-void FreehandMode::activate(bool flag)
-{
+void FreehandMode::activate(bool fromGesture)
+{
+	CanvasMode::activate(fromGesture);
 	m_xp = m_yp = -1;
 	m_mouseButtonPressed = false;
 	setModeCursor();
 }
 
-void FreehandMode::deactivate(bool flag)
+void FreehandMode::deactivate(bool forGesture)
 {
 	m_view->setRedrawMarkerShown(false);
+	CanvasMode::deactivate(forGesture);
 }
 
 void FreehandMode::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp	Tue Apr 14 16:07:24 2020
@@ -260,6 +260,8 @@
 
 void CanvasMode_Edit::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -303,6 +305,7 @@
 		mRulerGuide = -1;
 		m_blinker->stop();
 	}
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_Edit::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_editarc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_editarc.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editarc.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_editarc.cpp	Tue Apr 14 16:07:24 2020
@@ -150,6 +150,8 @@
 
 void CanvasMode_EditArc::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	vectorDialog = new ArcVectorDialog(m_ScMW);
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
@@ -183,6 +185,18 @@
 	connect(vectorDialog, SIGNAL(endEdit()), this, SLOT(endEditing()));
 	connect(vectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
 	connect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
+}
+
+void CanvasMode_EditArc::deactivate(bool forGesture)
+{
+	CanvasMode::deactivate(forGesture);
+
+	disconnect(vectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
+	vectorDialog->close();
+	vectorDialog->deleteLater();
+	m_view->setRedrawMarkerShown(false);
+	m_arcPoint = noPointDefined;
+	disconnect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
 }
 
 void CanvasMode_EditArc::updateFromItem()
@@ -282,16 +296,6 @@
 
 //	QTransform itemMatrix = currItem->getTransform();
 //	m_doc->regionsChanged()->update(itemMatrix.mapRect(QRectF(0, 0, currItem->width(), currItem->height())).adjusted(-currItem->width() / 2.0, -currItem->height() / 2.0, currItem->width(), currItem->height()));
-}
-
-void CanvasMode_EditArc::deactivate(bool forGesture)
-{
-	disconnect(vectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
-	vectorDialog->close();
-	vectorDialog->deleteLater();
-	m_view->setRedrawMarkerShown(false);
-	m_arcPoint = noPointDefined;
-	disconnect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
 }
 
 void CanvasMode_EditArc::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_editgradient.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_editgradient.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editgradient.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_editgradient.cpp	Tue Apr 14 16:07:24 2020
@@ -244,6 +244,8 @@
 void CanvasMode_EditGradient::activate(bool fromGesture)
 {
 //	qDebug() << "CanvasMode_EditGradient::activate" << fromGesture;
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -263,6 +265,7 @@
 {
 //	qDebug() << "CanvasMode_EditGradient::deactivate" << forGesture;
 	m_view->setRedrawMarkerShown(false);
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_EditGradient::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_editmeshgradient.cpp	Tue Apr 14 16:07:24 2020
@@ -357,6 +357,8 @@
 
 void CanvasMode_EditMeshGradient::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -380,6 +382,8 @@
 	m_selectedMeshPoints.clear();
 	m_gradientPoint = noPointDefined;
 	m_ScMW->propertiesPalette->updateColorSpecialGradient();
+
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_EditMeshGradient::keyPressEvent(QKeyEvent *e)

Modified: trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_editmeshpatch.cpp	Tue Apr 14 16:07:24 2020
@@ -286,6 +286,8 @@
 
 void CanvasMode_EditMeshPatch::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -316,6 +318,8 @@
 	m_currItem->selectedMeshControlPoint = m_gradientPoint;
 	m_ScMW->propertiesPalette->updateColorSpecialGradient();
 	m_currItem->snapToPatchGrid = false;
+
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_EditMeshPatch::keyPressEvent(QKeyEvent *e)

Modified: trunk/Scribus/scribus/canvasmode_editpolygon.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_editpolygon.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editpolygon.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_editpolygon.cpp	Tue Apr 14 16:07:24 2020
@@ -172,6 +172,8 @@
 
 void CanvasMode_EditPolygon::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	m_polygonPoint = noPointDefined;
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
@@ -223,6 +225,8 @@
 	m_view->setRedrawMarkerShown(false);
 	m_polygonPoint = noPointDefined;
 	disconnect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
+
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_EditPolygon::endEditing(bool active)

Modified: trunk/Scribus/scribus/canvasmode_editspiral.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_editspiral.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editspiral.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_editspiral.cpp	Tue Apr 14 16:07:24 2020
@@ -109,6 +109,8 @@
 
 void CanvasMode_EditSpiral::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	m_VectorDialog = new SpiralVectorDialog(m_ScMW);
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
@@ -135,6 +137,18 @@
 	connect(m_VectorDialog, SIGNAL(endEdit()), this, SLOT(endEditing()));
 	connect(m_VectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
 	connect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
+}
+
+void CanvasMode_EditSpiral::deactivate(bool forGesture)
+{
+	disconnect(m_VectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
+	m_VectorDialog->close();
+	m_VectorDialog->deleteLater();
+	m_view->setRedrawMarkerShown(false);
+	m_arcPoint = noPointDefined;
+	disconnect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
+
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_EditSpiral::updateFromItem()
@@ -245,16 +259,6 @@
 	m_endAngle = item->spiralEndAngle;
 	QTransform itemMatrix = currItem->getTransform();
 	m_doc->regionsChanged()->update(itemMatrix.mapRect(QRectF(0, 0, currItem->width(), currItem->height())).adjusted(-5, -5, 10, 10));
-}
-
-void CanvasMode_EditSpiral::deactivate(bool forGesture)
-{
-	disconnect(m_VectorDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
-	m_VectorDialog->close();
-	m_VectorDialog->deleteLater();
-	m_view->setRedrawMarkerShown(false);
-	m_arcPoint = noPointDefined;
-	disconnect(m_doc, SIGNAL(docChanged()), this, SLOT(updateFromItem()));
 }
 
 void CanvasMode_EditSpiral::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_edittable.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_edittable.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edittable.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_edittable.cpp	Tue Apr 14 16:07:24 2020
@@ -63,6 +63,8 @@
 
 void CanvasMode_EditTable::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	PageItem *item = m_doc->m_Selection->itemAt(0);
 	Q_ASSERT(item && item->isTable());
 	m_table = item->asTable();
@@ -84,6 +86,7 @@
 		m_canvasUpdateTimer->stop();
 
 	m_view->m_ScMW->updateTableMenuActions();
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_EditTable::keyPressEvent(QKeyEvent* event)

Modified: trunk/Scribus/scribus/canvasmode_editweldpoint.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_editweldpoint.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_editweldpoint.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_editweldpoint.cpp	Tue Apr 14 16:07:24 2020
@@ -123,6 +123,8 @@
 
 void CanvasMode_EditWeldPoint::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -157,6 +159,8 @@
 	disconnect(m_ModeDialog, SIGNAL(paletteShown(bool)), this, SLOT(endEditing(bool)));
 	m_ModeDialog->close();
 	delete m_ModeDialog;
+
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_EditWeldPoint::endEditing(bool active)

Modified: trunk/Scribus/scribus/canvasmode_eyedropper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_eyedropper.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_eyedropper.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_eyedropper.cpp	Tue Apr 14 16:07:24 2020
@@ -80,6 +80,8 @@
 void CanvasMode_EyeDropper::activate(bool fromGesture)
 {
 //	qDebug() << "CanvasMode_EyeDropper::activate" << fromGesture;
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -100,6 +102,8 @@
 //	qDebug() << "CanvasMode_EyeDropper::deactivate" << forGesture;
 	m_view->setRedrawMarkerShown(false);
 	releaseMouse();
+
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_EyeDropper::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_framelinks.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_framelinks.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_framelinks.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_framelinks.cpp	Tue Apr 14 16:07:24 2020
@@ -83,6 +83,8 @@
 void CanvasMode_FrameLinks::activate(bool fromGesture)
 {
 //	qDebug() << "CanvasMode_FrameLinks::activate" << fromGesture;
+	CanvasMode::activate(fromGesture);
+
 	if (m_doc->m_Selection->count() >= 2)
 	{
 		switch (m_doc->appMode)
@@ -125,6 +127,7 @@
 {
 //	qDebug() << "CanvasMode_FrameLinks::deactivate" << forGesture;
 	m_view->setRedrawMarkerShown(false);
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_FrameLinks::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_imageimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_imageimport.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_imageimport.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_imageimport.cpp	Tue Apr 14 16:07:24 2020
@@ -129,6 +129,8 @@
 
 void CanvasMode_ImageImport::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_keyRepeat = false;
@@ -145,6 +147,7 @@
 void CanvasMode_ImageImport::deactivate(bool forGesture)
 {
 	m_view->setRedrawMarkerShown(false);
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_ImageImport::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_magnifier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_magnifier.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_magnifier.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_magnifier.cpp	Tue Apr 14 16:07:24 2020
@@ -75,6 +75,8 @@
 void CanvasMode_Magnifier::activate(bool fromGesture)
 {
 //	qDebug() << "CanvasMode_Magnifier::activate" << fromGesture;
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -92,6 +94,7 @@
 {
 //	qDebug() << "CanvasMode_Magnifier::deactivate" << forGesture;
 	m_view->setRedrawMarkerShown(false);
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_Magnifier::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_measurements.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_measurements.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_measurements.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_measurements.cpp	Tue Apr 14 16:07:24 2020
@@ -51,14 +51,16 @@
 }
 
 
-void MeasurementsMode::activate(bool)
+void MeasurementsMode::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
 	m_palette->show();
 }
 
-void MeasurementsMode::deactivate(bool)
+void MeasurementsMode::deactivate(bool forGesture)
 {
 	m_palette->hide();
+	CanvasMode::deactivate(forGesture);
 }
 
 void MeasurementsMode::drawControls(QPainter* p)

Modified: trunk/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_nodeedit.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_nodeedit.cpp	Tue Apr 14 16:07:24 2020
@@ -158,6 +158,7 @@
 
 void CanvasMode_NodeEdit::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
 	if (fromGesture && m_rectangleSelect)
 	{
 		m_canvas->m_viewMode.m_MouseButtonPressed = false;
@@ -220,7 +221,6 @@
 	}
 }
 
-
 void CanvasMode_NodeEdit::deactivate(bool forGesture)
 {
 	if (!forGesture && m_rectangleSelect)
@@ -229,6 +229,7 @@
 		delete m_rectangleSelect;
 		m_rectangleSelect = nullptr;
 	}
+	CanvasMode::deactivate(forGesture);
 }
 
 

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp	Tue Apr 14 16:07:24 2020
@@ -106,6 +106,8 @@
 void CanvasMode_Normal::activate(bool fromGesture)
 {
 //	qDebug() << "CanvasMode_Normal::activate" << fromGesture;
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -131,6 +133,7 @@
 {
 //	qDebug() << "CanvasMode_Normal::deactivate" << forGesture;
 	m_view->setRedrawMarkerShown(false);
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_Normal::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_objimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_objimport.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_objimport.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_objimport.cpp	Tue Apr 14 16:07:24 2020
@@ -87,6 +87,8 @@
 void CanvasMode_ObjImport::activate(bool fromGesture)
 {
 //	qDebug() << "CanvasMode_ObjImport::activate" << fromGesture;
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -108,6 +110,8 @@
 	setMimeData(nullptr);
 	setTransactionSettings(nullptr);
 	m_view->setRedrawMarkerShown(false);
+
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_ObjImport::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_panning.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_panning.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_panning.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_panning.cpp	Tue Apr 14 16:07:24 2020
@@ -57,6 +57,8 @@
 
 void CanvasMode_Panning::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->DragP = false;
@@ -74,6 +76,7 @@
 void CanvasMode_Panning::deactivate(bool forGesture)
 {
 	m_view->setRedrawMarkerShown(false);
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_Panning::mouseDoubleClickEvent(QMouseEvent *m)

Modified: trunk/Scribus/scribus/canvasmode_rotate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/canvasmode_rotate.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_rotate.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_rotate.cpp	Tue Apr 14 16:07:24 2020
@@ -157,6 +157,8 @@
 
 void CanvasMode_Rotate::activate(bool fromGesture)
 {
+	CanvasMode::activate(fromGesture);
+
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m_doc->leaveDrag = false;
@@ -173,10 +175,11 @@
 	}
 }
 
-void CanvasMode_Rotate::deactivate(bool)
+void CanvasMode_Rotate::deactivate(bool forGesture)
 {
 	m_view->setRedrawMarkerShown(false);
 	m_inItemRotation = false;
+	CanvasMode::deactivate(forGesture);
 }
 
 void CanvasMode_Rotate::enterEvent(QEvent *)

Modified: trunk/Scribus/scribus/ui/hruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/ui/hruler.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/hruler.cpp	(original)
+++ trunk/Scribus/scribus/ui/hruler.cpp	Tue Apr 14 16:07:24 2020
@@ -296,14 +296,8 @@
 		m_view->DrawNew();
 		m_doc->m_Selection->itemAt(0)->emitAllToGUI();
 	}
-	else
-	{
-		if (m_mousePressed)
-		{
-			rulerGesture->mouseReleaseEvent(m);
-			m_mousePressed = false;
-		}
-	}
+	else if (m_mousePressed && rulerGesture->isActive())
+		rulerGesture->mouseReleaseEvent(m);
 	m_mousePressed = false;
 	qApp->restoreOverrideCursor();
 }
@@ -448,10 +442,8 @@
 	}
 	else
 	{
-		if (m_mousePressed)
-		{
+		if (m_mousePressed && rulerGesture->isActive())
 			rulerGesture->mouseMoveEvent(m);
-		}
 		else
 			setCursor(QCursor(Qt::ArrowCursor));
 	}

Modified: trunk/Scribus/scribus/ui/vruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23613&path=/trunk/Scribus/scribus/ui/vruler.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/vruler.cpp	(original)
+++ trunk/Scribus/scribus/ui/vruler.cpp	Tue Apr 14 16:07:24 2020
@@ -69,14 +69,15 @@
 {
 	if (!m_mousePressed)
 		return;
-	rulerGesture->mouseReleaseEvent(m);
+	if (rulerGesture->isActive())
+		rulerGesture->mouseReleaseEvent(m);
 	qApp->restoreOverrideCursor();
 	m_mousePressed = false;
 }
 
 void Vruler::mouseMoveEvent(QMouseEvent *m)
 {
-	if (m_mousePressed)
+	if (m_mousePressed && rulerGesture->isActive())
 		rulerGesture->mouseMoveEvent(m);
 }
 




More information about the scribus-commit mailing list