r14332 by cbradney - Allow new operator prefs to load/save, fix bug in old displacement prefs setting missing ratio conversion

scribus-commit scribus-commit at lists.scribus.net
Mon Nov 23 13:10:31 CET 2009


Revision: 14332
Author: cbradney
Date: 2009-11-23T03:06:53.588428Z
Commit message: Allow new operator prefs to load/save, fix bug in old displacement prefs setting missing ratio conversion

Changeset: 
M  /trunk/Scribus/scribus/ui/prefs_operatortools.cpp
M  /trunk/Scribus/scribus/ui/prefs.cpp
M  /trunk/Scribus/scribus/ui/prefs_operatortools.h
M  /trunk/Scribus/scribus/ui/preferencesdialog.cpp
M  /trunk/Scribus/scribus/ui/prefs_operatortoolsbase.ui
M  /trunk/Scribus/scribus/ui/prefs_scrapbook.cpp
M  /trunk/Scribus/scribus/ui/prefs_display.cpp

Diffs:
Index: scribus/ui/prefs.cpp
===================================================================
--- scribus/ui/prefs.cpp	(revision 14331)
+++ scribus/ui/prefs.cpp	(revision 14332)
@@ -546,8 +546,8 @@
 	if (tabTools->checkHalfRes->isChecked())
 		haRes = 2;
 	prefsManager->appPrefs.itemToolPrefs.imageLowResType = haRes;
-	prefsManager->appPrefs.opToolPrefs.dispX = tabTools->genDispX->value();
-	prefsManager->appPrefs.opToolPrefs.dispY = tabTools->genDispY->value();
+	prefsManager->appPrefs.opToolPrefs.dispX = tabTools->genDispX->value() / unitRatio;
+	prefsManager->appPrefs.opToolPrefs.dispY = tabTools->genDispY->value() / unitRatio;
 	prefsManager->appPrefs.opToolPrefs.constrain = tabTools->genRot->value();
 	prefsManager->appPrefs.docSetupPrefs.AutoSave = tabDocument->GroupAS->isChecked();
 	prefsManager->appPrefs.docSetupPrefs.AutoSaveTime = tabDocument->ASTime->value() * 60 * 1000;
