r17565 by craig - #10295: Apply 2nd patch for text linking splitting

scribus-commit scribus-commit at lists.scribus.net
Thu Jun 14 20:54:10 UTC 2012


Author: craig
Date: Thu Jun 14 20:54:10 2012
New Revision: 17565

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17565
Log:
#10295: Apply 2nd patch for text linking splitting

Modified:
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17565&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Thu Jun 14 20:54:10 2012
@@ -772,6 +772,10 @@
 	scrActions->insert(name, new ScrAction(ScrAction::DataInt, loadIcon("16/color-picker.png"), loadIcon("22/color-picker.png"), "", defaultKey(name), mainWindow, modeEyeDropper));
 	name="toolsCopyProperties";
 	scrActions->insert(name, new ScrAction(ScrAction::DataInt, loadIcon("wizard16.png"), loadIcon("wizard.png"), "", defaultKey(name), mainWindow, modeCopyProperties));
+	name="toolsUnlinkTextFrameWithTextCopy";
+	scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, modeUnlinkFrames));
+	name="toolsUnlinkTextFrameWithTextCut";
+	scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), mainWindow, modeUnlinkFrames));
 
 	//PDF toolbar
 	name="toolsPDFPushButton";
@@ -823,7 +827,7 @@
 	*modeActionNames << "toolsSelect" << "toolsInsertTextFrame" << "toolsInsertImageFrame" << "toolsInsertTable";
 	*modeActionNames << "toolsInsertShape" << "toolsInsertPolygon" << "toolsInsertArc" << "toolsInsertSpiral" << "toolsInsertLine" << "toolsInsertBezier";
 	*modeActionNames << "toolsInsertFreehandLine" << "toolsInsertCalligraphicLine" << "toolsInsertRenderFrame" << "toolsRotate" << "toolsZoom" << "toolsEditContents";
-	*modeActionNames << "toolsEditWithStoryEditor" << "toolsLinkTextFrame" << "toolsUnlinkTextFrame";
+	*modeActionNames << "toolsEditWithStoryEditor" << "toolsLinkTextFrame" << "toolsUnlinkTextFrame" << "toolsUnlinkTextFrameWithTextCopy" << "toolsUnlinkTextFrameWithTextCut";
 	*modeActionNames << "toolsEyeDropper" << "toolsCopyProperties";
 	*modeActionNames << "toolsPDFPushButton" << "toolsPDFTextField" << "toolsPDFCheckBox" << "toolsPDFComboBox" << "toolsPDFListBox" << "toolsPDFAnnotText" << "toolsPDFAnnotLink";
 #ifdef HAVE_OSG
@@ -1123,7 +1127,8 @@
 	disconnect( (*scrActions)["itemRaiseToTop"], 0, 0, 0);
 	disconnect( (*scrActions)["itemLower"], 0, 0, 0);
 	disconnect( (*scrActions)["itemRaise"], 0, 0, 0);
-
+	disconnect( (*scrActions)["toolsUnlinkTextFrameWithTextCopy"], 0, 0, 0 );
+	disconnect( (*scrActions)["toolsUnlinkTextFrameWithTextCut"], 0, 0, 0 );
 
 }
 
@@ -1163,6 +1168,8 @@
 	connect( (*scrActions)["itemRaiseToTop"], SIGNAL(triggered()), currDoc, SLOT(bringItemSelectionToFront()) );
 	connect( (*scrActions)["itemLower"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_LowerItem()) );
 	connect( (*scrActions)["itemRaise"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_RaiseItem()) );
+	connect( (*scrActions)["toolsUnlinkTextFrameWithTextCopy"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UnlinkTextFrameWithText()) );
+	connect( (*scrActions)["toolsUnlinkTextFrameWithTextCut"], SIGNAL(triggered()), currDoc, SLOT(itemSelection_UnlinkTextFrameWithTextCut()) );
 }
 
 void ActionManager::disconnectNewViewActions()
@@ -1552,6 +1559,8 @@
 	(*scrActions)["toolsEditWithStoryEditor"]->setText( tr("Edit Text..."));
 	(*scrActions)["toolsLinkTextFrame"]->setTexts( tr("Link Text Frames"));
 	(*scrActions)["toolsUnlinkTextFrame"]->setTexts( tr("Unlink Text Frames"));
+	(*scrActions)["toolsUnlinkTextFrameWithTextCopy"]->setTexts( tr("Unlink Text Frame with Text Copy"));
+	(*scrActions)["toolsUnlinkTextFrameWithTextCut"]->setTexts( tr("Unlink Text Frame with Text Cut"));
 	(*scrActions)["toolsEyeDropper"]->setTexts( tr("&Eye Dropper"));
 	(*scrActions)["toolsCopyProperties"]->setTexts( tr("Copy Item Properties"));
 
