Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
1195 fschmid 1
#include "tabtools.h"
2
#include "tabtools.moc"
3
#include <qtooltip.h>
4
#include <qspinbox.h>
5
#include "units.h"
6
#include "mspinbox.h"
7
#include "linecombo.h"
8
#include "fontcombo.h"
9
#include "polygonwidget.h"
10
#include "arrowchooser.h"
11
#include "linkbutton.h"
12
#include "scribusstructs.h"
13
#include "scribus.h"
14
extern QPixmap loadIcon(QString nam);
15
extern QPixmap fontSamples(QString da, int s, QString ts, QColor back);
16
extern double UmReFaktor;
17
extern ScribusApp* ScApp;
18
 
19
TabTools::TabTools( QWidget* parent, struct toolPrefs *prefsData, double unitBase, QString unit, ScribusDoc* doc) : QWidget( parent, "tabtools", 0 )
20
{
21
        fon = &ScApp->Prefs.AvailFonts;
22
        tabToolsLayout = new QHBoxLayout( this, 11, 6, "tabToolsLayout");
23
        buttonGroupTools = new QButtonGroup( this, "buttonGroupTools" );
24
        buttonGroupTools->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, buttonGroupTools->sizePolicy().hasHeightForWidth() ) );
25
        buttonGroupTools->setExclusive( true );
26
        buttonGroupTools->setRadioButtonExclusive( true );
27
        buttonGroupTools->setColumnLayout(0, Qt::Vertical );
28
        buttonGroupTools->layout()->setSpacing( 5 );
29
        buttonGroupTools->layout()->setMargin( 5 );
30
        buttonGroupTools->setTitle( QString::null );
31
        buttonGroupToolsLayout = new QVBoxLayout( buttonGroupTools->layout() );
32
        buttonGroupToolsLayout->setAlignment( Qt::AlignTop );
33
        toolText = new QToolButton( buttonGroupTools, "toolText" );
34
        toolText->setToggleButton( true );
35
        toolText->setText( QString::null );
36
        toolText->setIconSet( QIconSet( loadIcon("Text.xpm") ) );
37
        buttonGroupToolsLayout->addWidget( toolText );
38
        toolImage = new QToolButton( buttonGroupTools, "toolImage" );
39
        toolImage->setToggleButton( true );
40
        toolImage->setText( QString::null );
41
        toolImage->setIconSet( QIconSet( loadIcon("Bild.xpm") ) );
42
        buttonGroupToolsLayout->addWidget( toolImage );
43
        toolShape = new QToolButton( buttonGroupTools, "toolShape" );
44
        toolShape->setToggleButton( true );
45
        toolShape->setText( QString::null );
46
        toolShape->setIconSet( QIconSet( loadIcon("Rechtecke.xpm") ) );
47
        buttonGroupToolsLayout->addWidget( toolShape);
48
        toolPoly = new QToolButton( buttonGroupTools, "toolPoly" );
49
        toolPoly->setToggleButton( true );
50
        toolPoly->setText( QString::null );
51
        toolPoly->setIconSet( QIconSet( loadIcon("spline.png") ) );
52
        buttonGroupToolsLayout->addWidget( toolPoly );
53
        toolLine = new QToolButton( buttonGroupTools, "toolLine" );
54
        toolLine->setToggleButton( true );
55
        toolLine->setText( QString::null );
56
        toolLine->setIconSet( QIconSet( loadIcon("Stift.xpm") ) );
57
        buttonGroupToolsLayout->addWidget( toolLine );
58
        toolZoom = new QToolButton( buttonGroupTools, "toolZoom" );
59
        toolZoom->setToggleButton( true );
60
        toolZoom->setText( QString::null );
61
        toolZoom->setIconSet( QIconSet( loadIcon("Lupe.xpm") ) );
62
        buttonGroupToolsLayout->addWidget( toolZoom );
63
        tabToolsLayout->addWidget( buttonGroupTools );
64
        subStackTools = new QWidgetStack( this, "subStackTools" );
65
        subStackTools->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, subStackTools->sizePolicy().hasHeightForWidth() ) );
66
        subStackTools->setFrameShape( QWidgetStack::GroupBoxPanel );
67
        subStackTools->setFrameShadow( QWidgetStack::Sunken );
68
 
69
        subTabText = new QWidget( subStackTools, "subTabText" );
70
        subTabTextLayout = new QGridLayout( subTabText, 1, 1, 11, 6, "subTabTextLayout");
71
        fontComboText = new FontCombo(subTabText, &ScApp->Prefs);
72
        for (int fc=0; fc<fontComboText->count(); ++fc)
73
        {
74
                if (fontComboText->text(fc) == prefsData->defFont)
75
                {
76
                        fontComboText->setCurrentItem(fc);
77
                        break;
78
                }
79
        }
