Subversion Repositories Scribus

Rev

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