r24794 by craig - Code cleanup

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 1 20:08:11 UTC 2022


Author: craig
Date: Sat Jan  1 20:08:10 2022
New Revision: 24794

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

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

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24794&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Sat Jan  1 20:08:10 2022
@@ -11258,9 +11258,9 @@
 		if (currItem->isImageFrame() && ScCore->fileWatcher->isWatching(currItem->Pfile) && currItem->imageIsAvailable)
 			ScCore->fileWatcher->removeFile(currItem->Pfile);
 		//delete marks pointed to that item
-		for (int a=0; a < m_docMarksList.count(); a++)
-		{
-			Mark* m = m_docMarksList.at(a);
+		for (int i = 0; i < m_docMarksList.count(); i++)
+		{
+			Mark* m = m_docMarksList.at(i);
 			Q_ASSERT(m != nullptr);
 			if (m->isType(MARK2ItemType) && (m->getItemPtr() == currItem))
 			{
@@ -11270,7 +11270,7 @@
 		}
 		if (currItem->isNoteFrame())
 		{
-			if (currItem->itemText.length() >0)
+			if (currItem->itemText.length() > 0)
 			{
 				currItem->itemText.selectAll();
 				currItem->asTextFrame()->deleteSelectedTextFromFrame();
@@ -11419,13 +11419,7 @@
 	regionsChanged()->update(QRectF());
 	changed();
 	if (activeTransaction)
-	{
-		activeTransaction.commit(Um::Selection,
-								 Um::IGroup,
-								 Um::BlendMode,
-								 "",
-								 Um::IGroup);
-	}
+		activeTransaction.commit(Um::Selection, Um::IGroup, Um::BlendMode, "", Um::IGroup);
 }
 
 
@@ -11507,13 +11501,7 @@
 		currItem->update();
 	}
 	if (activeTransaction)
-	{
-		activeTransaction.commit(Um::Selection,
-								 Um::IGroup,
-							     Um::Overprint,
-								 "",
-								 Um::IGroup);
-	}
+		activeTransaction.commit(Um::Selection, Um::IGroup, Um::Overprint, "", Um::IGroup);
 	m_updateManager.setUpdatesEnabled();
 	changed();
 }
@@ -11627,13 +11615,7 @@
 		currItem->update();
 	}
 	if (activeTransaction)
-	{
-		activeTransaction.commit(Um::Selection,
-									Um::IGroup,
-									Um::ImageOffset,
-									tooltip,
-									Um::IImageScaling);
-	}
+		activeTransaction.commit(Um::Selection, Um::IGroup, Um::ImageOffset, tooltip, Um::IImageScaling);
 	m_updateManager.setUpdatesEnabled();
 	changed();
 }
@@ -11671,13 +11653,7 @@
 		currItem->update();
 	}
 	if (activeTransaction)
-	{
-		activeTransaction.commit(Um::Selection,
-							Um::IGroup,
-							Um::ImageScale,
-							tooltip,
-							Um::IImageScaling);
-	}
+		activeTransaction.commit(Um::Selection, Um::IGroup, Um::ImageScale, tooltip, Um::IImageScaling);
 	m_updateManager.setUpdatesEnabled();
 	changed();
 }
@@ -11717,23 +11693,11 @@
 		if (selectedItemCount <= Um::ItemsInvolvedLimit)
 			tooltip += "\t" + currItem->getUName() + "\n";
 		if (activeTransaction)
-		{
-			activeTransaction.commit(Um::Selection,
-									 Um::IImageFrame,
-									 Um::ImageScale,
-									 tooltip,
-									 Um::IImageScaling);
-		}
+			activeTransaction.commit(Um::Selection, Um::IImageFrame, Um::ImageScale, tooltip, Um::IImageScaling);
 		currItem->update();
 	}
 	if (outerTransaction)
-	{
-		outerTransaction.commit(Um::Selection,
-								Um::IGroup,
-								Um::ImageScale,
-								tooltip,
-								Um::IImageScaling);
-	}
+		outerTransaction.commit(Um::Selection, Um::IGroup, Um::ImageScale, tooltip, Um::IImageScaling);
 	m_updateManager.setUpdatesEnabled();
 	changed();
 }
@@ -16909,11 +16873,11 @@
 
 Mark *ScribusDoc::newMark(Mark* mrk)
 {
-	Mark* newMrk = new Mark();
+	Mark* newMark = new Mark();
 	if (mrk != nullptr)
-		*newMrk = *mrk;
-	m_docMarksList.append(newMrk);
-	return newMrk;
+		*newMark = *mrk;
+	m_docMarksList.append(newMark);
+	return newMark;
 }
 
 TextNote *ScribusDoc::newNote(NotesStyle* noteStyle)
@@ -17939,67 +17903,67 @@
 	return nF;
 }
 
