r17465 by fschmid - Fixed Bug 10694: The new document size seems to be out of kilter.
scribus-commit
scribus-commit at lists.scribus.net
Sun Apr 22 09:43:27 UTC 2012
Author: fschmid
Date: Sun Apr 22 09:43:26 2012
New Revision: 17465
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17465
Log:
Fixed Bug 10694: The new document size seems to be out of kilter.
Modified:
trunk/Scribus/scribus/pagesize.cpp
trunk/Scribus/scribus/ui/applytemplatedialog.cpp
trunk/Scribus/scribus/ui/newfile.cpp
trunk/Scribus/scribus/ui/scrspinbox.cpp
trunk/Scribus/scribus/ui/scrspinbox.h
Modified: trunk/Scribus/scribus/pagesize.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17465&path=/trunk/Scribus/scribus/pagesize.cpp
==============================================================================
--- trunk/Scribus/scribus/pagesize.cpp (original)
+++ trunk/Scribus/scribus/pagesize.cpp Sun Apr 22 09:43:26 2012
@@ -168,39 +168,101 @@
width = floor(1000.0 / sqrt(sqrt(2.0)) + 0.5);
height = floor(sqrt(sqrt(2.0))*1000.0 + 0.5);
//4A0
- info.width=mm2pts(width*2.0);
- info.height=mm2pts(height*2.0);
- info.pageUnitIndex=SC_MM;
- info.trSizeName=QObject::tr("4A0");
+ info.width = mm2pts(1682.0);
+ info.height = mm2pts(2378.0);
+ info.pageUnitIndex = SC_MM;
+ info.trSizeName = QObject::tr("4A0");
pageSizeList.insert("4A0", info);
//2A0
- info.width=mm2pts(height);
- info.height=mm2pts(width*2.0);
- info.pageUnitIndex=SC_MM;
- info.trSizeName=QObject::tr("2A0");
+ info.width = mm2pts(1189.0);
+ info.height = mm2pts(1682.0);
+ info.pageUnitIndex = SC_MM;
+ info.trSizeName = QObject::tr("2A0");
pageSizeList.insert("2A0", info);
//Continue with rest of A series
+ // do not use the formula below, as it is correct in theory,
+ // but due to rounding errors it gives incorrect results.
+/* for (format = 0; format <= 10; format++) {
+ info.width=mm2pts(width);
+ info.height=mm2pts(height);
+ info.pageUnitIndex=SC_MM;
+ name=QString("A%1").arg(format);
+ info.trSizeName=name;
+ pageSizeList.insert(name, info);
+ tmp = height;
+ height = width;
+ width = floor(tmp / 2.0);
+ } */
+ // all of the following data is taken from the Ghostscript manual
+ // "Appendix: Paper sizes known to Ghostscript"
+ QList<double> Awidths;
+ QList<double> Aheights;
+ Awidths << 841.0 << 594.0 << 420.0 << 297.0 << 210.0 << 148.0 << 105.0 << 74.0 << 52.0 << 37.0 << 26.0;
+ Aheights << 1189.0 << 841.0 << 594.0 << 420.0 << 297.0 << 210.0 << 148.0 << 105.0 << 74.0 << 52.0 << 37.0;
+ for (format = 0; format < Awidths.count(); format++)
+ {
+ info.width = mm2pts(Awidths[format]);
+ info.height = mm2pts(Aheights[format]);
+ info.pageUnitIndex = SC_MM;
+ name = QString("A%1").arg(format);
+ info.trSizeName = name;
+ pageSizeList.insert(name, info);
+ }
+
+ /* B series */
+ Awidths.clear();
+ Aheights.clear();
+ Awidths << 1000.0 << 707.0 << 500.0 << 353.0 << 250.0 << 176.0 << 125.0 << 88.0 << 62.0 << 44.0 << 31.0;
+ Aheights << 1414.0 << 1000.0 << 707.0 << 500.0 << 353.0 << 250.0 << 176.0 << 125.0 << 88.0 << 62.0 << 44.0;
+ for (format = 0; format < Awidths.count(); format++)
+ {
+ info.width = mm2pts(Awidths[format]);
+ info.height = mm2pts(Aheights[format]);
+ info.pageUnitIndex=SC_MM;
+ name = QString("B%1").arg(format);
+ info.trSizeName = name;
+ pageSizeList.insert(name, info);
+ }
+ /* C series */
+ Awidths.clear();
+ Aheights.clear();
+ Awidths << 917.0 << 648.0 << 458.0 << 324.0 << 229.0 << 162.0 << 114.0 << 81.0 << 57.0 << 40.0 << 28.0;
+ Aheights << 1297.0 << 917.0 << 648.0 << 458.0 << 324.0 << 229.0 << 162.0 << 114.0 << 81.0 << 57.0 << 40.0;
+ for (format = 0; format < Awidths.count(); format++)
+ {
+ info.width = mm2pts(Awidths[format]);
+ info.height = mm2pts(Aheights[format]);
+ info.pageUnitIndex=SC_MM;
+ name = QString("B%1").arg(format);
+ info.trSizeName = name;
+ pageSizeList.insert(name, info);
+ }
+/*
+ width = 1000.0;
+ height = floor(sqrt(2.0)*1000.0 + 0.5);
+
for (format = 0; format <= 10; format++) {
info.width=mm2pts(width);
info.height=mm2pts(height);
info.pageUnitIndex=SC_MM;
- name=QString("A%1").arg(format);
+ name=QString("B%1").arg(format);
info.trSizeName=name;
pageSizeList.insert(name, info);
+
tmp = height;
height = width;
width = floor(tmp / 2.0);
}
-
- /* B series */
- width = 1000.0;
- height = floor(sqrt(2.0)*1000.0 + 0.5);
+
+ // C series
+ width = floor(1000.0 / sqrt(sqrt(sqrt(2.0)))+0.5);
+ height = floor(sqrt(sqrt(sqrt(8.0)))*1000.0 + 0.5);
for (format = 0; format <= 10; format++) {
info.width=mm2pts(width);
info.height=mm2pts(height);
info.pageUnitIndex=SC_MM;
- name=QString("B%1").arg(format);
+ name=QString("C%1").arg(format);
info.trSizeName=name;
pageSizeList.insert(name, info);
@@ -208,24 +270,7 @@
height = width;
width = floor(tmp / 2.0);
}
-
- /* C series */
- width = floor(1000.0 / sqrt(sqrt(sqrt(2.0)))+0.5);
- height = floor(sqrt(sqrt(sqrt(8.0)))*1000.0 + 0.5);
-
- for (format = 0; format <= 10; format++) {
- info.width=mm2pts(width);
- info.height=mm2pts(height);
- info.pageUnitIndex=SC_MM;
- name=QString("C%1").arg(format);
- info.trSizeName=name;
- pageSizeList.insert(name, info);
-
- tmp = height;
- height = width;
- width = floor(tmp / 2.0);
- }
-
+*/
/* PA series */
width = 840;
height = 1120;
Modified: trunk/Scribus/scribus/ui/applytemplatedialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17465&path=/trunk/Scribus/scribus/ui/applytemplatedialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/applytemplatedialog.cpp (original)
+++ trunk/Scribus/scribus/ui/applytemplatedialog.cpp Sun Apr 22 09:43:26 2012
@@ -171,7 +171,7 @@
fromPageSpinBox->setMaximum(docPagesCount);
fromPageSpinBox->setValue(view->currentPage()->pageNr()+1);
toPageSpinBox->setMaximum(docPagesCount);
- toPageSpinBox->setValue(docPagesCount);
+ toPageSpinBox->setValue(static_cast<int>(docPagesCount));
}
Modified: trunk/Scribus/scribus/ui/newfile.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17465&path=/trunk/Scribus/scribus/ui/newfile.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/newfile.cpp (original)
+++ trunk/Scribus/scribus/ui/newfile.cpp Sun Apr 22 09:43:26 2012
@@ -516,6 +516,8 @@
Distance->setNewUnit(newUnitIndex);
m_unitRatio = unitGetRatioFromIndex(newUnitIndex);
m_unitIndex = newUnitIndex;
+ widthSpinBox->setValue(m_pageWidth * m_unitRatio);
+ heightSpinBox->setValue(m_pageHeight * m_unitRatio);
/*
double oldUnitRatio = unitRatio;
double val, oldB, oldBM, oldH, oldHM;
Modified: trunk/Scribus/scribus/ui/scrspinbox.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17465&path=/trunk/Scribus/scribus/ui/scrspinbox.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrspinbox.cpp (original)
+++ trunk/Scribus/scribus/ui/scrspinbox.cpp Sun Apr 22 09:43:26 2012
@@ -52,6 +52,11 @@
}
void ScrSpinBox::setValue(int val)
+{
+ QDoubleSpinBox::setValue(val);
+}
+
+void ScrSpinBox::setValue(double val)
{
QDoubleSpinBox::setValue(val);
}
Modified: trunk/Scribus/scribus/ui/scrspinbox.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17465&path=/trunk/Scribus/scribus/ui/scrspinbox.h
==============================================================================
--- trunk/Scribus/scribus/ui/scrspinbox.h (original)
+++ trunk/Scribus/scribus/ui/scrspinbox.h Sun Apr 22 09:43:26 2012
@@ -48,6 +48,7 @@
void setValues(double min, double max, int deci, double val);
void getValues(double *min, double *max, int *deci, double *val);
void setValue(int val);
+ void setValue(double val);
protected:
void setParameters( int s );
More information about the scribus-commit
mailing list