r23635 by jghali - Code style fixes
scribus-commit
scribus-commit at lists.scribus.net
Tue Apr 21 21:19:09 UTC 2020
Author: jghali
Date: Tue Apr 21 21:19:09 2020
New Revision: 23635
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23635
Log:
Code style fixes
Modified:
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/undomanager.cpp
trunk/Scribus/scribus/undostack.cpp
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23635&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Tue Apr 21 21:19:09 2020
@@ -1612,7 +1612,7 @@
lowerLayer(ss->getInt("ACTIVE"));
else
raiseLayer(ss->getInt("ACTIVE"));
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("DOWN_LAYER"))
{
@@ -1620,39 +1620,39 @@
raiseLayer(ss->getInt("ACTIVE"));
else
lowerLayer(ss->getInt("ACTIVE"));
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("PRINT_LAYER"))
{
bool print = ss->getBool("PRINT");
setLayerPrintable(ss->getInt("ACTIVE"), isUndo ? !print : print);
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("LAYER_FLOW"))
{
bool flow = ss->getBool("FLOW");
setLayerFlow(ss->getInt("ACTIVE"), isUndo ? !flow : flow);
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("LAYER_LOCK"))
{
bool lock = ss->getBool("LOCK");
setLayerLocked(ss->getInt("ACTIVE"), isUndo ? !lock : lock);
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("LAYER_TRANSPARENCY"))
{
double old_trans = ss->getDouble("OLD_TRANS");
double new_trans = ss->getDouble("NEW_TRANS");
setLayerTransparency(ss->getInt("ACTIVE"), isUndo ? old_trans : new_trans);
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("LAYER_BLENDMODE"))
{
int old_blend = ss->getInt("OLD_BLENDMODE");
int new_blend = ss->getInt("NEW_BLENDMODE");
setLayerBlendMode(ss->getInt("ACTIVE"), isUndo ? old_blend : new_blend);
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("ADD_LAYER"))
{
@@ -1660,22 +1660,22 @@
deleteLayer(ss->getInt("LAYER_NR"), false);
else
{
- int layerID=addLayer( ss->get("NAME"), false );
- int newLayerID=ss->getInt("LAYER_NR");
+ int layerID = addLayer(ss->get("NAME"), false);
+ int newLayerID = ss->getInt("LAYER_NR");
bool renumberedOk=renumberLayer(layerID, newLayerID);
Q_ASSERT(renumberedOk);
}
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("REMOVE_LAYER"))
{
if (isUndo)
{
- int layerID=addLayer( ss->get("NAME"), false );
- int newLayerID=ss->getInt("LAYER_NR");
+ int layerID = addLayer(ss->get("NAME"), false);
+ int newLayerID = ss->getInt("LAYER_NR");
bool renumberedOk=renumberLayer(layerID, newLayerID);
Q_ASSERT(renumberedOk);
- layerID=newLayerID;
+ layerID = newLayerID;
//Layer is at the top now, lower it until it reaches the old level
int level = ss->getInt("LEVEL");
while (layerLevelFromID(layerID)!=level)
@@ -1683,7 +1683,7 @@
}
else
deleteLayer(ss->getInt("LAYER_NR"), ss->getBool("DELETE"));
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("CHANGE_NAME"))
{
@@ -1691,7 +1691,7 @@
if (!isUndo)
name = ss->get("NEW_NAME");
changeLayerName(ss->getInt("ACTIVE"), name);
- layersUndo=true;
+ layersUndo = true;
}
else if (ss->contains("MASTERPAGE_ADD"))
restoreAddMasterPage(ss, isUndo);
Modified: trunk/Scribus/scribus/undomanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23635&path=/trunk/Scribus/scribus/undomanager.cpp
==============================================================================
--- trunk/Scribus/scribus/undomanager.cpp (original)
+++ trunk/Scribus/scribus/undomanager.cpp Tue Apr 21 21:19:09 2020
@@ -288,7 +288,8 @@
if (currentDoc_ == newName)
return;
- if (stacks_[currentDoc_].size() == 0) {
+ if (stacks_[currentDoc_].size() == 0)
+ {
currentDoc_ = newName;
return;
}
Modified: trunk/Scribus/scribus/undostack.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23635&path=/trunk/Scribus/scribus/undostack.cpp
==============================================================================
--- trunk/Scribus/scribus/undostack.cpp (original)
+++ trunk/Scribus/scribus/undostack.cpp Tue Apr 21 21:19:09 2020
@@ -44,7 +44,8 @@
bool UndoStack::undo(uint steps, int objectId)
{
- for (uint i = 0; i < steps && !m_undoActions_.empty(); ++i) {
+ for (uint i = 0; i < steps && !m_undoActions_.empty(); ++i)
+ {
UndoState *tmpUndoState = nullptr;
if (objectId == Um::GLOBAL_UNDO_MODE)
{
@@ -153,13 +154,15 @@
checkSize(); // we may need to remove actions
}
-bool UndoStack::checkSize() {
+bool UndoStack::checkSize()
+{
if (m_maxSize_ == 0) // 0 marks for infinite stack size
return false;
bool needsPopping = size () > m_maxSize_;
- while (size() > m_maxSize_) {
+ while (size() > m_maxSize_)
+ {
if (!m_redoActions_.empty()) // clear redo actions first
m_redoActions_.pop_back();
else
@@ -181,56 +184,50 @@
UndoState* UndoStack::getNextUndo(int objectId)
{
+ if (m_undoActions_.empty())
+ return nullptr;
+
+ if (objectId == Um::GLOBAL_UNDO_MODE)
+ return m_undoActions_[0];
+
UndoState *state = nullptr;
- if (!m_undoActions_.empty())
- {
- if (objectId == Um::GLOBAL_UNDO_MODE)
- state = m_undoActions_[0];
- else
- {
- StateList::iterator it;
- for (it = m_undoActions_.begin(); it != m_undoActions_.end(); ++it)
- {
- UndoState* tmp = *it;
- TransactionState *ts = dynamic_cast<TransactionState*>(tmp);
- if ((tmp && tmp->undoObject() &&
- tmp->undoObject()->getUId() == static_cast<ulong>(objectId)) || (ts && ts->containsOnly(objectId)))
- {
- state = tmp;
- break;
- }
- if (ts && ts->contains(objectId))
- break;
- }
- }
+ for (auto it = m_undoActions_.begin(); it != m_undoActions_.end(); ++it)
+ {
+ UndoState* tmp = *it;
+ TransactionState *ts = dynamic_cast<TransactionState*>(tmp);
+ if ((tmp && tmp->undoObject() &&
+ tmp->undoObject()->getUId() == static_cast<ulong>(objectId)) || (ts && ts->containsOnly(objectId)))
+ {
+ state = tmp;
+ break;
+ }
+ if (ts && ts->contains(objectId))
+ break;
}
return state;
}
UndoState* UndoStack::getNextRedo(int objectId)
{
+ if (m_redoActions_.empty())
+ return nullptr;
+
+ if (objectId == Um::GLOBAL_UNDO_MODE)
+ return m_redoActions_[0];
+
UndoState *state = nullptr;
- if (!m_redoActions_.empty())
- {
- if (objectId == Um::GLOBAL_UNDO_MODE)
- state = m_redoActions_[0];
- else
- {
- StateList::iterator it;
- for (it = m_redoActions_.begin(); it != m_redoActions_.end(); ++it)
- {
- UndoState* tmp = *it;
- TransactionState *ts = dynamic_cast<TransactionState*>(tmp);
- if ((tmp && tmp->undoObject() &&
- tmp->undoObject()->getUId() == static_cast<ulong>(objectId)) || (ts && ts->containsOnly(objectId)))
- {
- state = tmp;
- break;
- }
- if (ts && ts->contains(objectId))
- break;
- }
- }
+ for (auto it = m_redoActions_.begin(); it != m_redoActions_.end(); ++it)
+ {
+ UndoState* tmp = *it;
+ TransactionState *ts = dynamic_cast<TransactionState*>(tmp);
+ if ((tmp && tmp->undoObject() &&
+ tmp->undoObject()->getUId() == static_cast<ulong>(objectId)) || (ts && ts->containsOnly(objectId)))
+ {
+ state = tmp;
+ break;
+ }
+ if (ts && ts->contains(objectId))
+ break;
}
return state;
}
More information about the scribus-commit
mailing list