r14229 by cbradney - Doc setup prefs pane now working, along with new margin widget
scribus-commit
scribus-commit at lists.scribus.net
Mon Oct 26 01:20:35 CET 2009
Revision: 14229
Author: cbradney
Date: 2009-10-25T20:41:21.178069Z
Commit message: Doc setup prefs pane now working, along with new margin widget
Changeset:
M /trunk/Scribus/scribus/ui/newmarginwidget.cpp
M /trunk/Scribus/scribus/scribus.cpp
M /trunk/Scribus/scribus/ui/prefs_documentsetup.cpp
M /trunk/Scribus/scribus/CMakeLists.txt
M /trunk/Scribus/scribus/ui/newmarginwidget.h
M /trunk/Scribus/scribus/ui/newmarginwidgetbase.ui
M /trunk/Scribus/scribus/ui/prefs_documentsetupbase.ui
Diffs:
Index: scribus/ui/newmarginwidget.h
===================================================================
--- scribus/ui/newmarginwidget.h (revision 14228)
+++ scribus/ui/newmarginwidget.h (revision 14229)
@@ -20,21 +20,32 @@
NewMarginWidget(QWidget* parent=0);
~NewMarginWidget();
- void setup(const MarginStruct& margs, int unitIndex=0, bool showPreset=true);
+ void setup(const MarginStruct& margs, int layoutType, int unitIndex=0, bool showPreset=true, bool showPrinterMargins=true);
+ /*! \brief Setup the labels by facing pages option */
+ void setFacingPages(bool facing, int pagetype = 0);
+ /*! \brief Setup the spinboxes properties (min/max value etc.) by width */
void setPageWidth(double);
+ /*! \brief Setup the spinboxes properties (min/max value etc.) by height */
void setPageHeight(double);
+ /*! \brief Set the page size for margin getting from cups */
void setPageSize(const QString&);
void setNewUnitIndex(int);
+
+ /*! \brief Setup the presetCombo without changing the margin values, only used by tabdocument */
+ void setMarginPreset(int p);
+ const MarginStruct & margins() const;
+
+ public slots:
+ void languageChange();
void setTop();
void setBottom();
void setLeft();
void setRight();
+ void slotLinkMargins();
void setPreset();
- const MarginStruct & margins() const;
- void slotLinkMargins();
- public slots:
- void languageChange();
+ protected slots:
+ void setMarginsToPrinterMargins();
protected:
void updateMarginSpinValues();
@@ -49,6 +60,8 @@
double pageWidth;
double pageHeight;
int pageType;
+ bool usingPreset;
+ bool usingPrinterMargins;
};
#endif // NEWMARGINWIDGET_H
Index: scribus/ui/newmarginwidget.cpp
===================================================================
--- scribus/ui/newmarginwidget.cpp (revision 14228)
+++ scribus/ui/newmarginwidget.cpp (revision 14229)
@@ -12,7 +12,10 @@
#include "ui/useprintermarginsdialog.h"
NewMarginWidget::NewMarginWidget(QWidget* parent)
- : QWidget(parent)
+ : QWidget(parent),
+ savedPresetItem(PresetLayout::none),
+ facingPages(false),
+ usingPreset(true)
{
setupUi(this);
@@ -22,17 +25,42 @@
{
}
-void NewMarginWidget::setup(const MarginStruct& margs, int unitIndex, bool showPreset)
+void NewMarginWidget::setup(const MarginStruct& margs, int layoutType, int unitIndex, bool showPreset, bool showPrinterMargins)
{
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);
+ leftMarginSpinBox->init(unitIndex);
+ rightMarginSpinBox->init(unitIndex);
+ topMarginSpinBox->init(unitIndex);
+ bottomMarginSpinBox->init(unitIndex);
+ updateMarginSpinValues();
+ usingPreset=showPreset;
+ if (!showPreset)
+ {
+ presetLayoutComboBox->blockSignals(true);
+ presetLayoutComboBox->hide();
+ presetLayoutLabel->hide();
+ }
+ if (!showPrinterMargins)
+ {
+ printerMarginsPushButton->blockSignals(true);
+ printerMarginsPushButton->hide();
+ }
+
+ setFacingPages(!(layoutType == singlePage));
+
+ connect(topMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setTop()));
+ connect(bottomMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setBottom()));
+ connect(leftMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setLeft()));
+ connect(rightMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setRight()));
+ connect(presetLayoutComboBox, SIGNAL(activated(int)), this, SLOT(setPreset()));
+ connect(marginLinkCheckBox, SIGNAL(clicked()), this, SLOT(slotLinkMargins()));
+ connect(printerMarginsPushButton, SIGNAL(clicked()), this, SLOT(setMarginsToPrinterMargins()));
}
void NewMarginWidget::languageChange()
@@ -41,7 +69,6 @@
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::setPageWidth(double newWidth)
@@ -136,6 +163,8 @@
void NewMarginWidget::setPreset()
{
+ if (!usingPreset)
+ return;
leftMarginSpinBox->blockSignals(true);
rightMarginSpinBox->blockSignals(true);
topMarginSpinBox->blockSignals(true);
@@ -192,10 +221,18 @@
void NewMarginWidget::updateMarginSpinValues()
{
+ leftMarginSpinBox->blockSignals(true);
+ rightMarginSpinBox->blockSignals(true);
+ topMarginSpinBox->blockSignals(true);
+ bottomMarginSpinBox->blockSignals(true);
topMarginSpinBox->setValue(marginData.Top * m_unitRatio);
rightMarginSpinBox->setValue(marginData.Right * m_unitRatio);
bottomMarginSpinBox->setValue(marginData.Bottom * m_unitRatio);
leftMarginSpinBox->setValue(marginData.Left * m_unitRatio);
+ leftMarginSpinBox->blockSignals(false);
+ rightMarginSpinBox->blockSignals(false);
+ topMarginSpinBox->blockSignals(false);
+ bottomMarginSpinBox->blockSignals(false);
}
const MarginStruct & NewMarginWidget::margins() const
@@ -209,7 +246,6 @@
rightMarginSpinBox->blockSignals(true);
topMarginSpinBox->blockSignals(true);
bottomMarginSpinBox->blockSignals(true);
-
if (marginLinkCheckBox->isChecked())
{
bottomMarginSpinBox->setValue(leftMarginSpinBox->value());
@@ -223,3 +259,73 @@
topMarginSpinBox->blockSignals(false);
bottomMarginSpinBox->blockSignals(false);
}
+
+void NewMarginWidget::setMarginPreset(int p)
+{
+ if (!usingPreset)
+ return;
+ presetLayoutComboBox->blockSignals(true);
+ savedPresetItem = p;
+ presetLayoutComboBox->setCurrentIndex(p);
+ if (savedPresetItem==PresetLayout::none)
+ savedMarginData=marginData;
+ int item = presetLayoutComboBox->currentIndex();
+ facingPages ? presetLayoutComboBox->setEnabled(true) : presetLayoutComboBox->setEnabled(false);
+ bool restoringValues=false;
+ if (item==PresetLayout::none && savedPresetItem!=PresetLayout::none)
+ {
+ restoringValues=true;
+ }
+ if (restoringValues || (presetLayoutComboBox->needUpdate() && facingPages))
+ {
+ 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);
+ presetLayoutComboBox->blockSignals(false);
+}
+
+void NewMarginWidget::setFacingPages(bool facing, int pagetype)
+{
+ facingPages = facing;
+ pageType = pagetype;
+ leftMarginLabel->setText(facing == true ? tr( "&Inside:" ) : tr( "&Left:" ));
+ rightMarginLabel->setText(facing == true ? tr( "O&utside:" ) : tr( "&Right:" ));
+ setPreset();
+}
+
+void NewMarginWidget::setMarginsToPrinterMargins()
+{
+ UsePrinterMarginsDialog upm(parentWidget(), m_pageSize, unitGetRatioFromIndex(m_unitIndex), unitGetSuffixFromIndex(m_unitIndex));
+ if (upm.exec())
+ {
+ double t,b,l,r;
+ upm.getNewPrinterMargins(t,b,l,r);
+ presetLayoutComboBox->setCurrentIndex(PresetLayout::none);
+ marginData.set(t,l,b,r);
+
+ updateMarginSpinValues();
+
+ bottomMarginSpinBox->setMaximum((qMax(0.0, pageHeight - t) * m_unitRatio));
+ topMarginSpinBox->setMaximum((qMax(0.0, pageHeight - b) * m_unitRatio));
+ rightMarginSpinBox->setMaximum((qMax(0.0, pageWidth - l) * m_unitRatio));
+ leftMarginSpinBox->setMaximum((qMax(0.0, pageWidth - r) * m_unitRatio));
+
+ rightMarginSpinBox->setEnabled(true);
+ topMarginSpinBox->setEnabled(true);
+ bottomMarginSpinBox->setEnabled(true);
+ }
+}
+
Index: scribus/ui/prefs_documentsetup.cpp
===================================================================
--- scribus/ui/prefs_documentsetup.cpp (revision 14228)
+++ scribus/ui/prefs_documentsetup.cpp (revision 14229)
@@ -18,10 +18,17 @@
: Prefs_Pane(parent)
{
setupUi(this);
+
+ applySizesToAllPagesCheckBox->hide();
+ applySizesToAllMasterPagesCheckBox->hide();
+ applyMarginsToAllPagesCheckBox->hide();
+ applyMarginsToAllMasterPagesCheckBox->hide();
+
pageWidthSpinBox->setMaximum(16777215);
pageHeightSpinBox->setMaximum(16777215);
languageChange();
+
pageLayoutButtonGroup->setId(singlePageRadioButton,0);
pageLayoutButtonGroup->setId(doublePageRadioButton,1);
pageLayoutButtonGroup->setId(threeFoldRadioButton,2);
@@ -53,6 +60,9 @@
marginsWidget->setNewUnitIndex(docUnitIndex);
marginsWidget->setPageHeight(pageH);
marginsWidget->setPageWidth(pageW);
+ bleedsWidget->setNewUnitIndex(docUnitIndex);
+ bleedsWidget->setPageHeight(pageH);
+ bleedsWidget->setPageWidth(pageW);
pageWidthSpinBox->blockSignals(false);
pageHeightSpinBox->blockSignals(false);
@@ -126,12 +136,17 @@
pageOrientationComboBox->blockSignals(false);
pageSizeComboBox->blockSignals(false);
+ marginsWidget->setup(prefsData->docSetupPrefs.margins, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, true, true);
+ marginsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
+ marginsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
+ marginsWidget->setPageSize(prefsPageSizeName);
+ marginsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
+ bleedsWidget->setup(prefsData->docSetupPrefs.bleeds, prefsData->docSetupPrefs.pagePositioning, prefsData->docSetupPrefs.docUnitIndex, false, false);
+ bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
+ bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
+ bleedsWidget->setPageSize(prefsPageSizeName);
+ bleedsWidget->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
/*
- marginGroup->setNewMargins(prefsData->docSetupPrefs.margins);
- marginGroup->setPageWidthHeight(prefsData->docSetupPrefs.pageWidth, prefsData->docSetupPrefs.pageHeight);
- marginGroup->setPageSize(prefsPageSizeName);
- marginGroup->setNewBleeds(prefsData->docSetupPrefs.bleeds);
- marginGroup->setMarginPreset(prefsData->docSetupPrefs.marginPreset);
GroupAS->setChecked( prefsData->docSetupPrefs.AutoSave );
ASTime->setValue(prefsData->docSetupPrefs.AutoSaveTime / 1000 / 60);
*/
@@ -146,6 +161,8 @@
prefsData->docSetupPrefs.pageHeight=pageH;
prefsData->docSetupPrefs.pagePositioning=pageLayoutButtonGroup->checkedId();
prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage=layoutFirstPageIsComboBox->currentIndex();
+ prefsData->docSetupPrefs.margins=marginsWidget->margins();
+ prefsData->docSetupPrefs.bleeds=bleedsWidget->margins();
}
void Prefs_DocumentSetup::setupPageSets()
@@ -159,9 +176,10 @@
layoutFirstPageIsComboBox->setCurrentIndex(i<0?0:i);
}
-void Prefs_DocumentSetup::pageLayoutChanged(int /*i*/)
+void Prefs_DocumentSetup::pageLayoutChanged(int i)
{
setupPageSets();
+ marginsWidget->setFacingPages(!(i == singlePage));
layoutFirstPageIsComboBox->setCurrentIndex(pageSets[pageLayoutButtonGroup->checkedId()].FirstPage);
}
Index: scribus/ui/newmarginwidgetbase.ui
===================================================================
--- scribus/ui/newmarginwidgetbase.ui (revision 14228)
+++ scribus/ui/newmarginwidgetbase.ui (revision 14229)
@@ -23,7 +23,7 @@
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
- <widget class="QLabel" name="label_5">
+ <widget class="QLabel" name="presetLayoutLabel">
<property name="text">
<string>Preset Layouts:</string>
</property>
@@ -40,10 +40,13 @@
</widget>
</item>
<item row="2" column="0">
- <widget class="QLabel" name="label">
+ <widget class="QLabel" name="leftMarginLabel">
<property name="text">
<string>Left:</string>
</property>
+ <property name="buddy">
+ <cstring>leftMarginSpinBox</cstring>
+ </property>
</widget>
</item>
<item row="2" column="1">
@@ -57,10 +60,13 @@
</widget>
</item>
<item row="3" column="0">
- <widget class="QLabel" name="label_2">
+ <widget class="QLabel" name="rightMarginLabel">
<property name="text">
<string>Right:</string>
</property>
+ <property name="buddy">
+ <cstring>rightMarginSpinBox</cstring>
+ </property>
</widget>
</item>
<item row="3" column="1">
@@ -74,10 +80,13 @@
</widget>
</item>
<item row="4" column="0">
- <widget class="QLabel" name="label_3">
+ <widget class="QLabel" name="topMarginLabel">
<property name="text">
<string>Top:</string>
</property>
+ <property name="buddy">
+ <cstring>topMarginSpinBox</cstring>
+ </property>
</widget>
</item>
<item row="4" column="1">
@@ -91,10 +100,13 @@
</widget>
</item>
<item row="5" column="0">
- <widget class="QLabel" name="label_4">
+ <widget class="QLabel" name="bottomMarginLabel">
<property name="text">
<string>Bottom:</string>
</property>
+ <property name="buddy">
+ <cstring>bottomMarginSpinBox</cstring>
+ </property>
</widget>
</item>
<item row="5" column="1">
Index: scribus/ui/prefs_documentsetupbase.ui
===================================================================
--- scribus/ui/prefs_documentsetupbase.ui (revision 14228)
+++ scribus/ui/prefs_documentsetupbase.ui (revision 14229)
@@ -46,7 +46,7 @@
<x>0</x>
<y>0</y>
<width>686</width>
- <height>713</height>
+ <height>776</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@@ -158,6 +158,20 @@
</layout>
</item>
<item>
+ <widget class="QCheckBox" name="applySizesToAllPagesCheckBox">
+ <property name="text">
+ <string>Apply changes to all pages</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="applySizesToAllMasterPagesCheckBox">
+ <property name="text">
+ <string>Apply changes to all master pages</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -195,63 +209,83 @@
</widget>
</item>
<item>
- <layout class="QFormLayout" name="formLayout_2">
- <item row="0" column="0" colspan="2">
- <widget class="QRadioButton" name="singlePageRadioButton">
- <property name="text">
- <string>Single Page</string>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QFormLayout" name="formLayout_2">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetDefaultConstraint</enum>
</property>
- <property name="checked">
- <bool>true</bool>
- </property>
- <attribute name="buttonGroup">
- <string>pageLayoutButtonGroup</string>
- </attribute>
- </widget>
+ <item row="0" column="1">
+ <widget class="QRadioButton" name="singlePageRadioButton">
+ <property name="text">
+ <string>Single Page</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string>pageLayoutButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QRadioButton" name="doublePageRadioButton">
+ <property name="text">
+ <string>Double Page</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>pageLayoutButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QRadioButton" name="threeFoldRadioButton">
+ <property name="text">
+ <string>3-Fold</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>pageLayoutButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QRadioButton" name="fourFoldRadioButton">
+ <property name="text">
+ <string>4-Fold</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string>pageLayoutButtonGroup</string>
+ </attribute>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="layoutFirstPageIsLabel">
+ <property name="text">
+ <string>First Page is:</string>
+ </property>
+ <property name="buddy">
+ <cstring>layoutFirstPageIsComboBox</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QComboBox" name="layoutFirstPageIsComboBox"/>
+ </item>
+ </layout>
</item>
- <item row="1" column="0" colspan="2">
- <widget class="QRadioButton" name="doublePageRadioButton">
- <property name="text">
- <string>Double Page</string>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
</property>
- <attribute name="buttonGroup">
- <string>pageLayoutButtonGroup</string>
- </attribute>
- </widget>
- </item>
- <item row="2" column="0" colspan="2">
- <widget class="QRadioButton" name="threeFoldRadioButton">
- <property name="text">
- <string>3-Fold</string>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
</property>
- <attribute name="buttonGroup">
- <string>pageLayoutButtonGroup</string>
- </attribute>
- </widget>
+ </spacer>
</item>
- <item row="3" column="0" colspan="2">
- <widget class="QRadioButton" name="fourFoldRadioButton">
- <property name="text">
- <string>4-Fold</string>
- </property>
- <attribute name="buttonGroup">
- <string>pageLayoutButtonGroup</string>
- </attribute>
- </widget>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="layoutFirstPageIsLabel">
- <property name="text">
- <string>First Page is:</string>
- </property>
- <property name="buddy">
- <cstring>layoutFirstPageIsComboBox</cstring>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <widget class="QComboBox" name="layoutFirstPageIsComboBox"/>
- </item>
</layout>
</item>
<item>
@@ -319,7 +353,7 @@
</widget>
</item>
<item>
- <widget class="QCheckBox" name="appleMarginsToAllMasterPagesCheckBox">
+ <widget class="QCheckBox" name="applyMarginsToAllMasterPagesCheckBox">
<property name="text">
<string>Apply changes to all master pages</string>
</property>
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp (revision 14228)
+++ scribus/scribus.cpp (revision 14229)
@@ -7677,6 +7677,10 @@
qApp->setFont(apf);
}
propertiesPalette->Fonts->RebuildList(0);
+ if (prefsManager->appPrefs.uiPrefs.useTabs)
+ mdiArea->setViewMode(QMdiArea::TabbedView);
+ else
+ mdiArea->setViewMode(QMdiArea::SubWindowView);
}
}
Index: scribus/CMakeLists.txt
===================================================================
--- scribus/CMakeLists.txt (revision 14228)
+++ scribus/CMakeLists.txt (revision 14229)
@@ -236,10 +236,10 @@
ui/layers.h
loadsaveplugin.h
ui/loremipsum.h
+ ui/margindialog.h
ui/marginpresetlayout.h
ui/marginwidget.h
ui/newmarginwidget.h
- ui/margindialog.h
ui/masterpagepalette.h
ui/measurements.h
menumanager.h
@@ -537,10 +537,10 @@
ui/linkbutton.cpp
loadsaveplugin.cpp
ui/loremipsum.cpp
+ ui/margindialog.cpp
ui/marginpresetlayout.cpp
ui/marginwidget.cpp
ui/newmarginwidget.cpp
- ui/margindialog.cpp
ui/masterpagepalette.cpp
ui/measurements.cpp
menumanager.cpp
More information about the scribus-commit
mailing list