Back to index

scribus-ng  1.3.4.dfsg+svn20071115
tabtypography.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 "tabtypography.h"
00008 #include "tabtypography.moc"
00009 #include <qlayout.h>
00010 #include <qgroupbox.h>
00011 #include <qlabel.h>
00012 #include <qtooltip.h>
00013 #include <qspinbox.h>
00014 #include "mspinbox.h"
00015 #include "prefsstructs.h"
00016 #include "scribusstructs.h"
00017 
00018 TabTypograpy::TabTypograpy( QWidget* parent, struct typoPrefs *prefsData) : QWidget( parent, "tabtypo", 0 )
00019 {
00020        tabTypoLayout = new QGridLayout( this, 1, 1, 0, 6, "tabTypoLayout");
00021        groupBox1a = new QGroupBox( this, "groupBox1a" );
00022        groupBox1a->setColumnLayout(0, Qt::Vertical );
00023        groupBox1a->layout()->setSpacing( 6 );
00024        groupBox1a->layout()->setMargin( 11 );
00025        groupBox1a->setTitle( tr( "Subscript" ) );
00026        groupBox1aLayout = new QGridLayout( groupBox1a->layout() );
00027        groupBox1aLayout->setAlignment( Qt::AlignTop );
00028        subDisplacement = new QSpinBox( groupBox1a, "subDisplacement" );
00029        subDisplacement->setMaxValue( 100 );
00030        subDisplacement->setSuffix( tr( " %" ) );
00031        groupBox1aLayout->addWidget( subDisplacement, 0, 1, Qt::AlignLeft );
00032        textLabel1a = new QLabel(subDisplacement, tr( "&Displacement:" ), groupBox1a, "textLabel1a" );
00033        groupBox1aLayout->addWidget( textLabel1a, 0, 0 );
00034        subScaling = new QSpinBox( groupBox1a, "subScaling" );
00035        subScaling->setMaxValue( 100 );
00036        subScaling->setMinValue( 1 );
00037        subScaling->setSuffix( tr( " %" ) );
00038        groupBox1aLayout->addWidget( subScaling, 0, 3, Qt::AlignLeft );
00039        textLabel2a = new QLabel(subScaling, tr( "&Scaling:" ), groupBox1a, "textLabel2a" );
00040        groupBox1aLayout->addWidget( textLabel2a, 0, 2 );
00041        tabTypoLayout->addMultiCellWidget( groupBox1a, 0, 0, 0, 1 );
00042        groupBox2a = new QGroupBox( this, "groupBox2a" );
00043        groupBox2a->setColumnLayout(0, Qt::Vertical );
00044        groupBox2a->layout()->setSpacing( 6 );
00045        groupBox2a->layout()->setMargin( 11 );
00046        groupBox2a->setTitle( tr( "Superscript" ) );
00047        groupBox2aLayout = new QGridLayout( groupBox2a->layout() );
00048        groupBox2aLayout->setAlignment( Qt::AlignTop );
00049        superDisplacement = new QSpinBox( groupBox2a, "superDisplacement" );
00050        superDisplacement->setMaxValue( 100 );
00051        superDisplacement->setSuffix( tr( " %" ) );
00052        groupBox2aLayout->addWidget( superDisplacement, 0, 1, Qt::AlignLeft );
00053        textLabel3a = new QLabel(superDisplacement, tr( "D&isplacement:" ), groupBox2a, "textLabel3a" );
00054        groupBox2aLayout->addWidget( textLabel3a, 0, 0 );
00055        superScaling = new QSpinBox( groupBox2a, "superScaling" );
00056        superScaling->setMaxValue( 100 );
00057        superScaling->setMinValue( 1 );
00058        superScaling->setSuffix( tr( " %" ) );
00059        groupBox2aLayout->addWidget( superScaling, 0, 3, Qt::AlignLeft );
00060        textLabel4a = new QLabel(superScaling, tr( "S&caling:" ), groupBox2a, "textLabel4a" );
00061        groupBox2aLayout->addWidget( textLabel4a, 0, 2 );
00062        tabTypoLayout->addMultiCellWidget( groupBox2a, 1, 1, 0, 1 );
00063 
00064        underlineGroup = new QGroupBox( this, "underlineGroup" );
00065        underlineGroup->setTitle( tr( "Underline" ) );
00066        underlineGroup->setColumnLayout(0, Qt::Vertical );
00067        underlineGroup->layout()->setSpacing( 6 );
00068        underlineGroup->layout()->setMargin( 11 );
00069        underlineGroupLayout = new QGridLayout( underlineGroup->layout() );
00070        underlineGroupLayout->setAlignment( Qt::AlignTop );
00071        textLabel1 = new QLabel( underlineGroup, "textLabel1" );
00072        textLabel1->setText( tr( "Displacement:" ) );
00073        underlineGroupLayout->addWidget( textLabel1, 0, 0 );
00074        underlinePos = new MSpinBox( -0.1, 100, underlineGroup, 1 );
00075        underlinePos->setWrapping(true);
00076        underlinePos->setSuffix( tr( " %" ) );
00077        underlinePos->setSpecialValueText( tr( "Auto" ) );
00078        underlineGroupLayout->addWidget( underlinePos, 0, 1 );
00079        textLabel2 = new QLabel( underlineGroup, "textLabel2" );
00080        textLabel2->setText( tr( "Line Width:" ) );
00081        underlineGroupLayout->addWidget( textLabel2, 0, 2 );
00082        underlineWidth = new MSpinBox( -0.1, 100, underlineGroup, 1 );
00083        underlineWidth->setSuffix( tr( " %" ) );
00084        underlineWidth->setWrapping(true);
00085        underlineWidth->setSpecialValueText( tr( "Auto" ) );
00086        underlineGroupLayout->addWidget( underlineWidth, 0, 3 );
00087        tabTypoLayout->addMultiCellWidget( underlineGroup, 2, 2, 0, 1 );
00088 
00089        strikethruGroup = new QGroupBox( this, "strikethruGroup" );
00090        strikethruGroup->setTitle( tr( "Strikethru" ) );
00091        strikethruGroup->setColumnLayout(0, Qt::Vertical );
00092        strikethruGroup->layout()->setSpacing( 6 );
00093        strikethruGroup->layout()->setMargin( 11 );
00094        strikethruGroupLayout = new QGridLayout( strikethruGroup->layout() );
00095        strikethruGroupLayout->setAlignment( Qt::AlignTop );
00096        textLabel1_2 = new QLabel( strikethruGroup, "textLabel1" );
00097        textLabel1_2->setText( tr( "Displacement:" ) );
00098        strikethruGroupLayout->addWidget( textLabel1_2, 0, 0 );
00099        strikethruPos = new MSpinBox( -0.1, 100, strikethruGroup, 1 );
00100        strikethruPos->setSuffix( tr( " %" ) );
00101        strikethruPos->setSpecialValueText( tr( "Auto" ) );
00102        strikethruPos->setWrapping(true);
00103        strikethruGroupLayout->addWidget( strikethruPos, 0, 1 );
00104        textLabel2_2 = new QLabel( strikethruGroup, "textLabel2" );
00105        textLabel2_2->setText( tr( "Line Width:" ) );
00106        strikethruGroupLayout->addWidget( textLabel2_2, 0, 2 );
00107        strikethruWidth = new MSpinBox( -0.1, 100, strikethruGroup, 1 );
00108        strikethruWidth->setWrapping(true);
00109        strikethruWidth->setSuffix( tr( " %" ) );
00110        strikethruWidth->setSpecialValueText( tr( "Auto" ) );
00111        strikethruGroupLayout->addWidget( strikethruWidth, 0, 3 );
00112        tabTypoLayout->addMultiCellWidget( strikethruGroup, 3, 3, 0, 1 );
00113 
00114        groupBox3a = new QGroupBox( this, "groupBox3a" );
00115        groupBox3a->setColumnLayout(0, Qt::Vertical );
00116        groupBox3a->layout()->setSpacing( 6 );
00117        groupBox3a->layout()->setMargin( 11 );
00118        groupBox3a->setTitle( tr( "Small Caps" ) );
00119        groupBox3aLayout = new QGridLayout( groupBox3a->layout() );
00120        groupBox3aLayout->setAlignment( Qt::AlignTop );
00121        capsScaling = new QSpinBox( groupBox3a, "capsScaling" );
00122        capsScaling->setMaxValue( 100 );
00123        capsScaling->setMinValue( 1 );
00124        capsScaling->setSuffix( tr( " %" ) );
00125        groupBox3aLayout->addWidget( capsScaling, 0, 1, Qt::AlignLeft );
00126        textLabel5a = new QLabel(capsScaling, tr( "Sc&aling:" ), groupBox3a, "textLabel5a" );
00127        groupBox3aLayout->addWidget( textLabel5a, 0, 0 );
00128        tabTypoLayout->addWidget( groupBox3a, 4, 0 );
00129 
00130        groupBox4a = new QGroupBox( this, "groupBox3a" );
00131        groupBox4a->setColumnLayout(0, Qt::Vertical );
00132        groupBox4a->layout()->setSpacing( 6 );
00133        groupBox4a->layout()->setMargin( 11 );
00134        groupBox4a->setTitle( tr( "Automatic &Line Spacing" ) );
00135        groupBox4aLayout = new QGridLayout( groupBox4a->layout() );
00136        groupBox4aLayout->setAlignment( Qt::AlignTop );
00137        autoLine = new QSpinBox( groupBox4a, "autoLine" );
00138        autoLine->setMaxValue( 100 );
00139        autoLine->setMinValue( 1 );
00140        autoLine->setSuffix( tr( " %" ) );
00141        groupBox4aLayout->addWidget( autoLine, 1, 1 );
00142        textLabel8a = new QLabel( autoLine, tr( "Line Spacing:" ), groupBox4a, "textLabel8a" );
00143        groupBox4aLayout->addWidget( textLabel8a, 1, 0 );
00144        tabTypoLayout->addWidget( groupBox4a, 4, 1 );
00145        // switched off as it's called in main prefs classes - PV
00146        //restoreDefaults(prefsData);
00147        QToolTip::add( superDisplacement, tr( "Displacement above the baseline of the font on a line" ) );
00148        QToolTip::add( superScaling, tr( "Relative size of the superscript compared to the normal font" ) );
00149        QToolTip::add( subDisplacement, tr( "Displacement below the baseline of the normal font on a line" ) );
00150        QToolTip::add( subScaling, tr( "Relative size of the subscript compared to the normal font" ) );
00151        QToolTip::add( capsScaling, tr( "Relative size of the small caps font compared to the normal font" ) );
00152        QToolTip::add( autoLine, tr( "Percentage increase over the font size for the line spacing" ) );
00153        QToolTip::add( underlinePos, tr( "Displacement below the baseline of the normal font expressed as a percentage of the fonts descender" ) );
00154        QToolTip::add( underlineWidth, tr( "Line width expressed as a percentage of the font size" ) );
00155        QToolTip::add( strikethruPos, tr( "Displacement above the baseline of the normal font expressed as a percentage of the fonts ascender" ) );
00156        QToolTip::add( strikethruWidth, tr( "Line width expressed as a percentage of the font size" ) );
00157 }
00158 
00159 void TabTypograpy::restoreDefaults(struct typoPrefs *prefsData)
00160 {
00161        capsScaling->setValue( prefsData->valueSmallCaps );
00162        subDisplacement->setValue( prefsData->valueSubScript );
00163        subScaling->setValue( prefsData->scalingSubScript );
00164        superDisplacement->setValue( prefsData->valueSuperScript);
00165        superScaling->setValue( prefsData->scalingSuperScript );
00166        autoLine->setValue( prefsData->autoLineSpacing );
00167        underlinePos->setValue(prefsData->valueUnderlinePos);
00168        underlineWidth->setValue(prefsData->valueUnderlineWidth);
00169        strikethruPos->setValue(prefsData->valueStrikeThruPos);
00170        strikethruWidth->setValue(prefsData->valueStrikeThruWidth);
00171 }