Subversion Repositories Scribus

Rev

Rev 1321 | Rev 1542 | 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>
838 cbradney 4
#include <qspinbox.h>
705 fschmid 5
#include <qcolordialog.h>
788 fschmid 6
#include "tabtypography.h"
879 fschmid 7
#include "tabguides.h"
1194 fschmid 8
#include "tabtools.h"
1235 fschmid 9
#include "tabcheckdoc.h"
795 fschmid 10
#include "hysettings.h"
11
#include "cmsprefs.h"
806 cbradney 12
#include "units.h"
838 cbradney 13
#include "mspinbox.h"
14
#include "scribus.h"
1307 fschmid 15
#include "tabpdfoptions.h"
1321 fschmid 16
#include "fontprefs.h"
788 fschmid 17
 
3 paul 18
extern QPixmap loadIcon(QString nam);
80 Franz 19
extern double UmReFaktor;
795 fschmid 20
extern bool CMSavail;
21
extern ProfilesL InputProfiles;
3 paul 22
 
1194 fschmid 23
ReformDoc::ReformDoc( QWidget* parent, ScribusDoc* doc ) : PrefsDialogBase( parent )
3 paul 24
{
1065 cbradney 25
        einheit = doc->docUnitIndex;
734 fschmid 26
        docc = doc;
795 fschmid 27
        ap = (ScribusApp*)parent;
734 fschmid 28
        Umrech = UmReFaktor;
1065 cbradney 29
        QString ein = unitGetSuffixFromIndex(doc->docUnitIndex);
30
        decimals = unitGetDecimalsFromIndex(doc->docUnitIndex);
519 cbradney 31
        int i=-1;
726 fschmid 32
        pageWidth = doc->PageB * UmReFaktor;
33
        pageHeight = doc->PageH * UmReFaktor;
249 Franz 34
        setCaption( tr( "Document Setup" ) );
693 fschmid 35
        tabPage = new QWidget( prefsWidgets, "tab" );
788 fschmid 36
        reformDocLayout = new QVBoxLayout( tabPage );
37
        reformDocLayout->setSpacing( 6 );
38
        reformDocLayout->setMargin( 10 );
693 fschmid 39
        dsGroupBox7 = new QGroupBox( tabPage, "GroupBox7" );
519 cbradney 40
        dsGroupBox7->setTitle( tr( "Page Size" ) );
41
        dsGroupBox7->setColumnLayout(0, Qt::Vertical );
42
        dsGroupBox7->layout()->setSpacing( 0 );
43
        dsGroupBox7->layout()->setMargin( 0 );
44
        dsGroupBox7Layout = new QHBoxLayout( dsGroupBox7->layout() );
45
        dsGroupBox7Layout->setAlignment( Qt::AlignTop );
46
        dsGroupBox7Layout->setSpacing( 0 );
47
        dsGroupBox7Layout->setMargin( 10 );
48
        dsLayout4 = new QGridLayout;
49
        dsLayout4->setSpacing( 6 );
50
        dsLayout4->setMargin( 0 );
693 fschmid 51
        sizeQComboBox = new QComboBox( true, dsGroupBox7, "sizeQComboBox" );
52
        sizeQLabel = new QLabel( sizeQComboBox, tr( "&Size:" ), dsGroupBox7, "sizeQLabel" );
53
        QString sizelist[] = {"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "B0", "B1", "B2", "B3", "B4",
54
                              "B5", "B6", "B7", "B8", "B9", "B10", "C5E", "Comm10E", "DLE", "Executive", "Folio",
55
                              "Ledger", tr("Legal"), tr("Letter"), tr("Tabloid"), tr("Custom")};
56
        size_t const num_mappings = (sizeof sizelist)/(sizeof *sizelist);
57
        for (uint m = 0; m < num_mappings; ++m)
58
        {
59
                sizeQComboBox->insertItem(sizelist[m]);
60
                if (sizelist[m]==doc->PageSize)
519 cbradney 61
                        i=m;
62
        }
63
        //set Custom if we dont have one already as old docs wont have this attribute
64
        if (i==-1)
65
                i=num_mappings-1;
693 fschmid 66
        sizeQComboBox->setEnabled(false);
67
        sizeQComboBox->setCurrentItem(i);
68
        dsLayout4->addWidget( sizeQLabel, 0, 0 );
69
        dsLayout4->addWidget( sizeQComboBox, 0, 1 );
70
        orientationQComboBox = new QComboBox( true, dsGroupBox7, "orientationQComboBox" );
71
        orientationQLabel = new QLabel( orientationQComboBox, tr( "Orie&ntation:" ), dsGroupBox7, "orientationQLabel" );
72
        orientationQComboBox->insertItem( tr( "Portrait" ) );
73
        orientationQComboBox->insertItem( tr( "Landscape" ) );
74
        orientationQComboBox->setEnabled(false);
75
        orientationQComboBox->setCurrentItem(doc->PageOri);
76
        dsLayout4->addWidget( orientationQLabel, 0, 2 );
519 cbradney 77
        dsLayout4->addWidget( orientationQComboBox, 0, 3 );
693 fschmid 78
        widthMSpinBox = new MSpinBox( 1, 10000, dsGroupBox7, 2 );
79
        widthQLabel = new QLabel( tr( "&Width:" ), dsGroupBox7, "widthLabel" );
80
        widthMSpinBox->setEnabled( false );
81
        widthMSpinBox->setSuffix(ein);
726 fschmid 82
        widthMSpinBox->setValue(pageWidth);
693 fschmid 83
        widthQLabel->setBuddy(widthMSpinBox);
84
        dsLayout4->addWidget( widthQLabel, 1, 0 );
85
        dsLayout4->addWidget( widthMSpinBox, 1, 1 );
86
        heightMSpinBox = new MSpinBox( 1, 10000, dsGroupBox7, 2 );
87
        heightMSpinBox->setEnabled( false );
88
        heightMSpinBox->setSuffix(ein);
726 fschmid 89
        heightMSpinBox->setValue(pageHeight);
800 fschmid 90
        heightQLabel = new QLabel(heightMSpinBox,  tr( "&Height:" ), dsGroupBox7, "heightLabel" );
693 fschmid 91
        dsLayout4->addWidget( heightQLabel, 1, 2 );
92
        dsLayout4->addWidget( heightMSpinBox, 1, 3 );
800 fschmid 93
        unitCombo = new QComboBox( true, dsGroupBox7, "unitCombo" );
1525 cbradney 94
        unitCombo->insertStringList(unitGetTextUnitList());
800 fschmid 95
        unitCombo->setEditable(false);
1065 cbradney 96
        unitCombo->setCurrentItem(doc->docUnitIndex);
800 fschmid 97
        unitQLabel = new QLabel(unitCombo, tr( "&Unit:" ), dsGroupBox7, "unitQLabel" );
98
        dsLayout4->addWidget( unitQLabel, 2, 0 );
99
        dsLayout4->addWidget( unitCombo, 2, 1 );
519 cbradney 100
        dsGroupBox7Layout->addLayout( dsLayout4 );
788 fschmid 101
        reformDocLayout->addWidget( dsGroupBox7 );
102
        groupBox7 = new QGroupBox( tabPage, "GroupBox7" );
103
        groupBox7->setTitle( tr( "Margin Guides" ) );
104
        groupBox7->setColumnLayout(0, Qt::Vertical );
105
        groupBox7->layout()->setSpacing( 0 );
106
        groupBox7->layout()->setMargin( 0 );
107
        groupBox7Layout = new QHBoxLayout( groupBox7->layout() );
108
        groupBox7Layout->setAlignment( Qt::AlignTop );
109
        groupBox7Layout->setSpacing( 0 );
110
        groupBox7Layout->setMargin( 10 );
111
        layout4 = new QGridLayout;
112
        layout4->setSpacing( 6 );
113
        layout4->setMargin( 0 );
114
        topR = new MSpinBox( groupBox7, 4 );
726 fschmid 115
        topR->setSuffix( ein );
116
        topR->setDecimals( decimals );
117
        topR->setMaxValue(pageHeight);
118
        topR->setValue(doc->PageM.Top * UmReFaktor);
788 fschmid 119
        layout4->addWidget( topR, 0, 1 );
120
        TextLabel5 = new QLabel( tr( "&Top:" ), groupBox7, "TextLabel5" );
726 fschmid 121
        TextLabel5->setBuddy(topR);
788 fschmid 122
        layout4->addWidget( TextLabel5, 0, 0 );
123
        leftR = new MSpinBox( groupBox7, 4 );
726 fschmid 124
        leftR->setSuffix( ein );
125
        leftR->setDecimals( decimals );
126
        leftR->setMaxValue(pageWidth);
127
        leftR->setValue(doc->PageM.Left * UmReFaktor);
788 fschmid 128
        layout4->addWidget( leftR, 0, 3 );
129
        Links = new QLabel( tr( "&Left:" ), groupBox7, "Links" );
726 fschmid 130
        Links->setBuddy(leftR);
788 fschmid 131
        layout4->addWidget( Links, 0, 2 );
132
        bottomR = new MSpinBox( groupBox7, 4 );
726 fschmid 133
        bottomR->setSuffix( ein );
134
        bottomR->setDecimals( decimals );
135
        bottomR->setMaxValue(pageHeight);
136
        bottomR->setValue(doc->PageM.Bottom * UmReFaktor);
788 fschmid 137
        layout4->addWidget( bottomR, 1, 1 );
138
        TextLabel7 = new QLabel( tr( "&Bottom:" ), groupBox7, "TextLabel7" );
726 fschmid 139
        TextLabel7->setBuddy(bottomR);
788 fschmid 140
        layout4->addWidget( TextLabel7, 1, 0 );
141
        rightR = new MSpinBox( groupBox7, 4 );
726 fschmid 142
        rightR->setSuffix( ein );
143
        rightR->setDecimals( decimals );
144
        rightR->setMaxValue(pageWidth);
145
        rightR->setValue(doc->PageM.Right * UmReFaktor);
788 fschmid 146
        layout4->addWidget( rightR, 1, 3 );
147
        Rechts = new QLabel( tr( "&Right:" ), groupBox7, "Rechts" );
726 fschmid 148
        Rechts->setBuddy(rightR);
788 fschmid 149
        layout4->addWidget( Rechts, 1, 2 );
150
        groupBox7Layout->addLayout( layout4 );
151
        reformDocLayout->addWidget( groupBox7 );
152
        groupBox7a = new QGroupBox( tabPage, "groupBox7" );
153
        groupBox7a->setTitle( tr( "Layout" ) );
154
        groupBox7a->setColumnLayout(0, Qt::Vertical );
155
        groupBox7a->layout()->setSpacing( 0 );
156
        groupBox7a->layout()->setMargin( 0 );
157
        groupBox7aLayout = new QHBoxLayout( groupBox7a->layout() );
158
        groupBox7aLayout->setAlignment( Qt::AlignTop );
159
        groupBox7aLayout->setSpacing( 0 );
160
        groupBox7aLayout->setMargin( 10 );
161
        layout4a = new QGridLayout;
162
        layout4a->setSpacing( 6 );
163
        layout4a->setMargin( 0 );
164
        facingPages = new QCheckBox( tr( "&Facing Pages" ),groupBox7a, "facingPages" );
726 fschmid 165
        facingPages->setChecked( doc->PageFP );
788 fschmid 166
        layout4a->addMultiCellWidget( facingPages, 2, 2, 0, 1 );
167
        firstPage = new QCheckBox( tr( "Left &Page First" ), groupBox7a, "n" );
726 fschmid 168
        firstPage->setChecked( doc->FirstPageLeft );
788 fschmid 169
        layout4a->addMultiCellWidget( firstPage, 2, 2, 2, 3 );
693 fschmid 170
        if (!doc->PageFP)
726 fschmid 171
                firstPage->setEnabled(false);
249 Franz 172
        setDS();
788 fschmid 173
        TextLabel1_3 = new QLabel( tr( "F&irst Page Number:" ), groupBox7a, "TextLabel1_3" );
174
        layout4a->addMultiCellWidget( TextLabel1_3, 3, 3, 0, 1 );
175
        pageNumber = new QSpinBox( groupBox7a, "pageNumber" );
726 fschmid 176
        pageNumber->setMaxValue( 10000 );
177
        pageNumber->setMinValue( 1 );
178
        pageNumber->setValue(doc->FirstPnum);
788 fschmid 179
        layout4a->addWidget( pageNumber, 3, 2, Qt::AlignRight );
726 fschmid 180
        TextLabel1_3->setBuddy(pageNumber);
788 fschmid 181
        groupBox7aLayout->addLayout( layout4a );
182
        reformDocLayout->addWidget( groupBox7a );
800 fschmid 183
        groupAutoSave = new QGroupBox( tabPage, "groupAutoSave" );
184
        groupAutoSave->setTitle( tr( "Autosave" ) );
185
        groupAutoSave->setCheckable( true );
186
        groupAutoSave->setChecked( doc->AutoSave );
187
        groupAutoSave->setColumnLayout(0, Qt::Vertical );
188
        groupAutoSave->layout()->setSpacing( 6 );
189
        groupAutoSave->layout()->setMargin( 11 );
190
        groupAutoSaveLayout = new QHBoxLayout( groupAutoSave->layout() );
191
        groupAutoSaveLayout->setAlignment( Qt::AlignTop );
192
        autoSaveTime = new QSpinBox( groupAutoSave, "autoSaveTime" );
193
        autoSaveTime->setMinValue( 1 );
194
        autoSaveTime->setMaxValue( 60 );
195
        autoSaveTime->setSuffix( " " + tr("min") );
196
        autoSaveTime->setValue(doc->AutoSaveTime / 1000 / 60);
197
        groupAutoSaveLayout->addWidget( autoSaveTime );
198
        textLabel1m = new QLabel(autoSaveTime, tr( "&Interval:" ), groupAutoSave, "textLabel1m" );
199
        groupAutoSaveLayout->addWidget( textLabel1m );
200
        reformDocLayout->addWidget( groupAutoSave );
201
        addItem( tr("Document"), loadIcon("page.png"), tabPage);
693 fschmid 202
 
1195 fschmid 203
        tabGuides = new TabGuides(prefsWidgets, &doc->guidesSettings, &doc->typographicSetttings, UmReFaktor, ein);
715 fschmid 204
        addItem( tr("Guides"), loadIcon("guides.png"), tabGuides);
693 fschmid 205
 
705 fschmid 206
        tabView = new QWidget( prefsWidgets, "tabView" );
207
        tabViewLayout = new QVBoxLayout( tabView, 10, 5, "tabViewLayout");
208
        pageBackground = new QButtonGroup( tabView, "pageBackground" );
1195 fschmid 209
        pageBackground->setTitle( tr( "Page Display" ) );
705 fschmid 210
        pageBackground->setColumnLayout(0, Qt::Vertical );
211
        pageBackground->layout()->setSpacing( 5 );
212
        pageBackground->layout()->setMargin( 10 );
213
        pageBackgroundLayout = new QVBoxLayout( pageBackground->layout() );
214
        pageBackgroundLayout->setAlignment( Qt::AlignTop );
215
        layout10 = new QHBoxLayout( 0, 0, 5, "layout10");
216
        textLabel9 = new QLabel( pageBackground, "textLabel9" );
217
        textLabel9->setText( tr( "Color:" ) );
218
        layout10->addWidget( textLabel9 );
219
        backColor = new QPushButton( pageBackground, "backColor" );
220
        backColor->setMinimumSize( QSize( 60, 20 ) );
221
        backColor->setMaximumSize( QSize( 60, 20 ) );
222
        backColor->setFlat( false );
223
        backColor->setAutoDefault( false );
224
        QPixmap pm5 = QPixmap(54, 14);
225
        pm5.fill(doc->papColor);
226
        colorPaper = doc->papColor;
227
        backColor->setPixmap(pm5);
228
        backColor->setText( QString::null );
229
        layout10->addWidget( backColor );
1195 fschmid 230
        QSpacerItem* spacer3 = new QSpacerItem( 61, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
705 fschmid 231
        layout10->addItem( spacer3 );
232
        pageBackgroundLayout->addLayout( layout10 );
233
        checkUnprintable = new QCheckBox( pageBackground, "checkUnprintable" );
234
        checkUnprintable->setText( tr( "Display &Unprintable Area in Margin Color" ) );
235
        checkUnprintable->setAccel( QKeySequence( tr( "Alt+U" ) ) );
1065 cbradney 236
        checkUnprintable->setChecked( doc->marginColored );
705 fschmid 237
        pageBackgroundLayout->addWidget( checkUnprintable );
1195 fschmid 238
        checkPictures = new QCheckBox( pageBackground, "checkPictures" );
239
        checkPictures->setText( tr( "Show Pictures" ) );
240
        checkPictures->setChecked(doc->guidesSettings.showPic);
241
        pageBackgroundLayout->addWidget( checkPictures );
242
        checkLink = new QCheckBox( pageBackground, "checkLink" );
243
        checkLink->setText( tr( "Show Text Chains" ) );
244
        checkLink->setChecked(doc->guidesSettings.linkShown);
245
        pageBackgroundLayout->addWidget( checkLink );
246
        checkFrame = new QCheckBox( pageBackground, "checkFrame" );
247
        checkFrame->setText( tr( "Show Frames" ) );
248
        checkFrame->setChecked(doc->guidesSettings.framesShown);
249
        pageBackgroundLayout->addWidget( checkFrame );
705 fschmid 250
        tabViewLayout->addWidget( pageBackground );
734 fschmid 251
 
252
        groupScratch = new QGroupBox( tabView, "GroupBox7" );
253
        groupScratch->setTitle( tr( "Scratch Space" ) );
254
        groupScratch->setColumnLayout(0, Qt::Vertical );
255
        groupScratch->layout()->setSpacing( 0 );
256
        groupScratch->layout()->setMargin( 0 );
257
        groupScratchLayout = new QHBoxLayout( groupScratch->layout() );
258
        groupScratchLayout->setAlignment( Qt::AlignTop );
259
        groupScratchLayout->setSpacing( 0 );
260
        groupScratchLayout->setMargin( 10 );
788 fschmid 261
        layout4s = new QGridLayout;
262
        layout4s->setSpacing( 6 );
263
        layout4s->setMargin( 0 );
734 fschmid 264
        topScratch = new MSpinBox( groupScratch, 4 );
265
        topScratch->setSuffix( ein );
266
        topScratch->setDecimals( decimals );
267
        topScratch->setMaxValue(1000);
268
        topScratch->setValue(doc->ScratchTop * UmReFaktor);
788 fschmid 269
        layout4s->addWidget( topScratch, 0, 1 );
734 fschmid 270
        TextLabel5s = new QLabel(topScratch, tr( "&Top:" ), groupScratch, "TextLabel5" );
788 fschmid 271
        layout4s->addWidget( TextLabel5s, 0, 0 );
734 fschmid 272
        leftScratch = new MSpinBox( groupScratch, 4 );
273
        leftScratch->setSuffix( ein );
274
        leftScratch->setDecimals( decimals );
275
        leftScratch->setMaxValue(1000);
276
        leftScratch->setValue(doc->ScratchLeft * UmReFaktor);
788 fschmid 277
        layout4s->addWidget( leftScratch, 0, 3 );
734 fschmid 278
        Linkss = new QLabel(leftScratch, tr( "&Left:" ), groupScratch, "Links" );
788 fschmid 279
        layout4s->addWidget( Linkss, 0, 2 );
734 fschmid 280
        bottomScratch = new MSpinBox( groupScratch, 4 );
281
        bottomScratch->setSuffix( ein );
282
        bottomScratch->setDecimals( decimals );
283
        bottomScratch->setMaxValue(1000);
284
        bottomScratch->setValue(doc->ScratchBottom * UmReFaktor);
788 fschmid 285
        layout4s->addWidget( bottomScratch, 1, 1 );
734 fschmid 286
        TextLabel7s = new QLabel(bottomScratch, tr( "&Bottom:" ), groupScratch, "TextLabel7" );
788 fschmid 287
        layout4s->addWidget( TextLabel7s, 1, 0 );
734 fschmid 288
        rightScratch = new MSpinBox( groupScratch, 4 );
289
        rightScratch->setSuffix( ein );
290
        rightScratch->setDecimals( decimals );
291
        rightScratch->setMaxValue(1000);
292
        rightScratch->setValue(doc->ScratchRight * UmReFaktor);
788 fschmid 293
        layout4s->addWidget( rightScratch, 1, 3 );
734 fschmid 294
        Rechtss = new QLabel(rightScratch, tr( "&Right:" ), groupScratch, "Rechts" );
788 fschmid 295
        layout4s->addWidget( Rechtss, 1, 2 );
296
        groupScratchLayout->addLayout( layout4s );
734 fschmid 297
        tabViewLayout->addWidget( groupScratch );
715 fschmid 298
        addItem( tr("Display"), loadIcon("screen.png"), tabView);
299
 
1195 fschmid 300
        tabTypo = new TabTypograpy(  prefsWidgets, &doc->typographicSetttings);
715 fschmid 301
        addItem( tr("Typography"), loadIcon("font.png"), tabTypo);
302
 
1194 fschmid 303
        tabTools = new TabTools(  prefsWidgets, &doc->toolSettings, UmReFaktor, ein, doc);
726 fschmid 304
        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
305
 
795 fschmid 306
        tabHyphenator = new HySettings(prefsWidgets, &ap->LangTransl);
1065 cbradney 307
        tabHyphenator->verbose->setChecked(!doc->docHyphenator->Automatic);
308
        tabHyphenator->input->setChecked(doc->docHyphenator->AutoCheck);
309
        tabHyphenator->language->setCurrentText(ap->LangTransl[doc->docHyphenator->Language]);
310
        tabHyphenator->wordLen->setValue(doc->docHyphenator->MinWordLen);
311
        tabHyphenator->maxCount->setValue(doc->docHyphenator->HyCount);
795 fschmid 312
        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
1321 fschmid 313
 
314
        tabFonts = new FontPrefs(  prefsWidgets, ap->Prefs.AvailFonts, true, &ap->Prefs, ap->PrefsPfad, doc);
315
        addItem( tr("Fonts"), loadIcon("font.png"), tabFonts);
1235 fschmid 316
 
1261 fschmid 317
        tabDocChecker = new TabCheckDoc(  prefsWidgets, doc->checkerProfiles, doc->curCheckProfile);
1235 fschmid 318
        addItem( tr("Doc-Checker"), loadIcon("checkdoc.png"), tabDocChecker);
1307 fschmid 319
 
1525 cbradney 320
        tabPDF = new TabPDFOptions( prefsWidgets, &doc->PDF_Optionen, ap->Prefs.AvailFonts,
321
                                                                &ap->PDFXProfiles, doc->UsedFonts, doc->PDF_Optionen.PresentVals,
322
                                                                UmReFaktor, ein, doc->PageH, doc->PageB, 0 );
1307 fschmid 323
        addItem( tr("PDF Export"), loadIcon("acroread.png"), tabPDF);
1235 fschmid 324
 
800 fschmid 325
        int cmsTab = 0;
795 fschmid 326
        if (CMSavail)
327
        {
328
                tabColorManagement = new CMSPrefs(prefsWidgets, &doc->CMSSettings, &InputProfiles, &ap->PrinterProfiles, &ap->MonitorProfiles);
800 fschmid 329
                cmsTab = addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
795 fschmid 330
        }
331
 
726 fschmid 332
        rightR->setMaxValue(pageWidth - leftR->value());
333
        leftR->setMaxValue(pageWidth - rightR->value());
334
        topR->setMaxValue(pageHeight - bottomR->value());
335
        bottomR->setMaxValue(pageHeight - topR->value());
249 Franz 336
        //tooltips
1195 fschmid 337
        QToolTip::add( checkLink, tr("Turns the of linked frames on or off"));
338
        QToolTip::add( checkFrame, tr("Turns the display of frames on or off"));
339
        QToolTip::add( checkPictures, tr("Turns the display of pictures on or off"));
776 fschmid 340
        QToolTip::add( backColor, tr( "Color for paper" ) );
341
        QToolTip::add( checkUnprintable, tr( "Mask the area outside the margins in the margin color" ) );
726 fschmid 342
        QToolTip::add( facingPages, tr( "Enable single or spread based layout" ) );
343
        QToolTip::add( firstPage, tr( "Make the first page the left page of the document" ) );
344
        QToolTip::add( topR, tr( "Distance between the top margin guide and the edge of the page" ) );
345
        QToolTip::add( bottomR, tr( "Distance between the bottom margin guide and the edge of the page" ) );
346
        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" ) );
347
        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 348
 
249 Franz 349
        // signals and slots connections
726 fschmid 350
        connect( facingPages, SIGNAL( clicked() ), this, SLOT( setDS() ) );
351
        connect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
352
        connect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
353
        connect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
354
        connect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
705 fschmid 355
        connect(backColor, SIGNAL(clicked()), this, SLOT(changePaperColor()));
734 fschmid 356
        connect(unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
731 fschmid 357
 
800 fschmid 358
        if (CMSavail)
1307 fschmid 359
        {
800 fschmid 360
                prefsWidgets->raiseWidget(cmsTab);
1307 fschmid 361
                connect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
362
        }
800 fschmid 363
        arrangeIcons();
693 fschmid 364
        resize( minimumSizeHint() );
365
        clearWState( WState_Polished );
800 fschmid 366
        prefsWidgets->raiseWidget(0);
3 paul 367
}
368
 
734 fschmid 369
void ReformDoc::unitChange()
370
{
371
        disconnect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
372
        disconnect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
373
        disconnect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
374
        disconnect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
375
        int decimalsOld;
376
        double AltUmrech = Umrech;
377
        double oldMin, oldMax, val;
378
        QString einh;
379
        einheit = unitCombo->currentItem();
1525 cbradney 380
        Umrech=unitGetRatioFromIndex(einheit);
381
        decimals=unitGetDecimalsFromIndex(einheit);
382
        einh=unitGetSuffixFromIndex(einheit);
781 cbradney 383
 
782 fschmid 384
        widthMSpinBox->setSuffix(einh);
385
        heightMSpinBox->setSuffix(einh);
386
        topR->setSuffix(einh);
387
        bottomR->setSuffix(einh);
388
        leftR->setSuffix(einh);
389
        rightR->setSuffix(einh);
879 fschmid 390
        tabGuides->minorSpace->setSuffix(einh);
391
        tabGuides->majorSpace->setSuffix(einh);
392
        tabGuides->snapDistance->setSuffix(einh);
1195 fschmid 393
        tabGuides->baseGrid->setSuffix(einh);
394
        tabGuides->baseOffset->setSuffix(einh);
1194 fschmid 395
        tabTools->gapText->setSuffix(einh);
782 fschmid 396
        topScratch->setSuffix(einh);
397
        bottomScratch->setSuffix(einh);
398
        leftScratch->setSuffix(einh);
399
        rightScratch->setSuffix(einh);
1307 fschmid 400
        tabPDF->BleedBottom->setSuffix(einh);
401
        tabPDF->BleedTop->setSuffix(einh);
402
        tabPDF->BleedRight->setSuffix(einh);
403
        tabPDF->BleedLeft->setSuffix(einh);
781 cbradney 404
 
782 fschmid 405
        double invUnitConversion = 1.0 / AltUmrech * Umrech;
781 cbradney 406
 
734 fschmid 407
        widthMSpinBox->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 408
        widthMSpinBox->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, docc->PageB * Umrech);
734 fschmid 409
        heightMSpinBox->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 410
        heightMSpinBox->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, docc->PageH * Umrech);
734 fschmid 411
        topR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 412
        topR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 413
        bottomR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 414
        bottomR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 415
        leftR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 416
        leftR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 417
        rightR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 418
        rightR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
879 fschmid 419
        tabGuides->minorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
420
        tabGuides->minorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
421
        tabGuides->majorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
422
        tabGuides->majorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
423
        tabGuides->snapDistance->getValues(&oldMin, &oldMax, &decimalsOld, &val);
424
        tabGuides->snapDistance->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1195 fschmid 425
        tabGuides->baseGrid->getValues(&oldMin, &oldMax, &decimalsOld, &val);
426
        tabGuides->baseGrid->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
427
        tabGuides->baseOffset->getValues(&oldMin, &oldMax, &decimalsOld, &val);
428
        tabGuides->baseOffset->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1194 fschmid 429
        tabTools->gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
430
        tabTools->gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 431
        topScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 432
        topScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 433
        bottomScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 434
        bottomScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 435
        leftScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 436
        leftScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 437
        rightScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 438
        rightScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1307 fschmid 439
        tabPDF->BleedBottom->getValues(&oldMin, &oldMax, &decimalsOld, &val);
440
        tabPDF->BleedBottom->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
441
        tabPDF->BleedTop->getValues(&oldMin, &oldMax, &decimalsOld, &val);
442
        tabPDF->BleedTop->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
443
        tabPDF->BleedRight->getValues(&oldMin, &oldMax, &decimalsOld, &val);
444
        tabPDF->BleedRight->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
445
        tabPDF->BleedLeft->getValues(&oldMin, &oldMax, &decimalsOld, &val);
446
        tabPDF->BleedLeft->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
447
        tabPDF->unitConv = Umrech;
734 fschmid 448
        pageWidth = docc->PageB * Umrech;
449
        pageHeight = docc->PageH * Umrech;
450
        rightR->setMaxValue(pageWidth - leftR->value());
451
        leftR->setMaxValue(pageWidth - rightR->value());
452
        topR->setMaxValue(pageHeight - bottomR->value());
453
        bottomR->setMaxValue(pageHeight - topR->value());
454
        connect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
455
        connect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
456
        connect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
457
        connect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
458
}
459
 
