Subversion Repositories Scribus

Rev

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