Subversion Repositories Scribus

Rev

Rev 8894 | 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 "druck.h"
8
#include "druck.moc"
128 Franz 9
 
2688 craig 10
#include "scconfig.h"
128 Franz 11
 
7117 jghali 12
#include "scpaths.h"
5880 jghali 13
#include "scribusdoc.h"
6663 cbradney 14
#include "createrange.h"
2952 cbradney 15
#include "commonstrings.h"
2856 cbradney 16
#include "prefsmanager.h"
3252 craig 17
#include "prefscontext.h"
415 Franz 18
#include "prefsfile.h"
3 paul 19
#include "customfdialog.h"
20
#include "cupsoptions.h"
21
#include <qtextstream.h>
22
#include <qstringlist.h>
23
#include <qdir.h>
24
#include <qfileinfo.h>
25
#include <qmap.h>
4361 cbradney 26
#if defined( HAVE_CUPS )
3 paul 27
#include <cups/cups.h>
4361 cbradney 28
#elif defined(_WIN32)
29
#include <windows.h>
30
#include <winspool.h>
3 paul 31
#endif
4504 cbradney 32
#include "printerutil.h"
4361 cbradney 33
#include "util.h"
6954 fschmid 34
#include "units.h"
6663 cbradney 35
#include "usertaskstructs.h"
36
 
3234 fschmid 37
extern bool previewDinUse;
3 paul 38
 
5880 jghali 39
Druck::Druck( QWidget* parent, ScribusDoc* doc, QString PDatei, QString PDev, QString PCom, QByteArray& PSettings, bool gcr, QStringList spots)
248 Franz 40
                : QDialog( parent, "Dr", true, 0)
