Subversion Repositories Scribus

Rev

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