r13801 by pierre - added a couple of helpers in Selection, ensure that selection bounding rect is up to date when getting it

scribus-commit scribus-commit at lists.scribus.net
Sat Aug 1 09:45:19 CEST 2009


Revision: 13801
Author: pierre
Date: 2009-08-01T07:44:12.832479Z
Commit message: added a couple of helpers in Selection, ensure that selection bounding rect is up to date when getting it

Changeset: 
M  /trunk/Scribus/scribus/selection.h
M  /trunk/Scribus/scribus/selection.cpp

Diffs:
Index: scribus/selection.h
===================================================================
--- scribus/selection.h	(revision 13800)
+++ scribus/selection.h	(revision 13801)
@@ -24,6 +24,7 @@
 #include <QMap>
 #include <QObject>
 #include <QPointer>
+#include <QRectF>
 
 #include "pageitem.h"
 #include "scribusapi.h"
@@ -134,6 +135,7 @@
 		 * @param item PageItem reference
 		 */
 		bool primarySelectionIs(const PageItem* item) const { return (!m_SelList.isEmpty() && (item==m_SelList.first())); }
+		const SelectionList& selectionList() const {return m_SelList;}
 		PageItem *itemAt(int index=0) { return itemAt_(index); }
 		const PageItem *itemAt(int index=0) const { return const_cast<Selection*>(this)->itemAt_(index); }
 		QStringList getSelectedItemsByName() const;
@@ -144,7 +146,9 @@
 		//set the group rectangle properties
 		void setGroupRect();
 		void getGroupRect(double *x, double *y, double *w, double *h);
+		QRectF getGroupRect();
 		void getVisualGroupRect(double *x, double *y, double *w, double *h);
+		QRectF getVisualGroupRect();
 		//!\brief Test to see if all items in the selection are the same typedef
 		bool itemsAreSameType() const;
 
Index: scribus/selection.cpp
===================================================================
--- scribus/selection.cpp	(revision 13800)
+++ scribus/selection.cpp	(revision 13801)
@@ -460,20 +460,36 @@
 
 void Selection::getGroupRect(double *x, double *y, double *w, double *h)
 {
+	setGroupRect();
 	*x = groupX;
 	*y = groupY;
 	*w = groupW;
 	*h = groupH;
 }
 
+QRectF Selection::getGroupRect()
+{
+	double x, y, w, h;
+	getGroupRect(&x, &y, &w, &h);
+	return QRectF(x,y,w,h);
+}
+
 void Selection::getVisualGroupRect(double * x, double * y, double * w, double * h)
 {
+	setGroupRect();
 	*x = visualGX;
 	*y = visualGY;
 	*w = visualGW;
 	*h = visualGH;
 }
 
+QRectF Selection::getVisualGroupRect()
+{
+	double x, y, w, h;
+	getGroupRect(&x, &y, &w, &h);
+	return QRectF(x,y,w,h);
+}
+
 bool Selection::itemsAreSameType() const
 {
 	//CB Putting count=1 before isempty test as its probably the most likely, given our view code.




More information about the scribus-commit mailing list