diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp
index 041f139e7..e16169c31 100644
--- a/scribus/scribusdoc.cpp
+++ b/scribus/scribusdoc.cpp
@@ -13796,45 +13796,51 @@ void ScribusDoc::multipleDuplicateByPage(const ItemMultipleDuplicateData& dialog
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;
+ if (item->OwnPage >= 0)
+ {
+ if (item->OwnPage < firstPage)
+ firstPage = item->OwnPage;
+ if (item->OwnPage > lastPage)
+ lastPage = item->OwnPage;
+ }
}
setCurrentPage(Pages->at(firstPage));
int pageSpread = lastPage - firstPage + 1;
QStringList pageList;
+ // with multi-page selection, only "following pages" is available
+ for (int i = lastPage + 2; i < Pages->count(); i += pageSpread)
+ pageList << QString::number(i);
+ pageRange = pageList.join(',');
+ }
+ else
+ {
if (dialogData.pageSelection == 1)
- for (int i = lastPage + 2; i < Pages->count(); i += pageSpread)
+ pageRange = QString("%1-%2").arg(currPageNumber + 2).arg(Pages->count());
+ else if ((dialogData.pageSelection == 2) || dialogData.pageSelection == 3)
+ {
+ int start = currPageNumber + 2;
+ // round to the next odd / even number
+ if (dialogData.pageSelection == 2)
+ start += start % 2;
+ else
+ start += 1 - (start % 2);
+
+ QStringList pageList;
+ for (int i = start; i <= Pages->count(); i += 2)
pageList << QString::number(i);
+ pageRange = pageList.join(',');
+ }
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)
- {
- int start = currPageNumber + 2;
- // round to the next odd / even number
- if (dialogData.pageSelection == 2)
- start += start % 2;
- else
- start += 1 - (start % 2);
+ parsePagesString(pageRange, &pages, Pages->count());
- QStringList pageList;
- for (int i = start; i <= Pages->count(); i += 2)
- pageList << QString::number(i);
- pageRange = pageList.join(',');
+ if (dialogData.copyCount > 0 && dialogData.copyCount < pages.size()) {
+ pages.resize(dialogData.copyCount);
+ pages.shrink_to_fit();
}
- else if (dialogData.pageSelection == 4)
- {
- pageRange = dialogData.pageRange;
- }
- parsePagesString(pageRange, &pages, Pages->count());
PageItem* lastInChain = nullptr;
if (dialogData.pageLinkText)
diff --git a/scribus/ui/multipleduplicate.cpp b/scribus/ui/multipleduplicate.cpp
index d569dbf0b..796d1b7f5 100644
--- a/scribus/ui/multipleduplicate.cpp
+++ b/scribus/ui/multipleduplicate.cpp
@@ -50,12 +50,22 @@ MultipleDuplicate::MultipleDuplicate(QWidget* parent, ScribusDoc *doc) : QDialog
{
radioButtonPageOdd->setEnabled(false);
radioButtonPageEven->setEnabled(false);
+ radioButtonPageRange->setEnabled(false);
+ lineEditPageRange->setEnabled(false);
+ toolButtonPageRange->setEnabled(false);
}
createGapRadioButton->setChecked(true);
setCopiesGap();
+ spinBoxMaxCopies->setToolTip(tr("Maximal number of duplicates to be created"));
+ spinBoxMaxCopies->setMinimum(0);
+ spinBoxMaxCopies->setSpecialValueText( tr( "Auto" ));
+ spinBoxMaxCopies->setDecimals(0);
+ spinBoxMaxCopies->setSuffix("");
+
toolButtonPageRange->setIcon(IconManager::instance().loadIcon("ellipsis.png"));
+
radioButtonPageAll->setChecked(true);
// signals and slots connections
@@ -96,16 +106,20 @@ void MultipleDuplicate::getMultiplyData(ItemMultipleDuplicateData& mdData)
mdData.gridCols = gridColsSpinBox->value();
mdData.gridGapH = horizRCGapSpinBox->value();
mdData.gridGapV = vertRCGapSpinBox->value();
- if (radioButtonPageAll->isChecked())
- mdData.pageSelection = 1;
- else if (radioButtonPageEven->isChecked())
- mdData.pageSelection = 2;
- else if (radioButtonPageOdd->isChecked())
- mdData.pageSelection = 3;
- else if (radioButtonPageRange->isChecked())
- mdData.pageSelection = 4;
- mdData.pageRange = lineEditPageRange->text();
- mdData.pageLinkText = checkBoxPageLinkText->isChecked();
+ if (mdData.type == 2)
+ {
+ if (radioButtonPageAll->isChecked())
+ mdData.pageSelection = 1;
+ else if (radioButtonPageEven->isChecked())
+ mdData.pageSelection = 2;
+ else if (radioButtonPageOdd->isChecked())
+ mdData.pageSelection = 3;
+ else if (radioButtonPageRange->isChecked())
+ mdData.pageSelection = 4;
+ mdData.pageRange = lineEditPageRange->text();
+ mdData.pageLinkText = checkBoxPageLinkText->isChecked();
+ mdData.copyCount = spinBoxMaxCopies->value();
+ }
}
void MultipleDuplicate::selectRangeOfPages()
diff --git a/scribus/ui/multipleduplicate.ui b/scribus/ui/multipleduplicate.ui
index 61d54b178..1b21d2605 100644
--- a/scribus/ui/multipleduplicate.ui
+++ b/scribus/ui/multipleduplicate.ui
@@ -10,7 +10,7 @@
0
0
426
- 294
+ 329
@@ -381,6 +381,43 @@
+ -
+
+
-
+
+
+ Number of copies:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Auto
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
-
-
@@ -423,7 +460,7 @@
ScrSpinBox
QDoubleSpinBox
-
+
diff --git a/scribus/usertaskstructs.h b/scribus/usertaskstructs.h
index 8c498283e..5ac48395f 100644
--- a/scribus/usertaskstructs.h
+++ b/scribus/usertaskstructs.h
@@ -34,7 +34,7 @@ struct InsertAFrameData
struct ItemMultipleDuplicateData
{
- int type = 0;
+ int type = 0; // 0 = by number, 1 = by rows & columns, 2 = by page
int copyCount = 0;
int copyShiftOrGap = 0;
double copyShiftGapH = 0.0;