r14274 by cbradney - Make new typorgraphy prefs pane work and bump about date

scribus-commit scribus-commit at lists.scribus.net
Mon Nov 9 21:50:35 CET 2009


Revision: 14274
Author: cbradney
Date: 2009-11-09T14:17:22.460790Z
Commit message: Make new typorgraphy prefs pane work and bump about date

Changeset: 
M  /trunk/Scribus/scribus/ui/prefs_typographybase.ui
M  /trunk/Scribus/scribus/ui/preferencesdialog.cpp
M  /trunk/Scribus/scribus/ui/prefs_typography.cpp
M  /trunk/Scribus/scribus/ui/about.cpp
M  /trunk/Scribus/scribus/ui/prefs_typography.h

Diffs:
Index: scribus/ui/prefs_typography.cpp
===================================================================
--- scribus/ui/prefs_typography.cpp	(revision 14273)
+++ scribus/ui/prefs_typography.cpp	(revision 14274)
@@ -6,15 +6,64 @@
 */
 
 #include "prefs_typography.h"
+#include "prefsstructs.h"
 
 Prefs_Typography::Prefs_Typography(QWidget* parent)
-	: QWidget(parent)
+	: Prefs_Pane(parent)
 {
 	setupUi(this);
-
+	languageChange();
 }
 
 Prefs_Typography::~Prefs_Typography()
 {
 }
 
+void Prefs_Typography::languageChange()
+{
+	QString autoText=tr( "Auto" );
+	underlineDisplacementSpinBox->setSpecialValueText(autoText);
+	underlineLineWidthSpinBox->setSpecialValueText(autoText);
+	strikeoutDisplacementSpinBox->setSpecialValueText(autoText);
+	strikeoutLineWidthSpinBox->setSpecialValueText(autoText);
+
+	subscriptDisplacementSpinBox->setToolTip( tr( "Displacement below the baseline of the normal font on a line" ) );
+	subscriptScalingSpinBox->setToolTip( tr( "Relative size of the subscript compared to the normal font" ) );
+	superscriptDisplacementSpinBox->setToolTip( tr( "Displacement above the baseline of the font on a line" ) );
+	superscriptScalingSpinBox->setToolTip( tr( "Relative size of the superscript compared to the normal font" ) );
+	underlineDisplacementSpinBox->setToolTip( tr( "Displacement below the baseline of the normal font expressed as a percentage of the fonts descender" ) );
+	underlineLineWidthSpinBox->setToolTip( tr( "Line width expressed as a percentage of the font size" ) );
+	strikeoutDisplacementSpinBox->setToolTip( tr( "Displacement above the baseline of the normal font expressed as a percentage of the fonts ascender" ) );
+	strikeoutLineWidthSpinBox->setToolTip( tr( "Line width expressed as a percentage of the font size" ) );
+	smallcapsScalingSpinBox->setToolTip( tr( "Relative size of the small caps font compared to the normal font" ) );
+	automaticLineSpacingSpinBox->setToolTip( tr( "Percentage increase over the font size for the line spacing" ) );
+}
+
+void Prefs_Typography::restoreDefaults(struct ApplicationPrefs *prefsData)
+{
+	subscriptDisplacementSpinBox->setValue(prefsData->typoPrefs.valueSubScript);
+	subscriptScalingSpinBox->setValue(prefsData->typoPrefs.scalingSubScript);
+	superscriptDisplacementSpinBox->setValue(prefsData->typoPrefs.valueSuperScript);
+	superscriptScalingSpinBox->setValue(prefsData->typoPrefs.scalingSuperScript);
+	underlineDisplacementSpinBox->setValue(prefsData->typoPrefs.valueUnderlinePos / 10.0);
+	underlineLineWidthSpinBox->setValue(prefsData->typoPrefs.valueUnderlineWidth / 10.0);
+	strikeoutDisplacementSpinBox->setValue(prefsData->typoPrefs.valueStrikeThruPos / 10.0);
+	strikeoutLineWidthSpinBox->setValue(prefsData->typoPrefs.valueStrikeThruWidth / 10.0);
+	smallcapsScalingSpinBox->setValue(prefsData->typoPrefs.valueSmallCaps);
+	automaticLineSpacingSpinBox->setValue(prefsData->typoPrefs.autoLineSpacing);
+}
+
+void Prefs_Typography::saveGuiToPrefs(struct ApplicationPrefs *prefsData) const
+{
+	prefsData->typoPrefs.valueSubScript=subscriptDisplacementSpinBox->value();
+	prefsData->typoPrefs.scalingSubScript=subscriptScalingSpinBox->value();
+	prefsData->typoPrefs.valueSuperScript=superscriptDisplacementSpinBox->value();
+	prefsData->typoPrefs.scalingSuperScript=superscriptScalingSpinBox->value();
+	prefsData->typoPrefs.valueUnderlinePos=underlineDisplacementSpinBox->value() * 10.0;
+	prefsData->typoPrefs.valueUnderlineWidth=underlineLineWidthSpinBox->value() * 10.0;
+	prefsData->typoPrefs.valueStrikeThruPos=strikeoutDisplacementSpinBox->value() * 10.0;
+	prefsData->typoPrefs.valueStrikeThruWidth=strikeoutLineWidthSpinBox->value() * 10.0;
+	prefsData->typoPrefs.valueSmallCaps=smallcapsScalingSpinBox->value();
+	prefsData->typoPrefs.autoLineSpacing=automaticLineSpacingSpinBox->value();
+}
+
Index: scribus/ui/about.cpp
===================================================================
--- scribus/ui/about.cpp	(revision 14273)
+++ scribus/ui/about.cpp	(revision 14274)
@@ -114,8 +114,8 @@
 	buildID = new QLabel( tab );
 	buildID->setAlignment(Qt::AlignCenter);
 	buildID->setTextInteractionFlags(Qt::TextSelectableByMouse);
