/*
* This file is part of the KDE libraries
* Copyright (c) 2001 Michael Goffioul
*
* 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"
#include
#include
#include
#include
#include
#include
KPHpgl2Page::KPHpgl2Page(TQWidget *parent, const char *name)
: KPrintDialogPage(parent, name)
{
//WhatsThis strings.... (added by pfeifle@kde.org)
TQString whatsThisBlackplotHpgl2Page = i18n( " "
" Print in Black Only (Blackplot) "
" 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.
"
"
"
"
"
" Additional hint for power users: This TDEPrint GUI element matches "
" with the CUPS commandline job option parameter: "
"
"
" -o blackplot=true "
"
"
"
"
" " );
TQString whatsThisFitplotHpgl2Page = i18n( " "
" Scale Print Image to Page Size "
" The 'fitplot' option specifies that the HP-GL image should be scaled to fill "
" exactly the page with the (elsewhere selected) media size.
"
" 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.)
"
" Note: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.
"
"
"
"
"
" Additional hint for power users: This TDEPrint GUI element matches with the CUPS commandline job option parameter: "
"
"
" -o fitplot=true "
"
"
" "
" " );
TQString whatsThisPenwidthHpgl2Page = i18n( " "
" Set Pen Width for HP-GL (if not defined in file). "
" 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.
"
" Note: The penwidth option set here is ignored if the pen widths are set inside "
" the plot file itself..
"
"
"
"
"
" Additional hint for power users: This TDEPrint GUI element matches with the CUPS commandline job option parameter: "
"
"
" -o penwidth=... # example: \"2000\" or \"500\" "
"
"
" "
" " );
TQString whatsThisAllOptionsHpgl2Page = i18n( " "
" HP-GL Print Options "
" All options on this page are only applicable if you use TDEPrint to send HP-GL and "
" HP-GL/2 files to one of your printers.
"
" HP-GL and HP-GL/2 are page description languages developed by Hewlett-Packard to drive "
" Pen Plotting devices.
"
" TDEPrint can (with the help of CUPS) convert the HP-GL file format and print it "
" on any installed printer.
"
" Note 1: To print HP-GL files, start 'kprinter' and simply load the file into "
" the running kprinter.
"
" Note 2: 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).
"
"
"
"
"
" Additional hint for power users: These TDEPrint GUI elements match with CUPS commandline job option parameters: "
"
"
" -o blackplot=... # examples: \"true\" or \"false\" "
"
"
" -o fitplot=... # examples: \"true\" or \"false\" "
"
"
" -o penwidth=... # examples: \"true\" or \"false\" "
"
"
" "
" " );
setTitle("HP-GL/2");
TQGroupBox *box = new TQGroupBox(0, TQt::Vertical, i18n("HP-GL/2 Options"), this);
m_blackplot = new TQCheckBox(i18n("&Use only black pen"), box);
TQWhatsThis::add(m_blackplot, whatsThisBlackplotHpgl2Page);
m_fitplot = new TQCheckBox(i18n("&Fit plot to page"), box);
TQWhatsThis::add(m_fitplot, whatsThisFitplotHpgl2Page);
m_penwidth = new KIntNumInput(1000, box);
m_penwidth->setLabel(i18n("&Pen width:"), TQt::AlignLeft|TQt::AlignVCenter);
m_penwidth->setSuffix(" [um]");
m_penwidth->setRange(0, 10000, 100, true);
TQWhatsThis::add(m_penwidth, whatsThisPenwidthHpgl2Page);
TQVBoxLayout *l0 = new TQVBoxLayout(this, 0, 10);
l0->addWidget(box);
l0->addStretch(1);
TQVBoxLayout *l1 = new TQVBoxLayout(TQT_TQLAYOUT(box->layout()), 10);
l1->addWidget(m_blackplot);
l1->addWidget(m_fitplot);
l1->addWidget(m_penwidth);
TQWhatsThis::add(this, whatsThisAllOptionsHpgl2Page);
}
KPHpgl2Page::~KPHpgl2Page()
{
}
void KPHpgl2Page::setOptions(const TQMap& opts)
{
TQString value;
if (opts.contains("blackplot") && ((value=opts["blackplot"]).isEmpty() || value == "true"))
m_blackplot->setChecked(true);
if (opts.contains("fitplot") && ((value=opts["fitplot"]).isEmpty() || value == "true"))
m_fitplot->setChecked(true);
if (!(value=opts["penwidth"]).isEmpty())
m_penwidth->setValue(value.toInt());
}
void KPHpgl2Page::getOptions(TQMap& opts, bool incldef)
{
if (incldef || m_penwidth->value() != 1000)
opts["penwidth"] = TQString::number(m_penwidth->value());
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");
}