You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
6.6 KiB
170 lines
6.6 KiB
15 years ago
|
/*
|
||
|
* This file is part of the KDE libraries
|
||
13 years ago
|
* Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
|
||
15 years ago
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Library General Public
|
||
|
* License version 2 as published by the Free Software Foundation.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Library General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Library General Public License
|
||
|
* along with this library; see the file COPYING.LIB. If not, write to
|
||
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
**/
|
||
|
|
||
|
#include "kphpgl2page.h"
|
||
|
|
||
14 years ago
|
#include <tqcheckbox.h>
|
||
|
#include <tqgroupbox.h>
|
||
|
#include <tqlayout.h>
|
||
|
#include <tqwhatsthis.h>
|
||
15 years ago
|
#include <klocale.h>
|
||
|
#include <knuminput.h>
|
||
|
|
||
14 years ago
|
KPHpgl2Page::KPHpgl2Page(TQWidget *parent, const char *name)
|
||
15 years ago
|
: KPrintDialogPage(parent, name)
|
||
|
{
|
||
|
//WhatsThis strings.... (added by pfeifle@kde.org)
|
||
14 years ago
|
TQString whatsThisBlackplotHpgl2Page = i18n( " <qt> "
|
||
15 years ago
|
" <b>Print in Black Only (Blackplot)</b> "
|
||
|
" <p>The \'blackplot\' option specifies that all pens should plot in black-only:"
|
||
|
" The default is to use the colors defined in the plot file, or the standard "
|
||
|
" pen colors defined in the HP-GL/2 reference manual from Hewlett Packard. </p> "
|
||
|
" <br> "
|
||
|
" <hr> "
|
||
|
" <p><em><b>Additional hint for power users:</b> This KDEPrint GUI element matches "
|
||
|
" with the CUPS commandline job option parameter:</em> "
|
||
|
" <pre>"
|
||
|
" -o blackplot=true "
|
||
|
" </pre> "
|
||
|
" </p> "
|
||
|
" </qt>" );
|
||
|
|
||
14 years ago
|
TQString whatsThisFitplotHpgl2Page = i18n( " <qt> "
|
||
15 years ago
|
" <b>Scale Print Image to Page Size</b> "
|
||
|
" <p>The 'fitplot' option specifies that the HP-GL image should be scaled to fill "
|
||
|
" exactly the page with the (elsewhere selected) media size. </p> "
|
||
|
" <p>The default is 'fitplot is disabled'. The default will therefore use the absolute "
|
||
|
" distances specified in the plot file. (You should be aware that HP-GL files are very "
|
||
|
" often CAD drawings intended for large format plotters. On standard office printers "
|
||
|
" they will therefore lead to the drawing printout being spread across multiple pages.) </p> "
|
||
|
" <p><b>Note:</b>This feature depends upon an accurate plot size (PS) command in the "
|
||
|
" HP-GL/2 file. If no plot size is given in the file the filter converting the HP-GL "
|
||
|
" to PostScript assumes the plot is ANSI E size. </p> "
|
||
|
" <br> "
|
||
|
" <hr> "
|
||
|
" <p><em><b>Additional hint for power users:</b> This KDEPrint GUI element matches with the CUPS commandline job option parameter:</em> "
|
||
|
" <pre> "
|
||
|
" -o fitplot=true "
|
||
|
" </pre>"
|
||
|
" </p> "
|
||
|
" </qt>" );
|
||
|
|
||
14 years ago
|
TQString whatsThisPenwidthHpgl2Page = i18n( " <qt> "
|
||
15 years ago
|
" <b>Set Pen Width for HP-GL (if not defined in file)</b>. "
|
||
|
" <p>The pen width value can be set here in case the original HP-GL file does not have it "
|
||
|
" set. The pen width specifies the value in micrometers. The default value of 1000 produces "
|
||
|
" lines that are 1000 micrometers == 1 millimeter in width. Specifying a pen width of 0 "
|
||
|
" produces lines that are exactly 1 pixel wide. </p> "
|
||
|
" <p><b>Note:</b> The penwidth option set here is ignored if the pen widths are set inside "
|
||
|
" the plot file itself..</p> "
|
||
|
" <br> "
|
||
|
" <hr> "
|
||
|
" <p><em><b>Additional hint for power users:</b> This KDEPrint GUI element matches with the CUPS commandline job option parameter:</em> "
|
||
|
" <pre>"
|
||
|
" -o penwidth=... # example: \"2000\" or \"500\" "
|
||
|
" </pre>"
|
||
|
" </p> "
|
||
|
" </qt>" );
|
||
|
|
||
14 years ago
|
TQString whatsThisAllOptionsHpgl2Page = i18n( " <qt> "
|
||
15 years ago
|
" <b>HP-GL Print Options</b> "
|
||
|
" <p>All options on this page are only applicable if you use KDEPrint to send HP-GL and "
|
||
|
" HP-GL/2 files to one of your printers. </p> "
|
||
|
" <p>HP-GL and HP-GL/2 are page description languages developed by Hewlett-Packard to drive "
|
||
|
" Pen Plotting devices. </p> "
|
||
|
" <p>KDEPrint can (with the help of CUPS) convert the HP-GL file format and print it "
|
||
|
" on any installed printer. </p> "
|
||
|
" <p><b>Note 1:</b> To print HP-GL files, start 'kprinter' and simply load the file into "
|
||
|
" the running kprinter.</p>"
|
||
|
" <p><b>Note 2:</b> The 'fitplot' parameter provided on this dialog does also work for "
|
||
|
" printing PDF files (if your CUPS version is more recent than 1.1.22).</p> "
|
||
|
" <br> "
|
||
|
" <hr> "
|
||
|
" <p><em><b>Additional hint for power users:</b> These KDEPrint GUI elements match with CUPS commandline job option parameters:</em> "
|
||
|
" <pre>"
|
||
|
" -o blackplot=... # examples: \"true\" or \"false\" "
|
||
|
" <br> "
|
||
|
" -o fitplot=... # examples: \"true\" or \"false\" "
|
||
|
" <br> "
|
||
|
" -o penwidth=... # examples: \"true\" or \"false\" "
|
||
|
" </pre>"
|
||
|
" </p> "
|
||
|
" </qt>" );
|
||
|
|
||
|
|
||
|
setTitle("HP-GL/2");
|
||
|
|
||
14 years ago
|
TQGroupBox *box = new TQGroupBox(0, Qt::Vertical, i18n("HP-GL/2 Options"), this);
|
||
15 years ago
|
|
||
14 years ago
|
m_blackplot = new TQCheckBox(i18n("&Use only black pen"), box);
|
||
|
TQWhatsThis::add(m_blackplot, whatsThisBlackplotHpgl2Page);
|
||
15 years ago
|
|
||
14 years ago
|
m_fitplot = new TQCheckBox(i18n("&Fit plot to page"), box);
|
||
|
TQWhatsThis::add(m_fitplot, whatsThisFitplotHpgl2Page);
|
||
15 years ago
|
|
||
|
m_penwidth = new KIntNumInput(1000, box);
|
||
|
m_penwidth->setLabel(i18n("&Pen width:"), Qt::AlignLeft|Qt::AlignVCenter);
|
||
|
m_penwidth->setSuffix(" [um]");
|
||
|
m_penwidth->setRange(0, 10000, 100, true);
|
||
14 years ago
|
TQWhatsThis::add(m_penwidth, whatsThisPenwidthHpgl2Page);
|
||
15 years ago
|
|
||
14 years ago
|
TQVBoxLayout *l0 = new TQVBoxLayout(this, 0, 10);
|
||
15 years ago
|
l0->addWidget(box);
|
||
|
l0->addStretch(1);
|
||
|
|
||
14 years ago
|
TQVBoxLayout *l1 = new TQVBoxLayout(TQT_TQLAYOUT(box->layout()), 10);
|
||
15 years ago
|
l1->addWidget(m_blackplot);
|
||
|
l1->addWidget(m_fitplot);
|
||
|
l1->addWidget(m_penwidth);
|
||
14 years ago
|
TQWhatsThis::add(this, whatsThisAllOptionsHpgl2Page);
|
||
15 years ago
|
}
|
||
|
|
||
|
KPHpgl2Page::~KPHpgl2Page()
|
||
|
{
|
||
|
}
|
||
|
|
||
14 years ago
|
void KPHpgl2Page::setOptions(const TQMap<TQString,TQString>& opts)
|
||
15 years ago
|
{
|
||
14 years ago
|
TQString value;
|
||
13 years ago
|
if (opts.contains("blackplot") && ((value=opts["blackplot"]).isEmpty() || value == "true"))
|
||
15 years ago
|
m_blackplot->setChecked(true);
|
||
13 years ago
|
if (opts.contains("fitplot") && ((value=opts["fitplot"]).isEmpty() || value == "true"))
|
||
15 years ago
|
m_fitplot->setChecked(true);
|
||
|
if (!(value=opts["penwidth"]).isEmpty())
|
||
|
m_penwidth->setValue(value.toInt());
|
||
|
}
|
||
|
|
||
14 years ago
|
void KPHpgl2Page::getOptions(TQMap<TQString,TQString>& opts, bool incldef)
|
||
15 years ago
|
{
|
||
|
if (incldef || m_penwidth->value() != 1000)
|
||
14 years ago
|
opts["penwidth"] = TQString::number(m_penwidth->value());
|
||
15 years ago
|
if (m_blackplot->isChecked())
|
||
|
opts["blackplot"] = "true";
|
||
|
else if (incldef)
|
||
|
opts["blackplot"] = "false";
|
||
|
else
|
||
|
opts.remove("blackplot");
|
||
|
if (m_fitplot->isChecked())
|
||
|
opts["fitplot"] = "true";
|
||
|
else if (incldef)
|
||
|
opts["fitplot"] = "false";
|
||
|
else
|
||
|
opts.remove("fitplot");
|
||
|
}
|