-void ScribusDoc::delNoteFrame(PageItem_NoteFrame* nF, bool removeMarks, bool forceDeletion)
-{
-	Q_ASSERT(nF != nullptr);
+void ScribusDoc::delNoteFrame(PageItem_NoteFrame* noteFrame, bool removeMarks, bool forceDeletion)
+{
+	Q_ASSERT(noteFrame != nullptr);
 
 	//for all notes in noteFrame set notes marks to null
-	for (TextNote* n : nF->notesList())
+	for (TextNote* n : noteFrame->notesList())
 		n->setNoteMark(nullptr);
 
-	if (nF->itemText.length() > 0 && removeMarks)
-		nF->removeMarksFromText(false);
+	if (noteFrame->itemText.length() > 0 && removeMarks)
+		noteFrame->removeMarksFromText(false);
 		
-	if (appMode == modeEdit && nF->isSelected())
+	if (appMode == modeEdit && noteFrame->isSelected())
 	{
 		view()->deselectItems(true);
-		if (!nF->isEndNotesFrame())
-			view()->selectItem(nF->masterFrame());
-	}
-	if (m_docEndNotesFramesMap.contains(nF))
-	{
-		m_docEndNotesFramesMap.remove(nF);
-		m_docEndNotesFramesChanged.removeAll(nF);
-		for (TextNote* note : nF->notesList())
+		if (!noteFrame->isEndNotesFrame())
+			view()->selectItem(noteFrame->masterFrame());
+	}
+	if (m_docEndNotesFramesMap.contains(noteFrame))
+	{
+		m_docEndNotesFramesMap.remove(noteFrame);
+		m_docEndNotesFramesChanged.removeAll(noteFrame);
+		for (TextNote* note : noteFrame->notesList())
 		{
 			PageItem* masterMarkItem = note->masterMark()->getItemPtr();
-			masterMarkItem->asTextFrame()->removeNoteFrame(nF);
+			masterMarkItem->asTextFrame()->removeNoteFrame(noteFrame);
 			masterMarkItem->invalid = true;
 		}
 	}
-	else if (nF->masterFrame() != nullptr)
-	{
-		nF->masterFrame()->removeNoteFrame(nF);
-		nF->masterFrame()->invalid = true;
-	}
-	m_docNotesInFrameMap.remove(nF);
-
-	nF->dropLinks();
-	if (nF->isWelded())
-		nF->unWeld(!nF->isAutoNoteFrame());
+	else if (noteFrame->masterFrame() != nullptr)
+	{
+		noteFrame->masterFrame()->removeNoteFrame(noteFrame);
+		noteFrame->masterFrame()->invalid = true;
+	}
+	m_docNotesInFrameMap.remove(noteFrame);
+
+	noteFrame->dropLinks();
+	if (noteFrame->isWelded())
+		noteFrame->unWeld(!noteFrame->isAutoNoteFrame());
 	//delete marks pointed to that item
-	for (int a=0; a < m_docMarksList.count(); ++a)
-	{
-		Mark* m = m_docMarksList.at(a);
+	for (int i = 0; i < m_docMarksList.count(); ++i)
+	{
+		Mark* m = m_docMarksList.at(i);
 		Q_ASSERT(m != nullptr);
-		if (m->isType(MARK2ItemType) && (m->getItemPtr() == nF))
+		if (m->isType(MARK2ItemType) && (m->getItemPtr() == noteFrame))
 		{
 			setUndoDelMark(m);
 			eraseMark(m, true);
 		}
 	}
 	m_Selection->delaySignalsOn();
-	if (m_Selection->findItem(nF) != -1)
+	if (m_Selection->findItem(noteFrame) != -1)
 	{
 		if (appMode == modeEdit)
 			view()->requestMode(modeNormal);
-		m_Selection->removeItem(nF);
-		if (m_Selection->isEmpty() && nF->masterFrame())
-			m_Selection->addItem(nF->masterFrame());
+		m_Selection->removeItem(noteFrame);
+		if (m_Selection->isEmpty() && noteFrame->masterFrame())
+			m_Selection->addItem(noteFrame->masterFrame());
 	}
 	m_Selection->delaySignalsOff();
 
-	Items->removeOne(nF);
+	Items->removeOne(noteFrame);
 
 	QList<PageItem*> allItems = *Items;
 	while (allItems.count() > 0)
@@ -18011,11 +17975,11 @@
 			continue;
 		}
 		if (item->isTextFrame())
-			item->asTextFrame()->removeNoteFrame(nF);
+			item->asTextFrame()->removeNoteFrame(noteFrame);
 	}
 	setNotesChanged(true);
 	if (forceDeletion)
-		delete nF;
+		delete noteFrame;
 }
 
 bool ScribusDoc::validateNSet(const NotesStyle& noteStyle, QString newName)

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24794&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h	(original)
+++ trunk/Scribus/scribus/scribusdoc.h	Sat Jan  1 20:08:10 2022
@@ -1813,7 +1813,7 @@
 	PageItem_NoteFrame* createNoteFrame(PageItem_TextFrame* inFrame, NotesStyle *nStyle, int index = -1);
 	PageItem_NoteFrame* createNoteFrame(NotesStyle *nStyle, double x, double y, double w, double h, double w2, const QString& fill, const QString& outline);
 	//delete noteframe
-	void delNoteFrame(PageItem_NoteFrame *nF, bool removeMarks=true, bool forceDeletion = true);
+	void delNoteFrame(PageItem_NoteFrame *noteFrame, bool removeMarks=true, bool forceDeletion = true);
 	//renumber notes for given notes style
 	//return true if doc needs update after changing numbers of notes
 	bool updateNotesNums(NotesStyle* nStyle);




More information about the scribus-commit mailing list