r15234 by jghali - #9188 : incorrect update of text layout when changing layer properties
scribus-commit
scribus-commit at lists.scribus.net
Sat Jun 19 21:50:28 CEST 2010
Revision: 15234
Author: jghali
Date: 2010-06-19T19:41:05.355779Z
Commit message: #9188 : incorrect update of text layout when changing layer properties
Changeset:
M /branches/Version135/Scribus/scribus/layers.cpp
M /branches/Version135/Scribus/scribus/scribusdoc.cpp
M /branches/Version135/Scribus/scribus/scribusdoc.h
Diffs:
Index: scribus/layers.cpp
===================================================================
--- scribus/layers.cpp (revision 15233)
+++ scribus/layers.cpp (revision 15234)
@@ -399,6 +399,7 @@
if (strcmp(senderBox->metaObject()->className(), "QCheckBox") == 0)
{
m_Doc->setLayerFlow(layerNumber,((QCheckBox*)(senderBox))->isChecked());
+ emit LayerChanged();
setActiveLayer(Table->currentRow(), -1);
}
}
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 15233)
+++ scribus/scribusdoc.cpp (revision 15234)
@@ -2112,10 +2112,10 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
+ if (it->LNr == layerNumber)
{
- bool oldPrintable = (*it).isPrintable;
- (*it).isPrintable = isPrintable;
+ bool oldPrintable = it->isPrintable;
+ it->isPrintable = isPrintable;
if (oldPrintable!=isPrintable && UndoManager::undoEnabled())
{
@@ -2142,8 +2142,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
- return (*it).isPrintable;
+ if (it->LNr == layerNumber)
+ return it->isPrintable;
}
return false;
}
@@ -2156,9 +2156,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
+ if (it->LNr == layerNumber)
{
- (*it).isViewable = isViewable;
+ it->isViewable = isViewable;
found=true;
break;
}
@@ -2175,8 +2175,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
- return (*it).isViewable;
+ if (it->LNr == layerNumber)
+ return it->isViewable;
}
return false;
}
@@ -2189,9 +2189,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
+ if (it->LNr == layerNumber)
{
- (*it).isEditable = !isLocked;
+ it->isEditable = !isLocked;
found=true;
break;
}
@@ -2208,8 +2208,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
- return !(*it).isEditable;
+ if (it->LNr == layerNumber)
+ return !it->isEditable;
}
return false;
}
@@ -2222,15 +2222,24 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
+ if (it->LNr == layerNumber)
{
- (*it).flowControl = flow;
+ it->flowControl = flow;
found=true;
break;
}
}
if (found)
+ {
+ // #9188 : invalidate layout of items below layer
+ for (it = Layers.begin(); it != itend; ++it)
+ {
+ if (it->LNr == layerNumber)
+ break;
+ invalidateLayer(it->LNr);
+ }
changed();
+ }
return found;
}
@@ -2241,8 +2250,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
- return (*it).flowControl;
+ if (it->LNr == layerNumber)
+ return it->flowControl;
}
return false;
}
@@ -2255,9 +2264,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
+ if (it->LNr == layerNumber)
{
- (*it).transparency = trans;
+ it->transparency = trans;
found=true;
break;
}
@@ -2274,8 +2283,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
- return (*it).transparency;
+ if (it->LNr == layerNumber)
+ return it->transparency;
}
return 1.0;
}
@@ -2288,9 +2297,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
+ if (it->LNr == layerNumber)
{
- (*it).blendMode = blend;
+ it->blendMode = blend;
found=true;
break;
}
@@ -2307,8 +2316,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
- return (*it).blendMode;
+ if (it->LNr == layerNumber)
+ return it->blendMode;
}
return 0;
}
@@ -2321,9 +2330,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
+ if (it->LNr == layerNumber)
{
- (*it).outlineMode = outline;
+ it->outlineMode = outline;
found=true;
break;
}
@@ -2340,8 +2349,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
- return (*it).outlineMode;
+ if (it->LNr == layerNumber)
+ return it->outlineMode;
}
return false;
}
@@ -2354,9 +2363,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
+ if (it->LNr == layerNumber)
{
- (*it).markerColor = color;
+ it->markerColor = color;
found=true;
break;
}
@@ -2373,8 +2382,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).LNr == layerNumber)
- return (*it).markerColor;
+ if (it->LNr == layerNumber)
+ return it->markerColor;
}
return QColor(0, 0, 0);
}
@@ -2432,18 +2441,27 @@
ScLayers::iterator itend=Layers.end();
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).Level == layerLevel-1)
+ if (it->Level == layerLevel-1)
break;
}
ScLayers::iterator it2;
ScLayers::iterator it2end=Layers.end();
for (it2 = Layers.begin(); it2 != it2end; ++it2)
{
- if ((*it2).Level == layerLevel)
+ if (it2->Level == layerLevel)
break;
}
- (*it2).Level -= 1;
- (*it).Level += 1;
+ it2->Level -= 1;
+ it->Level += 1;
+ // #9188 : invalidate layout of items in below layers
+ int maxLevel = qMax(it->Level, it2->Level);
+ for (it = Layers.begin(); it != itend; ++it)
+ {
+ if (it->flowControl)
+ invalidateLayer(it->LNr);
+ if (it->Level == maxLevel)
+ break;
+ }
return true;
}
@@ -2470,18 +2488,27 @@
ScLayers::iterator itend=Layers.end();
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).Level == layerLevel+1)
+ if (it->Level == layerLevel+1)
break;
}
ScLayers::iterator it2;
ScLayers::iterator it2end=Layers.end();
for (it2 = Layers.begin(); it2 != it2end; ++it2)
{
- if ((*it2).Level == layerLevel)
+ if (it2->Level == layerLevel)
break;
}
- (*it2).Level += 1;
- (*it).Level -= 1;
+ it2->Level += 1;
+ it->Level -= 1;
+ // #9188 : invalidate layout of items in below layers
+ int maxLevel = qMax(it->Level, it2->Level);
+ for (it = Layers.begin(); it != itend; ++it)
+ {
+ if (it->flowControl)
+ invalidateLayer(it->LNr);
+ if (it->Level == maxLevel)
+ break;
+ }
return true;
}
@@ -8910,6 +8937,26 @@
}
}
+void ScribusDoc::invalidateLayer(int layerID)
+{
+ for (int c = 0; c < DocItems.count(); ++c)
+ {
+ PageItem *ite = DocItems.at(c);
+ if (ite->LayerNr == layerID)
+ ite->invalidateLayout();
+ }
+ if (this->masterPageMode())
+ {
+ for (int c=0; c < MasterItems.count(); ++c)
+ {
+ PageItem *ite = MasterItems.at(c);
+ if (ite->LayerNr == layerID)
+ ite->invalidateLayout();
+ }
+ }
+ // for now hope that frameitems get invalidated by their parents layout() method.
+}
+
void ScribusDoc::invalidateRegion(QRectF region)
{
for (int c=0; c<DocItems.count(); ++c)
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h (revision 15233)
+++ scribus/scribusdoc.h (revision 15234)
@@ -143,6 +143,8 @@
MassObservable<PageItem*> * itemsChanged() { return &m_itemsChanged; }
MassObservable<Page*> * pagesChanged() { return &m_pagesChanged; }
MassObservable<QRectF> * regionsChanged() { return &m_regionsChanged; }
+
+ void invalidateLayer(int layerID);
void invalidateRegion(QRectF region);
// Add, delete and move pages
More information about the scribus-commit
mailing list