Index: scribus/ui/prefs_display.cpp
===================================================================
--- scribus/ui/prefs_display.cpp	(revision 14331)
+++ scribus/ui/prefs_display.cpp	(revision 14332)
@@ -65,7 +65,6 @@
 {
 	docUnitIndex = prefsData->docSetupPrefs.docUnitIndex;
 	double unitRatio = unitGetRatioFromIndex(docUnitIndex);
-//	int decimals = unitGetPrecisionFromIndex(docUnitIndex);
 	QString unitSuffix = unitGetSuffixFromIndex(docUnitIndex);
 
 	showImagesCheckBox->setChecked(prefsData->guidesPrefs.showPic);
Index: scribus/ui/prefs_operatortoolsbase.ui
===================================================================
--- scribus/ui/prefs_operatortoolsbase.ui	(revision 14331)
+++ scribus/ui/prefs_operatortoolsbase.ui	(revision 14332)
@@ -44,7 +44,7 @@
       <enum>QTabWidget::Rounded</enum>
      </property>
      <property name="currentIndex">
-      <number>1</number>
+      <number>0</number>
      </property>
      <property name="elideMode">
       <enum>Qt::ElideRight</enum>
@@ -99,13 +99,43 @@
               </widget>
              </item>
              <item row="0" column="1">
-              <widget class="ScrSpinBox" name="spinBox"/>
+              <widget class="ScrSpinBox" name="zoomMinimumSpinBox">
+               <property name="suffix">
+                <string> %</string>
+               </property>
+               <property name="minimum">
+                <number>10</number>
+               </property>
+               <property name="maximum">
+                <number>3200</number>
+               </property>
+              </widget>
              </item>
              <item row="1" column="1">
-              <widget class="QSpinBox" name="spinBox_2"/>
+              <widget class="QSpinBox" name="zoomMaximumSpinBox">
+               <property name="suffix">
+                <string> %</string>
+               </property>
+               <property name="minimum">
+                <number>10</number>
+               </property>
+               <property name="maximum">
+                <number>3200</number>
+               </property>
+              </widget>
              </item>
              <item row="2" column="1">
-              <widget class="QSpinBox" name="spinBox_3"/>
+              <widget class="QSpinBox" name="zoomSteppingSpinBox">
+               <property name="suffix">
+                <string> %</string>
+               </property>
+               <property name="minimum">
+                <number>100</number>
+               </property>
+               <property name="maximum">
+                <number>500</number>
+               </property>
+              </widget>
              </item>
             </layout>
            </item>
@@ -188,10 +218,10 @@
               </widget>
              </item>
              <item row="0" column="1">
-              <widget class="ScrSpinBox" name="spinBox_4"/>
+              <widget class="ScrSpinBox" name="itemDuplicateXDispSpinBox"/>
              </item>
              <item row="1" column="1">
-              <widget class="ScrSpinBox" name="spinBox_5"/>
+              <widget class="ScrSpinBox" name="itemDuplicateYDispSpinBox"/>
              </item>
             </layout>
            </item>
@@ -244,7 +274,7 @@
               </widget>
              </item>
              <item row="0" column="1">
-              <widget class="ScrSpinBox" name="spinBox_6"/>
+              <widget class="ScrSpinBox" name="rotationConstraintSpinBox"/>
              </item>
             </layout>
            </item>
Index: scribus/ui/prefs_scrapbook.cpp
===================================================================
--- scribus/ui/prefs_scrapbook.cpp	(revision 14331)
+++ scribus/ui/prefs_scrapbook.cpp	(revision 14332)
@@ -28,11 +28,9 @@
 
 void Prefs_Scrapbook::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
-
 	autoSendCopiedToScrapCheckBox->setChecked(prefsData->scrapbookPrefs.doCopyToScrapbook);
 	keepCopiedAcrossSessionsCheckBox->setChecked(prefsData->scrapbookPrefs.persistentScrapbook);
 	itemCountKeptInScrapbookSpinBox->setValue(prefsData->scrapbookPrefs.numScrapbookCopies);
-
 }
 
 void Prefs_Scrapbook::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
Index: scribus/ui/prefs_operatortools.h
===================================================================
--- scribus/ui/prefs_operatortools.h	(revision 14331)
+++ scribus/ui/prefs_operatortools.h	(revision 14332)
@@ -9,15 +9,21 @@
 #define PREFS_OPERATORTOOLS_H
 
 #include "ui_prefs_operatortoolsbase.h"
+#include "prefs_pane.h"
 #include "scribusapi.h"
 
-class SCRIBUS_API Prefs_OperatorTools : public QWidget, Ui::Prefs_OperatorTools
+class SCRIBUS_API Prefs_OperatorTools : public Prefs_Pane, Ui::Prefs_OperatorTools
 {
 	Q_OBJECT
 
 	public:
 		Prefs_OperatorTools(QWidget* parent=0);
 		~Prefs_OperatorTools();
+		virtual void restoreDefaults(struct ApplicationPrefs *prefsData);
+		virtual void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const;
+
+	public slots:
+		void languageChange();
 };
 
 #endif // PREFS_OPERATORTOOLS_H
Index: scribus/ui/prefs_operatortools.cpp
===================================================================
--- scribus/ui/prefs_operatortools.cpp	(revision 14331)
+++ scribus/ui/prefs_operatortools.cpp	(revision 14332)
@@ -4,17 +4,58 @@
 a copyright and/or license notice that predates the release of Scribus 1.3.2
 for which a new license (GPL+exception) is in place.
 */
+#include <QSpinBox>
+#include "ui/prefs_operatortools.h"
+#include "prefsstructs.h"
+#include "scrspinbox.h"
+#include "units.h"
 
-#include "prefs_operatortools.h"
-
 Prefs_OperatorTools::Prefs_OperatorTools(QWidget* parent)
