Subversion Repositories Scribus

Rev

Rev 2040 | Rev 2282 | 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 );
2219 fschmid 159
        tabFillCombo = new QComboBox( true, subTabText, "tabFillCombo" );
160
        tabFillCombo->setEditable(false);
161
        tabFillCombo->insertItem( tr("None"));
162
        tabFillCombo->insertItem( "...");
163
        tabFillCombo->insertItem( "---");
164
        tabFillCombo->insertItem( "___");
165
        if (prefsData->tabFillChar == "")
166
                tabFillCombo->setCurrentItem(0);
167
        if (prefsData->tabFillChar == ".")
168
                tabFillCombo->setCurrentItem(1);
169
        if (prefsData->tabFillChar == "-")
170
                tabFillCombo->setCurrentItem(2);
171
        if (prefsData->tabFillChar == "_")
172
                tabFillCombo->setCurrentItem(3);
173
        subTabTextLayout->addMultiCellWidget( tabFillCombo, 4, 4, 1, 3, Qt::AlignLeft );
174
        textLabel3b2t = new QLabel(tabFillCombo, tr( "Tab Fill Character:" ), subTabText, "textLabel3b2t" );
175
        subTabTextLayout->addWidget( textLabel3b2t, 4, 0 );
1195 fschmid 176
        columnsText = new QSpinBox( subTabText, "columnsText" );
177
        columnsText->setMinValue( 1 );
178
        columnsText->setMaxValue(100);
179
        columnsText->setValue(prefsData->dCols);
2219 fschmid 180
        subTabTextLayout->addWidget( columnsText, 5, 1, Qt::AlignLeft );
1195 fschmid 181
        textLabel4b = new QLabel(columnsText, tr("Colu&mns:"), subTabText, "TextCol");
2219 fschmid 182
        subTabTextLayout->addWidget( textLabel4b, 5, 0 );
1790 cbradney 183
        gapText = new MSpinBox( 0, 200, subTabText, precision );
1195 fschmid 184
        gapText->setSuffix( unit );
1790 cbradney 185
        gapText->setValue(prefsData->dGap * unitRatio);
2219 fschmid 186
        subTabTextLayout->addWidget( gapText, 5, 3, Qt::AlignLeft );
1195 fschmid 187
        textLabel5b = new QLabel(gapText, tr("&Gap:"), subTabText, "TextCol");
2219 fschmid 188
        subTabTextLayout->addWidget( textLabel5b, 5, 2 );
1195 fschmid 189
        previewText = new QLabel( tr( "Woven silk pyjamas exchanged for blue quartz" ), subTabText, "previewText" );
190
        previewText->setMinimumSize( QSize( 280, 70 ) );
191
        previewText->setAlignment( static_cast<int>( QLabel::AlignVCenter | QLabel::AlignLeft ) );
2219 fschmid 192
        subTabTextLayout->addMultiCellWidget( previewText, 6, 6, 0, 3 );
1195 fschmid 193
        subStackTools->addWidget( subTabText, 0 );
194
 
195
        subTabShape = new QWidget( subStackTools, "subTabShape" );
196
        subTabShapeLayout = new QGridLayout( subTabShape, 1, 1, 11, 6, "subTabShapeLayout");
197
        subTabShapeLayout->setAlignment( Qt::AlignTop );
198
        colorComboLineShape = new QComboBox( true, subTabShape, "colorComboLineShape" );
199
        colorComboLineShape->setEditable(false);
200
        colorComboLineShape->insertItem( tr("None"));
201
        if (prefsData->dPen == "None")
202
                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
203
        QPixmap pm2S = QPixmap(15, 15);
204
        if (doc != 0)
205
        {
206
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
207
                {
208
                        pm2S.fill(doc->PageColors[itc.key()].getRGBColor());
209
                        colorComboLineShape->insertItem(pm2S, itc.key());
210
                        if (itc.key() == prefsData->dPen)
211
                                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
212
                }
213
        }
214
        else
215
        {
216
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
217
                {
218
                        pm2S.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
219
                        colorComboLineShape->insertItem(pm2S, itc.key());
220
                        if (itc.key() == prefsData->dPen)
221
                                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
222
                }
223
        }
