r15096 by cbradney - Add the page & margin resizing functions back when doc setup closes in new doc setup
scribus-commit
scribus-commit at lists.scribus.net
Fri May 21 00:00:38 CEST 2010
Revision: 15096
Author: cbradney
Date: 2010-05-20T21:53:08.501283Z
Commit message: Add the page & margin resizing functions back when doc setup closes in new doc setup
Changeset:
M /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/ui/prefs_documentsetup.cpp
M /trunk/Scribus/scribus/ui/preferencesdialog.cpp
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/ui/prefs_documentsetup.h
M /trunk/Scribus/scribus/ui/preferencesdialog.h
M /trunk/Scribus/scribus/scribusdoc.h
Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 15095)
+++ scribus/scribusdoc.cpp (revision 15096)
@@ -12228,77 +12228,21 @@
docPrefsData.pageSets[layout].FirstPage=fp;
}
-void ScribusDoc::setNewPrefs(const ApplicationPrefs& prefsData, const ApplicationPrefs& oldPrefsData)
+void ScribusDoc::setNewPrefs(const ApplicationPrefs& prefsData, const ApplicationPrefs& oldPrefsData, bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins)
{
docPrefsData=prefsData;
+ double topDisplacement = prefsData.displayPrefs.scratch.Top - oldPrefsData.displayPrefs.scratch.Top;
+ double leftDisplacement = prefsData.displayPrefs.scratch.Left - oldPrefsData.displayPrefs.scratch.Left;
+ applyPrefsPageSizingAndMargins(resizePages, resizeMasterPages, resizePageMargins, resizeMasterPageMargins);
- double TopD = prefsData.displayPrefs.scratch.Top - oldPrefsData.displayPrefs.scratch.Top;
- double LeftD = prefsData.displayPrefs.scratch.Left - oldPrefsData.displayPrefs.scratch.Left;
- /* TODO: pull in the make changes to all pages bools
- for (int p = 0; p < Pages->count(); ++p)
- {
- Page *pp = Pages->at(p);
- if (tabPage->sizeAllPages->isChecked())
- {
- pp->setInitialWidth(docPrefsData.docSetupPrefs.pageWidth);
- pp->setInitialHeight(docPrefsData.docSetupPrefs.pageHeight);
- pp->setHeight(docPrefsData.docSetupPrefs.pageHeight);
- pp->setWidth(docPrefsData.docSetupPrefs.pageWidth);
- pp->m_pageSize = docPrefsData.docSetupPrefs.pageSize;
- pp->setOrientation(docPrefsData.docSetupPrefs.pageOrientation);
- }
- if (tabPage->marginGroup->getMarginsForAllPages())
- {
- pp->initialMargins=docPrefsData.docSetupPrefs.margins;
- pp->marginPreset=docPrefsData.docSetupPrefs.marginPreset;
- }
- else
- if (tabPage->marginGroup->getMarginsForAllMasterPages())
- {
- //CB #6796: find the master page (*mp) for the current page (*pp)
- //check if *pp's margins are the same as the *mp's current margins
- //apply new margins if same
- const int masterPageNumber = MasterNames[pp->MPageNam];
- const Page* mp = MasterPages.at(masterPageNumber);
- if (pp->initialMargins.Left == mp->initialMargins.Left &&
- pp->initialMargins.Right == mp->initialMargins.Right &&
- pp->initialMargins.Top == mp->initialMargins.Top &&
- pp->initialMargins.Bottom == mp->initialMargins.Bottom)
- {
- pp->initialMargins=docPrefsData.docSetupPrefs.margins;
- pp->marginPreset=docPrefsData.docSetupPrefs.marginPreset;
- }
- }
- }
-
- for (int p = 0; p < MasterPages.count(); ++p)
- {
- Page *pp = MasterPages.at(p);
- if (tabPage->sizeAllMasterPages->isChecked())
- {
- pp->setInitialWidth(docPrefsData.docSetupPrefs.pageWidth);
- pp->setInitialHeight(docPrefsData.docSetupPrefs.pageHeight);
- pp->setHeight(docPrefsData.docSetupPrefs.pageHeight);
- pp->setWidth(docPrefsData.docSetupPrefs.pageWidth);
- pp->m_pageSize = docPrefsData.docSetupPrefs.pageSize;
- pp->setOrientation(docPrefsData.docSetupPrefs.pageOrientation);
- }
- if (tabPage->marginGroup->getMarginsForAllMasterPages())
- {
- pp->initialMargins=docPrefsData.docSetupPrefs.margins;
- pp->marginPreset=docPrefsData.docSetupPrefs.marginPreset;
- }
- pp->setXOffset(docPrefsData.displayPrefs.scratch.Left);
- pp->setYOffset(docPrefsData.displayPrefs.scratch.Top);
- }
- */
uint docItemsCount = MasterItems.count();
for (uint ite = 0; ite < docItemsCount; ++ite)
{
PageItem *item = MasterItems.at(ite);
- item->moveBy(LeftD, TopD);
+ item->moveBy(leftDisplacement, topDisplacement);
item->setRedrawBounding();
}
+
bool viewToRecalcPictureRes=(docPrefsData.itemToolPrefs.imageLowResType==oldPrefsData.itemToolPrefs.imageLowResType);
autoSaveTimer->stop();
@@ -12408,4 +12352,62 @@
}
+void ScribusDoc::applyPrefsPageSizingAndMargins(bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins)
+{
+ for (int p = 0; p < Pages->count(); ++p)
+ {
+ Page *pp = Pages->at(p);
+ if (resizePages)
+ {
+ pp->setInitialWidth(pageWidth());
+ pp->setInitialHeight(pageHeight());
+ pp->setHeight(pageHeight());
+ pp->setWidth(pageWidth());
+ pp->m_pageSize = pageSize();
+ pp->setOrientation(pageOrientation());
+ }
+ if (resizePageMargins)
+ {
+ pp->initialMargins=docPrefsData.docSetupPrefs.margins;
+ pp->marginPreset=docPrefsData.docSetupPrefs.marginPreset;
+ }
+ else
+ if (resizeMasterPageMargins)
+ {
+ //CB #6796: find the master page (*mp) for the current page (*pp)
+ //check if *pp's margins are the same as the *mp's current margins
+ //apply new margins if same
+ const int masterPageNumber = MasterNames[pp->MPageNam];
+ const Page* mp = MasterPages.at(masterPageNumber);
+ if (pp->initialMargins.Left == mp->initialMargins.Left &&
+ pp->initialMargins.Right == mp->initialMargins.Right &&
+ pp->initialMargins.Top == mp->initialMargins.Top &&
+ pp->initialMargins.Bottom == mp->initialMargins.Bottom)
+ {
+ pp->initialMargins=docPrefsData.docSetupPrefs.margins;
+ pp->marginPreset=docPrefsData.docSetupPrefs.marginPreset;
+ }
+ }
+ }
+ for (int p = 0; p < MasterPages.count(); ++p)
+ {
+ Page *pp = MasterPages.at(p);
+ if (resizeMasterPages)
+ {
+ pp->setInitialWidth(pageWidth());
+ pp->setInitialHeight(pageHeight());
+ pp->setHeight(pageHeight());
+ pp->setWidth(pageWidth());
+ pp->m_pageSize = pageSize();
+ pp->setOrientation(pageOrientation());
+ }
+ if (resizeMasterPageMargins)
+ {
+ pp->initialMargins=docPrefsData.docSetupPrefs.margins;
+ pp->marginPreset=docPrefsData.docSetupPrefs.marginPreset;
+ }
+ pp->setXOffset(scratch()->Left);
+ pp->setYOffset(scratch()->Top);
+ }
+}
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h (revision 15095)
+++ scribus/scribusdoc.h (revision 15096)
@@ -220,7 +220,7 @@
const QMap<QString, int> & usedFonts() { return UsedFonts; }
const ApplicationPrefs& prefsData() { return docPrefsData; }
- void setNewPrefs(const ApplicationPrefs& prefsData, const ApplicationPrefs& oldPrefsData);
+ void setNewPrefs(const ApplicationPrefs& prefsData, const ApplicationPrefs& oldPrefsData, bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins);
// Add, delete and move pages
@@ -1004,6 +1004,8 @@
protected:
void addSymbols();
+ void applyPrefsPageSizingAndMargins(bool resizePages, bool resizeMasterPages, bool resizePageMargins, bool resizeMasterPageMargins);
+
bool m_hasGUI;
ApplicationPrefs& appPrefsData;
ApplicationPrefs docPrefsData;
Index: scribus/ui/preferencesdialog.h
===================================================================
--- scribus/ui/preferencesdialog.h (revision 15095)
+++ scribus/ui/preferencesdialog.h (revision 15096)
@@ -58,6 +58,7 @@
virtual void changeEvent(QEvent *e);
ApplicationPrefs prefs() const { return localPrefs; }
+ void getResizeDocumentPages(bool &resizePages, bool &resizeMasterPages, bool &resizePageMargins, bool &resizeMasterPageMargins);
public slots:
/// \brief Overridden to emit accepted(), which plugin panels use
Index: scribus/ui/prefs_documentsetup.h
===================================================================
--- scribus/ui/prefs_documentsetup.h (revision 15095)
+++ scribus/ui/prefs_documentsetup.h (revision 15096)
@@ -13,6 +13,8 @@
#include "scribusapi.h"
#include "scribusstructs.h"
+class ScribusDoc;
+
class SCRIBUS_API Prefs_DocumentSetup : public Prefs_Pane, Ui::Prefs_DocumentSetup
{
Q_OBJECT
@@ -22,7 +24,9 @@
~Prefs_DocumentSetup();
virtual void restoreDefaults(struct ApplicationPrefs *prefsData);
virtual void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const;
+ void getResizeDocumentPages(bool &resizePages, bool &resizeMasterPages, bool &resizePageMargins, bool &resizeMasterPageMargins);
+
public slots:
void languageChange();
void pageLayoutChanged(int);
@@ -51,10 +55,10 @@
void slotUndo(bool);
void unitChange();
- private:
+ protected:
void setupPageSets();
+ ScribusDoc* m_doc;
-
double unitRatio;
int choosenLayout;
double pageW;
Index: scribus/ui/prefs_documentsetup.cpp
===================================================================
--- scribus/ui/prefs_documentsetup.cpp (revision 15095)
+++ scribus/ui/prefs_documentsetup.cpp (revision 15096)
@@ -18,14 +18,18 @@
#include "util.h"
Prefs_DocumentSetup::Prefs_DocumentSetup(QWidget* parent, ScribusDoc* doc)
- : Prefs_Pane(parent)
+ : Prefs_Pane(parent),
+ m_doc(doc)
{
setupUi(this);
- applySizesToAllPagesCheckBox->hide();
- applySizesToAllMasterPagesCheckBox->hide();
- applyMarginsToAllPagesCheckBox->hide();
- applyMarginsToAllMasterPagesCheckBox->hide();
+ if (!m_doc)
+ {
+ applySizesToAllPagesCheckBox->hide();
+ applySizesToAllMasterPagesCheckBox->hide();
+ applyMarginsToAllPagesCheckBox->hide();
+ applyMarginsToAllMasterPagesCheckBox->hide();
+ }
pageWidthSpinBox->setMaximum(16777215);
pageHeightSpinBox->setMaximum(16777215);
@@ -89,6 +93,16 @@
setupPageSets();
+ pageWidthSpinBox->setToolTip( "<qt>" + tr( "Width of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
+ pageHeightSpinBox->setToolTip( "<qt>" + tr( "Height of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
+ pageSizeComboBox->setToolTip( "<qt>" + tr( "Default page size, either a standard size or a custom size" ) + "</qt>" );
+ pageOrientationComboBox->setToolTip( "<qt>" + tr( "Default orientation of document pages" ) + "</qt>" );
+ pageUnitsComboBox->setToolTip( "<qt>" + tr( "Default unit of measurement for document editing" ) + "</qt>" );
+ autosaveCheckBox->setToolTip( "<qt>" + tr( "When enabled, Scribus saves a backup copy of your file with the .bak extension each time the time period elapses" ) + "</qt>" );
+ autosaveIntervalSpinBox->setToolTip( "<qt>" + tr( "Time period between saving automatically" ) + "</qt>" );
+ undoLengthSpinBox->setToolTip( "<qt>" + tr("Set the length of the action history in steps. If set to 0 infinite amount of actions will be stored.") + "</qt>");
+ applySizesToAllPagesCheckBox->setToolTip( "<qt>" + tr( "Apply the page size changes to all existing pages in the document" ) + "</qt>" );
+ applyMarginsToAllPagesCheckBox->setToolTip( "<qt>" + tr( "Apply the page size changes to all existing master pages in the document" ) + "</qt>" );
}
void Prefs_DocumentSetup::restoreDefaults(struct ApplicationPrefs *prefsData)
@@ -286,3 +300,12 @@
{
undoLengthSpinBox->setEnabled(isEnabled);
}
+
+void Prefs_DocumentSetup::getResizeDocumentPages(bool &resizePages, bool &resizeMasterPages, bool &resizePageMargins, bool &resizeMasterPageMargins)
+{
+ resizePages=applySizesToAllPagesCheckBox->isChecked();
+ resizeMasterPages=applySizesToAllMasterPagesCheckBox->isChecked();
+ resizePageMargins=applyMarginsToAllPagesCheckBox->isChecked();
+ resizeMasterPageMargins=applyMarginsToAllMasterPagesCheckBox->isChecked();
+}
+
Index: scribus/ui/preferencesdialog.cpp
===================================================================
--- scribus/ui/preferencesdialog.cpp (revision 15095)
+++ scribus/ui/preferencesdialog.cpp (revision 15096)
@@ -364,6 +364,12 @@
}
}
+void PreferencesDialog::getResizeDocumentPages(bool &resizePages, bool &resizeMasterPages, bool &resizePageMargins, bool &resizeMasterPageMargins)
+{
+ prefs_DocumentSetup->getResizeDocumentPages(resizePages, resizeMasterPages, resizePageMargins, resizeMasterPageMargins);
+}
+
+
void PreferencesDialog::arrangeIcons()
{/*
int maxWidth = 0;
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 15095)
+++ scribus/scribus.cpp (revision 15096)
@@ -7704,7 +7704,9 @@
if (prefsResult==QDialog::Accepted)
{
struct ApplicationPrefs newDocPrefs(prefsDialog.prefs());
- doc->setNewPrefs(newDocPrefs, oldDocPrefs);
+ bool resizePages, resizeMasterPages, resizePageMargins, resizeMasterPageMargins;
+ prefsDialog.getResizeDocumentPages(resizePages, resizeMasterPages, resizePageMargins, resizeMasterPageMargins);
+ doc->setNewPrefs(newDocPrefs, oldDocPrefs, resizePages, resizeMasterPages, resizePageMargins, resizeMasterPageMargins);
slotChangeUnit(doc->unitIndex(), false);
More information about the scribus-commit
mailing list