Subversion Repositories Scribus

Rev

Rev 5890 | Rev 5993 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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