r22271 by craig -

scribus-commit scribus-commit at lists.scribus.net
Sun Dec 24 23:45:22 UTC 2017


Author: craig
Date: Sun Dec 24 23:45:22 2017
New Revision: 22271

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22271
Log:
Some code cleanup

Modified:
    trunk/Scribus/scribus/actionmanager.cpp
    trunk/Scribus/scribus/appmodehelper.cpp
    trunk/Scribus/scribus/guidemanagercore.h
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/scpainter.cpp
    trunk/Scribus/scribus/scpainter.h
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/selection.cpp
    trunk/Scribus/scribus/text/storytext.cpp
    trunk/Scribus/scribus/text/storytext.h
    trunk/Scribus/scribus/ui/outlinepalette.cpp
    trunk/Scribus/scribus/ui/outlinepalette.h
    trunk/Scribus/scribus/util.cpp
    trunk/Scribus/scribus/util_formats.cpp
    trunk/Scribus/scribus/util_math.cpp

Modified: trunk/Scribus/scribus/actionmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/actionmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/actionmanager.cpp	(original)
+++ trunk/Scribus/scribus/actionmanager.cpp	Sun Dec 24 23:45:22 2017
@@ -823,6 +823,9 @@
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="toolsToolbarView";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+	name="toolsTestXYZ";
+	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
+
 
 	//toolbar only items
 	name="toolsSelect";
@@ -908,7 +911,7 @@
 	(*scrActions)["toolsAlignDistribute"]->setShortcutContext(Qt::ApplicationShortcut);
 	(*scrActions)["toolsSymbols"]->setShortcutContext(Qt::ApplicationShortcut);
 	(*scrActions)["toolsInline"]->setShortcutContext(Qt::ApplicationShortcut);
-
+	(*scrActions)["toolsTestXYZ"]->setShortcutContext(Qt::ApplicationShortcut);
 
 	(*scrActions)["toolsProperties"]->setToggleAction(true);
 	(*scrActions)["toolsText"]->setToggleAction(true);
@@ -922,6 +925,7 @@
 	(*scrActions)["toolsActionHistory"]->setToggleAction(true);
 	(*scrActions)["toolsPreflightVerifier"]->setToggleAction(true);
 	(*scrActions)["toolsAlignDistribute"]->setToggleAction(true);
+	(*scrActions)["toolsTestXYZ"]->setToggleAction(true);
 	(*scrActions)["toolsSymbols"]->setToggleAction(true);
 	(*scrActions)["toolsInline"]->setToggleAction(true);
 	(*scrActions)["toolsToolbarTools"]->setToggleAction(true);
@@ -964,12 +968,9 @@
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name="extrasUpdateDocument";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
-	//name="extrasTestQTQuick2_1";
-	//scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	connect( (*scrActions)["extrasManageImages"], SIGNAL(triggered()), mainWindow, SLOT(StatusPic()) );
 	connect( (*scrActions)["extrasGenerateTableOfContents"], SIGNAL(triggered()), mainWindow, SLOT(generateTableOfContents()) );
 	connect( (*scrActions)["extrasUpdateDocument"], SIGNAL(triggered()), mainWindow, SLOT(updateDocument()) );
-	//connect( (*scrActions)["extrasTestQTQuick2_1"], SIGNAL(triggered()), mainWindow, SLOT(testQTQuick2_1()) );
 }
 
 
@@ -1691,6 +1692,7 @@
 	(*scrActions)["toolsActionHistory"]->setTexts( tr("Action &History"));
 	(*scrActions)["toolsPreflightVerifier"]->setTexts( tr("Preflight &Verifier"));
 	(*scrActions)["toolsAlignDistribute"]->setTexts( tr("&Align and Distribute"));
+	(*scrActions)["toolsTestXYZ"]->setTexts( tr("&Test XYZ"));
 	(*scrActions)["toolsSymbols"]->setTexts( tr("Symbols"));
 	(*scrActions)["toolsInline"]->setTexts( tr("Inline Items"));
 	(*scrActions)["toolsToolbarTools"]->setTexts( tr("&Tools"));
@@ -2364,6 +2366,7 @@
 		<< "toolsActionHistory"
 		<< "toolsPreflightVerifier"
 		<< "toolsAlignDistribute"
+		<< "toolsTestXYZ"
 		<< "toolsSymbols"
 		<< "toolsInline"
 		<< "toolsToolbarTools"

