View Issue Details

IDProjectCategoryView StatusLast Update
0016918ScribusMaster Pagespublic2023-04-25 21:02
Reporterale Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status newResolutionopen 
Product Version1.7.0.svn 
Summary0016918: move items when applying a master page
Descriptionwhen using the "apply master page" it should optionally possible to move all items.

i suggest adding a checkbox that allows the user to optionally move all the items on the page according to the changes in the left/inside/right/outside margin.

i have a working prototype for the UI and if craig and jean agree i can try to work on moving the items.
Tagspatch
PatchNo

Activities

ale

2023-03-30 11:30

manager  

apply_master_page.png (30,777 bytes)   
apply_master_page.png (30,777 bytes)   

ale

2023-03-30 11:35

manager   ~0050055

here is the current state of the patch
- creating a .ui file (for the second time... as i've discovered too late)
- adding the (inactive) widgets
applytemplatedialog.diff (13,870 bytes)   
diff --git a/Scribus.pro b/Scribus.pro
index f097e699f..f8d5b56e6 100644
--- a/Scribus.pro
+++ b/Scribus.pro
@@ -1010,6 +1010,7 @@ FORMS += scribus/ui/aboutplugins.ui \
          scribus/ui/actionsearchdialog.ui \
          scribus/ui/aligndistribute.ui \
          scribus/ui/annot.ui \
+         scribus/ui/applytemplatedialog.ui \
          scribus/ui/arcvectorbase.ui \
          scribus/ui/arcwidgetbase.ui \
          scribus/ui/charselect.ui \
diff --git a/scribus/ui/applytemplatedialog.cpp b/scribus/ui/applytemplatedialog.cpp
index 075997b1b..d0e709e6f 100644
--- a/scribus/ui/applytemplatedialog.cpp
+++ b/scribus/ui/applytemplatedialog.cpp
@@ -48,79 +48,84 @@ enum {
  */
 ApplyMasterPageDialog::ApplyMasterPageDialog( QWidget* parent ) : QDialog( parent )
 {
-	setModal(true);
-	setWindowTitle( tr( "Apply Master Page" ));
-	setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
-	ApplyMasterPageDialogLayout = new QVBoxLayout(this);
-	ApplyMasterPageDialogLayout->setContentsMargins(9, 9, 9, 9);
-	ApplyMasterPageDialogLayout->setSpacing(6);
-
-	templateNameLayout = new QHBoxLayout;
-	templateNameLayout->setContentsMargins(0, 0, 0, 0);
-	templateNameLayout->setSpacing(6);
-
-	masterPageLabel = new QLabel( this );
-	templateNameLayout->addWidget( masterPageLabel );
-	spacer2 = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
-	templateNameLayout->addItem( spacer2 );
-
-	masterPageComboBox = new QComboBox(this);
-	masterPageComboBox->setEditable(false);
-	templateNameLayout->addWidget( masterPageComboBox );
-	ApplyMasterPageDialogLayout->addLayout( templateNameLayout );
-
-	applyToPageButtonGroup = new QGroupBox(this);
-	applyToPageButtonGroup->setMinimumSize( QSize( 250, 0 ) );
-	applyToPageButtonGroupLayout = new QVBoxLayout(applyToPageButtonGroup);
-	applyToPageButtonGroupLayout->setSpacing(6);
-	applyToPageButtonGroupLayout->setContentsMargins(9, 9, 9, 9);
-
-	currentPageRadioButton = new QRadioButton( applyToPageButtonGroup );
-	currentPageRadioButton->setChecked( true );
-	applyToPageButtonGroupLayout->addWidget( currentPageRadioButton );
-
-	evenPagesRadioButton = new QRadioButton( applyToPageButtonGroup );
-	applyToPageButtonGroupLayout->addWidget( evenPagesRadioButton );
-
-	oddPagesRadioButton = new QRadioButton( applyToPageButtonGroup );
-	applyToPageButtonGroupLayout->addWidget( oddPagesRadioButton );
-
-	allPagesRadioButton = new QRadioButton( applyToPageButtonGroup );
-	applyToPageButtonGroupLayout->addWidget( allPagesRadioButton );
-
-	rangeLayout = new QHBoxLayout;
-	rangeLayout->setSpacing(6);
-	rangeLayout->setContentsMargins(0, 0, 0, 0);
-
-	useRangeCheckBox = new QCheckBox( applyToPageButtonGroup );
-	useRangeCheckBox->setEnabled( false );	
-	rangeLayout->addWidget( useRangeCheckBox );
-
-	fromPageSpinBox = new ScrSpinBox( applyToPageButtonGroup );
-	fromPageSpinBox->setEnabled( false );
-	fromPageSpinBox->setMinimum( 1 );
-	fromPageSpinBox->setDecimals(0);
+	setupUi(this);
+	setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
 	fromPageSpinBox->setSuffix("");
-	rangeLayout->addWidget( fromPageSpinBox );
-
-	toPageLabel = new QLabel( applyToPageButtonGroup );
-	rangeLayout->addWidget( toPageLabel );
-
-	toPageSpinBox = new ScrSpinBox( applyToPageButtonGroup );
-	toPageSpinBox->setEnabled( false );
-	toPageSpinBox->setMinimum( 1 );
-	toPageSpinBox->setDecimals(0);
 	toPageSpinBox->setSuffix("");
-	rangeLayout->addWidget( toPageSpinBox );
-	spacer3 = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
-	rangeLayout->addItem( spacer3 );
-	applyToPageButtonGroupLayout->addLayout( rangeLayout );
-	ApplyMasterPageDialogLayout->addWidget( applyToPageButtonGroup );
-
-	buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-	ApplyMasterPageDialogLayout->addWidget(buttonBox);
-	languageChange();
+
+	// setModal(true);
+	// setWindowTitle( tr( "Apply Master Page" ));
+	// setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
+	// ApplyMasterPageDialogLayout = new QVBoxLayout(this);
+	// ApplyMasterPageDialogLayout->setContentsMargins(9, 9, 9, 9);
+	// ApplyMasterPageDialogLayout->setSpacing(6);
+
+	// templateNameLayout = new QHBoxLayout;
+	// templateNameLayout->setContentsMargins(0, 0, 0, 0);
+	// templateNameLayout->setSpacing(6);
+
+	// masterPageLabel = new QLabel( this );
+	// templateNameLayout->addWidget( masterPageLabel );
+	// spacer2 = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
+	// templateNameLayout->addItem( spacer2 );
+
+	// masterPageComboBox = new QComboBox(this);
+	// masterPageComboBox->setEditable(false);
+	// templateNameLayout->addWidget( masterPageComboBox );
+	// ApplyMasterPageDialogLayout->addLayout( templateNameLayout );
+
+	// applyToPageButtonGroup = new QGroupBox(this);
+	// applyToPageButtonGroup->setMinimumSize( QSize( 250, 0 ) );
+	// applyToPageButtonGroupLayout = new QVBoxLayout(applyToPageButtonGroup);
+	// applyToPageButtonGroupLayout->setSpacing(6);
+	// applyToPageButtonGroupLayout->setContentsMargins(9, 9, 9, 9);
+
+	// currentPageRadioButton = new QRadioButton( applyToPageButtonGroup );
+	// currentPageRadioButton->setChecked( true );
+	// applyToPageButtonGroupLayout->addWidget( currentPageRadioButton );
+
+	// evenPagesRadioButton = new QRadioButton( applyToPageButtonGroup );
+	// applyToPageButtonGroupLayout->addWidget( evenPagesRadioButton );
+
+	// oddPagesRadioButton = new QRadioButton( applyToPageButtonGroup );
+	// applyToPageButtonGroupLayout->addWidget( oddPagesRadioButton );
+
+	// allPagesRadioButton = new QRadioButton( applyToPageButtonGroup );
+	// applyToPageButtonGroupLayout->addWidget( allPagesRadioButton );
+
+	// rangeLayout = new QHBoxLayout;
+	// rangeLayout->setSpacing(6);
+	// rangeLayout->setContentsMargins(0, 0, 0, 0);
+
+	// useRangeCheckBox = new QCheckBox( applyToPageButtonGroup );
+	// useRangeCheckBox->setEnabled( false );	
+	// rangeLayout->addWidget( useRangeCheckBox );
+
+	// fromPageSpinBox = new ScrSpinBox( applyToPageButtonGroup );
+	// fromPageSpinBox->setEnabled( false );
+	// fromPageSpinBox->setMinimum( 1 );
+	// fromPageSpinBox->setDecimals(0);
+	// fromPageSpinBox->setSuffix("");
+	// rangeLayout->addWidget( fromPageSpinBox );
+
+	// toPageLabel = new QLabel( applyToPageButtonGroup );
+	// rangeLayout->addWidget( toPageLabel );
+
+	// toPageSpinBox = new ScrSpinBox( applyToPageButtonGroup );
+	// toPageSpinBox->setEnabled( false );
+	// toPageSpinBox->setMinimum( 1 );
+	// toPageSpinBox->setDecimals(0);
+	// toPageSpinBox->setSuffix("");
+	// rangeLayout->addWidget( toPageSpinBox );
+	// spacer3 = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
+	// rangeLayout->addItem( spacer3 );
+	// applyToPageButtonGroupLayout->addLayout( rangeLayout );
+	// ApplyMasterPageDialogLayout->addWidget( applyToPageButtonGroup );
+
+	// buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+	// ApplyMasterPageDialogLayout->addWidget(buttonBox);
 	resize( QSize(268, 230).expandedTo(minimumSizeHint()) );
+	languageChange();
 
 	// signals and slots connections
 	connect( useRangeCheckBox, SIGNAL( toggled(bool) ), this, SLOT( enableRange(bool) ) );
@@ -132,9 +137,10 @@ ApplyMasterPageDialog::ApplyMasterPageDialog( QWidget* parent ) : QDialog( paren
 	connect( toPageSpinBox, SIGNAL( valueChanged(double) ), this, SLOT( checkRangeTo() ) );
 	connect(buttonBox, &QDialogButtonBox::accepted, this, &ApplyMasterPageDialog::accept);
 	connect(buttonBox, &QDialogButtonBox::rejected, this, &ApplyMasterPageDialog::reject);
+	connect(moveItemsCheckBox, &QCheckBox::toggled, this, &ApplyMasterPageDialog::enableItemsSelectable);
 
 	// buddies
-	masterPageLabel->setBuddy( masterPageComboBox );
+	// masterPageLabel->setBuddy( masterPageComboBox );
 }
 
 void ApplyMasterPageDialog::setup(ScribusDoc *doc, const QString& Nam)
@@ -158,6 +164,7 @@ void ApplyMasterPageDialog::setup(ScribusDoc *doc, const QString& Nam)
 	fromPageSpinBox->setValue(doc->currentPage()->pageNr() + 1);
 	toPageSpinBox->setMaximum(docPagesCount);
 	toPageSpinBox->setValue(docPagesCount);
+	facingPages = doc->pagePositioning() != 0;
 }
 
 
@@ -218,6 +225,14 @@ void ApplyMasterPageDialog::singleSelectable()
 	toPageSpinBox->setEnabled(false);
 }
 
+void ApplyMasterPageDialog::enableItemsSelectable(bool enabled)
+{
+	moveItemsAnchorComboBox->setEnabled(enabled);
+	moveItemsAnchorComboBox->setEnabled(enabled);
+	moveItemsMarginLabel->setEnabled(enabled);
+}
+
+
 
 bool ApplyMasterPageDialog::usingRange()
 {
@@ -252,19 +267,31 @@ void ApplyMasterPageDialog::changeEvent(QEvent *e)
 
 void ApplyMasterPageDialog::languageChange()
 {
-	setWindowTitle( tr( "Apply Master Page" ) );
-	masterPageLabel->setText( tr( "&Master Page:" ) );
-	applyToPageButtonGroup->setTitle( tr( "Apply to" ) );
-	currentPageRadioButton->setText( tr( "Current &Page" ) );
-	currentPageRadioButton->setShortcut( QKeySequence( tr( "Alt+P" ) ) );
-	evenPagesRadioButton->setText( tr( "&Even Pages" ) );
-	evenPagesRadioButton->setShortcut( QKeySequence( tr( "Alt+E" ) ) );
-	oddPagesRadioButton->setText( tr( "O&dd Pages" ) );
-	oddPagesRadioButton->setShortcut( QKeySequence( tr( "Alt+D" ) ) );
-	allPagesRadioButton->setText( tr( "&All Pages" ) );
-	allPagesRadioButton->setShortcut( QKeySequence( tr( "Alt+A" ) ) );
-	useRangeCheckBox->setText( tr( "&Within Range" ) );
-	useRangeCheckBox->setShortcut( QKeySequence( tr( "Alt+W" ) ) );
-	useRangeCheckBox->setToolTip( "<qt>" + tr( "Apply the selected master page to even, odd or all pages within the following range") + "</qt>" );
-	toPageLabel->setText( tr( "to" ) );
+	setWindowTitle(tr("Apply Master Page"));
+	masterPageLabel->setText(tr("&Master Page:"));
+	applyToPageButtonGroup->setTitle(tr("Apply to"));
+	currentPageRadioButton->setText(tr("Current &Page"));
+	currentPageRadioButton->setShortcut(QKeySequence(tr("Alt+P")));
+	evenPagesRadioButton->setText(tr("&Even Pages"));
+	evenPagesRadioButton->setShortcut(QKeySequence(tr("Alt+E")));
+	oddPagesRadioButton->setText(tr("O&dd Pages"));
+	oddPagesRadioButton->setShortcut(QKeySequence(tr("Alt+D")));
+	allPagesRadioButton->setText(tr("&All Pages"));
+	allPagesRadioButton->setShortcut(QKeySequence(tr("Alt+A")));
+	useRangeCheckBox->setText(tr("&Within Range"));
+	useRangeCheckBox->setShortcut(QKeySequence(tr("Alt+W")));
+	useRangeCheckBox->setToolTip("<qt>" + tr("Apply the selected master page to even, odd or all pages within the following range") + "</qt>");
+	toPageLabel->setText(tr("to"));
+	moveItemsCheckBox->setText(tr("Move Items with"));
+	moveItemsAnchorComboBox->clear();
+	if (facingPages) {
+		moveItemsAnchorComboBox->addItem(tr("Inside"));
+		moveItemsAnchorComboBox->addItem(tr("Outside"));
+	}
+	else
+	{
+		moveItemsAnchorComboBox->addItem(tr("Left"));
+		moveItemsAnchorComboBox->addItem(tr("Right"));
+	}
+	moveItemsMarginLabel->setText(tr("Margin"));
 }
diff --git a/scribus/ui/applytemplatedialog.h b/scribus/ui/applytemplatedialog.h
index 71dd7fef4..efc177f52 100644
--- a/scribus/ui/applytemplatedialog.h
+++ b/scribus/ui/applytemplatedialog.h
@@ -15,6 +15,8 @@ for which a new license (GPL+exception) is in place.
 #ifndef APPLYMASTERPAGEDIALOG_H
 #define APPLYMASTERPAGEDIALOG_H
 
+#include "ui_applytemplatedialog.h"
+
 #include <QDialog>
 #include <QDialogButtonBox>
 #include <QString>
@@ -35,7 +37,7 @@ class QRadioButton;
 class QSpacerItem;
 class QVBoxLayout;
 
-class SCRIBUS_API ApplyMasterPageDialog : public QDialog
+class SCRIBUS_API ApplyMasterPageDialog : public QDialog, Ui::ApplyMasterPage
 {
 	Q_OBJECT
 
@@ -43,17 +45,17 @@ public:
 	ApplyMasterPageDialog( QWidget* parent = nullptr );
 	~ApplyMasterPageDialog() = default;
 
-	QLabel* masterPageLabel { nullptr };
-	QComboBox* masterPageComboBox { nullptr };
-	QGroupBox* applyToPageButtonGroup { nullptr };
-	QRadioButton* currentPageRadioButton { nullptr };
-	QRadioButton* evenPagesRadioButton { nullptr };
-	QRadioButton* oddPagesRadioButton { nullptr };
-	QRadioButton* allPagesRadioButton { nullptr };
-	QCheckBox* useRangeCheckBox { nullptr };
-	ScrSpinBox* fromPageSpinBox { nullptr };
-	QLabel* toPageLabel { nullptr };
-	ScrSpinBox* toPageSpinBox { nullptr };
+	// QLabel* masterPageLabel { nullptr };
+	// QComboBox* masterPageComboBox { nullptr };
+	// QGroupBox* applyToPageButtonGroup { nullptr };
+	// QRadioButton* currentPageRadioButton { nullptr };
+	// QRadioButton* evenPagesRadioButton { nullptr };
+	// QRadioButton* oddPagesRadioButton { nullptr };
+	// QRadioButton* allPagesRadioButton { nullptr };
+	// QCheckBox* useRangeCheckBox { nullptr };
+	// ScrSpinBox* fromPageSpinBox { nullptr };
+	// QLabel* toPageLabel { nullptr };
+	// ScrSpinBox* toPageSpinBox { nullptr };
 
 	virtual void setup(ScribusDoc* doc, const QString& Nam);
 	virtual QString getMasterPageName();
@@ -63,14 +65,15 @@ public:
 	virtual int getToPage();
 
 protected:
-	QVBoxLayout* ApplyMasterPageDialogLayout { nullptr };
-	QHBoxLayout* templateNameLayout { nullptr };
-	QSpacerItem* spacer2 { nullptr };
-	QVBoxLayout* applyToPageButtonGroupLayout { nullptr };
-	QHBoxLayout* rangeLayout { nullptr };
-	QSpacerItem* spacer3 { nullptr };
-	QDialogButtonBox* buttonBox { nullptr };
+	// QVBoxLayout* ApplyMasterPageDialogLayout { nullptr };
+	// QHBoxLayout* templateNameLayout { nullptr };
+	// QSpacerItem* spacer2 { nullptr };
+	// QVBoxLayout* applyToPageButtonGroupLayout { nullptr };
+	// QHBoxLayout* rangeLayout { nullptr };
+	// QSpacerItem* spacer3 { nullptr };
+	// QDialogButtonBox* buttonBox { nullptr };
 	
+	bool facingPages = false;
 	void changeEvent(QEvent *e) override;
 
 protected slots:
@@ -82,6 +85,7 @@ private slots:
 	virtual void enableRange( bool enabled );
 	virtual void rangeSelectable();
 	virtual void singleSelectable();
+	virtual void enableItemsSelectable(bool enabled);
 
 };
 
applytemplatedialog.diff (13,870 bytes)   
applytemplatedialog.ui (6,663 bytes)   
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>ApplyMasterPage</class>
 <widget class="QDialog" name="ApplyMasterPage">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>380</width>
    <height>278</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Apply Master Page</string>
  </property>
  <layout class="QVBoxLayout" name="verticalLayout">
   <item>
    <layout class="QHBoxLayout" name="horizontalLayout">
     <item>
      <widget class="QLabel" name="masterPageLabel">
       <property name="text">
        <string>&amp;Master Page:</string>
       </property>
       <property name="buddy">
        <cstring>masterPageComboBox</cstring>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="horizontalSpacer">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>40</width>
         <height>20</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QComboBox" name="masterPageComboBox"/>
     </item>
    </layout>
   </item>
   <item>
    <widget class="QGroupBox" name="applyToPageButtonGroup">
     <property name="title">
      <string>Apply to</string>
     </property>
     <layout class="QVBoxLayout" name="verticalLayout_2">
      <item>
       <widget class="QRadioButton" name="currentPageRadioButton">
        <property name="text">
         <string>Current &amp;Page</string>
        </property>
        <property name="checked">
         <bool>true</bool>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QRadioButton" name="evenPagesRadioButton">
        <property name="text">
         <string>&amp;Even Pages</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QRadioButton" name="oddPagesRadioButton">
        <property name="text">
         <string>O&amp;dd Pages</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QRadioButton" name="allPagesRadioButton">
        <property name="text">
         <string>&amp;All Pages</string>
        </property>
       </widget>
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_2">
        <item>
         <widget class="QCheckBox" name="useRangeCheckBox">
          <property name="enabled">
           <bool>false</bool>
          </property>
          <property name="text">
           <string>&amp;Within Range</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="ScrSpinBox" name="fromPageSpinBox">
          <property name="enabled">
           <bool>false</bool>
          </property>
          <property name="decimals">
           <number>0</number>
          </property>
          <property name="minimum">
           <double>1.000000000000000</double>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QLabel" name="toPageLabel">
          <property name="enabled">
           <bool>false</bool>
          </property>
          <property name="text">
           <string>to</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="ScrSpinBox" name="toPageSpinBox">
          <property name="enabled">
           <bool>false</bool>
          </property>
          <property name="decimals">
           <number>0</number>
          </property>
          <property name="minimum">
           <double>1.000000000000000</double>
          </property>
         </widget>
        </item>
        <item>
         <spacer name="horizontalSpacer_2">
          <property name="orientation">
           <enum>Qt::Horizontal</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
            <width>40</width>
            <height>20</height>
           </size>
          </property>
         </spacer>
        </item>
       </layout>
      </item>
     </layout>
    </widget>
   </item>
   <item>
    <layout class="QHBoxLayout" name="horizontalLayout_3">
     <item>
      <widget class="QCheckBox" name="moveItemsCheckBox">
       <property name="enabled">
        <bool>true</bool>
       </property>
       <property name="toolTip">
        <string>All items on the page will be moved according to the displacement of the selected margin</string>
       </property>
       <property name="text">
        <string>Move Items with the</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QComboBox" name="moveItemsAnchorComboBox">
       <property name="enabled">
        <bool>false</bool>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QLabel" name="moveItemsMarginLabel">
       <property name="enabled">
        <bool>false</bool>
       </property>
       <property name="text">
        <string>Margin</string>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="horizontalSpacer_3">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>40</width>
         <height>20</height>
        </size>
       </property>
      </spacer>
     </item>
    </layout>
   </item>
   <item>
    <widget class="QDialogButtonBox" name="buttonBox">
     <property name="orientation">
      <enum>Qt::Horizontal</enum>
     </property>
     <property name="standardButtons">
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <customwidgets>
  <customwidget>
   <class>ScrSpinBox</class>
   <extends>QDoubleSpinBox</extends>
   <header>ui/scrspinbox.h</header>
  </customwidget>
 </customwidgets>
 <resources/>
 <connections>
  <connection>
   <sender>buttonBox</sender>
   <signal>accepted()</signal>
   <receiver>ApplyMasterPage</receiver>
   <slot>accept()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>248</x>
     <y>254</y>
    </hint>
    <hint type="destinationlabel">
     <x>157</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>buttonBox</sender>
   <signal>rejected()</signal>
   <receiver>ApplyMasterPage</receiver>
   <slot>reject()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>316</x>
     <y>260</y>
    </hint>
    <hint type="destinationlabel">
     <x>286</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>
applytemplatedialog.ui (6,663 bytes)   

ale

2023-03-30 16:57

manager   ~0050056

... as requested in https://forums.scribus.net/index.php/topic,4539.0.html ...

cbradney

2023-03-30 19:24

administrator   ~0050057

The idea seems reasonable to me. I have not yet tested it though. Will do.

ale

2023-03-30 19:32

manager   ~0050058

the patch above "does nothing". it only introduces a .ui file and the checkbox "move items with inside margin".

i've pasted here, so that the work i've done does not get lost...

during the weekend i will then try to find some time to add some "real" code to move the frames (i guess it will be more complex than the small python script i've written for doing the same task : - )

ale

2023-04-07 09:13

manager   ~0050102

status update: i can now "correctly" (according to my tests...) move the page items with the inside and outside margin, respecting the left and right pages.

yeah.

what is missing:

- clean up the code.
- correctly manage the undo.

i should be prepare a patch over easter.

(finally this note is at the right place... sorry, for the noise)

ale

2023-04-13 15:00

manager   ~0050110

voilĂ , i'm ready for a first version of the patch.

two remarks:

- i've created two functions and i don't know where it's the right place for defining them; currently, they are lambda function inside of ScribusMainWindow::ApplyMasterPage()
  - moveAllPageItems(): should it go to scpage.cpp?
  - getRelevantMarginsByAnchor(): scribus.cpp is already very busy... can it bear one more function? into applytemplatedialog.cpp? (but it's a UI class...)
- the undo code seems to be working... but, as noted in 0016919, it does not restore the margins. also, the labels for the undo transaction are wrong, but i could not find out how to do them right.

ideally, i would upload a branch on gitlab and let you review my patch there... but well... you can tell me in here how i can improve my patch or just apply it modified (obviously, the worse option for me...)
apply-masterpage.diff (16,272 bytes)   
diff --git a/Scribus.pro b/Scribus.pro
index f097e699f..f8d5b56e6 100644
--- a/Scribus.pro
+++ b/Scribus.pro
@@ -1010,6 +1010,7 @@ FORMS += scribus/ui/aboutplugins.ui \
          scribus/ui/actionsearchdialog.ui \
          scribus/ui/aligndistribute.ui \
          scribus/ui/annot.ui \
+         scribus/ui/applytemplatedialog.ui \
          scribus/ui/arcvectorbase.ui \
          scribus/ui/arcwidgetbase.ui \
          scribus/ui/charselect.ui \
diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp
index f7d0ffbd8..985e8dbf4 100644
--- a/scribus/scribus.cpp
+++ b/scribus/scribus.cpp
@@ -7617,40 +7617,115 @@ void ScribusMainWindow::ApplyMasterPage()
 		return;
 
 	QString masterPageName(dia->getMasterPageName());
-	int pageSelection = dia->getPageSelection(); //0=current, 1=even, 2=odd, 3=all
-	if (pageSelection == 0) //current page only
-		Apply_MasterPage(masterPageName, doc->currentPage()->pageNr(), false);
+	auto pageSelection = dia->getPageSelection(); //0=current, 1=even, 2=odd, 3=all
+	int moveItemsAnchor = dia->getMoveItemsAnchor();
+	// TODO: is it worth to create this function? if yes, where should this function be added?
+	// (or does it already exist and i did not find it?) (pageitem.h (as moveByPage)? scpage.h?
+	auto moveAllPageItems = [this](ScPage* page, double dx, double dy) {
+		UndoTransaction activeTransaction;
+		if (UndoManager::undoEnabled())
+			// TODO: not sure that the values passed to the transaction are the good ones
+			activeTransaction = m_undoManager->beginTransaction(Um::ItemsInvolved, Um::IMove, Um::Move, "", Um::IMove);
+		for (PageItem* pageItem: doc->DocItems) {
+			if (pageItem->OwnPage == page->pageNr()) {
+				pageItem->moveBy(dx, dy);
+			}
+		}
+		if (activeTransaction)
+			activeTransaction.commit();
+	};
+
+	/// \param moveItemsAnchor must be 1 or 2
+	/// \return the reference margin for the left and right pages according to the left / inside or right / outside "anchoring"
+	auto getRelevantMarginsByAnchor = [this](const MarginStruct& margins, int moveItemsAnchor) -> std::array<double, 2> {
+		if (doc->pagePositioning() == 0)
+		{
+			// single page
+			if (moveItemsAnchor == 1)
+				return {margins.left(), margins.left()};
+			else if (moveItemsAnchor == 2)
+				return {margins.right(), margins.right()};
+		}
+		else
+		{
+			// double page
+			if (moveItemsAnchor == 1)
+				// use inside margins
+				return {margins.right(), margins.left()};
+			else if (moveItemsAnchor == 2)
+				// use outside margins
+				return {margins.left(), margins.right()};
+		}
+		return {0.0, 0.0};
+	};
+
+	std::array<double, 2> masterPageMarginsForAnchor {0, 0};
+
+	if (moveItemsAnchor != 0)
+		masterPageMarginsForAnchor = getRelevantMarginsByAnchor(doc->MasterPages.at(doc->MasterNames[masterPageName])->Margins, moveItemsAnchor);
+
+	int startPage, endPage;
+	if (pageSelection == PageSelection::currentPage) {
+		startPage = doc->currentPage()->pageNr();
+		endPage = startPage + 1;
+	}
+	else if (dia->usingRange())
+	{
+		startPage = dia->getFromPage() - 1; // page indexes start from 0, not 1
+		endPage = dia->getToPage();
+	}
 	else
 	{
-		int startPage, endPage;
-		if (dia->usingRange())
+		startPage = 0;
+		endPage = doc->DocPages.count();
+	}
+
+	UndoTransaction activeTransaction;
+	if (UndoManager::undoEnabled())
+		// TODO: not sure that the values passed to the transaction are the good ones
+		activeTransaction = m_undoManager->beginTransaction(Um::ItemsInvolved, Um::IMove, Um::Move, "", Um::IMove);
+
+	auto currentPage = doc->currentPage();
+	for (int i = startPage; i < endPage; i++) // don't try to increment +2 for odd / even
+	{
+		// the input page number starts from 1, i starts from 0: the even / odd checks are inversed
+		if (i % 2 == 0)
 		{
-			startPage = dia->getFromPage()-1; //Pages start from 0, not 1
-			endPage = dia->getToPage();
+			if (pageSelection == PageSelection::evenPages)
+				continue; // ignore even indexes (odd pages) if the selection was even pages
 		}
 		else
 		{
-			startPage = pageSelection==1 ? 1 : 0; //if even, startPage is 1 (real page 2)
-			endPage = doc->DocPages.count();
+			if (pageSelection == PageSelection::oddPages)
+				continue; // ignore odd indexes (even pages) if the selection was odd pages
 		}
-		for (int pageNum = startPage; pageNum < endPage; ++pageNum)// +=pageStep)
+		Apply_MasterPage(masterPageName, i, false);
+		if (moveItemsAnchor != 0)
 		{
-			//Increment by 1 and not 2 even for even/odd application as user
-			//can select to eg apply to even pages with a single odd page selected
-			if (pageSelection == 1 && (pageNum %2 != 0)) //Even, %2!=0 as 1st page is numbered 0
-				Apply_MasterPage(masterPageName, pageNum, false);
-			else if (pageSelection == 2 && (pageNum %2 == 0)) //Odd, %2==0 as 1st page is numbered 0
-				Apply_MasterPage(masterPageName, pageNum, false);
-			else if (pageSelection == 3) //All
-				Apply_MasterPage(masterPageName, pageNum, false);
+			auto pageMarginsForAnchor = getRelevantMarginsByAnchor(doc->DocPages.at(i)->Margins, moveItemsAnchor);
+			// for single page use moveItemsAnchor
+			// for double pages use left if is odd (with first page offset) xor is left/inside
+			bool isLeftPage = (doc->pageSets()[doc->pagePositioning()].FirstPage + i) % 2 == 0;
+			bool isReferenceMarginOnTheLeft = doc->pagePositioning() == 0  ?
+				moveItemsAnchor == 1 :
+				(isLeftPage) != (moveItemsAnchor == 1); // xor: one of both, but not both or neither
+			// right margin (1) if isLeftPage xor isReferenceMarginOnTheLeft, left margin otherwise (0)
+			double masterPageMargin = masterPageMarginsForAnchor[isLeftPage != isReferenceMarginOnTheLeft ? 1 : 0];
+			double pageOldMargin = pageMarginsForAnchor[isLeftPage != isReferenceMarginOnTheLeft ? 1 : 0];
+
+			moveAllPageItems(doc->DocPages.at(i), masterPageMargin - pageOldMargin, 0);
 		}
 	}
+	doc->setCurrentPage(currentPage);
+
+	if (activeTransaction)
+		activeTransaction.commit();
 
 	view->reformPages();
 	view->DrawNew();
 	pagePalette->rebuild();
 	// #9476 : call setupPage with false arg to setup only guidePalette GUI
-	// Otherwise setupPage() will apply guides to current page, doesn't need that, 
+	// Otherwise setupPage() will apply guides to current page, doesn't need that,
 	// Apply_MasterPage() has already done it
 	guidePalette->setupPage(false);
 }
diff --git a/scribus/ui/applytemplatedialog.cpp b/scribus/ui/applytemplatedialog.cpp
index 075997b1b..7cb7d8916 100644
--- a/scribus/ui/applytemplatedialog.cpp
+++ b/scribus/ui/applytemplatedialog.cpp
@@ -32,13 +32,6 @@ for which a new license (GPL+exception) is in place.
 #include "scribusdoc.h"
 #include "iconmanager.h"
 
-enum {
-    CurrentPage,
-    EvenPages,
-    OddPages,
-    AllPages
-};
-
 /*
  *  Constructs a ApplyMasterPageDialog as a child of 'parent', with the
  *  name 'name' and widget flags set to 'f'.
@@ -48,78 +41,10 @@ enum {
  */
 ApplyMasterPageDialog::ApplyMasterPageDialog( QWidget* parent ) : QDialog( parent )
 {
-	setModal(true);
-	setWindowTitle( tr( "Apply Master Page" ));
-	setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
-	ApplyMasterPageDialogLayout = new QVBoxLayout(this);
-	ApplyMasterPageDialogLayout->setContentsMargins(9, 9, 9, 9);
-	ApplyMasterPageDialogLayout->setSpacing(6);
-
-	templateNameLayout = new QHBoxLayout;
-	templateNameLayout->setContentsMargins(0, 0, 0, 0);
-	templateNameLayout->setSpacing(6);
-
-	masterPageLabel = new QLabel( this );
-	templateNameLayout->addWidget( masterPageLabel );
-	spacer2 = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
-	templateNameLayout->addItem( spacer2 );
-
-	masterPageComboBox = new QComboBox(this);
-	masterPageComboBox->setEditable(false);
-	templateNameLayout->addWidget( masterPageComboBox );
-	ApplyMasterPageDialogLayout->addLayout( templateNameLayout );
-
-	applyToPageButtonGroup = new QGroupBox(this);
-	applyToPageButtonGroup->setMinimumSize( QSize( 250, 0 ) );
-	applyToPageButtonGroupLayout = new QVBoxLayout(applyToPageButtonGroup);
-	applyToPageButtonGroupLayout->setSpacing(6);
-	applyToPageButtonGroupLayout->setContentsMargins(9, 9, 9, 9);
-
-	currentPageRadioButton = new QRadioButton( applyToPageButtonGroup );
-	currentPageRadioButton->setChecked( true );
-	applyToPageButtonGroupLayout->addWidget( currentPageRadioButton );
-
-	evenPagesRadioButton = new QRadioButton( applyToPageButtonGroup );
-	applyToPageButtonGroupLayout->addWidget( evenPagesRadioButton );
-
-	oddPagesRadioButton = new QRadioButton( applyToPageButtonGroup );
-	applyToPageButtonGroupLayout->addWidget( oddPagesRadioButton );
-
-	allPagesRadioButton = new QRadioButton( applyToPageButtonGroup );
-	applyToPageButtonGroupLayout->addWidget( allPagesRadioButton );
-
-	rangeLayout = new QHBoxLayout;
-	rangeLayout->setSpacing(6);
-	rangeLayout->setContentsMargins(0, 0, 0, 0);
-
-	useRangeCheckBox = new QCheckBox( applyToPageButtonGroup );
-	useRangeCheckBox->setEnabled( false );	
-	rangeLayout->addWidget( useRangeCheckBox );
-
-	fromPageSpinBox = new ScrSpinBox( applyToPageButtonGroup );
-	fromPageSpinBox->setEnabled( false );
-	fromPageSpinBox->setMinimum( 1 );
-	fromPageSpinBox->setDecimals(0);
+	setupUi(this);
+	setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
 	fromPageSpinBox->setSuffix("");
-	rangeLayout->addWidget( fromPageSpinBox );
-
-	toPageLabel = new QLabel( applyToPageButtonGroup );
-	rangeLayout->addWidget( toPageLabel );
-
-	toPageSpinBox = new ScrSpinBox( applyToPageButtonGroup );
-	toPageSpinBox->setEnabled( false );
-	toPageSpinBox->setMinimum( 1 );
-	toPageSpinBox->setDecimals(0);
 	toPageSpinBox->setSuffix("");
-	rangeLayout->addWidget( toPageSpinBox );
-	spacer3 = new QSpacerItem( 1, 1, QSizePolicy::Expanding, QSizePolicy::Minimum );
-	rangeLayout->addItem( spacer3 );
-	applyToPageButtonGroupLayout->addLayout( rangeLayout );
-	ApplyMasterPageDialogLayout->addWidget( applyToPageButtonGroup );
-
-	buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
-	ApplyMasterPageDialogLayout->addWidget(buttonBox);
-	languageChange();
 	resize( QSize(268, 230).expandedTo(minimumSizeHint()) );
 
 	// signals and slots connections
@@ -132,9 +57,7 @@ ApplyMasterPageDialog::ApplyMasterPageDialog( QWidget* parent ) : QDialog( paren
 	connect( toPageSpinBox, SIGNAL( valueChanged(double) ), this, SLOT( checkRangeTo() ) );
 	connect(buttonBox, &QDialogButtonBox::accepted, this, &ApplyMasterPageDialog::accept);
 	connect(buttonBox, &QDialogButtonBox::rejected, this, &ApplyMasterPageDialog::reject);
-
-	// buddies
-	masterPageLabel->setBuddy( masterPageComboBox );
+	connect(moveItemsCheckBox, &QCheckBox::toggled, this, &ApplyMasterPageDialog::enableItemsSelectable);
 }
 
 void ApplyMasterPageDialog::setup(ScribusDoc *doc, const QString& Nam)
@@ -158,6 +81,18 @@ void ApplyMasterPageDialog::setup(ScribusDoc *doc, const QString& Nam)
 	fromPageSpinBox->setValue(doc->currentPage()->pageNr() + 1);
 	toPageSpinBox->setMaximum(docPagesCount);
 	toPageSpinBox->setValue(docPagesCount);
+
+	moveItemsAnchorComboBox->clear();
+	if (doc->pagePositioning() != 0) // facing pages
+	{
+		moveItemsAnchorComboBox->addItem(tr("Inside"), 1);
+		moveItemsAnchorComboBox->addItem(tr("Outside"), 2);
+	}
+	else
+	{
+		moveItemsAnchorComboBox->addItem(tr("Left"), 1);
+		moveItemsAnchorComboBox->addItem(tr("Right"), 2);
+	}
 }
 
 
@@ -168,15 +103,15 @@ QString ApplyMasterPageDialog::getMasterPageName()
 }
 
 
-int ApplyMasterPageDialog::getPageSelection()
+PageSelection ApplyMasterPageDialog::getPageSelection()
 {
 	if (currentPageRadioButton->isChecked())
-		return CurrentPage;
+		return PageSelection::currentPage;
 	if (evenPagesRadioButton->isChecked())
-		return EvenPages;
+		return PageSelection::evenPages;
 	if (oddPagesRadioButton->isChecked())
-		return OddPages;
-	return AllPages;
+		return PageSelection::oddPages;
+	return PageSelection::allPages;
 }
 
 void ApplyMasterPageDialog::checkRangeFrom()
@@ -218,6 +153,13 @@ void ApplyMasterPageDialog::singleSelectable()
 	toPageSpinBox->setEnabled(false);
 }
 
+void ApplyMasterPageDialog::enableItemsSelectable(bool enabled)
+{
+	moveItemsAnchorComboBox->setEnabled(enabled);
+	moveItemsMarginLabel->setEnabled(enabled);
+}
+
+
 
 bool ApplyMasterPageDialog::usingRange()
 {
@@ -240,31 +182,16 @@ int ApplyMasterPageDialog::getToPage()
 	return -1;
 }
 
-void ApplyMasterPageDialog::changeEvent(QEvent *e)
+/**
+ * \return 0 if no change is required,
+ *         1 if it moves according to the left / inside margins,
+ *         2 if it moves according to the right maring
+ */
+int ApplyMasterPageDialog::getMoveItemsAnchor()
 {
-	if (e->type() == QEvent::LanguageChange)
+	if (!moveItemsCheckBox->isChecked())
 	{
-		languageChange();
+		return 0;
 	}
-	else
-		QWidget::changeEvent(e);
-}
-
-void ApplyMasterPageDialog::languageChange()
-{
-	setWindowTitle( tr( "Apply Master Page" ) );
-	masterPageLabel->setText( tr( "&Master Page:" ) );
-	applyToPageButtonGroup->setTitle( tr( "Apply to" ) );
-	currentPageRadioButton->setText( tr( "Current &Page" ) );
-	currentPageRadioButton->setShortcut( QKeySequence( tr( "Alt+P" ) ) );
-	evenPagesRadioButton->setText( tr( "&Even Pages" ) );
-	evenPagesRadioButton->setShortcut( QKeySequence( tr( "Alt+E" ) ) );
-	oddPagesRadioButton->setText( tr( "O&dd Pages" ) );
-	oddPagesRadioButton->setShortcut( QKeySequence( tr( "Alt+D" ) ) );
-	allPagesRadioButton->setText( tr( "&All Pages" ) );
-	allPagesRadioButton->setShortcut( QKeySequence( tr( "Alt+A" ) ) );
-	useRangeCheckBox->setText( tr( "&Within Range" ) );
-	useRangeCheckBox->setShortcut( QKeySequence( tr( "Alt+W" ) ) );
-	useRangeCheckBox->setToolTip( "<qt>" + tr( "Apply the selected master page to even, odd or all pages within the following range") + "</qt>" );
-	toPageLabel->setText( tr( "to" ) );
+	return moveItemsAnchorComboBox->currentData().toInt();
 }
diff --git a/scribus/ui/applytemplatedialog.h b/scribus/ui/applytemplatedialog.h
index 71dd7fef4..98b324aa0 100644
--- a/scribus/ui/applytemplatedialog.h
+++ b/scribus/ui/applytemplatedialog.h
@@ -15,6 +15,8 @@ for which a new license (GPL+exception) is in place.
 #ifndef APPLYMASTERPAGEDIALOG_H
 #define APPLYMASTERPAGEDIALOG_H
 
+#include "ui_applytemplatedialog.h"
+
 #include <QDialog>
 #include <QDialogButtonBox>
 #include <QString>
@@ -35,7 +37,14 @@ class QRadioButton;
 class QSpacerItem;
 class QVBoxLayout;
 
-class SCRIBUS_API ApplyMasterPageDialog : public QDialog
+enum class PageSelection {
+    currentPage,
+    evenPages,
+    oddPages,
+    allPages
+};
+
+class SCRIBUS_API ApplyMasterPageDialog : public QDialog, Ui::ApplyMasterPageDialog
 {
 	Q_OBJECT
 
@@ -43,38 +52,13 @@ public:
 	ApplyMasterPageDialog( QWidget* parent = nullptr );
 	~ApplyMasterPageDialog() = default;
 
-	QLabel* masterPageLabel { nullptr };
-	QComboBox* masterPageComboBox { nullptr };
-	QGroupBox* applyToPageButtonGroup { nullptr };
-	QRadioButton* currentPageRadioButton { nullptr };
-	QRadioButton* evenPagesRadioButton { nullptr };
-	QRadioButton* oddPagesRadioButton { nullptr };
-	QRadioButton* allPagesRadioButton { nullptr };
-	QCheckBox* useRangeCheckBox { nullptr };
-	ScrSpinBox* fromPageSpinBox { nullptr };
-	QLabel* toPageLabel { nullptr };
-	ScrSpinBox* toPageSpinBox { nullptr };
-
 	virtual void setup(ScribusDoc* doc, const QString& Nam);
 	virtual QString getMasterPageName();
-	virtual int getPageSelection();
+	virtual PageSelection getPageSelection();
 	virtual bool usingRange();
 	virtual int getFromPage();
 	virtual int getToPage();
-
-protected:
-	QVBoxLayout* ApplyMasterPageDialogLayout { nullptr };
-	QHBoxLayout* templateNameLayout { nullptr };
-	QSpacerItem* spacer2 { nullptr };
-	QVBoxLayout* applyToPageButtonGroupLayout { nullptr };
-	QHBoxLayout* rangeLayout { nullptr };
-	QSpacerItem* spacer3 { nullptr };
-	QDialogButtonBox* buttonBox { nullptr };
-	
-	void changeEvent(QEvent *e) override;
-
-protected slots:
-	virtual void languageChange();
+	virtual int getMoveItemsAnchor();
 
 private slots:
 	virtual void checkRangeFrom();
@@ -82,7 +66,7 @@ private slots:
 	virtual void enableRange( bool enabled );
 	virtual void rangeSelectable();
 	virtual void singleSelectable();
-
+	virtual void enableItemsSelectable(bool enabled);
 };
 
 #endif // APPLYMASTERPAGEDIALOG_H
apply-masterpage.diff (16,272 bytes)   
applytemplatedialog-2.ui (6,692 bytes)   
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>ApplyMasterPageDialog</class>
 <widget class="QDialog" name="ApplyMasterPageDialog">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>380</width>
    <height>278</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Apply Master Page</string>
  </property>
  <layout class="QVBoxLayout" name="verticalLayout">
   <item>
    <layout class="QHBoxLayout" name="horizontalLayout">
     <item>
      <widget class="QLabel" name="masterPageLabel">
       <property name="text">
        <string>&amp;Master Page:</string>
       </property>
       <property name="buddy">
        <cstring>masterPageComboBox</cstring>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="horizontalSpacer">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>40</width>
         <height>20</height>
        </size>
       </property>
      </spacer>
     </item>
     <item>
      <widget class="QComboBox" name="masterPageComboBox"/>
     </item>
    </layout>
   </item>
   <item>
    <widget class="QGroupBox" name="applyToPageButtonGroup">
     <property name="title">
      <string>Apply to</string>
     </property>
     <layout class="QVBoxLayout" name="verticalLayout_2">
      <item>
       <widget class="QRadioButton" name="currentPageRadioButton">
        <property name="text">
         <string>Current &amp;Page</string>
        </property>
        <property name="checked">
         <bool>true</bool>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QRadioButton" name="evenPagesRadioButton">
        <property name="text">
         <string>&amp;Even Pages</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QRadioButton" name="oddPagesRadioButton">
        <property name="text">
         <string>O&amp;dd Pages</string>
        </property>
       </widget>
      </item>
      <item>
       <widget class="QRadioButton" name="allPagesRadioButton">
        <property name="text">
         <string>&amp;All Pages</string>
        </property>
       </widget>
      </item>
      <item>
       <layout class="QHBoxLayout" name="horizontalLayout_2">
        <item>
         <widget class="QCheckBox" name="useRangeCheckBox">
          <property name="enabled">
           <bool>false</bool>
          </property>
          <property name="text">
           <string>&amp;Within Range</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="ScrSpinBox" name="fromPageSpinBox">
          <property name="enabled">
           <bool>false</bool>
          </property>
          <property name="decimals">
           <number>0</number>
          </property>
          <property name="minimum">
           <double>1.000000000000000</double>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QLabel" name="toPageLabel">
          <property name="enabled">
           <bool>false</bool>
          </property>
          <property name="text">
           <string>to</string>
          </property>
         </widget>
        </item>
        <item>
         <widget class="ScrSpinBox" name="toPageSpinBox">
          <property name="enabled">
           <bool>false</bool>
          </property>
          <property name="decimals">
           <number>0</number>
          </property>
          <property name="minimum">
           <double>1.000000000000000</double>
          </property>
         </widget>
        </item>
        <item>
         <spacer name="horizontalSpacer_2">
          <property name="orientation">
           <enum>Qt::Horizontal</enum>
          </property>
          <property name="sizeHint" stdset="0">
           <size>
            <width>40</width>
            <height>20</height>
           </size>
          </property>
         </spacer>
        </item>
       </layout>
      </item>
     </layout>
    </widget>
   </item>
   <item>
    <layout class="QHBoxLayout" name="horizontalLayout_3">
     <item>
      <widget class="QCheckBox" name="moveItemsCheckBox">
       <property name="enabled">
        <bool>true</bool>
       </property>
       <property name="toolTip">
        <string>All items on the page will be moved according to the displacement of the selected margin</string>
       </property>
       <property name="text">
        <string>M&amp;ove Items with the</string>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QComboBox" name="moveItemsAnchorComboBox">
       <property name="enabled">
        <bool>false</bool>
       </property>
      </widget>
     </item>
     <item>
      <widget class="QLabel" name="moveItemsMarginLabel">
       <property name="enabled">
        <bool>false</bool>
       </property>
       <property name="text">
        <string>Margin</string>
       </property>
      </widget>
     </item>
     <item>
      <spacer name="horizontalSpacer_3">
       <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
       <property name="sizeHint" stdset="0">
        <size>
         <width>40</width>
         <height>20</height>
        </size>
       </property>
      </spacer>
     </item>
    </layout>
   </item>
   <item>
    <widget class="QDialogButtonBox" name="buttonBox">
     <property name="orientation">
      <enum>Qt::Horizontal</enum>
     </property>
     <property name="standardButtons">
      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <customwidgets>
  <customwidget>
   <class>ScrSpinBox</class>
   <extends>QDoubleSpinBox</extends>
   <header>ui/scrspinbox.h</header>
  </customwidget>
 </customwidgets>
 <resources/>
 <connections>
  <connection>
   <sender>buttonBox</sender>
   <signal>accepted()</signal>
   <receiver>ApplyMasterPageDialog</receiver>
   <slot>accept()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>248</x>
     <y>254</y>
    </hint>
    <hint type="destinationlabel">
     <x>157</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
  <connection>
   <sender>buttonBox</sender>
   <signal>rejected()</signal>
   <receiver>ApplyMasterPageDialog</receiver>
   <slot>reject()</slot>
   <hints>
    <hint type="sourcelabel">
     <x>316</x>
     <y>260</y>
    </hint>
    <hint type="destinationlabel">
     <x>286</x>
     <y>274</y>
    </hint>
   </hints>
  </connection>
 </connections>
</ui>
applytemplatedialog-2.ui (6,692 bytes)   

ale

2023-04-23 14:34

manager   ~0050130

any feedback?

cbradney

2023-04-23 20:14

administrator   ~0050131

We can look at it this week. I've been travelling so can take a look during the week.

ale

2023-04-24 10:39

manager   ~0050132

ok, thanks!

cbradney

2023-04-25 19:45

administrator   ~0050134

Looks ok, not sure if Jean has read it yet. I'll ask him.

I wonder about moveAllPageItems.. it could go to ScPage.. or it could be made widely usable by moving to ScribusDoc as an itemSelection_MoveItemsOnPageBy(ScPage*, double dX, double dY) with the necessary addition of the items from the page to a temporary Selection. Simplest would be to move to ScPage.

cbradney

2023-04-25 21:02

administrator   ~0050136

Also, what happens with groups and welded items?

Issue History

Date Modified Username Field Change
2023-03-30 11:30 ale New Issue
2023-03-30 11:30 ale File Added: apply_master_page.png
2023-03-30 11:35 ale Note Added: 0050055
2023-03-30 11:35 ale File Added: applytemplatedialog.diff
2023-03-30 11:35 ale File Added: applytemplatedialog.ui
2023-03-30 11:36 ale Severity minor => feature
2023-03-30 11:36 ale Product Version => 1.7.0.svn
2023-03-30 16:57 ale Note Added: 0050056
2023-03-30 19:24 cbradney Note Added: 0050057
2023-03-30 19:32 ale Note Added: 0050058
2023-04-07 09:13 ale Note Added: 0050102
2023-04-13 15:00 ale Note Added: 0050110
2023-04-13 15:00 ale File Added: apply-masterpage.diff
2023-04-13 15:00 ale File Added: applytemplatedialog-2.ui
2023-04-13 15:01 ale Tag Attached: patch
2023-04-23 14:34 ale Note Added: 0050130
2023-04-23 20:14 cbradney Note Added: 0050131
2023-04-24 10:39 ale Note Added: 0050132
2023-04-25 19:45 cbradney Note Added: 0050134
2023-04-25 21:02 cbradney Note Added: 0050136