224
        subTabShapeLayout->addWidget( colorComboLineShape, 0, 1, Qt::AlignLeft );
225
        textLabel7b = new QLabel( colorComboLineShape, tr( "&Line Color:" ), subTabShape, "textLabel7b" );
226
        subTabShapeLayout->addWidget( textLabel7b, 0, 0 );
227
        shadingLineShape = new QSpinBox( subTabShape, "shadingLineShape" );
228
        shadingLineShape->setMaxValue( 100 );
229
        shadingLineShape->setSuffix( tr( " %" ) );
230
        shadingLineShape->setMinValue( 0 );
231
        shadingLineShape->setValue(prefsData->dShade2);
232
        subTabShapeLayout->addWidget( shadingLineShape, 1, 1, Qt::AlignLeft );
233
        textLabel8b = new QLabel( shadingLineShape, tr( "&Shading:" ), subTabShape, "textLabel8b" );
234
        subTabShapeLayout->addWidget( textLabel8b, 1, 0 );
235
        comboFillShape = new QComboBox( true, subTabShape, "comboFillShape" );
236
        comboFillShape->setEditable(false);
237
        comboFillShape->insertItem( tr("None"));
238
        if (prefsData->dBrush == "None")
239
                comboFillShape->setCurrentItem(comboFillShape->count()-1);
240
        if (doc != 0)
241
        {
242
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
243
                {
244
                        pm2S.fill(doc->PageColors[itc.key()].getRGBColor());
245
                        comboFillShape->insertItem(pm2S, itc.key());
246
                        if (itc.key() == prefsData->dBrush)
247
                                comboFillShape->setCurrentItem(comboFillShape->count()-1);
248
                }
249
        }
250
        else
251
        {
252
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
253
                {
254
                        pm2S.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
255
                        comboFillShape->insertItem(pm2S, itc.key());
256
                        if (itc.key() == prefsData->dBrush)
257
                                comboFillShape->setCurrentItem(comboFillShape->count()-1);
258
                }
259
        }
260
        subTabShapeLayout->addWidget( comboFillShape, 2, 1, Qt::AlignLeft );
261
        textLabel9b = new QLabel( comboFillShape, tr( "&Fill Color:" ), subTabShape, "textLabel9b" );
262
        subTabShapeLayout->addWidget( textLabel9b, 2, 0 );
263
        shadingFillShape = new QSpinBox( subTabShape, "shadingFillShape" );
264
        shadingFillShape->setMaxValue( 100 );
265
        shadingFillShape->setSuffix( tr( " %" ) );
266
        shadingFillShape->setMinValue( 0 );
267
        shadingFillShape->setValue(prefsData->dShade);
268
        subTabShapeLayout->addWidget( shadingFillShape, 3, 1, Qt::AlignLeft );
269
        textLabel10b = new QLabel( shadingFillShape, tr( "S&hading:" ), subTabShape, "textLabel10b" );
270
        subTabShapeLayout->addWidget( textLabel10b, 3, 0 );
271
        comboStyleShape = new LineCombo(subTabShape);
272
        comboStyleShape->setEditable(false);
273
        switch (prefsData->dLineArt)
274
        {
275
        case SolidLine:
276
                comboStyleShape->setCurrentItem(0);
277
                break;
278
        case DashLine:
279
                comboStyleShape->setCurrentItem(1);
280
                break;
281
        case DotLine:
282
                comboStyleShape->setCurrentItem(2);
283
                break;
284
        case DashDotLine:
285
                comboStyleShape->setCurrentItem(3);
286
                break;
287
        case DashDotDotLine:
288
                comboStyleShape->setCurrentItem(4);
289
                break;
290
        default:
291
                comboStyleShape->setCurrentItem(0);
292
                break;
293
        }
294
        subTabShapeLayout->addWidget( comboStyleShape, 4, 1, Qt::AlignLeft );
295
        textLabel11b = new QLabel( comboStyleShape, tr( "Line Style:" ), subTabShape, "textLabel11b" );
296
        subTabShapeLayout->addWidget( textLabel11b, 4, 0 );
297
        lineWidthShape = new MSpinBox( 0, 36, subTabShape, 1 );
