Subversion Repositories Scribus

Rev

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