Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
3 paul 1
#include "reformdoc.h"
2
#include "reformdoc.moc"
249 Franz 3
#include <qtooltip.h>
3 paul 4
extern QPixmap loadIcon(QString nam);
80 Franz 5
extern double UmReFaktor;
3 paul 6
 
80 Franz 7
ReformDoc::ReformDoc( QWidget* parent, double t, double l, double r, double b, double Pagebr, double Pageho, bool fp, bool fpe, int Einh)
249 Franz 8
                : QDialog( parent, "r", true, 0 )
3 paul 9
{
249 Franz 10
        QString ein;
173 Franz 11
        int decimals;
12
        einheit = Einh;
13
        switch (Einh)
249 Franz 14
        {
15
        case 0:
16
                ein = " pt";
17
                decimals = 100;
18
                break;
19
        case 1:
20
                ein = " mm";
21
                decimals = 1000;
22
                break;
23
        case 2:
24
                ein = " in";
25
                decimals = 10000;
26
                break;
27
        case 3:
28
                ein = " p";
29
                decimals = 100;
30
                break;
31
        }
173 Franz 32
        Breite = Pagebr * UmReFaktor;
33
        Hoehe = Pageho * UmReFaktor;
249 Franz 34
        setCaption( tr( "Document Setup" ) );
35
        setIcon(loadIcon("AppIcon.png"));
36
        ReformDocLayout = new QVBoxLayout( this );
37
        ReformDocLayout->setSpacing( 6 );
38
        ReformDocLayout->setMargin( 10 );
39
        GroupBox7 = new QGroupBox( this, "GroupBox7" );
40
        GroupBox7->setTitle( tr( "Margin Guides" ) );
41
        GroupBox7->setColumnLayout(0, Qt::Vertical );
42
        GroupBox7->layout()->setSpacing( 0 );
43
        GroupBox7->layout()->setMargin( 0 );
44
        GroupBox7Layout = new QHBoxLayout( GroupBox7->layout() );
45
        GroupBox7Layout->setAlignment( Qt::AlignTop );
46
        GroupBox7Layout->setSpacing( 0 );
47
        GroupBox7Layout->setMargin( 10 );
48
        Layout4 = new QGridLayout;
49
        Layout4->setSpacing( 6 );
50
        Layout4->setMargin( 0 );
51
        TextLabel5 = new QLabel( GroupBox7, "TextLabel5" );
52
        TextLabel5->setText( tr( "Top:" ) );
53
        Layout4->addWidget( TextLabel5, 0, 0 );
54
        TopR = new MSpinBox( GroupBox7, 4 );
55
        TopR->setSuffix( ein );
173 Franz 56
        TopR->setDecimals( decimals );
249 Franz 57
        TopR->setMaxValue(Hoehe);
58
        TopR->setValue(t * UmReFaktor);
59
        Layout4->addWidget( TopR, 0, 1 );
60
        Links = new QLabel( GroupBox7, "Links" );
61
        Links->setText( tr( "Left:" ) );
62
        Layout4->addWidget( Links, 0, 2 );
63
        LeftR = new MSpinBox( GroupBox7, 4 );
64
        LeftR->setSuffix( ein );
173 Franz 65
        LeftR->setDecimals( decimals );
249 Franz 66
        LeftR->setMaxValue(Breite);
67
        LeftR->setValue(l * UmReFaktor);
68
        Layout4->addWidget( LeftR, 0, 3 );
69
        TextLabel7 = new QLabel( GroupBox7, "TextLabel7" );
70
        TextLabel7->setText( tr( "Bottom:" ) );
71
        Layout4->addWidget( TextLabel7, 1, 0 );
72
        BottomR = new MSpinBox( GroupBox7, 4 );
73
        BottomR->setSuffix( ein );
173 Franz 74
        BottomR->setDecimals( decimals );
249 Franz 75
        BottomR->setMaxValue(Hoehe);
76
        BottomR->setValue(b * UmReFaktor);
77
        Layout4->addWidget( BottomR, 1, 1 );
78
        Rechts = new QLabel( GroupBox7, "Rechts" );
79
        Rechts->setText( tr( "Right:" ) );
80
        Layout4->addWidget( Rechts, 1, 2 );
81
        RightR = new MSpinBox( GroupBox7, 4 );
82
        RightR->setSuffix( ein );
173 Franz 83
        RightR->setDecimals( decimals );
249 Franz 84
        RightR->setMaxValue(Breite);
85
        RightR->setValue(r * UmReFaktor);
86
        Layout4->addWidget( RightR, 1, 3 );
87
        Doppelseiten = new QCheckBox( GroupBox7, "Doppelseiten" );
88
        Doppelseiten->setText( tr( "Facing Pages" ) );
89
        Doppelseiten->setChecked( fp );
90
        Layout4->addMultiCellWidget( Doppelseiten, 2, 2, 0, 1 );
91
        ErsteSeite = new QCheckBox( GroupBox7, "n" );
92
        ErsteSeite->setText( tr( "Left Page first" ) );
93
        ErsteSeite->setChecked( fpe );
94
        Layout4->addMultiCellWidget( ErsteSeite, 2, 2, 2, 3 );
95
        if (!fp)
96
                ErsteSeite->setEnabled(false);
97
        setDS();
98
        GroupBox7Layout->addLayout( Layout4 );
99
        ReformDocLayout->addWidget( GroupBox7 );
100
        Layout3 = new QHBoxLayout;
101
        Layout3->setSpacing( 6 );
102
        Layout3->setMargin( 0 );
103
        OKButton = new QPushButton( this, "OKButton" );
104
        OKButton->setText( tr( "OK" ) );
105
        OKButton->setDefault( true );
106
        Layout3->addWidget( OKButton );
107
        QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
108
        Layout3->addItem( spacer );
109
        CancelB = new QPushButton( this, "CancelB" );
110
        CancelB->setText( tr( "Cancel" ) );
111
        CancelB->setAutoDefault( false );
112
        Layout3->addWidget( CancelB );
113
        ReformDocLayout->addLayout( Layout3 );
114
        RightR->setMaxValue(Breite - LeftR->value());
115
        LeftR->setMaxValue(Breite - RightR->value());
116
        TopR->setMaxValue(Hoehe - BottomR->value());
117
        BottomR->setMaxValue(Hoehe - TopR->value());
118
        //tooltips
119
        QToolTip::add( Doppelseiten, tr( "Enable single or spread based layout" ) );
120
        QToolTip::add( ErsteSeite, tr( "Make the first page the left page of the document" ) );
121
        QToolTip::add( TopR, tr( "Distance between the top margin guide and the edge of the page" ) );
122
        QToolTip::add( BottomR, tr( "Distance between the bottom margin guide and the edge of the page" ) );
123
        QToolTip::add( LeftR, tr( "Distance between the left margin guide and the edge of the page.\nIf Facing Pages is selected, this margin space can be used to achieve the correct margins for binding" ) );
124
        QToolTip::add( RightR, tr( "Distance between the right margin guide and the edge of the page.\nIf Facing Pages is selected, this margin space can be used to achieve the correct margins for binding" ) );
3 paul 125
 
249 Franz 126
 
127
        // signals and slots connections
128
        connect( Doppelseiten, SIGNAL( clicked() ), this, SLOT( setDS() ) );
129
        connect( OKButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
130
        connect( CancelB, SIGNAL( clicked() ), this, SLOT( reject() ) );
131
        connect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
132
        connect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
133
        connect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
134
        connect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
3 paul 135
}
136
 
36 Franz 137
void ReformDoc::setTop(int v)
138
{
139
        BottomR->setMaxValue(Hoehe - TopR->value());
140
}
3 paul 141
 
36 Franz 142
void ReformDoc::setBottom(int v)
143
{
144
        TopR->setMaxValue(Hoehe - BottomR->value());
145
}
146
 
147
void ReformDoc::setLeft(int v)
148
{
149
        RightR->setMaxValue(Breite - LeftR->value());
150
}
151
 
152
void ReformDoc::setRight(int v)
153
{
154
        LeftR->setMaxValue(Breite - RightR->value());
155
}
156
 
3 paul 157
void ReformDoc::setDS()
158
{
249 Franz 159
        if (Doppelseiten->isChecked())
160
        {
161
                Links->setText( tr( "Inside:" ) );
162
                Rechts->setText( tr( "Outside:" ) );
163
                ErsteSeite->setEnabled(true);
164
        }
165
        else
166
        {
167
                Links->setText( tr( "Left:" ) );
168
                Rechts->setText( tr( "Right:" ) );
169
                ErsteSeite->setEnabled(false);
170
        }
3 paul 171
}
172