r15235 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:53 CEST 2010
Revision: 15235
Author: jghali
Date: 2010-06-19T19:44:55.387595Z
Commit message: #9188 : incorrect update of text layout when changing layer properties
Changeset:
M /trunk/Scribus/scribus/ui/layers.cpp
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/scribusdoc.h
Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 15234)
+++ scribus/scribusdoc.cpp (revision 15235)
@@ -2066,10 +2066,10 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
+ if (it->ID == layerID)
{
bool oldPrintable = (*it).isPrintable;
- (*it).isPrintable = isPrintable;
+ it->isPrintable = isPrintable;
if (oldPrintable!=isPrintable && UndoManager::undoEnabled())
{
@@ -2096,8 +2096,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
- return (*it).isPrintable;
+ if (it->ID == layerID)
+ return it->isPrintable;
}
return false;
}
@@ -2110,9 +2110,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
+ if (it->ID == layerID)
{
- (*it).isViewable = isViewable;
+ it->isViewable = isViewable;
found=true;
break;
}
@@ -2129,8 +2129,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
- return (*it).isViewable;
+ if (it->ID == layerID)
+ return it->isViewable;
}
return false;
}
@@ -2143,9 +2143,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
+ if (it->ID == layerID)
{
- (*it).isEditable = !isLocked;
+ it->isEditable = !isLocked;
found=true;
break;
}
@@ -2162,8 +2162,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
- return !(*it).isEditable;
+ if (it->ID == layerID)
+ return !it->isEditable;
}
return false;
}
@@ -2176,15 +2176,24 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
+ if (it->ID == layerID)
{
- (*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->ID == layerID)
+ break;
+ invalidateLayer(it->ID);
+ }
changed();
+ }
return found;
}
@@ -2195,8 +2204,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
- return (*it).flowControl;
+ if (it->ID == layerID)
+ return it->flowControl;
}
return false;
}
@@ -2209,9 +2218,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
+ if (it->ID == layerID)
{
- (*it).transparency = trans;
+ it->transparency = trans;
found=true;
break;
}
@@ -2228,8 +2237,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
- return (*it).transparency;
+ if (it->ID == layerID)
+ return it->transparency;
}
return 1.0;
}
@@ -2242,9 +2251,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
+ if (it->ID == layerID)
{
- (*it).blendMode = blend;
+ it->blendMode = blend;
found=true;
break;
}
@@ -2261,8 +2270,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
- return (*it).blendMode;
+ if (it->ID == layerID)
+ return it->blendMode;
}
return 0;
}
@@ -2275,9 +2284,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
+ if (it->ID == layerID)
{
- (*it).outlineMode = outline;
+ it->outlineMode = outline;
found=true;
break;
}
@@ -2294,8 +2303,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
- return (*it).outlineMode;
+ if (it->ID == layerID)
+ return it->outlineMode;
}
return false;
}
@@ -2308,9 +2317,9 @@
bool found=false;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
+ if (it->ID == layerID)
{
- (*it).markerColor = color;
+ it->markerColor = color;
found=true;
break;
}
@@ -2327,8 +2336,8 @@
ScLayers::iterator it;
for (it = Layers.begin(); it != itend; ++it)
{
- if ((*it).ID == layerID)
- return (*it).markerColor;
+ if (it->ID == layerID)
+ return it->markerColor;
}
return QColor(0, 0, 0);
}
@@ -2386,18 +2395,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->ID);
+ if (it->Level == maxLevel)
+ break;
+ }
return true;
}
@@ -2424,18 +2442,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->ID);
+ if (it->Level == maxLevel)
+ break;
+ }
return true;
}
@@ -10009,6 +10036,26 @@
}
}
+void ScribusDoc::invalidateLayer(int layerID)
+{
+ for (int c = 0; c < DocItems.count(); ++c)
+ {
+ PageItem *ite = DocItems.at(c);
+ if (ite->LayerID == layerID)
+ ite->invalidateLayout();
+ }
+ if (this->masterPageMode())
+ {
+ for (int c=0; c < MasterItems.count(); ++c)
+ {
+ PageItem *ite = MasterItems.at(c);
+ if (ite->LayerID == 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 15234)
+++ scribus/scribusdoc.h (revision 15235)
@@ -142,6 +142,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);
Index: scribus/ui/layers.cpp
===================================================================
--- scribus/ui/layers.cpp (revision 15234)
+++ scribus/ui/layers.cpp (revision 15235)
@@ -399,6 +399,7 @@
if (strcmp(senderBox->metaObject()->className(), "QCheckBox") == 0)
{
m_Doc->setLayerFlow(layerID,((QCheckBox*)(senderBox))->isChecked());
+ emit LayerChanged();
setActiveLayer(Table->currentRow(), -1);
}
}
More information about the scribus-commit
mailing list