Subversion Repositories Scribus

Rev

Rev 2142 | Rev 2250 | 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"
2246 subik 7
#include "docinfo.h"
879 fschmid 8
#include "tabguides.h"
1194 fschmid 9
#include "tabtools.h"
1235 fschmid 10
#include "tabcheckdoc.h"
795 fschmid 11
#include "hysettings.h"
12
#include "cmsprefs.h"
806 cbradney 13
#include "units.h"
838 cbradney 14
#include "mspinbox.h"
15
#include "scribus.h"
1307 fschmid 16
#include "tabpdfoptions.h"
1321 fschmid 17
#include "fontprefs.h"
1542 cbradney 18
#include "units.h"
19
#include "pagesize.h"
1641 cbradney 20
#include "docitemattrprefs.h"
1684 cbradney 21
#include "tocindexprefs.h"
788 fschmid 22
 
3 paul 23
extern QPixmap loadIcon(QString nam);
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;
1843 cbradney 32
        unitRatio = doc->unitRatio;
1065 cbradney 33
        QString ein = unitGetSuffixFromIndex(doc->docUnitIndex);
34
        decimals = unitGetDecimalsFromIndex(doc->docUnitIndex);
2142 cbradney 35
        pageWidth = doc->pageWidth * unitRatio;
36
        pageHeight = doc->pageHeight * unitRatio;
249 Franz 37
        setCaption( tr( "Document Setup" ) );
693 fschmid 38
        tabPage = new QWidget( prefsWidgets, "tab" );
788 fschmid 39
        reformDocLayout = new QVBoxLayout( tabPage );
1878 cbradney 40
        reformDocLayout->setSpacing( 5 );
41
        reformDocLayout->setMargin( 0 );
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" ) );
2246 subik 61
 
1542 cbradney 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);
2246 subik 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);
2142 cbradney 120
        topR->setValue(doc->pageMargins.Top * unitRatio);
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);
2142 cbradney 129
        leftR->setValue(doc->pageMargins.Left * unitRatio);
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);
2142 cbradney 138
        bottomR->setValue(doc->pageMargins.Bottom * unitRatio);
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);
2142 cbradney 147
        rightR->setValue(doc->pageMargins.Right * unitRatio);
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
 
2246 subik 205
        docInfos = new DocInfos(prefsWidgets, doc->documentInfo);
206
        addItem(tr("Document Informations"), loadIcon("documentinfo.png"), docInfos);
207
 
1790 cbradney 208
        tabGuides = new TabGuides(prefsWidgets, &doc->guidesSettings, &doc->typographicSetttings, einheit);
2246 subik 209
        addItem(tr("Guides"), loadIcon("guides.png"), tabGuides);
693 fschmid 210
 
705 fschmid 211
        tabView = new QWidget( prefsWidgets, "tabView" );
1878 cbradney 212
        tabViewLayout = new QVBoxLayout( tabView, 0, 5, "tabViewLayout");
705 fschmid 213
        pageBackground = new QButtonGroup( tabView, "pageBackground" );
1195 fschmid 214
        pageBackground->setTitle( tr( "Page Display" ) );
705 fschmid 215
        pageBackground->setColumnLayout(0, Qt::Vertical );
216
        pageBackground->layout()->setSpacing( 5 );
217
        pageBackground->layout()->setMargin( 10 );
218
        pageBackgroundLayout = new QVBoxLayout( pageBackground->layout() );
219
        pageBackgroundLayout->setAlignment( Qt::AlignTop );
220
        layout10 = new QHBoxLayout( 0, 0, 5, "layout10");
221
        textLabel9 = new QLabel( pageBackground, "textLabel9" );
222
        textLabel9->setText( tr( "Color:" ) );
223
        layout10->addWidget( textLabel9 );
224
        backColor = new QPushButton( pageBackground, "backColor" );
225
        backColor->setMinimumSize( QSize( 60, 20 ) );
226
        backColor->setMaximumSize( QSize( 60, 20 ) );
227
        backColor->setFlat( false );
228
        backColor->setAutoDefault( false );
229
        QPixmap pm5 = QPixmap(54, 14);
230
        pm5.fill(doc->papColor);
231
        colorPaper = doc->papColor;
232
        backColor->setPixmap(pm5);
233
        backColor->setText( QString::null );
234
        layout10->addWidget( backColor );