298
        lineWidthShape->setSuffix( tr( " pt" ) );
299
        lineWidthShape->setValue(prefsData->dWidth);
300
        subTabShapeLayout->addWidget( lineWidthShape, 5, 1, Qt::AlignLeft );
301
        textLabel12b = new QLabel( lineWidthShape, tr( "Line &Width:" ), subTabShape, "TextLabel2_3_4" );
302
        subTabShapeLayout->addWidget( textLabel12b, 5, 0 );
303
        subStackTools->addWidget( subTabShape, 1 );
304
 
305
        subTabLine = new QWidget( subStackTools, "subTabLine" );
306
        subTabLineLayout = new QGridLayout( subTabLine, 1, 1, 11, 6, "subTabLineLayout");
307
        subTabLineLayout->setAlignment( Qt::AlignTop );
308
        colorComboLine = new QComboBox( true, subTabLine, "colorComboLine" );
309
        colorComboLine->setEditable(false);
310
        QPixmap pm2L = QPixmap(15, 15);
311
        colorComboLine->insertItem( tr("None"));
312
        if (prefsData->dPenLine == "None")
313
                colorComboLine->setCurrentItem(colorComboLine->count()-1);
314
        if (doc != 0)
315
        {
316
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
317
                {
318
                        pm2L.fill(doc->PageColors[itc.key()].getRGBColor());
319
                        colorComboLine->insertItem(pm2L, itc.key());
320
                        if (itc.key() == prefsData->dPenLine)
321
                                colorComboLine->setCurrentItem(colorComboLine->count()-1);
322
                }
323
        }
324
        else
325
        {
326
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
327
                {
328
                        pm2L.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
329
                        colorComboLine->insertItem(pm2L, itc.key());
330
                        if (itc.key() == prefsData->dPenLine)
331
                                colorComboLine->setCurrentItem(colorComboLine->count()-1);
332
                }
333
        }
334
        subTabLineLayout->addMultiCellWidget( colorComboLine, 0, 0, 1, 2, Qt::AlignLeft );
335
        textLabel13b = new QLabel(colorComboLine, tr("&Line Color:"), subTabLine, "textLabel13b" );
336
        subTabLineLayout->addWidget( textLabel13b, 0, 0 );
337
        shadingLine = new QSpinBox( subTabLine, "shadingLine" );
338
        shadingLine->setMaxValue( 100 );
339
        shadingLine->setValue(prefsData->dShadeLine);
340
        shadingLine->setSuffix( tr( " %" ) );
341
        subTabLineLayout->addMultiCellWidget( shadingLine, 1, 1, 1, 2, Qt::AlignLeft );
342
        textLabel14b = new QLabel(shadingLine, tr("&Shading:"), subTabLine, "textLabel14b" );
343
        subTabLineLayout->addWidget( textLabel14b, 1, 0 );
344
        comboStyleLine = new LineCombo(subTabLine);
345
        comboStyleLine->setEditable(false);
346
        switch (prefsData->dLstyleLine)
347
        {
348
        case SolidLine:
349
                comboStyleLine->setCurrentItem(0);
350
                break;
351
        case DashLine:
352
                comboStyleLine->setCurrentItem(1);
353
                break;
354
        case DotLine:
355
                comboStyleLine->setCurrentItem(2);
356
                break;
357
        case DashDotLine:
358
                comboStyleLine->setCurrentItem(3);
359
                break;
360
        case DashDotDotLine:
361
                comboStyleLine->setCurrentItem(4);
362
                break;
363
        default:
364
                comboStyleLine->setCurrentItem(0);
365
                break;
366
        }
367
        subTabLineLayout->addMultiCellWidget( comboStyleLine, 2, 2, 1, 2, Qt::AlignLeft );
368
        textLabel15b = new QLabel(subTabLine, tr("Line S&tyle:"), subTabLine, "textLabel15b" );
369
        subTabLineLayout->addWidget( textLabel15b, 2, 0 );
370
        startArrow = new ArrowChooser(subTabLine, true);
371
        subTabLineLayout->addWidget( startArrow, 4, 1 );
372
        endArrow = new ArrowChooser(subTabLine, false);
373
        subTabLineLayout->addWidget( endArrow, 4, 2 );
