Subversion Repositories Scribus

Rev

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