3 paul 41
{
6119 tsoots 42
        cdia = 0;
5880 jghali 43
        m_doc = doc;
6954 fschmid 44
        unit = unitGetSuffixFromIndex(doc->unitIndex());
45
        precision = unitGetPrecisionFromIndex(doc->unitIndex());
46
        unitRatio = unitGetRatioFromIndex(doc->unitIndex());
2856 cbradney 47
        prefs = PrefsManager::instance()->prefsFile->getContext("print_options");
4361 cbradney 48
        DevMode = PSettings;
3234 fschmid 49
        ToSeparation = false;
161 Franz 50
        PrinterOpts = "";
248 Franz 51
        setCaption( tr( "Setup Printer" ) );
52
        setIcon(loadIcon("AppIcon.png"));
53
        DruckLayout = new QVBoxLayout( this );
3234 fschmid 54
        DruckLayout->setSpacing( 5 );
248 Franz 55
        DruckLayout->setMargin( 10 );
3 paul 56
 
248 Franz 57
        Drucker = new QGroupBox( this, "Drucker" );
348 Franz 58
        Drucker->setTitle( tr( "Print Destination" ) );
248 Franz 59
        Drucker->setColumnLayout(0, Qt::Vertical );
60
        Drucker->layout()->setSpacing( 0 );
61
        Drucker->layout()->setMargin( 0 );
62
        DruckerLayout = new QGridLayout( Drucker->layout() );
63
        DruckerLayout->setAlignment( Qt::AlignTop );
3234 fschmid 64
        DruckerLayout->setSpacing( 5 );
248 Franz 65
        DruckerLayout->setMargin( 10 );
3 paul 66
 
248 Franz 67
        Layout1x = new QHBoxLayout;
3234 fschmid 68
        Layout1x->setSpacing( 5 );
248 Franz 69
        Layout1x->setMargin( 0 );
70
        PrintDest = new QComboBox( true, Drucker, "PrintDest" );
71
        PrintDest->setMinimumSize( QSize( 250, 22 ) );
3068 fschmid 72
        PrintDest->setMaximumSize( QSize( 260, 30 ) );
248 Franz 73
        PrintDest->setEditable(false);
74
        QString Pcap;
4361 cbradney 75
        QString printerName;
4504 cbradney 76
        QStringList printerNames = PrinterUtil::getPrinterNames();
4361 cbradney 77
        int numPrinters = printerNames.count();
78
        for( int i = 0; i < numPrinters; i++)
161 Franz 79
        {
4361 cbradney 80
                printerName = printerNames[i];
81
                PrintDest->insertItem(printerName);
82
                if( printerName == PDev )
248 Franz 83
                {
84
                        PrintDest->setCurrentItem(PrintDest->count()-1);
4361 cbradney 85
                        prefs->set("CurrentPrn", PrintDest->currentText());
248 Franz 86
                        ToFile = false;
87
                }
161 Franz 88
        }
4361 cbradney 89
 
248 Franz 90
        PrintDest->insertItem( tr("File"));
2877 cbradney 91
        if (PDev.isEmpty())
248 Franz 92
        {
93
                Geraet = PrintDest->text(0);
94
                ToFile = false;
95
        }
96
        else
97
                Geraet = PDev;
451 tsoots 98
 
248 Franz 99
        Layout1x->addWidget( PrintDest );
3 paul 100
 
4361 cbradney 101
#if defined(HAVE_CUPS) || defined(_WIN32)
348 Franz 102
        OptButton = new QPushButton( tr( "&Options..." ), Drucker, "Optionen" );
248 Franz 103
        Layout1x->addWidget( OptButton );
3 paul 104
#endif
248 Franz 105
        QSpacerItem* spacerDR = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
106
        Layout1x->addItem( spacerDR );
107
        DruckerLayout->addLayout( Layout1x, 0, 0);
108
        Layout1 = new QHBoxLayout;
3234 fschmid 109
        Layout1->setSpacing( 5 );
248 Franz 110
        Layout1->setMargin( 0 );
7117 jghali 111
        LineEdit1 = new QLineEdit( QDir::convertSeparators(PDatei), Drucker, "LineEdit1" );
348 Franz 112
        LineEdit1->setMinimumSize( QSize( 240, 22 ) );
113
        LineEdit1->setEnabled(false);
114
        DateiT = new QLabel( LineEdit1, tr( "&File:" ), Drucker, "DateiT" );
248 Franz 115
        DateiT->setEnabled( false );
116
        Layout1->addWidget( DateiT );
117
        Layout1->addWidget( LineEdit1 );
118
        ToolButton1 = new QToolButton( Drucker, "ToolButton1" );
348 Franz 119
        ToolButton1->setText( tr( "C&hange..." ) );
248 Franz 120
        ToolButton1->setMinimumSize( QSize( 80, 22 ) );
121
        ToolButton1->setEnabled(false);
261 Franz 122
        ToolButton1->setFocusPolicy( QToolButton::TabFocus );
248 Franz 123
        Layout1->addWidget( ToolButton1 );
124
        DruckerLayout->addLayout( Layout1, 1, 0 );
3 paul 125
 
2397 cbradney 126
        OtherCom = new QCheckBox( tr("A&lternative Printer Command"), Drucker, "Dc");
248 Franz 127
        OtherCom->setChecked(false);
128
        DruckerLayout->addWidget( OtherCom, 2, 0, Qt::AlignLeft);
129
        LayoutCC = new QHBoxLayout;
3234 fschmid 130
        LayoutCC->setSpacing( 5 );
248 Franz 131
        LayoutCC->setMargin( 0 );
348 Franz 132
        Command = new QLineEdit( PCom, Drucker, "LineEdit12" );
133
        Command->setMinimumSize( QSize( 240, 22 ) );
134
        Command->setEnabled(false);
135
        OthText = new QLabel( Command, tr( "Co&mmand:" ), Drucker, "DateiTc" );
248 Franz 136
        OthText->setEnabled( false );
137
        LayoutCC->addWidget( OthText );
138
        LayoutCC->addWidget( Command );
139
        DruckerLayout->addLayout( LayoutCC, 3, 0 );
140
        DruckLayout->addWidget( Drucker );
3 paul 141
 
3234 fschmid 142
        rangeGroup = new QButtonGroup( tr( "Range" ), this, "rangeGroup" );
143
        rangeGroup->setColumnLayout(0, Qt::Vertical );
144
        rangeGroup->layout()->setSpacing( 5 );
145
        rangeGroup->layout()->setMargin( 10 );
146
        rangeGroupLayout = new QGridLayout( rangeGroup->layout() );
147
        rangeGroupLayout->setAlignment( Qt::AlignTop );
148
        RadioButton1 = new QRadioButton( tr( "Print &All" ), rangeGroup, "RadioButton1" );
149
        rangeGroupLayout->addMultiCellWidget( RadioButton1, 0, 0, 0, 1 );
150
        CurrentPage = new QRadioButton( tr( "Print Current Pa&ge" ), rangeGroup, "CurrentPage" );
151
        rangeGroupLayout->addMultiCellWidget( CurrentPage, 1, 1, 0, 1 );
152
        RadioButton2 = new QRadioButton( tr( "Print &Range" ), rangeGroup, "RadioButton2" );
153
        rangeGroupLayout->addWidget( RadioButton2, 2, 0 );
6663 cbradney 154
        pageNumberSelectorLayout = new QHBoxLayout( 0, 0, 5, "pageNumberSelectorLayout" );
155
        pageNr = new QLineEdit( rangeGroup, "pageNr" );
156
        pageNumberSelectorLayout->addWidget( pageNr );
157
        pageNrButton = new QPushButton( QString::fromUtf8("…"), rangeGroup, "pageNrButton" );
158
        pageNrButton->setPixmap(loadIcon("ellipsis.png"));
159
        pageNumberSelectorLayout->addWidget( pageNrButton );
160
        rangeGroupLayout->addLayout( pageNumberSelectorLayout, 2, 1 );
161
        pageNr->setEnabled(false);
162
        pageNrButton->setEnabled(false);
3234 fschmid 163
        Copies = new QSpinBox( rangeGroup, "Copies" );
248 Franz 164
        Copies->setEnabled( true );
165
        Copies->setMinimumSize( QSize( 70, 22 ) );
166
        Copies->setMinValue( 1 );
167
        Copies->setMaxValue(1000);
168
        Copies->setValue(1);
3234 fschmid 169
        rangeGroupLayout->addWidget( Copies, 0, 3 );
170
        TextLabel3 = new QLabel( Copies, tr( "N&umber of Copies:" ), rangeGroup, "TextLabel3" );
171
        rangeGroupLayout->addWidget( TextLabel3, 0, 2 );
172
        DruckLayout->addWidget( rangeGroup );
3 paul 173
 
3234 fschmid 174
        printOptions = new QTabWidget( this, "printOptions" );
175
        tab = new QWidget( printOptions, "tab" );
176
        tabLayout = new QGridLayout( tab, 1, 1, 10, 5, "tabLayout");
177
        PrintSep = new QComboBox( true, tab, "PrintSep" );
178
        PrintSep->setEditable(false);
179
        PrintSep->insertItem( tr( "Print Normal" ) );
180
        PrintSep->insertItem( tr( "Print Separations" ) );
181
        tabLayout->addWidget( PrintSep, 0, 0 );
182
        colorType = new QComboBox( true, tab, "colorType" );
183
        colorType->setEditable(false);
184
        colorType->insertItem( tr( "Print in Color if Available" ) );
185
        colorType->insertItem( tr( "Print in Grayscale" ) );
186
        colorType->setCurrentItem(0);
187
        tabLayout->addWidget( colorType, 0, 1 );
188
        SepArt = new QComboBox( true, tab, "SepArt" );
248 Franz 189
        QString sep[] =
190
            {
191
                tr("All"), tr("Cyan"), tr("Magenta"), tr("Yellow"),
192
                tr("Black")
193
            };
223 Franz 194
        size_t sepArray = sizeof(sep) / sizeof(*sep);
195
        for (uint prop = 0; prop < sepArray; ++prop)
196
                SepArt->insertItem(sep[prop]);
3068 fschmid 197
        SepArt->insertStringList(spots);
248 Franz 198
        SepArt->setEnabled( false );
199
        SepArt->setEditable( false );
3234 fschmid 200
        tabLayout->addWidget( SepArt, 1, 0 );
201
        psLevel = new QComboBox( true, tab, "psLevel" );
202
        psLevel->insertItem( tr( "PostScript Level 1" ) );
203
        psLevel->insertItem( tr( "PostScript Level 2" ) );
204
        psLevel->insertItem( tr( "PostScript Level 3" ) );
205
        psLevel->setEditable( false );
206
        tabLayout->addWidget( psLevel, 1, 1 );
207
        printOptions->insertTab( tab, tr( "Options" ) );
208
        tab_2 = new QWidget( printOptions, "tab_2" );
209
        tabLayout_2 = new QHBoxLayout( tab_2, 10, 5, "tabLayout_2");
210
        pageOpts = new QGroupBox( tab_2, "pageOpts" );
211
        pageOpts->setTitle( tr( "Page" ) );
212
        pageOpts->setColumnLayout(0, Qt::Vertical );
213
        pageOpts->layout()->setSpacing( 5 );
214
        pageOpts->layout()->setMargin( 10 );
215
        pageOptsLayout = new QVBoxLayout( pageOpts->layout() );
216
        pageOptsLayout->setAlignment( Qt::AlignTop );
217
        MirrorHor = new QCheckBox( pageOpts, "MirrorH" );
218
        MirrorHor->setText( tr( "Mirror Page(s) Horizontal" ) );
219
        pageOptsLayout->addWidget( MirrorHor );
220
        MirrorVert = new QCheckBox( pageOpts, "MirrorV" );
221
        MirrorVert->setText( tr( "Mirror Page(s) Vertical" ) );
222
        pageOptsLayout->addWidget( MirrorVert );
223
        devPar = new QCheckBox( pageOpts, "devPar" );
224
        devPar->setText( tr( "Set Media Size" ) );
225
        pageOptsLayout->addWidget( devPar );
4649 fschmid 226
        ClipMarg = new QCheckBox( tr( "Clip to Page Margins" ), pageOpts, "ClipMarg" );
227
        pageOptsLayout->addWidget( ClipMarg );
3234 fschmid 228
        tabLayout_2->addWidget( pageOpts );
229
        colorOpts = new QButtonGroup( tab_2, "colorOpts" );
230
        colorOpts->setTitle( tr( "Color" ) );
231
        colorOpts->setColumnLayout(0, Qt::Vertical );
232
        colorOpts->layout()->setSpacing( 5 );
233
        colorOpts->layout()->setMargin( 10 );
234
        colorOptsLayout = new QVBoxLayout( colorOpts->layout() );
235
        colorOptsLayout->setAlignment( Qt::AlignTop );
236
        GcR = new QCheckBox( colorOpts, "GcR" );
237
        GcR->setText( tr( "Apply Under Color Removal" ) );
238
        colorOptsLayout->addWidget( GcR );
239
        spotColors = new QCheckBox( colorOpts, "spotColors" );
240
        spotColors->setText( tr( "Convert Spot Colors to Process Colors" ) );
241
        colorOptsLayout->addWidget( spotColors );
5308 fschmid 242
        overprintMode = new QCheckBox( colorOpts, "overprintMode" );
5320 fschmid 243
        overprintMode->setText( tr( "Force Overprint Mode" ) );
5308 fschmid 244
        colorOptsLayout->addWidget( overprintMode );
5880 jghali 245
        if (m_doc->HasCMS)
3234 fschmid 246
        {
247
                UseICC = new QCheckBox( colorOpts, "UseICC" );
248
                UseICC->setText( tr( "Apply ICC Profiles" ) );
249
                colorOptsLayout->addWidget( UseICC );
250
        }
251
        tabLayout_2->addWidget( colorOpts );
252
        printOptions->insertTab( tab_2, tr( "Advanced Options" ) );
6954 fschmid 253
 
254
        tab_3 = new QWidget( printOptions, "tab_3" );
255
        tabLayout_3 = new QGridLayout( tab_3, 1, 1, 10, 5, "tabLayout_3");
256
        MarkGroup = new QGroupBox( tab_3, "MarkGroup" );
257
        MarkGroup->setTitle( tr( "Printer Marks" ) );
258
        MarkGroup->setColumnLayout(0, Qt::Vertical );
259
        MarkGroup->layout()->setSpacing( 5 );
260
        MarkGroup->layout()->setMargin( 10 );
261
        MarkGroupLayout = new QGridLayout( MarkGroup->layout() );
262
        MarkGroupLayout->setAlignment( Qt::AlignTop );
263
        cropMarks = new QCheckBox( tr( "Crop Marks" ), MarkGroup, "cropMarks" );
264
        MarkGroupLayout->addWidget( cropMarks, 0, 0 );
265
        bleedMarks = new QCheckBox( tr( "Bleed Marks" ), MarkGroup, "bleedMarks" );
266
        MarkGroupLayout->addWidget( bleedMarks, 1, 0 );
267
        registrationMarks = new QCheckBox( tr( "Registration Marks" ), MarkGroup, "registrationMarks" );
268
        MarkGroupLayout->addWidget( registrationMarks, 2, 0 );
269
        colorMarks = new QCheckBox( tr( "Color Bars" ), MarkGroup, "colorMarks" );
270
        MarkGroupLayout->addMultiCellWidget( colorMarks, 0, 0, 1, 2 );
271
        MarkTxt1 = new QLabel( MarkGroup, "MarkTxt1" );
272
        MarkTxt1->setText( tr( "Offset:" ) );
273
        MarkGroupLayout->addWidget( MarkTxt1, 1, 1 );
274
        markOffset = new MSpinBox( MarkGroup, precision );
275
        MarkGroupLayout->addWidget( markOffset, 1, 2 );
276
        markOffset->setSuffix( unit );
277
        markOffset->setMinValue(0);
278
        markOffset->setMaxValue(3000 * unitRatio);
279
        tabLayout_3->addWidget( MarkGroup, 0, 0 );
280
        printOptions->insertTab( tab_3, tr( "Marks" ) );
281
 
282
        tab_4 = new QWidget( printOptions, "tab_4" );
283
        tabLayout_4 = new QGridLayout( tab_4, 1, 1, 10, 5, "tabLayout_4");
284
        BleedGroup = new QGroupBox( tab_4, "BleedGroup" );
285
        BleedGroup->setTitle( tr( "Bleed Settings" ) );
286
        BleedGroup->setColumnLayout(0, Qt::Vertical );
287
        BleedGroup->layout()->setSpacing( 5 );
288
        BleedGroup->layout()->setMargin( 10 );
289
        BleedGroupLayout = new QGridLayout( BleedGroup->layout() );
290
        BleedGroupLayout->setAlignment( Qt::AlignTop );
291
        BleedTxt1 = new QLabel( BleedGroup, "BleedTxt1" );
292
        BleedTxt1->setText( tr( "Top:" ) );
293
        BleedGroupLayout->addWidget( BleedTxt1, 0, 0 );
294
        BleedTop = new MSpinBox( BleedGroup, precision );
295
        BleedGroupLayout->addWidget( BleedTop, 0, 1 );
296
        BleedTxt2 = new QLabel( BleedGroup, "BleedTxt2" );
297
        BleedTxt2->setText( tr( "Bottom:" ) );
298
        BleedGroupLayout->addWidget( BleedTxt2, 1, 0 );
299
        BleedBottom = new MSpinBox( BleedGroup, precision );
300
        BleedGroupLayout->addWidget( BleedBottom, 1, 1 );
301
        BleedTxt3 = new QLabel( BleedGroup, "BleedTxt3" );
302
        BleedTxt3->setText( tr( "Left:" ) );
303
        BleedGroupLayout->addWidget( BleedTxt3, 0, 2 );
304
        BleedRight = new MSpinBox( BleedGroup, precision );
305
        BleedGroupLayout->addWidget( BleedRight, 0, 3 );
306
        BleedTxt4 = new QLabel( BleedGroup, "BleedTxt4" );
307
        BleedTxt4->setText( tr( "Right:" ) );
308
        BleedGroupLayout->addWidget( BleedTxt4, 1, 2 );
309
        BleedLeft = new MSpinBox( BleedGroup, precision );
310
        BleedGroupLayout->addWidget( BleedLeft, 1, 3 );
311
        docBleeds = new QCheckBox( tr( "Use Document Bleeds" ), BleedGroup, "docBleeds" );
312
        docBleeds->setChecked(false);
313
        BleedGroupLayout->addMultiCellWidget( docBleeds, 2, 2, 0, 3 );
314
        tabLayout_4->addWidget( BleedGroup, 0, 0 );
315
        printOptions->insertTab( tab_4, tr( "Bleeds" ) );
316
        BleedTop->setSuffix( unit );
317
        BleedTop->setMinValue(0);
318
        BleedTop->setMaxValue(3000*unitRatio);
319
        BleedBottom->setSuffix( unit );
320
        BleedBottom->setMinValue(0);
321
        BleedBottom->setMaxValue(3000*unitRatio);
322
        BleedRight->setSuffix( unit );
323
        BleedRight->setMinValue(0);
324
        BleedRight->setMaxValue(3000*unitRatio);
325
        BleedLeft->setSuffix( unit );
326
        BleedLeft->setMinValue(0);
327
        BleedLeft->setMaxValue(3000*unitRatio);
6980 fschmid 328
        if (m_doc->currentPageLayout != 0)
329
        {
330
                BleedTxt3->setText( tr( "Inside:" ) );
331
                BleedTxt4->setText( tr( "Outside:" ) );
332
        }
6954 fschmid 333
 
3234 fschmid 334
        DruckLayout->addWidget( printOptions );
3 paul 335
 
248 Franz 336
        Layout2 = new QHBoxLayout;
3234 fschmid 337
        Layout2->setSpacing( 5 );
248 Franz 338
        Layout2->setMargin( 0 );
339
        QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
340
        Layout2->addItem( spacer );
3234 fschmid 341
 
342
        previewButton = new QPushButton( tr( "Preview..." ), this, "previewButton" );
343
        previewButton->setDefault( false );
344
        previewButton->setEnabled(!previewDinUse);
345
        Layout2->addWidget( previewButton );
3 paul 346
 
348 Franz 347
        OKButton = new QPushButton( tr( "&Print" ), this, "OKButton" );
248 Franz 348
        OKButton->setDefault( true );
349
        Layout2->addWidget( OKButton );
2952 cbradney 350
        OKButton_2 = new QPushButton( CommonStrings::tr_Cancel, this, "OKButton_2" );
248 Franz 351
        OKButton_2->setDefault( false );
352
        Layout2->addWidget( OKButton_2 );
3 paul 353
 
248 Franz 354
        DruckLayout->addLayout( Layout2 );
355
        if ((PDev== tr("File")) || (PrintDest->count() == 1))
356
        {
357
                PrintDest->setCurrentItem(PrintDest->count()-1);
4361 cbradney 358
                prefs->set("CurrentPrn", PrintDest->currentText());
248 Franz 359
                DateiT->setEnabled(true);
360
                LineEdit1->setEnabled(true);
361
                ToolButton1->setEnabled(true);
362
                ToFile = true;
363
        }
4361 cbradney 364
 
248 Franz 365
        setMaximumSize(sizeHint());
260 Franz 366
        PrintDest->setFocus();
6954 fschmid 367
        QToolTip::add( BleedTop, "<qt>" + tr( "Distance for bleed from the top of the physical page" ) + "</qt>" );
368
        QToolTip::add( BleedBottom, "<qt>" + tr( "Distance for bleed from the bottom of the physical page" ) + "</qt>" );
369
        QToolTip::add( BleedLeft, "<qt>" + tr( "Distance for bleed from the left of the physical page" ) + "</qt>" );
370
        QToolTip::add( BleedRight, "<qt>" + tr( "Distance for bleed from the right of the physical page" )  + "</qt>");
4836 cbradney 371
        QToolTip::add( ClipMarg, "<qt>" + tr( "Do not show objects outside the margins on the printed page" ) + "</qt>" );
6663 cbradney 372
        QToolTip::add( pageNr, tr( "Insert a comma separated list of tokens where\n"
3234 fschmid 373
                                           "a token can be * for all the pages, 1-5 for\n"
374
                                           "a range of pages or a single page number.") );
3666 mrdocs 375
        QToolTip::add( OtherCom,"<qt>" + tr( "Use an alternative print manager, such as kprinter or gtklp, to utilize additional printing options") + "</qt>" );
376
        QToolTip::add( psLevel,"<qt>" +  tr( "Sets the PostScript Level.\n Setting to Level 1 or 2 can create huge files" ) + "</qt>" );
377
        QToolTip::add( GcR, "<qt>" + tr( "A way of switching off some of the gray shades which are composed of cyan, yellow and magenta and using black instead. UCR most affects parts of images which are neutral and/or dark tones which are close to the gray. Use of this may improve printing some images and some experimentation and testing is need on a case by case basis.UCR reduces the possibility of over saturation with CMY inks." ) + "</qt>");
3701 cbradney 378
        QToolTip::add(spotColors,"<qt>" + tr( "Enables Spot Colors to be converted to composite colors. Unless you are planning to print spot colors at a commercial printer, this is probably best left enabled." ) + "</qt>");
5320 fschmid 379
        QToolTip::add(overprintMode, "<qt>"+ tr("Enables global Overprint Mode for this document, overrides object settings") + "<qt>");
5880 jghali 380
        if (m_doc->HasCMS)
3702 cbradney 381
                QToolTip::add(UseICC,"<qt>" + tr( "Allows you to embed ICC profiles in the print stream when color management is enabled" ) + "</qt>");
3701 cbradney 382
        QToolTip::add(devPar, "<qt>" + tr( "This enables you to explicitely set the media size of the PostScript file. Not recommended unless requested by your printer." ) + "</qt>");
8886 mrdocs 383
        QToolTip::add( cropMarks, "<qt>" + tr( "This creates crop marks in the PDF indicating where the paper should be cut or trimmed after printing." ) + "</qt>" );
8894 cbradney 384
        QToolTip::add( bleedMarks, "<qt>" + tr( "This creates bleed marks which are indicated by  _ . _ and show the bleed limit" ) + "</qt>" );
8886 mrdocs 385
        QToolTip::add( registrationMarks, "<qt>" + tr( "Add registration marks which are added to each separation" ) + "</qt>" );
386
        QToolTip::add( colorMarks, "<qt>" + tr( "Add color calibration bars" ) + "</qt>" );
387
        QToolTip::add( markOffset, "<qt>" + tr( "Indicate the distance offset for the registration marks" ) + "</qt>" );
388
        QToolTip::add( BleedTop, "<qt>" + tr( "Distance for bleed from the top of the physical page" ) + "</qt>" );
389
        QToolTip::add( BleedBottom, "<qt>" + tr( "Distance for bleed from the bottom of the physical page" ) + "</qt>" );
390
        QToolTip::add( BleedLeft, "<qt>" + tr( "Distance for bleed from the left of the physical page" ) + "</qt>" );
391
        QToolTip::add( BleedRight, "<qt>" + tr( "Distance for bleed from the right of the physical page" )  + "</qt>");
392
        QToolTip::add( docBleeds, "<qt>" + tr( "Use the existing bleed settings from the document preferences" ) + "</qt>" );
248 Franz 393
        // signals and slots connections
451 tsoots 394
        connect( OKButton, SIGNAL( clicked() ), this, SLOT( okButtonClicked() ) );
248 Franz 395
        connect( OKButton_2, SIGNAL( clicked() ), this, SLOT( reject() ) );
396
        connect( PrintDest, SIGNAL(activated(const QString&)), this, SLOT(SelPrinter(const QString&)));
397
        connect( RadioButton1, SIGNAL(toggled(bool)), this, SLOT(SelRange(bool)));
307 Franz 398
        connect( CurrentPage, SIGNAL(toggled(bool)), this, SLOT(SelRange(bool)));
6663 cbradney 399
        connect( pageNrButton, SIGNAL(clicked()), this, SLOT(createPageNumberRange()));
3234 fschmid 400
        connect( PrintSep, SIGNAL(activated(int)), this, SLOT(SelMode(int)));
248 Franz 401
        connect( ToolButton1, SIGNAL(clicked()), this, SLOT(SelFile()));
402
        connect( OtherCom, SIGNAL(clicked()), this, SLOT(SelComm()));
6690 fschmid 403
        connect( previewButton, SIGNAL(clicked()), this, SLOT(previewButtonClicked()));
6954 fschmid 404
        connect(docBleeds, SIGNAL(clicked()), this, SLOT(doDocBleeds()));
4361 cbradney 405
#if defined(HAVE_CUPS) || defined(_WIN32)
248 Franz 406
        connect( OptButton, SIGNAL( clicked() ), this, SLOT( SetOptions() ) );
3 paul 407
#endif
4361 cbradney 408
 
3234 fschmid 409
        setStoredValues(gcr);
4506 cbradney 410
#if defined(_WIN32)
4361 cbradney 411
        if (!ToFile)
4506 cbradney 412
                PrinterUtil::initDeviceSettings( PrintDest->currentText(), DevMode );
413
#endif
4504 cbradney 414
        if ( PrinterUtil::isPostscriptPrinter(PrintDest->currentText()) || ToFile )
4361 cbradney 415
                psLevel->setEnabled( true );
416
        else
417
                psLevel->setEnabled( false );
3 paul 418
}
419
 