374
        if (doc != 0)
375
        {
376
                startArrow->rebuildList(&doc->arrowStyles);
377
                endArrow->rebuildList(&doc->arrowStyles);
378
        }
379
        else
380
        {
381
                startArrow->rebuildList(&ScApp->Prefs.arrowStyles);
382
                endArrow->rebuildList(&ScApp->Prefs.arrowStyles);
383
        }
384
        startArrow->setCurrentItem(prefsData->dStartArrow);
385
        endArrow->setCurrentItem(prefsData->dEndArrow);
386
        arrowText = new QLabel( tr( "Arrows:" ), subTabLine, "arrowText" );
387
        subTabLineLayout->addMultiCellWidget( arrowText, 3, 4, 0, 0 );
388
        startArrowText = new QLabel( startArrow, tr( "Start:" ), subTabLine, "startArrowText" );
389
        subTabLineLayout->addWidget( startArrowText, 3, 1 );
390
        endArrowText = new QLabel( endArrow, tr( "End:" ), subTabLine, "endArrowText" );
391
        subTabLineLayout->addWidget( endArrowText, 3, 2 );
392
        lineWidthLine = new MSpinBox( 1, 36, subTabLine, 1 );
393
        lineWidthLine->setSuffix( tr( " pt" ) );
394
        lineWidthLine->setValue(prefsData->dWidthLine);
395
        subTabLineLayout->addMultiCellWidget( lineWidthLine, 5, 5, 1, 2, Qt::AlignLeft );
396
        textLabel16b = new QLabel(lineWidthLine, tr("Line &Width:"), subTabLine, "textLabel16b" );
397
        subTabLineLayout->addWidget( textLabel16b, 5, 0 );
398
        subStackTools->addWidget( subTabLine, 2 );
399
 
400
        subTabImage = new QWidget( subStackTools, "subTabImage" );
401
        subTabImageLayout = new QGridLayout( subTabImage, 1, 1, 11, 6, "subTabImageLayout");
402
        subTabImageLayout->setAlignment( Qt::AlignTop );
403
        buttonGroup3 = new QButtonGroup( subTabImage, "buttonGroup3" );
404
        buttonGroup3->setCheckable( true );
405
        buttonGroup3->setChecked( prefsData->scaleType );
406
        buttonGroup3->setColumnLayout(0, Qt::Vertical );
407
        buttonGroup3->layout()->setSpacing( 6 );
408
        buttonGroup3->layout()->setMargin( 11 );
409
        buttonGroup3->setTitle( tr( "&Free Scaling" ) );
410
        buttonGroup3Layout = new QGridLayout( buttonGroup3->layout() );
411
        buttonGroup3Layout->setAlignment( Qt::AlignTop );
412
        scalingHorizontal = new QSpinBox( buttonGroup3, "scalingHorizontal" );
413
        scalingHorizontal->setMaxValue( 1000 );
414
        scalingHorizontal->setMinValue( 1 );
415
        scalingHorizontal->setValue(qRound(prefsData->scaleX * 100));
416
        scalingHorizontal->setSuffix( tr( " %" ) );
417
        buttonGroup3Layout->addWidget( scalingHorizontal, 0, 1, Qt::AlignRight );
418
        textLabel17b = new QLabel(scalingHorizontal, tr("&Horizontal Scaling:"), buttonGroup3, "textLabel17b" );
419
        buttonGroup3Layout->addWidget( textLabel17b, 0, 0 );
420
        scalingVertical = new QSpinBox( buttonGroup3, "scalingVertical" );
421
        scalingVertical->setMaxValue( 1000 );
422
        scalingVertical->setMinValue( 1 );
423
        scalingVertical->setSuffix( tr( " %" ) );
424
        scalingVertical->setValue(qRound(prefsData->scaleY * 100));
425
        buttonGroup3Layout->addWidget( scalingVertical, 1, 1, Qt::AlignRight );
426
        textLabel18b = new QLabel(scalingVertical, tr( "&Vertical Scaling:" ), buttonGroup3, "textLabel18b" );
427
        buttonGroup3Layout->addWidget( textLabel18b, 1, 0 );
428
        chainButton = new LinkButton( buttonGroup3 );
