r18471 by fschmid - Fixed Bug #11730: Vector files imported to wrong page

scribus-commit scribus-commit at lists.scribus.net
Tue Sep 10 19:53:16 UTC 2013


Author: fschmid
Date: Tue Sep 10 19:53:16 2013
New Revision: 18471

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18471
Log:
Fixed Bug #11730: Vector files imported to wrong page

Modified:
    trunk/Scribus/scribus/canvasmode_objimport.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusXml.cpp

Modified: trunk/Scribus/scribus/canvasmode_objimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18471&path=/trunk/Scribus/scribus/canvasmode_objimport.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_objimport.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_objimport.cpp Tue Sep 10 19:53:16 2013
@@ -37,6 +37,7 @@
 #include "scribus.h"
 #include "scribusdoc.h"
 #include "scribusview.h"
+#include "selection.h"
 #include "undomanager.h"
 #include "util.h"
 #include "util_icon.h"
@@ -178,8 +179,15 @@
 		}
 		// Creating QDragEnterEvent outside of Qt is not recommended per docs :S
 		QPoint dropPos = m_view->widget()->mapFromGlobal(m->globalPos());
+		const FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
 		QDropEvent dropEvent(dropPos, Qt::CopyAction|Qt::MoveAction, m_mimeData, m->buttons(), m->modifiers());
 		m_view->contentsDropEvent(&dropEvent);
+		if (m_doc->m_Selection->count() > 0)
+		{
+			double gx, gy, gh, gw;
+			m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
+			m_doc->moveGroup(mousePointDoc.x() - gx, mousePointDoc.y() -gy, false);
+		}
 		// Commit undo transaction if necessary
 		if (undoTransaction)
 		{

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18471&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Tue Sep 10 19:53:16 2013
@@ -3532,6 +3532,8 @@
 
 void ScribusMainWindow::pasteFromScrapbook(QString fn)
 {
+	view->dragX = 0;
+	view->dragY = 0;
 	doPasteRecent(scrapbookPalette->activeBView->objectMap[fn].Data);
 }
 
@@ -3596,9 +3598,9 @@
 			doc->SnapGuides = false;
 			doc->SnapElement = false;
 			if ((view->dragX == 0) && (view->dragY == 0))
-				slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, false, doc, view);
+				slotElemRead(data, doc->currentPage()->xOffset(), doc->currentPage()->yOffset(), true, true, doc, view);
 			else
-				slotElemRead(data, view->dragX, view->dragY, true, false, doc, view);
+				slotElemRead(data, view->dragX, view->dragY, true, true, doc, view);
 			doc->SnapGrid = savedAlignGrid;
 			doc->SnapGuides = savedAlignGuides;
 			doc->SnapElement = savedAlignElement;

Modified: trunk/Scribus/scribus/scribusXml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18471&path=/trunk/Scribus/scribus/scribusXml.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusXml.cpp (original)
+++ trunk/Scribus/scribus/scribusXml.cpp Tue Sep 10 19:53:16 2013
@@ -208,6 +208,12 @@
 		embedded->DrawObj(painter, QRectF());
 		painter->restore();
 	}
+	int pg = doc->OnPage(xp + wp / 2.0, yp + hp / 2.0);
+	if (pg > 0)
+	{
+		xp = xp - doc->getXOffsetForPage(pg);
+		yp = yp - doc->getYOffsetForPage(pg);
+	}
 	delete painter;
 	QBuffer buffer;
 	buffer.open(QIODevice::WriteOnly);




More information about the scribus-commit mailing list