Subversion Repositories Scribus

Rev

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