Rev 12771 | 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., * |
||
18122 | mrdocs | 24 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * |
12066 | fschmid | 25 | ***************************************************************************/ |
26 | |||
27 | #include "pathdialog.h" |
||
28 | |||
12730 | fschmid | 29 | PathDialog::PathDialog(QWidget* parent, int unitIndex, double len, 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; |
12730 | fschmid | 38 | offsetYSpin->setMinimum(-len); |
39 | offsetYSpin->setMaximum(len); |
||
40 | offsetXSpin->setMinimum(-len); |
||
41 | offsetXSpin->setMaximum(len); |
||
12066 | fschmid | 42 | offsetXSpin->setNewUnit(unitIndex); |
43 | offsetYSpin->setNewUnit(unitIndex); |
||
44 | gapSpin->setNewUnit(unitIndex); |
||
12577 | fschmid | 45 | if (group) |
46 | { |
||
47 | label_3->hide(); |
||
48 | gapSpin->hide(); |
||
49 | typeCombo->removeItem(3); |
||
50 | typeCombo->removeItem(2); |
||
51 | resize(minimumSizeHint()); |
||
52 | } |
||
12713 | fschmid | 53 | typeCombo->setCurrentIndex(0); |
54 | label_3->setEnabled(false); |
||
55 | gapSpin->setEnabled(false); |
||
12066 | fschmid | 56 | connect(offsetXSpin, SIGNAL(valueChanged(double)), this, SLOT(newOffset(double))); |
57 | connect(offsetYSpin, SIGNAL(valueChanged(double)), this, SLOT(newOffsetY(double))); |
||
58 | connect(gapSpin, SIGNAL(valueChanged(double)), this, SLOT(newGap(double))); |
||
59 | connect(typeCombo, SIGNAL(activated(int)), this, SLOT(newType(int))); |
||
60 | connect(previewCheck, SIGNAL(clicked()), this, SLOT(togglePreview())); |
||
12597 | fschmid | 61 | connect(rotationCombo, SIGNAL(activated(int)), this, SLOT(toggleRotate(int))); |
12066 | fschmid | 62 | } |
63 | |||
12597 | fschmid | 64 | void PathDialog::toggleRotate(int rot) |
12066 | fschmid | 65 | { |
12597 | fschmid | 66 | rotate = rot; |
12066 | fschmid | 67 | if (previewCheck->isChecked()) |
68 | emit updateValues(effectType, offset, offsetY, gap, rotate); |
||
69 | } |
||
70 | |||
71 | void PathDialog::newOffsetY(double val) |
||
72 | { |
||
73 | offsetY = val; |
||
74 | if (previewCheck->isChecked()) |
||
75 | emit updateValues(effectType, offset, offsetY, gap, rotate); |
||
76 | } |
||
77 | |||
78 | void PathDialog::newOffset(double val) |
||
79 | { |
||
80 | offset = val; |
||
81 | if (previewCheck->isChecked()) |
||
82 | emit updateValues(effectType, offset, offsetY, gap, rotate); |
||
83 | } |
||
84 | |||
85 | void PathDialog::newGap(double val) |
||
86 | { |
||
87 | gap = val; |
||
88 | if (previewCheck->isChecked()) |
||
89 | emit updateValues(effectType, offset, offsetY, gap, rotate); |
||
90 | } |
||
91 | |||
92 | void PathDialog::newType(int val) |
||
93 | { |
||
94 | effectType = val; |
||
95 | if (previewCheck->isChecked()) |
||
96 | emit updateValues(effectType, offset, offsetY, gap, rotate); |
||
12771 | cbradney | 97 | bool setter = (effectType < 2) ? false : true; |
12713 | fschmid | 98 | label_3->setEnabled(setter); |
99 | gapSpin->setEnabled(setter); |
||
12066 | fschmid | 100 | } |
101 | |||
102 | void PathDialog::togglePreview() |
||
103 | { |
||
12771 | cbradney | 104 | int t = (previewCheck->isChecked()) ? effectType : -1; |
105 | emit updateValues(t, offset, offsetY, gap, rotate); |
||
12066 | fschmid | 106 | } |