Subversion Repositories Scribus

Rev

Rev 1195 | Rev 1261 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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