6663 cbradney 420
Druck::~Druck()
421
{
422
        delete cdia;
423
        cdia = 0;
424
}
425
 
3 paul 426
void Druck::SetOptions()
427
{
4361 cbradney 428
#ifdef HAVE_CUPS
3 paul 429
        PrinterOpts = "";
6119 tsoots 430
        if (!cdia)
431
                cdia = new CupsOptions(this, Geraet);
432
        if (!cdia->exec())
161 Franz 433
        {
6119 tsoots 434
                delete cdia; // if options was canceled delete dia 
435
                cdia = 0;    // so that getoptions() in the okButtonClicked() will get 
436
                             // the default values from the last succesful run
437
        }
438
 
439
#elif defined(_WIN32)
440
        bool done;
441
        QString  printerS;
442
        QCString printerC;
443
        HANDLE handle = NULL;
444
        // Retrieve the selected printer
445
        printerS = PrintDest->currentText();
446
        printerC = printerS.local8Bit();
447
        // Get a printer handle
448
        done = OpenPrinter( printerC.data(), &handle, NULL );
449
        if(!done)
450
                return;
451
        // Merge stored settings, prompt user and return user settings
452
        DocumentProperties( winId(), handle, printerC.data(), (DEVMODE*) DevMode.data(), (DEVMODE*) DevMode.data(),
453
                                                DM_IN_BUFFER | DM_IN_PROMPT | DM_OUT_BUFFER);
454
        // Free the printer handle
455
        ClosePrinter( handle );
456
#endif
457
}
458
 
