Subversion Repositories Scribus

Rev

Rev 6358 | Rev 6618 | 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"
4689 mrdocs 29
#include "colorm.h"
2529 craig 30
 
2636 cbradney 31
 
1790 cbradney 32
TabTools::TabTools( QWidget* parent, struct toolPrefs *prefsData, int unitIndex, ScribusDoc* doc) : QWidget( parent, "tabtools", 0 )
1195 fschmid 33
{
4614 fschmid 34
        docu = doc;
5851 subik 35
        fontPreview = false;
36
 
1878 cbradney 37
        tabToolsLayout = new QHBoxLayout( this, 0, 5, "tabToolsLayout");
1195 fschmid 38
        buttonGroupTools = new QButtonGroup( this, "buttonGroupTools" );
39
        buttonGroupTools->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, buttonGroupTools->sizePolicy().hasHeightForWidth() ) );
40
        buttonGroupTools->setExclusive( true );
41
        buttonGroupTools->setRadioButtonExclusive( true );
42
        buttonGroupTools->setColumnLayout(0, Qt::Vertical );
43
        buttonGroupTools->layout()->setSpacing( 5 );
44
        buttonGroupTools->layout()->setMargin( 5 );
45
        buttonGroupTools->setTitle( QString::null );
46
        buttonGroupToolsLayout = new QVBoxLayout( buttonGroupTools->layout() );
47
        buttonGroupToolsLayout->setAlignment( Qt::AlignTop );
48
        toolText = new QToolButton( buttonGroupTools, "toolText" );
49
        toolText->setToggleButton( true );
50
        toolText->setText( QString::null );
5287 cbradney 51
        toolText->setIconSet( QIconSet( loadIcon("16/insert-text-frame.png") ) );
1195 fschmid 52
        buttonGroupToolsLayout->addWidget( toolText );
53
        toolImage = new QToolButton( buttonGroupTools, "toolImage" );
54
        toolImage->setToggleButton( true );
55
        toolImage->setText( QString::null );
5287 cbradney 56
        toolImage->setIconSet( QIconSet( loadIcon("16/insert-image.png") ) );
1195 fschmid 57
        buttonGroupToolsLayout->addWidget( toolImage );
58
        toolShape = new QToolButton( buttonGroupTools, "toolShape" );
59
        toolShape->setToggleButton( true );
60
        toolShape->setText( QString::null );
5287 cbradney 61
        toolShape->setIconSet( QIconSet( loadIcon("16/draw-rectangle.png") ) );
1195 fschmid 62
        buttonGroupToolsLayout->addWidget( toolShape);
63
        toolPoly = new QToolButton( buttonGroupTools, "toolPoly" );
64
        toolPoly->setToggleButton( true );
65
        toolPoly->setText( QString::null );
5287 cbradney 66
        toolPoly->setIconSet( QIconSet( loadIcon("16/draw-polygon.png") ) );
1195 fschmid 67
        buttonGroupToolsLayout->addWidget( toolPoly );
68
        toolLine = new QToolButton( buttonGroupTools, "toolLine" );
69
        toolLine->setToggleButton( true );
70
        toolLine->setText( QString::null );
71
        toolLine->setIconSet( QIconSet( loadIcon("Stift.xpm") ) );
72
        buttonGroupToolsLayout->addWidget( toolLine );
73
        toolZoom = new QToolButton( buttonGroupTools, "toolZoom" );
74
        toolZoom->setToggleButton( true );
75
        toolZoom->setText( QString::null );
5287 cbradney 76
        toolZoom->setIconSet( QIconSet( loadIcon("16/zoom.png") ) );
1195 fschmid 77
        buttonGroupToolsLayout->addWidget( toolZoom );
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 );
411
        generalHeadLine = new QLabel( tr( "Misc. Settings" ), subTabGeneral, "generalHeadLine" );
412
        generalHeadLine->setFont(f);
413
        subTabGeneralLayout->addMultiCellWidget( generalHeadLine, 0, 0, 0, 1, Qt::AlignHCenter | Qt::AlignTop );
414
 
415
        genDispBox = new QGroupBox( subTabGeneral, "genDispBox" );
416
        genDispBox->setTitle( tr( "Object Duplicate" ) );
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 );
425
        genText1 = new QLabel( genDispX, tr( "X-Displacement" ), genDispBox, "genText1" );
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 );
431
        genText2 = new QLabel( genDispY, tr( "Y-Displacement" ), genDispBox, "genText2" );
