r24256 by craig - Code clean up

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 15 15:01:40 UTC 2020


Author: craig
Date: Sun Nov 15 15:01:40 2020
New Revision: 24256

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24256
Log:
Code clean up

Modified:
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp
    trunk/Scribus/scribus/pageitem_noteframe.cpp
    trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
    trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
    trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
    trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
    trunk/Scribus/scribus/scimage.cpp
    trunk/Scribus/scribus/scribuscore.cpp
    trunk/Scribus/scribus/ui/hruler.cpp

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	Sun Nov 15 15:01:40 2020
@@ -1021,10 +1021,7 @@
 	}
 	m_imageInfoRecord.BBoxX = 0;
 	m_imageInfoRecord.BBoxH = r_image.height();
-	if ((m_imageInfoRecord.layerInfo.isEmpty()) && (m_imageInfoRecord.PDSpathData.isEmpty()))
-		m_imageInfoRecord.valid = false;
-	else
-		m_imageInfoRecord.valid = true;
+	m_imageInfoRecord.valid = !(m_imageInfoRecord.layerInfo.isEmpty() && m_imageInfoRecord.PDSpathData.isEmpty());
 	return true;
 }
 

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_wpg.cpp	Sun Nov 15 15:01:40 2020
@@ -138,10 +138,7 @@
 
 void ScrPainterIm::setFillRule(FillRule rule)
 {
-	if(rule == libwpg::WPGPaintInterface::WindingFill)
-		fillrule = false;
-	else
-		fillrule = true;
+	fillrule = rule != libwpg::WPGPaintInterface::WindingFill;
 //	qDebug() << "Fill Rule " << fillrule;
 }
 

Modified: trunk/Scribus/scribus/pageitem_noteframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/pageitem_noteframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_noteframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_noteframe.cpp	Sun Nov 15 15:01:40 2020
@@ -15,7 +15,7 @@
 #include "text/boxes.h"
 
 PageItem_NoteFrame::PageItem_NoteFrame(NotesStyle *nStyle, ScribusDoc *doc, double x, double y, double w, double h, double w2, const QString& fill, const QString& outline)
-    : PageItem_TextFrame(doc, x, y, w, h, w2, fill, outline)
+	: PageItem_TextFrame(doc, x, y, w, h, w2, fill, outline)
 {
 	m_nstyle = nStyle;
 	itemText.clear();
@@ -23,7 +23,7 @@
 	m_itemName = generateUniqueCopyName(nStyle->isEndNotes() ? tr("Endnote frame ") + m_nstyle->name() : tr("Footnote frame ") + m_nstyle->name(), false);
 	AutoName = false; //endnotes frame will saved with name
 	setUName(m_itemName);
-	
+
 	//set default style for note frame
 	ParagraphStyle newStyle;
 	if (nStyle->notesParStyle().isEmpty() || (nStyle->notesParStyle() == tr("No Style")))
@@ -37,22 +37,13 @@
 	m_textFlowMode = TextFlowUsesFrameShape;
 	setColumns(1);
 
-	if (m_nstyle->isAutoNotesHeight())
-		m_SizeVLocked = true;
-	else
-		m_SizeVLocked = false;
-	if (m_nstyle->isAutoNotesWidth())
-		m_SizeHLocked = true;
-	else
-		m_SizeHLocked = false;
-	if (m_nstyle->isAutoNotesHeight() && m_nstyle->isAutoNotesWidth())
-		m_SizeLocked = true;
-	else
-		m_SizeLocked = false;
+	m_SizeVLocked = m_nstyle->isAutoNotesHeight();
+	m_SizeHLocked = m_nstyle->isAutoNotesWidth();
+	m_SizeLocked = m_nstyle->isAutoNotesHeight() && m_nstyle->isAutoNotesWidth();
 }
 
 PageItem_NoteFrame::PageItem_NoteFrame(ScribusDoc *doc, double x, double y, double w, double h, double w2, const QString& fill, const QString& outline)
-    : PageItem_TextFrame(doc, x, y, w, h, w2, fill, outline)
+	: PageItem_TextFrame(doc, x, y, w, h, w2, fill, outline)
 {
 	m_textFlowMode = TextFlowUsesFrameShape;
 }
@@ -84,7 +75,7 @@
 	itemText.blockSignals(true);
 	itemText.setDefaultStyle(newStyle);
 	itemText.blockSignals(false);
-	
+
 	double frameHeight = calculateLineSpacing(newStyle, this);
 	if (frameHeight == 0.0 && !m_nstyle->isAutoNotesHeight())
 		frameHeight = newStyle.charStyle().fontSize()/10;
@@ -151,7 +142,7 @@
 
 	m_itemName = generateUniqueCopyName(m_nstyle->isEndNotes() ? "Endnote frame " + m_nstyle->name() : "Footnote frame " + m_nstyle->name(), false);
 	setUName(m_itemName);
-	
+
 	//set default style for note frame
 	ParagraphStyle newStyle;
 	if (nStyle->notesParStyle().isEmpty() || (nStyle->notesParStyle() == tr("No Style")))

Modified: trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp	Sun Nov 15 15:01:40 2020
@@ -1102,10 +1102,7 @@
 	else if (elemID == 6)
 	{
 		ts >> data;
-		if (data == 0)
-			useClipRect = false;
-		else
-			useClipRect = true;
+		useClipRect = data != 0;
 		// qDebug() << "CLIP INDICATOR" << useClipRect;
 	}
 	else if (elemID == 7)
@@ -2353,10 +2350,7 @@
 	{
 		quint16 data;
 		ts >> data;
-		if (data == 0)
-			lineVisible = false;
-		else
-			lineVisible = true;
+		lineVisible = data != 0;
  		// qDebug() << "EDGE VISIBILITY";
 	}
 	else if (elemID == 31)

