Subversion Repositories Scribus

Rev

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