Subversion Repositories Scribus

Rev

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