@@ -2184,6 +2193,8 @@
 	itnmenua->second << "toolsEditContents";
 	itnmenua->second << "toolsLinkTextFrame";
 	itnmenua->second << "toolsUnlinkTextFrame";
+	itnmenua->second << "toolsUnlinkTextFrameWithTextCopy";
+	itnmenua->second << "toolsUnlinkTextFrameWithTextCut";
 	itnmenua->second << "toolsEyeDropper";
 	itnmenua->second << "toolsCopyProperties";
 	itnmenua->second << "toolsPDFPushButton";

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17565&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Thu Jun 14 20:54:10 2012
@@ -1304,6 +1304,23 @@
 		// JG we should set BackBox and NextBox to NULL at a point
 		BackBox = NextBox = NULL;
 	}
+}
+
+//unlink selected frame from text chain
+//but copy or cut its content from itemText
+void PageItem::unlinkWithText(bool cutText)
+{
+	// FIX ME - make this operation undoable
+	PageItem * Next = NextBox;
+	itemText.select(firstInFrame(),lastInFrame() - firstInFrame() +1);
+	StoryText content(m_Doc);
+	content.insert(0, itemText, true);
+	if (cutText)
+		itemText.removeSelection();
+	dropLinks();
+	itemText.append(content);
+	if (Next)
+		Next->update();
 }
 
 /// tests if a character is displayed by this frame

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17565&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Thu Jun 14 20:54:10 2012
@@ -548,6 +548,7 @@
 	void unlink();
 	void link(PageItem* nextFrame);
 	void dropLinks();
+	void unlinkWithText(bool);
 
 protected:
 	PageItem *BackBox;

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17565&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Jun 14 20:54:10 2012
@@ -828,6 +828,8 @@
 	scrMenuMgr->addMenuSeparator("Item");
 	scrMenuMgr->addMenuItem(scrActions["toolsLinkTextFrame"], "Item", false);
 	scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrame"], "Item", false);
+	scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrameWithTextCopy"], "Item", false);
+	scrMenuMgr->addMenuItem(scrActions["toolsUnlinkTextFrameWithTextCut"], "Item", false);
 	scrMenuMgr->addMenuSeparator("Item");
 	scrMenuMgr->addMenuItem(scrActions["itemAttachTextToPath"], "Item", false);
 	scrMenuMgr->addMenuItem(scrActions["itemDetachTextFromPath"], "Item", false);
@@ -2703,6 +2705,8 @@
 		scrActions["extrasDeHyphenateText"]->setEnabled(false);
 
 		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
 		scrActions["toolsLinkTextFrame"]->setEnabled(false);
 		scrActions["toolsEditContents"]->setEnabled(false);
 		scrActions["toolsEditWithStoryEditor"]->setEnabled(false);
@@ -2754,6 +2758,8 @@
 		scrActions["itemConvertToPolygon"]->setEnabled(doc->appMode != modeEdit);
 		scrActions["itemConvertToTextFrame"]->setEnabled(doc->appMode != modeEdit);
 		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
 		scrActions["toolsLinkTextFrame"]->setEnabled(false);
 		scrActions["toolsEditContents"]->setEnabled(currItem->ScaleType);
 		scrActions["toolsEditWithStoryEditor"]->setEnabled(false);
@@ -2820,6 +2826,8 @@
 			scrActions["itemConvertToPolygon"]->setEnabled(false);
 			scrActions["itemConvertToTextFrame"]->setEnabled(false);
 			scrActions["toolsUnlinkTextFrame"]->setEnabled(true);
+			scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(true);
+			scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(true);
 			// FIXME: once there's one itemtext per story, always enable editcontents
 			if ((currItem->prevInChain() != 0) && (currItem->itemText.length() == 0))
 				scrActions["toolsEditContents"]->setEnabled(false);
@@ -2830,6 +2838,8 @@
 		{
 			scrActions["toolsEditContents"]->setEnabled(true);
 			scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
+			scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+			scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
 		}
 		if (currItem->nextInChain() == 0)
 			scrActions["toolsLinkTextFrame"]->setEnabled(true);
@@ -2920,6 +2930,8 @@
 		scrActions["toolsEditWithStoryEditor"]->setEnabled(true);
 		scrActions["toolsLinkTextFrame"]->setEnabled(false);
 		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
 		if (doc->appMode == modeEdit)
 			setTBvals(currItem);
 		else
