Subversion Repositories Scribus

Rev

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