-	QString BUILD_DAY = "27";
-	QString BUILD_MONTH = CommonStrings::october;
+	QString BUILD_DAY = "09";
+	QString BUILD_MONTH = CommonStrings::november;
 	QString BUILD_YEAR = "2009";
 	QString BUILD_TIME = "";
 	QString BUILD_TZ = "";
Index: scribus/ui/prefs_typographybase.ui
===================================================================
--- scribus/ui/prefs_typographybase.ui	(revision 14273)
+++ scribus/ui/prefs_typographybase.ui	(revision 14274)
@@ -44,9 +44,9 @@
       <property name="geometry">
        <rect>
         <x>0</x>
-        <y>0</y>
+        <y>-61</y>
         <width>452</width>
-        <height>803</height>
+        <height>788</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout">
@@ -86,14 +86,27 @@
           </widget>
          </item>
          <item row="0" column="1">
-          <widget class="QSpinBox" name="spinBox">
+          <widget class="QSpinBox" name="subscriptDisplacementSpinBox">
            <property name="suffix">
-            <string/>
+            <string> %</string>
            </property>
+           <property name="maximum">
+            <number>100</number>
+           </property>
           </widget>
          </item>
          <item row="1" column="1">
-          <widget class="QSpinBox" name="spinBox_2"/>
+          <widget class="QSpinBox" name="subscriptScalingSpinBox">
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <number>1</number>
+           </property>
+           <property name="maximum">
+            <number>100</number>
+           </property>
+          </widget>
          </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_6">
@@ -156,7 +169,14 @@
           </widget>
          </item>
          <item row="0" column="1">
-          <widget class="QSpinBox" name="spinBox_3"/>
+          <widget class="QSpinBox" name="superscriptDisplacementSpinBox">
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="maximum">
+            <number>100</number>
+           </property>
+          </widget>
          </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_8">
@@ -166,7 +186,17 @@
           </widget>
          </item>
          <item row="1" column="1">
