Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 23187 → Rev 23188

/trunk/Scribus/scribus/pageitem.cpp
10032,18 → 10032,6
return last;
}
 
bool PageItem::areNextInChainOnSamePage() const
{
const PageItem* next = this;
while (next->nextInChain() != nullptr)
{
next = next->nextInChain();
if (next->OwnPage != this->OwnPage)
return false;
}
return true;
}
 
QRect PageItem::getRedrawBounding(double viewScale) const
{
int x = qRound(floor(BoundingX - m_oldLineWidth / 2.0 - 5) * viewScale);
/trunk/Scribus/scribus/pageitem.h
473,7 → 473,6
const PageItem* prevInChain() const { return BackBox; }
const PageItem* nextInChain() const { return NextBox; }
bool isInChain() const { return ((BackBox != nullptr) || (NextBox != nullptr)); }
bool areNextInChainOnSamePage() const;
 
bool canBeLinkedTo(const PageItem* nextFrame) const;
void unlink(bool createUndo = true);
1691,8 → 1690,8
protected: // Start protected variables
PageItem *BackBox;
PageItem *NextBox;
uint firstChar;
uint m_maxChars;
int firstChar;
int m_maxChars;
bool m_sampleItem; ///< Used to not draw the frame for sample items
MarginStruct m_textDistanceMargins; ///< Left, Top, Bottom, Right distances of text from the frame
int verticalAlign;
/trunk/Scribus/scribus/scribusdoc.cpp
13609,7 → 13609,30
std::vector<int> pages;
QString pageRange;
 
if (dialogData.pageSelection == 1)
if (!m_Selection->itemsAreOnSamePage())
{
int firstPage = Pages->count(), lastPage = 0;
for (auto item: selection.items())
{
if ((item->OwnPage >= 0) && (item->OwnPage < firstPage))
firstPage = item->OwnPage;
if ((item->OwnPage) >= 0 && (item->OwnPage > lastPage))
lastPage = item->OwnPage;
}
setCurrentPage(Pages->at(firstPage));
int pageSpread = lastPage - firstPage + 1;
QStringList pageList;
if (dialogData.pageSelection == 1)
for (int i = lastPage + 2; i < Pages->count(); i += pageSpread)
pageList << QString::number(i);
else if (dialogData.pageSelection == 4)
{
// TODO: what to do with manual selections?
pageRange = dialogData.pageRange;
}
pageRange = pageList.join(',');
}
else if (dialogData.pageSelection == 1)
pageRange = QString("%1-%2").arg(currPageNumber + 2).arg(Pages->count());
else if ((dialogData.pageSelection == 2) || dialogData.pageSelection == 3)
{
13639,15 → 13662,10
// get the first text frame in the selection, the first frame in the chain
if (item->itemType() != PageItem::TextFrame)
continue;
if (item->isInChain() && item->areNextInChainOnSamePage())
{
if (item->isInChain())
lastInChain = item->lastInChain();
assert( !lastInChain->nextInChain() );
}
else
{
lastInChain = item;
}
break;
}
}
/trunk/Scribus/scribus/selection.cpp
532,6 → 532,24
return true;
}
 
bool Selection::itemsAreOnSamePage() const
{
//CB Putting count=1 before isempty test as its probably the most likely, given our view code.
if (m_SelList.count() == 1)
return true;
if (m_SelList.isEmpty())
return false;
auto it = m_SelList.begin();
auto itend = m_SelList.end();
auto ownPage = (*it)->OwnPage;
for ( ; it!=itend ; ++it)
{
if ((*it)->OwnPage != ownPage)
return false;
}
return true;
}
 
int Selection::objectsLayer() const
{
if (m_SelList.isEmpty())
/trunk/Scribus/scribus/selection.h
158,6 → 158,8
bool containsItemType(PageItem::ItemType type) const;
//!\brief Test to see if all items in the selection are the same typedef
bool itemsAreSameType() const;
//!\brief Test to see if all items in the selection are on same page
bool itemsAreOnSamePage() const;
 
/**
* \brief get the layer ID of items in the selection
/trunk/Scribus/scribus/ui/multipleduplicate.cpp
15,6 → 15,7
 
#include "iconmanager.h"
#include "scribusdoc.h"
#include "selection.h"
#include "scrspinbox.h"
#include "units.h"
#include "ui/createrange.h"
43,6 → 44,12
rotationSpinBox->setValues(-180.0, 180.0, 6, 0.0);
rotationSpinBox->setDecimals(1);
rotationSpinBox->setNewUnit(6);
 
if (!m_Doc->m_Selection->itemsAreOnSamePage())
{
radioButtonPageOdd->setEnabled(false);
radioButtonPageEven->setEnabled(false);
}
createGapRadioButton->setChecked(true);
setCopiesGap();