r18456 by craig - Fix the selection rubber band in node edit mode / canvas gesture rectangle select with use of new SelectionRubberBand class

scribus-commit scribus-commit at lists.scribus.net
Wed Sep 4 19:27:42 UTC 2013


Author: craig
Date: Wed Sep  4 19:27:42 2013
New Revision: 18456

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18456
Log:
Fix the selection rubber band in node edit mode / canvas gesture rectangle select with use of new SelectionRubberBand class

Modified:
    trunk/Scribus/scribus/canvasgesture_rectselect.cpp
    trunk/Scribus/scribus/canvasgesture_rectselect.h

Modified: trunk/Scribus/scribus/canvasgesture_rectselect.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18456&path=/trunk/Scribus/scribus/canvasgesture_rectselect.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rectselect.cpp (original)
+++ trunk/Scribus/scribus/canvasgesture_rectselect.cpp Wed Sep  4 19:27:42 2013
@@ -19,6 +19,7 @@
 #include "canvasgesture_rectselect.h"
 #include "canvas.h"
 #include "scribusview.h"
+#include "selectionrubberband.h"
 
 #include <QDragEnterEvent>
 #include <QDragMoveEvent>
@@ -37,17 +38,17 @@
 
 void RectSelect::prepare(QPoint start)
 {
-	if (!m_rectangle)
-		m_rectangle = new QRubberBand(QRubberBand::Rectangle, m_view);
+	if (!m_selectionRubberBand)
+		m_selectionRubberBand = new SelectionRubberBand(QRubberBand::Rectangle, m_view);
 	setStart(start);
 //FIXME Move to new code like SelectionRubberBand
-	m_rectangle->setWindowOpacity(0.5);
-	m_rectangle->setGeometry(QRect(m_view->mapFromGlobal(start), m_view->mapFromGlobal(start)));
+	m_selectionRubberBand->setWindowOpacity(0.5);
+	m_selectionRubberBand->setGeometry(QRect(m_view->mapFromGlobal(start), m_view->mapFromGlobal(start)));
 }
 
 void RectSelect::clear()
 {
-	m_rectangle->hide();
+	m_selectionRubberBand->hide();
 	m_start = QPoint(0,0);
 }
 
@@ -55,12 +56,12 @@
 void RectSelect::activate(bool)
 {
 	prepare(m_start);
-	m_rectangle->show();
+	m_selectionRubberBand->show();
 }
 
 void RectSelect::deactivate(bool)
 {
-	m_rectangle->hide();
+	m_selectionRubberBand->hide();
 }
 
 void RectSelect::setStart(QPoint globalPos)
@@ -70,13 +71,13 @@
 
 void RectSelect::setEnd(QPoint globalPos)
 {
-	m_rectangle->setGeometry(QRect(m_view->mapFromGlobal(m_start), m_view->mapFromGlobal(globalPos)).normalized());
+	m_selectionRubberBand->setGeometry(QRect(m_view->mapFromGlobal(m_start), m_view->mapFromGlobal(globalPos)).normalized());
 }
 
 
 QRectF RectSelect::result() const
 {
-	QRect geom = m_rectangle->geometry().normalized();
+	QRect geom = m_selectionRubberBand->geometry().normalized();
 	geom = QRect(m_view->mapToGlobal(geom.topLeft()), m_view->mapToGlobal(geom.bottomRight()));
 	return m_canvas->globalToCanvas(geom);
 }

Modified: trunk/Scribus/scribus/canvasgesture_rectselect.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18456&path=/trunk/Scribus/scribus/canvasgesture_rectselect.h
==============================================================================
--- trunk/Scribus/scribus/canvasgesture_rectselect.h (original)
+++ trunk/Scribus/scribus/canvasgesture_rectselect.h Wed Sep  4 19:27:42 2013
@@ -33,7 +33,7 @@
 class QMouseEvent;
 class QKeyEvent;
 class QPainter;
-class QRubberBand;
+class SelectionRubberBand;
 
 /**
   This class realizes rectangle-select on behalf of its parent mode.
@@ -48,7 +48,7 @@
 class SCRIBUS_API RectSelect : public CanvasGesture
 {
 public:
-	explicit RectSelect (CanvasMode* parent) : CanvasGesture(parent), m_start(0,0), m_rectangle(0) {};
+	explicit RectSelect (CanvasMode* parent) : CanvasGesture(parent), m_start(0,0), m_selectionRubberBand(0) {};
 	virtual ~RectSelect() {}
 	
 	void prepare(QPoint globalStartPos);
@@ -73,7 +73,7 @@
 	void setEnd(QPoint globalPos);
 	
 	QPoint m_start;
-	QRubberBand* m_rectangle;
+	SelectionRubberBand* m_selectionRubberBand;
 };
 
 




More information about the scribus-commit mailing list