Subversion Repositories Scribus

Rev

Rev 534 | Rev 705 | 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>
693 fschmid 4
#include "scribusdoc.h"
3 paul 5
extern QPixmap loadIcon(QString nam);
80 Franz 6
extern double UmReFaktor;
3 paul 7
 
693 fschmid 8
ReformDoc::ReformDoc( QWidget* parent, ScribusDoc* doc ) : PrefsDialogBase( parent )
3 paul 9
{
693 fschmid 10
        einheit = doc->Einheit;
274 Franz 11
        QString units[] = { tr(" pt"), tr(" mm"), tr(" in"), tr(" p")};
693 fschmid 12
        QString ein = units[doc->Einheit];
274 Franz 13
        int dp[] = {100, 1000, 10000, 100};
693 fschmid 14
        int decimals = dp[doc->Einheit];
519 cbradney 15
        int i=-1;
693 fschmid 16
        Breite = doc->PageB * UmReFaktor;
17
        Hoehe = doc->PageH * UmReFaktor;
249 Franz 18
        setCaption( tr( "Document Setup" ) );
693 fschmid 19
        prefsSelection->insertItem( tr("Page"));
20
        tabPage = new QWidget( prefsWidgets, "tab" );
21
        ReformDocLayout = new QVBoxLayout( tabPage );
249 Franz 22
        ReformDocLayout->setSpacing( 6 );
23
        ReformDocLayout->setMargin( 10 );
693 fschmid 24
        dsGroupBox7 = new QGroupBox( tabPage, "GroupBox7" );
519 cbradney 25
        dsGroupBox7->setTitle( tr( "Page Size" ) );
26
        dsGroupBox7->setColumnLayout(0, Qt::Vertical );
27
        dsGroupBox7->layout()->setSpacing( 0 );
28
        dsGroupBox7->layout()->setMargin( 0 );
29
        dsGroupBox7Layout = new QHBoxLayout( dsGroupBox7->layout() );
30
        dsGroupBox7Layout->setAlignment( Qt::AlignTop );
31
        dsGroupBox7Layout->setSpacing( 0 );
32
        dsGroupBox7Layout->setMargin( 10 );
33
        dsLayout4 = new QGridLayout;
34
        dsLayout4->setSpacing( 6 );
35
        dsLayout4->setMargin( 0 );
693 fschmid 36
        sizeQComboBox = new QComboBox( true, dsGroupBox7, "sizeQComboBox" );
37
        sizeQLabel = new QLabel( sizeQComboBox, tr( "&Size:" ), dsGroupBox7, "sizeQLabel" );
38
        QString sizelist[] = {"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "B0", "B1", "B2", "B3", "B4",
39
                              "B5", "B6", "B7", "B8", "B9", "B10", "C5E", "Comm10E", "DLE", "Executive", "Folio",
40
                              "Ledger", tr("Legal"), tr("Letter"), tr("Tabloid"), tr("Custom")};
41
        size_t const num_mappings = (sizeof sizelist)/(sizeof *sizelist);
42
        for (uint m = 0; m < num_mappings; ++m)
43
        {
44
                sizeQComboBox->insertItem(sizelist[m]);
45
                if (sizelist[m]==doc->PageSize)
519 cbradney 46
                        i=m;
47
        }
48
        //set Custom if we dont have one already as old docs wont have this attribute
49
        if (i==-1)
50
                i=num_mappings-1;
693 fschmid 51
        sizeQComboBox->setEnabled(false);
52
        sizeQComboBox->setCurrentItem(i);
53
        dsLayout4->addWidget( sizeQLabel, 0, 0 );
54
        dsLayout4->addWidget( sizeQComboBox, 0, 1 );
55
        orientationQComboBox = new QComboBox( true, dsGroupBox7, "orientationQComboBox" );
56
        orientationQLabel = new QLabel( orientationQComboBox, tr( "Orie&ntation:" ), dsGroupBox7, "orientationQLabel" );
57
        orientationQComboBox->insertItem( tr( "Portrait" ) );
58
        orientationQComboBox->insertItem( tr( "Landscape" ) );
59
        orientationQComboBox->setEnabled(false);
60
        orientationQComboBox->setCurrentItem(doc->PageOri);
61
        dsLayout4->addWidget( orientationQLabel, 0, 2 );
519 cbradney 62
        dsLayout4->addWidget( orientationQComboBox, 0, 3 );
693 fschmid 63
        widthMSpinBox = new MSpinBox( 1, 10000, dsGroupBox7, 2 );
64
        widthQLabel = new QLabel( tr( "&Width:" ), dsGroupBox7, "widthLabel" );
65
        widthMSpinBox->setEnabled( false );
66
        widthMSpinBox->setSuffix(ein);
519 cbradney 67
        widthMSpinBox->setValue(Breite);
693 fschmid 68
        widthQLabel->setBuddy(widthMSpinBox);
69
        dsLayout4->addWidget( widthQLabel, 1, 0 );
70
        dsLayout4->addWidget( widthMSpinBox, 1, 1 );
71
        heightMSpinBox = new MSpinBox( 1, 10000, dsGroupBox7, 2 );
72
        heightQLabel = new QLabel( tr( "&Height:" ), dsGroupBox7, "heightLabel" );
73
        heightMSpinBox->setEnabled( false );
74
        heightMSpinBox->setSuffix(ein);
519 cbradney 75
        heightMSpinBox->setValue(Hoehe);
693 fschmid 76
        heightQLabel->setBuddy(heightMSpinBox);
77
        dsLayout4->addWidget( heightQLabel, 1, 2 );
78
        dsLayout4->addWidget( heightMSpinBox, 1, 3 );
519 cbradney 79
        dsGroupBox7Layout->addLayout( dsLayout4 );
80
        ReformDocLayout->addWidget( dsGroupBox7 );
693 fschmid 81
        GroupBox7 = new QGroupBox( tabPage, "GroupBox7" );
249 Franz 82
        GroupBox7->setTitle( tr( "Margin Guides" ) );
83
        GroupBox7->setColumnLayout(0, Qt::Vertical );
84
        GroupBox7->layout()->setSpacing( 0 );
85
        GroupBox7->layout()->setMargin( 0 );
86
        GroupBox7Layout = new QHBoxLayout( GroupBox7->layout() );
87
        GroupBox7Layout->setAlignment( Qt::AlignTop );
88
        GroupBox7Layout->setSpacing( 0 );
89
        GroupBox7Layout->setMargin( 10 );
90
        Layout4 = new QGridLayout;
91
        Layout4->setSpacing( 6 );
92
        Layout4->setMargin( 0 );
93
        TopR = new MSpinBox( GroupBox7, 4 );
94
        TopR->setSuffix( ein );
173 Franz 95
        TopR->setDecimals( decimals );
249 Franz 96
        TopR->setMaxValue(Hoehe);
693 fschmid 97
        TopR->setValue(doc->PageM.Top * UmReFaktor);
249 Franz 98
        Layout4->addWidget( TopR, 0, 1 );
340 Franz 99
        TextLabel5 = new QLabel( tr( "&Top:" ), GroupBox7, "TextLabel5" );
100
        TextLabel5->setBuddy(TopR);
101
        Layout4->addWidget( TextLabel5, 0, 0 );
249 Franz 102
        LeftR = new MSpinBox( GroupBox7, 4 );
103
        LeftR->setSuffix( ein );
173 Franz 104
        LeftR->setDecimals( decimals );
249 Franz 105
        LeftR->setMaxValue(Breite);
693 fschmid 106
        LeftR->setValue(doc->PageM.Left * UmReFaktor);
249 Franz 107
        Layout4->addWidget( LeftR, 0, 3 );
340 Franz 108
        Links = new QLabel( tr( "&Left:" ), GroupBox7, "Links" );
109
        Links->setBuddy(LeftR);
110
        Layout4->addWidget( Links, 0, 2 );
249 Franz 111
        BottomR = new MSpinBox( GroupBox7, 4 );
112
        BottomR->setSuffix( ein );
173 Franz 113
        BottomR->setDecimals( decimals );
249 Franz 114
        BottomR->setMaxValue(Hoehe);
693 fschmid 115
        BottomR->setValue(doc->PageM.Bottom * UmReFaktor);
249 Franz 116
        Layout4->addWidget( BottomR, 1, 1 );
340 Franz 117
        TextLabel7 = new QLabel( tr( "&Bottom:" ), GroupBox7, "TextLabel7" );
118
        TextLabel7->setBuddy(BottomR);
119
        Layout4->addWidget( TextLabel7, 1, 0 );
249 Franz 120
        RightR = new MSpinBox( GroupBox7, 4 );
121
        RightR->setSuffix( ein );
173 Franz 122
        RightR->setDecimals( decimals );
249 Franz 123
        RightR->setMaxValue(Breite);
693 fschmid 124
        RightR->setValue(doc->PageM.Right * UmReFaktor);
249 Franz 125
        Layout4->addWidget( RightR, 1, 3 );
340 Franz 126
        Rechts = new QLabel( tr( "&Right:" ), GroupBox7, "Rechts" );
127
        Rechts->setBuddy(RightR);
128
        Layout4->addWidget( Rechts, 1, 2 );
129
        Doppelseiten = new QCheckBox( tr( "&Facing Pages" ),GroupBox7, "Doppelseiten" );
693 fschmid 130
        Doppelseiten->setChecked( doc->PageFP );
249 Franz 131
        Layout4->addMultiCellWidget( Doppelseiten, 2, 2, 0, 1 );
340 Franz 132
        ErsteSeite = new QCheckBox( tr( "Left &Page First" ), GroupBox7, "n" );
693 fschmid 133
        ErsteSeite->setChecked( doc->FirstPageLeft );
249 Franz 134
        Layout4->addMultiCellWidget( ErsteSeite, 2, 2, 2, 3 );
693 fschmid 135
        if (!doc->PageFP)
249 Franz 136
                ErsteSeite->setEnabled(false);
137
        setDS();
534 fschmid 138
        TextLabel1_3 = new QLabel( tr( "F&irst Page Number:" ), GroupBox7, "TextLabel1_3" );
139
        Layout4->addMultiCellWidget( TextLabel1_3, 3, 3, 0, 1 );
140
        PgNr = new QSpinBox( GroupBox7, "PgNr" );
141
        PgNr->setMaxValue( 1000 );
142
        PgNr->setMinValue( 1 );
693 fschmid 143
        PgNr->setValue(doc->FirstPnum);
534 fschmid 144
        Layout4->addWidget( PgNr, 3, 2, Qt::AlignRight );
145
        TextLabel1_3->setBuddy(PgNr);
249 Franz 146
        GroupBox7Layout->addLayout( Layout4 );
147
        ReformDocLayout->addWidget( GroupBox7 );
693 fschmid 148
        prefsWidgets->addWidget( tabPage, 0 );
149
 
150
        prefsSelection->insertItem( tr("View"));
151
        tabView = new QWidget( prefsWidgets, "tabView" );
152
        tabViewLayout = new QVBoxLayout( tabView, 11, 6, "tabViewLayout");
153
        checkMargin = new QCheckBox( tabView, "checkMargin" );
154
        checkMargin->setText( tr( "Show Margins" ) );
155
        checkMargin->setChecked(doc->MarginsShown);
156
        tabViewLayout->addWidget( checkMargin );
157
        checkFrame = new QCheckBox( tabView, "checkFrame" );
158
        checkFrame->setText( tr( "Show Frames" ) );
159
        checkFrame->setChecked(doc->FramesShown);
160
        tabViewLayout->addWidget( checkFrame );
161
        checkPictures = new QCheckBox( tabView, "checkPictures" );
162
        checkPictures->setText( tr( "Show Pictures" ) );
163
        checkPictures->setChecked(doc->ShowPic);
164
        tabViewLayout->addWidget( checkPictures );
165
        checkGrid = new QCheckBox( tabView, "checkGrid" );
166
        checkGrid->setText( tr( "Show Grid" ) );
167
        checkGrid->setChecked(doc->GridShown);
168
        tabViewLayout->addWidget( checkGrid );
169
        checkGuides = new QCheckBox( tabView, "checkGuides" );
170
        checkGuides->setText( tr( "Show Guides" ) );
171
        checkGuides->setChecked(doc->GuidesShown);
172
        tabViewLayout->addWidget( checkGuides );
173
        checkBaseline = new QCheckBox( tabView, "checkBaseline" );
174
        checkBaseline->setText( tr( "Show Baseline Grid" ) );
175
        checkBaseline->setChecked(doc->BaseShown);
176
        tabViewLayout->addWidget( checkBaseline );
177
        prefsWidgets->addWidget( tabView, 1 );
178
 
249 Franz 179
        RightR->setMaxValue(Breite - LeftR->value());
180
        LeftR->setMaxValue(Breite - RightR->value());
181
        TopR->setMaxValue(Hoehe - BottomR->value());
182
        BottomR->setMaxValue(Hoehe - TopR->value());
183
        //tooltips
184
        QToolTip::add( Doppelseiten, tr( "Enable single or spread based layout" ) );
185
        QToolTip::add( ErsteSeite, tr( "Make the first page the left page of the document" ) );
186
        QToolTip::add( TopR, tr( "Distance between the top margin guide and the edge of the page" ) );
187
        QToolTip::add( BottomR, tr( "Distance between the bottom margin guide and the edge of the page" ) );
188
        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" ) );
189
        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 190
 
249 Franz 191
        // signals and slots connections
192
        connect( Doppelseiten, SIGNAL( clicked() ), this, SLOT( setDS() ) );
693 fschmid 193
        connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
194
        connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
249 Franz 195
        connect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
196
        connect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
197
        connect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
198
        connect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
693 fschmid 199
        prefsWidgets->raiseWidget(0);
200
        resize( minimumSizeHint() );
201
        clearWState( WState_Polished );
3 paul 202
}
203
 
