r19340 by jghali - get rid of unnecessarily long if() block

scribus-commit scribus-commit at lists.scribus.net
Sat Jul 12 00:08:58 UTC 2014


Author: jghali
Date: Sat Jul 12 00:08:58 2014
New Revision: 19340

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19340
Log:
get rid of unnecessarily long if() block

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19340&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sat Jul 12 00:08:58 2014
@@ -6583,7 +6583,7 @@
 		//disable text action which work only text frame in edit mode
 		if ((mode != modeEdit) || !currItem->isTextFrame())
 			appModeHelper.enableTextActions(false);
-		int docSelectionCount=doc->m_Selection->count();
+		int docSelectionCount = doc->m_Selection->count();
 		if (mode == modeDrawBezierLine)
 		{
 			if ((docSelectionCount != 0) && (!prefsManager->appPrefs.uiPrefs.stickyTools))
@@ -8756,36 +8756,36 @@
 void ScribusMainWindow::ModifyAnnot()
 {
 //	Q_ASSERT(!doc->masterPageMode());
-	if (!doc->m_Selection->isEmpty())
-	{
-		PageItem *currItem = doc->m_Selection->itemAt(0);
-		if ((currItem->annotation().Type() == 0) || (currItem->annotation().Type() == 1) || ((currItem->annotation().Type() > 9) && (currItem->annotation().Type() < 13)))
-		{
-			int AnType = currItem->annotation().Type();
-			int AnActType = currItem->annotation().ActionType();
-			QString AnAction = currItem->annotation().Action();
-			QString An_Extern = currItem->annotation().Extern();
-			Annota *dia = new Annota(this, currItem, doc->DocPages.count(), static_cast<int>(doc->pageWidth()), static_cast<int>(doc->pageHeight()), view);
-			if (dia->exec())
-				slotDocCh();
-			else
-			{
-				currItem->annotation().setType(AnType);
-				currItem->annotation().setActionType(AnActType);
-				currItem->annotation().setAction(AnAction);
-				currItem->annotation().setExtern(An_Extern);
-			}
-			delete dia;
-		}
+	if (doc->m_Selection->isEmpty())
+		return;
+
+	PageItem *currItem = doc->m_Selection->itemAt(0);
+	if ((currItem->annotation().Type() == 0) || (currItem->annotation().Type() == 1) || ((currItem->annotation().Type() > 9) && (currItem->annotation().Type() < 13)))
+	{
+		int AnType = currItem->annotation().Type();
+		int AnActType = currItem->annotation().ActionType();
+		QString AnAction = currItem->annotation().Action();
+		QString An_Extern = currItem->annotation().Extern();
+		Annota *dia = new Annota(this, currItem, doc->DocPages.count(), static_cast<int>(doc->pageWidth()), static_cast<int>(doc->pageHeight()), view);
+		if (dia->exec())
+			slotDocCh();
 		else
 		{
-			ScAnnot *dia = new ScAnnot(this, currItem, doc->DocPages.count(), static_cast<int>(doc->pageWidth()), static_cast<int>(doc->pageHeight()), doc->PageColors, view);
-			if (dia->exec())
-				slotDocCh();
-			delete dia;
-		}
-		currItem->update();
-	}
+			currItem->annotation().setType(AnType);
+			currItem->annotation().setActionType(AnActType);
+			currItem->annotation().setAction(AnAction);
+			currItem->annotation().setExtern(An_Extern);
+		}
+		delete dia;
+	}
+	else
+	{
+		ScAnnot *dia = new ScAnnot(this, currItem, doc->DocPages.count(), static_cast<int>(doc->pageWidth()), static_cast<int>(doc->pageHeight()), doc->PageColors, view);
+		if (dia->exec())
+			slotDocCh();
+		delete dia;
+	}
+	currItem->update();
 }
 
 void ScribusMainWindow::SetShortCut()




More information about the scribus-commit mailing list