80
        subTabTextLayout->addMultiCellWidget( fontComboText, 0, 0, 1, 3, Qt::AlignLeft );
81
        textLabel1b = new QLabel( fontComboText, tr( "Font:" ), subTabText, "textLabel1b" );
82
        subTabTextLayout->addWidget( textLabel1b, 0, 0 );
83
        sizeComboText = new QComboBox( true, subTabText, "SizeCombo" );
84
        sizeComboText->setEditable(false);
85
        QString ar_sizes[] = {" 7", " 9", "10", "11", "12", "14", "18", "24", "36", "48", "60", "72"};
86
        size_t f_size = sizeof(ar_sizes) / sizeof(*ar_sizes);
87
        for (uint s = 0; s < f_size; ++s)
88
                sizeComboText->insertItem(ar_sizes[s] + tr(" pt"));
89
        for (int a = 0; a < sizeComboText->count(); ++a)
90
        {
91
                if (sizeComboText->text(a).left(2).toInt() == prefsData->defSize / 10)
92
                        sizeComboText->setCurrentItem(a);
93
        }
94
        subTabTextLayout->addMultiCellWidget( sizeComboText, 1, 1, 1, 3, Qt::AlignLeft );
95
        textLabel2b = new QLabel(sizeComboText, tr( "Size:" ), subTabText, "textLabel2b" );
96
        subTabTextLayout->addWidget( textLabel2b, 1, 0 );
97
        colorComboText = new QComboBox( true, subTabText, "colorComboText" );
98
        colorComboText->setEditable(false);
99
        QPixmap pmT2;
100
        pmT2 = QPixmap(15, 15);
101
        ColorList::Iterator itc;
102
        colorComboText->insertItem( tr("None"));
103
        if (prefsData->dPenText == "None")
104
                colorComboText->setCurrentItem(colorComboText->count()-1);
105
        if (doc != 0)
106
        {
107
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
108
                {
109
                        pmT2.fill(doc->PageColors[itc.key()].getRGBColor());
110
                        colorComboText->insertItem(pmT2, itc.key());
111
                        if (itc.key() == prefsData->dPenText)
112
                                colorComboText->setCurrentItem(colorComboText->count()-1);
113
                }
114
        }
115
        else
116
        {
117
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
118
                {
119
                        pmT2.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
120
                        colorComboText->insertItem(pmT2, itc.key());
121
                        if (itc.key() == prefsData->dPenText)
122
                                colorComboText->setCurrentItem(colorComboText->count()-1);
123
                }
124
        }
125
        subTabTextLayout->addMultiCellWidget( colorComboText, 2, 2, 1, 3, Qt::AlignLeft );
126
        textLabel3b = new QLabel(colorComboText, tr( "Fill Color:" ), subTabText, "textLabel3b" );
127
        subTabTextLayout->addWidget( textLabel3b, 2, 0 );
128
        colorComboStrokeText = new QComboBox( true, subTabText, "colorComboStrokeText" );
129
        colorComboStrokeText->setEditable(false);
130
        colorComboStrokeText->insertItem( tr("None"));
131
        if (prefsData->dStrokeText == "None")
132
                colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
133
        if (doc != 0)
134
        {
135
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
136
                {
137
                        pmT2.fill(doc->PageColors[itc.key()].getRGBColor());
138
                        colorComboStrokeText->insertItem(pmT2, itc.key());
139
                        if (itc.key() == prefsData->dStrokeText)
140
                                colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
141
                }
142
        }
143
        else
144
        {
145
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
146
                {
147
                        pmT2.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
148
                        colorComboStrokeText->insertItem(pmT2, itc.key());
149
                        if (itc.key() == prefsData->dStrokeText)
150
                                colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
151
                }
152
        }
153
        subTabTextLayout->addMultiCellWidget( colorComboStrokeText, 3, 3, 1, 3, Qt::AlignLeft );
154
        textLabel3b2 = new QLabel(colorComboStrokeText, tr( "Stroke Color:" ), subTabText, "textLabel3b2" );
155
        subTabTextLayout->addWidget( textLabel3b2, 3, 0 );
156
        columnsText = new QSpinBox( subTabText, "columnsText" );
157
        columnsText->setMinValue( 1 );
158
        columnsText->setMaxValue(100);
159
        columnsText->setValue(prefsData->dCols);
160
        subTabTextLayout->addWidget( columnsText, 4, 1, Qt::AlignLeft );
161
        textLabel4b = new QLabel(columnsText, tr("Colu&mns:"), subTabText, "TextCol");
162
        subTabTextLayout->addWidget( textLabel4b, 4, 0 );
163
        gapText = new MSpinBox( 0, 200, subTabText, 2 );
164
        gapText->setSuffix( unit );