705 fschmid 460
void ReformDoc::changePaperColor()
461
{
462
        QColor neu = QColor();
463
        neu = QColorDialog::getColor(colorPaper, this);
464
        if (neu.isValid())
465
        {
466
                QPixmap pm = QPixmap(54, 14);
467
                pm.fill(neu);
468
                colorPaper = neu;
469
                backColor->setPixmap(pm);
470
        }
471
}
472
 
693 fschmid 473
void ReformDoc::setTop(int )
36 Franz 474
{
726 fschmid 475
        bottomR->setMaxValue(pageHeight - topR->value());
36 Franz 476
}
3 paul 477
 
693 fschmid 478
void ReformDoc::setBottom(int )
36 Franz 479
{
726 fschmid 480
        topR->setMaxValue(pageHeight - bottomR->value());
36 Franz 481
}
482
 
693 fschmid 483
void ReformDoc::setLeft(int )
36 Franz 484
{
726 fschmid 485
        rightR->setMaxValue(pageWidth - leftR->value());
36 Franz 486
}
487
 
693 fschmid 488
void ReformDoc::setRight(int )
36 Franz 489
{
726 fschmid 490
        leftR->setMaxValue(pageWidth - rightR->value());
36 Franz 491
}
492
 
3 paul 493
void ReformDoc::setDS()
494
{
726 fschmid 495
        if (facingPages->isChecked())
249 Franz 496
        {
340 Franz 497
                Links->setText( tr( "&Inside:" ) );
498
                Rechts->setText( tr( "&Outside:" ) );
726 fschmid 499
                firstPage->setEnabled(true);
249 Franz 500
        }
501
        else
502
        {
340 Franz 503
                Links->setText( tr( "&Left:" ) );
504
                Rechts->setText( tr( "&Right:" ) );
726 fschmid 505
                firstPage->setEnabled(false);
249 Franz 506
        }
348 Franz 507
}
1307 fschmid 508
 
509
void ReformDoc::switchCMS(bool enable)
510
{
511
        tabPDF->enableCMS(enable);
512
}