r24420 by jghali - Fix some issues in old layer API

scribus-commit scribus-commit at lists.scribus.net
Fri Jan 22 01:22:53 UTC 2021


Author: jghali
Date: Fri Jan 22 01:22:53 2021
New Revision: 24420

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24420
Log:
Fix some issues in old layer API

Modified:
    trunk/Scribus/scribus/sclayer.cpp
    trunk/Scribus/scribus/sclayer.h

Modified: trunk/Scribus/scribus/sclayer.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24420&path=/trunk/Scribus/scribus/sclayer.cpp
==============================================================================
--- trunk/Scribus/scribus/sclayer.cpp	(original)
+++ trunk/Scribus/scribus/sclayer.cpp	Fri Jan 22 01:22:53 2021
@@ -126,7 +126,7 @@
 ScLayer* ScLayers::byLevel(int level)
 {
 	ScLayers::Iterator itend = end();
-	for (ScLayers::Iterator it = nullptr; it != itend; ++it)
+	for (ScLayers::Iterator it = begin(); it != itend; ++it)
 	{
 		if (it->Level == level)
 			return &(*it);
@@ -137,7 +137,7 @@
 ScLayer* ScLayers::byID(int nr)
 {
 	ScLayers::Iterator itend = end();
-	for (ScLayers::Iterator it = nullptr; it != itend; ++it)
+	for (ScLayers::Iterator it = begin(); it != itend; ++it)
 	{
 		if (it->ID == nr)
 			return &(*it);
@@ -358,7 +358,7 @@
 	if (layerName.isEmpty())
 	{
 		QString tmp;
-		lname = QObject::tr("New Layer")+" "+tmp.setNum(lId);
+		lname = QObject::tr("New Layer") + " " + tmp.setNum(lId);
 	}
 	else
 		lname = layerName;
@@ -386,8 +386,8 @@
 		ScLayers::Iterator it, itEnd = end();
 		for (it = begin(); it != itEnd; ++it)
 		{
-			if ((*it).Level > layerLevel)
-				(*it).Level -= 1;
+			if (it->Level > layerLevel)
+				it->Level -= 1;
 		}
 		return true;
 	}
@@ -411,8 +411,8 @@
 		ScLayers::Iterator it, itEnd = end();
 		for (it = begin(); it != itEnd; ++it)
 		{
-			if ((*it).Level > level)
-				(*it).Level -= 1;
+			if (it->Level > level)
+				it->Level -= 1;
 		}
 	}
 	return false;
@@ -427,8 +427,8 @@
 	if ((!alyr) || (clyr == alyr))
 		return false;
 	
-	clyr->ID += 1;
-	alyr->ID -= 1;
+	clyr->Level += 1;
+	alyr->Level -= 1;
 	return true;
 }
 
@@ -441,8 +441,8 @@
 	if (!blyr || (clyr == blyr))
 		return false;
 
-	clyr->ID -= 1;
-	blyr->ID += 1;
+	clyr->Level -= 1;
+	blyr->Level += 1;
 	return true;
 }
 

Modified: trunk/Scribus/scribus/sclayer.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24420&path=/trunk/Scribus/scribus/sclayer.h
==============================================================================
--- trunk/Scribus/scribus/sclayer.h	(original)
+++ trunk/Scribus/scribus/sclayer.h	Fri Jan 22 01:22:53 2021
@@ -82,14 +82,14 @@
 	 * @param  level the layer level
 	 * @return layer with the specified level or NULL if not found
 	 */
-	ScLayer* byLevel(const int level);
+	ScLayer* byLevel(int level);
 
 	/**
 	 * @brief  Get layer with a specific number
 	 * @param  nr the layer number
 	 * @return layer with the specified number or NULL if not found
 	 */
-	ScLayer* byID(const int nr);
+	ScLayer* byID(int nr);
 
 	/**
 	 * @brief  Get layer above the layer with the specified ID




More information about the scribus-commit mailing list