Subversion Repositories Scribus

Rev

Rev 1065 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
879 fschmid 1
#include "tabguides.h"
2
#include "tabguides.moc"
3
#include <qlayout.h>
4
#include <qgroupbox.h>
5
#include <qlabel.h>
6
#include <qtooltip.h>
7
#include <qspinbox.h>
8
#include <qcolor.h>
9
#include <qcolordialog.h>
10
#include <qcheckbox.h>
11
#include <qpushbutton.h>
12
#include <qpixmap.h>
13
#include "mspinbox.h"
14
#include "scribusstructs.h"
15
 
16
TabGuides::TabGuides( QWidget* parent, struct guidesStruct *prefsData, double unitBase, QString unit) : QWidget( parent, "tabguide", 0 )
17
{
18
        tabGuidesLayout = new QVBoxLayout( this, 10, 5, "tabViewLayout");
19
        checkGrid = new QGroupBox( this, "checkGrid" );
20
        checkGrid->setTitle( tr( "Show Grid" ) );
21
        checkGrid->setCheckable( true );
22
        checkGrid->setChecked(prefsData->gridShown);
23
        checkGrid->setColumnLayout(0, Qt::Vertical );
24
        checkGrid->layout()->setSpacing( 5 );
25
        checkGrid->layout()->setMargin( 10 );
26
        checkGridLayout = new QGridLayout( checkGrid->layout() );
27
        checkGridLayout->setAlignment( Qt::AlignTop );
28
        groupBox1 = new QGroupBox( checkGrid, "groupBox1" );
29
        groupBox1->setColumnLayout(0, Qt::Vertical );
30
        groupBox1->layout()->setSpacing( 5 );
31
        groupBox1->layout()->setMargin( 10 );
32
        groupBox1->setTitle( tr( "Major Grid" ) );
33
        groupBox1Layout = new QGridLayout( groupBox1->layout() );
34
        groupBox1Layout->setAlignment( Qt::AlignTop );
35
        majorGridColor = new QPushButton( groupBox1, "majorGridColor" );
36
        majorGridColor->setMinimumSize( QSize( 60, 20 ) );
37
        majorGridColor->setMaximumSize( QSize( 60, 20 ) );
38
        majorGridColor->setFlat( false );
39
        majorGridColor->setAutoDefault( false );
40
        QPixmap pm1 = QPixmap(54, 14);
41
        pm1.fill(prefsData->majorColor);
42
        colorMajorGrid = prefsData->majorColor;
43
        majorGridColor->setPixmap(pm1);
44
        majorGridColor->setText( QString::null );
45
        groupBox1Layout->addWidget( majorGridColor, 1, 1 );
46
        textLabel4 = new QLabel( groupBox1, "textLabel4" );
47
        textLabel4->setText( tr( "Color:" ) );
48
        groupBox1Layout->addWidget( textLabel4, 1, 0 );
49
        textLabel6 = new QLabel( groupBox1, "textLabel6" );
50
        textLabel6->setText( tr( "Spacing:" ) );
51
        groupBox1Layout->addWidget( textLabel6, 0, 0 );
52
        majorSpace = new MSpinBox( 10 * unitBase, 1000 * unitBase, groupBox1, 2 );
53
        majorSpace->setValue( prefsData->majorGrid * unitBase );
54
        majorSpace->setSuffix( unit );
55
        groupBox1Layout->addWidget( majorSpace, 0, 1 );
56
        checkGridLayout->addWidget( groupBox1, 0, 0 );
57
        groupBox2 = new QGroupBox( checkGrid, "groupBox2" );
58
        groupBox2->setColumnLayout(0, Qt::Vertical );
59
        groupBox2->layout()->setSpacing( 5 );
60
        groupBox2->layout()->setMargin( 10 );
61
        groupBox2->setTitle( tr( "Minor Grid" ) );
62
        groupBox2Layout = new QGridLayout( groupBox2->layout() );
63
        groupBox2Layout->setAlignment( Qt::AlignTop );
64
        textLabel5 = new QLabel( groupBox2, "textLabel5" );
65
        textLabel5->setText( tr( "Color:" ) );
66
        groupBox2Layout->addWidget( textLabel5, 1, 0 );
67
        minorGridColor = new QPushButton( groupBox2, "minorGridColor" );
68
        minorGridColor->setMinimumSize( QSize( 60, 20 ) );
69
        minorGridColor->setMaximumSize( QSize( 60, 20 ) );
70
        minorGridColor->setFlat( false );
71
        minorGridColor->setAutoDefault( false );
72
        QPixmap pm = QPixmap(54, 14);
73
        pm.fill(prefsData->minorColor);
74
        colorMinorGrid = prefsData->minorColor;
75
        minorGridColor->setPixmap(pm);
76
        minorGridColor->setText( QString::null );
77
        groupBox2Layout->addWidget( minorGridColor, 1, 1 );
78
        textLabel7 = new QLabel( groupBox2, "textLabel7" );
79
        textLabel7->setText( tr( "Spacing:" ) );
80
        groupBox2Layout->addWidget( textLabel7, 0, 0 );
81
        minorSpace = new MSpinBox( unitBase, 1000 * unitBase, groupBox2, 2 );
82
        minorSpace->setValue( prefsData->minorGrid  * unitBase);
83
        minorSpace->setSuffix( unit );
84
        groupBox2Layout->addWidget( minorSpace, 0, 1 );
85
        checkGridLayout->addWidget( groupBox2, 0, 1 );
86
        tabGuidesLayout->addWidget( checkGrid );
87
        layout11 = new QGridLayout( 0, 1, 1, 0, 5, "layout11");
88
        textLabel8 = new QLabel( this, "textLabel8" );
89
        textLabel8->setText( tr( "Guide Snap Distance:" ) );
90
        layout11->addWidget( textLabel8, 0, 0 );
91
        snapDistance = new MSpinBox( unitBase, 1000 * unitBase, this, 2 );
92
        snapDistance->setValue( prefsData->guideRad * unitBase );
93
        snapDistance->setSuffix( unit );
94
        layout11->addWidget( snapDistance, 0, 1, Qt::AlignLeft );
95
        textLabel82 = new QLabel( this, "textLabel8" );
96
        textLabel82->setText( tr( "Grab Radius:" ) );
97
        layout11->addWidget( textLabel82, 1, 0 );
98
        grabDistance = new QSpinBox( this, "grabDistance" );
99
        grabDistance->setMaxValue( 1000 );
100
        grabDistance->setMinValue( 1 );
101
        grabDistance->setLineStep( 1 );
102
        grabDistance->setValue( prefsData->grabRad );
103
        grabDistance->setSuffix( tr( " px" ) );
104
        layout11->addWidget( grabDistance, 1, 1, Qt::AlignLeft );
105
 
106
        checkMargin = new QCheckBox( this, "checkMargin" );
107
        checkMargin->setText( tr( "Show Margins" ) );
108
        checkMargin->setChecked(prefsData->marginsShown);
109
        layout11->addWidget( checkMargin, 2, 0 );
110
        checkGuides = new QCheckBox( this, "checkGuides" );
111
        checkGuides->setText( tr( "Show Guides" ) );
112
        checkGuides->setChecked(prefsData->guidesShown);
113
        layout11->addWidget( checkGuides, 3, 0 );
114
        checkBaseline = new QCheckBox( this, "checkBaseline" );
115
        checkBaseline->setText( tr( "Show Baseline Grid" ) );
116
        checkBaseline->setChecked(prefsData->baseShown);
117
        layout11->addWidget( checkBaseline, 4, 0 );
118
        layout2 = new QHBoxLayout( 0, 0, 5, "layout2");
119
        textLabel2 = new QLabel( this, "textLabel2" );
120
        textLabel2->setText( tr( "Color:" ) );
121
        layout2->addWidget( textLabel2 );
122
        baselineColor = new QPushButton( this, "baselineColor" );
123
        baselineColor->setMinimumSize( QSize( 60, 20 ) );
124
        baselineColor->setMaximumSize( QSize( 60, 20 ) );
125
        baselineColor->setFlat( false );
126
        baselineColor->setAutoDefault( false );
127
        QPixmap pm4 = QPixmap(54, 14);
128
        pm4.fill(prefsData->baseColor);
129
        colorBaselineGrid = prefsData->baseColor;
130
        baselineColor->setPixmap(pm4);
131
        baselineColor->setText( QString::null );
132
        layout2->addWidget( baselineColor );
133
        layout11->addLayout( layout2, 4, 1 );
134
        layout3 = new QHBoxLayout( 0, 0, 5, "layout3");
135
        textLabel3 = new QLabel( this, "textLabel3" );
136
        textLabel3->setText( tr( "Color:" ) );
137
        layout3->addWidget( textLabel3 );
138
        guideColor = new QPushButton( this, "guideColor" );
139
        guideColor->setMinimumSize( QSize( 60, 20 ) );
140
        guideColor->setMaximumSize( QSize( 60, 20 ) );
141
        guideColor->setFlat( false );
142
        guideColor->setAutoDefault( false );
143
        QPixmap pm3 = QPixmap(54, 14);
144
        pm3.fill(prefsData->guideColor);
145
        colorGuides = prefsData->guideColor;
146
        guideColor->setPixmap(pm3);
147
        guideColor->setText( QString::null );
148
        layout3->addWidget( guideColor );
149
        layout11->addLayout( layout3, 3, 1 );
150
        layout9 = new QHBoxLayout( 0, 0, 5, "layout9");
151
        textLabel1 = new QLabel( this, "textLabel1" );
152
        textLabel1->setText( tr( "Color:" ) );
153
        layout9->addWidget( textLabel1 );
154
        marginColor = new QPushButton( this, "marginColor" );
155
        marginColor->setMinimumSize( QSize( 60, 20 ) );
156
        marginColor->setMaximumSize( QSize( 60, 20 ) );
157
        marginColor->setAutoDefault( false );
158
        QPixmap pm6 = QPixmap(54, 14);
159
        pm6.fill(prefsData->margColor);
160
        colorMargin = prefsData->margColor;
161
        marginColor->setPixmap(pm6);
162
        marginColor->setFlat( false );
163
        marginColor->setText( QString::null );
164
        layout9->addWidget( marginColor );
165
        layout11->addLayout( layout9, 2, 1 );
166
        tabGuidesLayout->addLayout( layout11 );
167
        layout12 = new QGridLayout( 0, 1, 1, 0, 5, "layout12");
168
        checkLink = new QCheckBox( this, "checkLink" );
169
        checkLink->setText( tr( "Show Text Chains" ) );
170
        checkLink->setChecked(prefsData->linkShown);
171
        layout12->addWidget( checkLink, 1, 0 );
172
        checkFrame = new QCheckBox( this, "checkFrame" );
173
        checkFrame->setText( tr( "Show Frames" ) );
174
        checkFrame->setChecked(prefsData->framesShown);
175
        layout12->addWidget( checkFrame, 0, 0 );
176
        checkPictures = new QCheckBox( this, "checkPictures" );
177
        checkPictures->setText( tr( "Show Pictures" ) );
178
        layout12->addWidget( checkPictures, 0, 1 );
179
        checkPictures->setChecked(prefsData->showPic);
180
        tabGuidesLayout->addLayout( layout12 );
181
        connect(majorGridColor, SIGNAL(clicked()), this, SLOT(changeMajorColor()));
182
        connect(minorGridColor, SIGNAL(clicked()), this, SLOT(changeMinorColor()));
183
        connect(baselineColor, SIGNAL(clicked()), this, SLOT(changeBaselineColor()));
184
        connect(guideColor, SIGNAL(clicked()), this, SLOT(changeGuideColor()));
185
        connect(marginColor, SIGNAL(clicked()), this, SLOT(changeMarginColor()));
186
        QToolTip::add( minorSpace, tr( "Distance between the minor grid lines" ) );
187
        QToolTip::add( majorSpace, tr( "Distance between the major grid lines" ) );
188
        QToolTip::add( snapDistance, tr( "Distance within which an object will snap to your placed guides" ) );
189
        QToolTip::add( grabDistance, tr( "Radius of the area where Scribus will allow you to grab an objects handles" ) );
190
        QToolTip::add( minorGridColor, tr( "Color of the minor grid lines" ) );
191
        QToolTip::add( majorGridColor, tr( "Color of the major grid lines" ) );
192
        QToolTip::add( guideColor, tr( "Color of the guide lines you insert" ) );
193
        QToolTip::add( marginColor, tr( "Color for the margin lines" ) );
194
        QToolTip::add( baselineColor, tr( "Color for the basegrid lines" ) );
195
        QToolTip::add( checkBaseline, tr("Turns the basegrid on or off"));
196
        QToolTip::add( checkGrid, tr("Turns the gridlines on or off"));
197
        QToolTip::add( checkGuides, tr("Turns the guides on or off"));
198
        QToolTip::add( checkMargin, tr("Turns the margins on or off"));
199
        QToolTip::add( checkLink, tr("Turns the of linked frames on or off"));
200
        QToolTip::add( checkFrame, tr("Turns the display of frames on or off"));
201
        QToolTip::add( checkPictures, tr("Turns the display of pictures on or off"));
202
}
203
 