1195 fschmid 235
        QSpacerItem* spacer3 = new QSpacerItem( 61, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
705 fschmid 236
        layout10->addItem( spacer3 );
237
        pageBackgroundLayout->addLayout( layout10 );
238
        checkUnprintable = new QCheckBox( pageBackground, "checkUnprintable" );
239
        checkUnprintable->setText( tr( "Display &Unprintable Area in Margin Color" ) );
240
        checkUnprintable->setAccel( QKeySequence( tr( "Alt+U" ) ) );
1065 cbradney 241
        checkUnprintable->setChecked( doc->marginColored );
705 fschmid 242
        pageBackgroundLayout->addWidget( checkUnprintable );
1195 fschmid 243
        checkPictures = new QCheckBox( pageBackground, "checkPictures" );
244
        checkPictures->setText( tr( "Show Pictures" ) );
245
        checkPictures->setChecked(doc->guidesSettings.showPic);
246
        pageBackgroundLayout->addWidget( checkPictures );
247
        checkLink = new QCheckBox( pageBackground, "checkLink" );
248
        checkLink->setText( tr( "Show Text Chains" ) );
249
        checkLink->setChecked(doc->guidesSettings.linkShown);
250
        pageBackgroundLayout->addWidget( checkLink );
251
        checkFrame = new QCheckBox( pageBackground, "checkFrame" );
252
        checkFrame->setText( tr( "Show Frames" ) );
253
        checkFrame->setChecked(doc->guidesSettings.framesShown);
254
        pageBackgroundLayout->addWidget( checkFrame );
705 fschmid 255
        tabViewLayout->addWidget( pageBackground );
734 fschmid 256
 
257
        groupScratch = new QGroupBox( tabView, "GroupBox7" );
258
        groupScratch->setTitle( tr( "Scratch Space" ) );
259
        groupScratch->setColumnLayout(0, Qt::Vertical );
260
        groupScratch->layout()->setSpacing( 0 );
261
        groupScratch->layout()->setMargin( 0 );
262
        groupScratchLayout = new QHBoxLayout( groupScratch->layout() );
263
        groupScratchLayout->setAlignment( Qt::AlignTop );
264
        groupScratchLayout->setSpacing( 0 );
265
        groupScratchLayout->setMargin( 10 );
788 fschmid 266
        layout4s = new QGridLayout;
267
        layout4s->setSpacing( 6 );
268
        layout4s->setMargin( 0 );
734 fschmid 269
        topScratch = new MSpinBox( groupScratch, 4 );
270
        topScratch->setSuffix( ein );
271
        topScratch->setDecimals( decimals );
272
        topScratch->setMaxValue(1000);
1843 cbradney 273
        topScratch->setValue(doc->ScratchTop * unitRatio);
788 fschmid 274
        layout4s->addWidget( topScratch, 0, 1 );
734 fschmid 275
        TextLabel5s = new QLabel(topScratch, tr( "&Top:" ), groupScratch, "TextLabel5" );
788 fschmid 276
        layout4s->addWidget( TextLabel5s, 0, 0 );
734 fschmid 277
        leftScratch = new MSpinBox( groupScratch, 4 );
278
        leftScratch->setSuffix( ein );
279
        leftScratch->setDecimals( decimals );
280
        leftScratch->setMaxValue(1000);
1843 cbradney 281
        leftScratch->setValue(doc->ScratchLeft * unitRatio);
788 fschmid 282
        layout4s->addWidget( leftScratch, 0, 3 );
734 fschmid 283
        Linkss = new QLabel(leftScratch, tr( "&Left:" ), groupScratch, "Links" );
788 fschmid 284
        layout4s->addWidget( Linkss, 0, 2 );
734 fschmid 285
        bottomScratch = new MSpinBox( groupScratch, 4 );
286
        bottomScratch->setSuffix( ein );
287
        bottomScratch->setDecimals( decimals );
288
        bottomScratch->setMaxValue(1000);
1843 cbradney 289
        bottomScratch->setValue(doc->ScratchBottom * unitRatio);
788 fschmid 290
        layout4s->addWidget( bottomScratch, 1, 1 );
734 fschmid 291
        TextLabel7s = new QLabel(bottomScratch, tr( "&Bottom:" ), groupScratch, "TextLabel7" );
788 fschmid 292
        layout4s->addWidget( TextLabel7s, 1, 0 );
734 fschmid 293
        rightScratch = new MSpinBox( groupScratch, 4 );
294
        rightScratch->setSuffix( ein );
295
        rightScratch->setDecimals( decimals );
296
        rightScratch->setMaxValue(1000);
1843 cbradney 297
        rightScratch->setValue(doc->ScratchRight * unitRatio);
788 fschmid 298
        layout4s->addWidget( rightScratch, 1, 3 );
734 fschmid 299
        Rechtss = new QLabel(rightScratch, tr( "&Right:" ), groupScratch, "Rechts" );
788 fschmid 300
        layout4s->addWidget( Rechtss, 1, 2 );
301
        groupScratchLayout->addLayout( layout4s );
734 fschmid 302
        tabViewLayout->addWidget( groupScratch );
715 fschmid 303
        addItem( tr("Display"), loadIcon("screen.png"), tabView);
304
 
1195 fschmid 305
        tabTypo = new TabTypograpy(  prefsWidgets, &doc->typographicSetttings);
715 fschmid 306
        addItem( tr("Typography"), loadIcon("font.png"), tabTypo);
307
 
1790 cbradney 308
        tabTools = new TabTools(  prefsWidgets, &doc->toolSettings, einheit, doc);
726 fschmid 309
        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
310
 
795 fschmid 311
        tabHyphenator = new HySettings(prefsWidgets, &ap->LangTransl);
1065 cbradney 312
        tabHyphenator->verbose->setChecked(!doc->docHyphenator->Automatic);
313
        tabHyphenator->input->setChecked(doc->docHyphenator->AutoCheck);
314
        tabHyphenator->language->setCurrentText(ap->LangTransl[doc->docHyphenator->Language]);
315
        tabHyphenator->wordLen->setValue(doc->docHyphenator->MinWordLen);
316
        tabHyphenator->maxCount->setValue(doc->docHyphenator->HyCount);
795 fschmid 317
        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
2246 subik 318
 
1321 fschmid 319
        tabFonts = new FontPrefs(  prefsWidgets, ap->Prefs.AvailFonts, true, &ap->Prefs, ap->PrefsPfad, doc);
320
        addItem( tr("Fonts"), loadIcon("font.png"), tabFonts);
1235 fschmid 321
 
1261 fschmid 322
        tabDocChecker = new TabCheckDoc(  prefsWidgets, doc->checkerProfiles, doc->curCheckProfile);
1641 cbradney 323
        addItem( tr("Document Checker"), loadIcon("checkdoc.png"), tabDocChecker);
2246 subik 324
 
1545 cbradney 325
        tabPDF = new TabPDFOptions( prefsWidgets, &doc->PDF_Options, ap->Prefs.AvailFonts,
326
                                                                &ap->PDFXProfiles, doc->UsedFonts, doc->PDF_Options.PresentVals,
2142 cbradney 327
                                                                einheit, doc->pageHeight, doc->pageWidth, 0 );
1307 fschmid 328
        addItem( tr("PDF Export"), loadIcon("acroread.png"), tabPDF);
2246 subik 329
 
1641 cbradney 330
        tabDocItemAttributes = new DocumentItemAttributes( prefsWidgets);
1694 cbradney 331
        docAttributesList=tabDocItemAttributes->getDocAttributesNames();
1641 cbradney 332
        tabDocItemAttributes->setup(&doc->docItemAttributes);
333
        addItem( tr("Document Item Attributes"), loadIcon("docattributes.png"), tabDocItemAttributes);
1235 fschmid 334
 
1684 cbradney 335
        tabTOCIndexPrefs = new TOCIndexPrefs( prefsWidgets );
1701 cbradney 336
        tabTOCIndexPrefs->setupItemAttrs( docAttributesList );
337
        tabTOCIndexPrefs->setup(&(currDoc->docToCSetups), currDoc);
1694 cbradney 338
        connect( prefsWidgets, SIGNAL(aboutToShow(QWidget *)), this, SLOT(setTOCIndexData(QWidget *)));
1684 cbradney 339
        addItem( tr("Table of Contents and Indexes"), loadIcon("tabtocindex.png"), tabTOCIndexPrefs);
2246 subik 340
 
800 fschmid 341
        int cmsTab = 0;
795 fschmid 342
        if (CMSavail)
343
        {
344
                tabColorManagement = new CMSPrefs(prefsWidgets, &doc->CMSSettings, &InputProfiles, &ap->PrinterProfiles, &ap->MonitorProfiles);
800 fschmid 345
                cmsTab = addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
795 fschmid 346
        }
347
 
726 fschmid 348
        rightR->setMaxValue(pageWidth - leftR->value());
349
        leftR->setMaxValue(pageWidth - rightR->value());
350
        topR->setMaxValue(pageHeight - bottomR->value());
351
        bottomR->setMaxValue(pageHeight - topR->value());
249 Franz 352
        //tooltips
2246 subik 353
        QToolTip::add( checkLink, "<qt>" + tr("Turns the of linked frames on or off") + "</qt>");
354
        QToolTip::add( checkFrame, "<qt>" + tr("Turns the display of frames on or off") + "</qt>");
355
        QToolTip::add( checkPictures, "<qt>" + tr("Turns the display of pictures on or off") + "</qt>");
356
        QToolTip::add( backColor, "<qt>" + tr( "Color for paper" ) + "</qt>" );
357
        QToolTip::add( checkUnprintable, "<qt>" + tr( "Mask the area outside the margins in the margin color" ) + "</qt>" );
358
        QToolTip::add( facingPages, "<qt>" + tr( "Enable single or spread based layout" ) + "</qt>" );
359
        QToolTip::add( firstPage, "<qt>" + tr( "Make the first page the left page of the document" ) + "</qt>" );
360
        QToolTip::add( topR, "<qt>" + tr( "Distance between the top margin guide and the edge of the page" ) + "</qt>" );
361
        QToolTip::add( bottomR, "<qt>" + tr( "Distance between the bottom margin guide and the edge of the page" ) + "</qt>" );
362
        QToolTip::add( leftR, "<qt>" + 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" )  + "</qt>");
363
        QToolTip::add( rightR, "<qt>" + 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" ) + "</qt>" );
3 paul 364
 
249 Franz 365
        // signals and slots connections
726 fschmid 366
        connect( facingPages, SIGNAL( clicked() ), this, SLOT( setDS() ) );
367
        connect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
368
        connect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
369
        connect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
370
        connect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
705 fschmid 371
        connect(backColor, SIGNAL(clicked()), this, SLOT(changePaperColor()));
734 fschmid 372
        connect(unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
1828 fschmid 373
        connect(backToDefaults, SIGNAL(clicked()), this, SLOT(restoreDefaults()));
731 fschmid 374
 
800 fschmid 375
        if (CMSavail)
1307 fschmid 376
        {
800 fschmid 377
                prefsWidgets->raiseWidget(cmsTab);
1307 fschmid 378
                connect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
379
        }
800 fschmid 380
        arrangeIcons();
693 fschmid 381
        resize( minimumSizeHint() );
382
        clearWState( WState_Polished );
1834 fschmid 383
        prefsSelection->setSelected(prefsSelection->firstItem(), true);
384
        itemSelected(prefsSelection->firstItem());
3 paul 385
}
386
 
1828 fschmid 387
void ReformDoc::restoreDefaults()
388
{
389
        QWidget* current = prefsWidgets->visibleWidget();
390
        if (current == tabPage)
391
        {
392
                unitCombo->setCurrentItem(currDoc->docUnitIndex);
393
                unitChange();
394
                autoSaveTime->setValue(currDoc->AutoSaveTime / 1000 / 60);
395
                groupAutoSave->setChecked( currDoc->AutoSave );
396
                pageNumber->setValue(currDoc->FirstPnum);
397
                firstPage->setChecked( currDoc->FirstPageLeft );
398
                facingPages->setChecked( currDoc->PageFP );
2142 cbradney 399
                rightR->setValue(currDoc->pageMargins.Right * unitRatio);
400
                bottomR->setValue(currDoc->pageMargins.Bottom * unitRatio);
401
                leftR->setValue(currDoc->pageMargins.Left * unitRatio);
402
                topR->setValue(currDoc->pageMargins.Top * unitRatio);
1828 fschmid 403
        }
404
        else if (current == tabView)
405
        {
406
                QPixmap pm = QPixmap(54, 14);
407
                pm.fill(currDoc->papColor);
408
                colorPaper = currDoc->papColor;
409
                backColor->setPixmap(pm);
410
                checkUnprintable->setChecked( currDoc->marginColored );
411
                checkPictures->setChecked(currDoc->guidesSettings.showPic);
412
                checkLink->setChecked(currDoc->guidesSettings.linkShown);
413
                checkFrame->setChecked(currDoc->guidesSettings.framesShown);
414
                topScratch->setValue(currDoc->ScratchTop * unitRatio);
415
                leftScratch->setValue(currDoc->ScratchLeft * unitRatio);
416
                bottomScratch->setValue(currDoc->ScratchBottom * unitRatio);
417
                rightScratch->setValue(currDoc->ScratchRight * unitRatio);
418
        }
419
        else if (current == tabHyphenator)
420
        {
421
                tabHyphenator->verbose->setChecked(!currDoc->docHyphenator->Automatic);
422
                tabHyphenator->input->setChecked(currDoc->docHyphenator->AutoCheck);
423
                tabHyphenator->language->setCurrentText(ap->LangTransl[currDoc->docHyphenator->Language]);
424
                tabHyphenator->wordLen->setValue(currDoc->docHyphenator->MinWordLen);
425
                tabHyphenator->maxCount->setValue(currDoc->docHyphenator->HyCount);
426
        }
427
        else if (current == tabGuides)
1833 fschmid 428
                tabGuides->restoreDefaults(&currDoc->guidesSettings, &currDoc->typographicSetttings, einheit);
1828 fschmid 429
        else if (current == tabTypo)
430
                tabTypo->restoreDefaults(&currDoc->typographicSetttings);
431
        else if (current == tabTools)
432
                tabTools->restoreDefaults();
433
        else if (current == tabFonts)
434
                tabFonts->restoreDefaults();
435
        else if (current == tabDocChecker)
436
                tabDocChecker->restoreDefaults();
437
        else if (current == tabPDF)
438
                tabPDF->restoreDefaults();
439
        else if (current == tabColorManagement)
440
                tabColorManagement->restoreDefaults();
2246 subik 441
        else if (current == docInfos)
442
                docInfos->restoreDefaults();
1828 fschmid 443
}
444
 
734 fschmid 445
void ReformDoc::unitChange()
446
{
447
        disconnect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
448
        disconnect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
449
        disconnect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
450
        disconnect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
451
        int decimalsOld;
1790 cbradney 452
        double oldUnitRatio = unitRatio;
734 fschmid 453
        double oldMin, oldMax, val;
454
        QString einh;
455
        einheit = unitCombo->currentItem();
1790 cbradney 456
        unitRatio=unitGetRatioFromIndex(einheit);
1525 cbradney 457
        decimals=unitGetDecimalsFromIndex(einheit);
458
        einh=unitGetSuffixFromIndex(einheit);
781 cbradney 459
 
782 fschmid 460
        widthMSpinBox->setSuffix(einh);
461
        heightMSpinBox->setSuffix(einh);
462
        topR->setSuffix(einh);
463
        bottomR->setSuffix(einh);
464
        leftR->setSuffix(einh);
465
        rightR->setSuffix(einh);
879 fschmid 466
        tabGuides->minorSpace->setSuffix(einh);
467
        tabGuides->majorSpace->setSuffix(einh);
468
        tabGuides->snapDistance->setSuffix(einh);
1195 fschmid 469
        tabGuides->baseGrid->setSuffix(einh);
470
        tabGuides->baseOffset->setSuffix(einh);
1194 fschmid 471
        tabTools->gapText->setSuffix(einh);
782 fschmid 472
        topScratch->setSuffix(einh);
473
        bottomScratch->setSuffix(einh);
474
        leftScratch->setSuffix(einh);
475
        rightScratch->setSuffix(einh);
1307 fschmid 476
        tabPDF->BleedBottom->setSuffix(einh);
477
        tabPDF->BleedTop->setSuffix(einh);
478
        tabPDF->BleedRight->setSuffix(einh);
479
        tabPDF->BleedLeft->setSuffix(einh);
781 cbradney 480
 
1790 cbradney 481
        double invUnitConversion = 1.0 / oldUnitRatio * unitRatio;
781 cbradney 482
 
734 fschmid 483
        widthMSpinBox->getValues(&oldMin, &oldMax, &decimalsOld, &val);
2142 cbradney 484
        widthMSpinBox->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, currDoc->pageWidth * unitRatio);
734 fschmid 485
        heightMSpinBox->getValues(&oldMin, &oldMax, &decimalsOld, &val);
2142 cbradney 486
        heightMSpinBox->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, currDoc->pageHeight * unitRatio);
734 fschmid 487
        topR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 488
        topR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 489
        bottomR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 490
        bottomR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 491
        leftR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 492
        leftR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 493
        rightR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 494
        rightR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
879 fschmid 495
        tabGuides->minorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
496
        tabGuides->minorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
497
        tabGuides->majorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
498
        tabGuides->majorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
499
        tabGuides->snapDistance->getValues(&oldMin, &oldMax, &decimalsOld, &val);
500
        tabGuides->snapDistance->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1195 fschmid 501
        tabGuides->baseGrid->getValues(&oldMin, &oldMax, &decimalsOld, &val);
502
        tabGuides->baseGrid->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
503
        tabGuides->baseOffset->getValues(&oldMin, &oldMax, &decimalsOld, &val);
504
        tabGuides->baseOffset->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1194 fschmid 505
        tabTools->gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
506
        tabTools->gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 507
        topScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 508
        topScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 509
        bottomScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 510
        bottomScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 511
        leftScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 512
        leftScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 513
        rightScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 514
        rightScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1307 fschmid 515
        tabPDF->BleedBottom->getValues(&oldMin, &oldMax, &decimalsOld, &val);
516
        tabPDF->BleedBottom->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
517
        tabPDF->BleedTop->getValues(&oldMin, &oldMax, &decimalsOld, &val);
518
        tabPDF->BleedTop->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
519
        tabPDF->BleedRight->getValues(&oldMin, &oldMax, &decimalsOld, &val);
520
        tabPDF->BleedRight->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
521
        tabPDF->BleedLeft->getValues(&oldMin, &oldMax, &decimalsOld, &val);
522
        tabPDF->BleedLeft->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1790 cbradney 523
        tabPDF->unitRatio = unitRatio;
2142 cbradney 524
        pageWidth = currDoc->pageWidth * unitRatio;
525
        pageHeight = currDoc->pageHeight * unitRatio;
734 fschmid 526
        rightR->setMaxValue(pageWidth - leftR->value());
527
        leftR->setMaxValue(pageWidth - rightR->value());
528
        topR->setMaxValue(pageHeight - bottomR->value());
529
        bottomR->setMaxValue(pageHeight - topR->value());
530
        connect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
531
        connect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
532
        connect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
533
        connect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
534
}
535
 
705 fschmid 536
void ReformDoc::changePaperColor()
537
{
538
        QColor neu = QColor();
539
        neu = QColorDialog::getColor(colorPaper, this);
540
        if (neu.isValid())
541
        {
542
                QPixmap pm = QPixmap(54, 14);
543
                pm.fill(neu);
544
                colorPaper = neu;
545
                backColor->setPixmap(pm);
546
        }
547
}
548
 
693 fschmid 549
void ReformDoc::setTop(int )
36 Franz 550
{
726 fschmid 551
        bottomR->setMaxValue(pageHeight - topR->value());
36 Franz 552
}
3 paul 553
 
693 fschmid 554
void ReformDoc::setBottom(int )
36 Franz 555
{
726 fschmid 556
        topR->setMaxValue(pageHeight - bottomR->value());
36 Franz 557
}
558
 
693 fschmid 559
void ReformDoc::setLeft(int )
36 Franz 560
{
726 fschmid 561
        rightR->setMaxValue(pageWidth - leftR->value());
36 Franz 562
}
563
 
693 fschmid 564
void ReformDoc::setRight(int )
36 Franz 565
{
726 fschmid 566
        leftR->setMaxValue(pageWidth - rightR->value());
36 Franz 567
}
568
 
3 paul 569
void ReformDoc::setDS()
570
{
726 fschmid 571
        if (facingPages->isChecked())
249 Franz 572
        {
340 Franz 573
                Links->setText( tr( "&Inside:" ) );
574
                Rechts->setText( tr( "&Outside:" ) );
726 fschmid 575
                firstPage->setEnabled(true);
249 Franz 576
        }
577
        else
578
        {
340 Franz 579
                Links->setText( tr( "&Left:" ) );
580
                Rechts->setText( tr( "&Right:" ) );
726 fschmid 581
                firstPage->setEnabled(false);
249 Franz 582
        }
348 Franz 583
}
1307 fschmid 584
 
585
void ReformDoc::switchCMS(bool enable)
586
{
587
        tabPDF->enableCMS(enable);
588
}
1694 cbradney 589
 
590
void ReformDoc::setTOCIndexData(QWidget *widgetToShow)
591
{
2246 subik 592
        //Update the attributes list in TOC setup
1694 cbradney 593
        if (widgetToShow==tabTOCIndexPrefs)
594
                tabTOCIndexPrefs->setupItemAttrs( tabDocItemAttributes->getDocAttributesNames() );
595
}