r19912 by craig - #12947: Fix paste contents as well as some clean up

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 12 19:22:45 UTC 2015


Author: craig
Date: Thu Mar 12 19:22:45 2015
New Revision: 19912

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19912
Log:
#12947: Fix paste contents as well as some clean up

Modified:
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/ui/pagepalette_pages.cpp

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19912&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp (original)
+++ trunk/Scribus/scribus/actionmanager.cpp Thu Mar 12 19:22:45 2015
@@ -290,7 +290,7 @@
 	(*scrActionGroups).insert("fontSize", new QActionGroup(mainWindow));
 	name="fontSizeOther";
 	scrActions->insert(name, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), (*scrActionGroups).value("fontSize"), -1));
-	connect( (*scrActions)["fontSizeOther"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemFSize(int)));
+	connect( (*scrActions)["fontSizeOther"], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemFontSize(int)));
 
 	int font_sizes[] = {7, 9, 10, 11, 12, 14, 18, 24, 36, 48, 60, 72};
 	size_t f_size = sizeof(font_sizes) / sizeof(*font_sizes);
@@ -299,7 +299,7 @@
 		QString fontSizeName=QString("fontSize%1").arg(font_sizes[s]);
 		scrActions->insert(fontSizeName, new ScrAction(ScrAction::DataInt, QPixmap(), QPixmap(), "", defaultKey(name), (*scrActionGroups).value("fontSize"), font_sizes[s]));
 		(*scrActions)[fontSizeName]->setToggleAction(true);
-		connect( (*scrActions)[fontSizeName], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemFSize(int)));
+		connect( (*scrActions)[fontSizeName], SIGNAL(triggeredData(int)), mainWindow, SLOT(setItemFontSize(int)));
 	}
 
 	//Alignment actions

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19912&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Mar 12 19:22:45 2015
@@ -6101,25 +6101,26 @@
 	doc->itemSetFont(nf);
 }
 