165
        gapText->setValue(prefsData->dGap * unitBase);
166
        subTabTextLayout->addWidget( gapText, 4, 3, Qt::AlignLeft );
167
        textLabel5b = new QLabel(gapText, tr("&Gap:"), subTabText, "TextCol");
168
        subTabTextLayout->addWidget( textLabel5b, 4, 2 );
169
        previewText = new QLabel( tr( "Woven silk pyjamas exchanged for blue quartz" ), subTabText, "previewText" );
170
        previewText->setMinimumSize( QSize( 280, 70 ) );
171
        previewText->setAlignment( static_cast<int>( QLabel::AlignVCenter | QLabel::AlignLeft ) );
172
        subTabTextLayout->addMultiCellWidget( previewText, 5, 5, 0, 3 );
173
        subStackTools->addWidget( subTabText, 0 );
174
 
175
        subTabShape = new QWidget( subStackTools, "subTabShape" );
176
        subTabShapeLayout = new QGridLayout( subTabShape, 1, 1, 11, 6, "subTabShapeLayout");
177
        subTabShapeLayout->setAlignment( Qt::AlignTop );
178
        colorComboLineShape = new QComboBox( true, subTabShape, "colorComboLineShape" );
179
        colorComboLineShape->setEditable(false);
180
        colorComboLineShape->insertItem( tr("None"));
181
        if (prefsData->dPen == "None")
182
                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
183
        QPixmap pm2S = QPixmap(15, 15);
184
        if (doc != 0)
185
        {
186
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
187
                {
188
                        pm2S.fill(doc->PageColors[itc.key()].getRGBColor());
189
                        colorComboLineShape->insertItem(pm2S, itc.key());
190
                        if (itc.key() == prefsData->dPen)
191
                                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
192
                }
193
        }
194
        else
195
        {
196
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
197
                {
198
                        pm2S.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
199
                        colorComboLineShape->insertItem(pm2S, itc.key());
200
                        if (itc.key() == prefsData->dPen)
201
                                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
202
                }
203
        }
204
        subTabShapeLayout->addWidget( colorComboLineShape, 0, 1, Qt::AlignLeft );
205
        textLabel7b = new QLabel( colorComboLineShape, tr( "&Line Color:" ), subTabShape, "textLabel7b" );
206
        subTabShapeLayout->addWidget( textLabel7b, 0, 0 );
207
        shadingLineShape = new QSpinBox( subTabShape, "shadingLineShape" );
208
        shadingLineShape->setMaxValue( 100 );
209
        shadingLineShape->setSuffix( tr( " %" ) );
210
        shadingLineShape->setMinValue( 0 );
211
        shadingLineShape->setValue(prefsData->dShade2);
212
        subTabShapeLayout->addWidget( shadingLineShape, 1, 1, Qt::AlignLeft );
213
        textLabel8b = new QLabel( shadingLineShape, tr( "&Shading:" ), subTabShape, "textLabel8b" );
214
        subTabShapeLayout->addWidget( textLabel8b, 1, 0 );
215
        comboFillShape = new QComboBox( true, subTabShape, "comboFillShape" );
216
        comboFillShape->setEditable(false);
217
        comboFillShape->insertItem( tr("None"));
218
        if (prefsData->dBrush == "None")
219
                comboFillShape->setCurrentItem(comboFillShape->count()-1);
220
        if (doc != 0)
221
        {
222
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
223
                {
224
                        pm2S.fill(doc->PageColors[itc.key()].getRGBColor());
225
                        comboFillShape->insertItem(pm2S, itc.key());
226
                        if (itc.key() == prefsData->dBrush)
227
                                comboFillShape->setCurrentItem(comboFillShape->count()-1);
228
                }
229
        }
230
        else
231
        {
232
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
233
                {
234
                        pm2S.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
235
                        comboFillShape->insertItem(pm2S, itc.key());
236
                        if (itc.key() == prefsData->dBrush)
237
                                comboFillShape->setCurrentItem(comboFillShape->count()-1);
238
                }
239
        }
240
        subTabShapeLayout->addWidget( comboFillShape, 2, 1, Qt::AlignLeft );
241
        textLabel9b = new QLabel( comboFillShape, tr( "&Fill Color:" ), subTabShape, "textLabel9b" );
242
        subTabShapeLayout->addWidget( textLabel9b, 2, 0 );
243
        shadingFillShape = new QSpinBox( subTabShape, "shadingFillShape" );
244
        shadingFillShape->setMaxValue( 100 );
245
        shadingFillShape->setSuffix( tr( " %" ) );
246
        shadingFillShape->setMinValue( 0 );
247
        shadingFillShape->setValue(prefsData->dShade);
248
        subTabShapeLayout->addWidget( shadingFillShape, 3, 1, Qt::AlignLeft );