429
        chainButton->setToggleButton( true );
430
        chainButton->setAutoRaise(true);
431
        buttonGroup3Layout->addMultiCellWidget( chainButton, 0, 1, 2, 2, Qt::AlignLeft );
432
        subTabImageLayout->addMultiCellWidget( buttonGroup3, 0, 0, 0, 1 );
433
        buttonGroup5 = new QButtonGroup( subTabImage, "buttonGroup5" );
434
        buttonGroup5->setCheckable( true );
435
        buttonGroup5->setChecked( !prefsData->scaleType );
436
        buttonGroup5->setColumnLayout(0, Qt::Vertical );
437
        buttonGroup5->layout()->setSpacing( 6 );
438
        buttonGroup5->layout()->setMargin( 11 );
439
        buttonGroup5->setTitle( tr( "&Scale Picture to Frame Size" ) );
440
        buttonGroup5Layout = new QHBoxLayout( buttonGroup5->layout() );
441
        buttonGroup5Layout->setAlignment( Qt::AlignTop );
442
        checkRatioImage = new QCheckBox( buttonGroup5, "checkRatioImage" );
443
        checkRatioImage->setText( tr( "Keep Aspect &Ratio" ) );
444
        checkRatioImage->setChecked(prefsData->aspectRatio);
445
        buttonGroup5Layout->addWidget( checkRatioImage );
446
        subTabImageLayout->addMultiCellWidget( buttonGroup5, 1, 1, 0, 1 );
447
        comboFillImage = new QComboBox( true, subTabImage, "comboFillImage" );
448
        comboFillImage->setEditable(false);
449
        QPixmap pm2I = QPixmap(15, 15);
450
        comboFillImage->insertItem( tr("None"));
451
        if (prefsData->dBrushPict == "None")
452
                comboFillImage->setCurrentItem(comboFillImage->count()-1);
453
        if (doc != 0)
454
        {
455
                for (itc = doc->PageColors.begin(); itc != doc->PageColors.end(); ++itc)
456
                {
457
                        pm2I.fill(doc->PageColors[itc.key()].getRGBColor());
458
                        comboFillImage->insertItem(pm2I, itc.key());
459
                        if (itc.key() == prefsData->dBrushPict)
460
                                comboFillImage->setCurrentItem(comboFillImage->count()-1);
461
                }
462
        }
463
        else
464
        {
465
                for (itc = ScApp->Prefs.DColors.begin(); itc != ScApp->Prefs.DColors.end(); ++itc)
466
                {
467
                        pm2I.fill(ScApp->Prefs.DColors[itc.key()].getRGBColor());
468
                        comboFillImage->insertItem(pm2I, itc.key());
469
                        if (itc.key() == prefsData->dBrushPict)
470
                                comboFillImage->setCurrentItem(comboFillImage->count()-1);
471
                }
472
        }
473
        subTabImageLayout->addWidget( comboFillImage, 2, 1, Qt::AlignLeft );
474
        textLabel19b = new QLabel(comboFillImage, tr( "F&ill Color:" ), subTabImage, "textLabel19b" );
475
        subTabImageLayout->addWidget( textLabel19b, 2, 0 );
476
        shadingFillImage = new QSpinBox( subTabImage, "shadingFillImage" );
477
        shadingFillImage->setMaxValue( 100 );
478
        shadingFillImage->setValue( prefsData->shadePict );
479
        shadingFillImage->setSuffix( tr( " %" ) );
480
        subTabImageLayout->addWidget( shadingFillImage, 3, 1, Qt::AlignLeft );
481
        textLabel20b = new QLabel(shadingFillImage, tr( "S&hading:" ), subTabImage, "textLabel20b" );
482
        subTabImageLayout->addWidget( textLabel20b, 3, 0 );
2040 fschmid 483
        embeddedPath = new QCheckBox( subTabImage, "embeddedPath" );
484
        embeddedPath->setText( tr( "Use embedded Clipping Path" ) );
485
        embeddedPath->setChecked(prefsData->useEmbeddedPath);
486
        subTabImageLayout->addMultiCellWidget( embeddedPath, 4, 4, 0, 1 );
2025 fschmid 487
        buttonGroupRes = new QButtonGroup( subTabImage, "buttonGroup3" );
