r19330 by jghali - refactor ScribusView::Deselect() to remove unneeded long 'if' block

scribus-commit scribus-commit at lists.scribus.net
Mon Jul 7 21:51:15 UTC 2014


Author: jghali
Date: Mon Jul  7 21:51:14 2014
New Revision: 19330

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19330
Log:
refactor ScribusView::Deselect() to remove unneeded long 'if' block

Modified:
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19330&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Mon Jul  7 21:51:14 2014
@@ -1668,35 +1668,35 @@
 //CB Remove bookmark interaction here, item/doc should do it
 void ScribusView::Deselect(bool /*prop*/)
 {
-	if (!Doc->m_Selection->isEmpty())
-	{
-		const double scale = m_canvas->scale();
-		PageItem* currItem=NULL;
-		for (int a = 0; a < Doc->m_Selection->count(); ++a)
-		{
-			currItem = Doc->m_Selection->itemAt(a);
-			if ((currItem->asTextFrame()) && (currItem->isBookmark))
-				emit ChBMText(currItem);
-		}
-		if (Doc->m_Selection->isMultipleSelection())
-		{
-			double x, y, w, h;
-			Doc->m_Selection->getGroupRect(&x, &y, &w, &h);
-			Doc->m_Selection->clear();
-			updateCanvas(x - 5/scale, y - 5/scale, w + 10/scale, h + 10/scale);
-		}
-		else
-		{
-			currItem = Doc->m_Selection->itemAt(0);
-			if (currItem != NULL)
-			{
-				currItem->itemText.deselectAll();
-				currItem->HasSel = false;
-			}
-			Doc->m_Selection->clear();
-			if (currItem != NULL)
-				updateContents(currItem->getRedrawBounding(scale));
-		}
+	if (Doc->m_Selection->isEmpty())
+		return;
+
+	const double scale = m_canvas->scale();
+	PageItem* currItem = NULL;
+	for (int a = 0; a < Doc->m_Selection->count(); ++a)
+	{
+		currItem = Doc->m_Selection->itemAt(a);
+		if ((currItem->asTextFrame()) && (currItem->isBookmark))
+			emit ChBMText(currItem);
+	}
+	if (Doc->m_Selection->isMultipleSelection())
+	{
+		double x, y, w, h;
+		Doc->m_Selection->getGroupRect(&x, &y, &w, &h);
+		Doc->m_Selection->clear();
+		updateCanvas(x - 5/scale, y - 5/scale, w + 10/scale, h + 10/scale);
+	}
+	else
+	{
+		currItem = Doc->m_Selection->itemAt(0);
+		if (currItem != NULL)
+		{
+			currItem->itemText.deselectAll();
+			currItem->HasSel = false;
+		}
+		Doc->m_Selection->clear();
+		if (currItem != NULL)
+			updateContents(currItem->getRedrawBounding(scale));
 	}
 }
 




More information about the scribus-commit mailing list