Subversion Repositories Scribus

Rev

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