Subversion Repositories Scribus

Rev

Rev 2262 | Rev 2285 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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