r17519 by craig - #10295: Apply first patch for creation of new frame when linking frames to empty space on canvas

scribus-commit scribus-commit at lists.scribus.net
Sun May 27 21:31:04 UTC 2012


Author: craig
Date: Sun May 27 21:31:03 2012
New Revision: 17519

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17519
Log:
#10295: Apply first patch for creation of new frame when linking frames to empty space on canvas

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

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17519&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sun May 27 21:31:03 2012
@@ -79,6 +79,7 @@
 #include "commonstrings.h"
 #include "filewatcher.h"
 #include "hyphenator.h"
+#include "pageitem.h"
 #include "pageitem_group.h"
 #include "pageitem_imageframe.h"
 #include "pageitem_line.h"
@@ -162,7 +163,8 @@
 	m_groupTransactions(0),
 	m_groupTransaction(NULL),
 	_isGlobalMode(true),
-	m_vhRulerHW(17)
+	m_vhRulerHW(17),
+	linkAfterDraw(false)
 {
 	setObjectName("s");
 	QPalette p=palette();
@@ -4209,12 +4211,36 @@
 		QMouseEvent* m = static_cast<QMouseEvent*> (event);
 		m_canvasMode->mouseReleaseEvent(m);
 		m_canvas->m_viewMode.m_MouseButtonPressed = false;
+		if (linkAfterDraw)
+		{
+			//user creates new frame using linking tool
+			PageItem * secondFrame = Doc->m_Selection->itemAt(0);
+			if (secondFrame && firstFrame)
+			{
+				firstFrame->link(secondFrame);
+				firstFrame = NULL;
+			}
+			linkAfterDraw = false;
+		}
 		return true;
 	}
 	else if (obj == widget() && event->type() == QEvent::MouseButtonPress)
 	{
 		QMouseEvent* m = static_cast<QMouseEvent*> (event);
+		bool linkmode = (Doc->appMode == modeLinkFrames);
+		firstFrame = Doc->m_Selection->itemAt(0);
 		m_canvasMode->mousePressEvent(m);
+		//if user dont click any frame he want to draw new frame and link it
+		bool requestDrawMode = (Doc->ElemToLink == NULL);
+		if (linkmode && requestDrawMode)
+		{
+			//switch to drawing new text frame
+			linkAfterDraw = true;
+			requestMode(modeDrawText);
+			m_canvasMode->mousePressEvent(m);
+		}
+		else
+			firstFrame = NULL;
 		m_canvas->m_viewMode.m_MouseButtonPressed = true;
 		return true;
 	}

Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17519&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Sun May 27 21:31:03 2012
@@ -294,7 +294,12 @@
 	void PasteToPage();
 	void TextToPath();
 	void adjustCMS();
-	
+
+//for linking frame after draw new frame
+private:
+	bool linkAfterDraw;
+	PageItem * firstFrame;
+
 private: // Private attributes
 	int m_previousMode;
 	QMenu *pmen3;




More information about the scribus-commit mailing list