Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
12066 fschmid 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
/**************************************************************************
8
*   Copyright (C) 2007 by Franz Schmid                                    *
9
*   franz.schmid@altmuehlnet.de                                           *
10
*                                                                         *
11
*   This program is free software; you can redistribute it and/or modify  *
12
*   it under the terms of the GNU General Public License as published by  *
13
*   the Free Software Foundation; either version 2 of the License, or     *
14
*   (at your option) any later version.                                   *
15
*                                                                         *
16
*   This program is distributed in the hope that it will be useful,       *
17
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
19
*   GNU General Public License for more details.                          *
20
*                                                                         *
21
*   You should have received a copy of the GNU General Public License     *
22
*   along with this program; if not, write to the                         *
23
*   Free Software Foundation, Inc.,                                       *
24
*   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
25
***************************************************************************/
26
 
27
#include "pathdialog.h"
28
 
12577 fschmid 29
PathDialog::PathDialog(QWidget* parent, int unitIndex, bool group) : QDialog(parent)
12066 fschmid 30
{
31
        setupUi(this);
32
        setModal(true);
33
        effectType = 0;
34
        gap = 0.0;
35
        offset = 0.0;
36
        offsetY = 0.0;
12597 fschmid 37
        rotate = 0;
12066 fschmid 38
        offsetXSpin->setNewUnit(unitIndex);
39
        offsetYSpin->setNewUnit(unitIndex);
40
        offsetYSpin->setMinimum(-1000);
41
        offsetYSpin->setMaximum(1000);
42
        gapSpin->setNewUnit(unitIndex);
12577 fschmid 43
        if (group)
44
        {
45
                label_3->hide();
46
                gapSpin->hide();
47
                typeCombo->removeItem(3);
48
                typeCombo->removeItem(2);
49
                resize(minimumSizeHint());
50
        }
12713 fschmid 51
        typeCombo->setCurrentIndex(0);
52
        label_3->setEnabled(false);
53
        gapSpin->setEnabled(false);
12066 fschmid 54
        connect(offsetXSpin, SIGNAL(valueChanged(double)), this, SLOT(newOffset(double)));
55
        connect(offsetYSpin, SIGNAL(valueChanged(double)), this, SLOT(newOffsetY(double)));
56
        connect(gapSpin, SIGNAL(valueChanged(double)), this, SLOT(newGap(double)));
57
        connect(typeCombo, SIGNAL(activated(int)), this, SLOT(newType(int)));
58
        connect(previewCheck, SIGNAL(clicked()), this, SLOT(togglePreview()));
12597 fschmid 59
        connect(rotationCombo, SIGNAL(activated(int)), this, SLOT(toggleRotate(int)));
12066 fschmid 60
}
61
 
12597 fschmid 62
void PathDialog::toggleRotate(int rot)
12066 fschmid 63
{
12597 fschmid 64
        rotate = rot;
12066 fschmid 65
        if (previewCheck->isChecked())
66
                emit updateValues(effectType, offset, offsetY, gap, rotate);
67
}
68
 
69
void PathDialog::newOffsetY(double val)
70
{
71
        offsetY = val;
72
        if (previewCheck->isChecked())
73
                emit updateValues(effectType, offset, offsetY, gap, rotate);
74
}
75
 
76
void PathDialog::newOffset(double val)
77
{
78
        offset = val;
79
        if (previewCheck->isChecked())
80
                emit updateValues(effectType, offset, offsetY, gap, rotate);
81
}
82
 
83
void PathDialog::newGap(double val)
84
{
85
        gap = val;
86
        if (previewCheck->isChecked())
87
                emit updateValues(effectType, offset, offsetY, gap, rotate);
88
}
89
 
90
void PathDialog::newType(int val)
91
{
12713 fschmid 92
        bool setter = true;
12066 fschmid 93
        effectType = val;
94
        if (previewCheck->isChecked())
95
                emit updateValues(effectType, offset, offsetY, gap, rotate);
12713 fschmid 96
        if (effectType < 2)
97
                setter = false;
98
        label_3->setEnabled(setter);
99
        gapSpin->setEnabled(setter);
12066 fschmid 100
}
101
 
102
void PathDialog::togglePreview()
103
{
104
        if (previewCheck->isChecked())
105
                emit updateValues(effectType, offset, offsetY, gap, rotate);
106
        else
107
                emit updateValues(-1, offset, offsetY, gap, rotate);
108
}