r24922 by jghali - Refactor PageItem_TextFrame::setTextFrameHeight() to avoid some useless processing
scribus-commit
scribus-commit at lists.scribus.net
Sun Feb 6 22:17:56 UTC 2022
Author: jghali
Date: Sun Feb 6 22:17:56 2022
New Revision: 24922
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24922
Log:
Refactor PageItem_TextFrame::setTextFrameHeight() to avoid some useless processing
Modified:
trunk/Scribus/scribus/pageitem_textframe.cpp
Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24922&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp Sun Feb 6 22:17:56 2022
@@ -5845,33 +5845,33 @@
if (textLayout.lines() <= 0)
return;
- if (m_nextBox == nullptr) // Vertical alignment is not used inside a text chain
- {
- textLayout.box()->moveTo(textLayout.box()->x(), 0);
- double newHeight = textLayout.box()->naturalHeight();
- newHeight += m_textDistanceMargins.bottom();
-
- UndoTransaction undoTransaction;
- if (UndoManager::undoEnabled())
- {
- QString unitSuffix = unitGetStrFromIndex(m_Doc->unitIndex());
- int unitPrecision = unitGetPrecisionFromIndex(m_Doc->unitIndex());
- double unitRatio = m_Doc->unitRatio();
- QString owString = QString::number(oldWidth * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
- QString ohString = QString::number(oldHeight * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
- QString nwString = QString::number(m_width * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
- QString nhString = QString::number(m_height * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
- QString tooltip = QString(Um::ResizeFromTo).arg(owString, ohString, nwString, nhString);
- undoTransaction = undoManager->beginTransaction(Um::Selection, Um::ITextFrame, Um::Resize, tooltip, Um::IResize);
- }
-
- setHeight(newHeight);
-
- if (undoTransaction)
- undoTransaction.commit();
- }
-
+ if (m_nextBox != nullptr) // Vertical alignment is not used inside a text chain
+ return;
+
+ textLayout.box()->moveTo(textLayout.box()->x(), 0);
+ double newHeight = textLayout.box()->naturalHeight();
+ newHeight += m_textDistanceMargins.bottom();
+
+ UndoTransaction undoTransaction;
+ if (UndoManager::undoEnabled())
+ {
+ QString unitSuffix = unitGetStrFromIndex(m_Doc->unitIndex());
+ int unitPrecision = unitGetPrecisionFromIndex(m_Doc->unitIndex());
+ double unitRatio = m_Doc->unitRatio();
+ QString owString = QString::number(oldWidth * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+ QString ohString = QString::number(oldHeight * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+ QString nwString = QString::number(m_width * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+ QString nhString = QString::number(m_height * unitRatio, 'f', unitPrecision) + " " + unitSuffix;
+ QString tooltip = QString(Um::ResizeFromTo).arg(owString, ohString, nwString, nhString);
+ undoTransaction = undoManager->beginTransaction(Um::Selection, Um::ITextFrame, Um::Resize, tooltip, Um::IResize);
+ }
+
+ setHeight(newHeight);
updateClip();
+
+ if (undoTransaction)
+ undoTransaction.commit();
+
invalid = true;
m_Doc->changed();
m_Doc->regionsChanged()->update(QRect());
More information about the scribus-commit
mailing list