Subversion Repositories Scribus

Rev

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