Subversion Repositories Scribus

Rev

Rev 274 | Rev 348 | 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 );
340 Franz 34
 
249 Franz 35
        TopR = new MSpinBox( GroupBox7, 4 );
36
        TopR->setSuffix( ein );
173 Franz 37
        TopR->setDecimals( decimals );
249 Franz 38
        TopR->setMaxValue(Hoehe);
39
        TopR->setValue(t * UmReFaktor);
40
        Layout4->addWidget( TopR, 0, 1 );
340 Franz 41
        TextLabel5 = new QLabel( tr( "&Top:" ), GroupBox7, "TextLabel5" );
42
        TextLabel5->setBuddy(TopR);
43
        Layout4->addWidget( TextLabel5, 0, 0 );
44
 
249 Franz 45
        LeftR = new MSpinBox( GroupBox7, 4 );
46
        LeftR->setSuffix( ein );
173 Franz 47
        LeftR->setDecimals( decimals );
249 Franz 48
        LeftR->setMaxValue(Breite);
49
        LeftR->setValue(l * UmReFaktor);
50
        Layout4->addWidget( LeftR, 0, 3 );
340 Franz 51
        Links = new QLabel( tr( "&Left:" ), GroupBox7, "Links" );
52
        Links->setBuddy(LeftR);
53
        Layout4->addWidget( Links, 0, 2 );
54
 
249 Franz 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 );
340 Franz 61
        TextLabel7 = new QLabel( tr( "&Bottom:" ), GroupBox7, "TextLabel7" );
62
        TextLabel7->setBuddy(BottomR);
63
        Layout4->addWidget( TextLabel7, 1, 0 );
64
 
249 Franz 65
        RightR = new MSpinBox( GroupBox7, 4 );
66
        RightR->setSuffix( ein );
173 Franz 67
        RightR->setDecimals( decimals );
249 Franz 68
        RightR->setMaxValue(Breite);
69
        RightR->setValue(r * UmReFaktor);
70
        Layout4->addWidget( RightR, 1, 3 );
340 Franz 71
        Rechts = new QLabel( tr( "&Right:" ), GroupBox7, "Rechts" );
72
        Rechts->setBuddy(RightR);
73
        Layout4->addWidget( Rechts, 1, 2 );
74
 
75
        Doppelseiten = new QCheckBox( tr( "&Facing Pages" ),GroupBox7, "Doppelseiten" );
249 Franz 76
        Doppelseiten->setChecked( fp );
77
        Layout4->addMultiCellWidget( Doppelseiten, 2, 2, 0, 1 );
340 Franz 78
        ErsteSeite = new QCheckBox( tr( "Left &Page First" ), GroupBox7, "n" );
249 Franz 79
        ErsteSeite->setChecked( fpe );
80
        Layout4->addMultiCellWidget( ErsteSeite, 2, 2, 2, 3 );
81
        if (!fp)
82
                ErsteSeite->setEnabled(false);
83
        setDS();
84
        GroupBox7Layout->addLayout( Layout4 );
85
        ReformDocLayout->addWidget( GroupBox7 );
86
        Layout3 = new QHBoxLayout;
87
        Layout3->setSpacing( 6 );
88
        Layout3->setMargin( 0 );
340 Franz 89
        OKButton = new QPushButton(tr( "&OK" ), this, "OKButton" );
249 Franz 90
        OKButton->setDefault( true );
91
        Layout3->addWidget( OKButton );
92
        QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
93
        Layout3->addItem( spacer );
340 Franz 94
        CancelB = new QPushButton( tr( "&Cancel" ), this, "CancelB" );
249 Franz 95
        CancelB->setAutoDefault( false );
96
        Layout3->addWidget( CancelB );
97
        ReformDocLayout->addLayout( Layout3 );
98
        RightR->setMaxValue(Breite - LeftR->value());
99
        LeftR->setMaxValue(Breite - RightR->value());
100
        TopR->setMaxValue(Hoehe - BottomR->value());
101
        BottomR->setMaxValue(Hoehe - TopR->value());
102
        //tooltips
103
        QToolTip::add( Doppelseiten, tr( "Enable single or spread based layout" ) );
104
        QToolTip::add( ErsteSeite, tr( "Make the first page the left page of the document" ) );
105
        QToolTip::add( TopR, tr( "Distance between the top margin guide and the edge of the page" ) );
106
        QToolTip::add( BottomR, tr( "Distance between the bottom margin guide and the edge of the page" ) );
107
        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" ) );
108
        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 109
 
249 Franz 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
        {
340 Franz 144
                Links->setText( tr( "&Inside:" ) );
145
                Rechts->setText( tr( "&Outside:" ) );
249 Franz 146
                ErsteSeite->setEnabled(true);
147
        }
148
        else
149
        {
340 Franz 150
                Links->setText( tr( "&Left:" ) );
151
                Rechts->setText( tr( "&Right:" ) );
249 Franz 152
                ErsteSeite->setEnabled(false);
153
        }
340 Franz 154
}