-          <widget class="QSpinBox" name="spinBox_4"/>
+          <widget class="QSpinBox" name="superscriptScalingSpinBox">
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <number>1</number>
+           </property>
+           <property name="maximum">
+            <number>100</number>
+           </property>
+          </widget>
          </item>
         </layout>
        </item>
@@ -221,9 +251,6 @@
            </property>
           </widget>
          </item>
-         <item row="0" column="1">
-          <widget class="QSpinBox" name="spinBox_5"/>
-         </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_10">
            <property name="text">
@@ -232,8 +259,43 @@
           </widget>
          </item>
          <item row="1" column="1">
-          <widget class="QSpinBox" name="spinBox_6"/>
+          <widget class="QDoubleSpinBox" name="underlineLineWidthSpinBox">
+           <property name="wrapping">
+            <bool>true</bool>
+           </property>
+           <property name="specialValueText">
+            <string>Auto</string>
+           </property>
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <double>-0.100000000000000</double>
+           </property>
+           <property name="maximum">
+            <double>100.000000000000000</double>
+           </property>
+          </widget>
          </item>
+         <item row="0" column="1">
+          <widget class="QDoubleSpinBox" name="underlineDisplacementSpinBox">
+           <property name="wrapping">
+            <bool>true</bool>
+           </property>
+           <property name="specialValueText">
+            <string>Auto</string>
+           </property>
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <double>-0.100000000000000</double>
+           </property>
+           <property name="maximum">
+            <double>100.000000000000000</double>
+           </property>
+          </widget>
+         </item>
         </layout>
        </item>
        <item>
@@ -288,7 +350,23 @@
           </widget>
          </item>
          <item row="0" column="1">
-          <widget class="QSpinBox" name="spinBox_7"/>
+          <widget class="QDoubleSpinBox" name="strikeoutDisplacementSpinBox">
+           <property name="wrapping">
+            <bool>true</bool>
+           </property>
+           <property name="specialValueText">
+            <string>Auto</string>
+           </property>
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <double>-0.100000000000000</double>
+           </property>
+           <property name="maximum">
+            <double>100.000000000000000</double>
+           </property>
+          </widget>
          </item>
          <item row="1" column="0">
           <widget class="QLabel" name="label_13">
@@ -298,7 +376,23 @@
           </widget>
          </item>
          <item row="1" column="1">
-          <widget class="QSpinBox" name="spinBox_8"/>
+          <widget class="QDoubleSpinBox" name="strikeoutLineWidthSpinBox">
+           <property name="wrapping">
+            <bool>true</bool>
+           </property>
+           <property name="specialValueText">
+            <string>Auto</string>
+           </property>
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="minimum">
+            <double>-0.100000000000000</double>
+           </property>
+           <property name="maximum">
+            <double>100.000000000000000</double>
+           </property>
+          </widget>
          </item>
         </layout>
        </item>
@@ -354,7 +448,14 @@
           </widget>
          </item>
          <item row="0" column="1">
-          <widget class="QSpinBox" name="spinBox_9"/>
+          <widget class="QSpinBox" name="smallcapsScalingSpinBox">
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="maximum">
+            <number>100</number>
+           </property>
+          </widget>
          </item>
         </layout>
        </item>
@@ -410,7 +511,14 @@
           </widget>
          </item>
          <item row="0" column="1">
-          <widget class="QSpinBox" name="spinBox_12"/>
+          <widget class="QSpinBox" name="automaticLineSpacingSpinBox">
+           <property name="suffix">
+            <string> %</string>
+           </property>
+           <property name="maximum">
+            <number>100</number>
+           </property>
+          </widget>
          </item>
         </layout>
        </item>
Index: scribus/ui/prefs_typography.h
===================================================================
--- scribus/ui/prefs_typography.h	(revision 14273)
+++ scribus/ui/prefs_typography.h	(revision 14274)
@@ -9,15 +9,21 @@
 #define PREFS_TYPOGRAPHY_H
 
 #include "ui_prefs_typographybase.h"
