Index: Scribus.pro =================================================================== --- Scribus.pro (Revision 26196) +++ Scribus.pro (Arbeitskopie) @@ -481,8 +481,7 @@ scribus/ui/linecombo.h \ scribus/ui/linkbutton.h \ scribus/ui/loremipsum.h \ - scribus/ui/marginpresetlayout.h \ - scribus/ui/marginwidget.h \ + scribus/ui/marginpresetlayout.h \ scribus/ui/mark2item.h \ scribus/ui/mark2mark.h \ scribus/ui/markanchor.h \ @@ -1083,6 +1082,7 @@ scribus/ui/measurementsbase.ui \ scribus/ui/multipleduplicate.ui \ scribus/ui/multiprogressdialog.ui \ + scribus/ui/newdocdialog.ui \ scribus/ui/newmarginwidgetbase.ui \ scribus/ui/nftdialog.ui \ scribus/ui/nftwidget.ui \ @@ -1627,8 +1627,7 @@ scribus/ui/linecombo.cpp \ scribus/ui/linkbutton.cpp \ scribus/ui/loremipsum.cpp \ - scribus/ui/marginpresetlayout.cpp \ - scribus/ui/marginwidget.cpp \ + scribus/ui/marginpresetlayout.cpp \ scribus/ui/mark2item.cpp \ scribus/ui/mark2mark.cpp \ scribus/ui/markanchor.cpp \ Index: resources/iconsets/1_7_0/16/action-minimize.svg =================================================================== --- resources/iconsets/1_7_0/16/action-minimize.svg (nicht existent) +++ resources/iconsets/1_7_0/16/action-minimize.svg (Arbeitskopie) @@ -0,0 +1,3 @@ + + + Index: resources/iconsets/1_7_0/16/action-pin.svg =================================================================== --- resources/iconsets/1_7_0/16/action-pin.svg (nicht existent) +++ resources/iconsets/1_7_0/16/action-pin.svg (Arbeitskopie) @@ -0,0 +1,3 @@ + + + Index: resources/iconsets/1_7_0/16/border-bottom.svg =================================================================== --- resources/iconsets/1_7_0/16/border-bottom.svg (nicht existent) +++ resources/iconsets/1_7_0/16/border-bottom.svg (Arbeitskopie) @@ -0,0 +1,4 @@ + + + + Index: resources/iconsets/1_7_0/16/border-inside.svg =================================================================== --- resources/iconsets/1_7_0/16/border-inside.svg (nicht existent) +++ resources/iconsets/1_7_0/16/border-inside.svg (Arbeitskopie) @@ -0,0 +1,5 @@ + + + + + Index: resources/iconsets/1_7_0/16/border-left.svg =================================================================== --- resources/iconsets/1_7_0/16/border-left.svg (nicht existent) +++ resources/iconsets/1_7_0/16/border-left.svg (Arbeitskopie) @@ -0,0 +1,4 @@ + + + + Index: resources/iconsets/1_7_0/16/border-outside.svg =================================================================== --- resources/iconsets/1_7_0/16/border-outside.svg (nicht existent) +++ resources/iconsets/1_7_0/16/border-outside.svg (Arbeitskopie) @@ -0,0 +1,6 @@ + + + + + + Index: resources/iconsets/1_7_0/16/border-right.svg =================================================================== --- resources/iconsets/1_7_0/16/border-right.svg (nicht existent) +++ resources/iconsets/1_7_0/16/border-right.svg (Arbeitskopie) @@ -0,0 +1,4 @@ + + + + Index: resources/iconsets/1_7_0/16/border-top.svg =================================================================== --- resources/iconsets/1_7_0/16/border-top.svg (nicht existent) +++ resources/iconsets/1_7_0/16/border-top.svg (Arbeitskopie) @@ -0,0 +1,4 @@ + + + + Index: resources/iconsets/1_7_0/1_7_0.xml =================================================================== --- resources/iconsets/1_7_0/1_7_0.xml (Revision 26196) +++ resources/iconsets/1_7_0/1_7_0.xml (Arbeitskopie) @@ -385,6 +385,12 @@ + + + + + + Index: scribus/CMakeLists_Sources.txt =================================================================== --- scribus/CMakeLists_Sources.txt (Revision 26196) +++ scribus/CMakeLists_Sources.txt (Arbeitskopie) @@ -362,7 +362,6 @@ ui/marksmanager.cpp ui/markvariabletext.cpp ui/marginpresetlayout.cpp - ui/marginwidget.cpp ui/newmarginwidget.cpp ui/mergedoc.cpp ui/missing.cpp @@ -559,6 +558,7 @@ ui/widgets/floatingwindow.cpp ui/widgets/form_widget.cpp ui/widgets/gradientlistbox.cpp + ui/widgets/pagelayoutswidget.cpp ui/widgets/popup_menu.cpp ui/widgets/section_container.cpp ui/widgets/stacked_container.cpp Index: scribus/scribus.cpp =================================================================== --- scribus/scribus.cpp (Revision 26196) +++ scribus/scribus.cpp (Arbeitskopie) @@ -183,7 +183,6 @@ #include "ui/javadocs.h" #include "ui/layers.h" #include "ui/loremipsum.h" -#include "ui/marginwidget.h" #include "ui/mark2item.h" #include "ui/mark2mark.h" #include "ui/markanchor.h" @@ -2016,10 +2015,10 @@ int facingPages = dia->choosenLayout(); int firstPage = dia->firstPage->currentIndex(); docSet = dia->startDocSetup->isChecked(); - double topMargin = dia->marginGroup->top(); - double bottomMargin = dia->marginGroup->bottom(); - double leftMargin = dia->marginGroup->left(); - double rightMargin = dia->marginGroup->right(); + double topMargin = dia->marginGroup->margins().top(); + double bottomMargin = dia->marginGroup->margins().bottom(); + double leftMargin = dia->marginGroup->margins().left(); + double rightMargin = dia->marginGroup->margins().right(); double columnDistance = dia->distance(); double pageWidth = dia->pageWidth(); double pageHeight = dia->pageHeight(); @@ -2035,7 +2034,7 @@ PageSize ps2(dia->pageSizeComboBox->currentText()); pagesize = ps2.name(); } - doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->getMarginPreset()); + doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset()); doc->setPageSetFirstPage(facingPages, firstPage); doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight()); HaveNewDoc(); @@ -2099,10 +2098,10 @@ int facingPages = dia->choosenLayout(); int firstPage = dia->firstPage->currentIndex(); bool docSet = dia->startDocSetup->isChecked(); - double topMargin = dia->marginGroup->top(); - double bottomMargin = dia->marginGroup->bottom(); - double leftMargin = dia->marginGroup->left(); - double rightMargin = dia->marginGroup->right(); + double topMargin = dia->marginGroup->margins().top(); + double bottomMargin = dia->marginGroup->margins().bottom(); + double leftMargin = dia->marginGroup->margins().left(); + double rightMargin = dia->marginGroup->margins().right(); double columnDistance = dia->distance(); double pageWidth = dia->pageWidth(); double pageHeight = dia->pageHeight(); @@ -2118,7 +2117,7 @@ PageSize ps2(dia->pageSizeComboBox->currentText()); pagesize = ps2.name(); } - if (doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->getMarginPreset())) + if (doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset())) { doc->setPageSetFirstPage(facingPages, firstPage); doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight()); Index: scribus/ui/marginwidget.cpp =================================================================== --- scribus/ui/marginwidget.cpp (Revision 26196) +++ scribus/ui/marginwidget.cpp (nicht existent) @@ -1,623 +0,0 @@ -/* -For general Scribus (>=1.3.2) copyright and licensing information please refer -to the COPYING file provided with the program. Following this notice may exist -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 "marginwidget.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "scrspinbox.h" -#include "units.h" -#include "ui/useprintermarginsdialog.h" - - -MarginWidget::MarginWidget( QWidget* parent, const QString& /*title*/, const MarginStruct* margs, int unitIndex, bool showChangeAll, bool showBleeds) : QTabWidget(parent), - m_useBleeds(showBleeds) -{ - marginData = *margs; - m_savedMargins = *margs; - m_savedPresetItem = PresetLayout::none; //we don't recheck if we are using a layout but always start at none - marginPage = new QWidget(this); - - presetCombo = new PresetLayout(marginPage); - presetLabel = new QLabel( tr("Preset Layouts:"), marginPage); - presetLabel->setBuddy(presetCombo); - m_unitIndex = unitIndex; - m_unitRatio = unitGetRatioFromIndex(unitIndex); - leftR = new ScrSpinBox( 0, 1000, marginPage, unitIndex ); - rightR = new ScrSpinBox( 0, 1000, marginPage, unitIndex ); - topR = new ScrSpinBox( 0, 1000, marginPage, unitIndex ); - bottomR = new ScrSpinBox( 0, 1000, marginPage, unitIndex ); - updateMarginSpinValues(); - - bText = new QLabel( tr( "&Bottom:" ), marginPage); - bText->setBuddy(bottomR); - tText = new QLabel( tr( "&Top:" ), marginPage); - tText->setBuddy(topR); - rText = new QLabel( tr( "&Right:" ), marginPage); - rText->setBuddy(rightR); - lText = new QLabel( tr( "&Left:" ), marginPage); - lText->setBuddy(leftR); - - linkMargins = new LinkButton( marginPage ); - linkMargins->setCheckable( true ); - linkMargins->setChecked(false); - linkMargins->setAutoRaise( true ); - linkMargins->setMinimumSize( QSize( 15, 0 ) ); - linkMargins->setMaximumSize( QSize( 15, 32767 ) ); - - // layout - GroupLayout = new QGridLayout( marginPage ); - GroupLayout->setSpacing(6); - GroupLayout->setContentsMargins(9, 9, 9, 9); - GroupLayout->addWidget(presetLabel, 0, 0); - GroupLayout->addWidget(presetCombo, 0, 1); - GroupLayout->addWidget( leftR, 1, 1 ); - GroupLayout->addWidget( rightR, 2, 1 ); - GroupLayout->addWidget( topR, 3, 1 ); - GroupLayout->addWidget( bottomR, 4, 1 ); - GroupLayout->addWidget( lText, 1, 0 ); - GroupLayout->addWidget( rText, 2, 0 ); - GroupLayout->addWidget( tText, 3, 0 ); - GroupLayout->addWidget( bText, 4, 0 ); - GroupLayout->addWidget( linkMargins, 1, 2, 4, 1 ); - if (showChangeAll) - { - marginsForPagesLayout = new QHBoxLayout; - marginsForPagesLayout->setContentsMargins(9, 9, 9, 9); - marginsForPagesLayout->setSpacing(6); - marginsForPages = new QLabel( tr( "Apply settings to:" ), marginPage ); - marginsForPagesLayout->addWidget(marginsForPages); - marginsForAllPages = new QCheckBox( marginPage ); - marginsForAllPages->setText( tr( "All Document Pages" ) ); - marginsForAllPages->setChecked( false ); - marginsForPagesLayout->addWidget(marginsForAllPages); - marginsForAllMasterPages = new QCheckBox( marginPage ); - marginsForAllMasterPages->setText( tr( "All Master Pages" ) ); - marginsForAllMasterPages->setChecked( false ); - marginsForPagesLayout->addWidget(marginsForAllMasterPages); - GroupLayout->addLayout( marginsForPagesLayout, 6, 0, 1, 2 ); - marginsForAllPages->setToolTip( "" + tr( "Apply the margin changes to all existing pages in the document" ) + "" ); - marginsForAllMasterPages->setToolTip( "" + tr( "Apply the margin changes to all existing master pages in the document" ) + "" ); - } - - usePrinterMarginsButton = nullptr; - usePrinterMarginsButton = new QPushButton( tr("Printer Margins..."),marginPage ); - GroupLayout->addWidget( usePrinterMarginsButton, 5, 1 ); - usePrinterMarginsButton->setToolTip( "" + tr( "Import the margins for the selected page size from the available printers" ) + ""); - connect(usePrinterMarginsButton, SIGNAL(clicked()), this, SLOT(setMarginsToPrinterMargins())); - - addTab(marginPage, tr("Margin Guides")); - - if (m_useBleeds) - { - bleedPage = new QWidget(this); - BleedGroupLayout = new QGridLayout( bleedPage ); - BleedGroupLayout->setSpacing(6); - BleedGroupLayout->setContentsMargins(9, 9, 9, 9); - BleedGroupLayout->setAlignment( Qt::AlignTop ); - BleedTxt3 = new QLabel( bleedPage ); - BleedGroupLayout->addWidget( BleedTxt3, 0, 0 ); - BleedLeft = new ScrSpinBox( 0, 3000*m_unitRatio, bleedPage, unitIndex ); - BleedGroupLayout->addWidget( BleedLeft, 0, 1 ); - BleedTxt4 = new QLabel( bleedPage ); - BleedGroupLayout->addWidget( BleedTxt4, 1, 0 ); - BleedRight = new ScrSpinBox( 0, 3000*m_unitRatio, bleedPage, unitIndex ); - BleedGroupLayout->addWidget( BleedRight, 1, 1 ); - BleedTxt1 = new QLabel( bleedPage ); - BleedTxt1->setText( tr( "Top:" ) ); - BleedGroupLayout->addWidget( BleedTxt1, 2, 0 ); - BleedTop = new ScrSpinBox( 0, 3000*m_unitRatio, bleedPage, unitIndex ); - BleedGroupLayout->addWidget( BleedTop, 2, 1 ); - BleedTxt2 = new QLabel( bleedPage ); - BleedTxt2->setText( tr( "Bottom:" ) ); - BleedGroupLayout->addWidget( BleedTxt2, 3, 0 ); - BleedBottom = new ScrSpinBox( 0, 3000*m_unitRatio, bleedPage, unitIndex ); - BleedGroupLayout->addWidget( BleedBottom, 3, 1 ); - linkBleeds = new LinkButton( bleedPage ); -/** Fix Me to move this to the prefsmanager.cpp someday */ - linkBleeds->setCheckable( true ); - linkBleeds->setChecked(true); - linkBleeds->setAutoRaise( true ); - linkBleeds->setMinimumSize( QSize( 15, 0 ) ); - linkBleeds->setMaximumSize( QSize( 15, 32767 ) ); - BleedGroupLayout->addWidget( linkBleeds, 0, 2, 4, 1 ); - BleedTop->setToolTip( "" + tr( "Distance for bleed from the top of the physical page" ) + "" ); - BleedBottom->setToolTip( "" + tr( "Distance for bleed from the bottom of the physical page" ) + "" ); - BleedLeft->setToolTip( "" + tr( "Distance for bleed from the left of the physical page" ) + "" ); - BleedRight->setToolTip( "" + tr( "Distance for bleed from the right of the physical page" ) + ""); - linkBleeds->setToolTip( "" + tr( "Ensure all bleeds have the same value" ) + ""); - connect(BleedLeft, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedRight, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedTop, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedBottom, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(linkBleeds, SIGNAL(clicked()), this, SLOT(slotLinkBleeds())); - addTab(bleedPage, tr("Bleeds")); - } - - // hints - topR->setToolTip( "" + tr( "Distance between the top margin guide and the edge of the page" ) + ""); - bottomR->setToolTip( "" + tr( "Distance between the bottom margin guide and the edge of the page" ) + ""); - leftR->setToolTip( "" + 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.") + ""); - rightR->setToolTip( "" + 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.") + ""); - linkMargins->setToolTip( "" + tr( "Ensure all margins have the same value") + ""); - - // signals&slots - connect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop())); - connect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); - connect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); - connect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight())); - connect(presetCombo, SIGNAL(activated(int)), this, SLOT(setPreset())); - connect(linkMargins, SIGNAL(clicked()), this, SLOT(slotLinkMargins())); -} - -void MarginWidget::slotLinkBleeds() -{ - disconnect(BleedLeft, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - disconnect(BleedRight, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - disconnect(BleedTop, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - disconnect(BleedBottom, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - - double bleedValue = BleedLeft->value(); - if (BleedLeft->hasFocus()) - { - BleedLeft->clearFocus(); - bleedValue = BleedLeft->value(); - } - if (BleedRight->hasFocus()) - { - BleedRight->clearFocus(); - bleedValue = BleedRight->value(); - } - if (BleedTop->hasFocus()) - { - BleedTop->clearFocus(); - bleedValue = BleedTop->value(); - } - if (BleedBottom->hasFocus()) - { - BleedBottom->clearFocus(); - bleedValue = BleedBottom->value(); - } - - if (linkBleeds->isChecked()) - { - BleedLeft->setValue(bleedValue); - BleedTop->setValue(bleedValue); - BleedBottom->setValue(bleedValue); - BleedRight->setValue(bleedValue); - } - - connect(BleedLeft, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedRight, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedTop, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedBottom, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); -} - -void MarginWidget::changeBleeds() -{ - if (linkBleeds->isChecked()) - { - double val = 0.0; - if (BleedTop == sender()) - val = BleedTop->value(); - else if (BleedBottom == sender()) - val = BleedBottom->value(); - else if (BleedLeft == sender()) - val = BleedLeft->value(); - else if (BleedRight == sender()) - val = BleedRight->value(); - val = val / m_unitRatio; - MarginStruct v(val,val,val,val); - setNewBleeds(v); - } -} - -void MarginWidget::setFacingPages(bool facing, int pagetype) -{ - m_facingPages = facing; - m_pageType = pagetype; - lText->setText(facing ? tr( "&Inside:" ) : tr( "&Left:" )); - rText->setText(facing ? tr( "O&utside:" ) : tr( "&Right:" )); - if (m_useBleeds) - { - if (facing) - { - BleedTxt3->setText( tr( "Inside:" ) ); - BleedTxt4->setText( tr( "Outside:" ) ); - } - else - { - BleedTxt3->setText( tr( "Left:" ) ); - BleedTxt4->setText( tr( "Right:" ) ); - } - } - setPreset(); -} - -void MarginWidget::setPageWidthHeight(double width, double height) -{ - rightR->setMaximum(qMax(0.0, width * m_unitRatio - leftR->value())); - leftR->setMaximum(qMax(0.0, width * m_unitRatio - rightR->value())); - m_pageWidth = width; - topR->setMaximum(qMax(0.0, height * m_unitRatio - bottomR->value())); - bottomR->setMaximum(qMax(0.0, height * m_unitRatio - topR->value())); - m_pageHeight = height; - setPreset(); -} - -void MarginWidget::setPageWidth(double width) -{ - rightR->setMaximum(qMax(0.0, width * m_unitRatio - leftR->value())); - leftR->setMaximum(qMax(0.0,width * m_unitRatio - rightR->value())); - m_pageWidth = width; - setPreset(); -} - -void MarginWidget::setPageHeight(double height) -{ - topR->setMaximum(qMax(0.0, height * m_unitRatio - bottomR->value())); - bottomR->setMaximum(qMax(0.0,height * m_unitRatio - topR->value())); - m_pageHeight = height; - setPreset(); -} - -void MarginWidget::setTop() -{ - double newVal = topR->value() / m_unitRatio; - bottomR->setMaximum(qMax(0.0, m_pageHeight * m_unitRatio - topR->value())); - if (linkMargins->isChecked() && m_savedPresetItem == PresetLayout::none) - { - marginData.set(newVal, newVal, newVal, newVal); - updateMarginSpinValues(); - } - else - marginData.setTop(newVal); - setPreset(); -} - -void MarginWidget::setBottom() -{ - double newVal = bottomR->value() / m_unitRatio; - topR->setMaximum(qMax(0.0, m_pageHeight * m_unitRatio - bottomR->value())); - if (linkMargins->isChecked() && m_savedPresetItem == PresetLayout::none) - { - marginData.set(newVal, newVal, newVal, newVal); - updateMarginSpinValues(); - } - else - marginData.setBottom(newVal); - setPreset(); -} - -void MarginWidget::setLeft() -{ - double newVal = leftR->value() / m_unitRatio; - rightR->setMaximum(qMax(0.0, m_pageWidth * m_unitRatio - leftR->value())); - if (linkMargins->isChecked() && m_savedPresetItem == PresetLayout::none) - { - marginData.set(newVal, newVal, newVal, newVal); - updateMarginSpinValues(); - } - else - marginData.setLeft(newVal); - setPreset(); -} - -void MarginWidget::setRight() -{ - double newVal = rightR->value() / m_unitRatio; - leftR->setMaximum(qMax(0.0, m_pageWidth * m_unitRatio - rightR->value())); - if (linkMargins->isChecked() && m_savedPresetItem == PresetLayout::none) - { - marginData.set(newVal, newVal, newVal, newVal); - updateMarginSpinValues(); - } - else - marginData.setRight(newVal); - setPreset(); -} - -void MarginWidget::setNewUnit(int newUnitIndex) -{ - disconnect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop())); - disconnect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); - disconnect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); - disconnect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight())); - m_unitIndex = newUnitIndex; - m_unitRatio = unitGetRatioFromIndex(newUnitIndex); - topR->setNewUnit(newUnitIndex); - bottomR->setNewUnit(newUnitIndex); - leftR->setNewUnit(newUnitIndex); - rightR->setNewUnit(newUnitIndex); - - if (m_useBleeds) - { - disconnect(BleedLeft, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - disconnect(BleedRight, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - disconnect(BleedTop, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - disconnect(BleedBottom, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - BleedBottom->setNewUnit(newUnitIndex); - BleedTop->setNewUnit(newUnitIndex); - BleedRight->setNewUnit(newUnitIndex); - BleedLeft->setNewUnit(newUnitIndex); - connect(BleedLeft, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedRight, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedTop, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedBottom, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - } - connect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop())); - connect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); - connect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); - connect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight())); -} - -void MarginWidget::setPreset() -{ - disconnect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop())); - disconnect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); - disconnect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); - disconnect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight())); - if (m_savedPresetItem == PresetLayout::none) - m_savedMargins = marginData; - int item = presetCombo->currentIndex(); - - MarginStruct marg = presetCombo->getMargins(item, m_pageWidth, m_pageHeight, leftR->value() / m_unitRatio); - presetCombo->setEnabled(m_facingPages); - - bool restoringValues = false; - if ((item == PresetLayout::none) && (m_savedPresetItem != PresetLayout::none)) - { - marg = m_savedMargins; - restoringValues = true; - } - if (restoringValues || (presetCombo->needUpdate() && m_facingPages)) - { - marginData.set(qMax(0.0, marg.top()), qMax(0.0, marg.left()), qMax(0.0, marg.bottom()), qMax(0.0, marg.right())); - updateMarginSpinValues(); - - bottomR->setMaximum(qMax(0.0, m_pageHeight * m_unitRatio - topR->value())); - topR->setMaximum(qMax(0.0, m_pageHeight * m_unitRatio - bottomR->value())); - rightR->setMaximum(qMax(0.0, m_pageWidth * m_unitRatio - leftR->value())); - leftR->setMaximum(qMax(0.0, m_pageWidth * m_unitRatio - rightR->value())); - rightR->setEnabled(restoringValues); - topR->setEnabled(restoringValues); - bottomR->setEnabled(restoringValues); - } - else - { - rightR->setEnabled(true); - topR->setEnabled(true); - bottomR->setEnabled(true); - } - if (m_pageType == 1) - rightR->setEnabled(false); - leftR->setEnabled(item != PresetLayout::nineparts); - if (item != PresetLayout::none) - linkMargins->setChecked(false); - linkMargins->setEnabled(item == PresetLayout::none || !presetCombo->isEnabled()); - connect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop())); - connect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); - connect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); - connect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight())); - m_savedPresetItem = item; -} - -void MarginWidget::setPageSize(const QString& pageSize) -{ - m_pageSize = pageSize; -} - -void MarginWidget::setMarginsToPrinterMargins() -{ - QSizeF pageDimensions(m_pageWidth, m_pageHeight); - UsePrinterMarginsDialog upm(parentWidget(), pageDimensions, m_pageSize, unitGetRatioFromIndex(m_unitIndex), unitGetSuffixFromIndex(m_unitIndex)); - if (upm.exec() != QDialog::Accepted) - return; - - double t, b, l, r; - upm.getNewPrinterMargins(t, b, l, r); - presetCombo->setCurrentIndex(PresetLayout::none); - - marginData.setTop(t); - marginData.setBottom(b); - marginData.setLeft(l); - marginData.setRight(r); - updateMarginSpinValues(); - - bottomR->setMaximum((qMax(0.0, m_pageHeight - t) * m_unitRatio)); - topR->setMaximum((qMax(0.0, m_pageHeight - b) * m_unitRatio)); - rightR->setMaximum((qMax(0.0, m_pageWidth - l) * m_unitRatio)); - leftR->setMaximum((qMax(0.0, m_pageWidth - r) * m_unitRatio)); - - rightR->setEnabled(true); - topR->setEnabled(true); - bottomR->setEnabled(true); -} - -double MarginWidget::top() const -{ - return marginData.top(); -} - -double MarginWidget::bottom() const -{ - return marginData.bottom(); -} - -double MarginWidget::left() const -{ - return marginData.left(); -} - -double MarginWidget::right() const -{ - return marginData.right(); -} - -void MarginWidget::setNewMargins(MarginStruct &m) -{ - disconnect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop())); - disconnect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); - disconnect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); - disconnect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight())); - marginData = m; - updateMarginSpinValues(); - connect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop())); - connect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); - connect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); - connect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight())); -} - -void MarginWidget::setMarginPreset(int p) -{ - disconnect(presetCombo, SIGNAL(activated(int)), this, SLOT(setPreset())); - m_savedPresetItem = p; - presetCombo->setCurrentIndex(p); - if (m_savedPresetItem == PresetLayout::none) - m_savedMargins = marginData; - int item = presetCombo->currentIndex(); - presetCombo->setEnabled(m_facingPages); - bool restoringValues = false; - if ((item == PresetLayout::none) && (m_savedPresetItem != PresetLayout::none)) - { - restoringValues = true; - } - if (restoringValues || (presetCombo->needUpdate() && m_facingPages)) - { - rightR->setEnabled(restoringValues); - topR->setEnabled(restoringValues); - bottomR->setEnabled(restoringValues); - } - else - { - rightR->setEnabled(true); - topR->setEnabled(true); - bottomR->setEnabled(true); - } - if (m_pageType == 1) - rightR->setEnabled(false); - leftR->setEnabled(item != PresetLayout::nineparts); - if (item != PresetLayout::none) - linkMargins->setChecked(false); - linkMargins->setEnabled(item == PresetLayout::none); - connect(presetCombo, SIGNAL(activated(int)), this, SLOT(setPreset())); -} - -int MarginWidget::getMarginPreset() -{ - return presetCombo->currentIndex(); -} - -bool MarginWidget::getMarginsForAllPages() const -{ - return marginsForAllPages->isChecked(); -} - -bool MarginWidget::getMarginsForAllMasterPages() const -{ - return marginsForAllMasterPages->isChecked(); -} - -void MarginWidget::setNewBleeds(MarginStruct& b) -{ - disconnect(BleedLeft, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - disconnect(BleedRight, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - disconnect(BleedTop, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - disconnect(BleedBottom, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - BleedTop->setValue(b.top() * m_unitRatio); - BleedBottom->setValue(b.bottom() * m_unitRatio); - BleedLeft->setValue(b.left() * m_unitRatio); - BleedRight->setValue(b.right() * m_unitRatio); - connect(BleedLeft, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedRight, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedTop, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); - connect(BleedBottom, SIGNAL(valueChanged(double)), this, SLOT(changeBleeds())); -} - -double MarginWidget::topBleed() const -{ - return BleedTop->value() / m_unitRatio; -} - -double MarginWidget::bottomBleed() const -{ - return BleedBottom->value() / m_unitRatio; -} - -double MarginWidget::leftBleed() const -{ - return BleedLeft->value() / m_unitRatio; -} - -double MarginWidget::rightBleed() const -{ - return BleedRight->value() / m_unitRatio; -} - -const MarginStruct & MarginWidget::margins() const -{ - return marginData; -} - -void MarginWidget::slotLinkMargins() -{ - disconnect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop())); - disconnect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); - disconnect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); - disconnect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight())); - - double marginValue = leftR->value(); - if (leftR->hasFocus()) - { - leftR->clearFocus(); - marginValue = leftR->value(); - } - if (rightR->hasFocus()) - { - rightR->clearFocus(); - marginValue = rightR->value(); - } - if (topR->hasFocus()) - { - topR->clearFocus(); - marginValue = topR->value(); - } - if (bottomR->hasFocus()) - { - bottomR->clearFocus(); - marginValue = bottomR->value(); - } - - if (linkMargins->isChecked()) - { - leftR->setValue(marginValue); - bottomR->setValue(marginValue); - topR->setValue(marginValue); - rightR->setValue(marginValue); - double newVal = marginValue / m_unitRatio; - marginData.set(newVal, newVal, newVal, newVal); - } - - connect(topR, SIGNAL(valueChanged(double)), this, SLOT(setTop())); - connect(bottomR, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); - connect(leftR, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); - connect(rightR, SIGNAL(valueChanged(double)), this, SLOT(setRight())); - -} - -void MarginWidget::updateMarginSpinValues() -{ - topR->setValue(marginData.top() * m_unitRatio); - rightR->setValue(marginData.right() * m_unitRatio); - bottomR->setValue(marginData.bottom() * m_unitRatio); - leftR->setValue(marginData.left() * m_unitRatio); -} Property changes on: scribus/ui/marginwidget.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: scribus/ui/marginwidget.h =================================================================== --- scribus/ui/marginwidget.h (Revision 26196) +++ scribus/ui/marginwidget.h (nicht existent) @@ -1,178 +0,0 @@ -/* -For general Scribus (>=1.3.2) copyright and licensing information please refer -to the COPYING file provided with the program. Following this notice may exist -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. -*/ -#ifndef MARGINWIDGET_H -#define MARGINWIDGET_H - -#include "scribusapi.h" -#include "scribusstructs.h" - -#include -#include -#include "linkbutton.h" -#include "marginpresetlayout.h" - -class QCheckBox; -class QPushButton; -class QLabel; -class QGridLayout; -class QHBoxLayout; -class ScrSpinBox; - - -/*! \brief Widget for Margins setting. -Used e.g. in "New Doc Dialog" or "Preferences". -*/ -class SCRIBUS_API MarginWidget : public QTabWidget -{ - Q_OBJECT - -public: - /*! \brief It creates an user interface for base margin settings for the document. - \param parent Parent widget (used as standard in Qt) - \param title Title of the Group box - \param margs A reference to the margins in the preferences. - \param unitIndex and index of the unit combobox - \param showChangeAll show "apply to all pages" related items - */ - MarginWidget(QWidget* parent, const QString& title, const MarginStruct* margs, int unitIndex, bool showChangeAll = false, bool showBleeds = true); - ~MarginWidget() {} - /*! \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 and height */ - void setPageWidthHeight(double width, double height); - /*! \brief Setup the spinboxes properties (min/max value etc.) by width */ - void setPageWidth(double width); - /*! \brief Setup the spinboxes properties (min/max value etc.) by height */ - void setPageHeight(double height); - /*! \brief Setup the widgets by new options */ - void setNewUnit(int newUnitIndex); - /*! \brief Set the page size for margin getting from cups */ - void setPageSize(const QString& pageSize); - - /*! \brief Margins - \retval MarginStruct data */ - const MarginStruct& margins() const; - /*! \brief Top Margin - \retval double margin size */ - double top() const; - /*! \brief Bottom Margin - \retval double margin size */ - double bottom() const; - /*! \brief Left Margin - \retval double margin size */ - double left() const; - /*! \brief Right Margin - \retval double margin size */ - double right() const; - - /*! \brief set new margin values for the dialog - It calls overridden setTop(), setBottom() etc. slots itself - via signals emitted from spinboxes. - \param m MarginStruct - */ - void setNewMargins(MarginStruct& m); - - /*! \brief Setup the presetCombo without changing the margin values, only used by tabdocument */ - void setMarginPreset(int p); - int getMarginPreset(); - - /*! \brief Top Bleed - \retval double bleed size */ - double topBleed() const; - /*! \brief Bottom Bleed - \retval double bleed size */ - double bottomBleed() const; - /*! \brief Left Bleed - \retval double bleed size */ - double leftBleed() const; - /*! \brief Right Bleed - \retval double bleed size */ - double rightBleed() const; - - /*! \brief set new bleed values for the dialog - \param b MarginStruct - */ - void setNewBleeds(MarginStruct& b); - - /*! \brief Return marginsForAllPages property - \retval bool true to apply for all pages */ - bool getMarginsForAllPages() const; - bool getMarginsForAllMasterPages() const; - -private: - /*! Tabs */ - QWidget *marginPage { nullptr }; - QWidget* bleedPage { nullptr }; - /*! Spinboxes */ - ScrSpinBox* topR { nullptr }; - ScrSpinBox* bottomR { nullptr }; - ScrSpinBox* rightR { nullptr }; - ScrSpinBox* leftR { nullptr }; - ScrSpinBox* BleedBottom { nullptr }; - ScrSpinBox* BleedLeft { nullptr }; - ScrSpinBox* BleedRight { nullptr }; - ScrSpinBox* BleedTop { nullptr }; - PresetLayout* presetCombo { nullptr }; - /*! Labels */ - QLabel* lText { nullptr }; - QLabel* rText { nullptr }; - QLabel* tText { nullptr }; - QLabel* bText { nullptr }; - QLabel* presetLabel { nullptr }; - QLabel* marginsForPages { nullptr }; - QLabel* BleedTxt1 { nullptr }; - QLabel* BleedTxt2 { nullptr }; - QLabel* BleedTxt3 { nullptr }; - QLabel* BleedTxt4 { nullptr }; - QCheckBox* marginsForAllPages { nullptr }; - QCheckBox* marginsForAllMasterPages { nullptr }; - QPushButton* usePrinterMarginsButton { nullptr }; - LinkButton* linkBleeds { nullptr }; - LinkButton* linkMargins { nullptr }; - - /*! \brief Margin values converted by unitRatio */ - MarginStruct marginData; - - /*! \brief Internally used page width */ - double m_pageWidth { 0.0 }; - /*! \brief Internally used page height */ - double m_pageHeight { 0.0 }; - -public slots: - /*! \brief Recompute the values after spinbox change */ - void setTop(); - void setBottom(); - void setLeft(); - void setRight(); - /*! \brief Recompute margins in PresetLayout combobox and disable/enable widgets. */ - void setPreset(); - void slotLinkBleeds(); - void slotLinkMargins(); - void changeBleeds(); - -protected slots: - virtual void setMarginsToPrinterMargins(); - -protected: - void updateMarginSpinValues(); - - QGridLayout* GroupLayout { nullptr }; - QHBoxLayout* marginsForPagesLayout { nullptr }; - QGridLayout* BleedGroupLayout { nullptr }; - - QString m_pageSize; - int m_unitIndex { 0 }; - double m_unitRatio { 1.0 }; - //! \brief if the outer facing palette points to the facing pages item - bool m_facingPages { false }; - bool m_useBleeds { false }; - int m_pageType { 0 }; - MarginStruct m_savedMargins; - int m_savedPresetItem { PresetLayout::none }; -}; - -#endif Property changes on: scribus/ui/marginwidget.h ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -Author Date Id Revision \ No newline at end of property Index: scribus/ui/newdocdialog.cpp =================================================================== --- scribus/ui/newdocdialog.cpp (Revision 26196) +++ scribus/ui/newdocdialog.cpp (Arbeitskopie) @@ -29,6 +29,7 @@ #include #include #include +#include #include "scconfig.h" @@ -36,7 +37,7 @@ #include "filedialogeventcatcher.h" #include "fileloader.h" #include "iconmanager.h" -#include "marginwidget.h" +#include "newmarginwidget.h" #include "pagesize.h" #include "pagestructs.h" #include "prefsfile.h" @@ -43,60 +44,15 @@ #include "prefsmanager.h" #include "scrspinbox.h" #include "units.h" -#include "ui/delegates/sclistitemdelegate.h" +#include "ui/widgets/pagelayoutswidget.h" -PageLayoutsWidget::PageLayoutsWidget(QWidget* parent) : - QListWidget(parent) -{ - setDragEnabled(false); - setViewMode(QListView::IconMode); - setFlow(QListView::LeftToRight); - setSortingEnabled(false); - setWrapping(false); - setWordWrap(true); - setAcceptDrops(false); - setDropIndicatorShown(false); - setDragDropMode(QAbstractItemView::NoDragDrop); - setResizeMode(QListView::Adjust); - setSelectionMode(QAbstractItemView::SingleSelection); - setFocusPolicy(Qt::NoFocus); - setIconSize(QSize(32, 32)); - clear(); - setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding); - setGridSize(QSize(96, 96)); - setItemDelegate(new ScListItemDelegate(QListWidget::IconMode, QSize(32,32))); -} -void PageLayoutsWidget::arrangeIcons() -{ - int startY = 5; - int startX = 5; - int maxSizeY = 0; - - setResizeMode(QListView::Fixed); - - for (int i = 0; i < count(); ++i) - { - QListWidgetItem* itemWidget = item(i); - QRect itemRect = visualItemRect(itemWidget); - setPositionForIndex(QPoint(startX, startY), indexFromItem(itemWidget)); - startX += itemRect.width() + 5; - maxSizeY = qMax(maxSizeY, itemRect.height()); - } - - maxX = startX; - maxY = maxSizeY + 10; -} - -QSize PageLayoutsWidget::minimumSizeHint() const -{ - return QSize(maxX, maxY); -} - NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool startUp, const QString& lang) : QDialog(parent), prefsManager(PrefsManager::instance()), m_onStartup(startUp) { + setupUi(this); + setObjectName(QString::fromLocal8Bit("NewDocumentWindow")); setModal(true); @@ -107,54 +63,27 @@ setWindowTitle( tr( "New Document" ) ); setWindowIcon(IconManager::instance().loadIcon("AppIcon.png")); - if (startUp) - setContentsMargins(0, 0, 0, 0); - else - setContentsMargins(9, 9, 9, 9); - TabbedNewDocLayout = new QVBoxLayout( this ); - if (startUp) - TabbedNewDocLayout->setContentsMargins(9, 9, 9, 9); - else - TabbedNewDocLayout->setContentsMargins(0, 0, 0, 0); - TabbedNewDocLayout->setSpacing(6); + createNewDocPage(); if (startUp) { - tabWidget = new QTabWidget( this ); - tabWidget->addTab(newDocFrame, tr("&New Document")); - createNewFromTempPage(); nftGui->setupSettings(lang); - tabWidget->addTab(newFromTempFrame, tr("New &from Template")); createOpenDocPage(); - tabWidget->addTab(openDocFrame, tr("Open &Existing Document")); recentDocList = recentDocs; - createRecentDocPage(); - tabWidget->addTab(recentDocFrame, tr("Open Recent &Document")); - TabbedNewDocLayout->addWidget(tabWidget); + createRecentDocPage(); + startUpDialog->setChecked(!prefsManager.appPrefs.uiPrefs.showStartupDialog); } else - TabbedNewDocLayout->addWidget(newDocFrame); - - Layout1 = new QHBoxLayout; - Layout1->setContentsMargins(0, 0, 0, 0); - Layout1->setSpacing(6); - if (startUp) { - startUpDialog = new QCheckBox( tr( "Do not show this dialog again" ), this ); - startUpDialog->setChecked(!prefsManager.appPrefs.uiPrefs.showStartupDialog); - Layout1->addWidget( startUpDialog ); + tabWidget->removeTab(3); + tabWidget->removeTab(2); + tabWidget->removeTab(1); } - QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum ); - Layout1->addItem( spacer ); - buttonBox = new QDialogButtonBox(); - Layout1->addWidget(buttonBox); - okButton = new QPushButton( CommonStrings::tr_OK, this ); - okButton->setDefault( true ); - buttonBox->addButton(okButton, QDialogButtonBox::AcceptRole); - cancelButton = new QPushButton( CommonStrings::tr_Cancel, this ); - cancelButton->setAutoDefault( false ); - buttonBox->addButton(cancelButton, QDialogButtonBox::RejectRole); - TabbedNewDocLayout->addLayout( Layout1 ); + + + tabWidget->setCurrentIndex(0); + startUpDialog->setVisible(startUp); + //tooltips pageSizeComboBox->setToolTip( tr( "Document page size, either a standard size or a custom size" ) ); pageOrientationComboBox->setToolTip( tr( "Orientation of the document's pages" ) ); @@ -189,16 +118,6 @@ void NewDocDialog::createNewDocPage() { - newDocFrame = new QFrame(this); - - pageSizeGroupBox = new QGroupBox(newDocFrame ); - pageSizeGroupBox->setTitle( tr( "Document Layout" ) ); - pageSizeGroupBoxLayout = new QGridLayout( pageSizeGroupBox ); - pageSizeGroupBoxLayout->setContentsMargins(9, 9, 9, 9); - pageSizeGroupBoxLayout->setSpacing(6); - pageSizeGroupBoxLayout->setAlignment( Qt::AlignTop ); - - layoutsView = new PageLayoutsWidget( pageSizeGroupBox ); layoutsView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); for (int i = 0; i < prefsManager.appPrefs.pageSets.count(); ++i) { @@ -214,66 +133,62 @@ ic = new QListWidgetItem( IconManager::instance().loadIcon("32/page-doublesided.png"), psname, layoutsView ); ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); } - else if (i == 2 && prefsManager.appPrefs.docSetupPrefs.pagePositioning == 2) - { - ic = new QListWidgetItem( IconManager::instance().loadIcon("32/page-3fold.png"), psname, layoutsView ); - ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - } - else if (i == 3 && prefsManager.appPrefs.docSetupPrefs.pagePositioning == 3) - { - ic = new QListWidgetItem( IconManager::instance().loadIcon("32/page-4fold.png"), psname, layoutsView ); - ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); - } + // else if (i == 2 && prefsManager.appPrefs.docSetupPrefs.pagePositioning == 2) + // { + // ic = new QListWidgetItem( IconManager::instance().loadIcon("32/page-3fold.png"), psname, layoutsView ); + // ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + // } + // else if (i == 3 && prefsManager.appPrefs.docSetupPrefs.pagePositioning == 3) + // { + // ic = new QListWidgetItem( IconManager::instance().loadIcon("32/page-4fold.png"), psname, layoutsView ); + // ic->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); + // } } layoutsView->arrangeIcons(); - pageSizeGroupBoxLayout->addWidget( layoutsView, 0, 0, 5, 1 ); - layoutsView->arrangeIcons(); - TextLabel1 = new QLabel( tr( "&Size:" ), pageSizeGroupBox ); - pageSizeGroupBoxLayout->addWidget( TextLabel1, 0, 1 ); PageSize ps(prefsManager.appPrefs.docSetupPrefs.pageSize); - pageSizeComboBox = new QComboBox( pageSizeGroupBox ); + pageSizeComboBox->addItems(ps.activeSizeTRList()); pageSizeComboBox->addItem( CommonStrings::trCustomPageSize ); pageSizeComboBox->setEditable(false); TextLabel1->setBuddy(pageSizeComboBox); - pageSizeGroupBoxLayout->addWidget(pageSizeComboBox, 0, 2 ); - TextLabel2 = new QLabel( tr( "Orie&ntation:" ), pageSizeGroupBox ); - pageSizeGroupBoxLayout->addWidget( TextLabel2, 1, 1 ); - pageOrientationComboBox = new QComboBox( pageSizeGroupBox ); + pageOrientationComboBox->addItem( tr( "Portrait" ) ); pageOrientationComboBox->addItem( tr( "Landscape" ) ); pageOrientationComboBox->setEditable(false); pageOrientationComboBox->setCurrentIndex(prefsManager.appPrefs.docSetupPrefs.pageOrientation); TextLabel2->setBuddy(pageOrientationComboBox); - pageSizeGroupBoxLayout->addWidget( pageOrientationComboBox, 1, 2 ); - TextLabel1_2 = new QLabel( tr( "&Width:" ), pageSizeGroupBox ); - pageSizeGroupBoxLayout->addWidget(TextLabel1_2, 2, 1 ); - widthSpinBox = new ScrSpinBox(pts2value(1.0, m_unitIndex), 16777215, pageSizeGroupBox, m_unitIndex ); + widthSpinBox->setMinimum(pts2value(1.0, m_unitIndex)); + widthSpinBox->setMaximum(16777215); + widthSpinBox->setNewUnit(m_unitIndex); widthSpinBox->setSuffix(m_unitSuffix); TextLabel1_2->setBuddy(widthSpinBox); - pageSizeGroupBoxLayout->addWidget(widthSpinBox, 2, 2 ); - TextLabel2_2 = new QLabel( tr( "&Height:" ), pageSizeGroupBox ); - pageSizeGroupBoxLayout->addWidget(TextLabel2_2, 3, 1 ); - heightSpinBox = new ScrSpinBox( pts2value(1.0, m_unitIndex), 16777215, pageSizeGroupBox, m_unitIndex ); + + heightSpinBox->setMinimum(pts2value(1.0, m_unitIndex)); + heightSpinBox->setMaximum(16777215); + heightSpinBox->setNewUnit(m_unitIndex); heightSpinBox->setSuffix(m_unitSuffix); TextLabel2_2->setBuddy(heightSpinBox); - pageSizeGroupBoxLayout->addWidget(heightSpinBox, 3, 2 ); - unitOfMeasureLabel = new QLabel( tr( "&Default Unit:" ), pageSizeGroupBox ); - unitOfMeasureComboBox = new QComboBox( pageSizeGroupBox ); unitOfMeasureComboBox->addItems(unitGetTextUnitList()); unitOfMeasureComboBox->setCurrentIndex(m_unitIndex); unitOfMeasureComboBox->setEditable(false); unitOfMeasureLabel->setBuddy(unitOfMeasureComboBox); - pageSizeGroupBoxLayout->addWidget( unitOfMeasureLabel, 4, 1 ); - pageSizeGroupBoxLayout->addWidget( unitOfMeasureComboBox, 4, 2 ); MarginStruct marg(prefsManager.appPrefs.docSetupPrefs.margins); - marginGroup = new MarginWidget(newDocFrame, tr( "Margin Guides" ), &marg, m_unitIndex ); - marginGroup->setPageWidthHeight(prefsManager.appPrefs.docSetupPrefs.pageWidth, prefsManager.appPrefs.docSetupPrefs.pageHeight); + marginGroup->setup(marg, !(prefsManager.appPrefs.docSetupPrefs.pagePositioning == singlePage), m_unitIndex, NewMarginWidget::MarginWidgetFlags); + marginGroup->setPageHeight(prefsManager.appPrefs.docSetupPrefs.pageHeight); + marginGroup->setPageWidth(prefsManager.appPrefs.docSetupPrefs.pageWidth); marginGroup->setFacingPages(!(prefsManager.appPrefs.docSetupPrefs.pagePositioning == singlePage)); + + MarginStruct bleed; + bleed.resetToZero(); + + bleedGroup->setup(bleed, !(prefsManager.appPrefs.docSetupPrefs.pagePositioning == singlePage), m_unitIndex, NewMarginWidget::BleedWidgetFlags); + bleedGroup->setPageHeight(prefsManager.appPrefs.docSetupPrefs.pageHeight); + bleedGroup->setPageWidth(prefsManager.appPrefs.docSetupPrefs.pageWidth); + bleedGroup->setFacingPages(!(prefsManager.appPrefs.docSetupPrefs.pagePositioning == singlePage)); widthSpinBox->setValue(prefsManager.appPrefs.docSetupPrefs.pageWidth * m_unitRatio); heightSpinBox->setValue(prefsManager.appPrefs.docSetupPrefs.pageHeight * m_unitRatio); QStringList pageSizes = ps.activeSizeTRList(); @@ -283,31 +198,16 @@ else pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count() - 1); marginGroup->setPageSize(pageSizeComboBox->currentText()); - marginGroup->setNewBleeds(prefsManager.appPrefs.docSetupPrefs.bleeds); marginGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset); + bleedGroup->setPageSize(pageSizeComboBox->currentText()); + bleedGroup->setMarginPreset(prefsManager.appPrefs.docSetupPrefs.marginPreset); - optionsGroupBox = new QGroupBox( newDocFrame ); - optionsGroupBox->setTitle( tr( "Options" ) ); - optionsGroupBoxLayout = new QGridLayout( optionsGroupBox ); - optionsGroupBoxLayout->setSpacing(6); - optionsGroupBoxLayout->setContentsMargins(9, 9, 9, 9); - optionsGroupBoxLayout->setAlignment( Qt::AlignTop ); - pageCountLabel = new QLabel( tr( "N&umber of Pages:" ), optionsGroupBox ); - - pageCountSpinBox = new QSpinBox( optionsGroupBox ); pageCountSpinBox->setMaximum( 10000 ); pageCountSpinBox->setMinimum( 1 ); - pageCountLabel->setBuddy(pageCountSpinBox); - optionsGroupBoxLayout->addWidget(pageCountLabel, 0, 0, Qt::AlignLeft); - optionsGroupBoxLayout->addWidget(pageCountSpinBox, 0, 1); - layoutLabel1 = new QLabel( optionsGroupBox ); - layoutLabel1->setText( tr( "First Page is:" ) ); - firstPage = new QComboBox( optionsGroupBox ); + layoutLabel1->setText( tr( "First Page" ) ); firstPage->clear(); selectItem(prefsManager.appPrefs.docSetupPrefs.pagePositioning); - optionsGroupBoxLayout->addWidget(layoutLabel1, 1, 0, Qt::AlignLeft); - optionsGroupBoxLayout->addWidget(firstPage, 1, 1); firstPage->setCurrentIndex(prefsManager.appPrefs.pageSets[prefsManager.appPrefs.docSetupPrefs.pagePositioning].FirstPage); setDocLayout(prefsManager.appPrefs.docSetupPrefs.pagePositioning); @@ -314,25 +214,16 @@ setSize(prefsManager.appPrefs.docSetupPrefs.pageSize); setOrientation(prefsManager.appPrefs.docSetupPrefs.pageOrientation); - autoTextFrame = new QCheckBox( optionsGroupBox ); - autoTextFrame->setText( tr( "&Automatic Text Frames" ) ); - optionsGroupBoxLayout->addWidget(autoTextFrame, 2, 0, 1, 2, Qt::AlignLeft); + autoTextFrame->setTitle(tr( "&Automatic Text Frames" ) ); - TextLabel3 = new QLabel( tr( "Colu&mns:" ), optionsGroupBox ); - numberOfCols = new QSpinBox( optionsGroupBox ); numberOfCols->setButtonSymbols( QSpinBox::UpDownArrows ); numberOfCols->setMinimum( 1 ); numberOfCols->setValue( 1 ); - TextLabel3->setBuddy(numberOfCols); - optionsGroupBoxLayout->addWidget(TextLabel3, 3, 0, Qt::AlignLeft); - optionsGroupBoxLayout->addWidget(numberOfCols, 3, 1); - TextLabel4 = new QLabel( tr( "&Gap:" ), optionsGroupBox ); - Distance = new ScrSpinBox( 0, 1000, optionsGroupBox, m_unitIndex ); + Distance->setMinimum(0); + Distance->setMaximum(1000); + Distance->setNewUnit(m_unitIndex); Distance->setValue(11 * m_unitRatio); - TextLabel4->setBuddy(Distance); - optionsGroupBoxLayout->addWidget(TextLabel4, 4, 0, Qt::AlignLeft); - optionsGroupBoxLayout->addWidget(Distance, 4, 1); firstPage->setMinimumWidth(Distance->width()); @@ -340,31 +231,12 @@ TextLabel4->setEnabled(false); Distance->setEnabled(false); numberOfCols->setEnabled(false); - startDocSetup = new QCheckBox( optionsGroupBox ); + startDocSetup->setText( tr( "Show Document Settings After Creation" ) ); startDocSetup->setChecked(false); - optionsGroupBoxLayout->addWidget(startDocSetup, 5, 0, 1, 2, Qt::AlignLeft); - NewDocLayout = new QGridLayout( newDocFrame ); - if (m_onStartup) - NewDocLayout->setContentsMargins(9, 9, 9, 9); - else - NewDocLayout->setContentsMargins(0, 0, 0, 0); - NewDocLayout->setSpacing(6); - NewDocLayout->addWidget( marginGroup, 1, 0 ); - NewDocLayout->addWidget( optionsGroupBox, 1, 1 ); - NewDocLayout->addWidget( pageSizeGroupBox, 0, 0, 1, 2); } -void NewDocDialog::createNewFromTempPage() -{ - newFromTempFrame = new QFrame(this); - verticalLayout = new QVBoxLayout(newFromTempFrame); - verticalLayout->setContentsMargins(9, 9, 9, 9); - nftGui = new nftwidget(newFromTempFrame); - verticalLayout->addWidget(nftGui); -} - void NewDocDialog::createOpenDocPage() { PrefsContext* docContext = prefsManager.prefsFile->getContext("docdirs", false); @@ -376,10 +248,9 @@ docDir = docContext->get("docsopen", "."); QString formats(FileLoader::getLoadFilterString()); // formats.remove("PDF (*.pdf *.PDF);;"); - openDocFrame = new QFrame(this); - openDocLayout = new QVBoxLayout(openDocFrame); + QVBoxLayout *openDocLayout = new QVBoxLayout(tab_3); openDocLayout->setContentsMargins(0, 0, 0, 0); - openDocLayout->setSpacing(6); + openDocLayout->setSpacing(4); m_selectedFile = ""; // With Qt 5.15 we have to be in careful so that new document dialog doesn't display too large on startup. @@ -386,7 +257,7 @@ // To avoid this we have to use QFileDialog(QWidget *parent, Qt::WindowFlags flags) constructor, then // set the QFileDialog::DontUseNativeDialog option as early as possible, and nonetheless set again // the Qt::Widget window flag before adding the widget to layout. - fileDialog = new QFileDialog(openDocFrame, Qt::Widget); + fileDialog = new QFileDialog(tab_3, Qt::Widget); fileDialog->setOption(QFileDialog::DontUseNativeDialog); fileDialog->setWindowTitle(tr("Open")); fileDialog->setDirectory(docDir); @@ -404,6 +275,7 @@ fileDialog->setWindowFlags(Qt::Widget); openDocLayout->addWidget(fileDialog); + FileDialogEventCatcher* keyCatcher = new FileDialogEventCatcher(this); QList listViews = fileDialog->findChildren(); for (auto listView : std::as_const(listViews)) @@ -426,12 +298,6 @@ void NewDocDialog::createRecentDocPage() { - recentDocFrame = new QFrame(this); - recentDocLayout = new QVBoxLayout(recentDocFrame); - recentDocLayout->setContentsMargins(9, 9, 9, 9); - recentDocLayout->setSpacing(6); - recentDocListBox = new QListWidget(recentDocFrame); - recentDocLayout->addWidget(recentDocListBox); int max = qMin(prefsManager.appPrefs.uiPrefs.recentDocCount, recentDocList.count()); for (int i = 0; i < max; ++i) recentDocListBox->addItem(QDir::toNativeSeparators(recentDocList[i])); @@ -443,6 +309,7 @@ { m_pageWidth = widthSpinBox->value() / m_unitRatio; marginGroup->setPageWidth(m_pageWidth); + bleedGroup->setPageWidth(m_pageWidth); QString psText = pageSizeComboBox->currentText(); if (psText != CommonStrings::trCustomPageSize && psText != CommonStrings::customPageSize) pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count() - 1); @@ -460,6 +327,7 @@ { m_pageHeight = heightSpinBox->value() / m_unitRatio; marginGroup->setPageHeight(m_pageHeight); + bleedGroup->setPageHeight(m_pageHeight); QString psText = pageSizeComboBox->currentText(); if (psText != CommonStrings::trCustomPageSize && psText != CommonStrings::customPageSize) pageSizeComboBox->setCurrentIndex(pageSizeComboBox->count() - 1); @@ -547,6 +415,9 @@ marginGroup->setNewUnit(m_unitIndex); marginGroup->setPageHeight(m_pageHeight); marginGroup->setPageWidth(m_pageWidth); + bleedGroup->setNewUnit(m_unitIndex); + bleedGroup->setPageHeight(m_pageHeight); + bleedGroup->setPageWidth(m_pageWidth); connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double))); connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double))); } @@ -555,10 +426,10 @@ { m_pageWidth = widthSpinBox->value() / m_unitRatio; m_pageHeight = heightSpinBox->value() / m_unitRatio; - m_bleedBottom = marginGroup->bottomBleed(); - m_bleedTop = marginGroup->topBleed(); - m_bleedLeft = marginGroup->leftBleed(); - m_bleedRight = marginGroup->rightBleed(); + m_bleedBottom = bleedGroup->margins().bottom(); + m_bleedTop = bleedGroup->margins().top(); + m_bleedLeft = bleedGroup->margins().left(); + m_bleedRight = bleedGroup->margins().right(); if (m_onStartup) { m_tabSelected = tabWidget->currentIndex(); @@ -622,6 +493,8 @@ // end of #869 marginGroup->setPageHeight(m_pageHeight); marginGroup->setPageWidth(m_pageWidth); + bleedGroup->setPageHeight(m_pageHeight); + bleedGroup->setPageWidth(m_pageWidth); connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double))); connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double))); } @@ -636,6 +509,7 @@ setOrientation(pageOrientationComboBox->currentIndex()); } marginGroup->setPageSize(size); + bleedGroup->setPageSize(size); } void NewDocDialog::setSize(const QString& gr) @@ -668,6 +542,8 @@ heightSpinBox->setValue(m_pageHeight * m_unitRatio); marginGroup->setPageHeight(m_pageHeight); marginGroup->setPageWidth(m_pageWidth); + bleedGroup->setPageHeight(m_pageHeight); + bleedGroup->setPageWidth(m_pageWidth); connect(widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setWidth(double))); connect(heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setHeight(double))); } @@ -675,6 +551,7 @@ void NewDocDialog::setDocLayout(int layout) { marginGroup->setFacingPages(layout != singlePage); + bleedGroup->setFacingPages(layout != singlePage); m_choosenLayout = layout; firstPage->setCurrentIndex(prefsManager.appPrefs.pageSets[m_choosenLayout].FirstPage); } @@ -698,7 +575,7 @@ setWindowTitle(tr("Open Recent Document")); else setWindowTitle(tr("New Document")); - okButton->setEnabled(tab!=2); + //okButton->setEnabled(tab!=2); } void NewDocDialog::locationDropped(const QString& fileUrl) @@ -750,5 +627,5 @@ void NewDocDialog::openFileDialogFileClicked(const QString& path) { - okButton->setEnabled(!path.isEmpty()); + //okButton->setEnabled(!path.isEmpty()); } Index: scribus/ui/newdocdialog.h =================================================================== --- scribus/ui/newdocdialog.h (Revision 26196) +++ scribus/ui/newdocdialog.h (Arbeitskopie) @@ -33,31 +33,19 @@ #include "ui/customfdialog.h" #include "ui/nftwidget.h" +#include "ui_newdocdialog.h" + class PrefsManager; -class MarginWidget; +class NewMarginWidget; class ScrSpinBox; class QFileDialog; -class SCRIBUS_API PageLayoutsWidget : public QListWidget +class SCRIBUS_API NewDocDialog : public QDialog, public Ui::newDocDialog { Q_OBJECT public: - PageLayoutsWidget(QWidget* parent); - ~PageLayoutsWidget() = default; - void arrangeIcons(); - QSize minimumSizeHint() const override; - int maxX {0}; - int maxY {0}; -}; - -class SCRIBUS_API NewDocDialog : public QDialog -{ - Q_OBJECT - -public: - //! \brief Indexes of the dialog's tabs. enum { NewDocumentTab = 0, @@ -70,48 +58,11 @@ ~NewDocDialog() = default; void createNewDocPage(); - void createNewFromTempPage(); void createOpenDocPage(); void createRecentDocPage(); void setSize(const QString& gr); - QTabWidget* tabWidget {nullptr}; - QFrame* newDocFrame {nullptr}; - PageLayoutsWidget* layoutsView {nullptr}; - QLabel* layoutLabel1 {nullptr}; - QComboBox* firstPage {nullptr}; - QGroupBox* pageSizeGroupBox {nullptr}; - MarginWidget* marginGroup {nullptr}; - QGroupBox* optionsGroupBox {nullptr}; - QLabel* TextLabel1 {nullptr}; - QLabel* TextLabel2 {nullptr}; - QLabel* TextLabel3 {nullptr}; - QLabel* TextLabel4 {nullptr}; - QLabel* TextLabel1_2 {nullptr}; - QLabel* TextLabel1_3 {nullptr}; - QLabel* pageCountLabel {nullptr}; - QLabel* TextLabel2_2 {nullptr}; - QLabel* unitOfMeasureLabel {nullptr}; - QComboBox* pageSizeComboBox {nullptr}; - QComboBox* pageOrientationComboBox {nullptr}; - QComboBox* unitOfMeasureComboBox {nullptr}; - QCheckBox* startUpDialog {nullptr}; - QCheckBox* autoTextFrame {nullptr}; - QCheckBox* startDocSetup {nullptr}; - ScrSpinBox* Distance {nullptr}; - QSpinBox* numberOfCols {nullptr}; - QSpinBox* pageCountSpinBox {nullptr}; - ScrSpinBox* widthSpinBox {nullptr}; - ScrSpinBox* heightSpinBox {nullptr}; - QFrame* openDocFrame {nullptr}; QFileDialog *fileDialog {nullptr}; - QFrame* newFromTempFrame {nullptr}; - nftwidget *nftGui {nullptr}; - QFrame* recentDocFrame {nullptr}; - QListWidget* recentDocListBox {nullptr}; - QDialogButtonBox* buttonBox {nullptr}; - QPushButton* okButton {nullptr}; - QPushButton* cancelButton {nullptr}; bool onStartup() const { return m_onStartup;} int tabSelected() const { return m_tabSelected;} @@ -157,14 +108,6 @@ void openFileDialogFileClicked(const QString &path); protected: - QVBoxLayout* TabbedNewDocLayout {nullptr}; - QHBoxLayout* Layout1 {nullptr}; - QGridLayout* NewDocLayout {nullptr}; - QGridLayout* pageSizeGroupBoxLayout {nullptr}; - QGridLayout* optionsGroupBoxLayout {nullptr}; - QVBoxLayout* openDocLayout {nullptr}; - QVBoxLayout* recentDocLayout {nullptr}; - QVBoxLayout *verticalLayout {nullptr}; PrefsManager& prefsManager; QStringList recentDocList; Index: scribus/ui/newdocdialog.ui =================================================================== --- scribus/ui/newdocdialog.ui (nicht existent) +++ scribus/ui/newdocdialog.ui (Arbeitskopie) @@ -0,0 +1,565 @@ + + + newDocDialog + + + + 0 + 0 + 721 + 528 + + + + Dialog + + + + + + 0 + + + true + + + true + + + + New Document + + + + 0 + + + 8 + + + 0 + + + 0 + + + 4 + + + + + Bleeds + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + + + + + + Document Layout + + + + + + &Size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + &Width: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + &Height: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Orie&ntation: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + + &Default Unit: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 16 + 0 + + + + + + + + + + + Automatic Text Frame + + + true + + + false + + + + + + + 0 + 0 + + + + Columns + + + + 8 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + 0 + 0 + + + + Gap + + + + 8 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + + + Margins + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + + + + + + Pages + + + + + + + 0 + 0 + + + + Number of Pages + + + + 8 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + 0 + 0 + + + + First Page + + + + 8 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + + + + Show Document Settings After Creation + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + + New from Template + + + + 4 + + + 0 + + + 8 + + + 0 + + + 0 + + + + + + + + + Open Existing Document + + + + + Open Recent Document + + + + 4 + + + 0 + + + 8 + + + 0 + + + 0 + + + + + + + + + + + + + + Do not show this dialog again + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + FormWidget + QWidget +
ui/widgets/form_widget.h
+ 1 +
+ + PageLayoutsWidget + QListWidget +
ui/widgets/pagelayoutswidget.h
+
+ + nftwidget + QWidget +
ui/nftwidget.h
+ 1 +
+ + ScrSpinBox + QDoubleSpinBox +
ui/scrspinbox.h
+
+ + NewMarginWidget + QWidget +
ui/newmarginwidget.h
+ 1 +
+
+ + layoutsView + pageSizeComboBox + pageOrientationComboBox + widthSpinBox + heightSpinBox + unitOfMeasureComboBox + pageCountSpinBox + firstPage + autoTextFrame + numberOfCols + Distance + startDocSetup + startUpDialog + recentDocListBox + tabWidget + + + + + buttonBox + accepted() + newDocDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + newDocDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +
Index: scribus/ui/newmarginwidget.cpp =================================================================== --- scribus/ui/newmarginwidget.cpp (Revision 26196) +++ scribus/ui/newmarginwidget.cpp (Arbeitskopie) @@ -10,6 +10,8 @@ #include "units.h" #include "ui/marginpresetlayout.h" #include "ui/useprintermarginsdialog.h" +#include "iconmanager.h" +#include "scribusapp.h" NewMarginWidget::NewMarginWidget(QWidget* parent) : QWidget(parent) @@ -39,8 +41,8 @@ presetLayoutLabel->resize(0,0); presetLayoutComboBox->hide(); presetLayoutLabel->hide(); - gridLayout->removeWidget(presetLayoutComboBox); - gridLayout->removeWidget(presetLayoutLabel); + horizontalLayout->removeWidget(presetLayoutComboBox); + horizontalLayout->removeWidget(presetLayoutLabel); } if ((m_flags & ShowPrinterMargins) == 0) { @@ -47,14 +49,16 @@ printerMarginsPushButton->blockSignals(true); printerMarginsPushButton->resize(0,0); printerMarginsPushButton->hide(); - gridLayout->removeWidget(printerMarginsPushButton); + horizontalLayout->removeWidget(printerMarginsPushButton); } setFacingPages(!(layoutType == singlePage)); - gridLayout->invalidate(); +// gridLayout->invalidate(); languageChange(); + iconSetChange(); + connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange())); connect(topMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setTop())); connect(bottomMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setBottom())); connect(leftMarginSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setLeft())); @@ -85,6 +89,16 @@ printerMarginsPushButton->setToolTip( "" + tr( "Import the margins for the selected page size from the available printers" ) + ""); } +void NewMarginWidget::iconSetChange() +{ + IconManager &iconManager = IconManager::instance(); + + topMarginLabel->setPixmap( iconManager.loadPixmap("border-top")); + bottomMarginLabel->setPixmap( iconManager.loadPixmap("border-bottom")); + leftMarginLabel->setPixmap( m_facingPages ? iconManager.loadPixmap("border-inside") : iconManager.loadPixmap("border-left")); + rightMarginLabel->setPixmap( m_facingPages ? iconManager.loadPixmap("border-outside") : iconManager.loadPixmap("border-right")); +} + void NewMarginWidget::setNewValues(const MarginStruct& margs) { m_marginData = m_savedMarginData = margs; @@ -324,8 +338,11 @@ { m_facingPages = facing; m_pageType = pageType; - leftMarginLabel->setText(facing ? tr( "&Inside:" ) : tr( "&Left:" )); - rightMarginLabel->setText(facing ? tr( "O&utside:" ) : tr( "&Right:" )); + + IconManager &iconManager = IconManager::instance(); + leftMarginLabel->setPixmap( m_facingPages ? iconManager.loadPixmap("border-inside") : iconManager.loadPixmap("border-left")); + rightMarginLabel->setPixmap( m_facingPages ? iconManager.loadPixmap("border-outside") : iconManager.loadPixmap("border-right")); + setPreset(); } Index: scribus/ui/newmarginwidget.h =================================================================== --- scribus/ui/newmarginwidget.h (Revision 26196) +++ scribus/ui/newmarginwidget.h (Arbeitskopie) @@ -41,10 +41,12 @@ void setNewValues(const MarginStruct& margs); /*! \brief Setup the presetCombo without changing the margin values, only used by tabdocument */ void setMarginPreset(int p); + int marginPreset() { return m_savedPresetItem; }; const MarginStruct & margins() const { return m_marginData; }; public slots: void languageChange(); + void iconSetChange(); void setTop(); void setBottom(); void setLeft(); Index: scribus/ui/newmarginwidgetbase.ui =================================================================== --- scribus/ui/newmarginwidgetbase.ui (Revision 26196) +++ scribus/ui/newmarginwidgetbase.ui (Arbeitskopie) @@ -6,8 +6,8 @@ 0 0 - 308 - 230 + 301 + 152 @@ -16,45 +16,35 @@ 0 - + + + 4 + - 0 + 8 - 0 + 8 - 0 + 8 - 0 + 8 - - - - + + + + - Bottom: + Preset: - - bottomMarginSpinBox - - - - - Left: - - - leftMarginSpinBox - - - - - + + - + 0 0 @@ -61,108 +51,286 @@ - - + + - Right: + Printer Margins... - - rightMarginSpinBox - - - - - Preset Layouts: + + + + Qt::Horizontal - + + + 0 + 0 + + + - - - - Top: + + + + + + + + Qt::Horizontal - - topMarginSpinBox + + + 40 + 20 + - + - - + + - + 0 0 + + + + + FormWidget::Left + + + + 8 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + - - + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + - + 0 0 + + + + + FormWidget::Left + + + + 8 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + - - - - - 0 - 0 - + + + + + + true + + + Qt::ToolButtonIconOnly + + + true + - - + + - + 0 0 + + + + + FormWidget::Right + + + + 8 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + - - - - Printer Margins... + + + + + + + + Qt::Horizontal - + + + 40 + 20 + + + - - + + - + 0 0 - - - 15 - 0 - - - + - - true + + FormWidget::Left - - Qt::ToolButtonIconOnly + + + 8 + - - true - + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -169,6 +337,12 @@ + FormWidget + QWidget +
ui/widgets/form_widget.h
+ 1 +
+ ScrSpinBox QDoubleSpinBox
ui/scrspinbox.h
@@ -186,12 +360,12 @@
presetLayoutComboBox + printerMarginsPushButton + topMarginSpinBox leftMarginSpinBox + marginLinkButton rightMarginSpinBox - topMarginSpinBox bottomMarginSpinBox - marginLinkButton - printerMarginsPushButton Index: scribus/ui/pagepropertiesdialog.cpp =================================================================== --- scribus/ui/pagepropertiesdialog.cpp (Revision 26196) +++ scribus/ui/pagepropertiesdialog.cpp (Arbeitskopie) @@ -17,7 +17,7 @@ #include "commonstrings.h" #include "iconmanager.h" -#include "marginwidget.h" +#include "newmarginwidget.h" #include "pagepropertiesdialog.h" #include "pagesize.h" #include "pagestructs.h" @@ -112,10 +112,13 @@ } dialogLayout->addWidget( dsGroupBox7 ); - marginWidget = new MarginWidget(this, tr( "Margin Guides" ), &doc->currentPage()->initialMargins, doc->unitIndex(), false, false); - marginWidget->setPageWidthHeight(doc->currentPage()->width(), doc->currentPage()->height()); +// marginWidget = new MarginWidget(this, tr( "Margin Guides" ), &doc->currentPage()->initialMargins, doc->unitIndex(), false, false); + marginWidget = new NewMarginWidget(); + marginWidget->setup(doc->currentPage()->initialMargins, doc->currentPage()->marginPreset, doc->unitIndex(), NewMarginWidget::MarginWidgetFlags ); + marginWidget->setPageHeight(doc->currentPage()->height()); + marginWidget->setPageWidth(doc->currentPage()->width()); marginWidget->setFacingPages(!(doc->pagePositioning() == singlePage), doc->locationOfPage(doc->currentPage()->pageNr())); - marginWidget->setMarginPreset(doc->currentPage()->marginPreset); +// marginWidget->setMarginPreset(doc->currentPage()->marginPreset); dialogLayout->addWidget( marginWidget ); groupMaster = new QGroupBox( this ); @@ -320,22 +323,22 @@ double PagePropertiesDialog::top() const { - return marginWidget->top(); + return marginWidget->margins().top(); } double PagePropertiesDialog::bottom() const { - return marginWidget->bottom(); + return marginWidget->margins().bottom(); } double PagePropertiesDialog::left() const { - return marginWidget->left(); + return marginWidget->margins().left(); } double PagePropertiesDialog::right() const { - return marginWidget->right(); + return marginWidget->margins().right(); } QString PagePropertiesDialog::masterPage() const @@ -347,5 +350,5 @@ int PagePropertiesDialog::getMarginPreset() const { - return marginWidget->getMarginPreset(); + return marginWidget->marginPreset(); } Index: scribus/ui/pagepropertiesdialog.h =================================================================== --- scribus/ui/pagepropertiesdialog.h (Revision 26196) +++ scribus/ui/pagepropertiesdialog.h (Arbeitskopie) @@ -20,7 +20,7 @@ class QHBoxLayout; class QVBoxLayout; class ScrSpinBox; -class MarginWidget; +class NewMarginWidget; class ScribusDoc; /*! \brief A dialog to setup the existing document margins. @@ -90,7 +90,7 @@ void setPageHeight(double v); private: - MarginWidget* marginWidget { nullptr }; + NewMarginWidget* marginWidget { nullptr }; QGroupBox* dsGroupBox7 { nullptr }; QGroupBox* groupMaster { nullptr }; QLabel* masterPageLabel { nullptr };