Back to index

scribus-ng  1.3.4.dfsg+svn20071115
multipleduplicate.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "multipleduplicate.h"
00008 #include "multipleduplicate.moc"
00009 
00010 #include <qbuttongroup.h>
00011 #include <qlabel.h>
00012 #include <qpushbutton.h>
00013 #include <qradiobutton.h>
00014 #include <qspinbox.h>
00015 #include <qtabwidget.h>
00016 
00017 #include "mspinbox.h"
00018 #include "units.h"
00019 
00020 MultipleDuplicate::MultipleDuplicate( int unitIndex, QWidget* parent, const char* name, WFlags fl )
00021        : MultipleDuplicateBase(parent, name, fl),
00022        m_unitIndex(unitIndex)
00023 {
00024 
00025        //set tab order
00026        QWidget::setTabOrder(createGapRadioButton, horizShiftMSpinBox);
00027        QWidget::setTabOrder(horizShiftMSpinBox, vertShiftMSpinBox);
00028        QWidget::setTabOrder(gridColsSpinBox, horizRCGapMSpinBox);
00029        QWidget::setTabOrder(horizRCGapMSpinBox, vertRCGapMSpinBox);
00030        QWidget::setTabOrder(vertRCGapMSpinBox, rotationMSpinBox);
00031        
00032        //set up mspinboxes
00033        int decimals = unitGetDecimalsFromIndex(unitIndex);
00034        QString unitSuffix(unitGetSuffixFromIndex(unitIndex));
00035        horizShiftMSpinBox->setValues(-1000.0, 1000.0, decimals, 0.0);
00036        vertShiftMSpinBox->setValues(-1000.0, 1000.0, decimals, 0.0);
00037        horizRCGapMSpinBox->setValues(-1000.0, 1000.0, decimals, 0.0);
00038        vertRCGapMSpinBox->setValues(-1000.0, 1000.0, decimals, 0.0);
00039        rotationMSpinBox->setValues(-180.0, 180.0, 10, 0.0);
00040        horizShiftMSpinBox->setSuffix(unitSuffix);
00041        vertShiftMSpinBox->setSuffix(unitSuffix);
00042        horizRCGapMSpinBox->setSuffix(unitSuffix);
00043        vertRCGapMSpinBox->setSuffix(unitSuffix);
00044        
00045        copiesCreateButtonGroup->setButton(0);
00046        // signals and slots connections
00047        connect(copiesCreateButtonGroup, SIGNAL(clicked(int)), this, SLOT(setCopiesShiftGap(int)));
00048 }
00049 
00050 MultipleDuplicate::~MultipleDuplicate()
00051 {
00052 }
00053 
00054 void MultipleDuplicate::setCopiesShiftGap(int sel)
00055 {
00056        if (sel==0)
00057        {
00058               horizShiftLabel->setText( tr("&Horizontal Shift:"));
00059               vertShiftLabel->setText( tr("&Vertical Shift:"));
00060        }
00061        else
00062        {
00063               horizShiftLabel->setText( tr("&Horizontal Gap:"));
00064               vertShiftLabel->setText( tr("&Vertical Gap:"));
00065        }
00066 }
00067 
00068 void MultipleDuplicate::getMultiplyData(ItemMultipleDuplicateData& mdData)
00069 {
00070        mdData.type = tabWidget->currentPageIndex();
00071        mdData.copyCount = numberOfCopiesSpinBox->value();
00072        mdData.copyShiftOrGap = copiesCreateButtonGroup->selectedId();
00073        mdData.copyShiftGapH = horizShiftMSpinBox->value();
00074        mdData.copyShiftGapV = vertShiftMSpinBox->value();
00075        mdData.copyRotation = rotationMSpinBox->value();
00076        mdData.gridRows = gridRowsSpinBox->value();
00077        mdData.gridCols = gridColsSpinBox->value();
00078        mdData.gridGapH = horizRCGapMSpinBox->value();
00079        mdData.gridGapV = vertRCGapMSpinBox->value();
00080 }