459
void Druck::getOptions()
460
{
461
#ifdef HAVE_CUPS
6121 tsoots 462
        PrinterOpts = "";
6119 tsoots 463
        if (!cdia)
464
                cdia = new CupsOptions(this, Geraet);
465
        struct CupsOptions::OpData daten;
466
        QMap<QString,CupsOptions::OpData>::Iterator it;
467
        for (it = cdia->KeyToText.begin(); it != cdia->KeyToText.end(); ++it)
468
        {
469
                if (cdia->KeyToDefault[it.key()] != cdia->FlagsOpt.at(it.data().Cnum)->currentText())
161 Franz 470
                {
6119 tsoots 471
                        if (it.data().KeyW == "mirror")
472
                                PrinterOpts += " -o mirror";
473
                        else
3 paul 474
                        {
6119 tsoots 475
                                if (it.data().KeyW == "page-set")
476
                                {
477
                                        PrinterOpts += " -o "+it.data().KeyW+"=";
478
                                        if (cdia->FlagsOpt.at(it.data().Cnum)->currentItem() == 1)
479
                                                PrinterOpts += "even";
480
                                        else
481
                                                PrinterOpts += "odd";
482
                                }
3 paul 483
                                else
161 Franz 484
                                {
6119 tsoots 485
                                        if (it.data().KeyW == "number-up")
3 paul 486
                                        {
487
                                                PrinterOpts += " -o "+it.data().KeyW+"=";
6119 tsoots 488
                                                switch (cdia->FlagsOpt.at(it.data().Cnum)->currentItem())
3 paul 489
                                                {
248 Franz 490
                                                        case 1:
491
                                                                PrinterOpts += "2";
492
                                                                break;
493
                                                        case 2:
494
                                                                PrinterOpts += "4";
495
                                                                break;
496
                                                        case 3:
497
                                                                PrinterOpts += "6";
498
                                                                break;
499
                                                        case 4:
500
                                                                PrinterOpts += "9";
501
                                                                break;
502
                                                        case 5:
503
                                                                PrinterOpts += "16";
504
                                                                break;
161 Franz 505
                                                }
6119 tsoots 506
                                        }
507
                                        else
508
                                        {
509
                                                if (it.data().KeyW == "orientation")
510
                                                        PrinterOpts += " -o landscape";
3 paul 511
                                                else
6119 tsoots 512
                                                        PrinterOpts += " -o " +
513
                                                                        it.data().KeyW+"="+cdia->FlagsOpt.at(it.data().Cnum)->currentText();
3 paul 514
                                        }
515
                                }
161 Franz 516
                        }
248 Franz 517
                }
161 Franz 518
        }
4361 cbradney 519
#endif
3 paul 520
}
521
 