249
        textLabel10b = new QLabel( shadingFillShape, tr( "S&hading:" ), subTabShape, "textLabel10b" );
250
        subTabShapeLayout->addWidget( textLabel10b, 3, 0 );
251
        comboStyleShape = new LineCombo(subTabShape);
252
        comboStyleShape->setEditable(false);
253
        switch (prefsData->dLineArt)
254
        {
255
        case SolidLine:
256
                comboStyleShape->setCurrentItem(0);
257
                break;
258
        case DashLine:
259
                comboStyleShape->setCurrentItem(1);
260
                break;
261
        case DotLine:
262
                comboStyleShape->setCurrentItem(2);
263
                break;
264
        case DashDotLine:
265
                comboStyleShape->setCurrentItem(3);
266
                break;
267
        case DashDotDotLine:
268
                comboStyleShape->setCurrentItem(4);
269
                break;
270
        default:
271
                comboStyleShape->setCurrentItem(0);
272
                break;
273
        }
274
        subTabShapeLayout->addWidget( comboStyleShape, 4, 1, Qt::AlignLeft );
275
        textLabel11b = new QLabel( comboStyleShape, tr( "Line Style:" ), subTabShape, "textLabel11b" );
276
        subTabShapeLayout->addWidget( textLabel11b, 4, 0 );
277
        lineWidthShape = new MSpinBox( 0, 36, subTabShape, 1 );
278
        lineWidthShape->setSuffix( tr( " pt" ) );
279
        lineWidthShape->setValue(prefsData->dWidth);
280
        subTabShapeLayout->addWidget( lineWidthShape, 5, 1, Qt::AlignLeft );
281
        textLabel12b = new QLabel( lineWidthShape, tr( "Line &Width:" ), subTabShape, "TextLabel2_3_4" );
282
        subTabShapeLayout->addWidget( textLabel12b, 5, 0 );
283
        subStackTools->addWidget( subTabShape, 1 );
284
 
285
        subTabLine = new QWidget( subStackTools, "subTabLine" );
286
        subTabLineLayout = new QGridLayout( subTabLine, 1, 1, 11, 6, "subTabLineLayout");
287
        subTabLineLayout->setAlignment( Qt::AlignTop );
288
        colorComboLine = new QComboBox( true, subTabLine, "colorComboLine" );
289
        colorComboLine->setEditable(false);
290
        QPixmap pm2L = QPixmap(15, 15);
291
        colorComboLine->insertItem( tr("None"));
292
        if (prefsData->dPenLine == "None")
293
                colorComboLine->setCurrentItem(colorComboLine->count()-1);
294
        if (doc != 0)
295
        {
296
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
297
                {
298
                        pm2L.fill(doc->PageColors[itc.key()].getRGBColor());
299
                        colorComboLine->insertItem(pm2L, itc.key());
300
                        if (itc.key() == prefsData->dPenLine)
301
                                colorComboLine->setCurrentItem(colorComboLine->count()-1);
302
                }
303
        }
304
        else
305
        {
306
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
307
                {
308
                        pm2L.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
309
                        colorComboLine->insertItem(pm2L, itc.key());
310
                        if (itc.key() == prefsData->dPenLine)
311
                                colorComboLine->setCurrentItem(colorComboLine->count()-1);
312
                }
313
        }
314
        subTabLineLayout->addMultiCellWidget( colorComboLine, 0, 0, 1, 2, Qt::AlignLeft );
315
        textLabel13b = new QLabel(colorComboLine, tr("&Line Color:"), subTabLine, "textLabel13b" );
316
        subTabLineLayout->addWidget( textLabel13b, 0, 0 );
317
        shadingLine = new QSpinBox( subTabLine, "shadingLine" );
318
        shadingLine->setMaxValue( 100 );
319
        shadingLine->setValue(prefsData->dShadeLine);
320
        shadingLine->setSuffix( tr( " %" ) );
321
        subTabLineLayout->addMultiCellWidget( shadingLine, 1, 1, 1, 2, Qt::AlignLeft );
322
        textLabel14b = new QLabel(shadingLine, tr("&Shading:"), subTabLine, "textLabel14b" );
323
        subTabLineLayout->addWidget( textLabel14b, 1, 0 );
324
        comboStyleLine = new LineCombo(subTabLine);
325
        comboStyleLine->setEditable(false);
326
        switch (prefsData->dLstyleLine)
327
        {
328
        case SolidLine:
329
                comboStyleLine->setCurrentItem(0);
330
                break;
331
        case DashLine:
332
                comboStyleLine->setCurrentItem(1);
333
                break;
334
        case DotLine:
335
                comboStyleLine->setCurrentItem(2);
336
                break;
337
        case DashDotLine:
338
                comboStyleLine->setCurrentItem(3);
339
                break;
340
        case DashDotDotLine:
341
                comboStyleLine->setCurrentItem(4);
342
                break;
343
        default:
344
                comboStyleLine->setCurrentItem(0);
345
                break;
346
        }
