casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
QtViewerPrintGui.qo.h
Go to the documentation of this file.
00001 //# QtViewerPrintGui.qo.h:  Printing dialog for QtViewer
00002 //# Copyright (C) 2005
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef QTVIEWERPRINTGUI_H
00029 #define QTVIEWERPRINTGUI_H
00030 
00031 
00032 #include <casa/aips.h>
00033 
00034 #include <graphics/X11/X_enter.h>
00035 #  include <QtCore>
00036 #  include <QtGui>
00037 #  include <QtXml/QDomDocument>
00038    //#dk Be careful to put *.ui.h within X_enter/exit bracket too,
00039    //#   because they'll have Qt includes.
00040    //#   E.g. <QApplication> needs the X11 definition of 'Display'
00041 #  include <display/QtViewer/printControl.ui.h>
00042 #include <graphics/X11/X_exit.h>
00043 
00044 
00045 #include <display/QtAutoGui/QtGuiEntry.qo.h>
00046 #include <display/QtAutoGui/QtXmlRecord.h>
00047 #include <display/QtViewer/QtDisplayPanel.qo.h>
00048 
00049 
00050 namespace casa { //# NAMESPACE CASA - BEGIN
00051 
00052 
00054 
00055 // <summary>
00056 // viewer print widget
00057 // </summary>
00058 
00059 class QtViewerPrintGui : public QWidget
00060 {
00061     Q_OBJECT
00062 
00063 public:
00064 
00065     QtViewerPrintGui(QtDisplayPanel *dp);
00066     ~QtViewerPrintGui();
00067   
00068     QString printFileName() const;
00069     QString printerName() const;
00070     bool load(QDomDocument &doc);
00071     void loadRecord(Record rec);
00072     static const QString printRecord;
00073     void adjustEpsBoundingBox( const char *from, const char *to,
00074                                const QSize &wcmax, const QRect &viewport );
00075     void printPS(QPrinter *printer, const QString printerType);
00076     friend ostream& operator <<(ostream &os,const QtViewerPrintGui &obj);
00077     friend ostream& operator <<(ostream &os,const QPrinter &printer); 
00078 signals:
00079 
00080 private slots:
00081 public slots:
00082     void saveXPM();
00083     void savePS(QPixmap*, int, int);
00084     void print();
00085     void dismiss();
00086     void itemValueChanged(QString name, QString value, int action, bool apply);
00087     void ps2eps(const QString &filename, QRect rect);
00088     void printToFile(const QString &filename,bool isEPS);
00089     void selectOutputType( const QString & text );
00090 
00091 private:
00092     QDomDocument m_doc;
00093     QVBoxLayout *vboxLayout;
00094     QLabel* sizeLabel;
00095     QString printfilename;
00096     QString savefiletype;
00097     QString printmedia;
00098     QString printorientation;
00099     int printresolution;
00100     float printmagnification;
00101     QString printepsformat;
00102     std::pair<int, int> printimgresolution;
00103     double printimgsizefactor;
00104     QPrinter *printer;
00105     QtDisplayPanel *pDP;
00106     
00107 private slots:
00108     void dpResized(QSize panelSize, QSize canvasSize);
00109 };
00110 
00111 // <summary>
00112 // viewer print widget
00113 // </summary>
00114 
00115 // <synopsis>
00116 //  synopsis for the QtViewerPrintGui
00117 // </synopsis>
00118 
00120 class QtViewerPrintCtl : public QDialog, private Ui::PrintControl
00121 {
00122     Q_OBJECT
00123 public:
00124 
00125     QtViewerPrintCtl(QtViewerPrintGui *parent = 0);
00126     ~QtViewerPrintCtl();
00127     QString fileName() const;
00128     QString printerName() const;
00129     QString orientation() const;
00130     QString paper() const;
00131 
00132 signals:
00133    void printIt();
00134 private slots:
00135     void checkPrinter();
00136 public slots:
00137 
00138 private:
00139 
00140 };
00141 
00142 
00143 } //# NAMESPACE CASA - END
00144 
00145 #endif