522
void Druck::SelComm()
523
{
223 Franz 524
        /* PFJ - 29.02.04 - removed OthText, Command and PrintDest from switch */
525
        bool test = OtherCom->isChecked() ? true : false;
526
        OthText->setEnabled(test);
527
        Command->setEnabled(test);
528
        PrintDest->setEnabled(!test);
3 paul 529
        if (OtherCom->isChecked())
161 Franz 530
        {
248 Franz 531
                DateiT->setEnabled(false);
532
                LineEdit1->setEnabled(false);
533
                ToolButton1->setEnabled(false);
534
                ToFile = false;
4361 cbradney 535
#if defined(HAVE_CUPS) || defined(_WIN32)
3 paul 536
                OptButton->setEnabled(false);
537
#endif
248 Franz 538
 
539
        }
3 paul 540
        else
161 Franz 541
        {
3 paul 542
                SelPrinter(PrintDest->currentText());
4361 cbradney 543
#if defined(HAVE_CUPS) || defined(_WIN32)
3 paul 544
                if (Geraet != tr("File"))
545
                        OptButton->setEnabled(true);
546
#endif
161 Franz 547
        }
3 paul 548
}
549
 
550
void Druck::SelPrinter(const QString& prn)
551
{
80 Franz 552
        bool setter = prn == tr("File") ? true : false;
161 Franz 553
        DateiT->setEnabled(setter);
554
        LineEdit1->setEnabled(setter);
555
        ToolButton1->setEnabled(setter);
556
        ToFile = setter;
4361 cbradney 557
        prefs->set("CurrentPrn", prn);
558
#if defined(HAVE_CUPS) || defined(_WIN32)
85 Franz 559
        OptButton->setEnabled(!setter);
3 paul 560
#endif
4506 cbradney 561
#if defined(_WIN32)
4361 cbradney 562
        if ( !ToFile )
4506 cbradney 563
                if( !PrinterUtil::getDefaultSettings(PrintDest->currentText(), DevMode) )
6260 fschmid 564
                        qWarning( tr("Failed to retrieve printer settings"));
4506 cbradney 565
#endif
4504 cbradney 566
        if ( ToFile || PrinterUtil::isPostscriptPrinter(PrintDest->currentText()) )
4361 cbradney 567
        {
568
                psLevel->setEnabled( true );
569
                PrintSep->setEnabled( true );
5880 jghali 570
                if (m_doc->HasCMS)
4361 cbradney 571
                        UseICC->setEnabled( true );
572
        }
573
        else
574
        {
575
                psLevel->setEnabled( false );
576
                PrintSep->setCurrentText( tr("Print Normal") );
577
                PrintSep->setEnabled( false );
578
                SepArt->setCurrentText( tr("All") );
579
                SepArt->setEnabled( false );
580
                ToSeparation = false;
5880 jghali 581
                if (m_doc->HasCMS)
4361 cbradney 582
                {
583
                        UseICC->setEnabled( false );
584
                        UseICC->setChecked( false );
585
                }
586
        }
3 paul 587
        Geraet = prn;
588
}
589
 