Modified: trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp	Sun Nov 15 15:01:40 2020
@@ -1587,10 +1587,7 @@
 			gElements.scaleY = scaleY;
 			gElements.rotationAngle = rotationAngle;
 			gElements.posPivot = posPivot;
-			if (data8 == 17)
-				gElements.filled = true;
-			else
-				gElements.filled = false;
+			gElements.filled = data8 == 17;
 			gElements.nrOfItems = nItems;
 			gElements.counter = 0;
 			gElements.patternIndex = patternIndex;

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp	Sun Nov 15 15:01:40 2020
@@ -1577,10 +1577,7 @@
 		transferFunc->transform(&lum, &lum2);
 	else
 		lum2 = lum;
-	if (lum == lum2)
-		m_groupStack.top().inverted = false;
-	else
-		m_groupStack.top().inverted = true;
+	m_groupStack.top().inverted = lum != lum2;
 	m_groupStack.top().maskName = m_currentMask;
 	// Remember the mask's position as it might not align with the image to which the mask is later assigned.
 	m_groupStack.top().maskPos = m_currentMaskPosition;

Modified: trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp	Sun Nov 15 15:01:40 2020
@@ -766,10 +766,7 @@
 	}
 	if (propList["svg:fill-rule"])
 	{
-		if (QString(propList["svg:fill-rule"]->getStr().cstr()) == "nonzero")
-			m_fillRule = false;
-		else
-			m_fillRule = true;
+		m_fillRule = QString(propList["svg:fill-rule"]->getStr().cstr()) != "nonzero";
 	}
 	if (propList["svg:stroke-width"])
 		m_lineWidth = valueAsPoint(propList["svg:stroke-width"]);

Modified: trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/wpg/importwpg.cpp	Sun Nov 15 15:01:40 2020
@@ -222,10 +222,7 @@
 
 void ScrPainter::setFillRule(FillRule rule)
 {
-	if (rule == libwpg::WPGPaintInterface::WindingFill)
-		fillrule = false;
-	else
-		fillrule = true;
+	fillrule = rule != libwpg::WPGPaintInterface::WindingFill;
 //	qDebug() << "Fill Rule " << fillrule;
 }
 

Modified: trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/plugins/import/xar/importxar.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/xar/importxar.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/xar/importxar.cpp	Sun Nov 15 15:01:40 2020
@@ -1603,10 +1603,7 @@
 	quint8 val;
 	ts >> val;
 	XarStyle *gc = m_gc.top();
-	if (val == 0)
-		gc->fillRule = false;
-	else
-		gc->fillRule = true;
+	gc->fillRule = val != 0;
 }
 
 void XarPlug::handleLineEnd(QDataStream &ts)

Modified: trunk/Scribus/scribus/scimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/scimage.cpp
==============================================================================
--- trunk/Scribus/scribus/scimage.cpp	(original)
+++ trunk/Scribus/scribus/scimage.cpp	Sun Nov 15 15:01:40 2020
@@ -2730,10 +2730,7 @@
 //		setAlphaBuffer(false);
 	setDotsPerMeterX (qMax(2834, (int) (imgInfo.xres / 0.0254)));
 	setDotsPerMeterY (qMax(2834, (int) (imgInfo.yres / 0.0254)));
-	if (imgInfo.isEmbedded && cmSettings.useEmbeddedProfile())
-		imgInfo.isEmbedded = true;
-	else
-		imgInfo.isEmbedded = false;
+	imgInfo.isEmbedded = imgInfo.isEmbedded && cmSettings.useEmbeddedProfile();
 	if	(ScCore->usingGUI() && pDataLoader->issuedWarningMsg() && showMsg)
 	{
 		ScMessageBox::warning(ScCore->primaryMainWindow(), CommonStrings::trWarning, pDataLoader->getMessage());

Modified: trunk/Scribus/scribus/scribuscore.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/scribuscore.cpp
==============================================================================
--- trunk/Scribus/scribus/scribuscore.cpp	(original)
+++ trunk/Scribus/scribus/scribuscore.cpp	Sun Nov 15 15:01:40 2020
@@ -310,10 +310,7 @@
 			getCMSProfilesDir(profDir, showInfo, true);
 		}
 	}
-	if ((!PrinterProfiles.isEmpty()) && (!InputProfiles.isEmpty()) && (!MonitorProfiles.isEmpty()))
-		m_haveCMS = true;
-	else
-		m_haveCMS = false;
+	m_haveCMS = (!PrinterProfiles.isEmpty()) && (!InputProfiles.isEmpty()) && (!MonitorProfiles.isEmpty());
 }
 
 void ScribusCore::getCMSProfilesDir(const QString& pfad, bool showInfo, bool recursive)

Modified: trunk/Scribus/scribus/ui/hruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24256&path=/trunk/Scribus/scribus/ui/hruler.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/hruler.cpp	(original)
+++ trunk/Scribus/scribus/ui/hruler.cpp	Sun Nov 15 15:01:40 2020
@@ -815,10 +815,7 @@
 						  - item->textToFrameDistLeft() - item->textToFrameDistLeft()
 						  - 2*m_lineCorr) / item->columns();
 	m_rightMargin = columnWidth - currentStyle.rightMargin();
-	if (item->imageFlippedH())
-		m_reverse = true;
-	else
-		m_reverse = false;
+	m_reverse = item->imageFlippedH();
 	m_textEditMode = true;
 	m_tabValues = currentStyle.tabValues();
 }




More information about the scribus-commit mailing list