488
        buttonGroupRes->setColumnLayout(0, Qt::Vertical );
489
        buttonGroupRes->layout()->setSpacing( 6 );
490
        buttonGroupRes->layout()->setMargin( 11 );
491
        buttonGroupRes->setExclusive( true );
492
        buttonGroupRes->setTitle( tr( "On Screen Preview" ) );
493
        buttonGroupResLayout = new QVBoxLayout( buttonGroupRes->layout() );
494
        buttonGroupResLayout->setAlignment( Qt::AlignTop );
495
        checkFullRes = new QRadioButton( buttonGroupRes, "checkFullRes" );
496
        checkFullRes->setText( tr( "Full Resolution Preview" ) );
497
        buttonGroupResLayout->addWidget( checkFullRes );
498
        checkNormalRes = new QRadioButton( buttonGroupRes, "checkNormalRes" );
499
        checkNormalRes->setText( tr( "Normal Resolution Preview" ) );
500
        buttonGroupResLayout->addWidget( checkNormalRes );
501
        checkHalfRes = new QRadioButton( buttonGroupRes, "checkHalfRes" );
2012 fschmid 502
        checkHalfRes->setText( tr( "Low Resolution Preview" ) );
2025 fschmid 503
        buttonGroupResLayout->addWidget( checkHalfRes );
504
        switch (prefsData->lowResType)
505
        {
506
                case 0:
507
                        checkFullRes->setChecked(true);
508
                        break;
509
                case 1:
510
                        checkNormalRes->setChecked(true);
511
                        break;
512
                case 2:
513
                        checkHalfRes->setChecked(true);
514
                        break;
515
        }
2040 fschmid 516
        subTabImageLayout->addMultiCellWidget( buttonGroupRes, 5, 5, 0, 1 );
1195 fschmid 517
        subStackTools->addWidget( subTabImage, 3 );
518
 
519
        subTabPolygon = new QWidget( subStackTools, "subTabPolygon" );
520
        subTabPolygonLayout = new QHBoxLayout( subTabPolygon, 11, 6, "subTabPolygonLayout");
521
        subTabPolygonLayout->setAlignment( Qt::AlignTop );
522
        polyWidget = new PolygonWidget(subTabPolygon, prefsData->polyC, prefsData->polyFd, prefsData->polyF, prefsData->polyS, prefsData->polyR);
523
        subTabPolygonLayout->addWidget( polyWidget );
524
        subStackTools->addWidget( subTabPolygon, 4 );
525
 
526
        subTabZoom = new QWidget( subStackTools, "subTabZoom" );
527
        subTabZoomLayout = new QGridLayout( subTabZoom, 1, 1, 11, 6, "subTabZoomLayout");
528
        subTabZoomLayout->setAlignment( Qt::AlignTop );
529
        minimumZoom = new QSpinBox( subTabZoom, "minimumZoom" );
530
        minimumZoom->setMaxValue( 3200 );
531
        minimumZoom->setMinValue( 10 );
532
        minimumZoom->setValue(prefsData->magMin);
533
        minimumZoom->setSuffix( tr( " %" ) );
534
        subTabZoomLayout->addWidget( minimumZoom, 0, 1, Qt::AlignLeft );
535
        textLabel21b = new QLabel( minimumZoom, tr( "Mi&nimum:" ), subTabZoom, "textLabel21b" );
536
        subTabZoomLayout->addWidget( textLabel21b, 0, 0);
537
        maximumZoom = new QSpinBox( subTabZoom, "maximumZoom" );
538
        maximumZoom->setMaxValue( 3200 );
539
        maximumZoom->setMinValue( 10 );
540
        maximumZoom->setValue(prefsData->magMax);
541
        maximumZoom->setSuffix( tr( " %" ) );
542
        subTabZoomLayout->addWidget( maximumZoom, 1, 1, Qt::AlignLeft );
543
        textLabel22b = new QLabel( maximumZoom, tr( "Ma&ximum:" ), subTabZoom, "textLabel22b" );
544
        subTabZoomLayout->addWidget( textLabel22b, 1, 0 );
545
        zoomStep = new QSpinBox( subTabZoom, "zoomStep" );