+#include "prefs_pane.h"
 #include "scribusapi.h"
 
-class SCRIBUS_API Prefs_Typography : public QWidget, Ui::Prefs_Typography
+class SCRIBUS_API Prefs_Typography : public Prefs_Pane, Ui::Prefs_Typography
 {
 	Q_OBJECT
 
 	public:
 		Prefs_Typography(QWidget* parent=0);
 		~Prefs_Typography();
+		virtual void restoreDefaults(struct ApplicationPrefs *prefsData);
+		virtual void saveGuiToPrefs(struct ApplicationPrefs *prefsData) const;
+
+	public slots:
+		void languageChange();
 };
 
 #endif // PREFS_TYPOGRAPHY_H
Index: scribus/ui/preferencesdialog.cpp
===================================================================
--- scribus/ui/preferencesdialog.cpp	(revision 14273)
+++ scribus/ui/preferencesdialog.cpp	(revision 14274)
@@ -88,6 +88,11 @@
 
 }
 
+
+PreferencesDialog::~PreferencesDialog()
+{
+}
+
 void PreferencesDialog::restoreDefaults()
 {
 	prefsManager->initDefaults();
@@ -108,16 +113,32 @@
 	prefs_UserInterface->restoreDefaults(&localPrefs);
 	prefs_Paths->restoreDefaults(&localPrefs);
 	prefs_DocumentSetup->restoreDefaults(&localPrefs);
+	prefs_Typography->restoreDefaults(&localPrefs);
 	prefs_ColorManagement->restoreDefaults(&localPrefs);
 	prefs_ColorManagement->setProfiles(&localPrefs, &ScCore->InputProfiles, &ScCore->InputProfilesCMYK, &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
 	prefs_Scrapbook->restoreDefaults(&localPrefs);
 	prefs_Display->restoreDefaults(&localPrefs);
 }
 
-PreferencesDialog::~PreferencesDialog()
+
+void PreferencesDialog::saveGuiToPrefs()
 {
+	prefs_UserInterface->saveGuiToPrefs(&localPrefs);
+	prefs_Paths->saveGuiToPrefs(&localPrefs);
+	prefs_DocumentSetup->saveGuiToPrefs(&localPrefs);
+	prefs_Typography->saveGuiToPrefs(&localPrefs);
+	prefs_ColorManagement->saveGuiToPrefs(&localPrefs);
+	prefs_Scrapbook->saveGuiToPrefs(&localPrefs);
+	prefs_Display->saveGuiToPrefs(&localPrefs);
 }
 
+void PreferencesDialog::applyButtonClicked()
+{
+	Prefs_Pane* pp=qobject_cast<Prefs_Pane *>(prefsStackWidget->currentWidget());
+	if (pp)
+		pp->saveGuiToPrefs(&localPrefs);
+}
+
 void PreferencesDialog::accept()
 {
 	saveGuiToPrefs();
@@ -231,20 +252,4 @@
 	}*/
 }
 
-void PreferencesDialog::applyButtonClicked()
-{
-	Prefs_Pane* pp=qobject_cast<Prefs_Pane *>(prefsStackWidget->currentWidget());
-	if (pp)
-		pp->saveGuiToPrefs(&localPrefs);
-}
 
-void PreferencesDialog::saveGuiToPrefs()
-{
-	prefs_UserInterface->saveGuiToPrefs(&localPrefs);
-	prefs_Paths->saveGuiToPrefs(&localPrefs);
-	prefs_DocumentSetup->saveGuiToPrefs(&localPrefs);
-	prefs_ColorManagement->saveGuiToPrefs(&localPrefs);
-	prefs_Scrapbook->saveGuiToPrefs(&localPrefs);
-	prefs_Display->saveGuiToPrefs(&localPrefs);
-}
-




More information about the scribus-commit mailing list