Back to index

scribus-ng  1.3.4.dfsg+svn20071115
tabtools.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "tabtools.h"
00008 #include "tabtools.moc"
00009 #include <qtooltip.h>
00010 #include <qspinbox.h>
00011 #include <qgroupbox.h>
00012 
00013 #include "sccombobox.h"
00014 #include "colorcombo.h"
00015 #include "units.h"
00016 #include "mspinbox.h"
00017 #include "linecombo.h"
00018 #include "fontcombo.h"
00019 #include "polygonwidget.h"
00020 #include "arrowchooser.h"
00021 #include "linkbutton.h"
00022 #include "scribusstructs.h"
00023 #include "scribus.h"
00024 #include "util.h"
00025 #include "prefsmanager.h"
00026 #include "scfonts.h"
00027 #include "sampleitem.h"
00028 #include "commonstrings.h"
00029 #include "colorlistbox.h"
00030 
00031 
00032 TabTools::TabTools( QWidget* parent, struct toolPrefs *prefsData, int unitIndex, ScribusDoc* doc) : QWidget( parent, "tabtools", 0 )
00033 {
00034        docu = doc;
00035        fontPreview = false;
00036 
00037        tabToolsLayout = new QHBoxLayout( this, 0, 5, "tabToolsLayout");
00038        buttonGroupTools = new QButtonGroup( this, "buttonGroupTools" );
00039        buttonGroupTools->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)5, 0, 0, buttonGroupTools->sizePolicy().hasHeightForWidth() ) );
00040        buttonGroupTools->setExclusive( true );
00041        buttonGroupTools->setRadioButtonExclusive( true );
00042        buttonGroupTools->setColumnLayout(0, Qt::Vertical );
00043        buttonGroupTools->layout()->setSpacing( 5 );
00044        buttonGroupTools->layout()->setMargin( 5 );
00045        buttonGroupTools->setTitle( QString::null );
00046        buttonGroupToolsLayout = new QVBoxLayout( buttonGroupTools->layout() );
00047        buttonGroupToolsLayout->setAlignment( Qt::AlignTop );
00048        toolText = new QToolButton( buttonGroupTools, "toolText" );
00049        toolText->setToggleButton( true );
00050        toolText->setText( QString::null );
00051        toolText->setIconSet( QIconSet( loadIcon("16/insert-text-frame.png") ) );
00052        buttonGroupToolsLayout->addWidget( toolText );
00053        toolImage = new QToolButton( buttonGroupTools, "toolImage" );
00054        toolImage->setToggleButton( true );
00055        toolImage->setText( QString::null );
00056        toolImage->setIconSet( QIconSet( loadIcon("16/insert-image.png") ) );
00057        buttonGroupToolsLayout->addWidget( toolImage );
00058        toolShape = new QToolButton( buttonGroupTools, "toolShape" );
00059        toolShape->setToggleButton( true );
00060        toolShape->setText( QString::null );
00061        toolShape->setIconSet( QIconSet( loadIcon("16/draw-rectangle.png") ) );
00062        buttonGroupToolsLayout->addWidget( toolShape);
00063        toolPoly = new QToolButton( buttonGroupTools, "toolPoly" );
00064        toolPoly->setToggleButton( true );
00065        toolPoly->setText( QString::null );
00066        toolPoly->setIconSet( QIconSet( loadIcon("16/draw-polygon.png") ) );
00067        buttonGroupToolsLayout->addWidget( toolPoly );
00068        toolLine = new QToolButton( buttonGroupTools, "toolLine" );
00069        toolLine->setToggleButton( true );
00070        toolLine->setText( QString::null );
00071        toolLine->setIconSet( QIconSet( loadIcon("Stift.xpm") ) );
00072        buttonGroupToolsLayout->addWidget( toolLine );
00073        toolZoom = new QToolButton( buttonGroupTools, "toolZoom" );
00074        toolZoom->setToggleButton( true );
00075        toolZoom->setText( QString::null );
00076        toolZoom->setIconSet( QIconSet( loadIcon("16/zoom.png") ) );
00077        buttonGroupToolsLayout->addWidget( toolZoom );
00078        toolMisc = new QToolButton( buttonGroupTools, "toolMisc" );
00079        toolMisc->setToggleButton( true );
00080        toolMisc->setText( QString::null );
00081        toolMisc->setIconSet( QIconSet( loadIcon("configure.png") ) );
00082        buttonGroupToolsLayout->addWidget( toolMisc );
00083        tabToolsLayout->addWidget( buttonGroupTools );
00084        subStackTools = new QWidgetStack( this, "subStackTools" );
00085        subStackTools->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)5, 0, 0, subStackTools->sizePolicy().hasHeightForWidth() ) );
00086        subStackTools->setFrameShape( QWidgetStack::GroupBoxPanel );
00087        subStackTools->setFrameShadow( QWidgetStack::Sunken );
00088        QFont f(this->font());
00089        f.setPointSize(f.pointSize()+3);
00090        f.setBold(true);
00091 
00092        subTabText = new QWidget( subStackTools, "subTabText" );
00093        subTabTextLayout = new QGridLayout( subTabText, 1, 1, 11, 6, "subTabTextLayout");
00094        subTabTextLayout->setAlignment( Qt::AlignTop );
00095        textHeadLine = new QLabel( tr( "Text" ), subTabText, "textHeadLine" );
00096        textHeadLine->setFont(f);
00097        subTabTextLayout->addMultiCellWidget( textHeadLine, 0, 0, 0, 3, Qt::AlignHCenter | Qt::AlignTop );
00098        fontComboText = new FontCombo(subTabText);
00099        subTabTextLayout->addMultiCellWidget( fontComboText, 1, 1, 1, 3, Qt::AlignLeft );
00100        textLabel1b = new QLabel( fontComboText, tr( "Font:" ), subTabText, "textLabel1b" );
00101        subTabTextLayout->addWidget( textLabel1b, 1, 0 );
00102        sizeComboText = new ScComboBox( false, subTabText, "SizeCombo" );
00103 
00104        subTabTextLayout->addMultiCellWidget( sizeComboText, 2, 2, 1, 3, Qt::AlignLeft );
00105        textLabel2b = new QLabel(sizeComboText, tr( "Size:" ), subTabText, "textLabel2b" );
00106        subTabTextLayout->addWidget( textLabel2b, 2, 0 );
00107 
00108        colorComboText = new ColorCombo( false, subTabText, "colorComboText" );
00109 
00110        subTabTextLayout->addWidget( colorComboText, 3, 1 );
00111        textLabel3b = new QLabel(colorComboText, tr( "Text Color:" ), subTabText, "textLabel3b" );
00112        subTabTextLayout->addWidget( textLabel3b, 3, 0 );
00113        shadingText = new QSpinBox( subTabText, "shadingText" );
00114        shadingText->setMaxValue( 100 );
00115        shadingText->setSuffix( tr( " %" ) );
00116        shadingText->setMinValue( 0 );
00117        subTabTextLayout->addWidget( shadingText, 3, 3, Qt::AlignLeft );
00118        textLabelTS = new QLabel( shadingText, tr( "Shading:" ), subTabText, "textLabelTS" );
00119        subTabTextLayout->addWidget( textLabelTS, 3, 2 );
00120 
00121        colorComboStrokeText = new ColorCombo( false, subTabText, "colorComboStrokeText" );
00122 
00123        subTabTextLayout->addWidget( colorComboStrokeText, 4, 1 );
00124        textLabel3b2 = new QLabel(colorComboStrokeText, tr( "Text Stroke:" ), subTabText, "textLabel3b2" );
00125        subTabTextLayout->addWidget( textLabel3b2, 4, 0 );
00126        shadingTextStroke = new QSpinBox( subTabText, "shadingTextStroke" );
00127        shadingTextStroke->setMaxValue( 100 );
00128        shadingTextStroke->setSuffix( tr( " %" ) );
00129        shadingTextStroke->setMinValue( 0 );
00130 
00131        subTabTextLayout->addWidget( shadingTextStroke, 4, 3, Qt::AlignLeft );
00132        textLabelTSS = new QLabel( shadingTextStroke, tr( "Shading:" ), subTabText, "textLabelTS" );
00133        subTabTextLayout->addWidget( textLabelTSS, 4, 2 );
00134 
00135        colorComboTextBackground = new ColorCombo( false, subTabText, "colorComboTextBackground" );
00136 
00137        subTabTextLayout->addWidget( colorComboTextBackground, 5, 1 );
00138        textLabel3bT = new QLabel(colorComboTextBackground, tr( "Fill Color:" ), subTabText, "textLabel3b" );
00139        subTabTextLayout->addWidget( textLabel3bT, 5, 0 );
00140        shadingTextBack = new QSpinBox( subTabText, "shadingTextBack" );
00141        shadingTextBack->setMaxValue( 100 );
00142        shadingTextBack->setSuffix( tr( " %" ) );
00143        shadingTextBack->setMinValue( 0 );
00144 
00145        subTabTextLayout->addWidget( shadingTextBack, 5, 3, Qt::AlignLeft );
00146        textLabelTSB = new QLabel( shadingTextBack, tr( "Shading:" ), subTabText, "textLabelTSS" );
00147        subTabTextLayout->addWidget( textLabelTSB, 5, 2 );
00148 
00149        colorComboTextLine = new ColorCombo( false, subTabText, "colorComboTextLine" );
00150 
00151        subTabTextLayout->addWidget( colorComboTextLine, 6, 1 );
00152        textLabel3bTL = new QLabel(colorComboTextLine, tr( "Stroke Color:" ), subTabText, "textLabel3b2" );
00153        subTabTextLayout->addWidget( textLabel3bTL, 6, 0 );
00154        shadingTextLine = new QSpinBox( subTabText, "shadingTextStroke" );
00155        shadingTextLine->setMaxValue( 100 );
00156        shadingTextLine->setSuffix( tr( " %" ) );
00157        shadingTextLine->setMinValue( 0 );
00158 
00159        subTabTextLayout->addWidget( shadingTextLine, 6, 3, Qt::AlignLeft );
00160        textLabelTSL = new QLabel( shadingTextLine, tr( "Shading:" ), subTabText, "textLabelTSL" );
00161        subTabTextLayout->addWidget( textLabelTSL, 6, 2 );
00162 
00163        tabFillCombo = new ScComboBox( false, subTabText, "tabFillCombo" );
00164 
00165        subTabTextLayout->addWidget( tabFillCombo, 7, 1, Qt::AlignLeft );
00166        textLabel3b2t = new QLabel(tabFillCombo, tr( "Tab Fill Character:" ), subTabText, "textLabel3b2t" );
00167        subTabTextLayout->addWidget( textLabel3b2t, 7, 0 );
00168        gapTab = new MSpinBox( 1, 200, subTabText, 2 );
00169 
00170        subTabTextLayout->addWidget( gapTab, 7, 3, Qt::AlignLeft );
00171        textLabel3b2t2 = new QLabel(gapTab, tr( "Tab Width:" ), subTabText, "textLabel3b2t2" );
00172        subTabTextLayout->addWidget( textLabel3b2t2, 7, 2 );
00173        columnsText = new QSpinBox( subTabText, "columnsText" );
00174        columnsText->setMinValue( 1 );
00175        columnsText->setMaxValue(100);
00176 
00177        subTabTextLayout->addWidget( columnsText, 8, 1, Qt::AlignLeft );
00178        textLabel4b = new QLabel(columnsText, tr("Colu&mns:"), subTabText, "TextCol");
00179        subTabTextLayout->addWidget( textLabel4b, 8, 0 );
00180        gapText = new MSpinBox( 0, 200, subTabText, 2 );
00181 
00182        subTabTextLayout->addWidget( gapText, 8, 3, Qt::AlignLeft );
00183        textLabel5b = new QLabel(gapText, tr("&Gap:"), subTabText, "TextCol");
00184        subTabTextLayout->addWidget( textLabel5b, 8, 2 );
00185        previewText = new QLabel( tr( "Woven silk pyjamas exchanged for blue quartz" ), subTabText, "previewText" );
00186        previewText->setMinimumSize(QSize(400, 170));
00187        previewText->setMaximumSize(QSize(400, 170));
00188        previewText->setFrameShape(QFrame::Box);
00189        previewText->setAlignment( static_cast<int>( QLabel::AlignTop | QLabel::AlignLeft ) );
00190        subTabTextLayout->addMultiCellWidget( previewText, 9, 9, 0, 3 );
00191        subStackTools->addWidget( subTabText, 0 );
00192 
00193        subTabShape = new QWidget( subStackTools, "subTabShape" );
00194        subTabShapeLayout = new QGridLayout( subTabShape, 1, 1, 11, 6, "subTabShapeLayout");
00195        subTabShapeLayout->setAlignment( Qt::AlignTop );
00196        shapeHeadLine = new QLabel( tr( "Shapes" ), subTabShape, "shapeHeadLine" );
00197        shapeHeadLine->setFont(f);
00198        subTabShapeLayout->addMultiCellWidget( shapeHeadLine, 0, 0, 0, 1, Qt::AlignHCenter | Qt::AlignTop );
00199        colorComboLineShape = new ColorCombo( false, subTabShape, "colorComboLineShape" );
00200 
00201        subTabShapeLayout->addWidget( colorComboLineShape, 1, 1, Qt::AlignLeft );
00202        textLabel7b = new QLabel( colorComboLineShape, tr( "&Line Color:" ), subTabShape, "textLabel7b" );
00203        subTabShapeLayout->addWidget( textLabel7b, 1, 0 );
00204        shadingLineShape = new QSpinBox( subTabShape, "shadingLineShape" );
00205        shadingLineShape->setMaxValue( 100 );
00206        shadingLineShape->setSuffix( tr( " %" ) );
00207        shadingLineShape->setMinValue( 0 );
00208 
00209        subTabShapeLayout->addWidget( shadingLineShape, 2, 1, Qt::AlignLeft );
00210        textLabel8b = new QLabel( shadingLineShape, tr( "&Shading:" ), subTabShape, "textLabel8b" );
00211        subTabShapeLayout->addWidget( textLabel8b, 2, 0 );
00212        comboFillShape = new ColorCombo( false, subTabShape, "comboFillShape" );
00213 
00214        subTabShapeLayout->addWidget( comboFillShape, 3, 1, Qt::AlignLeft );
00215        textLabel9b = new QLabel( comboFillShape, tr( "&Fill Color:" ), subTabShape, "textLabel9b" );
00216        subTabShapeLayout->addWidget( textLabel9b, 3, 0 );
00217        shadingFillShape = new QSpinBox( subTabShape, "shadingFillShape" );
00218        shadingFillShape->setMaxValue( 100 );
00219        shadingFillShape->setSuffix( tr( " %" ) );
00220        shadingFillShape->setMinValue( 0 );
00221 
00222        subTabShapeLayout->addWidget( shadingFillShape, 4, 1, Qt::AlignLeft );
00223        textLabel10b = new QLabel( shadingFillShape, tr( "S&hading:" ), subTabShape, "textLabel10b" );
00224        subTabShapeLayout->addWidget( textLabel10b, 4, 0 );
00225        comboStyleShape = new LineCombo(subTabShape);
00226        comboStyleShape->setEditable(false);
00227 
00228        subTabShapeLayout->addWidget( comboStyleShape, 5, 1, Qt::AlignLeft );
00229        textLabel11b = new QLabel( comboStyleShape, tr( "Line Style:" ), subTabShape, "textLabel11b" );
00230        subTabShapeLayout->addWidget( textLabel11b, 5, 0 );
00231        lineWidthShape = new MSpinBox( 0, 36, subTabShape, 1 );
00232        lineWidthShape->setSuffix( tr( " pt" ) );
00233 
00234        subTabShapeLayout->addWidget( lineWidthShape, 6, 1, Qt::AlignLeft );
00235        textLabel12b = new QLabel( lineWidthShape, tr( "Line &Width:" ), subTabShape, "TextLabel2_3_4" );
00236        subTabShapeLayout->addWidget( textLabel12b, 6, 0 );
00237        subStackTools->addWidget( subTabShape, 1 );
00238 
00239        subTabLine = new QWidget( subStackTools, "subTabLine" );
00240        subTabLineLayout = new QGridLayout( subTabLine, 1, 1, 11, 6, "subTabLineLayout");
00241        subTabLineLayout->setAlignment( Qt::AlignTop );
00242        lineHeadLine = new QLabel( tr( "Lines" ), subTabLine, "lineHeadLine" );
00243        lineHeadLine->setFont(f);
00244        subTabLineLayout->addMultiCellWidget( lineHeadLine, 0, 0, 0, 2, Qt::AlignHCenter | Qt::AlignTop );
00245        colorComboLine = new ColorCombo( false, subTabLine, "colorComboLine" );
00246 
00247        subTabLineLayout->addMultiCellWidget( colorComboLine, 1, 1, 1, 2, Qt::AlignLeft );
00248        textLabel13b = new QLabel(colorComboLine, tr("&Line Color:"), subTabLine, "textLabel13b" );
00249        subTabLineLayout->addWidget( textLabel13b, 1, 0 );
00250        shadingLine = new QSpinBox( subTabLine, "shadingLine" );
00251        shadingLine->setMaxValue( 100 );
00252 
00253        shadingLine->setSuffix( tr( " %" ) );
00254        subTabLineLayout->addMultiCellWidget( shadingLine, 2, 2, 1, 2, Qt::AlignLeft );
00255        textLabel14b = new QLabel(shadingLine, tr("&Shading:"), subTabLine, "textLabel14b" );
00256        subTabLineLayout->addWidget( textLabel14b, 2, 0 );
00257        comboStyleLine = new LineCombo(subTabLine);
00258        comboStyleLine->setEditable(false);
00259 
00260        subTabLineLayout->addMultiCellWidget( comboStyleLine, 3, 3, 1, 2, Qt::AlignLeft );
00261        textLabel15b = new QLabel(subTabLine, tr("Line S&tyle:"), subTabLine, "textLabel15b" );
00262        subTabLineLayout->addWidget( textLabel15b, 3, 0 );
00263        startArrow = new ArrowChooser(subTabLine, true);
00264        subTabLineLayout->addWidget( startArrow, 5, 1 );
00265        endArrow = new ArrowChooser(subTabLine, false);
00266        subTabLineLayout->addWidget( endArrow, 5, 2 );
00267 
00268        arrowText = new QLabel( tr( "Arrows:" ), subTabLine, "arrowText" );
00269        subTabLineLayout->addMultiCellWidget( arrowText, 4, 5, 0, 0 );
00270        startArrowText = new QLabel( startArrow, tr( "Start:" ), subTabLine, "startArrowText" );
00271        subTabLineLayout->addWidget( startArrowText, 4, 1 );
00272        endArrowText = new QLabel( endArrow, tr( "End:" ), subTabLine, "endArrowText" );
00273        subTabLineLayout->addWidget( endArrowText, 4, 2 );
00274        lineWidthLine = new MSpinBox( 1, 36, subTabLine, 1 );
00275        lineWidthLine->setSuffix( tr( " pt" ) );
00276 
00277        subTabLineLayout->addMultiCellWidget( lineWidthLine, 6, 6, 1, 2, Qt::AlignLeft );
00278        textLabel16b = new QLabel(lineWidthLine, tr("Line &Width:"), subTabLine, "textLabel16b" );
00279        subTabLineLayout->addWidget( textLabel16b, 6, 0 );
00280        subStackTools->addWidget( subTabLine, 2 );
00281 
00282        subTabImage = new QWidget( subStackTools, "subTabImage" );
00283        subTabImageLayout = new QGridLayout( subTabImage, 1, 1, 11, 6, "subTabImageLayout");
00284        subTabImageLayout->setAlignment( Qt::AlignTop );
00285        imageHeadLine = new QLabel( tr( "Images" ), subTabImage, "imageHeadLine" );
00286        imageHeadLine->setFont(f);
00287        subTabImageLayout->addMultiCellWidget( imageHeadLine, 0, 0, 0, 1, Qt::AlignHCenter | Qt::AlignTop );
00288        buttonGroup3 = new QButtonGroup( subTabImage, "buttonGroup3" );
00289        buttonGroup3->setCheckable( true );
00290 
00291        buttonGroup3->setColumnLayout(0, Qt::Vertical );
00292        buttonGroup3->layout()->setSpacing( 6 );
00293        buttonGroup3->layout()->setMargin( 11 );
00294        buttonGroup3->setTitle( tr( "&Free Scaling" ) );
00295        buttonGroup3Layout = new QGridLayout( buttonGroup3->layout() );
00296        buttonGroup3Layout->setAlignment( Qt::AlignTop );
00297        scalingHorizontal = new QSpinBox( buttonGroup3, "scalingHorizontal" );
00298        scalingHorizontal->setMaxValue( 1000 );
00299        scalingHorizontal->setMinValue( 1 );
00300 
00301        scalingHorizontal->setSuffix( tr( " %" ) );
00302        buttonGroup3Layout->addWidget( scalingHorizontal, 0, 1, Qt::AlignRight );
00303        textLabel17b = new QLabel(scalingHorizontal, tr("&Horizontal Scaling:"), buttonGroup3, "textLabel17b" );
00304        buttonGroup3Layout->addWidget( textLabel17b, 0, 0 );
00305        scalingVertical = new QSpinBox( buttonGroup3, "scalingVertical" );
00306        scalingVertical->setMaxValue( 1000 );
00307        scalingVertical->setMinValue( 1 );
00308        scalingVertical->setSuffix( tr( " %" ) );
00309 
00310        buttonGroup3Layout->addWidget( scalingVertical, 1, 1, Qt::AlignRight );
00311        textLabel18b = new QLabel(scalingVertical, tr( "&Vertical Scaling:" ), buttonGroup3, "textLabel18b" );
00312        buttonGroup3Layout->addWidget( textLabel18b, 1, 0 );
00313        chainButton = new LinkButton( buttonGroup3 );
00314        chainButton->setToggleButton( true );
00315        chainButton->setAutoRaise(true);
00316        buttonGroup3Layout->addMultiCellWidget( chainButton, 0, 1, 2, 2, Qt::AlignLeft );
00317        subTabImageLayout->addMultiCellWidget( buttonGroup3, 1, 1, 0, 1 );
00318        buttonGroup5 = new QButtonGroup( subTabImage, "buttonGroup5" );
00319        buttonGroup5->setCheckable( true );
00320 
00321        buttonGroup5->setColumnLayout(0, Qt::Vertical );
00322        buttonGroup5->layout()->setSpacing( 6 );
00323        buttonGroup5->layout()->setMargin( 11 );
00324        buttonGroup5->setTitle( tr( "&Scale Picture to Frame Size" ) );
00325        buttonGroup5Layout = new QHBoxLayout( buttonGroup5->layout() );
00326        buttonGroup5Layout->setAlignment( Qt::AlignTop );
00327        checkRatioImage = new QCheckBox( buttonGroup5, "checkRatioImage" );
00328        checkRatioImage->setText( tr( "Keep Aspect &Ratio" ) );
00329 
00330        buttonGroup5Layout->addWidget( checkRatioImage );
00331        subTabImageLayout->addMultiCellWidget( buttonGroup5, 2, 2, 0, 1 );
00332        comboFillImage = new ColorCombo( false, subTabImage, "comboFillImage" );
00333 
00334        subTabImageLayout->addWidget( comboFillImage, 3, 1, Qt::AlignLeft );
00335        textLabel19b = new QLabel(comboFillImage, tr( "F&ill Color:" ), subTabImage, "textLabel19b" );
00336        subTabImageLayout->addWidget( textLabel19b, 3, 0 );
00337        shadingFillImage = new QSpinBox( subTabImage, "shadingFillImage" );
00338        shadingFillImage->setMaxValue( 100 );
00339 
00340        shadingFillImage->setSuffix( tr( " %" ) );
00341        subTabImageLayout->addWidget( shadingFillImage, 4, 1, Qt::AlignLeft );
00342        textLabel20b = new QLabel(shadingFillImage, tr( "S&hading:" ), subTabImage, "textLabel20b" );
00343        subTabImageLayout->addWidget( textLabel20b, 4, 0 );
00344        embeddedPath = new QCheckBox( subTabImage, "embeddedPath" );
00345        embeddedPath->setText( tr( "Use embedded Clipping Path" ) );
00346 
00347        subTabImageLayout->addMultiCellWidget( embeddedPath, 5, 5, 0, 1 );
00348        buttonGroupRes = new QButtonGroup( subTabImage, "buttonGroup3" );
00349        buttonGroupRes->setColumnLayout(0, Qt::Vertical );
00350        buttonGroupRes->layout()->setSpacing( 6 );
00351        buttonGroupRes->layout()->setMargin( 11 );
00352        buttonGroupRes->setExclusive( true );
00353        buttonGroupRes->setTitle( tr( "On Screen Preview" ) );
00354        buttonGroupResLayout = new QVBoxLayout( buttonGroupRes->layout() );
00355        buttonGroupResLayout->setAlignment( Qt::AlignTop );
00356        checkFullRes = new QRadioButton( buttonGroupRes, "checkFullRes" );
00357        checkFullRes->setText( tr( "Full Resolution Preview" ) );
00358        buttonGroupResLayout->addWidget( checkFullRes );
00359        checkNormalRes = new QRadioButton( buttonGroupRes, "checkNormalRes" );
00360        checkNormalRes->setText( tr( "Normal Resolution Preview" ) );
00361        buttonGroupResLayout->addWidget( checkNormalRes );
00362        checkHalfRes = new QRadioButton( buttonGroupRes, "checkHalfRes" );
00363        checkHalfRes->setText( tr( "Low Resolution Preview" ) );
00364        buttonGroupResLayout->addWidget( checkHalfRes );
00365 
00366        subTabImageLayout->addMultiCellWidget( buttonGroupRes, 6, 6, 0, 1 );
00367        subStackTools->addWidget( subTabImage, 3 );
00368 
00369        subTabPolygon = new QWidget( subStackTools, "subTabPolygon" );
00370        subTabPolygonLayout = new QGridLayout( subTabPolygon, 1, 1, 11, 6, "subTabZoomLayout");
00371        subTabPolygonLayout->setAlignment( Qt::AlignTop );
00372        polygonHeadLine = new QLabel( tr( "Regular Polygons" ), subTabPolygon, "imageHeadLine" );
00373        polygonHeadLine->setFont(f);
00374        subTabPolygonLayout->addMultiCellWidget( polygonHeadLine, 0, 0, 0, 0, Qt::AlignHCenter | Qt::AlignTop );
00375        polyWidget = new PolygonWidget(subTabPolygon, prefsData->polyC, prefsData->polyFd, prefsData->polyF, prefsData->polyS, prefsData->polyR);
00376        subTabPolygonLayout->addWidget( polyWidget, 1, 0 );
00377        subStackTools->addWidget( subTabPolygon, 4 );
00378 
00379        subTabZoom = new QWidget( subStackTools, "subTabZoom" );
00380        subTabZoomLayout = new QGridLayout( subTabZoom, 1, 1, 11, 6, "subTabZoomLayout");
00381        subTabZoomLayout->setAlignment( Qt::AlignTop );
00382        zoomHeadLine = new QLabel( tr( "Zoom" ), subTabZoom, "zoomHeadLine" );
00383        zoomHeadLine->setFont(f);
00384        subTabZoomLayout->addMultiCellWidget( zoomHeadLine, 0, 0, 0, 1, Qt::AlignHCenter | Qt::AlignTop );
00385        minimumZoom = new QSpinBox( subTabZoom, "minimumZoom" );
00386        minimumZoom->setMaxValue( 3200 );
00387        minimumZoom->setMinValue( 10 );
00388        minimumZoom->setSuffix( tr( " %" ) );
00389        subTabZoomLayout->addWidget( minimumZoom, 1, 1, Qt::AlignLeft );
00390        textLabel21b = new QLabel( minimumZoom, tr( "Mi&nimum:" ), subTabZoom, "textLabel21b" );
00391        subTabZoomLayout->addWidget( textLabel21b, 1, 0);
00392 
00393        maximumZoom = new QSpinBox( subTabZoom, "maximumZoom" );
00394        maximumZoom->setMaxValue( 3200 );
00395        maximumZoom->setMinValue( 10 );
00396        maximumZoom->setSuffix( tr( " %" ) );
00397        subTabZoomLayout->addWidget( maximumZoom, 2, 1, Qt::AlignLeft );
00398        textLabel22b = new QLabel( maximumZoom, tr( "Ma&ximum:" ), subTabZoom, "textLabel22b" );
00399        subTabZoomLayout->addWidget( textLabel22b, 2, 0 );
00400        
00401        zoomStep = new QSpinBox( 101, 500, 1, subTabZoom, "zoomStep" );
00402        zoomStep->setSuffix( tr( " %" ) );
00403        subTabZoomLayout->addWidget( zoomStep, 3, 1, Qt::AlignLeft );
00404        textLabel23b = new QLabel( zoomStep, tr( "&Stepping:" ), subTabZoom, "textLabel23b" );
00405        subTabZoomLayout->addWidget( textLabel23b, 3, 0 );
00406        subStackTools->addWidget( subTabZoom, 5 );
00407 
00408        subTabGeneral = new QWidget( subStackTools, "subTabGeneral" );
00409        subTabGeneralLayout = new QGridLayout( subTabGeneral, 1, 1, 11, 6, "subTabGeneralLayout");
00410        subTabGeneralLayout->setAlignment( Qt::AlignTop );
00411        generalHeadLine = new QLabel( tr( "Miscellaneous Settings" ), subTabGeneral, "generalHeadLine" );
00412        generalHeadLine->setFont(f);
00413        subTabGeneralLayout->addMultiCellWidget( generalHeadLine, 0, 0, 0, 1, Qt::AlignHCenter | Qt::AlignTop );
00414 
00415        genDispBox = new QGroupBox( subTabGeneral, "genDispBox" );
00416        genDispBox->setTitle( tr( "Item Duplicate" ) );
00417        genDispBox->setColumnLayout(0, Qt::Vertical );
00418        genDispBox->layout()->setSpacing( 5 );
00419        genDispBox->layout()->setMargin( 10 );
00420        subTabGeneralLayout2 = new QGridLayout( genDispBox->layout() );
00421 
00422        genDispX = new MSpinBox( -1000, 1000, genDispBox, 1 );
00423        genDispX->setSuffix( tr( " pt" ) );
00424        subTabGeneralLayout2->addWidget( genDispX, 0, 1, Qt::AlignLeft );
00425        genText1 = new QLabel( genDispX, tr( "X Displacement" ), genDispBox, "genText1" );
00426        subTabGeneralLayout2->addWidget( genText1, 0, 0);
00427 
00428        genDispY = new MSpinBox( -1000, 1000, genDispBox, 1 );
00429        genDispY->setSuffix( tr( " pt" ) );
00430        subTabGeneralLayout2->addWidget( genDispY, 1, 1, Qt::AlignLeft );
00431        genText2 = new QLabel( genDispY, tr( "Y Displacement" ), genDispBox, "genText2" );
00432        subTabGeneralLayout2->addWidget( genText2, 1, 0);
00433        subTabGeneralLayout->addWidget( genDispBox, 1, 0);
00434 
00435        genRotBox = new QGroupBox( subTabGeneral, "genRotBox" );
00436        genRotBox->setTitle( tr( "Rotation Tool" ) );
00437        genRotBox->setColumnLayout(0, Qt::Vertical );
00438        genRotBox->layout()->setSpacing( 5 );
00439        genRotBox->layout()->setMargin( 10 );
00440        subTabGeneralLayout3 = new QGridLayout( genRotBox->layout() );
00441 
00442        genRot = new MSpinBox( 1, 90, genRotBox, 1 );
00443        subTabGeneralLayout3->addWidget( genRot, 0, 1, Qt::AlignLeft );
00444        genText3 = new QLabel( genRot, tr( "Constrain to:" ), genRotBox, "genText3" );
00445        subTabGeneralLayout3->addWidget( genText3, 0, 0);
00446        genText4 = new QLabel( tr( "Degrees" ), genRotBox, "genText4" );
00447        subTabGeneralLayout3->addWidget( genText4, 0, 2);
00448        subTabGeneralLayout->addWidget( genRotBox, 1, 1);
00449 
00450        subStackTools->addWidget( subTabGeneral, 6 );
00451 
00452        tabToolsLayout->addWidget( subStackTools );
00453        toolText->setOn(true);
00454 
00455        // Neccessary for document prefs
00456        //restoreDefaults(prefsData, unitIndex);
00457 
00458        QToolTip::add( toolText, tr( "Text Frame Properties" ) );
00459        QToolTip::add( toolImage, tr( "Picture Frame Properties" ) );
00460        QToolTip::add( toolShape, tr( "Shape Drawing Properties" ) );
00461        QToolTip::add( toolZoom, tr( "Magnification Level Defaults" ) );
00462        QToolTip::add( toolLine, tr( "Line Drawing Properties" ) );
00463        QToolTip::add( toolPoly, tr( "Polygon Drawing Properties" ) );
00464        QToolTip::add( toolMisc, tr( "Other Properties" ) );
00465        QToolTip::add( fontComboText, tr( "Font for new text frames" ) );
00466        QToolTip::add( sizeComboText, tr( "Size of font for new text frames" ) );
00467        QToolTip::add( colorComboText, tr( "Color of font" ) );
00468        QToolTip::add( columnsText, tr( "Number of columns in a text frame" ) );
00469        QToolTip::add( gapText, tr( "Gap between text frame columns" ) );
00470        QToolTip::add( previewText, tr( "Sample of your font" ) );
00471        QToolTip::add( buttonGroup3, tr( "Picture frames allow pictures to scale to any size" ) );
00472        QToolTip::add( scalingHorizontal, tr( "Horizontal scaling of images" ) );
00473        QToolTip::add( scalingVertical, tr( "Vertical scaling of images" ) );
00474        QToolTip::add( chainButton, tr( "Keep horizontal and vertical scaling the same" ) );
00475        QToolTip::add( buttonGroup5, tr( "Pictures in picture frames are scaled to the size of the frame" ) );
00476        QToolTip::add( checkRatioImage, tr( "Automatically scaled pictures keep their original proportions" ) );
00477        QToolTip::add( comboFillImage, tr( "Fill color of picture frames" ) );
00478        QToolTip::add( shadingFillImage, tr( "Saturation of color of fill" ) );
00479        QToolTip::add( colorComboLineShape, tr( "Line color of shapes" ) );
00480        QToolTip::add( shadingLineShape, tr( "Saturation of color of lines" ) );
00481        QToolTip::add( comboFillShape, tr( "Fill color of shapes" ) );
00482        QToolTip::add( shadingFillShape, tr( "Saturation of color of fill" ) );
00483        QToolTip::add( comboStyleShape, tr( "Line style of shapes" ) );
00484        QToolTip::add( lineWidthShape, tr( "Line width of shapes" ) );
00485        QToolTip::add( minimumZoom, tr( "Minimum magnification allowed" ) );
00486        QToolTip::add( maximumZoom, tr( "Maximum magnification allowed" ) );
00487        QToolTip::add( zoomStep, tr( "Change in magnification for each zoom operation" ) );
00488        QToolTip::add( colorComboLine, tr( "Color of lines" ) );
00489        QToolTip::add( shadingLine, tr( "Saturation of color" ) );
00490        QToolTip::add( comboStyleLine, tr( "Style of lines" ) );
00491        QToolTip::add( lineWidthLine, tr( "Width of lines" ) );
00492        QToolTip::add( genDispX, tr( "Horizontal displacement of page items") );
00493        QToolTip::add( genDispY, tr( "Vertical displacement of page items" ) );
00494        QToolTip::add( genRot, tr( "Constrain value for the rotation tool when the Control key is pressed" ) );
00495        QToolTip::add( embeddedPath, "<qt>" + tr( "Use the embedded clipping paths in images when importing them. JPEG, PSD and TIFF are the image formats which can embedded clipping paths." ) + "</qt>"  );
00496        //enableSignals(true);
00497 }
00498 
00499 void TabTools::enableSignals(bool on)
00500 {
00501        if (on)
00502        {
00503               connect(toolShape, SIGNAL(clicked()), this, SLOT(setTool()));
00504               connect(toolPoly, SIGNAL(clicked()), this, SLOT(setTool()));
00505               connect(toolImage, SIGNAL(clicked()), this, SLOT(setTool()));
00506               connect(toolText, SIGNAL(clicked()), this, SLOT(setTool()));
00507               connect(toolLine, SIGNAL(clicked()), this, SLOT(setTool()));
00508               connect(toolZoom, SIGNAL(clicked()), this, SLOT(setTool()));
00509               connect(toolMisc, SIGNAL(clicked()), this, SLOT(setTool()));
00510               connect(fontComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
00511               connect(sizeComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
00512               connect(colorComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
00513               connect(colorComboTextBackground, SIGNAL(activated(int)), this, SLOT(setSample()));
00514               connect(shadingTextBack, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
00515               connect(shadingText, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
00516               connect(buttonGroup3, SIGNAL(toggled(bool)), this, SLOT(changeImageScalingFree(bool)));
00517               connect(buttonGroup5, SIGNAL(toggled(bool)), this, SLOT(changeImageScalingRatio(bool)));
00518               connect(chainButton, SIGNAL(clicked()), this, SLOT(toggleChain()));
00519               connect(scalingHorizontal, SIGNAL(valueChanged(int)), this, SLOT(hChange()));
00520               connect(scalingVertical, SIGNAL(valueChanged(int)), this, SLOT(vChange()));
00521               connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
00522        }
00523        else
00524        {
00525               disconnect(toolShape, SIGNAL(clicked()), this, SLOT(setTool()));
00526               disconnect(toolPoly, SIGNAL(clicked()), this, SLOT(setTool()));
00527               disconnect(toolImage, SIGNAL(clicked()), this, SLOT(setTool()));
00528               disconnect(toolText, SIGNAL(clicked()), this, SLOT(setTool()));
00529               disconnect(toolLine, SIGNAL(clicked()), this, SLOT(setTool()));
00530               disconnect(toolZoom, SIGNAL(clicked()), this, SLOT(setTool()));
00531               disconnect(toolMisc, SIGNAL(clicked()), this, SLOT(setTool()));
00532               disconnect(fontComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
00533               disconnect(sizeComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
00534               disconnect(colorComboText, SIGNAL(activated(int)), this, SLOT(setSample()));
00535               disconnect(colorComboTextBackground, SIGNAL(activated(int)), this, SLOT(setSample()));
00536               disconnect(shadingTextBack, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
00537               disconnect(shadingText, SIGNAL(valueChanged(int)), this, SLOT(setSample()));
00538               disconnect(buttonGroup3, SIGNAL(toggled(bool)), this, SLOT(changeImageScalingFree(bool)));
00539               disconnect(buttonGroup5, SIGNAL(toggled(bool)), this, SLOT(changeImageScalingRatio(bool)));
00540               disconnect(chainButton, SIGNAL(clicked()), this, SLOT(toggleChain()));
00541               disconnect(scalingHorizontal, SIGNAL(valueChanged(int)), this, SLOT(hChange()));
00542               disconnect(scalingVertical, SIGNAL(valueChanged(int)), this, SLOT(vChange()));
00543               disconnect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
00544        }
00545 }
00546 
00547 void TabTools::restoreDefaults(struct toolPrefs *prefsData, int unitIndex)
00548 {
00549        enableSignals(false);
00550 
00551        PrefsManager* prefsManager=PrefsManager::instance();
00552        unit = unitGetSuffixFromIndex(unitIndex);
00553        precision = unitGetPrecisionFromIndex(unitIndex);
00554        unitRatio = unitGetRatioFromIndex(unitIndex);
00555 
00556        for (int fc=0; fc<fontComboText->count(); ++fc)
00557        {
00558               if (fontComboText->text(fc) == prefsData->defFont)
00559               {
00560                      fontComboText->setCurrentItem(fc);
00561                      break;
00562               }
00563        }
00564        QString ar_sizes[] = {" 7", " 9", "10", "11", "12", "14", "18", "24", "36", "48", "60", "72"};
00565        size_t f_size = sizeof(ar_sizes) / sizeof(*ar_sizes);
00566        sizeComboText->clear();
00567        for (uint s = 0; s < f_size; ++s)
00568               sizeComboText->insertItem(ar_sizes[s] + tr(" pt"));
00569        for (int a = 0; a < sizeComboText->count(); ++a)
00570        {
00571               if (sizeComboText->text(a).left(2).toInt() == prefsData->defSize / 10)
00572               {
00573                      sizeComboText->setCurrentItem(a);
00574                      break;
00575               }
00576        }
00577 
00578        
00579        ColorList::Iterator itc, endOfColorList;
00580        ColorList* colorList = (docu != 0) ? (&docu->PageColors) : prefsManager->colorSetPtr();
00581        colorComboText->clear();
00582        colorComboText->insertItem(CommonStrings::tr_NoneColor);
00583        if (prefsData->dPenText == CommonStrings::None)
00584               colorComboText->setCurrentItem(colorComboText->count()-1);
00585        endOfColorList=colorList->end();
00586        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
00587        {
00588               colorComboText->insertSmallItem( itc.data(), docu, itc.key() );
00589               if (itc.key() == prefsData->dPenText)
00590                      colorComboText->setCurrentItem(colorComboText->count()-1);
00591        }
00592 
00593        shadingText->setValue(prefsData->dTextPenShade);
00594 
00595        colorComboStrokeText->clear();
00596        colorComboStrokeText->insertItem(CommonStrings::tr_NoneColor);
00597        if (prefsData->dStrokeText == CommonStrings::None)
00598               colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
00599        endOfColorList=colorList->end();
00600        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
00601        {
00602               colorComboStrokeText->insertSmallItem( itc.data(), docu, itc.key() );
00603               if (itc.key() == prefsData->dStrokeText)
00604                      colorComboStrokeText->setCurrentItem(colorComboStrokeText->count()-1);
00605        }
00606        shadingTextStroke->setValue(prefsData->dTextStrokeShade);
00607 
00608        colorComboTextBackground->clear();
00609        colorComboTextBackground->insertItem(CommonStrings::tr_NoneColor);
00610        if (prefsData->dTextBackGround == CommonStrings::None)
00611               colorComboTextBackground->setCurrentItem(colorComboTextBackground->count()-1);
00612        endOfColorList=colorList->end();
00613        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
00614        {
00615               colorComboTextBackground->insertSmallItem( itc.data(), docu, itc.key() );
00616               if (itc.key() == prefsData->dTextBackGround)
00617                      colorComboTextBackground->setCurrentItem(colorComboTextBackground->count()-1);
00618        }
00619        shadingTextBack->setValue(prefsData->dTextBackGroundShade);
00620 
00621        colorComboTextLine->clear();
00622        colorComboTextLine->insertItem(CommonStrings::tr_NoneColor);
00623        if (prefsData->dTextLineColor == CommonStrings::None)
00624               colorComboTextLine->setCurrentItem(colorComboTextLine->count()-1);
00625        endOfColorList=colorList->end();
00626        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
00627        {
00628               colorComboTextLine->insertSmallItem( itc.data(), docu, itc.key() );
00629               if (itc.key() == prefsData->dTextLineColor)
00630                      colorComboTextLine->setCurrentItem(colorComboTextLine->count()-1);
00631        }
00632        shadingTextLine->setValue(prefsData->dTextLineShade);
00633 
00634        tabFillCombo->clear();
00635        tabFillCombo->insertItem( tr("None", "tab fill" ));
00636        tabFillCombo->insertItem( tr("Dot"));
00637        tabFillCombo->insertItem( tr("Hyphen"));
00638        tabFillCombo->insertItem( tr("Underscore"));
00639        tabFillCombo->insertItem( tr("Custom"));
00640        if (prefsData->tabFillChar.isEmpty())
00641        {
00642               tabFillCombo->setCurrentItem(0);
00643        }
00644        else if (prefsData->tabFillChar == ".")
00645        {
00646               tabFillCombo->setCurrentItem(1);
00647        }
00648        else if (prefsData->tabFillChar == "-")
00649        {
00650               tabFillCombo->setCurrentItem(2);
00651        }
00652        else if (prefsData->tabFillChar == "_")
00653        {
00654               tabFillCombo->setCurrentItem(3);
00655        }
00656        else
00657        {
00658               tabFillCombo->setCurrentItem(4);
00659               tabFillCombo->setEditable(true);
00660               tabFillCombo->setEditText( CommonStrings::trCustomTabFill + prefsData->tabFillChar);
00661        }
00662        gapTab->setSuffix( unit );
00663        gapTab->setValue(prefsData->dTabWidth * unitRatio);
00664        columnsText->setValue(prefsData->dCols);
00665        gapText->setSuffix( unit );
00666        gapText->setValue(prefsData->dGap * unitRatio);
00667 
00668        colorComboLineShape->clear();
00669        colorComboLineShape->insertItem(CommonStrings::tr_NoneColor);
00670        if (prefsData->dPen == CommonStrings::None)
00671               colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
00672        endOfColorList=colorList->end();
00673        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
00674        {
00675               colorComboLineShape->insertSmallItem( itc.data(), docu, itc.key() );
00676               if (itc.key() == prefsData->dPen)
00677                      colorComboLineShape->setCurrentItem(colorComboLineShape->count()-1);
00678        }
00679        shadingLineShape->setValue(prefsData->dShade2);
00680 
00681        comboFillShape->clear();
00682        comboFillShape->insertItem( tr("None"));
00683        if (prefsData->dBrush == CommonStrings::None)
00684               comboFillShape->setCurrentItem(comboFillShape->count()-1);
00685        endOfColorList=colorList->end();
00686        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
00687        {
00688               comboFillShape->insertSmallItem( itc.data(), docu, itc.key() );
00689               if (itc.key() == prefsData->dBrush)
00690                      comboFillShape->setCurrentItem(comboFillShape->count()-1);
00691        }
00692 
00693        shadingFillShape->setValue(prefsData->dShade);
00694        switch (prefsData->dLineArt)
00695        {
00696               case SolidLine:
00697                      comboStyleShape->setCurrentItem(0);
00698                      break;
00699               case DashLine:
00700                      comboStyleShape->setCurrentItem(1);
00701                      break;
00702               case DotLine:
00703                      comboStyleShape->setCurrentItem(2);
00704                      break;
00705               case DashDotLine:
00706                      comboStyleShape->setCurrentItem(3);
00707                      break;
00708               case DashDotDotLine:
00709                      comboStyleShape->setCurrentItem(4);
00710                      break;
00711               default:
00712                      comboStyleShape->setCurrentItem(0);
00713                      break;
00714        }
00715 
00716        lineWidthShape->setValue(prefsData->dWidth);
00717 
00718        colorComboLine->clear();
00719        colorComboLine->insertItem(CommonStrings::tr_NoneColor);
00720        if (prefsData->dPenLine == CommonStrings::None)
00721               colorComboLine->setCurrentItem(colorComboLine->count()-1);
00722        endOfColorList=colorList->end();
00723        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
00724        {
00725               colorComboLine->insertSmallItem( itc.data(), docu, itc.key() );
00726               if (itc.key() == prefsData->dPenLine)
00727                      colorComboLine->setCurrentItem(colorComboLine->count()-1);
00728        }
00729 
00730        shadingLine->setValue(prefsData->dShadeLine);
00731 
00732        switch (prefsData->dLstyleLine)
00733        {
00734               case SolidLine:
00735                      comboStyleLine->setCurrentItem(0);
00736                      break;
00737               case DashLine:
00738                      comboStyleLine->setCurrentItem(1);
00739                      break;
00740               case DotLine:
00741                      comboStyleLine->setCurrentItem(2);
00742                      break;
00743               case DashDotLine:
00744                      comboStyleLine->setCurrentItem(3);
00745                      break;
00746               case DashDotDotLine:
00747                      comboStyleLine->setCurrentItem(4);
00748                      break;
00749               default:
00750                      comboStyleLine->setCurrentItem(0);
00751                      break;
00752        }
00753 
00754        if (docu != 0)
00755        {
00756               startArrow->rebuildList(&docu->arrowStyles);
00757               endArrow->rebuildList(&docu->arrowStyles);
00758        }
00759        else
00760        {
00761               startArrow->rebuildList(&prefsManager->appPrefs.arrowStyles);
00762               endArrow->rebuildList(&prefsManager->appPrefs.arrowStyles);
00763        }
00764        startArrow->setCurrentItem(prefsData->dStartArrow);
00765        endArrow->setCurrentItem(prefsData->dEndArrow);
00766        lineWidthLine->setValue(prefsData->dWidthLine);
00767 
00768        buttonGroup3->setChecked( prefsData->scaleType );
00769        scalingHorizontal->setValue(qRound(prefsData->scaleX * 100));
00770        scalingVertical->setValue(qRound(prefsData->scaleY * 100));
00771        buttonGroup5->setChecked( !prefsData->scaleType );
00772        checkRatioImage->setChecked(prefsData->aspectRatio);
00773 
00774        comboFillImage->clear();
00775        comboFillImage->insertItem(CommonStrings::tr_NoneColor);
00776        if (prefsData->dBrushPict == CommonStrings::None)
00777               comboFillImage->setCurrentItem(comboFillImage->count()-1);
00778        endOfColorList=colorList->end();
00779        for (itc = colorList->begin(); itc != endOfColorList; ++itc)
00780        {
00781               comboFillImage->insertSmallItem( itc.data(), docu, itc.key() );
00782               if (itc.key() == prefsData->dBrushPict)
00783                      comboFillImage->setCurrentItem(comboFillImage->count()-1);
00784        }
00785 
00786        shadingFillImage->setValue( prefsData->shadePict );
00787        embeddedPath->setChecked(prefsData->useEmbeddedPath);
00788        switch (prefsData->lowResType)
00789        {
00790               case 0:
00791                      checkFullRes->setChecked(true);
00792                      break;
00793               case 1:
00794                      checkNormalRes->setChecked(true);
00795                      break;
00796               case 2:
00797                      checkHalfRes->setChecked(true);
00798                      break;
00799        }
00800 
00801        minimumZoom->setValue(prefsData->magMin);
00802        maximumZoom->setValue(prefsData->magMax);
00803        zoomStep->setValue( prefsData->magStep );
00804 
00805        genDispX->setValue(prefsData->dispX);
00806        genDispY->setValue(prefsData->dispY);
00807        genRot->setValue(prefsData->constrain);
00808 
00809        setSample();
00810 
00811        enableSignals(true);
00812 }
00813 
00814 void TabTools::setCustomFillChar(const QString &txt)
00815 {
00816        if (txt == CommonStrings::trCustomTabFill)
00817               return;
00818        disconnect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
00819        disconnect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
00820        QString ret = txt.right(1);
00821        if (tabFillCombo->editable())
00822        {
00823               tabFillCombo->setCurrentItem(4);
00824               tabFillCombo->setEditText( CommonStrings::trCustomTabFill+ret);
00825               tabFillCombo->changeItem( CommonStrings::trCustomTabFill+ret, 4);
00826        }
00827        connect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
00828        connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
00829 }
00830 
00831 void TabTools::setFillChar(int act)
00832 {
00833        disconnect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
00834        disconnect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
00835        switch (act)
00836        {
00837               case 0:
00838               case 1:
00839               case 2:
00840               case 3:
00841                      tabFillCombo->setCurrentItem(act);
00842                      tabFillCombo->setEditable(false);
00843                      break;
00844               case 4:
00845                      tabFillCombo->setEditable(true);
00846                      tabFillCombo->setEditText(CommonStrings::trCustomTabFill);
00847                      tabFillCombo->changeItem(CommonStrings::trCustomTabFill, 4);
00848                      tabFillCombo->lineEdit()->setFocus();
00849                      tabFillCombo->lineEdit()->setCursorPosition(CommonStrings::trCustomTabFill.length());
00850                      connect(tabFillCombo, SIGNAL(textChanged(const QString &)), this, SLOT(setCustomFillChar(const QString &)));
00851                      break;
00852        }
00853        connect(tabFillCombo, SIGNAL(activated(int)), this, SLOT(setFillChar(int)));
00854 }
00855 
00856 void TabTools::toggleChain()
00857 {
00858        if (chainButton->isOn())
00859               scalingVertical->setValue(scalingHorizontal->value());
00860 }
00861 
00862 void TabTools::hChange()
00863 {
00864        if (chainButton->isOn())
00865               scalingVertical->setValue(scalingHorizontal->value());
00866 }
00867 
00868 void TabTools::vChange()
00869 {
00870        if (chainButton->isOn())
00871               scalingHorizontal->setValue(scalingVertical->value());
00872 }
00873 
00874 void TabTools::changeImageScalingFree(bool)
00875 {
00876        if (buttonGroup3->isChecked())
00877               buttonGroup5->setChecked(false);
00878        else
00879               buttonGroup5->setChecked(true);
00880 }
00881 
00882 void TabTools::changeImageScalingRatio(bool)
00883 {
00884        if (buttonGroup5->isChecked())
00885               buttonGroup3->setChecked(false);
00886        else
00887               buttonGroup3->setChecked(true);
00888 }
00889 
00890 void TabTools::setSample()
00891 {
00892        if (!fontPreview)
00893               return;
00894 
00895        SampleItem *si = new SampleItem(docu);
00896        si->setText( tr("Woven silk pyjamas exchanged for blue quartz"));
00897        if (colorComboTextBackground->currentText() != CommonStrings::tr_NoneColor)
00898        {
00899               if (docu != 0)
00900               {
00901                      si->setBgColor(docu->PageColors[colorComboTextBackground->currentText()].getRawRGBColor());
00902                      si->setBgShade(shadingTextBack->value());
00903               }
00904               else
00905               {
00906                      PrefsManager* prefsManager=PrefsManager::instance();
00907                      ColorList* colorList=prefsManager->colorSetPtr();
00908                      si->setBgColor((*colorList)[colorComboTextBackground->currentText()].getRawRGBColor());
00909                      si->setBgShade(shadingTextBack->value());
00910               }
00911        }
00912        else
00913               si->setBgColor(paletteBackgroundColor());
00914 
00915        if (colorComboText->currentText() != CommonStrings::tr_NoneColor)
00916        {
00917               if (docu != 0)
00918               {
00919                      si->setTxColor(docu->PageColors[colorComboText->currentText()].getRawRGBColor());
00920                      si->setTxShade(shadingText->value());
00921               }
00922               else
00923               {
00924                      PrefsManager* prefsManager=PrefsManager::instance();
00925                      ColorList* colorList=prefsManager->colorSetPtr();
00926                      si->setTxColor((*colorList)[colorComboText->currentText()].getRawRGBColor());
00927                      si->setTxShade(shadingText->value());
00928               }
00929        }
00930        else
00931               si->setTxColor(paletteBackgroundColor());
00932        si->setFont(fontComboText->currentText());
00933        si->setFontSize(sizeComboText->currentText().left(2).toInt() * 10, true);
00934        previewText->setPixmap(si->getSample(previewText->width(), previewText->height()));
00935        delete si;
00936 }
00937 
00938 void TabTools::setTool()
00939 {
00940        if (toolText == sender())
00941               subStackTools->raiseWidget(0);
00942        if (toolShape == sender())
00943               subStackTools->raiseWidget(1);
00944        if (toolLine == sender())
00945               subStackTools->raiseWidget(2);
00946        if (toolImage == sender())
00947               subStackTools->raiseWidget(3);
00948        if (toolPoly == sender())
00949               subStackTools->raiseWidget(4);
00950        if (toolZoom == sender())
00951               subStackTools->raiseWidget(5);
00952        if (toolMisc == sender())
00953               subStackTools->raiseWidget(6);
00954 }
00955 
00956 void TabTools::enableFontPreview(bool state)
00957 {
00958        fontPreview = state;
00959        setSample();
00960 }
00961 
00962 void TabTools::unitChange(QString unit, int docUnitIndex, int decimals, double invUnitConversion)
00963 {
00964        double oldMin, oldMax, val;
00965        int decimalsOld;
00966 
00967        gapText->setSuffix(unit);
00968        gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
00969        gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
00970        gapTab->getValues(&oldMin, &oldMax, &decimalsOld, &val);
00971        gapTab->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
00972        genDispX->getValues(&oldMin, &oldMax, &decimalsOld, &val);
00973        genDispX->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
00974        genDispY->getValues(&oldMin, &oldMax, &decimalsOld, &val);
00975        genDispY->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
00976 }