546
        zoomStep->setMaxValue( 200 );
547
        zoomStep->setMinValue( 1 );
548
        zoomStep->setLineStep( 25 );
549
        zoomStep->setValue( prefsData->magStep );
550
        zoomStep->setSuffix( tr( " %" ) );
551
        subTabZoomLayout->addWidget( zoomStep, 2, 1, Qt::AlignLeft );
552
        textLabel23b = new QLabel( zoomStep, tr( "&Stepping:" ), subTabZoom, "textLabel23b" );
553
        subTabZoomLayout->addWidget( textLabel23b, 2, 0 );
554
        subStackTools->addWidget( subTabZoom, 5 );
555
        tabToolsLayout->addWidget( subStackTools );
556
        toolText->setOn(true);
557
        setSample();
558
        QToolTip::add( toolText, tr( "Text Frame Properties" ) );
559
        QToolTip::add( toolImage, tr( "Picture Frame Properties" ) );
560
        QToolTip::add( toolShape, tr( "Shape Drawing Properties" ) );
561
        QToolTip::add( toolZoom, tr( "Magnification Level Defaults" ) );
562
        QToolTip::add( toolLine, tr( "Line Drawing Properties" ) );
563
        QToolTip::add( toolPoly, tr( "Polygon Drawing Properties" ) );
564
        QToolTip::add( fontComboText, tr( "Font for new text frames" ) );
565
        QToolTip::add( sizeComboText, tr( "Size of font for new text frames" ) );
566
        QToolTip::add( colorComboText, tr( "Color of font" ) );
567
        QToolTip::add( columnsText, tr( "Number of columns in a text frame" ) );
568
        QToolTip::add( gapText, tr( "Gap between text frame columns" ) );
569
        QToolTip::add( previewText, tr( "Sample of your font" ) );
570
        QToolTip::add( buttonGroup3, tr( "Picture frames allow pictures to scale to any size" ) );
571
        QToolTip::add( scalingHorizontal, tr( "Horizontal scaling of images" ) );
572
        QToolTip::add( scalingVertical, tr( "Vertical scaling of images" ) );
573
        QToolTip::add( chainButton, tr( "Keep horizontal and vertical scaling the same" ) );
574
        QToolTip::add( buttonGroup5, tr( "Pictures in picture frames are scaled to the size of the frame" ) );
575
        QToolTip::add( checkRatioImage, tr( "Automatically scaled pictures keep their original proportions" ) );
576
        QToolTip::add( comboFillImage, tr( "Fill color of picture frames" ) );
577
        QToolTip::add( shadingFillImage, tr( "Saturation of color of fill" ) );
578
        QToolTip::add( colorComboLineShape, tr( "Line color of shapes" ) );
579
        QToolTip::add( shadingLineShape, tr( "Saturation of color of lines" ) );
580
        QToolTip::add( comboFillShape, tr( "Fill color of shapes" ) );
581
        QToolTip::add( shadingFillShape, tr( "Saturation of color of fill" ) );
582
        QToolTip::add( comboStyleShape, tr( "Line style of shapes" ) );
583
        QToolTip::add( lineWidthShape, tr( "Line width of shapes" ) );
584
        QToolTip::add( minimumZoom, tr( "Minimum magnification allowed" ) );
585
        QToolTip::add( maximumZoom, tr( "Maximum magnification allowed" ) );
586
        QToolTip::add( zoomStep, tr( "Change in magnification for each zoom operation" ) );
587
        QToolTip::add( colorComboLine, tr( "Color of lines" ) );
588
        QToolTip::add( shadingLine, tr( "Saturation of color" ) );
589
        QToolTip::add( comboStyleLine, tr( "Style of lines" ) );
590
        QToolTip::add( lineWidthLine, tr( "Width of lines" ) );
591
        connect(toolShape, SIGNAL(clicked()), this, SLOT(setTool()));
592
        connect(toolPoly, SIGNAL(clicked()), this, SLOT(setTool()));
593
        connect(toolImage, SIGNAL(clicked()), this, SLOT(setTool()));
594
        connect(toolText, SIGNAL(clicked()), this, SLOT(setTool()));