347
        subTabLineLayout->addMultiCellWidget( comboStyleLine, 2, 2, 1, 2, Qt::AlignLeft );
348
        textLabel15b = new QLabel(subTabLine, tr("Line S&tyle:"), subTabLine, "textLabel15b" );
349
        subTabLineLayout->addWidget( textLabel15b, 2, 0 );
350
        startArrow = new ArrowChooser(subTabLine, true);
351
        subTabLineLayout->addWidget( startArrow, 4, 1 );
352
        endArrow = new ArrowChooser(subTabLine, false);
353
        subTabLineLayout->addWidget( endArrow, 4, 2 );
354
        if (doc != 0)
355
        {
356
                startArrow->rebuildList(&doc->arrowStyles);
357
                endArrow->rebuildList(&doc->arrowStyles);
358
        }
359
        else
360
        {
361
                startArrow->rebuildList(&ScApp->Prefs.arrowStyles);
362
                endArrow->rebuildList(&ScApp->Prefs.arrowStyles);
363
        }
364
        startArrow->setCurrentItem(prefsData->dStartArrow);
365
        endArrow->setCurrentItem(prefsData->dEndArrow);
366
        arrowText = new QLabel( tr( "Arrows:" ), subTabLine, "arrowText" );
367
        subTabLineLayout->addMultiCellWidget( arrowText, 3, 4, 0, 0 );
368
        startArrowText = new QLabel( startArrow, tr( "Start:" ), subTabLine, "startArrowText" );
369
        subTabLineLayout->addWidget( startArrowText, 3, 1 );
370
        endArrowText = new QLabel( endArrow, tr( "End:" ), subTabLine, "endArrowText" );
371
        subTabLineLayout->addWidget( endArrowText, 3, 2 );
372
        lineWidthLine = new MSpinBox( 1, 36, subTabLine, 1 );
373
        lineWidthLine->setSuffix( tr( " pt" ) );
374
        lineWidthLine->setValue(prefsData->dWidthLine);
375
        subTabLineLayout->addMultiCellWidget( lineWidthLine, 5, 5, 1, 2, Qt::AlignLeft );
376
        textLabel16b = new QLabel(lineWidthLine, tr("Line &Width:"), subTabLine, "textLabel16b" );
377
        subTabLineLayout->addWidget( textLabel16b, 5, 0 );
378
        subStackTools->addWidget( subTabLine, 2 );
379
 
380
        subTabImage = new QWidget( subStackTools, "subTabImage" );
381
        subTabImageLayout = new QGridLayout( subTabImage, 1, 1, 11, 6, "subTabImageLayout");
382
        subTabImageLayout->setAlignment( Qt::AlignTop );
383
        buttonGroup3 = new QButtonGroup( subTabImage, "buttonGroup3" );
384
        buttonGroup3->setCheckable( true );
385
        buttonGroup3->setChecked( prefsData->scaleType );
386
        buttonGroup3->setColumnLayout(0, Qt::Vertical );
387
        buttonGroup3->layout()->setSpacing( 6 );
388
        buttonGroup3->layout()->setMargin( 11 );
389
        buttonGroup3->setTitle( tr( "&Free Scaling" ) );
390
        buttonGroup3Layout = new QGridLayout( buttonGroup3->layout() );
391
        buttonGroup3Layout->setAlignment( Qt::AlignTop );
392
        scalingHorizontal = new QSpinBox( buttonGroup3, "scalingHorizontal" );
393
        scalingHorizontal->setMaxValue( 1000 );
394
        scalingHorizontal->setMinValue( 1 );
395
        scalingHorizontal->setValue(qRound(prefsData->scaleX * 100));
396
        scalingHorizontal->setSuffix( tr( " %" ) );
397
        buttonGroup3Layout->addWidget( scalingHorizontal, 0, 1, Qt::AlignRight );
398
        textLabel17b = new QLabel(scalingHorizontal, tr("&Horizontal Scaling:"), buttonGroup3, "textLabel17b" );
399
        buttonGroup3Layout->addWidget( textLabel17b, 0, 0 );
400
        scalingVertical = new QSpinBox( buttonGroup3, "scalingVertical" );
401
        scalingVertical->setMaxValue( 1000 );
402
        scalingVertical->setMinValue( 1 );
403
        scalingVertical->setSuffix( tr( " %" ) );
404
        scalingVertical->setValue(qRound(prefsData->scaleY * 100));
405
        buttonGroup3Layout->addWidget( scalingVertical, 1, 1, Qt::AlignRight );
