Subversion Repositories Scribus

Rev

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