r20972 by craig -

scribus-commit scribus-commit at lists.scribus.net
Thu Feb 11 19:25:30 UTC 2016


Author: craig
Date: Thu Feb 11 19:25:29 2016
New Revision: 20972

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20972
Log:
#13723: Enforce better maximum values for margin values, rename widget to English

Modified:
    trunk/Scribus/scribus/ui/margindialog.cpp
    trunk/Scribus/scribus/ui/margindialog.h
    trunk/Scribus/scribus/ui/marginwidget.cpp

Modified: trunk/Scribus/scribus/ui/margindialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20972&path=/trunk/Scribus/scribus/ui/margindialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/margindialog.cpp	(original)
+++ trunk/Scribus/scribus/ui/margindialog.cpp	Thu Feb 11 19:25:29 2016
@@ -112,11 +112,11 @@
 	}
 	dialogLayout->addWidget( dsGroupBox7 );
 	
-	GroupRand = new MarginWidget(this,  tr( "Margin Guides" ), &doc->currentPage()->initialMargins, doc->unitIndex(), false, false);
-	GroupRand->setPageWidthHeight(doc->currentPage()->width(), doc->currentPage()->height());
-	GroupRand->setFacingPages(!(doc->pagePositioning() == singlePage), doc->locationOfPage(doc->currentPage()->pageNr()));
-	GroupRand->setMarginPreset(doc->currentPage()->marginPreset);
-	dialogLayout->addWidget( GroupRand );
+	marginWidget = new MarginWidget(this,  tr( "Margin Guides" ), &doc->currentPage()->initialMargins, doc->unitIndex(), false, false);
+	marginWidget->setPageWidthHeight(doc->currentPage()->width(), doc->currentPage()->height());
+	marginWidget->setFacingPages(!(doc->pagePositioning() == singlePage), doc->locationOfPage(doc->currentPage()->pageNr()));
+	marginWidget->setMarginPreset(doc->currentPage()->marginPreset);
+	dialogLayout->addWidget( marginWidget );
 
 	groupMaster = new QGroupBox( this );
 	groupMaster->setTitle( tr( "Other Settings" ) );
@@ -196,7 +196,7 @@
 void MarginDialog::setPageWidth(double)
 {
 	pageWidth = widthSpinBox->value() / unitRatio;
-	GroupRand->setPageWidth(pageWidth);
+	marginWidget->setPageWidth(pageWidth);
 	int newOrientation = (widthSpinBox->value() > heightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != orientationQComboBox->currentIndex())
 	{
@@ -210,7 +210,7 @@
 void MarginDialog::setPageHeight(double)
 {
 	pageHeight = heightSpinBox->value() / unitRatio;
-	GroupRand->setPageHeight(pageHeight);
+	marginWidget->setPageHeight(pageHeight);
 	int newOrientation = (widthSpinBox->value() > heightSpinBox->value()) ? landscapePage : portraitPage;
 	if (newOrientation != orientationQComboBox->currentIndex())
 	{
@@ -251,9 +251,9 @@
 	disconnect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
 	widthSpinBox->setValue(pageWidth * unitRatio);
 	heightSpinBox->setValue(pageHeight * unitRatio);
-	GroupRand->setPageHeight(pageHeight);
-	GroupRand->setPageWidth(pageWidth);
-	GroupRand->setPageSize(gr);
+	marginWidget->setPageHeight(pageHeight);
+	marginWidget->setPageWidth(pageWidth);
+	marginWidget->setPageSize(gr);
 	connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageWidth(double)));
 	connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setPageHeight(double)));
 	delete ps2;
@@ -327,22 +327,22 @@
 
 double MarginDialog::top()
 {
-	return GroupRand->top();
+	return marginWidget->top();
 }
 
 double MarginDialog::bottom()
 {
-	return GroupRand->bottom();
+	return marginWidget->bottom();
 }
 
 double MarginDialog::left()
 {
-	return GroupRand->left();
+	return marginWidget->left();
 }
 
 double MarginDialog::right()
 {
-	return GroupRand->right();
+	return marginWidget->right();
 }
 
 QString MarginDialog::masterPage()
@@ -354,5 +354,5 @@
 
 int MarginDialog::getMarginPreset()
 {
-	return GroupRand->getMarginPreset();
-}
+	return marginWidget->getMarginPreset();
+}

Modified: trunk/Scribus/scribus/ui/margindialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20972&path=/trunk/Scribus/scribus/ui/margindialog.h
==============================================================================
--- trunk/Scribus/scribus/ui/margindialog.h	(original)
+++ trunk/Scribus/scribus/ui/margindialog.h	Thu Feb 11 19:25:29 2016
@@ -90,7 +90,7 @@
 	virtual void setPageHeight(double v);
 
 private:
-	MarginWidget* GroupRand;
+	MarginWidget* marginWidget;
 	QGroupBox* dsGroupBox7;
 	QGroupBox* groupMaster;
 	QLabel* masterPageLabel;

Modified: trunk/Scribus/scribus/ui/marginwidget.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20972&path=/trunk/Scribus/scribus/ui/marginwidget.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/marginwidget.cpp	(original)
+++ trunk/Scribus/scribus/ui/marginwidget.cpp	Thu Feb 11 19:25:29 2016
@@ -255,11 +255,11 @@
 
 void MarginWidget::setPageWidthHeight(double width, double height)
 {
-	rightR->setMaximum(width * m_unitRatio - leftR->value());
-	leftR->setMaximum(width * m_unitRatio - rightR->value());
+	rightR->setMaximum(qMax(0.0, width * m_unitRatio - leftR->value()));
+	leftR->setMaximum(qMax(0.0, width * m_unitRatio - rightR->value()));
 	pageWidth = width;
-	topR->setMaximum(height * m_unitRatio - bottomR->value());
-	bottomR->setMaximum(height * m_unitRatio - topR->value());
+	topR->setMaximum(qMax(0.0, height * m_unitRatio - bottomR->value()));
+	bottomR->setMaximum(qMax(0.0, height * m_unitRatio - topR->value()));
 	pageHeight = height;
 	setPreset();
 }




More information about the scribus-commit mailing list