r14226 by cbradney - Add in tabbed UI to new prefs dialog, some more newmarginwidget updates
scribus-commit
scribus-commit at lists.scribus.net
Sun Oct 25 19:15:26 CET 2009
Revision: 14226
Author: cbradney
Date: 2009-10-25T14:39:03.473265Z
Commit message: Add in tabbed UI to new prefs dialog, some more newmarginwidget updates
Changeset:
M /trunk/Scribus/scribus/ui/newmarginwidget.cpp
M /trunk/Scribus/scribus/ui/prefs_userinterface.cpp
M /trunk/Scribus/scribus/ui/newmarginwidget.h
M /trunk/Scribus/scribus/ui/newmarginwidgetbase.ui
M /trunk/Scribus/scribus/ui/prefs_userinterfacebase.ui
Diffs:
Index: scribus/ui/newmarginwidget.h
===================================================================
--- scribus/ui/newmarginwidget.h (revision 14225)
+++ scribus/ui/newmarginwidget.h (revision 14226)
@@ -25,11 +25,33 @@
void setPageHeight(double);
void setPageSize(const QString&);
void setNewUnitIndex(int);
+ void setTop();
+ void setBottom();
+ void setLeft();
+ void setRight();
+ void setPreset();
+ const MarginStruct & margins() const;
+ void slotLinkMargins();
+ public slots:
+ void languageChange();
+
protected:
+ void updateMarginSpinValues();
+
MarginStruct marginData;
MarginStruct savedMarginData;
int savedPresetItem;
+ bool facingPages;
+ int m_unitIndex;
+ double m_unitRatio;
+ QString m_pageSize;
+ double pageWidth;
+ double pageHeight;
+ int pageType;
};
#endif // NEWMARGINWIDGET_H
+
+
+
Index: scribus/ui/newmarginwidget.cpp
===================================================================
--- scribus/ui/newmarginwidget.cpp (revision 14225)
+++ scribus/ui/newmarginwidget.cpp (revision 14226)
@@ -24,27 +24,202 @@
void NewMarginWidget::setup(const MarginStruct& margs, int unitIndex, bool showPreset)
{
- marginData=margs;
- savedMarginData=margs;
+ marginData=savedMarginData=margs;
savedPresetItem=PresetLayout::none;//we dont recheck if we are using a layout but always start at none
+ facingPages = false;
+ m_unitIndex=unitIndex;
+ m_unitRatio=unitGetRatioFromIndex(unitIndex);
+ leftMarginSpinBox->setMaximum(1000);
+ rightMarginSpinBox->setMaximum(1000);
+ topMarginSpinBox->setMaximum(1000);
+ bottomMarginSpinBox->setMaximum(1000);
}
-void NewMarginWidget::setPageWidth(double)
+void NewMarginWidget::languageChange()
{
+ leftMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the top margin guide and the edge of the page" ) + "</qt>");
+ rightMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the bottom margin guide and the edge of the page" ) + "</qt>");
+ topMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the left margin guide and the edge of the page. If a double-sided, 3 or 4-fold layout is selected, this margin space can be used to achieve the correct margins for binding") + "</qt>");
+ bottomMarginSpinBox->setToolTip( "<qt>" + tr( "Distance between the right margin guide and the edge of the page. If a double-sided, 3 or 4-fold layout is selected, this margin space can be used to achieve the correct margins for binding") + "</qt>");
}
-void NewMarginWidget::setPageHeight(double)
+void NewMarginWidget::setPageWidth(double newWidth)
{
+ leftMarginSpinBox->setMaximum(qMax(0.0, newWidth * m_unitRatio - leftMarginSpinBox->value()));
+ rightMarginSpinBox->setMaximum(qMax(0.0,newWidth * m_unitRatio - rightMarginSpinBox->value()));
+ pageWidth = newWidth;
+ setPreset();
+}
+void NewMarginWidget::setPageHeight(double newHeight)
+{
+ topMarginSpinBox->setMaximum(qMax(0.0, newHeight * m_unitRatio - bottomMarginSpinBox->value()));
+ bottomMarginSpinBox->setMaximum(qMax(0.0,newHeight * m_unitRatio - topMarginSpinBox->value()));
+ pageHeight = newHeight;
+ setPreset();
}
-void NewMarginWidget::setPageSize(const QString &newSize)
+void NewMarginWidget::setTop()
{
+ double newVal=topMarginSpinBox->value() / m_unitRatio;
+ bottomMarginSpinBox->setMaximum(qMax(0.0, pageHeight * m_unitRatio - topMarginSpinBox->value()));
+ if (marginLinkCheckBox->isChecked() && savedPresetItem==PresetLayout::none)
+ {
+ marginData.set(newVal, newVal, newVal, newVal);
+ updateMarginSpinValues();
+ }
+ else
+ marginData.Top = newVal;
+ setPreset();
+}
+void NewMarginWidget::setBottom()
+{
+ double newVal = bottomMarginSpinBox->value() / m_unitRatio;
+ topMarginSpinBox->setMaximum(qMax(0.0, pageHeight * m_unitRatio - bottomMarginSpinBox->value()));
+ if (marginLinkCheckBox->isChecked() && savedPresetItem==PresetLayout::none)
+ {
+ marginData.set(newVal, newVal, newVal, newVal);
+ updateMarginSpinValues();
+ }
+ else
+ marginData.Bottom = newVal;
+ setPreset();
}
-void NewMarginWidget::setNewUnitIndex(int newIndex)
+void NewMarginWidget::setLeft()
{
+ double newVal = leftMarginSpinBox->value() / m_unitRatio;
+ rightMarginSpinBox->setMaximum(qMax(0.0, pageWidth * m_unitRatio - leftMarginSpinBox->value()));
+ if (marginLinkCheckBox->isChecked() && savedPresetItem==PresetLayout::none)
+ {
+ marginData.set(newVal, newVal, newVal, newVal);
+ updateMarginSpinValues();
+ }
+ else
+ marginData.Left = newVal;
+ setPreset();
+}
+void NewMarginWidget::setRight()
+{
+ double newVal = rightMarginSpinBox->value() / m_unitRatio;
+ leftMarginSpinBox->setMaximum(qMax(0.0, pageWidth * m_unitRatio - rightMarginSpinBox->value()));
+ if (marginLinkCheckBox->isChecked() && savedPresetItem==PresetLayout::none)
+ {
+ marginData.set(newVal, newVal, newVal, newVal);
+ updateMarginSpinValues();
+ }
+ else
+ marginData.Right = newVal;
+ setPreset();
}
+
+void NewMarginWidget::setNewUnitIndex(int newUnitIndex)
+{
+ leftMarginSpinBox->blockSignals(true);
+ rightMarginSpinBox->blockSignals(true);
+ topMarginSpinBox->blockSignals(true);
+ bottomMarginSpinBox->blockSignals(true);
+ m_unitIndex=newUnitIndex;
+ m_unitRatio=unitGetRatioFromIndex(newUnitIndex);
+ topMarginSpinBox->setNewUnit(newUnitIndex);
+ bottomMarginSpinBox->setNewUnit(newUnitIndex);
+ leftMarginSpinBox->setNewUnit(newUnitIndex);
+ rightMarginSpinBox->setNewUnit(newUnitIndex);
+ leftMarginSpinBox->blockSignals(false);
+ rightMarginSpinBox->blockSignals(false);
+ topMarginSpinBox->blockSignals(false);
+ bottomMarginSpinBox->blockSignals(false);
+}
+
+void NewMarginWidget::setPreset()
+{
+ leftMarginSpinBox->blockSignals(true);
+ rightMarginSpinBox->blockSignals(true);
+ topMarginSpinBox->blockSignals(true);
+ bottomMarginSpinBox->blockSignals(true);
+ if (savedPresetItem==PresetLayout::none)
+ savedMarginData=marginData;
+ int item = presetLayoutComboBox->currentIndex();
+
+ MarginStruct marg = presetLayoutComboBox->getMargins(item, pageWidth, pageHeight, leftMarginSpinBox->value() / m_unitRatio);
+ facingPages ? presetLayoutComboBox->setEnabled(true) : presetLayoutComboBox->setEnabled(false);
+ bool restoringValues=false;
+ if (item==PresetLayout::none && savedPresetItem!=PresetLayout::none)
+ {
+ marg=savedMarginData;
+ restoringValues=true;
+ }
+ if (restoringValues || (presetLayoutComboBox->needUpdate() && facingPages))
+ {
+ marginData.set(qMax(0.0, marg.Top), qMax(0.0, marg.Left), qMax(0.0, marg.Bottom), qMax(0.0, marg.Right));
+ updateMarginSpinValues();
+
+ bottomMarginSpinBox->setMaximum(qMax(0.0, pageHeight * m_unitRatio - topMarginSpinBox->value()));
+ topMarginSpinBox->setMaximum(qMax(0.0, pageHeight * m_unitRatio - bottomMarginSpinBox->value()));
+ rightMarginSpinBox->setMaximum(qMax(0.0, pageWidth * m_unitRatio - leftMarginSpinBox->value()));
+ leftMarginSpinBox->setMaximum(qMax(0.0, pageWidth * m_unitRatio - rightMarginSpinBox->value()));
+ rightMarginSpinBox->setEnabled(restoringValues);
+ topMarginSpinBox->setEnabled(restoringValues);
+ bottomMarginSpinBox->setEnabled(restoringValues);
+ }
+ else
+ {
+ rightMarginSpinBox->setEnabled(true);
+ topMarginSpinBox->setEnabled(true);
+ bottomMarginSpinBox->setEnabled(true);
+ }
+ if (pageType == 1)
+ rightMarginSpinBox->setEnabled(false);
+ leftMarginSpinBox->setEnabled(item != PresetLayout::nineparts);
+ if (item!=PresetLayout::none)
+ marginLinkCheckBox->setChecked(false);
+ marginLinkCheckBox->setEnabled(item==PresetLayout::none);
+ leftMarginSpinBox->blockSignals(false);
+ rightMarginSpinBox->blockSignals(false);
+ topMarginSpinBox->blockSignals(false);
+ bottomMarginSpinBox->blockSignals(false);
+ savedPresetItem=item;
+}
+
+void NewMarginWidget::setPageSize(const QString& pageSize)
+{
+ m_pageSize=pageSize;
+}
+
+
+void NewMarginWidget::updateMarginSpinValues()
+{
+ topMarginSpinBox->setValue(marginData.Top * m_unitRatio);
+ rightMarginSpinBox->setValue(marginData.Right * m_unitRatio);
+ bottomMarginSpinBox->setValue(marginData.Bottom * m_unitRatio);
+ leftMarginSpinBox->setValue(marginData.Left * m_unitRatio);
+}
+
+const MarginStruct & NewMarginWidget::margins() const
+{
+ return marginData;
+}
+
+void NewMarginWidget::slotLinkMargins()
+{
+ leftMarginSpinBox->blockSignals(true);
+ rightMarginSpinBox->blockSignals(true);
+ topMarginSpinBox->blockSignals(true);
+ bottomMarginSpinBox->blockSignals(true);
+
+ if (marginLinkCheckBox->isChecked())
+ {
+ bottomMarginSpinBox->setValue(leftMarginSpinBox->value());
+ topMarginSpinBox->setValue(leftMarginSpinBox->value());
+ rightMarginSpinBox->setValue(leftMarginSpinBox->value());
+ double newVal=leftMarginSpinBox->value() / m_unitRatio;
+ marginData.set(newVal, newVal, newVal, newVal);
+ }
+ leftMarginSpinBox->blockSignals(false);
+ rightMarginSpinBox->blockSignals(false);
+ topMarginSpinBox->blockSignals(false);
+ bottomMarginSpinBox->blockSignals(false);
+}
Index: scribus/ui/prefs_userinterface.cpp
===================================================================
--- scribus/ui/prefs_userinterface.cpp (revision 14225)
+++ scribus/ui/prefs_userinterface.cpp (revision 14226)
@@ -40,18 +40,6 @@
void Prefs_UserInterface::languageChange()
{
- /*
- languageComboBox
- themeComboBox
- useSmallWidgetsCheckBox
- recentDocumentsSpinBox
- fontSizeMenuSpinBox
- fontSizePaletteSpinBox
- resizeMoveDelaySpinBox
- wheelJumpSpinBox
- showSplashCheckBox
- showStartupDialogCheckBox
- */
languageComboBox->setToolTip( "<qt>" + tr( "Select your default language for Scribus to run with. Leave this blank to choose based on environment variables. You can still override this by passing a command line option when starting Scribus" )+"</qt>");
themeComboBox->setToolTip( "<qt>" + tr( "Choose the default window decoration and looks. Scribus inherits any available KDE or Qt themes, if Qt is configured to search KDE plugins." ) + "</qt>");
useSmallWidgetsCheckBox->setToolTip( "<qt>" + tr( "Palette windows will use smaller (space savy) widgets. Requires application restart" ) + "</qt>");
@@ -76,6 +64,7 @@
resizeMoveDelaySpinBox->setValue(prefsData->uiPrefs.mouseMoveTimeout);
recentDocumentsSpinBox->setValue( prefsData->uiPrefs.recentDocCount );
showStartupDialogCheckBox->setChecked(prefsData->uiPrefs.showStartupDialog);
+ useTabsForDocumentsCheckBox->setChecked(prefsData->uiPrefs.useTabs);
showSplashCheckBox->setChecked(prefsData->uiPrefs.showSplashOnStartup);
useSmallWidgetsCheckBox->setChecked(prefsData->uiPrefs.useSmallWidgets);
}
@@ -90,6 +79,7 @@
prefsData->uiPrefs.mouseMoveTimeout=resizeMoveDelaySpinBox->value();
prefsData->uiPrefs.recentDocCount=recentDocumentsSpinBox->value();
prefsData->uiPrefs.showStartupDialog=showStartupDialogCheckBox->isChecked();
+ prefsData->uiPrefs.useTabs=useTabsForDocumentsCheckBox->isChecked();
prefsData->uiPrefs.showSplashOnStartup=showSplashCheckBox->isChecked();
prefsData->uiPrefs.useSmallWidgets=useSmallWidgetsCheckBox->isChecked();
}
Index: scribus/ui/newmarginwidgetbase.ui
===================================================================
--- scribus/ui/newmarginwidgetbase.ui (revision 14225)
+++ scribus/ui/newmarginwidgetbase.ui (revision 14226)
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>266</width>
+ <width>270</width>
<height>258</height>
</rect>
</property>
@@ -30,7 +30,7 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="QComboBox" name="comboBox">
+ <widget class="PresetLayout" name="presetLayoutComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -47,7 +47,7 @@
</widget>
</item>
<item row="2" column="1">
- <widget class="ScrSpinBox" name="spinBox">
+ <widget class="ScrSpinBox" name="leftMarginSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -64,7 +64,7 @@
</widget>
</item>
<item row="3" column="1">
- <widget class="ScrSpinBox" name="spinBox_2">
+ <widget class="ScrSpinBox" name="rightMarginSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -81,7 +81,7 @@
</widget>
</item>
<item row="4" column="1">
- <widget class="ScrSpinBox" name="spinBox_3">
+ <widget class="ScrSpinBox" name="topMarginSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -98,7 +98,7 @@
</widget>
</item>
<item row="5" column="1">
- <widget class="ScrSpinBox" name="spinBox_4">
+ <widget class="ScrSpinBox" name="bottomMarginSpinBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -131,6 +131,11 @@
<extends>QSpinBox</extends>
<header location="global">ui/scrspinbox.h</header>
</customwidget>
+ <customwidget>
+ <class>PresetLayout</class>
+ <extends>QComboBox</extends>
+ <header location="global">ui/marginpresetlayout.h</header>
+ </customwidget>
</customwidgets>
<resources/>
<connections/>
Index: scribus/ui/prefs_userinterfacebase.ui
===================================================================
--- scribus/ui/prefs_userinterfacebase.ui (revision 14225)
+++ scribus/ui/prefs_userinterfacebase.ui (revision 14226)
@@ -136,6 +136,30 @@
</layout>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="useTabsForDocumentsCheckBox">
+ <property name="text">
+ <string>Use Tabs for Documents</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="recentDocumentsLabel">
More information about the scribus-commit
mailing list