Subversion Repositories Scribus

Rev

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