Subversion Repositories Scribus

Rev

Rev 9528 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
3 paul 7
#include "reformdoc.h"
8521 cbradney 8
//#include "reformdoc.moc"
2965 cbradney 9
 
10
#include <qcolordialog.h>
11
#include <qcursor.h>
12
#include <qspinbox.h>
249 Franz 13
#include <qtooltip.h>
8501 cbradney 14
//Added by qt3to4:
15
#include <QPixmap>
2965 cbradney 16
 
3757 cbradney 17
#include "docsections.h"
788 fschmid 18
#include "tabtypography.h"
2246 subik 19
#include "docinfo.h"
879 fschmid 20
#include "tabguides.h"
1194 fschmid 21
#include "tabtools.h"
1235 fschmid 22
#include "tabcheckdoc.h"
795 fschmid 23
#include "hysettings.h"
24
#include "cmsprefs.h"
806 cbradney 25
#include "units.h"
6070 jghali 26
#include "mpalette.h"
8602 cbradney 27
#include "scrspinbox.h"
838 cbradney 28
#include "scribus.h"
5243 cbradney 29
#include "scribuscore.h"
1307 fschmid 30
#include "tabpdfoptions.h"
1321 fschmid 31
#include "fontprefs.h"
1542 cbradney 32
#include "units.h"
33
#include "pagesize.h"
1641 cbradney 34
#include "docitemattrprefs.h"
1684 cbradney 35
#include "tocindexprefs.h"
2769 fschmid 36
#include "marginWidget.h"
3670 cbradney 37
#include "page.h"
2834 cbradney 38
#include "prefsmanager.h"
2901 fschmid 39
#include "pagelayout.h"
4689 mrdocs 40
#include "colorcombo.h"
2965 cbradney 41
#include "fontcombo.h"
42
#include "linecombo.h"
43
#include "arrowchooser.h"
44
#include "polygonwidget.h"
3252 craig 45
#include "hyphenator.h"
3560 fschmid 46
#include "sccombobox.h"
4546 subik 47
#include "commonstrings.h"
5876 subik 48
#include "tabdisplay.h"
49
#include "tabdocument.h"
788 fschmid 50
 
3 paul 51
extern QPixmap loadIcon(QString nam);
52
 
5890 subik 53
 
