r14994 by cbradney - Move margins into docprefsdata
scribus-commit
scribus-commit at lists.scribus.net
Thu Apr 22 00:51:04 CEST 2010
Revision: 14994
Author: cbradney
Date: 2010-04-21T22:40:49.989850Z
Commit message: Move margins into docprefsdata
Changeset:
M /trunk/Scribus/scribus/ui/pagepalette.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
M /trunk/Scribus/scribus/ui/reformdoc.cpp
M /trunk/Scribus/scribus/scribusdoc.cpp
M /trunk/Scribus/scribus/ui/tabdocument.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
M /trunk/Scribus/scribus/plugins/scripter/api_document.cpp
M /trunk/Scribus/scribus/plugins/fileloader/scribus13format/scribus13format.cpp
M /trunk/Scribus/scribus/scribusdoc.h
M /trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp (revision 14993)
+++ scribus/scribusdoc.cpp (revision 14994)
@@ -309,7 +309,7 @@
Items(0), MasterItems(), DocItems(), FrameItems(),
m_Selection(new Selection(this, true)),
//->Prefs pageWidth(pagesize.width()), pageHeight(pagesize.height()),
- pageMargins(margins),
+ //->Prefs pageMargins(margins),
//->Prefs marginPreset(appPrefsData.docSetupPrefs.marginPreset),
//->Prefs pageSets(appPrefsData.pageSets),
PageSp(pagesSetup.columnCount), PageSpa(pagesSetup.columnDistance),
@@ -385,6 +385,7 @@
docPrefsData.docSetupPrefs.pageHeight=pagesize.height();
docPrefsData.docSetupPrefs.pageWidth=pagesize.width();
docPrefsData.docSetupPrefs.pageSize=pagesize.name();
+ docPrefsData.docSetupPrefs.margins=margins;
maxCanvasCoordinate=(FPoint(docPrefsData.displayPrefs.scratch.Left + docPrefsData.displayPrefs.scratch.Right, docPrefsData.displayPrefs.scratch.Top + docPrefsData.displayPrefs.scratch.Bottom)),
setPageSetFirstPage(pagesSetup.pageArrangement, pagesSetup.firstPageLocation);
//->Prefs pageSets[pagesSetup.pageArrangement].FirstPage = pagesSetup.firstPageLocation;
@@ -1537,14 +1538,11 @@
/** sets page properties */
-void ScribusDoc::setPage(double b, double h, double t, double l, double r, double bo, double sp, double ab, bool atf, int fp)
+void ScribusDoc::setPage(double w, double h, double t, double l, double r, double b, double sp, double ab, bool atf, int fp)
{
- docPrefsData.docSetupPrefs.pageWidth = b;
+ docPrefsData.docSetupPrefs.pageWidth = w;
docPrefsData.docSetupPrefs.pageHeight = h;
- pageMargins.Top = t;
- pageMargins.Left = l;
- pageMargins.Right = r;
- pageMargins.Bottom = bo;
+ docPrefsData.docSetupPrefs.margins.set(t, l, b ,r);
PageSp = sp;
PageSpa = ab;
currentPageLayout = fp;
@@ -1557,9 +1555,10 @@
// PDF_Options.BleedBottom = pageMargins.Bottom;
}
-void ScribusDoc::resetPage(MarginStruct& newMargins, int fp)
+void ScribusDoc::resetPage(int fp, MarginStruct* newMargins)
{
- pageMargins = newMargins;
+ if (newMargins!=0)
+ docPrefsData.docSetupPrefs.margins = *newMargins;
currentPageLayout = fp;
}
@@ -1737,12 +1736,12 @@
Page* addedPage = new Page(docPrefsData.displayPrefs.scratch.Left, DocPages.count()*(docPrefsData.docSetupPrefs.pageHeight+docPrefsData.displayPrefs.scratch.Bottom+docPrefsData.displayPrefs.scratch.Top)+docPrefsData.displayPrefs.scratch.Top, docPrefsData.docSetupPrefs.pageWidth, docPrefsData.docSetupPrefs.pageHeight);
assert(addedPage!=NULL);
addedPage->setDocument(this);
- addedPage->Margins.Top = pageMargins.Top;
- addedPage->Margins.Bottom = pageMargins.Bottom;
- addedPage->initialMargins.Top = pageMargins.Top;
- addedPage->initialMargins.Bottom = pageMargins.Bottom;
- addedPage->initialMargins.Left = pageMargins.Left;
- addedPage->initialMargins.Right = pageMargins.Right;
+ addedPage->Margins.Top = docPrefsData.docSetupPrefs.margins.Top;
+ addedPage->Margins.Bottom = docPrefsData.docSetupPrefs.margins.Bottom;
+ addedPage->initialMargins.Top = docPrefsData.docSetupPrefs.margins.Top;
+ addedPage->initialMargins.Bottom = docPrefsData.docSetupPrefs.margins.Bottom;
+ addedPage->initialMargins.Left = docPrefsData.docSetupPrefs.margins.Left;
+ addedPage->initialMargins.Right = docPrefsData.docSetupPrefs.margins.Right;
addedPage->setPageNr(pageIndex);
addedPage->m_pageSize = docPrefsData.docSetupPrefs.pageSize;
addedPage->setOrientation(docPrefsData.docSetupPrefs.pageOrientation);
@@ -1769,14 +1768,8 @@
Page* addedPage = new Page(docPrefsData.displayPrefs.scratch.Left, docPrefsData.displayPrefs.scratch.Top, docPrefsData.docSetupPrefs.pageWidth, docPrefsData.docSetupPrefs.pageHeight);
assert(addedPage!=NULL);
addedPage->setDocument(this);
- addedPage->Margins.Top = pageMargins.Top;
- addedPage->Margins.Bottom = pageMargins.Bottom;
- addedPage->Margins.Left = pageMargins.Left;//todo fix for layouts
- addedPage->Margins.Right = pageMargins.Right;
- addedPage->initialMargins.Top = pageMargins.Top;
- addedPage->initialMargins.Bottom = pageMargins.Bottom;
- addedPage->initialMargins.Left = pageMargins.Left;
- addedPage->initialMargins.Right = pageMargins.Right;
+ addedPage->Margins = docPrefsData.docSetupPrefs.margins;
+ addedPage->initialMargins = docPrefsData.docSetupPrefs.margins;
addedPage->m_pageSize = docPrefsData.docSetupPrefs.pageSize;
addedPage->setOrientation(docPrefsData.docSetupPrefs.pageOrientation);
addedPage->marginPreset = docPrefsData.docSetupPrefs.marginPreset;
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h (revision 14993)
+++ scribus/scribusdoc.h (revision 14994)
@@ -123,8 +123,8 @@
void setModified(const bool);
bool isModified() const;
/** Setzt die Seitenattribute */
- void setPage(double b, double h, double t, double l, double r, double bo, double sp, double ab, bool atf, int fp);
- void resetPage(MarginStruct& newMargins, int fp);
+ void setPage(double w, double h, double t, double l, double r, double b, double sp, double ab, bool atf, int fp);
+ void resetPage(int fp, MarginStruct* newMargins=0);
/**
* @brief Return the view associated with the document
@@ -147,6 +147,9 @@
MarginStruct* scratch() { return &docPrefsData.displayPrefs.scratch; }
MarginStruct* bleeds() { return &docPrefsData.docSetupPrefs.bleeds; }
+ MarginStruct& bleedsVal() { return docPrefsData.docSetupPrefs.bleeds; }
+ MarginStruct* margins() { return &docPrefsData.docSetupPrefs.margins; }
+ MarginStruct& marginsVal() { return docPrefsData.docSetupPrefs.margins; }
double pageGapHorizontal() const { return docPrefsData.displayPrefs.pageGapHorizontal; }
double pageGapVertical() const { return docPrefsData.displayPrefs.pageGapVertical; }
void setPageGapHorizontal(double h) { docPrefsData.displayPrefs.pageGapHorizontal=h; }
@@ -1049,8 +1052,8 @@
//->Prefs double pageHeight;
/* Number of Pages */
// int pageCount; Disabled CR no longer required
- /** \brief Margins */
- MarginStruct pageMargins;
+ //->Prefs /** \brief Margins */
+ //->Prefs MarginStruct pageMargins;
//->Prefs int marginPreset;
//->Prefs QList<PageSet> pageSets;
//->Prefs MarginStruct bleeds;
Index: scribus/ui/tabdocument.cpp
===================================================================
--- scribus/ui/tabdocument.cpp (revision 14993)
+++ scribus/ui/tabdocument.cpp (revision 14994)
@@ -266,8 +266,8 @@
pageHeight->setValue(doc->pageHeight() * unitRatio);
pageW = doc->pageWidth();
pageH = doc->pageHeight();
- marginGroup->setNewBleeds(*doc->bleeds());
- marginGroup->setNewMargins(doc->pageMargins);
+ marginGroup->setNewBleeds(doc->bleedsVal());
+ marginGroup->setNewMargins(doc->marginsVal());
marginGroup->setPageWidthHeight(doc->pageWidth(), doc->pageHeight());
marginGroup->setPageSize(prefsPageSizeName);
marginGroup->setMarginPreset(doc->marginPreset());
Index: scribus/ui/pagepalette.cpp
===================================================================
--- scribus/ui/pagepalette.cpp (revision 14993)
+++ scribus/ui/pagepalette.cpp (revision 14994)
@@ -699,7 +699,7 @@
void PagePalette::handlePageLayout(int layout)
{
pageLayout->selectFirstP(currView->Doc->pageSets()[layout].FirstPage);
- currView->Doc->resetPage(currView->Doc->pageMargins, layout);
+ currView->Doc->resetPage(layout);
currView->reformPages();
currView->DrawNew();
currView->GotoPage(currView->Doc->currentPageNumber());
Index: scribus/ui/reformdoc.cpp
===================================================================
--- scribus/ui/reformdoc.cpp (revision 14993)
+++ scribus/ui/reformdoc.cpp (revision 14994)
@@ -228,7 +228,7 @@
currDoc->setPageGapVertical(tabView->gapVertical->value() / currDoc->unitRatio());
// currDoc->pageSets[fp].GapBelow = tabView->gapVertical->value() / currDoc->unitRatio();
//currDoc->FirstPnum = pageNumber->value();
- currDoc->resetPage(updatedMargins, fp);
+ currDoc->resetPage(fp, &updatedMargins);
currDoc->setPageOrientation(tabPage->pageOrientationComboBox->currentIndex());
currDoc->setPageSize(tabPage->prefsPageSizeName);
currDoc->setPageWidth(tabPage->pageW);
Index: scribus/plugins/scripter/api_document.cpp
===================================================================
--- scribus/plugins/scripter/api_document.cpp (revision 14993)
+++ scribus/plugins/scripter/api_document.cpp (revision 14994)
@@ -225,7 +225,7 @@
*/
double Margins::top()
{
- return ScCore->primaryMainWindow()->doc->pageMargins.Top;
+ return ScCore->primaryMainWindow()->doc->margins()->Top;
}
@@ -237,7 +237,7 @@
*/
double Margins::left()
{
- return ScCore->primaryMainWindow()->doc->pageMargins.Left;
+ return ScCore->primaryMainWindow()->doc->margins()->Left;
}
@@ -248,7 +248,7 @@
* right-margin of active document as double
*/
double Margins::right() {
- return ScCore->primaryMainWindow()->doc->pageMargins.Right;
+ return ScCore->primaryMainWindow()->doc->margins()->Right;
}
@@ -259,7 +259,7 @@
* top-margin of active document as double
*/
double Margins::bottom() {
- return ScCore->primaryMainWindow()->doc->pageMargins.Bottom;
+ return ScCore->primaryMainWindow()->doc->margins()->Bottom;
}
@@ -274,7 +274,7 @@
void Margins::set(double lr, double tpr, double btr, double rr)
{
MarginStruct margins(tpr, lr, btr, rr);
- ScCore->primaryMainWindow()->doc->resetPage(margins,ScCore->primaryMainWindow()->doc->currentPageLayout);
+ ScCore->primaryMainWindow()->doc->resetPage(ScCore->primaryMainWindow()->doc->currentPageLayout, &margins);
ScCore->primaryMainWindow()->view->reformPages();
ScCore->primaryMainWindow()->doc->setModified(true);
ScCore->primaryMainWindow()->view->GotoPage(ScCore->primaryMainWindow()->doc->currentPageNumber());
Index: scribus/plugins/fileloader/scribus12format/scribus12format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus12format/scribus12format.cpp (revision 14993)
+++ scribus/plugins/fileloader/scribus12format/scribus12format.cpp (revision 14994)
@@ -273,10 +273,10 @@
else
m_Doc->setPageWidth(ScCLocale::toDoubleC(dc.attribute("PAGEWITH")));
m_Doc->setPageHeight(ScCLocale::toDoubleC(dc.attribute("PAGEHEIGHT")));
- m_Doc->pageMargins.Left=qMax(0.0, ScCLocale::toDoubleC(dc.attribute("BORDERLEFT")));
- m_Doc->pageMargins.Right=qMax(0.0, ScCLocale::toDoubleC(dc.attribute("BORDERRIGHT")));
- m_Doc->pageMargins.Top=qMax(0.0, ScCLocale::toDoubleC(dc.attribute("BORDERTOP")));
- m_Doc->pageMargins.Bottom=qMax(0.0, ScCLocale::toDoubleC(dc.attribute("BORDERBOTTOM")));
+ m_Doc->margins()->Left=qMax(0.0, ScCLocale::toDoubleC(dc.attribute("BORDERLEFT")));
+ m_Doc->margins()->Right=qMax(0.0, ScCLocale::toDoubleC(dc.attribute("BORDERRIGHT")));
+ m_Doc->margins()->Top=qMax(0.0, ScCLocale::toDoubleC(dc.attribute("BORDERTOP")));
+ m_Doc->margins()->Bottom=qMax(0.0, ScCLocale::toDoubleC(dc.attribute("BORDERBOTTOM")));
m_Doc->setMarginPreset(dc.attribute("PRESET", "0").toInt());
m_Doc->setPageOrientation(dc.attribute("ORIENTATION", "0").toInt());
m_Doc->setPageSize(dc.attribute("PAGESIZE"));
Index: scribus/plugins/fileloader/scribus13format/scribus13format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 14993)
+++ scribus/plugins/fileloader/scribus13format/scribus13format.cpp (revision 14994)
@@ -334,10 +334,10 @@
else
m_Doc->setPageWidth(ScCLocale::toDoubleC(dc.attribute("PAGEWITH")));
m_Doc->setPageHeight(ScCLocale::toDoubleC(dc.attribute("PAGEHEIGHT")));
- m_Doc->pageMargins.Left = qMax(0.0, ScCLocale::toDoubleC("BORDERLEFT"));
- m_Doc->pageMargins.Right = qMax(0.0, ScCLocale::toDoubleC("BORDERRIGHT"));
- m_Doc->pageMargins.Top = qMax(0.0, ScCLocale::toDoubleC("BORDERTOP"));
- m_Doc->pageMargins.Bottom= qMax(0.0, ScCLocale::toDoubleC("BORDERBOTTOM"));
+ m_Doc->margins()->Left = qMax(0.0, ScCLocale::toDoubleC("BORDERLEFT"));
+ m_Doc->margins()->Right = qMax(0.0, ScCLocale::toDoubleC("BORDERRIGHT"));
+ m_Doc->margins()->Top = qMax(0.0, ScCLocale::toDoubleC("BORDERTOP"));
+ m_Doc->margins()->Bottom= qMax(0.0, ScCLocale::toDoubleC("BORDERBOTTOM"));
m_Doc->setMarginPreset(dc.attribute("PRESET", "0").toInt());
m_Doc->setHyphAutomatic(static_cast<bool>(dc.attribute("AUTOMATIC", "1").toInt()));
m_Doc->setHyphAutoCheck(static_cast<bool>(dc.attribute("AUTOCHECK", "0").toInt()));
@@ -1189,10 +1189,10 @@
dc.setAttribute("ANZPAGES",m_Doc->DocPages.count());
dc.setAttribute("PAGEWIDTH",m_Doc->pageWidth());
dc.setAttribute("PAGEHEIGHT",m_Doc->pageHeight());
- dc.setAttribute("BORDERLEFT",m_Doc->pageMargins.Left);
- dc.setAttribute("BORDERRIGHT",m_Doc->pageMargins.Right);
- dc.setAttribute("BORDERTOP",m_Doc->pageMargins.Top);
- dc.setAttribute("BORDERBOTTOM",m_Doc->pageMargins.Bottom);
+ dc.setAttribute("BORDERLEFT",m_Doc->margins()->Left);
+ dc.setAttribute("BORDERRIGHT",m_Doc->margins()->Right);
+ dc.setAttribute("BORDERTOP",m_Doc->margins()->Top);
+ dc.setAttribute("BORDERBOTTOM",m_Doc->margins()->Bottom);
dc.setAttribute("PRESET",m_Doc->marginPreset());
dc.setAttribute("ORIENTATION",m_Doc->pageOrientation());
dc.setAttribute("PAGESIZE",m_Doc->pageSize());
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14993)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp (revision 14994)
@@ -82,11 +82,11 @@
docu.writeAttribute("ANZPAGES" , m_Doc->DocPages.count());
docu.writeAttribute("PAGEWIDTH" , m_Doc->pageWidth());
docu.writeAttribute("PAGEHEIGHT" , m_Doc->pageHeight());
- docu.writeAttribute("BORDERLEFT" , m_Doc->pageMargins.Left);
- docu.writeAttribute("BORDERRIGHT" , m_Doc->pageMargins.Right);
- docu.writeAttribute("BORDERTOP" , m_Doc->pageMargins.Top);
- docu.writeAttribute("BORDERBOTTOM", m_Doc->pageMargins.Bottom);
- docu.writeAttribute("PRESET" ,m_Doc->marginPreset());
+ docu.writeAttribute("BORDERLEFT" , m_Doc->margins()->Left);
+ docu.writeAttribute("BORDERRIGHT" , m_Doc->margins()->Right);
+ docu.writeAttribute("BORDERTOP" , m_Doc->margins()->Top);
+ docu.writeAttribute("BORDERBOTTOM", m_Doc->margins()->Bottom);
+ docu.writeAttribute("PRESET" , m_Doc->marginPreset());
docu.writeAttribute("BleedTop" , m_Doc->bleeds()->Top);
docu.writeAttribute("BleedLeft" , m_Doc->bleeds()->Left);
docu.writeAttribute("BleedRight" , m_Doc->bleeds()->Right);
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14993)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp (revision 14994)
@@ -752,10 +752,10 @@
else
m_Doc->setPageWidth(attrs.valueAsDouble("PAGEWITH"));
m_Doc->setPageHeight(attrs.valueAsDouble("PAGEHEIGHT"));
- m_Doc->pageMargins.Left = qMax(0.0, attrs.valueAsDouble("BORDERLEFT"));
- m_Doc->pageMargins.Right = qMax(0.0, attrs.valueAsDouble("BORDERRIGHT"));
- m_Doc->pageMargins.Top = qMax(0.0, attrs.valueAsDouble("BORDERTOP"));
- m_Doc->pageMargins.Bottom= qMax(0.0, attrs.valueAsDouble("BORDERBOTTOM"));
+ m_Doc->margins()->Left = qMax(0.0, attrs.valueAsDouble("BORDERLEFT"));
+ m_Doc->margins()->Right = qMax(0.0, attrs.valueAsDouble("BORDERRIGHT"));
+ m_Doc->margins()->Top = qMax(0.0, attrs.valueAsDouble("BORDERTOP"));
+ m_Doc->margins()->Bottom= qMax(0.0, attrs.valueAsDouble("BORDERBOTTOM"));
m_Doc->setMarginPreset(attrs.valueAsInt("PRESET", 0));
m_Doc->bleeds()->Top = attrs.valueAsDouble("BleedTop", 0.0);
m_Doc->bleeds()->Left = attrs.valueAsDouble("BleedLeft", 0.0);
Index: scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp (revision 14993)
+++ scribus/plugins/fileloader/scribus134format/scribus134format_save.cpp (revision 14994)
@@ -79,10 +79,10 @@
docu.writeAttribute("ANZPAGES" , m_Doc->DocPages.count());
docu.writeAttribute("PAGEWIDTH" , m_Doc->pageWidth());
docu.writeAttribute("PAGEHEIGHT" , m_Doc->pageHeight());
- docu.writeAttribute("BORDERLEFT" , m_Doc->pageMargins.Left);
- docu.writeAttribute("BORDERRIGHT" , m_Doc->pageMargins.Right);
- docu.writeAttribute("BORDERTOP" , m_Doc->pageMargins.Top);
- docu.writeAttribute("BORDERBOTTOM", m_Doc->pageMargins.Bottom);
+ docu.writeAttribute("BORDERLEFT" , m_Doc->margins()->Left);
+ docu.writeAttribute("BORDERRIGHT" , m_Doc->margins()->Right);
+ docu.writeAttribute("BORDERTOP" , m_Doc->margins()->Top);
+ docu.writeAttribute("BORDERBOTTOM", m_Doc->margins()->Bottom);
docu.writeAttribute("PRESET" , m_Doc->marginPreset());
docu.writeAttribute("BleedTop" , m_Doc->bleeds()->Top);
docu.writeAttribute("BleedLeft" , m_Doc->bleeds()->Left);
Index: scribus/plugins/fileloader/scribus134format/scribus134format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14993)
+++ scribus/plugins/fileloader/scribus134format/scribus134format.cpp (revision 14994)
@@ -747,10 +747,10 @@
else
m_Doc->setPageWidth(attrs.valueAsDouble("PAGEWITH"));
m_Doc->setPageHeight(attrs.valueAsDouble("PAGEHEIGHT"));
- m_Doc->pageMargins.Left = qMax(0.0, attrs.valueAsDouble("BORDERLEFT"));
- m_Doc->pageMargins.Right = qMax(0.0, attrs.valueAsDouble("BORDERRIGHT"));
- m_Doc->pageMargins.Top = qMax(0.0, attrs.valueAsDouble("BORDERTOP"));
- m_Doc->pageMargins.Bottom= qMax(0.0, attrs.valueAsDouble("BORDERBOTTOM"));
+ m_Doc->margins()->Left = qMax(0.0, attrs.valueAsDouble("BORDERLEFT"));
+ m_Doc->margins()->Right = qMax(0.0, attrs.valueAsDouble("BORDERRIGHT"));
+ m_Doc->margins()->Top = qMax(0.0, attrs.valueAsDouble("BORDERTOP"));
+ m_Doc->margins()->Bottom= qMax(0.0, attrs.valueAsDouble("BORDERBOTTOM"));
m_Doc->setMarginPreset(attrs.valueAsInt("PRESET", 0));
m_Doc->bleeds()->Top = attrs.valueAsDouble("BleedTop", 0.0);
m_Doc->bleeds()->Left = attrs.valueAsDouble("BleedLeft", 0.0);
More information about the scribus-commit
mailing list