406
        textLabel18b = new QLabel(scalingVertical, tr( "&Vertical Scaling:" ), buttonGroup3, "textLabel18b" );
407
        buttonGroup3Layout->addWidget( textLabel18b, 1, 0 );
408
        chainButton = new LinkButton( buttonGroup3 );
409
        chainButton->setToggleButton( true );
410
        chainButton->setAutoRaise(true);
411
        buttonGroup3Layout->addMultiCellWidget( chainButton, 0, 1, 2, 2, Qt::AlignLeft );
412
        subTabImageLayout->addMultiCellWidget( buttonGroup3, 0, 0, 0, 1 );
413
        buttonGroup5 = new QButtonGroup( subTabImage, "buttonGroup5" );
414
        buttonGroup5->setCheckable( true );
415
        buttonGroup5->setChecked( !prefsData->scaleType );
416
        buttonGroup5->setColumnLayout(0, Qt::Vertical );
417
        buttonGroup5->layout()->setSpacing( 6 );
418
        buttonGroup5->layout()->setMargin( 11 );
419
        buttonGroup5->setTitle( tr( "&Scale Picture to Frame Size" ) );
420
        buttonGroup5Layout = new QHBoxLayout( buttonGroup5->layout() );
421
        buttonGroup5Layout->setAlignment( Qt::AlignTop );
422
        checkRatioImage = new QCheckBox( buttonGroup5, "checkRatioImage" );
423
        checkRatioImage->setText( tr( "Keep Aspect &Ratio" ) );
424
        checkRatioImage->setChecked(prefsData->aspectRatio);
425
        buttonGroup5Layout->addWidget( checkRatioImage );
426
        subTabImageLayout->addMultiCellWidget( buttonGroup5, 1, 1, 0, 1 );
427
        comboFillImage = new QComboBox( true, subTabImage, "comboFillImage" );
428
        comboFillImage->setEditable(false);
429
        QPixmap pm2I = QPixmap(15, 15);
430
        comboFillImage->insertItem( tr("None"));
431
        if (prefsData->dBrushPict == "None")
432
                comboFillImage->setCurrentItem(comboFillImage->count()-1);
433
        if (doc != 0)
434
        {
435
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
436
                {
437
                        pm2I.fill(doc->PageColors[itc.key()].getRGBColor());
438
                        comboFillImage->insertItem(pm2I, itc.key());
439
                        if (itc.key() == prefsData->dBrushPict)
440
                                comboFillImage->setCurrentItem(comboFillImage->count()-1);
441
                }
442
        }
443
        else
444
        {
445
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
446
                {
447
                        pm2I.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
448
                        comboFillImage->insertItem(pm2I, itc.key());
449
                        if (itc.key() == prefsData->dBrushPict)
450
                                comboFillImage->setCurrentItem(comboFillImage->count()-1);
451
                }
452
        }
453
        subTabImageLayout->addWidget( comboFillImage, 2, 1, Qt::AlignLeft );
454
        textLabel19b = new QLabel(comboFillImage, tr( "F&ill Color:" ), subTabImage, "textLabel19b" );
455
        subTabImageLayout->addWidget( textLabel19b, 2, 0 );
456
        shadingFillImage = new QSpinBox( subTabImage, "shadingFillImage" );
457
        shadingFillImage->setMaxValue( 100 );
458
        shadingFillImage->setValue( prefsData->shadePict );
459
        shadingFillImage->setSuffix( tr( " %" ) );
460
        subTabImageLayout->addWidget( shadingFillImage, 3, 1, Qt::AlignLeft );
461
        textLabel20b = new QLabel(shadingFillImage, tr( "S&hading:" ), subTabImage, "textLabel20b" );
462
        subTabImageLayout->addWidget( textLabel20b, 3, 0 );
463
        subStackTools->addWidget( subTabImage, 3 );
464
 
465
        subTabPolygon = new QWidget( subStackTools, "subTabPolygon" );
466
        subTabPolygonLayout = new QHBoxLayout( subTabPolygon, 11, 6, "subTabPolygonLayout");
467
        subTabPolygonLayout->setAlignment( Qt::AlignTop );
468
        polyWidget = new PolygonWidget(subTabPolygon, prefsData->polyC, prefsData->polyFd, prefsData->polyF, prefsData->polyS, prefsData->polyR);
469
        subTabPolygonLayout->addWidget( polyWidget );
470
        subStackTools->addWidget( subTabPolygon, 4 );
471
 
472
        subTabZoom = new QWidget( subStackTools, "subTabZoom" );
473
        subTabZoomLayout = new QGridLayout( subTabZoom, 1, 1, 11, 6, "subTabZoomLayout");
474
        subTabZoomLayout->setAlignment( Qt::AlignTop );
475
        minimumZoom = new QSpinBox( subTabZoom, "minimumZoom" );