Modified: trunk/Scribus/scribus/appmodehelper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/appmodehelper.cpp
==============================================================================
--- trunk/Scribus/scribus/appmodehelper.cpp	(original)
+++ trunk/Scribus/scribus/appmodehelper.cpp	Sun Dec 24 23:45:22 2017
@@ -439,7 +439,7 @@
 {
 	int SelectedType = -1;
 	PageItem *currItem = NULL;
-	const uint docSelectionCount = doc->m_Selection->count();
+	const int docSelectionCount = doc->m_Selection->count();
 	if (docSelectionCount > 0)
 	{
 		currItem = doc->m_Selection->itemAt(0);
@@ -843,7 +843,7 @@
 		(*a_scrActions)["editSearchReplace"]->setEnabled(false);
 
 		bool hPoly = false;
-		for (uint i=0; i < docSelectionCount; ++i)
+		for (int i=0; i < docSelectionCount; ++i)
 		{
 			PageItem* it=doc->m_Selection->itemAt(i);
 			if ((it->asPolygon()) || (it->asPolyLine()))
@@ -939,9 +939,9 @@
 			{
 				bool haveSameParent = true;
 				PageItem *firstItem = doc->m_Selection->itemAt(0);
-				for (uint a = 1; a < docSelectionCount; ++a)
+				for (int i = 1; i < docSelectionCount; ++i)
 				{
-					if (doc->m_Selection->itemAt(a)->Parent != firstItem->Parent)
+					if (doc->m_Selection->itemAt(i)->Parent != firstItem->Parent)
 					{
 						haveSameParent = false;
 						break;

Modified: trunk/Scribus/scribus/guidemanagercore.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/guidemanagercore.h
==============================================================================
--- trunk/Scribus/scribus/guidemanagercore.h	(original)
+++ trunk/Scribus/scribus/guidemanagercore.h	Sun Dec 24 23:45:22 2017
@@ -78,29 +78,29 @@
 	QPair<double, double> bottomRight(double x, double y);// const;
 
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	int horizontalAutoCount() { return m_horizontalAutoCount; };
+	int horizontalAutoCount() { return m_horizontalAutoCount; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	void setHorizontalAutoCount(int val) { m_horizontalAutoCount = val; };
+	void setHorizontalAutoCount(int val) { m_horizontalAutoCount = val; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	int verticalAutoCount() { return m_verticalAutoCount; };
+	int verticalAutoCount() { return m_verticalAutoCount; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	void setVerticalAutoCount(int val) { m_verticalAutoCount = val; };
+	void setVerticalAutoCount(int val) { m_verticalAutoCount = val; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	double horizontalAutoGap(){ return m_horizontalAutoGap; };
+	double horizontalAutoGap(){ return m_horizontalAutoGap; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	double verticalAutoGap(){return m_verticalAutoGap; };
+	double verticalAutoGap(){return m_verticalAutoGap; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	void setHorizontalAutoGap(double gap){ m_horizontalAutoGap = gap; };
+	void setHorizontalAutoGap(double gap){ m_horizontalAutoGap = gap; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	void setVerticalAutoGap(double gap){ m_verticalAutoGap = gap; };
+	void setVerticalAutoGap(double gap){ m_verticalAutoGap = gap; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	int horizontalAutoRefer() { return m_horizontalAutoRefer; };
+	int horizontalAutoRefer() { return m_horizontalAutoRefer; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	void setHorizontalAutoRefer(int val) { m_horizontalAutoRefer = val; };
+	void setHorizontalAutoRefer(int val) { m_horizontalAutoRefer = val; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	int verticalAutoRefer() { return m_verticalAutoRefer; };
+	int verticalAutoRefer() { return m_verticalAutoRefer; }
 	//! \brief Properties for Auto guides remembrance. See GuideManager.
-	void setVerticalAutoRefer(int val) { m_verticalAutoRefer = val; };
+	void setVerticalAutoRefer(int val) { m_verticalAutoRefer = val; }
 
 	/*! \brief Selection/group coordinates
 	It's used to simulate the original selection "freezed in time"

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Sun Dec 24 23:45:22 2017
@@ -3285,7 +3285,7 @@
 			continue;
 		if (isFirst)
 		{
-			if (actualStop != 0)
+			if (actualStop != 0.0)
 			{
 				gradient.addStop(cstops.at(cst)->color, 0, 0, cstops.at(cst)->opacity, cstops.at(cst)->name, cstops.at(cst)->shade);
 				if (actualStop <= 0.25)
@@ -3421,7 +3421,7 @@
 	mgP3.color.setAlphaF(mgP3.transparency);
 	mgList2.append(mgP3);
 	startAngle -= stepAngle;
-	for (uint rst = 2; rst < gradient.Stops(); ++rst)
+	for (int rst = 2; rst < gradient.Stops(); ++rst)
 	{
 		stepAngle = 360 * (rstops.at(rst)->rampPoint - rstops.at(rst-1)->rampPoint);
 		if (stepAngle <= 0)

Modified: trunk/Scribus/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/scpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainter.cpp	(original)
+++ trunk/Scribus/scribus/scpainter.cpp	Sun Dec 24 23:45:22 2017
@@ -22,8 +22,10 @@
 #include <math.h>
 #include <QDebug>
 
-ScPainter::ScPainter( QImage *target, unsigned int w, unsigned int h, double transparency, int blendmode )
-{
+ScPainter::ScPainter( QImage *target, int w, int h, double transparency, int blendmode )
+{
+	Q_ASSERT(w>=0);
+	Q_ASSERT(h>=0);
 	m_width = w;
 	m_height= h;
 	m_stroke = QColor(0,0,0);
@@ -295,13 +297,13 @@
 	stroke_gradient.setVector(vec);
 	stroke_gradient.setFocalPoint(foc);
 	m_gradientScale = scale;
-	if (skew == 90)
+	if (skew == 90.0)
 		m_gradientSkew = 1;
-	else if (skew == 180)
+	else if (skew == 180.0)
 		m_gradientSkew = 0;
-	else if (skew == 270)
+	else if (skew == 270.0)
 		m_gradientSkew = -1;
-	else if (skew == 360)
+	else if (skew == 360.0)
 		m_gradientSkew = 0;
 	else
 		m_gradientSkew = tan(M_PI / 180.0 * skew);
@@ -319,13 +321,13 @@
 	mask_gradient.setVector(vec);
 	mask_gradient.setFocalPoint(foc);
 	m_mask_gradientScale = scale;
-	if (skew == 90)
+	if (skew == 90.0)
 		m_mask_gradientSkew = 1;
-	else if (skew == 180)
+	else if (skew == 180.0)
 		m_mask_gradientSkew = 0;
-	else if (skew == 270)
+	else if (skew == 270.0)
 		m_mask_gradientSkew = -1;
-	else if (skew == 360)
+	else if (skew == 360.0)
 		m_mask_gradientSkew = 0;
 	else
 		m_mask_gradientSkew = tan(M_PI / 180.0 * skew);

Modified: trunk/Scribus/scribus/scpainter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/scpainter.h
==============================================================================
--- trunk/Scribus/scribus/scpainter.h	(original)
+++ trunk/Scribus/scribus/scpainter.h	Sun Dec 24 23:45:22 2017
@@ -34,7 +34,7 @@
 class SCRIBUS_API ScPainter
 {
 public:
-	ScPainter( QImage *target, unsigned int w, unsigned int h, double transparency = 1.0, int blendmode = 0 );
+	ScPainter(QImage *target, int w, int h, double transparency = 1.0, int blendmode = 0 );
 	virtual ~ScPainter();
 	enum FillMode { None, Solid, Gradient, Pattern, Hatch };
 	virtual void beginLayer(double transparency, int blendmode, FPointArray *clipArray = 0);

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp	(original)
+++ trunk/Scribus/scribus/scribusview.cpp	Sun Dec 24 23:45:22 2017
@@ -856,7 +856,7 @@
 		activateWindow();
 		if (!m_ScMW->scriptIsRunning())
 			raise();
-		m_ScMW->newActWin(((ScribusWin*)(Doc->WinHan))->getSubWin());
+		m_ScMW->newActWin((dynamic_cast<ScribusWin*>(Doc->WinHan))->getSubWin());
 		updateContents();
 		QString patternVal = e->mimeData()->data("text/symbol");
 		Doc->m_Selection->delaySignalsOn();
@@ -905,7 +905,7 @@
 				activateWindow();
 				if (!m_ScMW->scriptIsRunning())
 					raise();
-				m_ScMW->newActWin(((ScribusWin*)(Doc->WinHan))->getSubWin());
+				m_ScMW->newActWin((dynamic_cast<ScribusWin*>(Doc->WinHan))->getSubWin());
 				updateContents();
 				QString patternVal = e->mimeData()->data("text/inline");
 				int id = patternVal.toInt();
@@ -941,7 +941,7 @@
 	activateWindow();
 	if (!m_ScMW->scriptIsRunning())
 		raise();
-	m_ScMW->newActWin(((ScribusWin*)(Doc->WinHan))->getSubWin());
+	m_ScMW->newActWin((dynamic_cast<ScribusWin*>(Doc->WinHan))->getSubWin());
 	updateContents();
 	//>>
 	QFileInfo fi;
@@ -1082,7 +1082,7 @@
 	else
 	{
 		Deselect(true);
-		uint oldDocItemCount = Doc->Items->count();
+		int oldDocItemCount = Doc->Items->count();
 		if (((!img) || (vectorFile)) && (Doc->DraggedElem == 0))
 		{
 			activeTransaction = undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::Create, "", Um::ICreate);
@@ -1330,9 +1330,9 @@
 	}
 	if (!Doc->masterPageMode())
 	{
-		uint docPagesCount=Doc->Pages->count();
-		uint docCurrPageNo=Doc->currentPageNumber();
-		for (uint i = 0; i < docPagesCount; ++i)
+		int docPagesCount=Doc->Pages->count();
+		int docCurrPageNo=Doc->currentPageNumber();
+		for (int i = 0; i < docPagesCount; ++i)
 		{
 			double x = Doc->Pages->at(i)->xOffset();
 			double y = Doc->Pages->at(i)->yOffset();
@@ -2049,7 +2049,7 @@
 {
 	Selection* itemSelection = (customSelection!=0) ? customSelection : Doc->m_Selection;
 	assert(itemSelection!=0);
-	uint selectedItemCount=itemSelection->count();
+	int selectedItemCount=itemSelection->count();
 	Q_ASSERT(selectedItemCount > 0);
 	if (!m_groupTransaction)
 	{
@@ -2061,7 +2061,7 @@
 			if (selectedItemCount <= Um::ItemsInvolvedLimit)
 			{
 				tooltip = Um::ItemsInvolved + "\n";
-				for (uint i = 0; i < selectedItemCount; ++i)
+				for (int i = 0; i < selectedItemCount; ++i)
 					tooltip += "\t" + itemSelection->itemAt(i)->getUName() + "\n";
 			}
 			else
@@ -2150,17 +2150,17 @@
 	{
 		QList<int> pag;
 		pag.clear();
-		uint docPageCount=Doc->Pages->count();
-		for (uint a = 0; a < docPageCount; ++a)
-		{
-			int xs = static_cast<int>(Doc->Pages->at(a)->xOffset() * m_canvas->scale());
-			int ys = static_cast<int>(Doc->Pages->at(a)->yOffset() * m_canvas->scale());
-			int ws = static_cast<int>(Doc->Pages->at(a)->width() * m_canvas->scale());
-			int hs = static_cast<int>(Doc->Pages->at(a)->height() * m_canvas->scale());
+		int docPageCount=Doc->Pages->count();
+		for (int i = 0; i < docPageCount; ++i)
+		{
+			int xs = static_cast<int>(Doc->Pages->at(i)->xOffset() * m_canvas->scale());
+			int ys = static_cast<int>(Doc->Pages->at(i)->yOffset() * m_canvas->scale());
+			int ws = static_cast<int>(Doc->Pages->at(i)->width() * m_canvas->scale());
+			int hs = static_cast<int>(Doc->Pages->at(i)->height() * m_canvas->scale());
 			QRect drawRect = QRect(x, y, visibleWidth(), visibleHeight());
 //			drawRect.moveBy(qRound(-Doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(-Doc->minCanvasCoordinate.y() * m_canvas->scale()));
 			if (drawRect.intersects(QRect(xs, ys, ws, hs)))
-				pag.append(a+1);
+				pag.append(i+1);
 		}
 		if (!pag.isEmpty())
 			newStatusBarText=( tr("Page %1 to %2").arg(pag.first()).arg(pag.last()));
@@ -3114,7 +3114,7 @@
 			transform.translate(0, -(fontSize() * gl.scaleV));
 			transform.scale(gl.scaleH * fontSize() / 10.0, gl.scaleV * fontSize() / 10.0);
 			outline.map(transform);
-			uint z = m_view->Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, m_item->xPos(), m_item->yPos(), m_item->width(), m_item->height(), 0, fillColor().color, CommonStrings::None);
+			int z = m_view->Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, m_item->xPos(), m_item->yPos(), m_item->width(), m_item->height(), 0, fillColor().color, CommonStrings::None);
 			PageItem* item = m_view->Doc->Items->at(z);
 			m_view->undoManager->setUndoEnabled(false);
 			item->setTextFlowMode(m_item->textFlowMode());
@@ -3161,7 +3161,7 @@
 			transform.translate(0, -(fontSize() * gl.scaleV));
 			transform.scale(gl.scaleH * fontSize() / 10.0, gl.scaleV * fontSize() / 10.0);
 			outline.map(transform);
-			uint z = m_view->Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, m_item->xPos(), m_item->yPos(), m_item->width(), m_item->height(), strokeWidth(), fillColor().color, strokeColor().color);
+			int z = m_view->Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, m_item->xPos(), m_item->yPos(), m_item->width(), m_item->height(), strokeWidth(), fillColor().color, strokeColor().color);
 			PageItem* item = m_view->Doc->Items->at(z);
 			m_view->undoManager->setUndoEnabled(false);
 			item->setTextFlowMode(m_item->textFlowMode());
@@ -3192,7 +3192,7 @@
 	{
 		QTransform transform = matrix();
 		transform.translate(x(), y());
-		uint z = m_view->Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, m_item->xPos(), m_item->yPos(), m_item->width(), m_item->height(), m_item->lineWidth(), m_item->lineColor(), m_item->fillColor());
+		int z = m_view->Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, m_item->xPos(), m_item->yPos(), m_item->width(), m_item->height(), m_item->lineWidth(), m_item->lineColor(), m_item->fillColor());
 		PageItem* item = m_view->Doc->Items->at(z);
 		m_view->undoManager->setUndoEnabled(false);
 		item->setTextFlowMode(m_item->textFlowMode());
@@ -3248,12 +3248,12 @@
 	}
 	QList<PageItem*> delItems,newGroupedItems;
 	newGroupedItems.clear();
-	uint selectedItemCount = tmpSelection.count();
+	int selectedItemCount = tmpSelection.count();
 	if (selectedItemCount != 0)
 	{
 		UndoTransaction trans(undoManager->beginTransaction(currItem->getUName(), currItem->getUPixmap(), Um::ToOutlines, "", 0));
-		uint offset=0;
-		for(uint i=0; i<selectedItemCount; ++i)
+		int offset=0;
+		for(int i=0; i<selectedItemCount; ++i)
 		{
 			PageItem *currItem = tmpSelection.itemAt(offset);
 			bool cont=false;
@@ -3275,7 +3275,7 @@
 			currItem->textLayout.render(&p);
 			if ((currItem->asPathText()) && (currItem->PoShow))
 			{
-				uint z = Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, currItem->xPos(), currItem->yPos(), currItem->width(), currItem->height(), currItem->lineWidth(), CommonStrings::None, currItem->lineColor());
+				int z = Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, currItem->xPos(), currItem->yPos(), currItem->width(), currItem->height(), currItem->lineWidth(), CommonStrings::None, currItem->lineColor());
 				PageItem *bb = Doc->Items->at(z);
 				undoManager->setUndoEnabled(false);
 				bb->PoLine = currItem->PoLine.copy();
@@ -3422,7 +3422,7 @@
 	{
 		//qDebug(QString("%1 %2").arg((int)m_ScMW).arg(m_ScMW->scrActions.contains("editActionMode")));
 		m_ScMW->scrActions["editActionMode"]->setChecked(true);
-		uint docSelectionCount=Doc->m_Selection->count();
+		int docSelectionCount=Doc->m_Selection->count();
 		if (docSelectionCount == 1)
 			undoManager->showObject(Doc->m_Selection->itemAt(0)->getUId());
 		else if (docSelectionCount > 1)
@@ -3441,7 +3441,7 @@
 			undoManager->showObject(Um::GLOBAL_UNDO_MODE);
 		else
 		{
-			uint docSelectionCount=Doc->m_Selection->count();
+			int docSelectionCount=Doc->m_Selection->count();
 			if (docSelectionCount == 1)
 				undoManager->showObject(Doc->m_Selection->itemAt(0)->getUId());
 			else if (docSelectionCount > 1)

Modified: trunk/Scribus/scribus/selection.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/selection.cpp
==============================================================================
--- trunk/Scribus/scribus/selection.cpp	(original)
+++ trunk/Scribus/scribus/selection.cpp	Sun Dec 24 23:45:22 2017
@@ -190,7 +190,7 @@
 	return true;
 }
 
-bool Selection::addItem(PageItem *item, bool ignoreGUI)
+bool Selection::addItem(PageItem *item, bool /*ignoreGUI*/)
 {
 	if (item==NULL)
 		return false;
@@ -210,7 +210,7 @@
 	return false;
 }
 
-bool Selection::prependItem(PageItem *item, bool doEmit)
+bool Selection::prependItem(PageItem *item, bool /*doEmit*/)
 {
 	if (item==NULL)
 		return false;
@@ -376,7 +376,7 @@
 void Selection::setGroupRect()
 {
 	PageItem *currItem;
-	uint selectedItemCount = count();
+	int selectedItemCount = count();
 	if (selectedItemCount == 0)
 	{
 		m_groupX   = m_groupY   = m_groupW   = m_groupH   = 0;
@@ -392,10 +392,10 @@
 	double vmaxx = -std::numeric_limits<double>::max();
 	double vmaxy = -std::numeric_limits<double>::max();
 
-	for (uint gc = 0; gc < selectedItemCount; ++gc)
-	{
-		currItem = itemAt(gc);
-		if (currItem->rotation() != 0)
+	for (int i = 0; i < selectedItemCount; ++i)
+	{
+		currItem = itemAt(i);
+		if (currItem->rotation() != 0.0)
 		{
 			QRectF itRect(currItem->getBoundingRect());
 			minx = qMin(minx, itRect.x());

Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp	(original)
+++ trunk/Scribus/scribus/text/storytext.cpp	Sun Dec 24 23:45:22 2017
@@ -1773,8 +1773,9 @@
 }
 
 
-void StoryText::select(int pos, uint len, bool on)
-{
+void StoryText::select(int pos, int len, bool on)
+{
+	Q_ASSERT(len>=0);
 	if (pos < 0)
 		pos += length();
 

Modified: trunk/Scribus/scribus/text/storytext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/text/storytext.h
==============================================================================
--- trunk/Scribus/scribus/text/storytext.h	(original)
+++ trunk/Scribus/scribus/text/storytext.h	Sun Dec 24 23:45:22 2017
@@ -242,7 +242,7 @@
  	void removeSelection();
  	void extendSelection(int oldPos, int newPos);
 	int selectWord(int pos);
-	void select(int pos, uint len, bool on = true);
+	void select(int pos, int len, bool on = true);
  	bool selected(int pos) const;
 	int startOfSelection() const;
 	int endOfSelection() const;

Modified: trunk/Scribus/scribus/ui/outlinepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/ui/outlinepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.cpp	(original)
+++ trunk/Scribus/scribus/ui/outlinepalette.cpp	Sun Dec 24 23:45:22 2017
@@ -93,12 +93,12 @@
 	{
 		id = idxs.at(i);
 		QTreeWidgetItem* it = id.isValid() ? itemFromIndex(id) : 0;
-		OutlineTreeItem *itemPar = it ? (OutlineTreeItem*) it->parent() : 0;
+		OutlineTreeItem *itemPar = it ? dynamic_cast<OutlineTreeItem*>(it->parent()) : 0;
 		while (itemPar && (itemPar->type != 2))
 		{
 			if (itemPar->type == 5)
 				haveLayers = true;
-			itemPar = (OutlineTreeItem*) itemPar->parent();
+			itemPar = dynamic_cast<OutlineTreeItem*>(itemPar->parent());
 		}
 		its.append(it);
 		itemPars.append(itemPar);
@@ -113,22 +113,22 @@
 		if (it == NULL)
 			continue;
 		OutlineTreeItem *itemPar = itemPars.at(i);
-		OutlineTreeItem *item = (OutlineTreeItem*) it;
-		OutlineTreeItem *itemPl = (OutlineTreeItem*)it->parent();
+		OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(it);
+		OutlineTreeItem *itemPl = dynamic_cast<OutlineTreeItem*>(it->parent());
 		OutlineTreeItem *itemPg;
 		if (itemPl->type == 5)
 		{
-			itemPg = (OutlineTreeItem*)it->parent()->parent();
+			itemPg = dynamic_cast<OutlineTreeItem*>(it->parent()->parent());
 		}
 		else if (itemPl->type == 2)
 		{
-			itemPg = (OutlineTreeItem*)it->parent();
+			itemPg = dynamic_cast<OutlineTreeItem*>(it->parent());
 			if (haveLayers)
 			{
-				itemPl = (OutlineTreeItem*) itemPg->child(0);
+				itemPl = dynamic_cast<OutlineTreeItem*>(itemPg->child(0));
 				for (int j = 0; j < itemPg->childCount(); ++j)
 				{
-					OutlineTreeItem* childItem = (OutlineTreeItem*) itemPg->child(j);
+					OutlineTreeItem* childItem = dynamic_cast<OutlineTreeItem*>(itemPg->child(j));
 					if (item->PageItemObject->LayerID == childItem->LayerID)
 					{
 						itemPl = childItem;
@@ -144,12 +144,12 @@
 			itemPg = (OutlineTreeItem*)it->parent();
 			while (itemPg->type != 2)
 			{
-				itemPg = (OutlineTreeItem*)itemPg->parent();
+				itemPg = dynamic_cast<OutlineTreeItem*>(itemPg->parent());
 			}
 		}
 		if (itemPl->indexOfChild(it) != itemPl->childCount() - 1)
 		{
-			OutlineTreeItem *itemBe = (OutlineTreeItem*)itemPl->child(itemPl->indexOfChild(it) + 1);
+			OutlineTreeItem *itemBe = dynamic_cast<OutlineTreeItem*>(itemPl->child(itemPl->indexOfChild(it) + 1));
 			if ((itemBe->type == 1) || (itemBe->type == 3) || (itemBe->type == 4))
 			{
 				if (item->PageItemObject->isGroupChild())
@@ -212,7 +212,7 @@
 			}
 			else
 			{
-				OutlineTreeItem *itemBe = (OutlineTreeItem*)it->parent();
+				OutlineTreeItem *itemBe = dynamic_cast<OutlineTreeItem*>(it->parent());
 				if ((itemBe->type == 1) || (itemBe->type == 3) || (itemBe->type == 4))
 				{
 					if (item->PageItemObject->isGroupChild())
@@ -256,7 +256,7 @@
 		{
 			if (twItem != 0)
 			{
-				OutlineTreeItem *item = (OutlineTreeItem*)twItem;
+				OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(twItem);
 				if (item)
 				{
 					switch (item->type)
@@ -295,7 +295,7 @@
 		QTreeWidgetItem* it = itemAt(helpEvent->pos());
  		if (it != 0)
  		{
- 			OutlineTreeItem *item = (OutlineTreeItem*)it;
+			OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(it);
  			if (item != NULL)
  			{
  				QString tipText("");
@@ -541,7 +541,7 @@
 		slotMultiSelect();
 	if (currDoc->drawAsPreview)
 		return;
-	OutlineTreeItem *item = (OutlineTreeItem*)ite;
+	OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(ite);
 	
 	if (item != NULL)
 	{
@@ -643,7 +643,7 @@
 	if (!m_MainWindow || m_MainWindow->scriptIsRunning())
 		return;
 	disconnect(reportDisplay, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(slotDoRename(QTreeWidgetItem*, int)));
-	OutlineTreeItem *item = (OutlineTreeItem*)ite;
+	OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(ite);
 	if (item != NULL)
 	{
 		if ((item->type == 1) || (item->type == 3) || (item->type == 4))
@@ -707,7 +707,7 @@
 			QTreeWidgetItemIterator it( reportDisplay );
 			while ( (*it) )
 			{
-				item = (OutlineTreeItem*)(*it);
+				item = dynamic_cast<OutlineTreeItem*>(*it);
 				if ((item->type == 0) && (item->PageObject->pageNr() == SNr))
 				{
 					retVal = (*it);
@@ -721,7 +721,7 @@
 			QTreeWidgetItemIterator it( reportDisplay );
 			while ( (*it) )
 			{
-				item = (OutlineTreeItem*)(*it);
+				item = dynamic_cast<OutlineTreeItem*>(*it);
 				if ((item->type == 1) && (item->PageItemObject == Nr))
 				{
 					retVal = (*it);
@@ -738,7 +738,7 @@
 			QTreeWidgetItemIterator it( reportDisplay );
 			while ( (*it) )
 			{
-				item = (OutlineTreeItem*)(*it);
+				item = dynamic_cast<OutlineTreeItem*>(*it);
 				if ((item->type == 2) && (item->PageObject->pageNr() == SNr))
 				{
 					retVal = (*it);
@@ -752,7 +752,7 @@
 			QTreeWidgetItemIterator it( reportDisplay );
 			while ( (*it) )
 			{
-				item = (OutlineTreeItem*)(*it);
+				item = dynamic_cast<OutlineTreeItem*>(*it);
 				if (((item->type == 3) || (item->type == 4)) && (item->PageItemObject == Nr))
 				{
 					retVal = (*it);
@@ -765,7 +765,7 @@
 	return retVal;
 }
 
-void OutlinePalette::slotShowSelect(uint SNr, PageItem *Nr)
+void OutlinePalette::slotShowSelect(int SNr, PageItem *Nr)
 {
 	if (!m_MainWindow || m_MainWindow->scriptIsRunning())
 		return;
@@ -780,10 +780,10 @@
 	if (currDoc->m_Selection->count() > 0)
 	{
 		QList<QTreeWidgetItem*> itemSelection;
-		uint docSelectionCount = currDoc->m_Selection->count();
-		for (uint a = 0; a < docSelectionCount; a++)
-		{
-			PageItem *item = currDoc->m_Selection->itemAt(a);
+		int docSelectionCount = currDoc->m_Selection->count();
+		for (int i = 0; i < docSelectionCount; i++)
+		{
+			PageItem *item = currDoc->m_Selection->itemAt(i);
 			QTreeWidgetItem *retVal = getListItem(item->OwnPage, item);
 			if (retVal != 0 && !retVal->isHidden())
 				itemSelection.append(retVal);
@@ -888,7 +888,7 @@
 	QTreeWidgetItemIterator it( reportDisplay );
 	while ( (*it) )
 	{
-		item = (OutlineTreeItem*)(*it);
+		item = dynamic_cast<OutlineTreeItem*>(*it);
 		for (int olc = 0; olc < currDoc->OpenNodes.count(); olc++)
 		{
 			if (item->type == currDoc->OpenNodes[olc].type)
@@ -921,7 +921,7 @@
 	QTreeWidgetItemIterator it( reportDisplay );
 	while ( (*it) )
 	{
-		item = (OutlineTreeItem*)(*it);
+		item = dynamic_cast<OutlineTreeItem*>(*it);
 		if (item->isExpanded())
 		{
 			ol.type = item->type;
@@ -953,7 +953,7 @@
 		for (int a = 0; a < items.count(); a++)
 		{
 			QTreeWidgetItem* ite = items[a];
-			OutlineTreeItem *item = (OutlineTreeItem*)ite;
+			OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(ite);
 			PageItem *pgItem = NULL;
 			switch (item->type)
 			{
@@ -990,8 +990,7 @@
 	if (!m_MainWindow || m_MainWindow->scriptIsRunning())
 		return;
 	selectionTriggered = true;
-	OutlineTreeItem *item = (OutlineTreeItem*)ite;
-	uint pg = 0;
+	OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(ite);
 	PageItem *pgItem = NULL;
 	switch (item->type)
 	{
@@ -1014,7 +1013,7 @@
 				return;
 			if (!currDoc->symbolEditMode())
 			{
-				pg = item->PageObject->pageNr();
+				int pg = item->PageObject->pageNr();
 				m_MainWindow->closeActiveWindowMasterPageEditor();
 				emit selectPage(pg);
 			}
@@ -1048,7 +1047,7 @@
 {
 	if (!m_MainWindow || m_MainWindow->scriptIsRunning())
 		return;
-	OutlineTreeItem *item = (OutlineTreeItem*)ite;
+	OutlineTreeItem *item = dynamic_cast<OutlineTreeItem*>(ite);
 	PageItem *pgItem = NULL;
 	switch (item->type)
 	{
@@ -1468,7 +1467,7 @@
 	reportDisplay->clear();
 }
 
-void OutlinePalette::createContextMenu(PageItem * currItem, double mx, double my)
+void OutlinePalette::createContextMenu(PageItem * currItem, double /*mx*/, double /*my*/)
 {
 	if (m_MainWindow==NULL || currDoc==NULL)
 		return;

Modified: trunk/Scribus/scribus/ui/outlinepalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/ui/outlinepalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/outlinepalette.h	(original)
+++ trunk/Scribus/scribus/ui/outlinepalette.h	Sun Dec 24 23:45:22 2017
@@ -76,7 +76,7 @@
 	void BuildTree(bool storeVals = true);
 	void filterTree(const QString& keyword);
 	void languageChange();
-	void slotShowSelect(uint SNr, PageItem *Nr);
+	void slotShowSelect(int SNr, PageItem *Nr);
 	void setPaletteShown(bool);
 	void slotRightClick(QPoint point);
 	void setActiveLayer(int layerID);
@@ -100,7 +100,7 @@
 protected:
 	void filterTree();
 	void clearPalette();
-	void createContextMenu(PageItem *currItem, double mx, double my);
+	void createContextMenu(PageItem *currItem, double, double);
 	QWidget* containerWidget;
 	OutlineWidget* reportDisplay;
 	QTreeWidgetItem* freeObjects;

Modified: trunk/Scribus/scribus/util.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/util.cpp
==============================================================================
--- trunk/Scribus/scribus/util.cpp	(original)
+++ trunk/Scribus/scribus/util.cpp	Sun Dec 24 23:45:22 2017
@@ -304,7 +304,7 @@
 QString String2Hex(QString *in, bool lang)
 {
 	int i = 0;
-	QString out("");
+	QString out;
 	for( int xi = 0; xi < in->length(); ++xi )
 	{
 		// Qt4 .cell() added ???
@@ -782,7 +782,7 @@
 
 QString readLinefromDataStream(QDataStream &s)
 {
-	QString ret = "";
+	QString ret;
 	uchar charData;
 	while (!s.atEnd())
 	{
@@ -831,7 +831,7 @@
 
 QString readAdobeUniCodeString(QDataStream &s)
 {
-	QString ret = "";
+	QString ret;
 	quint32 len;
 	s >> len;
 	for (quint32 i = 0; i < len; i++)
@@ -846,7 +846,7 @@
 
 QString readAdobeUniCodeString16(QDataStream &s)
 {
-	QString ret = "";
+	QString ret;
 	quint16 len;
 	s >> len;
 	for (quint16 i = 0; i < len; i++)

Modified: trunk/Scribus/scribus/util_formats.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/util_formats.cpp
==============================================================================
--- trunk/Scribus/scribus/util_formats.cpp	(original)
+++ trunk/Scribus/scribus/util_formats.cpp	Sun Dec 24 23:45:22 2017
@@ -378,7 +378,7 @@
 
 QString getImageType(QString filename)
 {
-	QString ret = "";
+	QString ret;
 	QFile f(filename);
 	QFileInfo fi(f);
 	if (fi.exists())

Modified: trunk/Scribus/scribus/util_math.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22271&path=/trunk/Scribus/scribus/util_math.cpp
==============================================================================
--- trunk/Scribus/scribus/util_math.cpp	(original)
+++ trunk/Scribus/scribus/util_math.cpp	Sun Dec 24 23:45:22 2017
@@ -430,11 +430,11 @@
 	FPoint np, rp;
 	double mx = 0;
 	double my = 0;
-	uint clipSize=Clip->size();
-	for (uint c = 0; c < clipSize; ++c)
-	{
-		np = Clip->point(c);
-		if (Clip->isMarker(c))
+	int clipSize=Clip->size();
+	for (int i = 0; i < clipSize; ++i)
+	{
+		np = Clip->point(i);
+		if (Clip->isMarker(i))
 			continue;
 		if (np.x() > mx)
 			mx = np.x();
@@ -450,11 +450,11 @@
 	FPoint np, rp;
 	double mx =  std::numeric_limits<double>::max();
 	double my =  std::numeric_limits<double>::max();
-	uint clipSize=Clip->size();
-	for (uint c = 0; c < clipSize; ++c)
-	{
-		np = Clip->point(c);
-		if (Clip->isMarker(c))
+	int clipSize=Clip->size();
+	for (int i = 0; i < clipSize; ++i)
+	{
+		np = Clip->point(i);
+		if (Clip->isMarker(i))
 			continue;
 		if (np.x() < mx)
 			mx = np.x();
@@ -515,15 +515,15 @@
 
 double getRotationDFromMatrix(QTransform& matrix)
 {
-	QLineF line = QLineF(0.0, 0.0, 1.0, 0.0);
+	QLineF line(0.0, 0.0, 1.0, 0.0);
 	line = matrix.map(line);
 	return line.angle();
 }
 
 void getScaleFromMatrix(QTransform &matrix, double &scX, double &scY)
 {
-	QLineF lineX = QLineF(0.0, 0.0, 1.0, 0.0);
-	QLineF lineY = QLineF(0.0, 0.0, 0.0, 1.0);
+	QLineF lineX(0.0, 0.0, 1.0, 0.0);
+	QLineF lineY(0.0, 0.0, 0.0, 1.0);
 	lineX = matrix.map(lineX);
 	lineY = matrix.map(lineY);
 	scX = lineX.length();
@@ -532,8 +532,8 @@
 
 void getTransformValuesFromMatrix(QTransform &matrix, double &scX, double &scY, double &rot, double &dx, double &dy)
 {
-	QLineF lineX = QLineF(0.0, 0.0, 1.0, 0.0);
-	QLineF lineY = QLineF(0.0, 0.0, 0.0, 1.0);
+	QLineF lineX(0.0, 0.0, 1.0, 0.0);
+	QLineF lineY(0.0, 0.0, 0.0, 1.0);
 	lineX = matrix.map(lineX);
 	lineY = matrix.map(lineY);
 	scX = lineX.length();




More information about the scribus-commit mailing list