r19818 by craig - #12517: Apply patch for adding swap page capability to move page dialog

scribus-commit scribus-commit at lists.scribus.net
Thu Feb 12 14:52:51 UTC 2015


Author: craig
Date: Thu Feb 12 14:52:51 2015
New Revision: 19818

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19818
Log:
#12517: Apply patch for adding swap page capability to move page dialog

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/ui/movepage.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19818&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Feb 12 14:52:51 2015
@@ -6015,6 +6015,12 @@
 		int to = dia->getToPage();
 		int wie = dia->getWhere();
 		int wo = dia->getWherePage();
+		if (wie == 3)
+		{
+			doc->swapPages(from-1, wo-1);
+			updateGUIAfterPagesChanged();
+			return;
+		}
 		if ((wie < 2) && (from <= wo) && (wo <= to))
 			return;
 		if (wie == 2 && to == signed(doc->Pages->count()))

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19818&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Feb 12 14:52:51 2015
@@ -2830,6 +2830,13 @@
 	changed();
 }
 
+void ScribusDoc::swapPages(const int a, const int b)
+{
+	Pages->swap(a,b);
+	reformPages();
+	changed();
+}
+
 
 void ScribusDoc::movePage(const int fromPage, const int toPage, const int dest, const int position)
 {

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19818&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Thu Feb 12 14:52:51 2015
@@ -270,6 +270,12 @@
 	 * @param pageIndex 
 	 */
 	void setLocationBasedPageLRMargins(uint pageIndex);
+	/**
+	 * @brief Swap two pages
+	 * @param a page index
+	 * @param b page index
+	 */
+	void swapPages(const int a, const int b);
 	/**
 	 * @brief Move page(s) within the document
 	 * @param fromPage page index

Modified: trunk/Scribus/scribus/ui/movepage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19818&path=/trunk/Scribus/scribus/ui/movepage.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/movepage.cpp (original)
+++ trunk/Scribus/scribus/ui/movepage.cpp Thu Feb 12 14:52:51 2015
@@ -74,6 +74,10 @@
 	mvWhereData->addItem( tr("Before Page"));
 	mvWhereData->addItem( tr("After Page"));
 	mvWhereData->addItem( tr("At End"));
+	if (move)
+	{
+		mvWhereData->addItem( tr("Swap with Page"));
+	}
 	mvWhereData->setCurrentIndex(2);
 	mvWherePageData = new ScrSpinBox( this );
 	mvWherePageData->setMinimum(1);
@@ -115,7 +119,7 @@
 	if (move)
 	{
 		int pageNumber=static_cast<int>(fromPageData->value());
-		if (pageNumber > toPageData->value())
+		if (pageNumber > toPageData->value() || mvWhereData->currentIndex() == 3)
 			toPageData->setValue(pageNumber);
 		if ((pageNumber == 1) && (toPageData->value() == toPageData->maximum()))
 			toPageData->setValue(toPageData->maximum()-1);
@@ -133,7 +137,12 @@
 
 void MovePages::mvWherePageDataDisable(int index)
 {
-    mvWherePageData->setDisabled((index==2));
+	mvWherePageData->setDisabled((index==2));
+	if (index==3)
+	{
+		toPageData->setDisabled(true);
+		toPageData->setValue(fromPageData->value());
+	}
 }
 
 




More information about the scribus-commit mailing list