476
        minimumZoom->setMaxValue( 3200 );
477
        minimumZoom->setMinValue( 10 );
478
        minimumZoom->setValue(prefsData->magMin);
479
        minimumZoom->setSuffix( tr( " %" ) );
480
        subTabZoomLayout->addWidget( minimumZoom, 0, 1, Qt::AlignLeft );
481
        textLabel21b = new QLabel( minimumZoom, tr( "Mi&nimum:" ), subTabZoom, "textLabel21b" );
482
        subTabZoomLayout->addWidget( textLabel21b, 0, 0);
483
        maximumZoom = new QSpinBox( subTabZoom, "maximumZoom" );
484
        maximumZoom->setMaxValue( 3200 );
485
        maximumZoom->setMinValue( 10 );
486
        maximumZoom->setValue(prefsData->magMax);
487
        maximumZoom->setSuffix( tr( " %" ) );
488
        subTabZoomLayout->addWidget( maximumZoom, 1, 1, Qt::AlignLeft );
489
        textLabel22b = new QLabel( maximumZoom, tr( "Ma&ximum:" ), subTabZoom, "textLabel22b" );
490
        subTabZoomLayout->addWidget( textLabel22b, 1, 0 );
491
        zoomStep = new QSpinBox( subTabZoom, "zoomStep" );
492
        zoomStep->setMaxValue( 200 );
493
        zoomStep->setMinValue( 1 );
494
        zoomStep->setLineStep( 25 );
495
        zoomStep->setValue( prefsData->magStep );
496
        zoomStep->setSuffix( tr( " %" ) );
497
        subTabZoomLayout->addWidget( zoomStep, 2, 1, Qt::AlignLeft );
498
        textLabel23b = new QLabel( zoomStep, tr( "&Stepping:" ), subTabZoom, "textLabel23b" );
499
        subTabZoomLayout->addWidget( textLabel23b, 2, 0 );
500
        subStackTools->addWidget( subTabZoom, 5 );
501
        tabToolsLayout->addWidget( subStackTools );
502
        toolText->setOn(true);
503
        setSample();
504
        QToolTip::add( toolText, tr( "Text Frame Properties" ) );
505
        QToolTip::add( toolImage, tr( "Picture Frame Properties" ) );
506
        QToolTip::add( toolShape, tr( "Shape Drawing Properties" ) );
507
        QToolTip::add( toolZoom, tr( "Magnification Level Defaults" ) );
508
        QToolTip::add( toolLine, tr( "Line Drawing Properties" ) );
509
        QToolTip::add( toolPoly, tr( "Polygon Drawing Properties" ) );
510
        QToolTip::add( fontComboText, tr( "Font for new text frames" ) );
511
        QToolTip::add( sizeComboText, tr( "Size of font for new text frames" ) );
512
        QToolTip::add( colorComboText, tr( "Color of font" ) );
513
        QToolTip::add( columnsText, tr( "Number of columns in a text frame" ) );
514
        QToolTip::add( gapText, tr( "Gap between text frame columns" ) );
515
        QToolTip::add( previewText, tr( "Sample of your font" ) );
516
        QToolTip::add( buttonGroup3, tr( "Picture frames allow pictures to scale to any size" ) );
517
        QToolTip::add( scalingHorizontal, tr( "Horizontal scaling of images" ) );
518
        QToolTip::add( scalingVertical, tr( "Vertical scaling of images" ) );
519
        QToolTip::add( chainButton, tr( "Keep horizontal and vertical scaling the same" ) );
520
        QToolTip::add( buttonGroup5, tr( "Pictures in picture frames are scaled to the size of the frame" ) );
521
        QToolTip::add( checkRatioImage, tr( "Automatically scaled pictures keep their original proportions" ) );
522
        QToolTip::add( comboFillImage, tr( "Fill color of picture frames" ) );
523
        QToolTip::add( shadingFillImage, tr( "Saturation of color of fill" ) );
524
        QToolTip::add( colorComboLineShape, tr( "Line color of shapes" ) );
525
        QToolTip::add( shadingLineShape, tr( "Saturation of color of lines" ) );
526
        QToolTip::add( comboFillShape, tr( "Fill color of shapes" ) );
527
        QToolTip::add( shadingFillShape, tr( "Saturation of color of fill" ) );
528
        QToolTip::add( comboStyleShape, tr( "Line style of shapes" ) );
529
        QToolTip::add( lineWidthShape, tr( "Line width of shapes" ) );
530
        QToolTip::add( minimumZoom, tr( "Minimum magnification allowed" ) );
531
        QToolTip::add( maximumZoom, tr( "Maximum magnification allowed" ) );
532
        QToolTip::add( zoomStep, tr( "Change in magnification for each zoom operation" ) );
