Subversion Repositories Scribus

Rev

Rev 6444 | Rev 6829 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6441 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
7
#include "multipleduplicate.h"
8
#include "multipleduplicate.moc"
9
 
10
#include <qbuttongroup.h>
11
#include <qlabel.h>
12
#include <qpushbutton.h>
6444 cbradney 13
#include <qradiobutton.h>
6441 cbradney 14
#include <qspinbox.h>
15
#include <qtabwidget.h>
16
 
17
#include "mspinbox.h"
18
#include "units.h"
19
 
20
MultipleDuplicate::MultipleDuplicate( int unitIndex, QWidget* parent, const char* name, WFlags fl )
21
        : MultipleDuplicateBase(parent, name, fl),
22
        m_unitIndex(unitIndex)
23
{
6444 cbradney 24
 
25
        //set tab order
26
        QWidget::setTabOrder(createGapRadioButton, horizShiftMSpinBox);
27
        QWidget::setTabOrder(horizShiftMSpinBox, vertShiftMSpinBox);
28
        QWidget::setTabOrder(gridColsSpinBox, horizRCGapMSpinBox);
29
        QWidget::setTabOrder(horizRCGapMSpinBox, vertRCGapMSpinBox);
30
 
31
        //set up mspinboxes
6441 cbradney 32
        int decimals = unitGetDecimalsFromIndex(unitIndex);
33
        QString unitSuffix(unitGetSuffixFromIndex(unitIndex));
34
        horizShiftMSpinBox->setValues(0.0, 1000.0, decimals, 0.0);
35
        vertShiftMSpinBox->setValues(0.0, 1000.0, decimals, 0.0);
36
        horizRCGapMSpinBox->setValues(0.0, 1000.0, decimals, 0.0);
37
        vertRCGapMSpinBox->setValues(0.0, 1000.0, decimals, 0.0);
38
        horizShiftMSpinBox->setSuffix(unitSuffix);
39
        vertShiftMSpinBox->setSuffix(unitSuffix);
40
        horizRCGapMSpinBox->setSuffix(unitSuffix);
41
        vertRCGapMSpinBox->setSuffix(unitSuffix);
42
 
43
        copiesCreateButtonGroup->setButton(0);
44
        // signals and slots connections
45
        connect(copiesCreateButtonGroup, SIGNAL(clicked(int)), this, SLOT(setCopiesShiftGap(int)));
46
}
47
 
48
MultipleDuplicate::~MultipleDuplicate()
49
{
50
}
51
 
52
void MultipleDuplicate::setCopiesShiftGap(int sel)
53
{
54
        if (sel==0)
55
        {
56
                horizShiftLabel->setText( tr("&Horizontal Shift:"));
57
                vertShiftLabel->setText( tr("&Vertical Shift:"));
58
        }
59
        else
60
        {
61
                horizShiftLabel->setText( tr("&Horizontal Gap:"));
62
                vertShiftLabel->setText( tr("&Vertical Gap:"));
63
        }
64
}
65
 
6657 cbradney 66
void MultipleDuplicate::getMultiplyData(ItemMultipleDuplicateData& mdData)
6441 cbradney 67
{
6657 cbradney 68
        mdData.type=tabWidget->currentPageIndex();
6441 cbradney 69
        mdData.copyCount=numberOfCopiesSpinBox->value();
70
        mdData.copyShiftOrGap=copiesCreateButtonGroup->selectedId();
71
        mdData.copyShiftGapH=horizShiftMSpinBox->value();
72
        mdData.copyShiftGapV=vertShiftMSpinBox->value();
73
        mdData.gridRows=gridRowsSpinBox->value();
74
        mdData.gridCols=gridColsSpinBox->value();
75
        mdData.gridGapH=horizRCGapMSpinBox->value();
76
        mdData.gridGapV=vertRCGapMSpinBox->value();
77
}