Subversion Repositories Scribus

Rev

Rev 1194 | Rev 1235 | 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"
795 fschmid 9
#include "hysettings.h"
10
#include "cmsprefs.h"
806 cbradney 11
#include "units.h"
838 cbradney 12
#include "mspinbox.h"
13
#include "scribus.h"
788 fschmid 14
 
3 paul 15
extern QPixmap loadIcon(QString nam);
80 Franz 16
extern double UmReFaktor;
795 fschmid 17
extern bool CMSavail;
18
extern ProfilesL InputProfiles;
3 paul 19
 
1194 fschmid 20
ReformDoc::ReformDoc( QWidget* parent, ScribusDoc* doc ) : PrefsDialogBase( parent )
3 paul 21
{
1065 cbradney 22
        einheit = doc->docUnitIndex;
734 fschmid 23
        docc = doc;
795 fschmid 24
        ap = (ScribusApp*)parent;
734 fschmid 25
        Umrech = UmReFaktor;
1065 cbradney 26
        QString ein = unitGetSuffixFromIndex(doc->docUnitIndex);
27
        decimals = unitGetDecimalsFromIndex(doc->docUnitIndex);
519 cbradney 28
        int i=-1;
726 fschmid 29
        pageWidth = doc->PageB * UmReFaktor;
30
        pageHeight = doc->PageH * UmReFaktor;
249 Franz 31
        setCaption( tr( "Document Setup" ) );
693 fschmid 32
        tabPage = new QWidget( prefsWidgets, "tab" );
788 fschmid 33
        reformDocLayout = new QVBoxLayout( tabPage );
34
        reformDocLayout->setSpacing( 6 );
35
        reformDocLayout->setMargin( 10 );
693 fschmid 36
        dsGroupBox7 = new QGroupBox( tabPage, "GroupBox7" );
519 cbradney 37
        dsGroupBox7->setTitle( tr( "Page Size" ) );
38
        dsGroupBox7->setColumnLayout(0, Qt::Vertical );
39
        dsGroupBox7->layout()->setSpacing( 0 );
40
        dsGroupBox7->layout()->setMargin( 0 );
41
        dsGroupBox7Layout = new QHBoxLayout( dsGroupBox7->layout() );
42
        dsGroupBox7Layout->setAlignment( Qt::AlignTop );
43
        dsGroupBox7Layout->setSpacing( 0 );
44
        dsGroupBox7Layout->setMargin( 10 );
45
        dsLayout4 = new QGridLayout;
46
        dsLayout4->setSpacing( 6 );
47
        dsLayout4->setMargin( 0 );
693 fschmid 48
        sizeQComboBox = new QComboBox( true, dsGroupBox7, "sizeQComboBox" );
49
        sizeQLabel = new QLabel( sizeQComboBox, tr( "&Size:" ), dsGroupBox7, "sizeQLabel" );
50
        QString sizelist[] = {"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "B0", "B1", "B2", "B3", "B4",
51
                              "B5", "B6", "B7", "B8", "B9", "B10", "C5E", "Comm10E", "DLE", "Executive", "Folio",
52
                              "Ledger", tr("Legal"), tr("Letter"), tr("Tabloid"), tr("Custom")};
53
        size_t const num_mappings = (sizeof sizelist)/(sizeof *sizelist);
54
        for (uint m = 0; m < num_mappings; ++m)
55
        {
56
                sizeQComboBox->insertItem(sizelist[m]);
57
                if (sizelist[m]==doc->PageSize)
519 cbradney 58
                        i=m;
59
        }
60
        //set Custom if we dont have one already as old docs wont have this attribute
61
        if (i==-1)
62
                i=num_mappings-1;
693 fschmid 63
        sizeQComboBox->setEnabled(false);
64
        sizeQComboBox->setCurrentItem(i);
65
        dsLayout4->addWidget( sizeQLabel, 0, 0 );
66
        dsLayout4->addWidget( sizeQComboBox, 0, 1 );
67
        orientationQComboBox = new QComboBox( true, dsGroupBox7, "orientationQComboBox" );
68
        orientationQLabel = new QLabel( orientationQComboBox, tr( "Orie&ntation:" ), dsGroupBox7, "orientationQLabel" );
69
        orientationQComboBox->insertItem( tr( "Portrait" ) );
70
        orientationQComboBox->insertItem( tr( "Landscape" ) );
71
        orientationQComboBox->setEnabled(false);
72
        orientationQComboBox->setCurrentItem(doc->PageOri);
73
        dsLayout4->addWidget( orientationQLabel, 0, 2 );
519 cbradney 74
        dsLayout4->addWidget( orientationQComboBox, 0, 3 );
693 fschmid 75
        widthMSpinBox = new MSpinBox( 1, 10000, dsGroupBox7, 2 );
76
        widthQLabel = new QLabel( tr( "&Width:" ), dsGroupBox7, "widthLabel" );
77
        widthMSpinBox->setEnabled( false );
78
        widthMSpinBox->setSuffix(ein);
726 fschmid 79
        widthMSpinBox->setValue(pageWidth);
693 fschmid 80
        widthQLabel->setBuddy(widthMSpinBox);
81
        dsLayout4->addWidget( widthQLabel, 1, 0 );
82
        dsLayout4->addWidget( widthMSpinBox, 1, 1 );
83
        heightMSpinBox = new MSpinBox( 1, 10000, dsGroupBox7, 2 );
84
        heightMSpinBox->setEnabled( false );
85
        heightMSpinBox->setSuffix(ein);
726 fschmid 86
        heightMSpinBox->setValue(pageHeight);
800 fschmid 87
        heightQLabel = new QLabel(heightMSpinBox,  tr( "&Height:" ), dsGroupBox7, "heightLabel" );
693 fschmid 88
        dsLayout4->addWidget( heightQLabel, 1, 2 );
89
        dsLayout4->addWidget( heightMSpinBox, 1, 3 );
800 fschmid 90
        unitCombo = new QComboBox( true, dsGroupBox7, "unitCombo" );
91
        unitCombo->insertItem( tr( "Points (pt)" ) );
92
        unitCombo->insertItem( tr( "Millimetres (mm)" ) );
93
        unitCombo->insertItem( tr( "Inches (in)" ) );
94
        unitCombo->insertItem( tr( "Picas (p)" ) );
95
        unitCombo->setEditable(false);
1065 cbradney 96
        unitCombo->setCurrentItem(doc->docUnitIndex);
800 fschmid 97
        unitQLabel = new QLabel(unitCombo, tr( "&Unit:" ), dsGroupBox7, "unitQLabel" );
98
        dsLayout4->addWidget( unitQLabel, 2, 0 );
99
        dsLayout4->addWidget( unitCombo, 2, 1 );
519 cbradney 100
        dsGroupBox7Layout->addLayout( dsLayout4 );
788 fschmid 101
        reformDocLayout->addWidget( dsGroupBox7 );
102
        groupBox7 = new QGroupBox( tabPage, "GroupBox7" );
103
        groupBox7->setTitle( tr( "Margin Guides" ) );
104
        groupBox7->setColumnLayout(0, Qt::Vertical );
105
        groupBox7->layout()->setSpacing( 0 );
106
        groupBox7->layout()->setMargin( 0 );
107
        groupBox7Layout = new QHBoxLayout( groupBox7->layout() );
108
        groupBox7Layout->setAlignment( Qt::AlignTop );
109
        groupBox7Layout->setSpacing( 0 );
110
        groupBox7Layout->setMargin( 10 );
111
        layout4 = new QGridLayout;
112
        layout4->setSpacing( 6 );
113
        layout4->setMargin( 0 );
114
        topR = new MSpinBox( groupBox7, 4 );
726 fschmid 115
        topR->setSuffix( ein );
116
        topR->setDecimals( decimals );
117
        topR->setMaxValue(pageHeight);
118
        topR->setValue(doc->PageM.Top * UmReFaktor);
788 fschmid 119
        layout4->addWidget( topR, 0, 1 );
120
        TextLabel5 = new QLabel( tr( "&Top:" ), groupBox7, "TextLabel5" );
726 fschmid 121
        TextLabel5->setBuddy(topR);
788 fschmid 122
        layout4->addWidget( TextLabel5, 0, 0 );
123
        leftR = new MSpinBox( groupBox7, 4 );
726 fschmid 124
        leftR->setSuffix( ein );
125
        leftR->setDecimals( decimals );
126
        leftR->setMaxValue(pageWidth);
127
        leftR->setValue(doc->PageM.Left * UmReFaktor);
788 fschmid 128
        layout4->addWidget( leftR, 0, 3 );
129
        Links = new QLabel( tr( "&Left:" ), groupBox7, "Links" );
726 fschmid 130
        Links->setBuddy(leftR);
788 fschmid 131
        layout4->addWidget( Links, 0, 2 );
132
        bottomR = new MSpinBox( groupBox7, 4 );
726 fschmid 133
        bottomR->setSuffix( ein );
134
        bottomR->setDecimals( decimals );
135
        bottomR->setMaxValue(pageHeight);
136
        bottomR->setValue(doc->PageM.Bottom * UmReFaktor);
788 fschmid 137
        layout4->addWidget( bottomR, 1, 1 );
138
        TextLabel7 = new QLabel( tr( "&Bottom:" ), groupBox7, "TextLabel7" );
726 fschmid 139
        TextLabel7->setBuddy(bottomR);
788 fschmid 140
        layout4->addWidget( TextLabel7, 1, 0 );
141
        rightR = new MSpinBox( groupBox7, 4 );
726 fschmid 142
        rightR->setSuffix( ein );
143
        rightR->setDecimals( decimals );
144
        rightR->setMaxValue(pageWidth);
145
        rightR->setValue(doc->PageM.Right * UmReFaktor);
788 fschmid 146
        layout4->addWidget( rightR, 1, 3 );
147
        Rechts = new QLabel( tr( "&Right:" ), groupBox7, "Rechts" );
726 fschmid 148
        Rechts->setBuddy(rightR);
788 fschmid 149
        layout4->addWidget( Rechts, 1, 2 );
150
        groupBox7Layout->addLayout( layout4 );
151
        reformDocLayout->addWidget( groupBox7 );
152
        groupBox7a = new QGroupBox( tabPage, "groupBox7" );
153
        groupBox7a->setTitle( tr( "Layout" ) );
154
        groupBox7a->setColumnLayout(0, Qt::Vertical );
155
        groupBox7a->layout()->setSpacing( 0 );
156
        groupBox7a->layout()->setMargin( 0 );
157
        groupBox7aLayout = new QHBoxLayout( groupBox7a->layout() );
158
        groupBox7aLayout->setAlignment( Qt::AlignTop );
159
        groupBox7aLayout->setSpacing( 0 );
160
        groupBox7aLayout->setMargin( 10 );
161
        layout4a = new QGridLayout;
162
        layout4a->setSpacing( 6 );
163
        layout4a->setMargin( 0 );
164
        facingPages = new QCheckBox( tr( "&Facing Pages" ),groupBox7a, "facingPages" );
726 fschmid 165
        facingPages->setChecked( doc->PageFP );
788 fschmid 166
        layout4a->addMultiCellWidget( facingPages, 2, 2, 0, 1 );
167
        firstPage = new QCheckBox( tr( "Left &Page First" ), groupBox7a, "n" );
726 fschmid 168
        firstPage->setChecked( doc->FirstPageLeft );
788 fschmid 169
        layout4a->addMultiCellWidget( firstPage, 2, 2, 2, 3 );
693 fschmid 170
        if (!doc->PageFP)
726 fschmid 171
                firstPage->setEnabled(false);
249 Franz 172
        setDS();
788 fschmid 173
        TextLabel1_3 = new QLabel( tr( "F&irst Page Number:" ), groupBox7a, "TextLabel1_3" );
174
        layout4a->addMultiCellWidget( TextLabel1_3, 3, 3, 0, 1 );
175
        pageNumber = new QSpinBox( groupBox7a, "pageNumber" );
726 fschmid 176
        pageNumber->setMaxValue( 10000 );
177
        pageNumber->setMinValue( 1 );
178
        pageNumber->setValue(doc->FirstPnum);
788 fschmid 179
        layout4a->addWidget( pageNumber, 3, 2, Qt::AlignRight );
726 fschmid 180
        TextLabel1_3->setBuddy(pageNumber);
788 fschmid 181
        groupBox7aLayout->addLayout( layout4a );
182
        reformDocLayout->addWidget( groupBox7a );
800 fschmid 183
        groupAutoSave = new QGroupBox( tabPage, "groupAutoSave" );
184
        groupAutoSave->setTitle( tr( "Autosave" ) );
185
        groupAutoSave->setCheckable( true );
186
        groupAutoSave->setChecked( doc->AutoSave );
187
        groupAutoSave->setColumnLayout(0, Qt::Vertical );
188
        groupAutoSave->layout()->setSpacing( 6 );
189
        groupAutoSave->layout()->setMargin( 11 );
190
        groupAutoSaveLayout = new QHBoxLayout( groupAutoSave->layout() );
191
        groupAutoSaveLayout->setAlignment( Qt::AlignTop );
192
        autoSaveTime = new QSpinBox( groupAutoSave, "autoSaveTime" );
193
        autoSaveTime->setMinValue( 1 );
194
        autoSaveTime->setMaxValue( 60 );
195
        autoSaveTime->setSuffix( " " + tr("min") );
196
        autoSaveTime->setValue(doc->AutoSaveTime / 1000 / 60);
197
        groupAutoSaveLayout->addWidget( autoSaveTime );
198
        textLabel1m = new QLabel(autoSaveTime, tr( "&Interval:" ), groupAutoSave, "textLabel1m" );
199
        groupAutoSaveLayout->addWidget( textLabel1m );
200
        reformDocLayout->addWidget( groupAutoSave );
201
        addItem( tr("Document"), loadIcon("page.png"), tabPage);
693 fschmid 202
 
1195 fschmid 203
        tabGuides = new TabGuides(prefsWidgets, &doc->guidesSettings, &doc->typographicSetttings, UmReFaktor, ein);
715 fschmid 204
        addItem( tr("Guides"), loadIcon("guides.png"), tabGuides);
693 fschmid 205
 
705 fschmid 206
        tabView = new QWidget( prefsWidgets, "tabView" );
207
        tabViewLayout = new QVBoxLayout( tabView, 10, 5, "tabViewLayout");
208
        pageBackground = new QButtonGroup( tabView, "pageBackground" );
1195 fschmid 209
        pageBackground->setTitle( tr( "Page Display" ) );
705 fschmid 210
        pageBackground->setColumnLayout(0, Qt::Vertical );
211
        pageBackground->layout()->setSpacing( 5 );
212
        pageBackground->layout()->setMargin( 10 );
213
        pageBackgroundLayout = new QVBoxLayout( pageBackground->layout() );
214
        pageBackgroundLayout->setAlignment( Qt::AlignTop );
215
        layout10 = new QHBoxLayout( 0, 0, 5, "layout10");
216
        textLabel9 = new QLabel( pageBackground, "textLabel9" );
217
        textLabel9->setText( tr( "Color:" ) );
218
        layout10->addWidget( textLabel9 );
219
        backColor = new QPushButton( pageBackground, "backColor" );
220
        backColor->setMinimumSize( QSize( 60, 20 ) );
221
        backColor->setMaximumSize( QSize( 60, 20 ) );
222
        backColor->setFlat( false );
223
        backColor->setAutoDefault( false );
224
        QPixmap pm5 = QPixmap(54, 14);
225
        pm5.fill(doc->papColor);
226
        colorPaper = doc->papColor;
227
        backColor->setPixmap(pm5);
228
        backColor->setText( QString::null );
229
        layout10->addWidget( backColor );
1195 fschmid 230
        QSpacerItem* spacer3 = new QSpacerItem( 61, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
705 fschmid 231
        layout10->addItem( spacer3 );
232
        pageBackgroundLayout->addLayout( layout10 );
233
        checkUnprintable = new QCheckBox( pageBackground, "checkUnprintable" );
234
        checkUnprintable->setText( tr( "Display &Unprintable Area in Margin Color" ) );
235
        checkUnprintable->setAccel( QKeySequence( tr( "Alt+U" ) ) );
1065 cbradney 236
        checkUnprintable->setChecked( doc->marginColored );
705 fschmid 237
        pageBackgroundLayout->addWidget( checkUnprintable );
1195 fschmid 238
        checkPictures = new QCheckBox( pageBackground, "checkPictures" );
239
        checkPictures->setText( tr( "Show Pictures" ) );
240
        checkPictures->setChecked(doc->guidesSettings.showPic);
241
        pageBackgroundLayout->addWidget( checkPictures );
242
        checkLink = new QCheckBox( pageBackground, "checkLink" );
243
        checkLink->setText( tr( "Show Text Chains" ) );
244
        checkLink->setChecked(doc->guidesSettings.linkShown);
245
        pageBackgroundLayout->addWidget( checkLink );
246
        checkFrame = new QCheckBox( pageBackground, "checkFrame" );
247
        checkFrame->setText( tr( "Show Frames" ) );
248
        checkFrame->setChecked(doc->guidesSettings.framesShown);
249
        pageBackgroundLayout->addWidget( checkFrame );
705 fschmid 250
        tabViewLayout->addWidget( pageBackground );
734 fschmid 251
 
252
        groupScratch = new QGroupBox( tabView, "GroupBox7" );
253
        groupScratch->setTitle( tr( "Scratch Space" ) );
254
        groupScratch->setColumnLayout(0, Qt::Vertical );
255
        groupScratch->layout()->setSpacing( 0 );
256
        groupScratch->layout()->setMargin( 0 );
257
        groupScratchLayout = new QHBoxLayout( groupScratch->layout() );
258
        groupScratchLayout->setAlignment( Qt::AlignTop );
259
        groupScratchLayout->setSpacing( 0 );
260
        groupScratchLayout->setMargin( 10 );
788 fschmid 261
        layout4s = new QGridLayout;
262
        layout4s->setSpacing( 6 );
263
        layout4s->setMargin( 0 );
734 fschmid 264
        topScratch = new MSpinBox( groupScratch, 4 );
265
        topScratch->setSuffix( ein );
266
        topScratch->setDecimals( decimals );
267
        topScratch->setMaxValue(1000);
268
        topScratch->setValue(doc->ScratchTop * UmReFaktor);
788 fschmid 269
        layout4s->addWidget( topScratch, 0, 1 );
734 fschmid 270
        TextLabel5s = new QLabel(topScratch, tr( "&Top:" ), groupScratch, "TextLabel5" );
788 fschmid 271
        layout4s->addWidget( TextLabel5s, 0, 0 );
734 fschmid 272
        leftScratch = new MSpinBox( groupScratch, 4 );
273
        leftScratch->setSuffix( ein );
274
        leftScratch->setDecimals( decimals );
275
        leftScratch->setMaxValue(1000);
276
        leftScratch->setValue(doc->ScratchLeft * UmReFaktor);
788 fschmid 277
        layout4s->addWidget( leftScratch, 0, 3 );
734 fschmid 278
        Linkss = new QLabel(leftScratch, tr( "&Left:" ), groupScratch, "Links" );
788 fschmid 279
        layout4s->addWidget( Linkss, 0, 2 );
734 fschmid 280
        bottomScratch = new MSpinBox( groupScratch, 4 );
281
        bottomScratch->setSuffix( ein );
282
        bottomScratch->setDecimals( decimals );
283
        bottomScratch->setMaxValue(1000);
284
        bottomScratch->setValue(doc->ScratchBottom * UmReFaktor);
788 fschmid 285
        layout4s->addWidget( bottomScratch, 1, 1 );
734 fschmid 286
        TextLabel7s = new QLabel(bottomScratch, tr( "&Bottom:" ), groupScratch, "TextLabel7" );
788 fschmid 287
        layout4s->addWidget( TextLabel7s, 1, 0 );
734 fschmid 288
        rightScratch = new MSpinBox( groupScratch, 4 );
289
        rightScratch->setSuffix( ein );
290
        rightScratch->setDecimals( decimals );
291
        rightScratch->setMaxValue(1000);
292
        rightScratch->setValue(doc->ScratchRight * UmReFaktor);
788 fschmid 293
        layout4s->addWidget( rightScratch, 1, 3 );
734 fschmid 294
        Rechtss = new QLabel(rightScratch, tr( "&Right:" ), groupScratch, "Rechts" );
788 fschmid 295
        layout4s->addWidget( Rechtss, 1, 2 );
296
        groupScratchLayout->addLayout( layout4s );
734 fschmid 297
        tabViewLayout->addWidget( groupScratch );
1195 fschmid 298
 
299
 
715 fschmid 300
        addItem( tr("Display"), loadIcon("screen.png"), tabView);
301
 
1195 fschmid 302
        tabTypo = new TabTypograpy(  prefsWidgets, &doc->typographicSetttings);
715 fschmid 303
        addItem( tr("Typography"), loadIcon("font.png"), tabTypo);
304
 
1194 fschmid 305
        tabTools = new TabTools(  prefsWidgets, &doc->toolSettings, UmReFaktor, ein, doc);
726 fschmid 306
        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
307
 
795 fschmid 308
        tabHyphenator = new HySettings(prefsWidgets, &ap->LangTransl);
1065 cbradney 309
        tabHyphenator->verbose->setChecked(!doc->docHyphenator->Automatic);
310
        tabHyphenator->input->setChecked(doc->docHyphenator->AutoCheck);
311
        tabHyphenator->language->setCurrentText(ap->LangTransl[doc->docHyphenator->Language]);
312
        tabHyphenator->wordLen->setValue(doc->docHyphenator->MinWordLen);
313
        tabHyphenator->maxCount->setValue(doc->docHyphenator->HyCount);
795 fschmid 314
        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
800 fschmid 315
 
316
        int cmsTab = 0;
795 fschmid 317
        if (CMSavail)
318
        {
319
                tabColorManagement = new CMSPrefs(prefsWidgets, &doc->CMSSettings, &InputProfiles, &ap->PrinterProfiles, &ap->MonitorProfiles);
800 fschmid 320
                cmsTab = addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
795 fschmid 321
        }
322
 
726 fschmid 323
        rightR->setMaxValue(pageWidth - leftR->value());
324
        leftR->setMaxValue(pageWidth - rightR->value());
325
        topR->setMaxValue(pageHeight - bottomR->value());
326
        bottomR->setMaxValue(pageHeight - topR->value());
249 Franz 327
        //tooltips
1195 fschmid 328
        QToolTip::add( checkLink, tr("Turns the of linked frames on or off"));
329
        QToolTip::add( checkFrame, tr("Turns the display of frames on or off"));
330
        QToolTip::add( checkPictures, tr("Turns the display of pictures on or off"));
776 fschmid 331
        QToolTip::add( backColor, tr( "Color for paper" ) );
332
        QToolTip::add( checkUnprintable, tr( "Mask the area outside the margins in the margin color" ) );
726 fschmid 333
        QToolTip::add( facingPages, tr( "Enable single or spread based layout" ) );
334
        QToolTip::add( firstPage, tr( "Make the first page the left page of the document" ) );
335
        QToolTip::add( topR, tr( "Distance between the top margin guide and the edge of the page" ) );
336
        QToolTip::add( bottomR, tr( "Distance between the bottom margin guide and the edge of the page" ) );
337
        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" ) );
338
        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 339
 
249 Franz 340
        // signals and slots connections
726 fschmid 341
        connect( facingPages, SIGNAL( clicked() ), this, SLOT( setDS() ) );
342
        connect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
343
        connect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
344
        connect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
345
        connect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
705 fschmid 346
        connect(backColor, SIGNAL(clicked()), this, SLOT(changePaperColor()));
734 fschmid 347
        connect(unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
731 fschmid 348
 
800 fschmid 349
        if (CMSavail)
350
                prefsWidgets->raiseWidget(cmsTab);
351
        arrangeIcons();
693 fschmid 352
        resize( minimumSizeHint() );
353
        clearWState( WState_Polished );
800 fschmid 354
        prefsWidgets->raiseWidget(0);
3 paul 355
}
356
 
734 fschmid 357
void ReformDoc::unitChange()
358
{
359
        disconnect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
360
        disconnect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
361
        disconnect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
362
        disconnect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
363
        int decimalsOld;
364
        double AltUmrech = Umrech;
365
        double oldMin, oldMax, val;
366
        QString einh;
367
        einheit = unitCombo->currentItem();
368
        switch (unitCombo->currentItem())
369
        {
370
        case 0:
371
                Umrech = 1.0;
372
                decimals = 100;
373
                einh = tr( " pt" );
374
                break;
375
        case 1:
376
                Umrech = 0.3527777;
377
                decimals = 1000;
378
                einh = tr( " mm" );
379
                break;
380
        case 2:
381
                Umrech = 1.0 / 72.0;
382
                decimals = 10000;
383
                einh = tr( " in" );
384
                break;
385
        case 3:
386
                Umrech = 1.0 / 12.0;
387
                decimals = 100;
388
                einh = tr( " p" );
389
                break;
390
        }
781 cbradney 391
 
782 fschmid 392
        widthMSpinBox->setSuffix(einh);
393
        heightMSpinBox->setSuffix(einh);
394
        topR->setSuffix(einh);
395
        bottomR->setSuffix(einh);
396
        leftR->setSuffix(einh);
397
        rightR->setSuffix(einh);
879 fschmid 398
        tabGuides->minorSpace->setSuffix(einh);
399
        tabGuides->majorSpace->setSuffix(einh);
400
        tabGuides->snapDistance->setSuffix(einh);
1195 fschmid 401
        tabGuides->baseGrid->setSuffix(einh);
402
        tabGuides->baseOffset->setSuffix(einh);
1194 fschmid 403
        tabTools->gapText->setSuffix(einh);
782 fschmid 404
        topScratch->setSuffix(einh);
405
        bottomScratch->setSuffix(einh);
406
        leftScratch->setSuffix(einh);
407
        rightScratch->setSuffix(einh);
781 cbradney 408
 
782 fschmid 409
        double invUnitConversion = 1.0 / AltUmrech * Umrech;
781 cbradney 410
 
734 fschmid 411
        widthMSpinBox->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 412
        widthMSpinBox->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, docc->PageB * Umrech);
734 fschmid 413
        heightMSpinBox->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 414
        heightMSpinBox->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, docc->PageH * Umrech);
734 fschmid 415
        topR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 416
        topR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 417
        bottomR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 418
        bottomR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 419
        leftR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 420
        leftR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 421
        rightR->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 422
        rightR->setValues(0, oldMax * invUnitConversion, decimals, val * invUnitConversion);
879 fschmid 423
        tabGuides->minorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
424
        tabGuides->minorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
425
        tabGuides->majorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
426
        tabGuides->majorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
427
        tabGuides->snapDistance->getValues(&oldMin, &oldMax, &decimalsOld, &val);
428
        tabGuides->snapDistance->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1195 fschmid 429
        tabGuides->baseGrid->getValues(&oldMin, &oldMax, &decimalsOld, &val);
430
        tabGuides->baseGrid->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
431
        tabGuides->baseOffset->getValues(&oldMin, &oldMax, &decimalsOld, &val);
432
        tabGuides->baseOffset->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1194 fschmid 433
        tabTools->gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
434
        tabTools->gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 435
        topScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 436
        topScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 437
        bottomScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 438
        bottomScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 439
        leftScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 440
        leftScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
734 fschmid 441
        rightScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
781 cbradney 442
        rightScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
443
 
734 fschmid 444
        pageWidth = docc->PageB * Umrech;
445
        pageHeight = docc->PageH * Umrech;
446
        rightR->setMaxValue(pageWidth - leftR->value());
447
        leftR->setMaxValue(pageWidth - rightR->value());
448
        topR->setMaxValue(pageHeight - bottomR->value());
449
        bottomR->setMaxValue(pageHeight - topR->value());
450
        connect(topR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
451
        connect(bottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
452
        connect(leftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
453
        connect(rightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
454
}
455
 
705 fschmid 456
void ReformDoc::changePaperColor()
457
{
458
        QColor neu = QColor();
459
        neu = QColorDialog::getColor(colorPaper, this);
460
        if (neu.isValid())
461
        {
462
                QPixmap pm = QPixmap(54, 14);
463
                pm.fill(neu);
464
                colorPaper = neu;
465
                backColor->setPixmap(pm);
466
        }
467
}
468
 
693 fschmid 469
void ReformDoc::setTop(int )
36 Franz 470
{
726 fschmid 471
        bottomR->setMaxValue(pageHeight - topR->value());
36 Franz 472
}
3 paul 473
 
693 fschmid 474
void ReformDoc::setBottom(int )
36 Franz 475
{
726 fschmid 476
        topR->setMaxValue(pageHeight - bottomR->value());
36 Franz 477
}
478
 
693 fschmid 479
void ReformDoc::setLeft(int )
36 Franz 480
{
726 fschmid 481
        rightR->setMaxValue(pageWidth - leftR->value());
36 Franz 482
}
483
 
693 fschmid 484
void ReformDoc::setRight(int )
36 Franz 485
{
726 fschmid 486
        leftR->setMaxValue(pageWidth - rightR->value());
36 Franz 487
}
488
 
3 paul 489
void ReformDoc::setDS()
490
{
726 fschmid 491
        if (facingPages->isChecked())
249 Franz 492
        {
340 Franz 493
                Links->setText( tr( "&Inside:" ) );
494
                Rechts->setText( tr( "&Outside:" ) );
726 fschmid 495
                firstPage->setEnabled(true);
249 Franz 496
        }
497
        else
498
        {
340 Franz 499
                Links->setText( tr( "&Left:" ) );
500
                Rechts->setText( tr( "&Right:" ) );
726 fschmid 501
                firstPage->setEnabled(false);
249 Franz 502
        }
348 Franz 503
}