@@ -3012,6 +3024,8 @@
 		scrActions["toolsEditContents"]->setEnabled(false);
 		scrActions["toolsEditWithStoryEditor"]->setEnabled(false);
 		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
 		scrActions["toolsLinkTextFrame"]->setEnabled(false);
 //		if (SelectedType != 5)
 			scrActions["toolsRotate"]->setEnabled(true);
@@ -4666,6 +4680,8 @@
 		scrActions["toolsInsertRenderFrame"]->setEnabled(false);
 		scrActions["toolsLinkTextFrame"]->setEnabled(false);
 		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
 		scrActions["toolsMeasurements"]->setEnabled(false);
 		scrActions["toolsCopyProperties"]->setEnabled(false);
 		scrActions["toolsEyeDropper"]->setEnabled(false);
@@ -6169,6 +6185,8 @@
 		scrActions["toolsInsertRenderFrame"]->setEnabled(false);
 		scrActions["toolsLinkTextFrame"]->setEnabled(false);
 		scrActions["toolsUnlinkTextFrame"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(false);
+		scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(false);
 		scrActions["toolsMeasurements"]->setEnabled(false);
 		scrActions["toolsCopyProperties"]->setEnabled(false);
 		scrActions["toolsEyeDropper"]->setEnabled(false);
@@ -6267,6 +6285,8 @@
 	scrActions["toolsCopyProperties"]->setEnabled(true);
 	scrActions["toolsEyeDropper"]->setEnabled(true);
 	scrActions["toolsUnlinkTextFrame"]->setEnabled(true);
+	scrActions["toolsUnlinkTextFrameWithTextCopy"]->setEnabled(true);
+	scrActions["toolsUnlinkTextFrameWithTextCut"]->setEnabled(true);
 	scrActions["itemDelete"]->setEnabled(true);
 	scrActions["itemShapeEdit"]->setChecked(false);
 	layerPalette->setEnabled(true);
@@ -6353,6 +6373,8 @@
 	scrActions["toolsEditWithStoryEditor"]->setChecked(mode==modeStoryEditor);
 	scrActions["toolsLinkTextFrame"]->setChecked(mode==modeLinkFrames);
 	scrActions["toolsUnlinkTextFrame"]->setChecked(mode==modeUnlinkFrames);
+	scrActions["toolsUnlinkTextFrameWithTextCopy"]->setChecked(mode==modeUnlinkFrames);
+	scrActions["toolsUnlinkTextFrameWithTextCut"]->setChecked(mode==modeUnlinkFrames);
 	scrActions["toolsEyeDropper"]->setChecked(mode==modeEyeDropper);
 	scrActions["toolsMeasurements"]->setChecked(mode==modeMeasurementTool);
 	scrActions["toolsCopyProperties"]->setChecked(mode==modeCopyProperties);

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17565&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Jun 14 20:54:10 2012
@@ -15233,6 +15233,37 @@
 	}
 }
 
+void ScribusDoc::itemSelection_UnlinkTextFrameWithText( Selection *customSelection, bool cutText)
+{
+	Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
+	assert(itemSelection!=0);
+	uint selectedItemCount=itemSelection->count();
+	if (selectedItemCount == 0)
+		return;
+
+	if (selectedItemCount > 0)
+	{
+		for (uint i = 0; i < selectedItemCount; ++i)
+		{
+			PageItem *currItem = itemSelection->itemAt(i);
+			if (currItem!=NULL)
+			{
+				if (currItem->asTextFrame() && (currItem->nextInChain() != NULL || currItem->prevInChain() != NULL))
+					currItem->unlinkWithText(cutText);
+			}
+		}
+		regionsChanged()->update(QRectF());
+		changed();
+		itemSelection->itemAt(0)->emitAllToGUI();
+	}
+
+}
+
+void ScribusDoc::itemSelection_UnlinkTextFrameWithTextCut( Selection *customSelection)
+{
+	itemSelection_UnlinkTextFrameWithText(customSelection, true);
+}
+
 void ScribusDoc::itemSelection_UnWeld()
 {
 	PageItem *currItem;

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17565&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Thu Jun 14 20:54:10 2012
@@ -1403,6 +1403,8 @@
 	void itemSelection_Rotate(double angle, Selection* customSelection = 0);
 	void itemSelection_DoHyphenate();
 	void itemSelection_DoDeHyphenate();
+	void itemSelection_UnlinkTextFrameWithText(Selection *customSelection=0, bool cutText=false);
+	void itemSelection_UnlinkTextFrameWithTextCut(Selection *customSelection=0);
 	void itemSelection_SendToLayer(int layerID);
 	void itemSelection_SetImageOffset(double x, double y, Selection* customSelection=0);
 	void itemSelection_SetImageScale(double x, double y, Selection* customSelection=0);




More information about the scribus-commit mailing list