Subversion Repositories Scribus

Rev

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