533
        QToolTip::add( colorComboLine, tr( "Color of lines" ) );
534
        QToolTip::add( shadingLine, tr( "Saturation of color" ) );
535
        QToolTip::add( comboStyleLine, tr( "Style of lines" ) );
536
        QToolTip::add( lineWidthLine, tr( "Width of lines" ) );
537
        connect(toolShape, SIGNAL(clicked()), this, SLOT(setTool()));
538
        connect(toolPoly, SIGNAL(clicked()), this, SLOT(setTool()));
539
        connect(toolImage, SIGNAL(clicked()), this, SLOT(setTool()));
540
        connect(toolText, SIGNAL(clicked()), this, SLOT(setTool()));
541
        connect(toolLine, SIGNAL(clicked()), this, SLOT(setTool()));
542
        connect(toolZoom, SIGNAL(clicked()), this, SLOT(setTool()));
543
        connect(fontComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
544
        connect(sizeComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
545
        connect(buttonGroup3, SIGNAL(clicked(int)), this, SLOT(changeImageScalingFree(int)));
546
        connect(buttonGroup5, SIGNAL(clicked(int)), this, SLOT(changeImageScalingRatio(int)));
547
        connect(chainButton, SIGNAL(clicked()), this, SLOT(toggleChain()));
548
        connect(scalingHorizontal, SIGNAL(valueChanged(int)), this, SLOT(hChange()));
549
        connect(scalingVertical, SIGNAL(valueChanged(int)), this, SLOT(vChange()));
550
}
551
 
552
/*!
553
 \fn void TabTools::ToggleKette()
554
 \author Franz Schmid
555
 \date  
556
 \brief TabTools (Tools, Image Frame), Sets Y Scale value from X Scale value when chain is toggled
557
 \param None
558
 \retval None
559
 */
560
void TabTools::toggleChain()
561
{
562
        if (chainButton->isOn())
563
                scalingVertical->setValue(scalingHorizontal->value());
564
}
565
 
566
/*!
567
 \fn void TabTools::HChange()
568
 \author Franz Schmid
569
 \date  
570
 \brief TabTools (Tools, Image Frame), Sets Y Scale value from X Scale value when X Scale value is changed
571
 \param None
572
 \retval None
573
 */
574
void TabTools::hChange()
575
{
576
        if (chainButton->isOn())
577
                scalingVertical->setValue(scalingHorizontal->value());
578
}
579
 
580
/*!
581
 \fn void TabTools::vChange()
582
 \author Franz Schmid
583
 \date  
584
 \brief TabTools (Tools, Image Frame). Sets X Scale value from Y Scale value when Y Scale value is changed
585
 \param None
586
 \retval None
587
 */
588
void TabTools::vChange()
589
{
590
        if (chainButton->isOn())
591
                scalingHorizontal->setValue(scalingVertical->value());
592
}
593
 
594
void TabTools::changeImageScalingFree(int)
595
{
596
        if (buttonGroup3->isChecked())
597
                buttonGroup5->setChecked(false);
598
        else
599
                buttonGroup5->setChecked(true);
600
}
601
 
602
void TabTools::changeImageScalingRatio(int)
603
{
604
        if (buttonGroup5->isChecked())
605
                buttonGroup3->setChecked(false);
606
        else
607
                buttonGroup3->setChecked(true);
608
}
609
 
610
/*!
611
 \fn void TabTools::SetSample()
612
 \author Franz Schmid
613
 \date  
614
 \brief TabTools (Tools, Text frame), Sets the sample text in selected font in text frame preferences
615
 \param None
616
 \retval None
617
 */
618
void TabTools::setSample()
619
{
620
        QString ts = tr( "Woven silk pyjamas exchanged for blue quartz" );
621
        QString da = (*fon)[fontComboText->currentText()]->Datei;
622
        int s = sizeComboText->currentText().left(2).toInt();
623
        QPixmap pm = fontSamples(da, s, ts, paletteBackgroundColor());
624
        previewText->setPixmap(pm);
625
}
626
 
627
/*!
628
 \fn void TabTools::SetTool()
629
 \author Franz Schmid
630
 \date  
631
 \brief TabTools (Tools), Raises widget for selected Tool properties
632
 \param None
633
 \retval None
634
 */
635
void TabTools::setTool()
636
{
637
        if (toolText == sender())
638
                subStackTools->raiseWidget(0);
639
        if (toolShape == sender())
640
                subStackTools->raiseWidget(1);
641
        if (toolLine == sender())
642
                subStackTools->raiseWidget(2);
643
        if (toolImage == sender())
644
                subStackTools->raiseWidget(3);
645
        if (toolPoly == sender())
646
                subStackTools->raiseWidget(4);
647
        if (toolZoom == sender())
648
                subStackTools->raiseWidget(5);
649
}