590
void Druck::SelRange(bool e)
591
{
6663 cbradney 592
        pageNr->setEnabled(!e);
593
        pageNrButton->setEnabled(!e);
3 paul 594
}
595
 
3234 fschmid 596
void Druck::SelMode(int e)
3 paul 597
{
3234 fschmid 598
        if (e == 0)
599
        {
600
                SepArt->setEnabled( false );
601
                ToSeparation = false;
602
        }
603
        else
604
        {
605
                SepArt->setEnabled( true );
606
                ToSeparation = true;
607
        }
3 paul 608
}
609
 
610
void Druck::SelFile()
611
{
2856 cbradney 612
        PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
415 Franz 613
        QString wdir = dirs->get("druck", ".");
5846 jghali 614
        CustomFDialog dia(this, wdir, tr("Save as"), tr("PostScript Files (*.ps);;All Files (*)"), fdNone);
2877 cbradney 615
        if (!LineEdit1->text().isEmpty())
3 paul 616
                dia.setSelection(LineEdit1->text());
617
        if (dia.exec() == QDialog::Accepted)
415 Franz 618
        {
619
                QString selectedFile = dia.selectedFile();
620
                dirs->set("druck", selectedFile.left(selectedFile.findRev("/")));
7117 jghali 621
                LineEdit1->setText( QDir::convertSeparators(selectedFile) );
415 Franz 622
        }
3 paul 623
}
624
 
307 Franz 625
void Druck::setMinMax(int min, int max, int cur)
3 paul 626
{
329 Franz 627
        QString tmp, tmp2;
2397 cbradney 628
        CurrentPage->setText( tr( "Print Current Pa&ge" )+" ("+tmp.setNum(cur)+")");
6663 cbradney 629
        pageNr->setText(tmp.setNum(min)+"-"+tmp2.setNum(max));
3 paul 630
}
631
 
6690 fschmid 632
void Druck::storeValues()
451 tsoots 633
{
6119 tsoots 634
        getOptions(); // options were not set get last options with this hack
7104 fschmid 635
 
636
        m_doc->Print_Options.printer = PrintDest->currentText();
7117 jghali 637
        m_doc->Print_Options.filename = ScPaths::separatorsToSlashes(LineEdit1->text());
7104 fschmid 638
        m_doc->Print_Options.toFile = ToFile;
639
        m_doc->Print_Options.copies = numCopies();
640
        m_doc->Print_Options.outputSeparations = outputSeparations();
641
        m_doc->Print_Options.separationName = separationName();
642
        m_doc->Print_Options.allSeparations = allSeparations();
643
        if (m_doc->Print_Options.outputSeparations)
644
                m_doc->Print_Options.useSpotColors = true;
645
        else
646
                m_doc->Print_Options.useSpotColors = doSpot();
647
        m_doc->Print_Options.useColor = color();
648
        m_doc->Print_Options.mirrorH = mirrorHorizontal();
649
        m_doc->Print_Options.mirrorV = mirrorVertical();
650
        m_doc->Print_Options.useICC = ICCinUse();
651
        m_doc->Print_Options.doClip = doClip();
652
        m_doc->Print_Options.doGCR = doGCR();
653
        m_doc->Print_Options.PSLevel = PSLevel();
654
        m_doc->Print_Options.setDevParam = doDev();
655
        m_doc->Print_Options.doOverprint = doOverprint();
7225 cbradney 656
        m_doc->Print_Options.bleeds.Top = BleedTop->value() / m_doc->unitRatio();
657
        m_doc->Print_Options.bleeds.Left = BleedLeft->value() / m_doc->unitRatio();
658
        m_doc->Print_Options.bleeds.Right = BleedRight->value() / m_doc->unitRatio();
659
        m_doc->Print_Options.bleeds.Bottom = BleedBottom->value() / m_doc->unitRatio();
7104 fschmid 660
        m_doc->Print_Options.markOffset = markOffset->value() / m_doc->unitRatio();
661
        m_doc->Print_Options.cropMarks = cropMarks->isChecked();
662
        m_doc->Print_Options.bleedMarks = bleedMarks->isChecked();
663
        m_doc->Print_Options.registrationMarks = registrationMarks->isChecked();
664
        m_doc->Print_Options.colorMarks = colorMarks->isChecked();
665
        if (OtherCom->isChecked())
666
        {
667
                m_doc->Print_Options.printerCommand = Command->text();
668
                m_doc->Print_Options.useAltPrintCommand = true;
669
        }
670
        else
671
                m_doc->Print_Options.useAltPrintCommand = false;
672
#ifdef HAVE_CUPS
673
                m_doc->Print_Options.printerOptions = PrinterOpts;
674
#else
675
                m_doc->Print_Options.printerOptions = QString("");
676
#endif
677
/*
451 tsoots 678
        prefs->set("PrintDest", PrintDest->currentItem());
4361 cbradney 679
        prefs->set("CurrentPrn", PrintDest->currentText());
451 tsoots 680
        prefs->set("OtherCom", OtherCom->isChecked());
681
        prefs->set("PrintAll", RadioButton1->isChecked());
682
        prefs->set("CurrentPage", CurrentPage->isChecked());
683
        prefs->set("PrintRange", RadioButton2->isChecked());
6663 cbradney 684
        prefs->set("PageNr", pageNr->text());
451 tsoots 685
        prefs->set("Copies", Copies->value());
3234 fschmid 686
        prefs->set("Separations", PrintSep->currentItem());
687
        prefs->set("PrintColor", colorType->currentItem());
451 tsoots 688
        prefs->set("SepArt", SepArt->currentItem());
3234 fschmid 689
        prefs->set("MirrorH", MirrorHor->isChecked());
690
        prefs->set("MirrorV", MirrorVert->isChecked());
691
        prefs->set("DoGCR", GcR->isChecked());
4649 fschmid 692
        prefs->set("Clip", ClipMarg->isChecked());
3234 fschmid 693
        prefs->set("PSLevel", psLevel->currentItem() + 1);
694
        prefs->set("doDev", devPar->isChecked());
695
        prefs->set("doSpot", !spotColors->isChecked());
5308 fschmid 696
        prefs->set("doOverprint", overprintMode->isChecked());
5880 jghali 697
        if (m_doc->HasCMS)
3234 fschmid 698
                prefs->set("ICCinUse", UseICC->isChecked());
6954 fschmid 699
        prefs->set("BleedTop", BleedTop->value() / unitRatio);
700
        prefs->set("BleedBottom", BleedBottom->value() / unitRatio);
701
        prefs->set("BleedRight", BleedRight->value() / unitRatio);
702
        prefs->set("BleedLeft", BleedLeft->value() / unitRatio);
703
        prefs->set("markOffset", markOffset->value() / unitRatio);
704
        prefs->set("cropMarks", cropMarks->isChecked());
705
        prefs->set("bleedMarks", bleedMarks->isChecked());
706
        prefs->set("registrationMarks", registrationMarks->isChecked());
7104 fschmid 707
        prefs->set("colorMarks", colorMarks->isChecked()); */
6690 fschmid 708
}
709
 