-void ScribusMainWindow::setItemFSize(int id)
-{
-	int c = id;
-	if (c != -1)
-		doc->itemSelection_SetFontSize(c*10);
+void ScribusMainWindow::setItemFontSize(int fontSize)
+{
+	int fs=fontSize;
+	if (fs != -1)
+		doc->itemSelection_SetFontSize(fs*10);
 	else
 	{
 		bool ok = false;
 		Query dia(this, "New", 1, tr("&Size:"), tr("Size"));
 		if (dia.exec())
 		{
-			c = qRound(dia.getEditText().toDouble(&ok));
-			if ((ok) && (c < 1025) && (c > 0))
-				doc->itemSelection_SetFontSize(c*10);
-		}
-	}
-	propertiesPalette->textPal->showFontSize(c*10);
-}
-
+			fs = qRound(dia.getEditText().toDouble(&ok));
+			if (ok && (fs < 1025) && (fs > 0))
+				doc->itemSelection_SetFontSize(fs*10);
+		}
+	}
+	propertiesPalette->textPal->showFontSize(fs*10);
+}
+
+/*
 //CB-->Doc partly
 void ScribusMainWindow::setItemShade(int id)
 {
@@ -6152,7 +6153,7 @@
 		}
 	}
 }
-
+*/
 //CB-->Doc
 void ScribusMainWindow::setNewAlignment(int a)
 {
@@ -8590,8 +8591,6 @@
 void ScribusMainWindow::slotEditCopyContents()
 {
 	PageItem *currItem = NULL;
-	contentsBuffer.contentsFileName = "";
-
 	if (!HaveDoc || (currItem = doc->m_Selection->itemAt(0)) == NULL)
 		return;
 	if (currItem->itemType() != PageItem::ImageFrame)
@@ -8600,6 +8599,7 @@
 	PageItem_ImageFrame* imageItem = currItem->asImageFrame();
 	if (!imageItem->imageIsAvailable)
 		return;
+	contentsBuffer.contentsFileName = "";
 	contentsBuffer.sourceType = PageItem::ImageFrame;
 	contentsBuffer.contentsFileName = imageItem->Pfile;
 	contentsBuffer.LocalScX = imageItem->imageXScale();
@@ -8617,9 +8617,9 @@
 
 void ScribusMainWindow::slotEditPasteContents(int absolute)
 {
+	if (!HaveDoc || contentsBuffer.contentsFileName.isEmpty())
+		return;
 	PageItem *currItem = NULL;
-	if (HaveDoc || contentsBuffer.contentsFileName.isEmpty())
-		return;
 	if ((currItem = doc->m_Selection->itemAt(0)) == NULL)
 		return;
 	if (contentsBuffer.sourceType != PageItem::ImageFrame || currItem->itemType() != PageItem::ImageFrame)

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19912&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Thu Mar 12 19:22:45 2015
@@ -462,12 +462,12 @@
 	/** Dokument ist geaendert worden */
 	void slotDocCh(bool reb = true);
 	/** Setzt die Abstufung */
-	void setItemShade(int id);
+	//void setItemShade(int id);
 	/** Setzt den Font */
 	/** Korrigiert das FontMenu */
 	void SetNewFont(const QString& nf);
 	/** Setz die Zeichensatzgroesse */
-	void setItemFSize(int id);
+	void setItemFontSize(int fontSize);
 	/** Color Replacement */
 	void slotReplaceColors();
 	/** Style Manager */

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19912&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Mar 12 19:22:45 2015
@@ -2371,7 +2371,7 @@
 	setCurrentPage(Pages->at(state->getInt("PAGE_NUM")));
 	if (isUndo)
 	{
-		//qDebug()<<"undo setting orientation to"<<state->getInt("OLD_PAGE_ORIENTATION");
+//		qDebug()<<"undo setting orientation to"<<state->getInt("OLD_PAGE_ORIENTATION");
 		changePageProperties(state->getDouble("OLD_PAGE_INITIALTOP"), state->getDouble("OLD_PAGE_INITIALBOTTOM"),
 				state->getDouble("OLD_PAGE_INITIALLEFT"), state->getDouble("OLD_PAGE_INITIALRIGHT"),
 				state->getDouble("OLD_PAGE_INITIALHEIGHT"), state->getDouble("OLD_PAGE_INITIALWIDTH"),
@@ -2380,7 +2380,7 @@
 	}
 	else
 	{
-		//qDebug()<<"redo setting orientation to"<<state->getInt("NEW_PAGE_ORIENTATION");
+//		qDebug()<<"redo setting orientation to"<<state->getInt("NEW_PAGE_ORIENTATION");
 		changePageProperties(state->getDouble("NEW_PAGE_INITIALTOP"), state->getDouble("NEW_PAGE_INITIALBOTTOM"),
 				state->getDouble("NEW_PAGE_INITIALLEFT"), state->getDouble("NEW_PAGE_INITIALRIGHT"),
 				state->getDouble("NEW_PAGE_INITIALHEIGHT"), state->getDouble("NEW_PAGE_INITIALWIDTH"),
@@ -2389,6 +2389,10 @@
 	}
 	setMasterPageMode(oldMPMode);
 	setCurrentPage(oldPage);
+//	m_View->reformPages();
+//	m_View->DrawNew();
+//	scMW()->pagePalette->Rebuild();
+//	scMW()->guidePalette->setupPage(false);
 }
 
 void ScribusDoc::restoreGrouping(SimpleState *state, bool isUndo)
@@ -6191,71 +6195,71 @@
 	currentXPos += (docPrefsData.docSetupPrefs.pageWidth+docPrefsData.displayPrefs.pageGapHorizontal) * counter;
 
 	lastYPos = Pages->at(0)->initialHeight();
-	ScPage* Seite;
+	ScPage* page;
 	uint docPageCount=Pages->count();
-	for (uint a = 0; a < docPageCount; ++a)
-	{
-		Seite = Pages->at(a);
-		oldPg.oldXO = Seite->xOffset();
-		oldPg.oldYO = Seite->yOffset();
-		oldPg.newPg = a;
-		pageTable.insert(Seite->pageNr(), oldPg);
-		Seite->setPageNr(a);
+	for (uint i = 0; i < docPageCount; ++i)
+	{
+		page = Pages->at(i);
+		oldPg.oldXO = page->xOffset();
+		oldPg.oldYO = page->yOffset();
+		oldPg.newPg = i;
+		pageTable.insert(page->pageNr(), oldPg);
+		page->setPageNr(i);
 		if (masterPageMode())
 		{
-			Seite->setXOffset(docPrefsData.displayPrefs.scratch.left());
-			Seite->setYOffset(docPrefsData.displayPrefs.scratch.top());
-			if (Seite->LeftPg == 0)
-			{
-				Seite->Margins.setRight(Seite->initialMargins.right());
-				Seite->Margins.setLeft(Seite->initialMargins.left());
-			}
-			else if ((Seite->LeftPg > 1) && (Seite->LeftPg < pageSets()[docPrefsData.docSetupPrefs.pagePositioning].Columns))
-			{
-				Seite->Margins.setLeft(Seite->initialMargins.left());
-				Seite->Margins.setRight(Seite->initialMargins.left());
+			page->setXOffset(docPrefsData.displayPrefs.scratch.left());
+			page->setYOffset(docPrefsData.displayPrefs.scratch.top());
+			if (page->LeftPg == 0)
+			{
+				page->Margins.setRight(page->initialMargins.right());
+				page->Margins.setLeft(page->initialMargins.left());
+			}
+			else if ((page->LeftPg > 1) && (page->LeftPg < pageSets()[docPrefsData.docSetupPrefs.pagePositioning].Columns))
+			{
+				page->Margins.setLeft(page->initialMargins.left());
+				page->Margins.setRight(page->initialMargins.left());
 			}
 			else
 			{
-				Seite->Margins.setLeft(Seite->initialMargins.right());
-				Seite->Margins.setRight(Seite->initialMargins.left());
+				page->Margins.setLeft(page->initialMargins.right());
+				page->Margins.setRight(page->initialMargins.left());
 			}
 		}
 		else
 		{
-			Seite->setWidth(Seite->initialWidth());
-			Seite->setHeight(Seite->initialHeight());
-			Seite->setXOffset(currentXPos);
-			Seite->setYOffset(currentYPos);
+			page->setWidth(page->initialWidth());
+			page->setHeight(page->initialHeight());
+			page->setXOffset(currentXPos);
+			page->setYOffset(currentYPos);
 			if (counter < pageSets()[docPrefsData.docSetupPrefs.pagePositioning].Columns-1)
 			{
 //				currentXPos += Seite->width() + pageSets[currentPageLayout].GapHorizontal;
-				currentXPos += Seite->width() + docPrefsData.displayPrefs.pageGapHorizontal;
-				lastYPos = qMax(lastYPos, Seite->height());
+				currentXPos += page->width() + docPrefsData.displayPrefs.pageGapHorizontal;
+				lastYPos = qMax(lastYPos, page->height());
 				if (counter == 0)
 				{
-					Seite->Margins.setLeft(Seite->initialMargins.right());
-					Seite->Margins.setRight(Seite->initialMargins.left());
+					page->Margins.setLeft(page->initialMargins.right());
+					page->Margins.setRight(page->initialMargins.left());
 				}
 				else
 				{
-					Seite->Margins.setLeft(Seite->initialMargins.left());
-					Seite->Margins.setRight(Seite->initialMargins.left());
+					page->Margins.setLeft(page->initialMargins.left());
+					page->Margins.setRight(page->initialMargins.left());
 				}
 			}
 			else
 			{
 				currentXPos = docPrefsData.displayPrefs.scratch.left();
 				if (pageSets()[docPrefsData.docSetupPrefs.pagePositioning].Columns > 1)
-					currentYPos += qMax(lastYPos, Seite->height())+docPrefsData.displayPrefs.pageGapVertical;
+					currentYPos += qMax(lastYPos, page->height())+docPrefsData.displayPrefs.pageGapVertical;
 //					currentYPos += qMax(lastYPos, Seite->height())+pageSets[currentPageLayout].GapVertical;
 				else
-					currentYPos += Seite->height()+docPrefsData.displayPrefs.pageGapVertical;
+					currentYPos += page->height()+docPrefsData.displayPrefs.pageGapVertical;
 //					currentYPos += Seite->height()+pageSets[currentPageLayout].GapVertical;
 //				lastYPos = qMax(lastYPos, Seite->height());
 				lastYPos = 0;
-				Seite->Margins.setRight(Seite->initialMargins.right());
-				Seite->Margins.setLeft(Seite->initialMargins.left());
+				page->Margins.setRight(page->initialMargins.right());
+				page->Margins.setLeft(page->initialMargins.left());
 			}
 			counter++;
 			if (counter > pageSets()[docPrefsData.docSetupPrefs.pagePositioning].Columns-1)
@@ -6270,10 +6274,10 @@
 				}
 			}
 		}
-		Seite->Margins.setTop(Seite->initialMargins.top());
-		Seite->Margins.setBottom(Seite->initialMargins.bottom());
-		maxXPos = qMax(maxXPos, Seite->xOffset()+Seite->width()+docPrefsData.displayPrefs.scratch.right());
-		maxYPos = qMax(maxYPos, Seite->yOffset()+Seite->height()+docPrefsData.displayPrefs.scratch.bottom());
+		page->Margins.setTop(page->initialMargins.top());
+		page->Margins.setBottom(page->initialMargins.bottom());
+		maxXPos = qMax(maxXPos, page->xOffset()+page->width()+docPrefsData.displayPrefs.scratch.right());
+		maxYPos = qMax(maxYPos, page->yOffset()+page->height()+docPrefsData.displayPrefs.scratch.bottom());
 	}
 	if (!isLoading())
 	{

Modified: trunk/Scribus/scribus/ui/pagepalette_pages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19912&path=/trunk/Scribus/scribus/ui/pagepalette_pages.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_pages.cpp (original)
+++ trunk/Scribus/scribus/ui/pagepalette_pages.cpp Thu Mar 12 19:22:45 2015
@@ -145,8 +145,6 @@
 	currView->reformPages();
 	rebuildPages();
 	currView->DrawNew();
-//CB done by doc::reformpages
-// 	currView->Doc->setModified(true);
 }
 
 void PagePalette_Pages::pageView_gotoPage(int r, int c, int b)
@@ -175,20 +173,15 @@
 	currView->DrawNew();
 	currView->GotoPage(currView->Doc->currentPageNumber());
 	rebuildPages();
-//CB done by doc::reformpages
-//	currView->Doc->setModified(true);
 }
 
 void PagePalette_Pages::handleFirstPage(int fp)
 {
-//	currView->Doc->pageSets()[currView->Doc->currentPageLayout].FirstPage = fp;
 	currView->Doc->setPageSetFirstPage(currView->Doc->pagePositioning(), fp);
 	currView->reformPages();
 	currView->DrawNew();
 	currView->GotoPage(currView->Doc->currentPageNumber());
 	rebuildPages();
-//CB done by doc::reformpages
-// 	currView->Doc->setModified(true);
 }
 
 void PagePalette_Pages::rebuildMasters()




More information about the scribus-commit mailing list