1194 fschmid 54
ReformDoc::ReformDoc( QWidget* parent, ScribusDoc* doc ) : PrefsDialogBase( parent )
3 paul 55
{
6201 subik 56
        saveButton->hide();
5512 subik 57
        docUnitIndex = doc->unitIndex();
1694 cbradney 58
        currDoc = doc;
4026 craig 59
        ScMW = (ScribusMainWindow*)parent;
2965 cbradney 60
        unitRatio = doc->unitRatio();
5512 subik 61
        QString ein = unitGetSuffixFromIndex(docUnitIndex);
62
        decimals = unitGetDecimalsFromIndex(docUnitIndex);
5876 subik 63
 
249 Franz 64
        setCaption( tr( "Document Setup" ) );
5876 subik 65
        tabPage = new TabDocument( prefsWidgets, "tab", true );
66
        tabPage->hideReform();
3544 avox 67
        addItem( tr("Document"), loadIcon("scribusdoc.png"), tabPage);
693 fschmid 68
 
2246 subik 69
        docInfos = new DocInfos(prefsWidgets, doc->documentInfo);
2397 cbradney 70
        addItem( tr("Document Information"), loadIcon("documentinfo32.png"), docInfos);
2246 subik 71
 
5512 subik 72
        tabGuides = new TabGuides(prefsWidgets, &doc->guidesSettings, &doc->typographicSettings, docUnitIndex);
2397 cbradney 73
        addItem( tr("Guides"), loadIcon("guides.png"), tabGuides);
693 fschmid 74
 
5876 subik 75
        tabView = new TabDisplay( prefsWidgets, "tabView" );
6337 cbradney 76
        tabView->setDocSetupMode();
715 fschmid 77
        addItem( tr("Display"), loadIcon("screen.png"), tabView);
78
 
2889 cbradney 79
        tabTypo = new TabTypograpy(  prefsWidgets, &doc->typographicSettings);
3544 avox 80
        addItem( tr("Typography"), loadIcon("typography.png"), tabTypo);
715 fschmid 81
 
5512 subik 82
        tabTools = new TabTools(  prefsWidgets, &doc->toolSettings, docUnitIndex, doc);
726 fschmid 83
        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
84
 
4026 craig 85
        tabHyphenator = new HySettings(prefsWidgets, &ScMW->LangTransl);
795 fschmid 86
        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
2246 subik 87
 
5890 subik 88
        tabFonts = new FontPrefs(prefsWidgets, true, PrefsManager::instance()->preferencesLocation(), doc);
1321 fschmid 89
        addItem( tr("Fonts"), loadIcon("font.png"), tabFonts);
1235 fschmid 90
 
1261 fschmid 91
        tabDocChecker = new TabCheckDoc(  prefsWidgets, doc->checkerProfiles, doc->curCheckProfile);
2770 cbradney 92
        addItem( tr("Preflight Verifier"), loadIcon("checkdoc.png"), tabDocChecker);
2246 subik 93
 
4260 craig 94
        tabPDF = new TabPDFOptions( prefsWidgets, doc->PDF_Options, PrefsManager::instance()->appPrefs.AvailFonts,
5243 cbradney 95
                                                                ScCore->PDFXProfiles, doc->UsedFonts, doc->PDF_Options.PresentVals,
5880 jghali 96
                                                                docUnitIndex, doc->pageHeight, doc->pageWidth, doc );
9532 cbradney 97
        addItem( tr("PDF Export"), loadIcon("acroread32.png"), tabPDF);
2246 subik 98
 
1641 cbradney 99
        tabDocItemAttributes = new DocumentItemAttributes( prefsWidgets);
1694 cbradney 100
        docAttributesList=tabDocItemAttributes->getDocAttributesNames();
1641 cbradney 101
        tabDocItemAttributes->setup(&doc->docItemAttributes);
102
        addItem( tr("Document Item Attributes"), loadIcon("docattributes.png"), tabDocItemAttributes);
1235 fschmid 103
 
1684 cbradney 104
        tabTOCIndexPrefs = new TOCIndexPrefs( prefsWidgets );
1701 cbradney 105
        tabTOCIndexPrefs->setupItemAttrs( docAttributesList );
106
        tabTOCIndexPrefs->setup(&(currDoc->docToCSetups), currDoc);
1684 cbradney 107
        addItem( tr("Table of Contents and Indexes"), loadIcon("tabtocindex.png"), tabTOCIndexPrefs);
2246 subik 108
 
3757 cbradney 109
        tabDocSections = new DocSections(prefsWidgets);
3770 cbradney 110
        tabDocSections->setup(currDoc->sections, currDoc->DocPages.count()-1);
3757 cbradney 111
        addItem( tr("Sections"), loadIcon("tabtocindex.png"), tabDocSections);
4546 subik 112
 
800 fschmid 113
        int cmsTab = 0;
5880 jghali 114
        if (ScCore->haveCMS())
795 fschmid 115
        {
5243 cbradney 116
                tabColorManagement = new CMSPrefs(prefsWidgets, &doc->CMSSettings, &ScCore->InputProfiles, &ScCore->InputProfilesCMYK, &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
800 fschmid 117
                cmsTab = addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
795 fschmid 118
        }
119
 
3032 fschmid 120
        setDS(doc->currentPageLayout);
3 paul 121
 
249 Franz 122
        // signals and slots connections
5876 subik 123
        connect(tabPage->docLayout, SIGNAL( selectedLayout(int) ), this, SLOT( setDS(int) ) );
124
        connect(tabPage->unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
1828 fschmid 125
        connect(backToDefaults, SIGNAL(clicked()), this, SLOT(restoreDefaults()));
5502 subik 126
        connect(applyChangesButton, SIGNAL(clicked()), this, SLOT(applyChangesButton_clicked()));
5876 subik 127
        connect(prefsWidgets, SIGNAL(aboutToShow(QWidget *)), this, SLOT(showWidgetInStack(QWidget *)));
731 fschmid 128
 
5880 jghali 129
        if (ScCore->haveCMS())
1307 fschmid 130
        {
800 fschmid 131
                prefsWidgets->raiseWidget(cmsTab);
1307 fschmid 132
                connect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
133
        }
5876 subik 134
 
800 fschmid 135
        arrangeIcons();
693 fschmid 136
        resize( minimumSizeHint() );
8530 subik 137
 
1834 fschmid 138
        prefsSelection->setSelected(prefsSelection->firstItem(), true);
139
        itemSelected(prefsSelection->firstItem());
5876 subik 140
        restoreDefaults();
3 paul 141
}
142
 
1828 fschmid 143
void ReformDoc::restoreDefaults()
144
{
5876 subik 145
        ApplicationPrefs* prefsData=&(PrefsManager::instance()->appPrefs);
6277 fschmid 146
        tabPage->restoreDefaults(currDoc);
8012 cbradney 147
        tabView->restoreDefaults(prefsData, currDoc->guidesSettings, currDoc->pageSets, currDoc->currentPageLayout, currDoc->scratch);
7538 fschmid 148
        tabView->setPaperColor(currDoc->papColor);
6279 fschmid 149
        tabHyphenator->restoreDefaults(currDoc);
5562 subik 150
        tabGuides->restoreDefaults(&currDoc->guidesSettings, &currDoc->typographicSettings, docUnitIndex);
151
        tabTypo->restoreDefaults(&currDoc->typographicSettings);
152
        tabTools->restoreDefaults(&currDoc->toolSettings, docUnitIndex);
153
        tabFonts->restoreDefaults();
154
        tabDocChecker->restoreDefaults(&currDoc->checkerProfiles, currDoc->curCheckProfile);
155
        tabPDF->restoreDefaults(currDoc->PDF_Options, PrefsManager::instance()->appPrefs.AvailFonts,
156
                                                        ScCore->PDFXProfiles, currDoc->UsedFonts, currDoc->PDF_Options.PresentVals,
5880 jghali 157
                                                        docUnitIndex, currDoc->pageHeight, currDoc->pageWidth, currDoc, false);
9528 avox 158
        if (ScCore->haveCMS())
159
                tabColorManagement->restoreDefaults(&currDoc->CMSSettings, &ScCore->InputProfiles,
5711 subik 160
                                                                                 &ScCore->InputProfilesCMYK,
161
                                                                                 &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
5562 subik 162
        docInfos->restoreDefaults();
5876 subik 163
 
164
        unitChange();
1828 fschmid 165
}
166
 
734 fschmid 167
void ReformDoc::unitChange()
168
{
1790 cbradney 169
        double oldUnitRatio = unitRatio;
5876 subik 170
        docUnitIndex = tabPage->unitCombo->currentItem();
171
        unitRatio = unitGetRatioFromIndex(docUnitIndex);
172
        int decimals = unitGetDecimalsFromIndex(docUnitIndex);
173
        QString suffix = unitGetSuffixFromIndex(docUnitIndex);
1790 cbradney 174
        double invUnitConversion = 1.0 / oldUnitRatio * unitRatio;
5876 subik 175
        tabPage->unitChange();
176
        tabGuides->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
177
        tabView->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
178
        tabTools->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
179
        tabPDF->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
734 fschmid 180
}
181
 
2901 fschmid 182
void ReformDoc::setDS(int layout)
3 paul 183
{
5876 subik 184
        tabPage->marginGroup->setFacingPages(!(layout == singlePage));
5890 subik 185
        tabPage->choosenLayout = layout;
186
        tabPage->docLayout->firstPage->setCurrentItem(currDoc->pageSets[tabPage->choosenLayout].FirstPage);
187
        tabView->gapHorizontal->setValue(currDoc->pageSets[tabPage->choosenLayout].GapHorizontal * unitRatio);
188
        tabView->gapVertical->setValue(currDoc->pageSets[tabPage->choosenLayout].GapBelow * unitRatio);
348 Franz 189
}
1307 fschmid 190
 
191
void ReformDoc::switchCMS(bool enable)
192
{
193
        tabPDF->enableCMS(enable);
194
}
1694 cbradney 195
 
5876 subik 196
void ReformDoc::showWidgetInStack(QWidget *widgetToShow)
1694 cbradney 197
{
2246 subik 198
        //Update the attributes list in TOC setup
1694 cbradney 199
        if (widgetToShow==tabTOCIndexPrefs)
200
                tabTOCIndexPrefs->setupItemAttrs( tabDocItemAttributes->getDocAttributesNames() );
5876 subik 201
        if (widgetToShow == tabTools)
202
                tabTools->enableFontPreview(true);
1694 cbradney 203
}
2965 cbradney 204
 
205
const int ReformDoc::getSelectedUnit()
206
{
5876 subik 207
        return tabPage->unitCombo->currentItem();
2965 cbradney 208
}
209
 
210
const bool ReformDoc::colorManagementSettingsChanged()
211
{
9528 avox 212
        return ScCore->haveCMS() && tabColorManagement->changed;
2965 cbradney 213
}
214
 
215
const bool ReformDoc::imageResolutionChanged()
216
{
217
        return viewToRecalcPictureRes;
218
}
219
 
220
void ReformDoc::updateDocumentSettings()
221
{
222
        double tpr2, lr2, rr2, br2;
5876 subik 223
        tpr2 = tabPage->marginGroup->top();
224
        br2 = tabPage->marginGroup->bottom();
225
        lr2 = tabPage->marginGroup->left();
226
        rr2 = tabPage->marginGroup->right();
5890 subik 227
        int fp = tabPage->choosenLayout;
5876 subik 228
        currDoc->pageSets[fp].FirstPage = tabPage->docLayout->firstPage->currentItem();
229
        currDoc->pageSets[fp].GapHorizontal = tabView->gapHorizontal->value() / currDoc->unitRatio();
230
        currDoc->pageSets[fp].GapBelow = tabView->gapVertical->value() / currDoc->unitRatio();
3796 cbradney 231
        //currDoc->FirstPnum = pageNumber->value();
2965 cbradney 232
        currDoc->resetPage(tpr2, lr2, rr2, br2, fp);
5876 subik 233
        currDoc->PageOri = tabPage->pageOrientationComboBox->currentItem();
5890 subik 234
        currDoc->m_pageSize = tabPage->prefsPageSizeName;
5876 subik 235
        currDoc->pageWidth = tabPage->pageW;
236
        currDoc->pageHeight = tabPage->pageH;
8012 cbradney 237
        double TopD = tabView->topScratch->value() / currDoc->unitRatio() - currDoc->scratch.Top;
238
        double LeftD = tabView->leftScratch->value() / currDoc->unitRatio() - currDoc->scratch.Left;
239
        currDoc->scratch.Bottom = tabView->bottomScratch->value() / currDoc->unitRatio();
240
        currDoc->scratch.Left = tabView->leftScratch->value() / currDoc->unitRatio();
241
        currDoc->scratch.Right = tabView->rightScratch->value() / currDoc->unitRatio();
242
        currDoc->scratch.Top = tabView->topScratch->value() / currDoc->unitRatio();
7225 cbradney 243
        currDoc->bleeds.Bottom = tabPage->marginGroup->bottomBleed();
244
        currDoc->bleeds.Top = tabPage->marginGroup->topBleed();
245
        currDoc->bleeds.Left = tabPage->marginGroup->leftBleed();
246
        currDoc->bleeds.Right = tabPage->marginGroup->rightBleed();
3724 cbradney 247
        for (uint p = 0; p < currDoc->Pages->count(); ++p)
2965 cbradney 248
        {
3724 cbradney 249
                Page *pp = currDoc->Pages->at(p);
5876 subik 250
                if (tabPage->sizeAllPages->isChecked())
2965 cbradney 251
                {
3200 cbradney 252
                        pp->setInitialWidth(currDoc->pageWidth);
253
                        pp->setInitialHeight(currDoc->pageHeight);
6277 fschmid 254
                        pp->setHeight(currDoc->pageHeight);
255
                        pp->setWidth(currDoc->pageWidth);
256
                        pp->m_pageSize = currDoc->m_pageSize;
257
                        pp->PageOri = currDoc->PageOri;
2965 cbradney 258
                }
5876 subik 259
                if (tabPage->marginGroup->getMarginsForAllPages())
2965 cbradney 260
                {
261
                        pp->initialMargins.Left = lr2;
262
                        pp->initialMargins.Right = rr2;
263
                        pp->initialMargins.Top = tpr2;
264
                        pp->initialMargins.Bottom = br2;
265
                }
266
        }
267
        for (uint p = 0; p < currDoc->MasterPages.count(); ++p)
268
        {
269
                Page *pp = currDoc->MasterPages.at(p);
6332 fschmid 270
                if (tabPage->sizeAllMasterPages->isChecked())
2965 cbradney 271
                {
3200 cbradney 272
                        pp->setInitialWidth(currDoc->pageWidth);
273
                        pp->setInitialHeight(currDoc->pageHeight);
6277 fschmid 274
                        pp->setHeight(currDoc->pageHeight);
275
                        pp->setWidth(currDoc->pageWidth);
276
                        pp->m_pageSize = currDoc->m_pageSize;
277
                        pp->PageOri = currDoc->PageOri;
2965 cbradney 278
                }
6332 fschmid 279
                if (tabPage->marginGroup->getMarginsForAllMasterPages())
2965 cbradney 280
                {
281
                        pp->initialMargins.Left = lr2;
282
                        pp->initialMargins.Right = rr2;
283
                        pp->initialMargins.Top = tpr2;
284
                        pp->initialMargins.Bottom = br2;
285
                }
8012 cbradney 286
                pp->setXOffset(currDoc->scratch.Left);
287
                pp->setYOffset(currDoc->scratch.Top);
2965 cbradney 288
        }
4364 fschmid 289
        uint docItemsCount = currDoc->MasterItems.count();
290
        for (uint ite = 0; ite < docItemsCount; ++ite)
291
        {
292
                PageItem *item = currDoc->MasterItems.at(ite);
293
                item->moveBy(LeftD, TopD);
294
                item->setRedrawBounding();
295
        }
2965 cbradney 296
        currDoc->guidesSettings.before = tabGuides->inBackground->isChecked();
5876 subik 297
        currDoc->marginColored = tabView->checkUnprintable->isChecked();
5890 subik 298
        currDoc->papColor = tabView->colorPaper;
2965 cbradney 299
        currDoc->guidesSettings.marginsShown = tabGuides->marginBox->isChecked();
7051 fschmid 300
        currDoc->guidesSettings.showBleed = tabView->checkBleed->isChecked();
5876 subik 301
        currDoc->guidesSettings.framesShown = tabView->checkFrame->isChecked();
302
        currDoc->guidesSettings.layerMarkersShown = tabView->checkLayerM->isChecked();
2965 cbradney 303
        currDoc->guidesSettings.gridShown = tabGuides->checkGrid->isChecked();
304
        currDoc->guidesSettings.guidesShown = tabGuides->guideBox->isChecked();
305
        currDoc->guidesSettings.baseShown = tabGuides->baselineBox->isChecked();
5876 subik 306
        currDoc->guidesSettings.showPic = tabView->checkPictures->isChecked();
307
        currDoc->guidesSettings.linkShown = tabView->checkLink->isChecked();
308
        currDoc->guidesSettings.showControls = tabView->checkControl->isChecked();
309
        currDoc->guidesSettings.rulerMode = tabView->checkRuler->isChecked();
2965 cbradney 310
        currDoc->guidesSettings.grabRad = tabGuides->grabDistance->value();
7417 fschmid 311
        currDoc->guidesSettings.guideRad = tabGuides->snapDistance->value();
2965 cbradney 312
        currDoc->guidesSettings.minorGrid = tabGuides->minorSpace->value() / currDoc->unitRatio();
313
        currDoc->guidesSettings.majorGrid = tabGuides->majorSpace->value() / currDoc->unitRatio();
314
        currDoc->guidesSettings.minorColor = tabGuides->colorMinorGrid;
315
        currDoc->guidesSettings.majorColor = tabGuides->colorMajorGrid;
316
        currDoc->guidesSettings.margColor = tabGuides->colorMargin;
317
        currDoc->guidesSettings.guideColor = tabGuides->colorGuides;
318
        currDoc->guidesSettings.baseColor = tabGuides->colorBaselineGrid;
319
        currDoc->checkerProfiles = tabDocChecker->checkerProfile;
320
        currDoc->curCheckProfile = tabDocChecker->curCheckProfile->currentText();
321
        currDoc->typographicSettings.valueSuperScript = tabTypo->superDisplacement->value();
322
        currDoc->typographicSettings.scalingSuperScript = tabTypo->superScaling->value();
323
        currDoc->typographicSettings.valueSubScript = tabTypo->subDisplacement->value();
324
        currDoc->typographicSettings.scalingSubScript = tabTypo->subScaling->value();
325
        currDoc->typographicSettings.valueSmallCaps = tabTypo->capsScaling->value();
326
        currDoc->typographicSettings.autoLineSpacing = tabTypo->autoLine->value();
327
        currDoc->typographicSettings.valueBaseGrid = tabGuides->baseGrid->value() / currDoc->unitRatio();
328
        currDoc->typographicSettings.offsetBaseGrid = tabGuides->baseOffset->value() / currDoc->unitRatio();
329
        currDoc->typographicSettings.valueUnderlinePos = qRound(tabTypo->underlinePos->value() * 10);
330
        currDoc->typographicSettings.valueUnderlineWidth = qRound(tabTypo->underlineWidth->value() * 10);
331
        currDoc->typographicSettings.valueStrikeThruPos = qRound(tabTypo->strikethruPos->value() * 10);
332
        currDoc->typographicSettings.valueStrikeThruWidth = qRound(tabTypo->strikethruWidth->value() * 10);
333
        currDoc->toolSettings.defFont = tabTools->fontComboText->currentText();
334
        currDoc->toolSettings.defSize = tabTools->sizeComboText->currentText().left(2).toInt() * 10;
335
        currDoc->toolSettings.dStrokeText = tabTools->colorComboStrokeText->currentText();
336
        switch (tabTools->tabFillCombo->currentItem())
337
        {
338
                case 0:
339
                        currDoc->toolSettings.tabFillChar = "";
340
                        break;
341
                case 1:
342
                        currDoc->toolSettings.tabFillChar = ".";
343
                        break;
344
                case 2:
345
                        currDoc->toolSettings.tabFillChar = "-";
346
                        break;
347
                case 3:
348
                        currDoc->toolSettings.tabFillChar = "_";
349
                        break;
350
                case 4:
351
                        currDoc->toolSettings.tabFillChar = tabTools->tabFillCombo->currentText().right(1);
352
                        break;
353
        }
8439 cbradney 354
        if (currDoc->toolSettings.dStrokeText == CommonStrings::tr_NoneColor)
4546 subik 355
                currDoc->toolSettings.dStrokeText = CommonStrings::None;
2965 cbradney 356
        currDoc->toolSettings.dPenText = tabTools->colorComboText->currentText();
8439 cbradney 357
        if (currDoc->toolSettings.dPenText == CommonStrings::tr_NoneColor)
4546 subik 358
                currDoc->toolSettings.dPenText = CommonStrings::None;
3093 fschmid 359
        currDoc->toolSettings.dTextBackGround = tabTools->colorComboTextBackground->currentText();
8439 cbradney 360
        if (currDoc->toolSettings.dTextBackGround == CommonStrings::tr_NoneColor)
4546 subik 361
                currDoc->toolSettings.dTextBackGround = CommonStrings::None;
3093 fschmid 362
        currDoc->toolSettings.dTextLineColor = tabTools->colorComboTextLine->currentText();
8439 cbradney 363
        if (currDoc->toolSettings.dTextLineColor == CommonStrings::tr_NoneColor)
4546 subik 364
                currDoc->toolSettings.dTextLineColor = CommonStrings::None;
3093 fschmid 365
        currDoc->toolSettings.dTextBackGroundShade = tabTools->shadingTextBack->value();
366
        currDoc->toolSettings.dTextLineShade = tabTools->shadingTextLine->value();
367
        currDoc->toolSettings.dTextPenShade = tabTools->shadingText->value();
368
        currDoc->toolSettings.dTextStrokeShade = tabTools->shadingTextStroke->value();
2965 cbradney 369
        currDoc->toolSettings.dCols = tabTools->columnsText->value();
370
        currDoc->toolSettings.dGap = tabTools->gapText->value() / currDoc->unitRatio();
371
        currDoc->toolSettings.dTabWidth = tabTools->gapTab->value() / currDoc->unitRatio();
372
        currDoc->toolSettings.dPen = tabTools->colorComboLineShape->currentText();
8439 cbradney 373
        if (currDoc->toolSettings.dPen == CommonStrings::tr_NoneColor)
4546 subik 374
                currDoc->toolSettings.dPen = CommonStrings::None;
2965 cbradney 375
        currDoc->toolSettings.dBrush = tabTools->comboFillShape->currentText();
8439 cbradney 376
        if (currDoc->toolSettings.dBrush == CommonStrings::tr_NoneColor)
4546 subik 377
                currDoc->toolSettings.dBrush = CommonStrings::None;
2965 cbradney 378
        currDoc->toolSettings.dShade = tabTools->shadingFillShape->value();
379
        currDoc->toolSettings.dShade2 = tabTools->shadingLineShape->value();
380
        switch (tabTools->comboStyleShape->currentItem())
381
        {
382
        case 0:
8522 cbradney 383
                currDoc->toolSettings.dLineArt = Qt::SolidLine;
2965 cbradney 384
                break;
385
        case 1:
8522 cbradney 386
                currDoc->toolSettings.dLineArt = Qt::DashLine;
2965 cbradney 387
                break;
388
        case 2:
8522 cbradney 389
                currDoc->toolSettings.dLineArt = Qt::DotLine;
2965 cbradney 390
                break;
391
        case 3:
8522 cbradney 392
                currDoc->toolSettings.dLineArt = Qt::DashDotLine;
2965 cbradney 393
                break;
394
        case 4:
8522 cbradney 395
                currDoc->toolSettings.dLineArt = Qt::DashDotDotLine;
2965 cbradney 396
                break;
397
        }
398
        currDoc->toolSettings.dWidth = tabTools->lineWidthShape->value();
399
        currDoc->toolSettings.dStartArrow = tabTools->startArrow->currentItem();
400
        currDoc->toolSettings.dEndArrow = tabTools->endArrow->currentItem();
401
        currDoc->toolSettings.magMin = tabTools->minimumZoom->value();
402
        currDoc->toolSettings.magMax = tabTools->maximumZoom->value();
403
        currDoc->toolSettings.magStep = tabTools->zoomStep->value();
404
        currDoc->toolSettings.dPenLine = tabTools->colorComboLine->currentText();
8439 cbradney 405
        if (currDoc->toolSettings.dPenLine == CommonStrings::tr_NoneColor)
4546 subik 406
                currDoc->toolSettings.dPenLine = CommonStrings::None;
2965 cbradney 407
        currDoc->toolSettings.dShadeLine = tabTools->shadingLine->value();
408
        switch (tabTools->comboStyleLine->currentItem())
409
        {
410
        case 0:
8522 cbradney 411
                currDoc->toolSettings.dLstyleLine = Qt::SolidLine;
2965 cbradney 412
                break;
413
        case 1:
8522 cbradney 414
                currDoc->toolSettings.dLstyleLine = Qt::DashLine;
2965 cbradney 415
                break;
416
        case 2:
8522 cbradney 417
                currDoc->toolSettings.dLstyleLine = Qt::DotLine;
2965 cbradney 418
                break;
419
        case 3:
8522 cbradney 420
                currDoc->toolSettings.dLstyleLine = Qt::DashDotLine;
2965 cbradney 421
                break;
422
        case 4:
8522 cbradney 423
                currDoc->toolSettings.dLstyleLine = Qt::DashDotDotLine;
2965 cbradney 424
                break;
425
        }
426
        currDoc->toolSettings.dWidthLine = tabTools->lineWidthLine->value();
427
        currDoc->toolSettings.dBrushPict = tabTools->comboFillImage->currentText();
8439 cbradney 428
        if (currDoc->toolSettings.dBrushPict == CommonStrings::tr_NoneColor)
4546 subik 429
                currDoc->toolSettings.dBrushPict = CommonStrings::None;
2965 cbradney 430
        currDoc->toolSettings.shadePict = tabTools->shadingFillImage->value();
431
        currDoc->toolSettings.scaleX = static_cast<double>(tabTools->scalingHorizontal->value()) / 100.0;
432
        currDoc->toolSettings.scaleY = static_cast<double>(tabTools->scalingVertical->value()) / 100.0;
433
        currDoc->toolSettings.scaleType = tabTools->buttonGroup3->isChecked();
434
        currDoc->toolSettings.aspectRatio = tabTools->checkRatioImage->isChecked();
435
        currDoc->toolSettings.useEmbeddedPath = tabTools->embeddedPath->isChecked();
436
        int haRes = 0;
437
        if (tabTools->checkFullRes->isChecked())
438
                haRes = 0;
439
        if (tabTools->checkNormalRes->isChecked())
440
                haRes = 1;
441
        if (tabTools->checkHalfRes->isChecked())
442
                haRes = 2;
443
        if (currDoc->toolSettings.lowResType != haRes)
444
        {
445
                currDoc->toolSettings.lowResType = haRes;
446
                viewToRecalcPictureRes=true;
447
        }
448
        else
449
                viewToRecalcPictureRes=false;
6606 fschmid 450
        currDoc->toolSettings.dispX = tabTools->genDispX->value();
451
        currDoc->toolSettings.dispY = tabTools->genDispY->value();
6618 fschmid 452
        currDoc->toolSettings.constrain = tabTools->genRot->value();
2965 cbradney 453
        tabTools->polyWidget->getValues(&currDoc->toolSettings.polyC, &currDoc->toolSettings.polyFd, &currDoc->toolSettings.polyF, &currDoc->toolSettings.polyS, &currDoc->toolSettings.polyR);
5876 subik 454
        currDoc->AutoSave = tabPage->GroupAS->isChecked();
455
        currDoc->AutoSaveTime = tabPage->ASTime->value() * 60 * 1000;
2965 cbradney 456
        if (currDoc->AutoSave)
457
        {
458
                currDoc->autoSaveTimer->stop();
459
                currDoc->autoSaveTimer->start(currDoc->AutoSaveTime);
460
        }
6934 avox 461
/*      FIXME: scribus determines dict by charstyle now, so this setting should go into the doc's default charstyle
462
                currDoc->docHyphenator->slotNewDict(ScMW->GetLang(tabHyphenator->language->currentText()));
463
*/
2965 cbradney 464
        currDoc->docHyphenator->slotNewSettings(tabHyphenator->wordLen->value(),
465
                                                                                                                                !tabHyphenator->verbose->isChecked(),
466
                                                                                                                                tabHyphenator->input->isChecked(),
467
                                                                                                                                tabHyphenator->maxCount->value());
5880 jghali 468
        if (ScCore->haveCMS())
2965 cbradney 469
        {
3051 fschmid 470
                bool oldCM = currDoc->CMSSettings.CMSinUse;
6070 jghali 471
                tabColorManagement->updateDocSettings(currDoc);
2965 cbradney 472
                if (tabColorManagement->changed)
473
                {
5781 cbradney 474
                        ScMW->setStatusBarInfoText( tr("Adjusting Colors"));
4026 craig 475
                        ScMW->mainWindowProgressBar->reset();
3841 cbradney 476
                        int cc = currDoc->PageColors.count() + currDoc->Items->count();
4026 craig 477
                        ScMW->mainWindowProgressBar->setTotalSteps(cc);
2965 cbradney 478
                        currDoc->HasCMS = currDoc->CMSSettings.CMSinUse;
479
                        currDoc->SoftProofing = currDoc->CMSSettings.SoftProofOn;
480
                        currDoc->Gamut = currDoc->CMSSettings.GamutCheck;
5345 mrdocs 481
                        currDoc->IntentColors = currDoc->CMSSettings.DefaultIntentColors;
482
                        currDoc->IntentImages = currDoc->CMSSettings.DefaultIntentImages;
9380 fschmid 483
                        qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
3051 fschmid 484
                        bool newCM = currDoc->CMSSettings.CMSinUse;
485
                        currDoc->CMSSettings.CMSinUse = oldCM;
2965 cbradney 486
                        currDoc->CloseCMSProfiles();
3051 fschmid 487
                        currDoc->CMSSettings.CMSinUse = newCM;
6070 jghali 488
                        if (!currDoc->CMSSettings.CMSinUse)
5178 mrdocs 489
                        {
6070 jghali 490
                                currDoc->HasCMS = false;
491
                                if      (oldCM)
492
                                {
493
                                        ScMW->recalcColors(ScMW->mainWindowProgressBar);
494
                                        currDoc->RecalcPictures(&ScCore->InputProfiles, &ScCore->InputProfilesCMYK, ScMW->mainWindowProgressBar);
495
                                }
496
                        }
497
                        else if ( currDoc->OpenCMSProfiles(ScCore->InputProfiles, ScCore->InputProfilesCMYK, ScCore->MonitorProfiles, ScCore->PrinterProfiles) )
498
                        {
5880 jghali 499
                                currDoc->HasCMS = true;
5178 mrdocs 500
                                currDoc->PDF_Options.SComp = currDoc->CMSSettings.ComponentsInput2;
5345 mrdocs 501
                                currDoc->PDF_Options.SolidProf = currDoc->CMSSettings.DefaultSolidColorRGBProfile;
5178 mrdocs 502
                                currDoc->PDF_Options.ImageProf = currDoc->CMSSettings.DefaultImageRGBProfile;
503
                                currDoc->PDF_Options.PrintProf = currDoc->CMSSettings.DefaultPrinterProfile;
5345 mrdocs 504
                                currDoc->PDF_Options.Intent = currDoc->CMSSettings.DefaultIntentColors;
5178 mrdocs 505
                                ScMW->recalcColors(ScMW->mainWindowProgressBar);
5243 cbradney 506
                                currDoc->RecalcPictures(&ScCore->InputProfiles, &ScCore->InputProfilesCMYK, ScMW->mainWindowProgressBar);
5178 mrdocs 507
                        }
508
                        else
509
                                currDoc->HasCMS = false;
4026 craig 510
                        ScMW->mainWindowProgressBar->setProgress(cc);
9380 fschmid 511
                        qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
5781 cbradney 512
                        ScMW->setStatusBarInfoText("");
4026 craig 513
                        ScMW->mainWindowProgressBar->reset();
2965 cbradney 514
                }
515
        }
516
        PrefsManager* prefsManager=PrefsManager::instance();
517
        SCFontsIterator it(prefsManager->appPrefs.AvailFonts);
5980 avox 518
        for ( ; it.hasNext() ; it.next())
2965 cbradney 519
        {
5980 avox 520
                it.current().embedPs(tabFonts->fontFlags[it.currentKey()].FlagPS);
521
                it.current().usable(tabFonts->fontFlags[it.currentKey()].FlagUse);
522
                it.current().subset(tabFonts->fontFlags[it.currentKey()].FlagSub);
2965 cbradney 523
        }
524
        uint a = 0;
525
        prefsManager->appPrefs.GFontSub.clear();
526
        QMap<QString,QString>::Iterator itfsu;
527
        QMap<QString,QString>::Iterator itfsuend=tabFonts->RList.end();
528
        for (itfsu = tabFonts->RList.begin(); itfsu != itfsuend; ++itfsu)
529
                prefsManager->appPrefs.GFontSub[itfsu.key()] = tabFonts->FlagsRepl.at(a++)->currentText();
530
        QStringList uf = currDoc->UsedFonts.keys();
3544 avox 531
        QMap<QString,int>::Iterator it3;
5559 avox 532
//      for (it3 = currDoc->UsedFonts.begin(); it3 != currDoc->UsedFonts.end(); ++it3)
533
//              FT_Done_Face(currDoc->FFonts[it3.key()]);
2965 cbradney 534
        currDoc->UsedFonts.clear();
535
        QStringList::Iterator it3a;
536
        QStringList::Iterator it3aend=uf.end();
537
        for (it3a = uf.begin(); it3a != it3aend; ++it3a)
3544 avox 538
                currDoc->AddFont(*it3a);
2965 cbradney 539
 
540
        currDoc->PDF_Options.Thumbnails = tabPDF->CheckBox1->isChecked();
541
        currDoc->PDF_Options.Compress = tabPDF->Compression->isChecked();
542
        currDoc->PDF_Options.CompressMethod = tabPDF->CMethod->currentItem();
543
        currDoc->PDF_Options.Quality = tabPDF->CQuality->currentItem();
544
        currDoc->PDF_Options.Resolution = tabPDF->Resolution->value();
545
        currDoc->PDF_Options.RecalcPic = tabPDF->DSColor->isChecked();
546
        currDoc->PDF_Options.PicRes = tabPDF->ValC->value();
547
        currDoc->PDF_Options.Bookmarks = tabPDF->CheckBM->isChecked();
548
        currDoc->PDF_Options.Binding = tabPDF->ComboBind->currentItem();
549
        currDoc->PDF_Options.MirrorH = tabPDF->MirrorH->isOn();
550
        currDoc->PDF_Options.MirrorV = tabPDF->MirrorV->isOn();
551
        currDoc->PDF_Options.RotateDeg = tabPDF->RotateDeg->currentItem() * 90;
552
        currDoc->PDF_Options.Articles = tabPDF->Article->isChecked();
553
        currDoc->PDF_Options.Encrypt = tabPDF->Encry->isChecked();
554
        currDoc->PDF_Options.UseLPI = tabPDF->UseLPI->isChecked();
555
        currDoc->PDF_Options.useLayers = tabPDF->useLayers->isChecked();
3079 fschmid 556
        currDoc->PDF_Options.UseSpotColors = !tabPDF->useSpot->isChecked();
5320 fschmid 557
        currDoc->PDF_Options.doOverprint = tabPDF->overprintMode->isChecked();
3079 fschmid 558
        currDoc->PDF_Options.doMultiFile = false;
7225 cbradney 559
        currDoc->PDF_Options.bleeds.Bottom = tabPDF->BleedBottom->value() / currDoc->unitRatio();
560
        currDoc->PDF_Options.bleeds.Top = tabPDF->BleedTop->value() / currDoc->unitRatio();
561
        currDoc->PDF_Options.bleeds.Left = tabPDF->BleedLeft->value() / currDoc->unitRatio();
562
        currDoc->PDF_Options.bleeds.Right = tabPDF->BleedRight->value() / currDoc->unitRatio();
4649 fschmid 563
        currDoc->PDF_Options.doClip = tabPDF->ClipMarg->isChecked();
4256 craig 564
        /* DISABLED CR 2006-12-07 Work around #2964
4197 fschmid 565
        currDoc->PDF_Options.displayBookmarks = tabPDF->useBookmarks->isChecked();
566
        currDoc->PDF_Options.displayFullscreen = tabPDF->useFullScreen->isChecked();
567
        currDoc->PDF_Options.displayLayers = tabPDF->useLayers2->isChecked();
568
        currDoc->PDF_Options.displayThumbs = tabPDF->useThumbnails->isChecked();
569
        int pgl = PDFOptions::SinglePage;
570
        if (tabPDF->singlePage->isChecked())
571
                pgl = PDFOptions::SinglePage;
572
        else if (tabPDF->continuousPages->isChecked())
573
                pgl = PDFOptions::OneColumn;
574
        else if (tabPDF->doublePageLeft->isChecked())
575
                pgl = PDFOptions::TwoColumnLeft;
576
        else if (tabPDF->doublePageRight->isChecked())
577
                pgl = PDFOptions::TwoColumnRight;
578
        currDoc->PDF_Options.PageLayout = pgl;
4256 craig 579
        */
4197 fschmid 580
        currDoc->PDF_Options.openAction = "";
2965 cbradney 581
        if (tabPDF->Encry->isChecked())
582
        {
583
                int Perm = -64;
584
                if (tabPDF->PDFVersionCombo->currentItem() == 1)
585
                        Perm &= ~0x00240000;
586
                if (tabPDF->PrintSec->isChecked())
587
                        Perm += 4;
588
                if (tabPDF->ModifySec->isChecked())
589
                        Perm += 8;
590
                if (tabPDF->CopySec->isChecked())
591
                        Perm += 16;
592
                if (tabPDF->AddSec->isChecked())
593
                        Perm += 32;
594
                currDoc->PDF_Options.Permissions = Perm;
595
                currDoc->PDF_Options.PassOwner = tabPDF->PassOwner->text();
596
                currDoc->PDF_Options.PassUser = tabPDF->PassUser->text();
597
        }
598
        if (tabPDF->PDFVersionCombo->currentItem() == 0)
599
                currDoc->PDF_Options.Version = PDFOptions::PDFVersion_13;
600
        if (tabPDF->PDFVersionCombo->currentItem() == 1)
601
                currDoc->PDF_Options.Version = PDFOptions::PDFVersion_14;
602
        if (tabPDF->PDFVersionCombo->currentItem() == 2)
603
                currDoc->PDF_Options.Version = PDFOptions::PDFVersion_15;
604
        if (tabPDF->PDFVersionCombo->currentItem() == 3)
605
                currDoc->PDF_Options.Version = PDFOptions::PDFVersion_X3;
606
        if (tabPDF->OutCombo->currentItem() == 0)
607
        {
608
                currDoc->PDF_Options.isGrayscale = false;
609
                currDoc->PDF_Options.UseRGB = true;
610
                currDoc->PDF_Options.UseProfiles = false;
611
                currDoc->PDF_Options.UseProfiles2 = false;
612
        }
613
        else
614
        {
615
                if (tabPDF->OutCombo->currentItem() == 3)
616
                {
617
                        currDoc->PDF_Options.isGrayscale = true;
618
                        currDoc->PDF_Options.UseRGB = false;
619
                        currDoc->PDF_Options.UseProfiles = false;
620
                        currDoc->PDF_Options.UseProfiles2 = false;
621
                }
622
                else
623
                {
624
                        currDoc->PDF_Options.isGrayscale = false;
625
                        currDoc->PDF_Options.UseRGB = false;
5880 jghali 626
                        if (currDoc->HasCMS)
2965 cbradney 627
                        {
628
                                currDoc->PDF_Options.UseProfiles = tabPDF->EmbedProfs->isChecked();
629
                                currDoc->PDF_Options.UseProfiles2 = tabPDF->EmbedProfs2->isChecked();
630
                                currDoc->PDF_Options.Intent = tabPDF->IntendS->currentItem();
631
                                currDoc->PDF_Options.Intent2 = tabPDF->IntendI->currentItem();
632
                                currDoc->PDF_Options.EmbeddedI = tabPDF->NoEmbedded->isChecked();
633
                                currDoc->PDF_Options.SolidProf = tabPDF->SolidPr->currentText();
634
                                currDoc->PDF_Options.ImageProf = tabPDF->ImageP->currentText();
635
                                currDoc->PDF_Options.PrintProf = tabPDF->PrintProfC->currentText();
636
                        }
637
                }
638
        }
639
 
640
        currDoc->documentInfo = docInfos->getDocInfo();
641
        currDoc->docItemAttributes = *(tabDocItemAttributes->getNewAttributes());
642
        currDoc->docToCSetups = *(tabTOCIndexPrefs->getNewToCs());
3757 cbradney 643
        currDoc->sections = tabDocSections->getNewSections();
2965 cbradney 644
 
3727 cbradney 645
        uint itemCount=currDoc->Items->count();
2965 cbradney 646
        for (uint b=0; b<itemCount; ++b)
647
        {
3727 cbradney 648
                if (currDoc->Items->at(b)->itemType() == PageItem::ImageFrame)
4492 cbradney 649
                        currDoc->Items->at(b)->setImageShown(currDoc->guidesSettings.showPic);
2965 cbradney 650
        }
651
}
5502 subik 652
 
653
void ReformDoc::applyChangesButton_clicked()
654
{
655
        ScMW->docSetup(this);
656
}