r22799 by jghali - Small refactoring

scribus-commit scribus-commit at lists.scribus.net
Tue Jan 8 22:31:44 UTC 2019


Author: jghali
Date: Tue Jan  8 22:31:44 2019
New Revision: 22799

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22799
Log:
Small refactoring

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pageitem_textframe.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22799&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Tue Jan  8 22:31:44 2019
@@ -355,7 +355,7 @@
 	m_imageXOffset(other.m_imageXOffset),
 	m_imageYOffset(other.m_imageYOffset),
 	m_imageRotation(other.m_imageRotation),
-	firstLineOffsetP(other.firstLineOffsetP),
+	m_firstLineOffset(other.m_firstLineOffset),
 	m_groupClips(other.m_groupClips),
 	hatchBackgroundQ(other.hatchBackgroundQ),
 	hatchForegroundQ(other.hatchForegroundQ)
@@ -832,7 +832,7 @@
 	meshGradientArray.append(mgList);
 	meshGradientPatches.append(patch);
 
-	firstLineOffsetP = FLOPRealGlyphHeight;
+	m_firstLineOffset = FLOPRealGlyphHeight;
 	Cols = m_Doc->itemToolPrefs().textColumns;
 	ColGap = m_Doc->itemToolPrefs().textColumnGap;
 	LeftLink = nullptr;
@@ -6631,9 +6631,9 @@
 	if (!is)
 		qFatal("PageItem::restoreFirstLineOffset: dynamic cast failed");
 	if (isUndo)
-		firstLineOffsetP = is->getItem().first;
-	else
-		firstLineOffsetP = is->getItem().second;
+		m_firstLineOffset = is->getItem().first;
+	else
+		m_firstLineOffset = is->getItem().second;
 	update();
 }
 
@@ -10508,22 +10508,22 @@
 
 FirstLineOffsetPolicy PageItem::firstLineOffset() const
 {
-	return firstLineOffsetP;
+	return m_firstLineOffset;
 }
 
 void PageItem::setFirstLineOffset(FirstLineOffsetPolicy flop)
 {
-	if (firstLineOffsetP != flop)
-	{
-		if (UndoManager::undoEnabled())
-		{
-			ScItemState<QPair<FirstLineOffsetPolicy,FirstLineOffsetPolicy> > *is = new ScItemState<QPair <FirstLineOffsetPolicy,FirstLineOffsetPolicy> >(Um::FirstLineOffset);
-			is->set("FIRSTLINEOFFSET");
-			is->setItem(qMakePair(firstLineOffsetP, flop));
-			undoManager->action(this, is);
-		}
-		firstLineOffsetP = flop;
-	}
+	if (m_firstLineOffset == flop)
+		return;
+
+	if (UndoManager::undoEnabled())
+	{
+		ScItemState<QPair<FirstLineOffsetPolicy,FirstLineOffsetPolicy> > *is = new ScItemState<QPair <FirstLineOffsetPolicy,FirstLineOffsetPolicy> >(Um::FirstLineOffset);
+		is->set("FIRSTLINEOFFSET");
+		is->setItem(qMakePair(m_firstLineOffset, flop));
+		undoManager->action(this, is);
+	}
+	m_firstLineOffset = flop;
 }
 
 void PageItem::setInlineData(const QString& data)

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22799&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h	(original)
+++ trunk/Scribus/scribus/pageitem.h	Tue Jan  8 22:31:44 2019
@@ -1852,7 +1852,7 @@
 	double m_imageXOffset; ///< Image X Offset to frame
 	double m_imageYOffset; ///< Image Y Offset to frame
 	double m_imageRotation; ///< Image rotation in frame
-	FirstLineOffsetPolicy firstLineOffsetP;
+	FirstLineOffsetPolicy m_firstLineOffset;
 	bool m_groupClips;
 	QColor hatchBackgroundQ;
 	QColor hatchForegroundQ;

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22799&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Tue Jan  8 22:31:44 2019
@@ -1677,7 +1677,7 @@
 					realCharHeight = font.height(style.charStyle().fontSize() / 10.0);
 				if (realCharAscent == 0.0)
 					realCharAscent = font.ascent(style.charStyle().fontSize() / 10.0);
-				if (current.startOfCol && (firstLineOffsetP == FLOPFontAscent))
+				if (current.startOfCol && (m_firstLineOffset == FLOPFontAscent))
 					realCharAscent = font.ascent(hlcsize10);
 				chsd = ((DropCapDrop + realCharAscent) / realCharHeight) * style.charStyle().fontSize();
 				chs  = ((DropCapDrop + realCharAscent) / realCharAscent) * style.charStyle().fontSize();
@@ -1764,7 +1764,7 @@
 					if (realCharAscent == 0)
 						realCharAscent = font.ascent(style.charStyle().fontSize() / 10.0);
 					asce = realCharAscent;
-					if (current.startOfCol && (firstLineOffsetP == FLOPFontAscent))
+					if (current.startOfCol && (m_firstLineOffset == FLOPFontAscent))
 						asce = font.ascent(hlcsize10);
 					glyphCluster.setScaleH(glyphCluster.scaleH() / glyphCluster.scaleV());
 					glyphCluster.setScaleV(realAsce / realCharHeight);




More information about the scribus-commit mailing list