Subversion Repositories Scribus

Rev

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