432
        subTabGeneralLayout2->addWidget( genText2, 1, 0);
433
        subTabGeneralLayout->addMultiCellWidget( genDispBox, 1, 1, 0, 1, Qt::AlignHCenter | Qt::AlignTop );
434
        subStackTools->addWidget( subTabGeneral, 6 );
435
 
1195 fschmid 436
        tabToolsLayout->addWidget( subStackTools );
437
        toolText->setOn(true);
5711 subik 438
 
5815 jghali 439
        // Neccessary for document prefs
5890 subik 440
        //restoreDefaults(prefsData, unitIndex);
5711 subik 441
 
1195 fschmid 442
        QToolTip::add( toolText, tr( "Text Frame Properties" ) );
443
        QToolTip::add( toolImage, tr( "Picture Frame Properties" ) );
444
        QToolTip::add( toolShape, tr( "Shape Drawing Properties" ) );
445
        QToolTip::add( toolZoom, tr( "Magnification Level Defaults" ) );
446
        QToolTip::add( toolLine, tr( "Line Drawing Properties" ) );
447
        QToolTip::add( toolPoly, tr( "Polygon Drawing Properties" ) );
6606 fschmid 448
        QToolTip::add( toolMisc, tr( "Other Properties" ) );
1195 fschmid 449
        QToolTip::add( fontComboText, tr( "Font for new text frames" ) );
450
        QToolTip::add( sizeComboText, tr( "Size of font for new text frames" ) );
451
        QToolTip::add( colorComboText, tr( "Color of font" ) );
452
        QToolTip::add( columnsText, tr( "Number of columns in a text frame" ) );
453
        QToolTip::add( gapText, tr( "Gap between text frame columns" ) );
454
        QToolTip::add( previewText, tr( "Sample of your font" ) );
455
        QToolTip::add( buttonGroup3, tr( "Picture frames allow pictures to scale to any size" ) );
456
        QToolTip::add( scalingHorizontal, tr( "Horizontal scaling of images" ) );
457
        QToolTip::add( scalingVertical, tr( "Vertical scaling of images" ) );
458
        QToolTip::add( chainButton, tr( "Keep horizontal and vertical scaling the same" ) );
459
        QToolTip::add( buttonGroup5, tr( "Pictures in picture frames are scaled to the size of the frame" ) );
460
        QToolTip::add( checkRatioImage, tr( "Automatically scaled pictures keep their original proportions" ) );
461
        QToolTip::add( comboFillImage, tr( "Fill color of picture frames" ) );
462
        QToolTip::add( shadingFillImage, tr( "Saturation of color of fill" ) );
463
        QToolTip::add( colorComboLineShape, tr( "Line color of shapes" ) );
464
        QToolTip::add( shadingLineShape, tr( "Saturation of color of lines" ) );
465
        QToolTip::add( comboFillShape, tr( "Fill color of shapes" ) );
466
        QToolTip::add( shadingFillShape, tr( "Saturation of color of fill" ) );
467
        QToolTip::add( comboStyleShape, tr( "Line style of shapes" ) );
468
        QToolTip::add( lineWidthShape, tr( "Line width of shapes" ) );
469
        QToolTip::add( minimumZoom, tr( "Minimum magnification allowed" ) );
470
        QToolTip::add( maximumZoom, tr( "Maximum magnification allowed" ) );
471
        QToolTip::add( zoomStep, tr( "Change in magnification for each zoom operation" ) );
472
        QToolTip::add( colorComboLine, tr( "Color of lines" ) );
473
        QToolTip::add( shadingLine, tr( "Saturation of color" ) );
474
        QToolTip::add( comboStyleLine, tr( "Style of lines" ) );
475
        QToolTip::add( lineWidthLine, tr( "Width of lines" ) );
6606 fschmid 476
        QToolTip::add( genDispX, tr( "Horizontal displacement of objects") );
477
        QToolTip::add( genDispY, tr( "Vertical displacement of objects" ) );
5763 subik 478
        //enableSignals(true);
1195 fschmid 479
}
480
 