710
void Druck::okButtonClicked()
711
{
712
        storeValues();
3234 fschmid 713
        accept();
451 tsoots 714
}
715
 
6690 fschmid 716
void Druck::previewButtonClicked()
717
{
718
        storeValues();
719
        emit doPreview();
720
}
721
 
3234 fschmid 722
void Druck::setStoredValues(bool gcr)
451 tsoots 723
{
7104 fschmid 724
        if (m_doc->Print_Options.firstUse)
451 tsoots 725
        {
7104 fschmid 726
                int selectedDest = prefs->getInt("PrintDest", 0);
727
                if ((selectedDest > -1) && (selectedDest < PrintDest->count()))
728
                {
729
                        PrintDest->setCurrentItem(selectedDest);
730
                        prefs->set("CurrentPrn", PrintDest->currentText());
731
                        if (PrintDest->currentText() == tr("File"))
732
                                SelPrinter( tr("File"));
733
                        Geraet = PrintDest->currentText();
734
                }
735
                OtherCom->setChecked(prefs->getBool("OtherCom", false));
736
                if (OtherCom->isChecked())
7109 fschmid 737
                {
7104 fschmid 738
                        SelComm();
7109 fschmid 739
                        Command->setText(prefs->get("Command", ""));
740
                }
7104 fschmid 741
                RadioButton1->setChecked(prefs->getBool("PrintAll", true));
742
                CurrentPage->setChecked(prefs->getBool("CurrentPage", false));
743
                bool printRangeChecked=prefs->getBool("PrintRange", false);
744
                RadioButton2->setChecked(printRangeChecked);
745
                pageNr->setEnabled(printRangeChecked);
746
                pageNr->setText(prefs->get("PageNr", "1-1"));
747
                Copies->setValue(prefs->getInt("Copies", 1));
748
                PrintSep->setCurrentItem(prefs->getInt("Separations", 0));
749
                colorType->setCurrentItem(prefs->getInt("PrintColor", 0));
750
                int selectedSep = prefs->getInt("SepArt", 0);
751
                if ((selectedSep > -1) && (selectedSep < 5))
752
                        SepArt->setCurrentItem(selectedSep);
753
                if (PrintSep->currentItem() == 1)
754
                {
755
                        SepArt->setEnabled(true);
756
                        ToSeparation = true;
757
                }
758
                psLevel->setCurrentItem(prefs->getInt("PSLevel", 3)-1);
759
                MirrorHor->setChecked(prefs->getBool("MirrorH", false));
760
                MirrorVert->setChecked(prefs->getBool("MirrorV", false));
761
                devPar->setChecked(prefs->getBool("doDev", false));
762
                GcR->setChecked(prefs->getBool("DoGCR", gcr));
763
                ClipMarg->setChecked(prefs->getBool("Clip", false));
764
                spotColors->setChecked(!prefs->getBool("doSpot", true));
765
                overprintMode->setChecked(prefs->getBool("doOverprint", false));
766
                if (m_doc->HasCMS)
767
                {
768
                        bool iccInUse = prefs->getBool("ICCinUse", false);
769
                        bool psPrinter = PrinterUtil::isPostscriptPrinter(PrintDest->currentText()) || ToFile;
770
                        UseICC->setChecked( psPrinter ? iccInUse : false );
771
                        UseICC->setEnabled( psPrinter );
772
                }
773
                BleedTop->setValue(prefs->getDouble("BleedTop",0.0)*unitRatio);
774
                BleedBottom->setValue(prefs->getDouble("BleedBottom",0.0)*unitRatio);
775
                BleedRight->setValue(prefs->getDouble("BleedRight",0.0)*unitRatio);
776
                BleedLeft->setValue(prefs->getDouble("BleedLeft",0.0)*unitRatio);
777
                markOffset->setValue(prefs->getDouble("markOffset",0.0)*unitRatio);
778
                cropMarks->setChecked(prefs->getBool("cropMarks", false));
779
                bleedMarks->setChecked(prefs->getBool("bleedMarks", false));
780
                registrationMarks->setChecked(prefs->getBool("registrationMarks", false));
781
                colorMarks->setChecked(prefs->getBool("colorMarks", false));
451 tsoots 782
        }
7104 fschmid 783
        else
6688 fschmid 784
        {
7104 fschmid 785
                int selectedDest = prefs->getInt("PrintDest", 0);
786
                if ((selectedDest > -1) && (selectedDest < PrintDest->count()))
787
                {
788
                        PrintDest->setCurrentItem(selectedDest);
789
                        prefs->set("CurrentPrn", PrintDest->currentText());
790
                        if (PrintDest->currentText() == tr("File"))
791
                                SelPrinter( tr("File"));
792
                        Geraet = PrintDest->currentText();
793
                }
794
                OtherCom->setChecked(m_doc->Print_Options.useAltPrintCommand);
795
                if (OtherCom->isChecked())
796
                {
797
                        SelComm();
798
                        Command->setText(m_doc->Print_Options.printerCommand);
799
                }
800
                RadioButton1->setChecked(prefs->getBool("PrintAll", true));
801
                CurrentPage->setChecked(prefs->getBool("CurrentPage", false));
802
                bool printRangeChecked=prefs->getBool("PrintRange", false);
803
                RadioButton2->setChecked(printRangeChecked);
804
                pageNr->setEnabled(printRangeChecked);
805
                pageNr->setText(prefs->get("PageNr", "1-1"));
806
                Copies->setValue(1);
807
                PrintSep->setCurrentItem(m_doc->Print_Options.outputSeparations);
9731 avox 808
                colorType->setCurrentItem(m_doc->Print_Options.useColor? 0 : 1);
7104 fschmid 809
                ColorList usedSpots;
810
                m_doc->getUsedColors(usedSpots, true);
811
                QStringList spots = usedSpots.keys();
812
                spots.prepend( tr("Black"));
813
                spots.prepend( tr("Yellow"));
814
                spots.prepend( tr("Magenta"));
815
                spots.prepend( tr("Cyan"));
816
                spots.prepend( tr("All"));
817
                int selectedSep = spots.findIndex(m_doc->Print_Options.separationName);
818
                if ((selectedSep > -1) && (selectedSep < SepArt->count()))
819
                        SepArt->setCurrentItem(selectedSep);
820
                if (PrintSep->currentItem() == 1)
821
                {
822
                        SepArt->setEnabled(true);
823
                        ToSeparation = true;
824
                }
825
                psLevel->setCurrentItem(m_doc->Print_Options.PSLevel-1);
826
                MirrorHor->setChecked(m_doc->Print_Options.mirrorH);
827
                MirrorVert->setChecked(m_doc->Print_Options.mirrorV);
828
                devPar->setChecked(m_doc->Print_Options.setDevParam);
829
                GcR->setChecked(m_doc->Print_Options.doGCR);
830
                ClipMarg->setChecked(m_doc->Print_Options.doClip);
831
                spotColors->setChecked(!m_doc->Print_Options.useSpotColors);
832
                overprintMode->setChecked(m_doc->Print_Options.doOverprint);
833
                if (m_doc->HasCMS)
834
                {
835
                        bool iccInUse = m_doc->Print_Options.useICC;
836
                        bool psPrinter = PrinterUtil::isPostscriptPrinter(PrintDest->currentText()) || ToFile;
837
                        UseICC->setChecked( psPrinter ? iccInUse : false );
838
                        UseICC->setEnabled( psPrinter );
839
                }
7225 cbradney 840
                BleedTop->setValue(m_doc->Print_Options.bleeds.Top*unitRatio);
841
                BleedBottom->setValue(m_doc->Print_Options.bleeds.Bottom*unitRatio);
842
                BleedRight->setValue(m_doc->Print_Options.bleeds.Right*unitRatio);
843
                BleedLeft->setValue(m_doc->Print_Options.bleeds.Left*unitRatio);
7104 fschmid 844
                markOffset->setValue(m_doc->Print_Options.markOffset*unitRatio);
845
                cropMarks->setChecked(m_doc->Print_Options.cropMarks);
846
                bleedMarks->setChecked(m_doc->Print_Options.bleedMarks);
847
                registrationMarks->setChecked(m_doc->Print_Options.registrationMarks);
848
                colorMarks->setChecked(m_doc->Print_Options.colorMarks);
6688 fschmid 849
        }
451 tsoots 850
}
851
 
