Subversion Repositories Scribus

Rev

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