Subversion Repositories Scribus

Rev

Rev 7850 | Rev 8439 | 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>
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 );
2285 fschmid 168
        gapTab = new MSpinBox( 1, 200, subTabText, precision );
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 );
1790 cbradney 180
        gapText = new MSpinBox( 0, 200, subTabText, precision );
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" ) );
5763 subik 495
        //enableSignals(true);
1195 fschmid 496
}
497
 
5763 subik 498
void TabTools::enableSignals(bool on)
1828 fschmid 499
{
5763 subik 500
        if (on)
501
        {
502
                connect(toolShape, SIGNAL(clicked()), this, SLOT(setTool()));
503
                connect(toolPoly, SIGNAL(clicked()), this, SLOT(setTool()));
504
                connect(toolImage, SIGNAL(clicked()), this, SLOT(setTool()));
505
                connect(toolText, SIGNAL(clicked()), this, SLOT(setTool()));
506
                connect(toolLine, SIGNAL(clicked()), this, SLOT(setTool()));
507
                connect(toolZoom, SIGNAL(clicked()), this, SLOT(setTool()));
6606 fschmid 508
                connect(toolMisc, SIGNAL(clicked()), this, SLOT(setTool()));
5763 subik 509
                connect(fontComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
510
                connect(sizeComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
511
                connect(colorComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
512
                connect(colorComboTextBackground, SIGNAL(activated(int)), this, SLOT(setSample()));
513
                connect(shadingTextBack, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
514
                connect(shadingText, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
515
                connect(buttonGroup3, SIGNAL(clicked(int)), this, SLOT(changeImageScalingFree(int)));
516
                connect(buttonGroup5, SIGNAL(clicked(int)), this, SLOT(changeImageScalingRatio(int)));
517
                connect(chainButton, SIGNAL(clicked()), this, SLOT(toggleChain()));
518
                connect(scalingHorizontal, SIGNAL(valueChanged(int)), this, SLOT(hChange()));
519
                connect(scalingVertical, SIGNAL(valueChanged(int)), this, SLOT(vChange()));
520
                connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
521
        }
522
        else
523
        {
524
                disconnect(toolShape, SIGNAL(clicked()), this, SLOT(setTool()));
525
                disconnect(toolPoly, SIGNAL(clicked()), this, SLOT(setTool()));
526
                disconnect(toolImage, SIGNAL(clicked()), this, SLOT(setTool()));
527
                disconnect(toolText, SIGNAL(clicked()), this, SLOT(setTool()));
528
                disconnect(toolLine, SIGNAL(clicked()), this, SLOT(setTool()));
529
                disconnect(toolZoom, SIGNAL(clicked()), this, SLOT(setTool()));
6606 fschmid 530
                disconnect(toolMisc, SIGNAL(clicked()), this, SLOT(setTool()));
5763 subik 531
                disconnect(fontComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
532
                disconnect(sizeComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
533
                disconnect(colorComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
534
                disconnect(colorComboTextBackground, SIGNAL(activated(int)), this, SLOT(setSample()));
535
                disconnect(shadingTextBack, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
536
                disconnect(shadingText, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
537
                disconnect(buttonGroup3, SIGNAL(clicked(int)), this, SLOT(changeImageScalingFree(int)));
538
                disconnect(buttonGroup5, SIGNAL(clicked(int)), this, SLOT(changeImageScalingRatio(int)));
539
                disconnect(chainButton, SIGNAL(clicked()), this, SLOT(toggleChain()));
540
                disconnect(scalingHorizontal, SIGNAL(valueChanged(int)), this, SLOT(hChange()));
541
                disconnect(scalingVertical, SIGNAL(valueChanged(int)), this, SLOT(vChange()));
542
                disconnect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
543
        }
544
}
545
 
5851 subik 546
void TabTools::restoreDefaults(struct toolPrefs *prefsData, int unitIndex)
5763 subik 547
{
548
        enableSignals(false);
549
 
5512 subik 550
        PrefsManager* prefsManager=PrefsManager::instance();
551
        unit = unitGetSuffixFromIndex(unitIndex);
552
        precision = unitGetPrecisionFromIndex(unitIndex);
553
        unitRatio = unitGetRatioFromIndex(unitIndex);
554
 
555
        for (int fc=0; fc<fontComboText->count(); ++fc)
556
        {
557
                if (fontComboText->text(fc) == prefsData->defFont)
558
                {
559
                        fontComboText->setCurrentItem(fc);
560
                        break;
561
                }
562
        }
5711 subik 563
        QString ar_sizes[] = {" 7", " 9", "10", "11", "12", "14", "18", "24", "36", "48", "60", "72"};
564
        size_t f_size = sizeof(ar_sizes) / sizeof(*ar_sizes);
565
        sizeComboText->clear();
566
        for (uint s = 0; s < f_size; ++s)
567
                sizeComboText->insertItem(ar_sizes[s] + tr(" pt"));
5512 subik 568
        for (int a = 0; a < sizeComboText->count(); ++a)
569
        {
570
                if (sizeComboText->text(a).left(2).toInt() == prefsData->defSize / 10)
571
                {
572
                        sizeComboText->setCurrentItem(a);
573
                        break;
574
                }
575
        }
5711 subik 576
 
7850 jghali 577
 
578
        ColorList::Iterator itc, endOfColorList;
579
        ColorList* colorList = (docu != 0) ? (&docu->PageColors) : prefsManager->colorSetPtr();
5711 subik 580
        colorComboText->clear();
581
        colorComboText->insertItem(CommonStrings::NoneColor);
5512 subik 582
        if (prefsData->dPenText == CommonStrings::None)
5711 subik 583
                colorComboText->setCurrentItem(colorComboText->count()-1);
7850 jghali 584
        endOfColorList=colorList->end();
585
        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
5512 subik 586
        {
7850 jghali 587
                colorComboText->insertSmallItem( itc.data(), docu, itc.key() );
588
                if (itc.key() == prefsData->dPenText)
589
                        colorComboText->setCurrentItem(colorComboText->count()-1);
5512 subik 590
        }
5711 subik 591
 
5512 subik 592
        shadingText->setValue(prefsData->dTextPenShade);
5711 subik 593
 
594
        colorComboStrokeText->clear();
595
        colorComboStrokeText->insertItem(CommonStrings::NoneColor);
5512 subik 596
        if (prefsData->dStrokeText == CommonStrings::None)
5711 subik 597
                colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
7850 jghali 598
        endOfColorList=colorList->end();
599
        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
5512 subik 600
        {
7850 jghali 601
                colorComboStrokeText->insertSmallItem( itc.data(), docu, itc.key() );
602
                if (itc.key() == prefsData->dStrokeText)
603
                        colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
5512 subik 604
        }
605
        shadingTextStroke->setValue(prefsData->dTextStrokeShade);
5711 subik 606
 
607
        colorComboTextBackground->clear();
608
        colorComboTextBackground->insertItem(CommonStrings::NoneColor);
5512 subik 609
        if (prefsData->dTextBackGround == CommonStrings::None)
5711 subik 610
                colorComboTextBackground->setCurrentItem(colorComboTextBackground->count()-1);
7850 jghali 611
        endOfColorList=colorList->end();
612
        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
5512 subik 613
        {
7850 jghali 614
                colorComboTextBackground->insertSmallItem( itc.data(), docu, itc.key() );
615
                if (itc.key() == prefsData->dTextBackGround)
616
                        colorComboTextBackground->setCurrentItem(colorComboTextBackground->count()-1);
5512 subik 617
        }
618
        shadingTextBack->setValue(prefsData->dTextBackGroundShade);
5711 subik 619
 
620
        colorComboTextLine->clear();
621
        colorComboTextLine->insertItem(CommonStrings::NoneColor);
5512 subik 622
        if (prefsData->dTextLineColor == CommonStrings::None)
5711 subik 623
                colorComboTextLine->setCurrentItem(colorComboTextLine->count()-1);
7850 jghali 624
        endOfColorList=colorList->end();
625
        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
5512 subik 626
        {
7850 jghali 627
                colorComboTextLine->insertSmallItem( itc.data(), docu, itc.key() );
628
                if (itc.key() == prefsData->dTextLineColor)
629
                        colorComboTextLine->setCurrentItem(colorComboTextLine->count()-1);
5512 subik 630
        }
631
        shadingTextLine->setValue(prefsData->dTextLineShade);
5711 subik 632
 
633
        tabFillCombo->clear();
634
        tabFillCombo->insertItem( tr("None", "tab fill" ));
635
        tabFillCombo->insertItem( tr("Dot"));
636
        tabFillCombo->insertItem( tr("Hyphen"));
637
        tabFillCombo->insertItem( tr("Underscore"));
638
        tabFillCombo->insertItem( tr("Custom"));
5512 subik 639
        if (prefsData->tabFillChar.isEmpty())
640
        {
641
                tabFillCombo->setCurrentItem(0);
642
        }
643
        else if (prefsData->tabFillChar == ".")
644
        {
645
                tabFillCombo->setCurrentItem(1);
646
        }
647
        else if (prefsData->tabFillChar == "-")
648
        {
649
                tabFillCombo->setCurrentItem(2);
650
        }
651
        else if (prefsData->tabFillChar == "_")
652
        {
653
                tabFillCombo->setCurrentItem(3);
654
        }
655
        else
656
        {
657
                tabFillCombo->setCurrentItem(4);
658
                tabFillCombo->setEditable(true);
7305 cbradney 659
                tabFillCombo->setEditText( CommonStrings::trCustomTabFill + prefsData->tabFillChar);
5512 subik 660
        }
5711 subik 661
        gapTab->setSuffix( unit );
5512 subik 662
        gapTab->setValue(prefsData->dTabWidth * unitRatio);
663
        columnsText->setValue(prefsData->dCols);
5711 subik 664
        gapText->setSuffix( unit );
5512 subik 665
        gapText->setValue(prefsData->dGap * unitRatio);
5711 subik 666
 
667
        colorComboLineShape->clear();
668
        colorComboLineShape->insertItem(CommonStrings::NoneColor);
5512 subik 669
        if (prefsData->dPen == CommonStrings::None)
5711 subik 670
                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
7850 jghali 671
        endOfColorList=colorList->end();
672
        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
5512 subik 673
        {
7850 jghali 674
                colorComboLineShape->insertSmallItem( itc.data(), docu, itc.key() );
675
                if (itc.key() == prefsData->dPen)
676
                        colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
5512 subik 677
        }
678
        shadingLineShape->setValue(prefsData->dShade2);
5711 subik 679
 
680
        comboFillShape->clear();
6825 cbradney 681
        comboFillShape->insertItem( tr("None"));
5512 subik 682
        if (prefsData->dBrush == CommonStrings::None)
5711 subik 683
                comboFillShape->setCurrentItem(comboFillShape->count()-1);
7850 jghali 684
        endOfColorList=colorList->end();
685
        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
5512 subik 686
        {
7850 jghali 687
                comboFillShape->insertSmallItem( itc.data(), docu, itc.key() );
688
                if (itc.key() == prefsData->dBrush)
689
                        comboFillShape->setCurrentItem(comboFillShape->count()-1);
5512 subik 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);
7850 jghali 721
        endOfColorList=colorList->end();
722
        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
5512 subik 723
        {
7850 jghali 724
                colorComboLine->insertSmallItem( itc.data(), docu, itc.key() );
725
                if (itc.key() == prefsData->dPenLine)
726
                        colorComboLine->setCurrentItem(colorComboLine->count()-1);
5512 subik 727
        }
5711 subik 728
 
5512 subik 729
        shadingLine->setValue(prefsData->dShadeLine);
5711 subik 730
 
5512 subik 731
        switch (prefsData->dLstyleLine)
732
        {
733
                case SolidLine:
734
                        comboStyleLine->setCurrentItem(0);
735
                        break;
736
                case DashLine:
737
                        comboStyleLine->setCurrentItem(1);
738
                        break;
739
                case DotLine:
740
                        comboStyleLine->setCurrentItem(2);
741
                        break;
742
                case DashDotLine:
743
                        comboStyleLine->setCurrentItem(3);
744
                        break;
745
                case DashDotDotLine:
746
                        comboStyleLine->setCurrentItem(4);
747
                        break;
748
                default:
749
                        comboStyleLine->setCurrentItem(0);
750
                        break;
751
        }
5711 subik 752
 
5512 subik 753
        if (docu != 0)
754
        {
755
                startArrow->rebuildList(&docu->arrowStyles);
756
                endArrow->rebuildList(&docu->arrowStyles);
757
        }
758
        else
759
        {
760
                startArrow->rebuildList(&prefsManager->appPrefs.arrowStyles);
761
                endArrow->rebuildList(&prefsManager->appPrefs.arrowStyles);
762
        }
763
        startArrow->setCurrentItem(prefsData->dStartArrow);
764
        endArrow->setCurrentItem(prefsData->dEndArrow);
765
        lineWidthLine->setValue(prefsData->dWidthLine);
5711 subik 766
 
5512 subik 767
        buttonGroup3->setChecked( prefsData->scaleType );
768
        scalingHorizontal->setValue(qRound(prefsData->scaleX * 100));
769
        scalingVertical->setValue(qRound(prefsData->scaleY * 100));
770
        buttonGroup5->setChecked( !prefsData->scaleType );
771
        checkRatioImage->setChecked(prefsData->aspectRatio);
5711 subik 772
 
773
        comboFillImage->clear();
774
        comboFillImage->insertItem(CommonStrings::NoneColor);
5512 subik 775
        if (prefsData->dBrushPict == CommonStrings::None)
5711 subik 776
                comboFillImage->setCurrentItem(comboFillImage->count()-1);
7850 jghali 777
        endOfColorList=colorList->end();
778
        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
5512 subik 779
        {
7850 jghali 780
                comboFillImage->insertSmallItem( itc.data(), docu, itc.key() );
781
                if (itc.key() == prefsData->dBrushPict)
782
                        comboFillImage->setCurrentItem(comboFillImage->count()-1);
5512 subik 783
        }
5711 subik 784
 
5512 subik 785
        shadingFillImage->setValue( prefsData->shadePict );
786
        embeddedPath->setChecked(prefsData->useEmbeddedPath);
787
        switch (prefsData->lowResType)
788
        {
789
                case 0:
790
                        checkFullRes->setChecked(true);
791
                        break;
792
                case 1:
793
                        checkNormalRes->setChecked(true);
794
                        break;
795
                case 2:
796
                        checkHalfRes->setChecked(true);
797
                        break;
798
        }
5711 subik 799
 
5512 subik 800
        minimumZoom->setValue(prefsData->magMin);
801
        maximumZoom->setValue(prefsData->magMax);
802
        zoomStep->setValue( prefsData->magStep );
5763 subik 803
 
6606 fschmid 804
        genDispX->setValue(prefsData->dispX);
805
        genDispY->setValue(prefsData->dispY);
6618 fschmid 806
        genRot->setValue(prefsData->constrain);
6606 fschmid 807
 
5851 subik 808
        setSample();
5763 subik 809
 
810
        enableSignals(true);
1828 fschmid 811
}
812
 
2282 fschmid 813
void TabTools::setCustomFillChar(const QString &txt)
814
{
7305 cbradney 815
        if (txt == CommonStrings::trCustomTabFill)
2282 fschmid 816
                return;
817
        disconnect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
3629 fschmid 818
        disconnect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
2282 fschmid 819
        QString ret = txt.right(1);
820
        if (tabFillCombo->editable())
821
        {
822
                tabFillCombo->setCurrentItem(4);
7305 cbradney 823
                tabFillCombo->setEditText( CommonStrings::trCustomTabFill+ret);
824
                tabFillCombo->changeItem( CommonStrings::trCustomTabFill+ret, 4);
2282 fschmid 825
        }
826
        connect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
3629 fschmid 827
        connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
2282 fschmid 828
}
829
 
3629 fschmid 830
void TabTools::setFillChar(int act)
2282 fschmid 831
{
832
        disconnect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
3629 fschmid 833
        disconnect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
834
        switch (act)
2282 fschmid 835
        {
836
                case 0:
837
                case 1:
838
                case 2:
839
                case 3:
3629 fschmid 840
                        tabFillCombo->setCurrentItem(act);
2282 fschmid 841
                        tabFillCombo->setEditable(false);
842
                        break;
843
                case 4:
844
                        tabFillCombo->setEditable(true);
7305 cbradney 845
                        tabFillCombo->setEditText(CommonStrings::trCustomTabFill);
846
                        tabFillCombo->changeItem(CommonStrings::trCustomTabFill, 4);
3629 fschmid 847
                        tabFillCombo->lineEdit()->setFocus();
7305 cbradney 848
                        tabFillCombo->lineEdit()->setCursorPosition(CommonStrings::trCustomTabFill.length());
3629 fschmid 849
                        connect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
2282 fschmid 850
                        break;
851
        }
3629 fschmid 852
        connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
2282 fschmid 853
}
854
 
1195 fschmid 855
void TabTools::toggleChain()
856
{
857
        if (chainButton->isOn())
858
                scalingVertical->setValue(scalingHorizontal->value());
859
}
860
 
861
void TabTools::hChange()
862
{
863
        if (chainButton->isOn())
864
                scalingVertical->setValue(scalingHorizontal->value());
865
}
866
 
867
void TabTools::vChange()
868
{
869
        if (chainButton->isOn())
870
                scalingHorizontal->setValue(scalingVertical->value());
871
}
872
 
873
void TabTools::changeImageScalingFree(int)
874
{
875
        if (buttonGroup3->isChecked())
876
                buttonGroup5->setChecked(false);
877
        else
878
                buttonGroup5->setChecked(true);
879
}
880
 
881
void TabTools::changeImageScalingRatio(int)
882
{
883
        if (buttonGroup5->isChecked())
884
                buttonGroup3->setChecked(false);
885
        else
886
                buttonGroup3->setChecked(true);
887
}
888
 
889
void TabTools::setSample()
890
{
5851 subik 891
        if (!fontPreview)
892
                return;
5890 subik 893
 
5898 subik 894
        SampleItem *si = new SampleItem(docu);
6260 fschmid 895
        si->setText( tr("Woven silk pyjamas exchanged for blue quartz"));
4729 subik 896
        if (colorComboTextBackground->currentText() != CommonStrings::NoneColor)
4614 fschmid 897
        {
898
                if (docu != 0)
899
                {
900
                        si->setBgColor(docu->PageColors[colorComboTextBackground->currentText()].getRawRGBColor());
901
                        si->setBgShade(shadingTextBack->value());
902
                }
903
                else
904
                {
905
                        PrefsManager* prefsManager=PrefsManager::instance();
906
                        ColorList* colorList=prefsManager->colorSetPtr();
907
                        si->setBgColor((*colorList)[colorComboTextBackground->currentText()].getRawRGBColor());
908
                        si->setBgShade(shadingTextBack->value());
909
                }
910
        }
911
        else
912
                si->setBgColor(paletteBackgroundColor());
5890 subik 913
 
4729 subik 914
        if (colorComboText->currentText() != CommonStrings::NoneColor)
4614 fschmid 915
        {
916
                if (docu != 0)
917
                {
918
                        si->setTxColor(docu->PageColors[colorComboText->currentText()].getRawRGBColor());
919
                        si->setTxShade(shadingText->value());
920
                }
921
                else
922
                {
923
                        PrefsManager* prefsManager=PrefsManager::instance();
924
                        ColorList* colorList=prefsManager->colorSetPtr();
925
                        si->setTxColor((*colorList)[colorComboText->currentText()].getRawRGBColor());
926
                        si->setTxShade(shadingText->value());
927
                }
928
        }
929
        else
930
                si->setTxColor(paletteBackgroundColor());
4077 subik 931
        si->setFont(fontComboText->currentText());
932
        si->setFontSize(sizeComboText->currentText().left(2).toInt() * 10, true);
5763 subik 933
        previewText->setPixmap(si->getSample(previewText->width(), previewText->height()));
4077 subik 934
        delete si;
1195 fschmid 935
}
936
 
937
void TabTools::setTool()
938
{
939
        if (toolText == sender())
940
                subStackTools->raiseWidget(0);
941
        if (toolShape == sender())
942
                subStackTools->raiseWidget(1);
943
        if (toolLine == sender())
944
                subStackTools->raiseWidget(2);
945
        if (toolImage == sender())
946
                subStackTools->raiseWidget(3);
947
        if (toolPoly == sender())
948
                subStackTools->raiseWidget(4);
949
        if (toolZoom == sender())
950
                subStackTools->raiseWidget(5);
6606 fschmid 951
        if (toolMisc == sender())
952
                subStackTools->raiseWidget(6);
1195 fschmid 953
}
5851 subik 954
 
955
void TabTools::enableFontPreview(bool state)
956
{
957
        fontPreview = state;
958
        setSample();
959
}
960
 
961
void TabTools::unitChange(QString unit, int docUnitIndex, int decimals, double invUnitConversion)
962
{
963
        double oldMin, oldMax, val;
964
        int decimalsOld;
965
 
966
        gapText->setSuffix(unit);
967
        gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
968
        gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
969
        gapTab->getValues(&oldMin, &oldMax, &decimalsOld, &val);
970
        gapTab->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
6606 fschmid 971
        genDispX->getValues(&oldMin, &oldMax, &decimalsOld, &val);
972
        genDispX->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
973
        genDispY->getValues(&oldMin, &oldMax, &decimalsOld, &val);
974
        genDispY->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
5851 subik 975
}