r22712 by jghali - #15422: Remove PageItem::hasLinks() and rename PageItem's testLinkCandidate() to canBeLinkedTo()
scribus-commit
scribus-commit at lists.scribus.net
Sun Sep 30 20:54:51 UTC 2018
Author: jghali
Date: Sun Sep 30 20:54:51 2018
New Revision: 22712
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22712
Log:
#15422: Remove PageItem::hasLinks() and rename PageItem's testLinkCandidate() to canBeLinkedTo()
Modified:
trunk/Scribus/scribus/canvasmode_framelinks.cpp
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
trunk/Scribus/scribus/scribusdoc.cpp
Modified: trunk/Scribus/scribus/canvasmode_framelinks.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22712&path=/trunk/Scribus/scribus/canvasmode_framelinks.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_framelinks.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_framelinks.cpp Sun Sep 30 20:54:51 2018
@@ -98,7 +98,7 @@
PageItem* item2 = m_doc->m_Selection->itemAt(i+1);
if ((item1 != nullptr && item1->asTextFrame()) &&
(item2 != nullptr && item2->asTextFrame()) &&
- item1->testLinkCandidate(item2))
+ item1->canBeLinkedTo(item2))
{
item1->link(item2);
}
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22712&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Sun Sep 30 20:54:51 2018
@@ -1295,7 +1295,7 @@
return qMin(signed(MaxChars), itemText.length()) - 1;
}
-bool PageItem::testLinkCandidate(PageItem* nxt)
+bool PageItem::canBeLinkedTo(PageItem* nxt)
{
if (this->nextInChain() )
return false;
@@ -1303,7 +1303,7 @@
return false;
for (PageItem* ff=nxt; ff; ff=ff->nextInChain())
{
- if (ff == this) return false;
+ if (ff == this)return false;
}
return true;
}
@@ -1484,11 +1484,6 @@
// JG we should set BackBox and NextBox to nullptr at a point
BackBox = NextBox = nullptr;
-}
-
-bool PageItem::hasLinks() const
-{
- return (BackBox != nullptr || NextBox != nullptr);
}
//unlink selected frame from text chain
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22712&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Sun Sep 30 20:54:51 2018
@@ -380,8 +380,6 @@
ObjectAttribute getObjectAttribute(const QString&) const;
void setObjectAttributes(ObjAttrVector*);
-
-
void SetFrameShape(int count, const double *vals);
void SetRectFrame();
void SetOvalFrame();
@@ -389,7 +387,6 @@
QTransform getGroupTransform() const;
void getTransform(QTransform& mat) const;
QTransform getTransform() const;
-
/// invalidates current layout information
virtual void invalidateLayout() { invalid = true; }
@@ -454,23 +451,22 @@
void setCompressionMethodIndex(int val) { CompressionMethodIndex = val; }
void setOverrideCompressionQuality(bool val) { OverrideCompressionQuality = val; }
void setCompressionQualityIndex(int val) { CompressionQualityIndex = val; }
+
+ //you can change all code for search first or last item in chain
+ PageItem* firstInChain();
+ PageItem* lastInChain();
PageItem* prevInChain() { return BackBox; }
PageItem* nextInChain() { return NextBox; }
const PageItem* prevInChain() const { return BackBox; }
const PageItem* nextInChain() const { return NextBox; }
- //simplify conditions checking if frame is in chain
- //FIX: use it in other places
- bool isInChain() { return ((prevInChain() != nullptr) || (nextInChain() != nullptr)); }
-
- //you can change all code for search first or last item in chain
- PageItem* firstInChain();
- PageItem* lastInChain();
- bool testLinkCandidate(PageItem* nextFrame);
+ bool isInChain() { return ((BackBox != nullptr) || (NextBox != nullptr)); }
+
+ bool canBeLinkedTo(PageItem* nextFrame);
void unlink(bool createUndo = true);
void link(PageItem* nextFrame, bool addPARSEP = true);
void dropLinks();
- bool hasLinks() const;
void unlinkWithText(bool);
+
void setSampleItem(bool b) {m_sampleItem=b;}
const QVector<double>& dashes() const { return DashValues; }
QVector<double>& dashes() { return DashValues; }
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22712&path=/trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp Sun Sep 30 20:54:51 2018
@@ -1281,7 +1281,7 @@
PageItem *Itn = m_Doc->Items->at(itemRemap[lc.value()]);
assert(Its && Its->asTextFrame());
assert(Itn && Itn->asTextFrame());
- if (!Its->testLinkCandidate(Itn))
+ if (!Its->canBeLinkedTo(Itn))
{
qDebug("scribus12format: corruption in linked textframes detected");
continue;
@@ -2139,7 +2139,7 @@
PageItem *Itn = m_Doc->Items->at(itemRemap[lc.value()]);
assert(Its && Its->asTextFrame());
assert(Itn && Itn->asTextFrame());
- if (!Its->testLinkCandidate(Itn))
+ if (!Its->canBeLinkedTo(Itn))
{
qDebug("scribus12format: corruption in linked textframes detected");
continue;
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22712&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Sun Sep 30 20:54:51 2018
@@ -614,7 +614,7 @@
Its = m_Doc->DocItems.at(lc.key());
if (lc.value() < m_Doc->DocItems.count())
Itn = m_Doc->DocItems.at(lc.value());
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus134format: corruption in linked textframes detected";
continue;
@@ -636,7 +636,7 @@
Its = m_Doc->MasterItems.at(lc.key());
if (lc.value() < m_Doc->MasterItems.count())
Itn = m_Doc->MasterItems.at(lc.value());
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus134format: corruption in linked textframes detected";
continue;
@@ -3442,7 +3442,7 @@
Its = m_Doc->DocItems.at(lc.key());
if (itemRemap[lc.value()] < m_Doc->DocItems.count())
Itn = m_Doc->DocItems.at(itemRemap[lc.value()]);
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus134format: corruption in linked textframes detected";
continue;
@@ -3463,7 +3463,7 @@
Its = m_Doc->MasterItems.at(lc.key());
if (itemRemapM[lc.value()] < m_Doc->MasterItems.count())
Itn = m_Doc->MasterItems.at(itemRemapM[lc.value()]);
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus134format: corruption in linked textframes detected";
continue;
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22712&path=/trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp Sun Sep 30 20:54:51 2018
@@ -1102,7 +1102,7 @@
Its = m_Doc->Items->at(lc.key());
if (itemRemap[lc.value()] < m_Doc->Items->count())
Itn = m_Doc->Items->at(itemRemap[lc.value()]);
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug("scribus13format: corruption in linked textframes detected");
continue;
@@ -2428,7 +2428,7 @@
Its = m_Doc->Items->at(lc.key());
if (itemRemap[lc.value()] < m_Doc->Items->count())
Itn = m_Doc->Items->at(itemRemap[lc.value()]);
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug("scribus13format: corruption in linked textframes detected");
continue;
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22712&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Sun Sep 30 20:54:51 2018
@@ -459,7 +459,7 @@
{
PageItem * Its = LinkID[lc.key()];
PageItem * Itn = LinkID[lc.value()];
- if (!Its->testLinkCandidate(Itn))
+ if (!Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -567,7 +567,7 @@
Its = m_Doc->DocItems.at(lc.key());
if (lc.value() < m_Doc->DocItems.count())
Itn = m_Doc->DocItems.at(lc.value());
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -958,7 +958,7 @@
{
PageItem * Its = LinkID[lc.key()];
PageItem * Itn = LinkID[lc.value()];
- if (!Its->testLinkCandidate(Itn))
+ if (!Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -1066,7 +1066,7 @@
Its = m_Doc->DocItems.at(lc.key());
if (lc.value() < m_Doc->DocItems.count())
Itn = m_Doc->DocItems.at(lc.value());
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -1087,7 +1087,7 @@
Its = m_Doc->MasterItems.at(lc.key());
if (lc.value() < m_Doc->MasterItems.count())
Itn = m_Doc->MasterItems.at(lc.value());
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -1641,7 +1641,7 @@
{
PageItem * Its = LinkID[lc.key()];
PageItem * Itn = LinkID[lc.value()];
- if (!Its->testLinkCandidate(Itn))
+ if (!Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -1748,7 +1748,7 @@
Its = m_Doc->DocItems.at(lc.key());
if (lc.value() < m_Doc->DocItems.count())
Itn = m_Doc->DocItems.at(lc.value());
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -1769,7 +1769,7 @@
Its = m_Doc->MasterItems.at(lc.key());
if (lc.value() < m_Doc->MasterItems.count())
Itn = m_Doc->MasterItems.at(lc.value());
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -6404,7 +6404,7 @@
{
PageItem * Its = LinkID[lc.key()];
PageItem * Itn = LinkID[lc.value()];
- if (!Its->testLinkCandidate(Itn))
+ if (!Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -6466,7 +6466,7 @@
Its = m_Doc->DocItems.at(lc.key());
if (itemRemap[lc.value()] < m_Doc->DocItems.count())
Itn = m_Doc->DocItems.at(itemRemap[lc.value()]);
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
@@ -6487,7 +6487,7 @@
Its = m_Doc->MasterItems.at(lc.key());
if (itemRemapM[lc.value()] < m_Doc->MasterItems.count())
Itn = m_Doc->MasterItems.at(itemRemapM[lc.value()]);
- if (!Its || !Itn || !Its->testLinkCandidate(Itn))
+ if (!Its || !Itn || !Its->canBeLinkedTo(Itn))
{
qDebug() << "scribus150format: corruption in linked textframes detected";
continue;
Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22712&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp Sun Sep 30 20:54:51 2018
@@ -666,7 +666,7 @@
{
PageItem *Its = lc.key();
PageItem *Itn = frameTargets[lc.value()];
- if (Its->testLinkCandidate(Itn))
+ if (Its->canBeLinkedTo(Itn))
Its->link(Itn);
}
}
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22712&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Sun Sep 30 20:54:51 2018
@@ -11469,7 +11469,7 @@
}
else
{
- if (currItem->asTextFrame() && !currItem->hasLinks())
+ if (currItem->asTextFrame() && !currItem->isInChain())
{
currItem->itemText.selectAll();
currItem->asTextFrame()->removeMarksFromText(true);
More information about the scribus-commit
mailing list