r20528 by craig -
scribus-commit
scribus-commit at lists.scribus.net
Wed Nov 4 22:58:05 UTC 2015
Author: craig
Date: Wed Nov 4 22:58:05 2015
New Revision: 20528
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20528
Log:
#11812: Thanks to anood for inspiration. Much wider fix found and applied. Also page updates now work as standard to item Mark's references
Added:
trunk/Scribus/scribus/marks.cpp (with props)
Modified:
trunk/Scribus/scribus/CMakeLists.txt
trunk/Scribus/scribus/marks.h
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/scribusdoc.cpp
trunk/Scribus/scribus/text/storytext.cpp
Modified: trunk/Scribus/scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20528&path=/trunk/Scribus/scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/CMakeLists.txt Wed Nov 4 22:58:05 2015
@@ -621,6 +621,7 @@
latexhelpers.cpp
loadsaveplugin.cpp
localemgr.cpp
+ marks.cpp
menumanager.cpp
mesh.cpp
navigator.cpp
Modified: trunk/Scribus/scribus/marks.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20528&path=/trunk/Scribus/scribus/marks.h
==============================================================================
--- trunk/Scribus/scribus/marks.h (original)
+++ trunk/Scribus/scribus/marks.h Wed Nov 4 22:58:05 2015
@@ -1,7 +1,7 @@
#ifndef MARKS_H
#define MARKS_H
-#include "QString"
+#include <QString>
#include "scribusapi.h"
#include "desaxe/saxiohelper.h"
#include "desaxe/simple_actions.h"
@@ -80,8 +80,8 @@
void setMark(QString l, MarkType t) { data.destmarkName = l; data.destmarkType = t; }
const MarkType getMarkType() { return data.markTyp; }
void setMarkType(MarkType t) { data.markTyp = t; }
- const QString getString() { return data.strtxt; }
- void setString( const QString str ) { data.strtxt = str; }
+ const QString getString();
+ void setString( const QString str );
TextNote* getNotePtr() { return data.notePtr; }
void setNotePtr(TextNote *note) { data.notePtr = note; }
@@ -107,3 +107,4 @@
};
#endif // MARKS_H
+
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20528&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 Wed Nov 4 22:58:05 2015
@@ -3431,7 +3431,6 @@
Mark* mark = doc->newMark();
mark->label=attrs.valueAsString("label");
mark->setType(type);
-
if (type == MARKVariableTextType && attrs.hasAttribute("str"))
mark->setString(attrs.valueAsString("str"));
if (type == MARK2ItemType && attrs.hasAttribute("ItemID"))
@@ -6696,7 +6695,7 @@
if (LinkID.contains(ItemID))
{
mrk->setItemPtr(LinkID[ItemID]);
- mrk->setString(QString("%1").arg(mrk->getItemPtr()->OwnPage +1));
+ mrk->setString(m_Doc->getSectionPageNumberForPageIndex(mrk->getItemPtr()->OwnPage));
}
else
{
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20528&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Nov 4 22:58:05 2015
@@ -9478,9 +9478,9 @@
{
Mark* mrk = NULL;
Mark oldMark;
- MarkData d;
+ MarkData markdata;
if (currItem != NULL)
- d.itemName = currItem->itemName();
+ markdata.itemName = currItem->itemName();
QString label = "", text = "";
NotesStyle* NStyle = NULL;
bool insertExistedMark = false;
@@ -9491,7 +9491,7 @@
insertMDialog->values(label);
if (label.isEmpty())
label = tr("Anchor mark");
- d.itemPtr = currItem;
+ markdata.itemPtr = currItem;
break;
case MARKVariableTextType:
mrk = insertMDialog->values(label, text);
@@ -9499,15 +9499,15 @@
return false; //FIX ME here user should be warned that inserting of mark fails and why
if (label.isEmpty())
label = tr("Mark with <%1> variable text").arg(text);
- d.strtxt = text;
+ markdata.strtxt = text;
break;
case MARK2ItemType:
- insertMDialog->values(label, d.itemPtr);
- if (d.itemPtr == NULL)
+ insertMDialog->values(label, markdata.itemPtr);
+ if (markdata.itemPtr == NULL)
return false; //FIX ME here user should be warned that inserting of mark fails and why
if (label.isEmpty())
- label = tr("Mark to %1 item").arg(d.itemPtr->itemName());
- d.strtxt = QString::number(d.itemPtr->OwnPage +1);
+ label = tr("Mark to %1 item").arg(markdata.itemPtr->itemName());
+ markdata.strtxt = QString::number(markdata.itemPtr->OwnPage +1);
break;
case MARK2MarkType:
//gets pointer to referenced mark
@@ -9517,9 +9517,9 @@
return false; //FIX ME here user should be warned that inserting of mark fails and why
if (label.isEmpty())
label = tr("Mark to %1 mark").arg(mrkPtr->label);
- d.strtxt = QString::number(mrkPtr->OwnPage +1);
- d.destmarkName = mrkPtr->label;
- d.destmarkType = mrkPtr->getType();
+ markdata.strtxt = QString::number(mrkPtr->OwnPage +1);
+ markdata.destmarkName = mrkPtr->label;
+ markdata.destmarkType = mrkPtr->getType();
break;
case MARKNoteMasterType:
//gets pointer to chosen notes style
@@ -9527,7 +9527,7 @@
if (NStyle == NULL)
return false;
- d.notePtr = doc->newNote(NStyle);
+ markdata.notePtr = doc->newNote(NStyle);
label = "NoteMark_" + NStyle->name();
if (NStyle->range() == NSRsection)
label += " in section " + doc->getSectionNameForPageIndex(currItem->OwnPage) + " page " + QString::number(currItem->OwnPage +1);
@@ -9558,12 +9558,12 @@
else
getUniqueName(label,doc->marksLabelsList(mrkType), "_");
mrk = doc->newMark();
- mrk->setValues(label, currItem->OwnPage, mrkType, d);
+ mrk->setValues(label, currItem->OwnPage, mrkType, markdata);
}
else
{ // that must be variable text mark
oldMark = *mrk;
- mrk->setString(d.strtxt);
+ mrk->setString(markdata.strtxt);
mrk->label = label;
insertExistedMark = true;
doc->flag_updateMarksLabels = true;
@@ -9709,9 +9709,9 @@
{
Mark oldMark = *mrk;
Mark* Mrk = NULL;
- MarkData d;
+ MarkData markdata;
if (currItem != NULL)
- d.itemName = currItem->itemName();
+ markdata.itemName = currItem->itemName();
QString label = "", text = "";
QString oldStr = mrk->getString();
bool newMark = false;
@@ -9759,25 +9759,26 @@
}
else
{
- d.strtxt = text;
+ markdata.strtxt = text;
mrk = doc->newMark();
getUniqueName(label,doc->marksLabelsList(mrk->getType()), "_"); //FIX ME here user should be warned that inserted mark`s label was changed
- mrk->setValues(label, currItem->OwnPage, MARKVariableTextType, d);
+ mrk->setValues(label, currItem->OwnPage, MARKVariableTextType, markdata);
currItem->itemText.replaceMark(currItem->itemText.cursorPosition(), mrk);
docWasChanged = true;
newMark = true;
}
break;
case MARK2ItemType:
- editMDialog->values(label, d.itemPtr);
- if (d.itemPtr == NULL)
+ editMDialog->values(label, markdata.itemPtr);
+ if (markdata.itemPtr == NULL)
return false; //FIX ME here user should be warned that inserting of mark fails and why
if (label.isEmpty())
- label = tr("Mark to %1 item").arg(d.itemPtr->itemName());
- if (d.itemPtr != mrk->getItemPtr())
+ label = tr("Mark to %1 item").arg(markdata.itemPtr->itemName());
+ if (markdata.itemPtr != mrk->getItemPtr())
{
- mrk->setItemPtr(d.itemPtr);
- mrk->setString(QString("%1").arg(d.itemPtr->OwnPage +1));
+ qDebug()<<"MarkTester"<<"4";
+ mrk->setItemPtr(markdata.itemPtr);
+ mrk->setString(doc->getSectionPageNumberForPageIndex(markdata.itemPtr->OwnPage));
docWasChanged = true;
}
if (mrk->label != label)
@@ -9797,10 +9798,11 @@
label = tr("Mark to %1 mark").arg(mrkPtr->label);
QString destLabel = mrkPtr->label;
MarkType destType = mrkPtr->getType();
- if (d.destmarkName != destLabel || d.destmarkType != destType)
+ if (markdata.destmarkName != destLabel || markdata.destmarkType != destType)
{
mrk->setMark(mrkPtr);
- mrk->setString(QString("%1").arg(mrkPtr->OwnPage +1));
+ qDebug()<<"MarkTester"<<"5";
+ mrk->setString(doc->getSectionPageNumberForPageIndex(mrkPtr->OwnPage));
docWasChanged = true;
}
if (mrk->label != label)
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20528&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Nov 4 22:58:05 2015
@@ -6414,6 +6414,7 @@
return;
if (!isLoading())
{
+ updateMarks(true);
FPoint minPoint, maxPoint;
canvasMinMax(minPoint, maxPoint);
FPoint maxSize(qMax(maxXPos, maxPoint.x()+docPrefsData.displayPrefs.scratch.right()), qMax(maxYPos, maxPoint.y()+docPrefsData.displayPrefs.scratch.bottom()));
@@ -7128,7 +7129,6 @@
break;
}
}
-
return retVal;
}
@@ -7146,7 +7146,7 @@
const QString ScribusDoc::getSectionPageNumberForPageIndex(const uint pageIndex) const
{
- QString retVal(QString::null);
+ QString retVal;
int key=getSectionKeyForPageIndex(pageIndex);
if (key==-1)
return retVal;
@@ -17392,7 +17392,7 @@
}
//update strings (page number) for marks pointed to anchors and items
-//and update marks list in Marka Manager
+//and update marks list in Marks Manager
bool ScribusDoc::updateMarks(bool updateNotesMarks)
{
if (updateNotesMarks && !notesList().isEmpty())
@@ -17483,15 +17483,11 @@
{
if (mrk->getItemPtr() != NULL)
{
- int page = mrk->getItemPtr()->OwnPage +1;
- if (mrk->getString().toInt() != page)
+ mrk->setString(getSectionPageNumberForPageIndex(mrk->getItemPtr()->OwnPage));
+ if (mItem != NULL)
{
- mrk->setString(QString("%1").arg(page));
- if (mItem != NULL)
- {
- mItem->asTextFrame()->invalidateLayout(false);
- docWasChanged = true;
- }
+ mItem->asTextFrame()->invalidateLayout(false);
+ docWasChanged = true;
}
}
else
@@ -17515,15 +17511,11 @@
else
{
destMark->OwnPage = dItem->OwnPage;
- int page = destMark->OwnPage +1;
- if (mrk->getString().toInt() != page)
+ mrk->setString(getSectionPageNumberForPageIndex(destMark->OwnPage));
+ if (mItem != NULL)
{
- mrk->setString(QString("%1").arg(page));
- if (mItem != NULL)
- {
- mItem->asTextFrame()->invalidateLayout(false);
- docWasChanged = true;
- }
+ mItem->asTextFrame()->invalidateLayout(false);
+ docWasChanged = true;
}
}
}
Modified: trunk/Scribus/scribus/text/storytext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20528&path=/trunk/Scribus/scribus/text/storytext.cpp
==============================================================================
--- trunk/Scribus/scribus/text/storytext.cpp (original)
+++ trunk/Scribus/scribus/text/storytext.cpp Wed Nov 4 22:58:05 2015
@@ -2152,7 +2152,7 @@
if (item == NULL)
mrk->setString("0");
else
- mrk->setString(QString::number(item->OwnPage));
+ mrk->setString(doc->getSectionPageNumberForPageIndex(item->OwnPage));
mrk->setItemName(Xml_data(iIt));
}
if (mrk->isType(MARK2MarkType) && (m_lIt != attr.end()) && (m_tIt != attr.end()))
@@ -2162,7 +2162,7 @@
if (targetMark == NULL)
mrk->setString("0");
else
- mrk->setString(QString::number(targetMark->OwnPage));
+ mrk->setString(doc->getSectionPageNumberForPageIndex(targetMark->OwnPage));
mrk->setItemName(Xml_data(m_lIt));
}
if (mrk->isType(MARKNoteMasterType))
More information about the scribus-commit
mailing list