693 fschmid 204
void ReformDoc::setTop(int )
36 Franz 205
{
206
        BottomR->setMaxValue(Hoehe - TopR->value());
207
}
3 paul 208
 
693 fschmid 209
void ReformDoc::setBottom(int )
36 Franz 210
{
211
        TopR->setMaxValue(Hoehe - BottomR->value());
212
}
213
 
693 fschmid 214
void ReformDoc::setLeft(int )
36 Franz 215
{
216
        RightR->setMaxValue(Breite - LeftR->value());
217
}
218
 
693 fschmid 219
void ReformDoc::setRight(int )
36 Franz 220
{
221
        LeftR->setMaxValue(Breite - RightR->value());
222
}
223
 
3 paul 224
void ReformDoc::setDS()
225
{
249 Franz 226
        if (Doppelseiten->isChecked())
227
        {
340 Franz 228
                Links->setText( tr( "&Inside:" ) );
229
                Rechts->setText( tr( "&Outside:" ) );
249 Franz 230
                ErsteSeite->setEnabled(true);
231
        }
232
        else
233
        {
340 Franz 234
                Links->setText( tr( "&Left:" ) );
235
                Rechts->setText( tr( "&Right:" ) );
249 Franz 236
                ErsteSeite->setEnabled(false);
237
        }
348 Franz 238
}