595
        connect(toolLine, SIGNAL(clicked()), this, SLOT(setTool()));
596
        connect(toolZoom, SIGNAL(clicked()), this, SLOT(setTool()));
597
        connect(fontComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
598
        connect(sizeComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
599
        connect(buttonGroup3, SIGNAL(clicked(int)), this, SLOT(changeImageScalingFree(int)));
600
        connect(buttonGroup5, SIGNAL(clicked(int)), this, SLOT(changeImageScalingRatio(int)));
601
        connect(chainButton, SIGNAL(clicked()), this, SLOT(toggleChain()));
602
        connect(scalingHorizontal, SIGNAL(valueChanged(int)), this, SLOT(hChange()));
603
        connect(scalingVertical, SIGNAL(valueChanged(int)), this, SLOT(vChange()));
604
}
605
 
1828 fschmid 606
void TabTools::restoreDefaults()
607
{
608
}
609
 
1195 fschmid 610
/*!
611
 \fn void TabTools::ToggleKette()
612
 \author Franz Schmid
613
 \date  
614
 \brief TabTools (Tools, Image Frame), Sets Y Scale value from X Scale value when chain is toggled
615
 \param None
616
 \retval None
617
 */
618
void TabTools::toggleChain()
619
{
620
        if (chainButton->isOn())
621
                scalingVertical->setValue(scalingHorizontal->value());
622
}
623
 
624
/*!
625
 \fn void TabTools::HChange()
626
 \author Franz Schmid
627
 \date  
628
 \brief TabTools (Tools, Image Frame), Sets Y Scale value from X Scale value when X Scale value is changed
629
 \param None
630
 \retval None
631
 */
632
void TabTools::hChange()
633
{
634
        if (chainButton->isOn())
635
                scalingVertical->setValue(scalingHorizontal->value());
636
}
637
 
638
/*!
639
 \fn void TabTools::vChange()
640
 \author Franz Schmid
641
 \date  
642
 \brief TabTools (Tools, Image Frame). Sets X Scale value from Y Scale value when Y Scale value is changed
643
 \param None
644
 \retval None
645
 */
646
void TabTools::vChange()
647
{
648
        if (chainButton->isOn())
649
                scalingHorizontal->setValue(scalingVertical->value());
650
}
651
 
652
void TabTools::changeImageScalingFree(int)
653
{
654
        if (buttonGroup3->isChecked())
655
                buttonGroup5->setChecked(false);
656
        else
657
                buttonGroup5->setChecked(true);
658
}
659
 
660
void TabTools::changeImageScalingRatio(int)
661
{
662
        if (buttonGroup5->isChecked())
663
                buttonGroup3->setChecked(false);
664
        else
665
                buttonGroup3->setChecked(true);
666
}
667
 
668
/*!
669
 \fn void TabTools::SetSample()
670
 \author Franz Schmid
671
 \date  
672
 \brief TabTools (Tools, Text frame), Sets the sample text in selected font in text frame preferences
673
 \param None
674
 \retval None
675
 */
676
void TabTools::setSample()
677
{
678
        QString ts = tr( "Woven silk pyjamas exchanged for blue quartz" );
679
        QString da = (*fon)[fontComboText->currentText()]->Datei;
680
        int s = sizeComboText->currentText().left(2).toInt();
681
        QPixmap pm = fontSamples(da, s, ts, paletteBackgroundColor());
682
        previewText->setPixmap(pm);
683
}
684
 
685
/*!
686
 \fn void TabTools::SetTool()
687
 \author Franz Schmid
688
 \date  
689
 \brief TabTools (Tools), Raises widget for selected Tool properties
690
 \param None
691
 \retval None
692
 */
693
void TabTools::setTool()
694
{
695
        if (toolText == sender())
696
                subStackTools->raiseWidget(0);
697
        if (toolShape == sender())
698
                subStackTools->raiseWidget(1);
699
        if (toolLine == sender())
700
                subStackTools->raiseWidget(2);
701
        if (toolImage == sender())
702
                subStackTools->raiseWidget(3);
703
        if (toolPoly == sender())
704
                subStackTools->raiseWidget(4);
705
        if (toolZoom == sender())
706
                subStackTools->raiseWidget(5);
707
}