-	: QWidget(parent)
+	: Prefs_Pane(parent)
 {
 	setupUi(this);
+	itemDuplicateXDispSpinBox->setMaximum(1000);
+	itemDuplicateYDispSpinBox->setMaximum(1000);
+	itemDuplicateXDispSpinBox->setMinimum(-1000);
+	itemDuplicateYDispSpinBox->setMinimum(-1000);
 
+	rotationConstraintSpinBox->setNewUnit(6);
+	rotationConstraintSpinBox->setMaximum(359.99);
+	rotationConstraintSpinBox->setMinimum(0);
+	languageChange();
 }
 
 Prefs_OperatorTools::~Prefs_OperatorTools()
 {
 }
 
+void Prefs_OperatorTools::languageChange()
+{
+
+}
+
+void Prefs_OperatorTools::restoreDefaults(struct ApplicationPrefs *prefsData)
+{
+	zoomMinimumSpinBox->setValue(prefsData->opToolPrefs.magMin);
+	zoomMaximumSpinBox->setValue(prefsData->opToolPrefs.magMax);
+	zoomSteppingSpinBox->setValue(prefsData->opToolPrefs.magStep);
+	double unitRatio = unitGetRatioFromIndex(prefsData->docSetupPrefs.docUnitIndex);
+	itemDuplicateXDispSpinBox->setNewUnit(prefsData->docSetupPrefs.docUnitIndex);
+	itemDuplicateYDispSpinBox->setNewUnit(prefsData->docSetupPrefs.docUnitIndex);
+	itemDuplicateXDispSpinBox->setValue(prefsData->opToolPrefs.dispX * unitRatio);
+	itemDuplicateYDispSpinBox->setValue(prefsData->opToolPrefs.dispY * unitRatio);
+	rotationConstraintSpinBox->setValue(prefsData->opToolPrefs.constrain);
+}
+
+void Prefs_OperatorTools::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
+{
+	prefsData->opToolPrefs.magMin=zoomMinimumSpinBox->value();
+	prefsData->opToolPrefs.magMax=zoomMaximumSpinBox->value();
+	prefsData->opToolPrefs.magStep=zoomSteppingSpinBox->value();
+	double unitRatio = unitGetRatioFromIndex(prefsData->docSetupPrefs.docUnitIndex);
+	prefsData->opToolPrefs.dispX=itemDuplicateXDispSpinBox->value() / unitRatio;
+	prefsData->opToolPrefs.dispY=itemDuplicateYDispSpinBox->value() / unitRatio;
+	prefsData->opToolPrefs.constrain=rotationConstraintSpinBox->value();
+}
+
+
Index: scribus/ui/preferencesdialog.cpp
===================================================================
--- scribus/ui/preferencesdialog.cpp	(revision 14331)
+++ scribus/ui/preferencesdialog.cpp	(revision 14332)
@@ -114,6 +114,7 @@
 	prefs_Paths->restoreDefaults(&localPrefs);
 	prefs_DocumentSetup->restoreDefaults(&localPrefs);
 	prefs_Typography->restoreDefaults(&localPrefs);
+	prefs_OperatorTools->restoreDefaults(&localPrefs);
 	prefs_ColorManagement->restoreDefaults(&localPrefs);
 	prefs_ColorManagement->setProfiles(&localPrefs, &ScCore->InputProfiles, &ScCore->InputProfilesCMYK, &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
 	prefs_Scrapbook->restoreDefaults(&localPrefs);
@@ -127,6 +128,7 @@
 	prefs_Paths->saveGuiToPrefs(&localPrefs);
 	prefs_DocumentSetup->saveGuiToPrefs(&localPrefs);
 	prefs_Typography->saveGuiToPrefs(&localPrefs);
+	prefs_OperatorTools->saveGuiToPrefs(&localPrefs);
 	prefs_ColorManagement->saveGuiToPrefs(&localPrefs);
 	prefs_Scrapbook->saveGuiToPrefs(&localPrefs);
 	prefs_Display->saveGuiToPrefs(&localPrefs);




More information about the scribus-commit mailing list