Subversion Repositories Scribus

Rev

Rev 4430 | 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
*/
788 fschmid 7
#include "tabtypography.h"
8
#include "tabtypography.moc"
9
#include <qlayout.h>
10
#include <qgroupbox.h>
11
#include <qlabel.h>
12
#include <qtooltip.h>
13
#include <qspinbox.h>
14
#include "mspinbox.h"
2834 cbradney 15
#include "prefsstructs.h"
838 cbradney 16
#include "scribusstructs.h"
788 fschmid 17
 
1195 fschmid 18
TabTypograpy::TabTypograpy( QWidget* parent, struct typoPrefs *prefsData) : QWidget( parent, "tabtypo", 0 )
788 fschmid 19
{
1878 cbradney 20
        tabTypoLayout = new QGridLayout( this, 1, 1, 0, 6, "tabTypoLayout");
788 fschmid 21
        groupBox1a = new QGroupBox( this, "groupBox1a" );
22
        groupBox1a->setColumnLayout(0, Qt::Vertical );
23
        groupBox1a->layout()->setSpacing( 6 );
24
        groupBox1a->layout()->setMargin( 11 );
25
        groupBox1a->setTitle( tr( "Subscript" ) );
26
        groupBox1aLayout = new QGridLayout( groupBox1a->layout() );
27
        groupBox1aLayout->setAlignment( Qt::AlignTop );
28
        subDisplacement = new QSpinBox( groupBox1a, "subDisplacement" );
29
        subDisplacement->setMaxValue( 100 );
30
        subDisplacement->setSuffix( tr( " %" ) );
31
        groupBox1aLayout->addWidget( subDisplacement, 0, 1, Qt::AlignLeft );
32
        textLabel1a = new QLabel(subDisplacement, tr( "&Displacement:" ), groupBox1a, "textLabel1a" );
33
        groupBox1aLayout->addWidget( textLabel1a, 0, 0 );
34
        subScaling = new QSpinBox( groupBox1a, "subScaling" );
35
        subScaling->setMaxValue( 100 );
36
        subScaling->setMinValue( 1 );
37
        subScaling->setSuffix( tr( " %" ) );
38
        groupBox1aLayout->addWidget( subScaling, 0, 3, Qt::AlignLeft );
39
        textLabel2a = new QLabel(subScaling, tr( "&Scaling:" ), groupBox1a, "textLabel2a" );
40
        groupBox1aLayout->addWidget( textLabel2a, 0, 2 );
2285 fschmid 41
        tabTypoLayout->addMultiCellWidget( groupBox1a, 0, 0, 0, 1 );
788 fschmid 42
        groupBox2a = new QGroupBox( this, "groupBox2a" );
43
        groupBox2a->setColumnLayout(0, Qt::Vertical );
44
        groupBox2a->layout()->setSpacing( 6 );
45
        groupBox2a->layout()->setMargin( 11 );
46
        groupBox2a->setTitle( tr( "Superscript" ) );
47
        groupBox2aLayout = new QGridLayout( groupBox2a->layout() );
48
        groupBox2aLayout->setAlignment( Qt::AlignTop );
49
        superDisplacement = new QSpinBox( groupBox2a, "superDisplacement" );
50
        superDisplacement->setMaxValue( 100 );
51
        superDisplacement->setSuffix( tr( " %" ) );
52
        groupBox2aLayout->addWidget( superDisplacement, 0, 1, Qt::AlignLeft );
53
        textLabel3a = new QLabel(superDisplacement, tr( "D&isplacement:" ), groupBox2a, "textLabel3a" );
54
        groupBox2aLayout->addWidget( textLabel3a, 0, 0 );
55
        superScaling = new QSpinBox( groupBox2a, "superScaling" );
56
        superScaling->setMaxValue( 100 );
57
        superScaling->setMinValue( 1 );
58
        superScaling->setSuffix( tr( " %" ) );
59
        groupBox2aLayout->addWidget( superScaling, 0, 3, Qt::AlignLeft );
60
        textLabel4a = new QLabel(superScaling, tr( "S&caling:" ), groupBox2a, "textLabel4a" );
61
        groupBox2aLayout->addWidget( textLabel4a, 0, 2 );
2285 fschmid 62
        tabTypoLayout->addMultiCellWidget( groupBox2a, 1, 1, 0, 1 );
2174 fschmid 63
 
64
        underlineGroup = new QGroupBox( this, "underlineGroup" );
65
        underlineGroup->setTitle( tr( "Underline" ) );
66
        underlineGroup->setColumnLayout(0, Qt::Vertical );
67
        underlineGroup->layout()->setSpacing( 6 );
68
        underlineGroup->layout()->setMargin( 11 );
69
        underlineGroupLayout = new QGridLayout( underlineGroup->layout() );
70
        underlineGroupLayout->setAlignment( Qt::AlignTop );
71
        textLabel1 = new QLabel( underlineGroup, "textLabel1" );
72
        textLabel1->setText( tr( "Displacement:" ) );
73
        underlineGroupLayout->addWidget( textLabel1, 0, 0 );
2262 fschmid 74
        underlinePos = new MSpinBox( -0.1, 100, underlineGroup, 1 );
2176 fschmid 75
        underlinePos->setWrapping(true);
2174 fschmid 76
        underlinePos->setSuffix( tr( " %" ) );
77
        underlinePos->setSpecialValueText( tr( "Auto" ) );
78
        underlineGroupLayout->addWidget( underlinePos, 0, 1 );
79
        textLabel2 = new QLabel( underlineGroup, "textLabel2" );
80
        textLabel2->setText( tr( "Line Width:" ) );
81
        underlineGroupLayout->addWidget( textLabel2, 0, 2 );
2262 fschmid 82
        underlineWidth = new MSpinBox( -0.1, 100, underlineGroup, 1 );
2174 fschmid 83
        underlineWidth->setSuffix( tr( " %" ) );
2176 fschmid 84
        underlineWidth->setWrapping(true);
2174 fschmid 85
        underlineWidth->setSpecialValueText( tr( "Auto" ) );
86
        underlineGroupLayout->addWidget( underlineWidth, 0, 3 );
2285 fschmid 87
        tabTypoLayout->addMultiCellWidget( underlineGroup, 2, 2, 0, 1 );
2174 fschmid 88
 
2176 fschmid 89
        strikethruGroup = new QGroupBox( this, "strikethruGroup" );
90
        strikethruGroup->setTitle( tr( "Strikethru" ) );
91
        strikethruGroup->setColumnLayout(0, Qt::Vertical );
92
        strikethruGroup->layout()->setSpacing( 6 );
93
        strikethruGroup->layout()->setMargin( 11 );
94
        strikethruGroupLayout = new QGridLayout( strikethruGroup->layout() );
95
        strikethruGroupLayout->setAlignment( Qt::AlignTop );
96
        textLabel1_2 = new QLabel( strikethruGroup, "textLabel1" );
97
        textLabel1_2->setText( tr( "Displacement:" ) );
98
        strikethruGroupLayout->addWidget( textLabel1_2, 0, 0 );
2272 fschmid 99
        strikethruPos = new MSpinBox( -0.1, 100, strikethruGroup, 1 );
2176 fschmid 100
        strikethruPos->setSuffix( tr( " %" ) );
101
        strikethruPos->setSpecialValueText( tr( "Auto" ) );
102
        strikethruPos->setWrapping(true);
103
        strikethruGroupLayout->addWidget( strikethruPos, 0, 1 );
104
        textLabel2_2 = new QLabel( strikethruGroup, "textLabel2" );
105
        textLabel2_2->setText( tr( "Line Width:" ) );
106
        strikethruGroupLayout->addWidget( textLabel2_2, 0, 2 );
2272 fschmid 107
        strikethruWidth = new MSpinBox( -0.1, 100, strikethruGroup, 1 );
2176 fschmid 108
        strikethruWidth->setWrapping(true);
109
        strikethruWidth->setSuffix( tr( " %" ) );
110
        strikethruWidth->setSpecialValueText( tr( "Auto" ) );
111
        strikethruGroupLayout->addWidget( strikethruWidth, 0, 3 );
2285 fschmid 112
        tabTypoLayout->addMultiCellWidget( strikethruGroup, 3, 3, 0, 1 );
2176 fschmid 113
 
2285 fschmid 114
        groupBox3a = new QGroupBox( this, "groupBox3a" );
115
        groupBox3a->setColumnLayout(0, Qt::Vertical );
116
        groupBox3a->layout()->setSpacing( 6 );
117
        groupBox3a->layout()->setMargin( 11 );
118
        groupBox3a->setTitle( tr( "Small Caps" ) );
119
        groupBox3aLayout = new QGridLayout( groupBox3a->layout() );
120
        groupBox3aLayout->setAlignment( Qt::AlignTop );
121
        capsScaling = new QSpinBox( groupBox3a, "capsScaling" );
122
        capsScaling->setMaxValue( 100 );
123
        capsScaling->setMinValue( 1 );
124
        capsScaling->setSuffix( tr( " %" ) );
125
        groupBox3aLayout->addWidget( capsScaling, 0, 1, Qt::AlignLeft );
126
        textLabel5a = new QLabel(capsScaling, tr( "Sc&aling:" ), groupBox3a, "textLabel5a" );
127
        groupBox3aLayout->addWidget( textLabel5a, 0, 0 );
128
        tabTypoLayout->addWidget( groupBox3a, 4, 0 );
129
 
1834 fschmid 130
        groupBox4a = new QGroupBox( this, "groupBox3a" );
131
        groupBox4a->setColumnLayout(0, Qt::Vertical );
132
        groupBox4a->layout()->setSpacing( 6 );
133
        groupBox4a->layout()->setMargin( 11 );
134
        groupBox4a->setTitle( tr( "Automatic &Line Spacing" ) );
135
        groupBox4aLayout = new QGridLayout( groupBox4a->layout() );
136
        groupBox4aLayout->setAlignment( Qt::AlignTop );
137
        autoLine = new QSpinBox( groupBox4a, "autoLine" );
138
        autoLine->setMaxValue( 100 );
139
        autoLine->setMinValue( 1 );
140
        autoLine->setSuffix( tr( " %" ) );
141
        groupBox4aLayout->addWidget( autoLine, 1, 1 );
142
        textLabel8a = new QLabel( autoLine, tr( "Line Spacing:" ), groupBox4a, "textLabel8a" );
143
        groupBox4aLayout->addWidget( textLabel8a, 1, 0 );
2285 fschmid 144
        tabTypoLayout->addWidget( groupBox4a, 4, 1 );
5763 subik 145
        // switched off as it's called in main prefs classes - PV
146
        //restoreDefaults(prefsData);
788 fschmid 147
        QToolTip::add( superDisplacement, tr( "Displacement above the baseline of the font on a line" ) );
148
        QToolTip::add( superScaling, tr( "Relative size of the superscript compared to the normal font" ) );
149
        QToolTip::add( subDisplacement, tr( "Displacement below the baseline of the normal font on a line" ) );
150
        QToolTip::add( subScaling, tr( "Relative size of the subscript compared to the normal font" ) );
151
        QToolTip::add( capsScaling, tr( "Relative size of the small caps font compared to the normal font" ) );
1834 fschmid 152
        QToolTip::add( autoLine, tr( "Percentage increase over the font size for the line spacing" ) );
2174 fschmid 153
        QToolTip::add( underlinePos, tr( "Displacement below the baseline of the normal font expressed as a percentage of the fonts descender" ) );
154
        QToolTip::add( underlineWidth, tr( "Line width expressed as a percentage of the font size" ) );
2176 fschmid 155
        QToolTip::add( strikethruPos, tr( "Displacement above the baseline of the normal font expressed as a percentage of the fonts ascender" ) );
156
        QToolTip::add( strikethruWidth, tr( "Line width expressed as a percentage of the font size" ) );
788 fschmid 157
}
1828 fschmid 158
 
159
void TabTypograpy::restoreDefaults(struct typoPrefs *prefsData)
160
{
2890 cbradney 161
        capsScaling->setValue( prefsData->valueSmallCaps );
1828 fschmid 162
        subDisplacement->setValue( prefsData->valueSubScript );
2890 cbradney 163
        subScaling->setValue( prefsData->scalingSubScript );
164
        superDisplacement->setValue( prefsData->valueSuperScript);
1828 fschmid 165
        superScaling->setValue( prefsData->scalingSuperScript );
1834 fschmid 166
        autoLine->setValue( prefsData->autoLineSpacing );
2174 fschmid 167
        underlinePos->setValue(prefsData->valueUnderlinePos);
168
        underlineWidth->setValue(prefsData->valueUnderlineWidth);
2176 fschmid 169
        strikethruPos->setValue(prefsData->valueStrikeThruPos);
170
        strikethruWidth->setValue(prefsData->valueStrikeThruWidth);
1828 fschmid 171
}