204
void TabGuides::changeMajorColor()
205
{
206
        QColor neu = QColor();
207
        neu = QColorDialog::getColor(colorMajorGrid, this);
208
        if (neu.isValid())
209
        {
210
                QPixmap pm = QPixmap(54, 14);
211
                pm.fill(neu);
212
                colorMajorGrid = neu;
213
                majorGridColor->setPixmap(pm);
214
        }
215
}
216
 
217
void TabGuides::changeMinorColor()
218
{
219
        QColor neu = QColor();
220
        neu = QColorDialog::getColor(colorMinorGrid, this);
221
        if (neu.isValid())
222
        {
223
                QPixmap pm = QPixmap(54, 14);
224
                pm.fill(neu);
225
                colorMinorGrid = neu;
226
                minorGridColor->setPixmap(pm);
227
        }
228
}
229
 
230
void TabGuides::changeBaselineColor()
231
{
232
        QColor neu = QColor();
233
        neu = QColorDialog::getColor(colorBaselineGrid, this);
234
        if (neu.isValid())
235
        {
236
                QPixmap pm = QPixmap(54, 14);
237
                pm.fill(neu);
238
                colorBaselineGrid = neu;
239
                baselineColor->setPixmap(pm);
240
        }
241
}
242
 
243
void TabGuides::changeGuideColor()
244
{
245
        QColor neu = QColor();
246
        neu = QColorDialog::getColor(colorGuides, this);
247
        if (neu.isValid())
248
        {
249
                QPixmap pm = QPixmap(54, 14);
250
                pm.fill(neu);
251
                colorGuides = neu;
252
                guideColor->setPixmap(pm);
253
        }
254
}
255
 
256
void TabGuides::changeMarginColor()
257
{
258
        QColor neu = QColor();
259
        neu = QColorDialog::getColor(colorMargin, this);
260
        if (neu.isValid())
261
        {
262
                QPixmap pm = QPixmap(54, 14);
263
                pm.fill(neu);
264
                colorMargin = neu;
265
                marginColor->setPixmap(pm);
266
        }
267
}