3 paul 852
QString Druck::printerName()
853
{
854
        return Geraet;
855
}
856
 
857
QString Druck::outputFileName()
858
{
7117 jghali 859
        return ScPaths::separatorsToSlashes(LineEdit1->text());
3 paul 860
}
861
 
862
bool Druck::outputToFile()
863
{
864
        return ToFile;
865
}
866
 
867
int Druck::numCopies()
868
{
869
        return Copies->value();
870
}
871
 
872
bool Druck::outputSeparations()
873
{
874
        return ToSeparation;
875
}
876
 
877
QString Druck::separationName()
878
{
879
        return SepArt->currentText();
880
}
881
 
3068 fschmid 882
QStringList Druck::allSeparations()
883
{
884
        QStringList ret;
885
        for (int a = 1; a < SepArt->count(); ++a)
886
        {
887
                ret.append(SepArt->text(a));
888
        }
889
        return ret;
890
}
3234 fschmid 891
 
3 paul 892
bool Druck::color()
893
{
3234 fschmid 894
        if (colorType->currentItem() == 0)
895
                return true;
896
        else
897
                return false;
3 paul 898
}
3234 fschmid 899
 
900
bool Druck::mirrorHorizontal()
901
{
902
        return MirrorHor->isChecked();
903
}
904
 
905
bool Druck::mirrorVertical()
906
{
907
        return MirrorVert->isChecked();
908
}
909
 
910
bool Druck::doGCR()
911
{
912
        return GcR->isChecked();
913
}
914
 
4649 fschmid 915
bool Druck::doClip()
916
{
917
        return ClipMarg->isChecked();
918
}
919
 
3234 fschmid 920
int Druck::PSLevel()
921
{
922
        return psLevel->currentItem() + 1;
923
}
924
 
925
bool Druck::doDev()
926
{
927
        return devPar->isChecked();
928
}
929
 
930
bool Druck::doSpot()
931
{
932
        return !spotColors->isChecked();
933
}
934
 
5308 fschmid 935
bool Druck::doOverprint()
936
{
937
        return overprintMode->isChecked();
938
}
939
 
3234 fschmid 940
bool Druck::ICCinUse()
941
{
5880 jghali 942
        if (m_doc->HasCMS)
3234 fschmid 943
                return UseICC->isChecked();
944
        else
945
                return false;
946
}
6119 tsoots 947
 
6954 fschmid 948
void Druck::doDocBleeds()
949
{
950
        if (docBleeds->isChecked())
951
        {
952
                prefs->set("BleedTop", BleedTop->value() / unitRatio);
953
                prefs->set("BleedBottom", BleedBottom->value() / unitRatio);
954
                prefs->set("BleedRight", BleedRight->value() / unitRatio);
955
                prefs->set("BleedLeft", BleedLeft->value() / unitRatio);
7225 cbradney 956
                BleedTop->setValue(m_doc->bleeds.Top*unitRatio);
957
                BleedBottom->setValue(m_doc->bleeds.Bottom*unitRatio);
958
                BleedRight->setValue(m_doc->bleeds.Right*unitRatio);
959
                BleedLeft->setValue(m_doc->bleeds.Left*unitRatio);
6954 fschmid 960
                BleedTop->setEnabled(false);
961
                BleedBottom->setEnabled(false);
962
                BleedRight->setEnabled(false);
963
                BleedLeft->setEnabled(false);
964
        }
965
        else
966
        {
967
                BleedTop->setValue(prefs->getDouble("BleedTop",0.0)*unitRatio);
968
                BleedBottom->setValue(prefs->getDouble("BleedBottom",0.0)*unitRatio);
969
                BleedRight->setValue(prefs->getDouble("BleedRight",0.0)*unitRatio);
970
                BleedLeft->setValue(prefs->getDouble("BleedLeft",0.0)*unitRatio);
971
                BleedTop->setEnabled(true);
972
                BleedBottom->setEnabled(true);
973
                BleedRight->setEnabled(true);
974
                BleedLeft->setEnabled(true);
975
        }
976
}
6663 cbradney 977
 
978
void Druck::createPageNumberRange( )
6119 tsoots 979
{
6663 cbradney 980
        if (m_doc!=0)
981
        {
6775 cbradney 982
                CreateRange cr(pageNr->text(), m_doc->DocPages.count(), this);
6663 cbradney 983
                if (cr.exec())
984
                {
985
                        CreateRangeData crData;
986
                        cr.getCreateRangeData(crData);
987
                        pageNr->setText(crData.pageRange);
988
                        return;
989
                }
990
        }
991
        pageNr->setText(QString::null);
6119 tsoots 992
}