5763 subik 481
void TabTools::enableSignals(bool on)
1828 fschmid 482
{
5763 subik 483
        if (on)
484
        {
485
                connect(toolShape, SIGNAL(clicked()), this, SLOT(setTool()));
486
                connect(toolPoly, SIGNAL(clicked()), this, SLOT(setTool()));
487
                connect(toolImage, SIGNAL(clicked()), this, SLOT(setTool()));
488
                connect(toolText, SIGNAL(clicked()), this, SLOT(setTool()));
489
                connect(toolLine, SIGNAL(clicked()), this, SLOT(setTool()));
490
                connect(toolZoom, SIGNAL(clicked()), this, SLOT(setTool()));
6606 fschmid 491
                connect(toolMisc, SIGNAL(clicked()), this, SLOT(setTool()));
5763 subik 492
                connect(fontComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
493
                connect(sizeComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
494
                connect(colorComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
495
                connect(colorComboTextBackground, SIGNAL(activated(int)), this, SLOT(setSample()));
496
                connect(shadingTextBack, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
497
                connect(shadingText, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
498
                connect(buttonGroup3, SIGNAL(clicked(int)), this, SLOT(changeImageScalingFree(int)));
499
                connect(buttonGroup5, SIGNAL(clicked(int)), this, SLOT(changeImageScalingRatio(int)));
500
                connect(chainButton, SIGNAL(clicked()), this, SLOT(toggleChain()));
501
                connect(scalingHorizontal, SIGNAL(valueChanged(int)), this, SLOT(hChange()));
502
                connect(scalingVertical, SIGNAL(valueChanged(int)), this, SLOT(vChange()));
503
                connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
504
        }
505
        else
506
        {
507
                disconnect(toolShape, SIGNAL(clicked()), this, SLOT(setTool()));
508
                disconnect(toolPoly, SIGNAL(clicked()), this, SLOT(setTool()));
509
                disconnect(toolImage, SIGNAL(clicked()), this, SLOT(setTool()));
510
                disconnect(toolText, SIGNAL(clicked()), this, SLOT(setTool()));
511
                disconnect(toolLine, SIGNAL(clicked()), this, SLOT(setTool()));
512
                disconnect(toolZoom, SIGNAL(clicked()), this, SLOT(setTool()));
6606 fschmid 513
                disconnect(toolMisc, SIGNAL(clicked()), this, SLOT(setTool()));
5763 subik 514
                disconnect(fontComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
515
                disconnect(sizeComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
516
                disconnect(colorComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
517
                disconnect(colorComboTextBackground, SIGNAL(activated(int)), this, SLOT(setSample()));
518
                disconnect(shadingTextBack, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
519
                disconnect(shadingText, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
520
                disconnect(buttonGroup3, SIGNAL(clicked(int)), this, SLOT(changeImageScalingFree(int)));
521
                disconnect(buttonGroup5, SIGNAL(clicked(int)), this, SLOT(changeImageScalingRatio(int)));
522
                disconnect(chainButton, SIGNAL(clicked()), this, SLOT(toggleChain()));
523
                disconnect(scalingHorizontal, SIGNAL(valueChanged(int)), this, SLOT(hChange()));
524
                disconnect(scalingVertical, SIGNAL(valueChanged(int)), this, SLOT(vChange()));
525
                disconnect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
526
        }
527
}
528
 
5851 subik 529
void TabTools::restoreDefaults(struct toolPrefs *prefsData, int unitIndex)
5763 subik 530
{
531
        enableSignals(false);
532
 
5512 subik 533
        PrefsManager* prefsManager=PrefsManager::instance();
534
        unit = unitGetSuffixFromIndex(unitIndex);
535
        precision = unitGetPrecisionFromIndex(unitIndex);
536
        unitRatio = unitGetRatioFromIndex(unitIndex);
537
 
538
        for (int fc=0; fc<fontComboText->count(); ++fc)
539
        {
540
                if (fontComboText->text(fc) == prefsData->defFont)
541
                {
542
                        fontComboText->setCurrentItem(fc);
543
                        break;
544
                }
545
        }
5711 subik 546
        QString ar_sizes[] = {" 7", " 9", "10", "11", "12", "14", "18", "24", "36", "48", "60", "72"};
547
        size_t f_size = sizeof(ar_sizes) / sizeof(*ar_sizes);
548
        sizeComboText->clear();
549
        for (uint s = 0; s < f_size; ++s)
550
                sizeComboText->insertItem(ar_sizes[s] + tr(" pt"));
5512 subik 551
        for (int a = 0; a < sizeComboText->count(); ++a)
552
        {
553
                if (sizeComboText->text(a).left(2).toInt() == prefsData->defSize / 10)
554
                {
555
                        sizeComboText->setCurrentItem(a);
556
                        break;
557
                }
558
        }
5711 subik 559
 
560
        ColorList::Iterator itc;
561
        colorComboText->clear();
562
        colorComboText->insertItem(CommonStrings::NoneColor);
5512 subik 563
        if (prefsData->dPenText == CommonStrings::None)
5711 subik 564
                colorComboText->setCurrentItem(colorComboText->count()-1);
5512 subik 565
        if (docu != 0)
566
        {
567
                for (itc = docu->PageColors.begin(); itc != docu->PageColors.end(); ++itc)
568
                {
5711 subik 569
                        colorComboText->insertSmallItem( docu->PageColors[itc.key()], itc.key() );
5512 subik 570
                        if (itc.key() == prefsData->dPenText)
571
                                colorComboText->setCurrentItem(colorComboText->count()-1);
572
                }
573
        }
574
        else
575
        {
576
                ColorList* colorList=prefsManager->colorSetPtr();
577
                ColorList::Iterator endOfColorList=colorList->end();
578
                for (itc = colorList->begin(); itc != endOfColorList; ++itc)
579
                {
5711 subik 580
                        colorComboText->insertSmallItem( (*colorList)[itc.key()], itc.key() );
5512 subik 581
                        if (itc.key() == prefsData->dPenText)
582
                                colorComboText->setCurrentItem(colorComboText->count()-1);
583
                }
584
        }
5711 subik 585
 
5512 subik 586
        shadingText->setValue(prefsData->dTextPenShade);
5711 subik 587
 
588
        colorComboStrokeText->clear();
589
        colorComboStrokeText->insertItem(CommonStrings::NoneColor);
5512 subik 590
        if (prefsData->dStrokeText == CommonStrings::None)
5711 subik 591
                colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
5512 subik 592
        if (docu != 0)
593
        {
594
                for (itc = docu->PageColors.begin(); itc != docu->PageColors.end(); ++itc)
595
                {
5711 subik 596
                        colorComboStrokeText->insertSmallItem( docu->PageColors[itc.key()], itc.key() );
5512 subik 597
                        if (itc.key() == prefsData->dStrokeText)
598
                                colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
599
                }
600
        }
601
        else
602
        {
603
                ColorList* colorList=prefsManager->colorSetPtr();
604
                ColorList::Iterator endOfColorList=colorList->end();
605
                for (itc = colorList->begin(); itc != endOfColorList; ++itc)
606
                {
5711 subik 607
                        colorComboStrokeText->insertSmallItem( (*colorList)[itc.key()], itc.key() );
5512 subik 608
                        if (itc.key() == prefsData->dStrokeText)
609
                                colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
610
                }
611
        }
612
        shadingTextStroke->setValue(prefsData->dTextStrokeShade);
5711 subik 613
 
614
        colorComboTextBackground->clear();
615
        colorComboTextBackground->insertItem(CommonStrings::NoneColor);
5512 subik 616
        if (prefsData->dTextBackGround == CommonStrings::None)
5711 subik 617
                colorComboTextBackground->setCurrentItem(colorComboTextBackground->count()-1);
5512 subik 618
        if (docu != 0)
619
        {
620
                for (itc = docu->PageColors.begin(); itc != docu->PageColors.end(); ++itc)
621
                {
5711 subik 622
                        colorComboTextBackground->insertSmallItem( docu->PageColors[itc.key()], itc.key() );
5512 subik 623
                        if (itc.key() == prefsData->dTextBackGround)
624
                                colorComboTextBackground->setCurrentItem(colorComboTextBackground->count()-1);
625
                }
626
        }
627
        else
628
        {
629
                ColorList* colorList=prefsManager->colorSetPtr();
630
                ColorList::Iterator endOfColorList=colorList->end();
631
                for (itc = colorList->begin(); itc != endOfColorList; ++itc)
632
                {
5711 subik 633
                        colorComboTextBackground->insertSmallItem( (*colorList)[itc.key()], itc.key() );
5512 subik 634
                        if (itc.key() == prefsData->dTextBackGround)
635
                                colorComboTextBackground->setCurrentItem(colorComboTextBackground->count()-1);
636
                }
637
        }
638
        shadingTextBack->setValue(prefsData->dTextBackGroundShade);
5711 subik 639
 
640
        colorComboTextLine->clear();
641
        colorComboTextLine->insertItem(CommonStrings::NoneColor);
5512 subik 642
        if (prefsData->dTextLineColor == CommonStrings::None)
5711 subik 643
                colorComboTextLine->setCurrentItem(colorComboTextLine->count()-1);
5512 subik 644
        if (docu != 0)
645
        {
646
                for (itc = docu->PageColors.begin(); itc != docu->PageColors.end(); ++itc)
647
                {
5711 subik 648
                        colorComboTextLine->insertSmallItem( docu->PageColors[itc.key()], itc.key() );
5512 subik 649
                        if (itc.key() == prefsData->dTextLineColor)
650
                                colorComboTextLine->setCurrentItem(colorComboTextLine->count()-1);
651
                }
652
        }
653
        else
654
        {
655
                ColorList* colorList=prefsManager->colorSetPtr();
656
                ColorList::Iterator endOfColorList=colorList->end();
657
                for (itc = colorList->begin(); itc != endOfColorList; ++itc)
658
                {
5711 subik 659
                        colorComboTextLine->insertSmallItem( (*colorList)[itc.key()], itc.key() );
5512 subik 660
                        if (itc.key() == prefsData->dTextLineColor)
661
                                colorComboTextLine->setCurrentItem(colorComboTextLine->count()-1);
662
                }
663
        }
664
        shadingTextLine->setValue(prefsData->dTextLineShade);
5711 subik 665
 
666
        tabFillCombo->clear();
667
        tabFillCombo->insertItem( tr("None", "tab fill" ));
668
        tabFillCombo->insertItem( tr("Dot"));
669
        tabFillCombo->insertItem( tr("Hyphen"));
670
        tabFillCombo->insertItem( tr("Underscore"));
671
        tabFillCombo->insertItem( tr("Custom"));
5512 subik 672
        if (prefsData->tabFillChar.isEmpty())
673
        {
674
                tabFillCombo->setCurrentItem(0);
675
        }
676
        else if (prefsData->tabFillChar == ".")
677
        {
678
                tabFillCombo->setCurrentItem(1);
679
        }
680
        else if (prefsData->tabFillChar == "-")
681
        {
682
                tabFillCombo->setCurrentItem(2);
683
        }
684
        else if (prefsData->tabFillChar == "_")
685
        {
686
                tabFillCombo->setCurrentItem(3);
687
        }
688
        else
689
        {
690
                tabFillCombo->setCurrentItem(4);
691
                tabFillCombo->setEditable(true);
692
                tabFillCombo->setEditText( tr("Custom: "+prefsData->tabFillChar));
693
        }
5711 subik 694
        gapTab->setSuffix( unit );
5512 subik 695
        gapTab->setValue(prefsData->dTabWidth * unitRatio);
696
        columnsText->setValue(prefsData->dCols);
5711 subik 697
        gapText->setSuffix( unit );
5512 subik 698
        gapText->setValue(prefsData->dGap * unitRatio);
5711 subik 699
 
700
        colorComboLineShape->clear();
701
        colorComboLineShape->insertItem(CommonStrings::NoneColor);
5512 subik 702
        if (prefsData->dPen == CommonStrings::None)
5711 subik 703
                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
5512 subik 704
        if (docu != 0)
705
        {
706
                for (itc = docu->PageColors.begin(); itc != docu->PageColors.end(); ++itc)
707
                {
5711 subik 708
                        colorComboLineShape->insertSmallItem( docu->PageColors[itc.key()], itc.key() );
5512 subik 709
                        if (itc.key() == prefsData->dPen)
710
                                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
711
                }
712
        }
713
        else
714
        {
715
                ColorList* colorList=prefsManager->colorSetPtr();
716
                ColorList::Iterator endOfColorList=colorList->end();
717
                for (itc = colorList->begin(); itc != endOfColorList; ++itc)
718
                {
5711 subik 719
                        colorComboLineShape->insertSmallItem( (*colorList)[itc.key()], itc.key() );
5512 subik 720
                        if (itc.key() == prefsData->dPen)
721
                                colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
722
                }
723
        }
724
        shadingLineShape->setValue(prefsData->dShade2);
5711 subik 725
 
726
        comboFillShape->clear();
727
        comboFillShape->insertItem( tr("None"), "fill shape");
5512 subik 728
        if (prefsData->dBrush == CommonStrings::None)
5711 subik 729
                comboFillShape->setCurrentItem(comboFillShape->count()-1);
5512 subik 730
        if (docu != 0)
731
        {
732
                for (itc = docu->PageColors.begin(); itc != docu->PageColors.end(); ++itc)
733
                {
5711 subik 734
                        comboFillShape->insertSmallItem( docu->PageColors[itc.key()], itc.key() );
5512 subik 735
                        if (itc.key() == prefsData->dBrush)
736
                                comboFillShape->setCurrentItem(comboFillShape->count()-1);
737
                }
738
        }
739
        else
740
        {
741
                ColorList* colorList=prefsManager->colorSetPtr();
742
                ColorList::Iterator endOfColorList=colorList->end();
743
                for (itc = colorList->begin(); itc != endOfColorList; ++itc)
744
                {
5711 subik 745
                        comboFillShape->insertSmallItem( (*colorList)[itc.key()], itc.key() );
5512 subik 746
                        if (itc.key() == prefsData->dBrush)
747
                                comboFillShape->setCurrentItem(comboFillShape->count()-1);
748
                }
749
        }
5711 subik 750
 
5512 subik 751
        shadingFillShape->setValue(prefsData->dShade);
752
        switch (prefsData->dLineArt)
753
        {
754
                case SolidLine:
755
                        comboStyleShape->setCurrentItem(0);
756
                        break;
757
                case DashLine:
758
                        comboStyleShape->setCurrentItem(1);
759
                        break;
760
                case DotLine:
761
                        comboStyleShape->setCurrentItem(2);
762
                        break;
763
                case DashDotLine:
764
                        comboStyleShape->setCurrentItem(3);
765
                        break;
766
                case DashDotDotLine:
767
                        comboStyleShape->setCurrentItem(4);
768
                        break;
769
                default:
770
                        comboStyleShape->setCurrentItem(0);
771
                        break;
772
        }
5711 subik 773
 
5512 subik 774
        lineWidthShape->setValue(prefsData->dWidth);
5711 subik 775
 
776
        colorComboLine->clear();
777
        colorComboLine->insertItem(CommonStrings::NoneColor);
5512 subik 778
        if (prefsData->dPenLine == CommonStrings::None)
5711 subik 779
                colorComboLine->setCurrentItem(colorComboLine->count()-1);
5512 subik 780
        if (docu != 0)
781
        {
782
                for (itc = docu->PageColors.begin(); itc != docu->PageColors.end(); ++itc)
783
                {
5711 subik 784
                        colorComboLine->insertSmallItem( docu->PageColors[itc.key()], itc.key() );
5512 subik 785
                        if (itc.key() == prefsData->dPenLine)
786
                                colorComboLine->setCurrentItem(colorComboLine->count()-1);
787
                }
788
        }
789
        else
790
        {
791
                ColorList* colorList=prefsManager->colorSetPtr();
792
                ColorList::Iterator endOfColorList=colorList->end();
793
                for (itc = colorList->begin(); itc != endOfColorList; ++itc)
794
                {
5711 subik 795
                        colorComboLine->insertSmallItem( (*colorList)[itc.key()], itc.key() );
5512 subik 796
                        if (itc.key() == prefsData->dPenLine)
797
                                colorComboLine->setCurrentItem(colorComboLine->count()-1);
798
                }
799
        }
5711 subik 800
 
5512 subik 801
        shadingLine->setValue(prefsData->dShadeLine);
5711 subik 802
 
5512 subik 803
        switch (prefsData->dLstyleLine)
804
        {
805
                case SolidLine:
806
                        comboStyleLine->setCurrentItem(0);
807
                        break;
808
                case DashLine:
809
                        comboStyleLine->setCurrentItem(1);
810
                        break;
811
                case DotLine:
812
                        comboStyleLine->setCurrentItem(2);
813
                        break;
814
                case DashDotLine:
815
                        comboStyleLine->setCurrentItem(3);
816
                        break;
817
                case DashDotDotLine:
818
                        comboStyleLine->setCurrentItem(4);
819
                        break;
820
                default:
821
                        comboStyleLine->setCurrentItem(0);
822
                        break;
823
        }
5711 subik 824
 
5512 subik 825
        if (docu != 0)
826
        {
827
                startArrow->rebuildList(&docu->arrowStyles);
828
                endArrow->rebuildList(&docu->arrowStyles);
829
        }
830
        else
831
        {
832
                startArrow->rebuildList(&prefsManager->appPrefs.arrowStyles);
833
                endArrow->rebuildList(&prefsManager->appPrefs.arrowStyles);
834
        }
835
        startArrow->setCurrentItem(prefsData->dStartArrow);
836
        endArrow->setCurrentItem(prefsData->dEndArrow);
837
        lineWidthLine->setValue(prefsData->dWidthLine);
5711 subik 838
 
5512 subik 839
        buttonGroup3->setChecked( prefsData->scaleType );
840
        scalingHorizontal->setValue(qRound(prefsData->scaleX * 100));
841
        scalingVertical->setValue(qRound(prefsData->scaleY * 100));
842
        buttonGroup5->setChecked( !prefsData->scaleType );
843
        checkRatioImage->setChecked(prefsData->aspectRatio);
5711 subik 844
 
845
        comboFillImage->clear();
846
        comboFillImage->insertItem(CommonStrings::NoneColor);
5512 subik 847
        if (prefsData->dBrushPict == CommonStrings::None)
5711 subik 848
                comboFillImage->setCurrentItem(comboFillImage->count()-1);
5512 subik 849
        if (docu != 0)
850
        {
851
                for (itc = docu->PageColors.begin(); itc != docu->PageColors.end(); ++itc)
852
                {
5711 subik 853
                        comboFillImage->insertSmallItem( docu->PageColors[itc.key()], itc.key() );
5512 subik 854
                        if (itc.key() == prefsData->dBrushPict)
855
                                comboFillImage->setCurrentItem(comboFillImage->count()-1);
856
                }
857
        }
858
        else
859
        {
860
                ColorList* colorList=prefsManager->colorSetPtr();
861
                ColorList::Iterator endOfColorList=colorList->end();
862
                for (itc = colorList->begin(); itc != endOfColorList; ++itc)
863
                {
5711 subik 864
                        comboFillImage->insertSmallItem( (*colorList)[itc.key()], itc.key() );
5512 subik 865
                        if (itc.key() == prefsData->dBrushPict)
866
                                comboFillImage->setCurrentItem(comboFillImage->count()-1);
867
                }
868
        }
5711 subik 869
 
5512 subik 870
        shadingFillImage->setValue( prefsData->shadePict );
871
        embeddedPath->setChecked(prefsData->useEmbeddedPath);
872
        switch (prefsData->lowResType)
873
        {
874
                case 0:
875
                        checkFullRes->setChecked(true);
876
                        break;
877
                case 1:
878
                        checkNormalRes->setChecked(true);
879
                        break;
880
                case 2:
881
                        checkHalfRes->setChecked(true);
882
                        break;
883
        }
5711 subik 884
 
5512 subik 885
        minimumZoom->setValue(prefsData->magMin);
886
        maximumZoom->setValue(prefsData->magMax);
887
        zoomStep->setValue( prefsData->magStep );
5763 subik 888
 
6606 fschmid 889
        genDispX->setValue(prefsData->dispX);
890
        genDispY->setValue(prefsData->dispY);
891
 
5851 subik 892
        setSample();
5763 subik 893
 
894
        enableSignals(true);
1828 fschmid 895
}
896
 
2282 fschmid 897
void TabTools::setCustomFillChar(const QString &txt)
898
{
899
        if (txt == tr("Custom:"))
900
                return;
901
        disconnect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
3629 fschmid 902
        disconnect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
2282 fschmid 903
        QString ret = txt.right(1);
904
        if (tabFillCombo->editable())
905
        {
906
                tabFillCombo->setCurrentItem(4);
907
                tabFillCombo->setEditText( tr("Custom: ")+ret);
908
                tabFillCombo->changeItem( tr("Custom: ")+ret, 4);
909
        }
910
        connect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
3629 fschmid 911
        connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
2282 fschmid 912
}
913
 
3629 fschmid 914
void TabTools::setFillChar(int act)
2282 fschmid 915
{
916
        disconnect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
3629 fschmid 917
        disconnect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
918
        switch (act)
2282 fschmid 919
        {
920
                case 0:
921
                case 1:
922
                case 2:
923
                case 3:
3629 fschmid 924
                        tabFillCombo->setCurrentItem(act);
2282 fschmid 925
                        tabFillCombo->setEditable(false);
926
                        break;
927
                case 4:
928
                        tabFillCombo->setEditable(true);
3629 fschmid 929
                        tabFillCombo->setEditText( tr("Custom: "));
2282 fschmid 930
                        tabFillCombo->changeItem( tr("Custom: "), 4);
3629 fschmid 931
                        tabFillCombo->lineEdit()->setFocus();
932
                        tabFillCombo->lineEdit()->setCursorPosition( tr("Custom: ").length());
933
                        connect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
2282 fschmid 934
                        break;
935
        }
3629 fschmid 936
        connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
2282 fschmid 937
}
938
 
1195 fschmid 939
void TabTools::toggleChain()
940
{
941
        if (chainButton->isOn())
942
                scalingVertical->setValue(scalingHorizontal->value());
943
}
944
 
945
void TabTools::hChange()
946
{
947
        if (chainButton->isOn())
948
                scalingVertical->setValue(scalingHorizontal->value());
949
}
950
 
951
void TabTools::vChange()
952
{
953
        if (chainButton->isOn())
954
                scalingHorizontal->setValue(scalingVertical->value());
955
}
956
 
957
void TabTools::changeImageScalingFree(int)
958
{
959
        if (buttonGroup3->isChecked())
960
                buttonGroup5->setChecked(false);
961
        else
962
                buttonGroup5->setChecked(true);
963
}
964
 
965
void TabTools::changeImageScalingRatio(int)
966
{
967
        if (buttonGroup5->isChecked())
968
                buttonGroup3->setChecked(false);
969
        else
970
                buttonGroup3->setChecked(true);
971
}
972
 
973
void TabTools::setSample()
974
{
5851 subik 975
        if (!fontPreview)
976
                return;
5890 subik 977
 
5898 subik 978
        SampleItem *si = new SampleItem(docu);
6260 fschmid 979
        si->setText( tr("Woven silk pyjamas exchanged for blue quartz"));
4729 subik 980
        if (colorComboTextBackground->currentText() != CommonStrings::NoneColor)
4614 fschmid 981
        {
982
                if (docu != 0)
983
                {
984
                        si->setBgColor(docu->PageColors[colorComboTextBackground->currentText()].getRawRGBColor());
985
                        si->setBgShade(shadingTextBack->value());
986
                }
987
                else
988
                {
989
                        PrefsManager* prefsManager=PrefsManager::instance();
990
                        ColorList* colorList=prefsManager->colorSetPtr();
991
                        si->setBgColor((*colorList)[colorComboTextBackground->currentText()].getRawRGBColor());
992
                        si->setBgShade(shadingTextBack->value());
993
                }
994
        }
995
        else
996
                si->setBgColor(paletteBackgroundColor());
5890 subik 997
 
4729 subik 998
        if (colorComboText->currentText() != CommonStrings::NoneColor)
4614 fschmid 999
        {
1000
                if (docu != 0)
1001
                {
1002
                        si->setTxColor(docu->PageColors[colorComboText->currentText()].getRawRGBColor());
1003
                        si->setTxShade(shadingText->value());
1004
                }
1005
                else
1006
                {
1007
                        PrefsManager* prefsManager=PrefsManager::instance();
1008
                        ColorList* colorList=prefsManager->colorSetPtr();
1009
                        si->setTxColor((*colorList)[colorComboText->currentText()].getRawRGBColor());
1010
                        si->setTxShade(shadingText->value());
1011
                }
1012
        }
1013
        else
1014
                si->setTxColor(paletteBackgroundColor());
4077 subik 1015
        si->setFont(fontComboText->currentText());
1016
        si->setFontSize(sizeComboText->currentText().left(2).toInt() * 10, true);
5763 subik 1017
        previewText->setPixmap(si->getSample(previewText->width(), previewText->height()));
4077 subik 1018
        delete si;
1195 fschmid 1019
}
1020
 
1021
void TabTools::setTool()
1022
{
1023
        if (toolText == sender())
1024
                subStackTools->raiseWidget(0);
1025
        if (toolShape == sender())
1026
                subStackTools->raiseWidget(1);
1027
        if (toolLine == sender())
1028
                subStackTools->raiseWidget(2);
1029
        if (toolImage == sender())
1030
                subStackTools->raiseWidget(3);
1031
        if (toolPoly == sender())
1032
                subStackTools->raiseWidget(4);
1033
        if (toolZoom == sender())
1034
                subStackTools->raiseWidget(5);
6606 fschmid 1035
        if (toolMisc == sender())
1036
                subStackTools->raiseWidget(6);
1195 fschmid 1037
}
5851 subik 1038
 
1039
void TabTools::enableFontPreview(bool state)
1040
{
1041
        fontPreview = state;
1042
        setSample();
1043
}
1044
 
1045
void TabTools::unitChange(QString unit, int docUnitIndex, int decimals, double invUnitConversion)
1046
{
1047
        double oldMin, oldMax, val;
1048
        int decimalsOld;
1049
 
1050
        gapText->setSuffix(unit);
1051
        gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1052
        gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1053
        gapTab->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1054
        gapTab->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
6606 fschmid 1055
        genDispX->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1056
        genDispX->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1057
        genDispY->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1058
        genDispY->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
5851 subik 1059
}