#include <qpainter.h>
#include <qapplication.h>
#include <qdatetime.h>
+#include <qimage.h>
const char* imageZoomCursor[] = {
"32 32 3 1",
#include <qptrlist.h>
#include <qlayout.h>
#include <qmap.h>
+#include <qpainter.h>
+#include <qpaintdevicemetrics.h>
#include <qwt_math.h>
#include <qwt_plot_canvas.h>
#include <iostream>
#include <stdlib.h>
+#include <qprinter.h>
#include <qwt_legend.h>
setTitle( myYTitleEnabled, yTitle + yUnits, YTitle, true );
setTitle( true, aTables.join("; "), MainTitle, true );
}
+
+bool Plot2d_ViewFrame::print( const QString& file, const QString& format ) const
+{
+#ifdef WIN32
+ return false;
+
+#else
+ bool res = false;
+ if( myPlot )
+ {
+ QPaintDevice* pd = 0;
+ if( format=="PS" )
+ {
+ QPrinter* pr = new QPrinter( QPrinter::HighResolution );
+ pr->setPageSize( QPrinter::A4 );
+ pr->setOutputToFile( true );
+ pr->setOutputFileName( file );
+ pr->setPrintProgram( "" );
+ pd = pr;
+ }
+
+ if( pd )
+ {
+ myPlot->print( *pd );
+ res = true;
+ delete pd;
+ }
+ }
+ return res;
+#endif
+}
bool isModeVerLinear();
bool isLegendShow() { return myShowLegend; };
+ virtual bool print( const QString& file, const QString& format ) const;
+
protected:
int testOperation( const QMouseEvent& );
void readPreferences();
#include <qlayout.h>
#include <qapplication.h>
#include <qpopupmenu.h>
+#include <qimage.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
QPixmap px = QPixmap::grabWindow( myViewFrame->winId() );
return px.convertToImage();
}
+
+bool Plot2d_ViewWindow::dumpViewToFormat( const QString& fileName, const QString& format )
+{
+ bool res = myViewFrame ? myViewFrame->print( fileName, format ) : false;
+ if( !res )
+ res = SUIT_ViewWindow::dumpViewToFormat( fileName, format );
+
+ return res;
+}
+
+QString Plot2d_ViewWindow::filter() const
+{
+ return SUIT_ViewWindow::filter() + ";;" + tr( "POSTSCRIPT_FILES" );
+}
void contextMenuPopup( QPopupMenu* thePopup );
protected:
- QImage dumpView();
+ virtual QImage dumpView();
+ virtual QString filter() const;
+ virtual bool dumpViewToFormat( const QString& fileName, const QString& format );
private:
bool eventFilter(QObject* watched, QEvent* e);
#include "SUIT_ViewManager.h"
#include "SUIT_Tools.h"
#include "SUIT_MessageBox.h"
-#include "qhbox.h"
-#include "qpopupmenu.h"
-#include "qapplication.h"
+#include <qhbox.h>
+#include <qpopupmenu.h>
+#include <qapplication.h>
+#include <qimage.h>
/*!\class SUIT_ViewWindow
* Class provide view window.
{
}
+void SUIT_ViewWindow::setViewManager( SUIT_ViewManager* theManager )
+{
+ myManager = theManager;
+}
+
+SUIT_ViewManager* SUIT_ViewWindow::getViewManager() const
+{
+ return myManager;
+}
+
+QImage SUIT_ViewWindow::dumpView()
+{
+ return QImage();
+}
+
+bool SUIT_ViewWindow::dumpViewToFormat( const QString& fileName, const QString& format )
+{
+ QImage img = dumpView();
+ if( img.isNull() )
+ return false;
+
+ QString fmt = format;
+ if( fmt.isEmpty() )
+ fmt = QString( "BMP" ); // default format
+ else if( fmt == "JPG" )
+ fmt = "JPEG";
+
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ bool res = img.save( fileName, fmt.latin1() );
+ QApplication::restoreOverrideCursor();
+ return res;
+}
+
/*! Close event \a theEvent.
*/
void SUIT_ViewWindow::closeEvent(QCloseEvent* theEvent)
qApp->postEvent( this, new QCustomEvent( DUMP_EVENT ) );
}
+QString SUIT_ViewWindow::filter() const
+{
+ return tr( "TLT_IMAGE_FILES" );
+}
+
/*! Reaction view window on event \a e.
*/
bool SUIT_ViewWindow::event( QEvent* e )
{
- if ( e->type() == DUMP_EVENT ) {
+ if ( e->type() == DUMP_EVENT )
+ {
bool bOk = false;
- if ( myManager && myManager->study() && myManager->study()->application() ) {
- // first create an image (this is small trick to avoid dialog box overlapping)
- QImage img = dumpView();
- if ( !img.isNull() ) {
- // get file name
- QString fileName = myManager->study()->application()->getFileName( false, QString::null, tr( "TLT_IMAGE_FILES" ), tr( "TLT_DUMP_VIEW" ), 0 );
- if ( !fileName.isEmpty() ) {
- QString fmt = SUIT_Tools::extension( fileName ).upper();
- if ( fmt.isEmpty() ) fmt = QString( "BMP" ); // default format
- if ( fmt == "JPG" ) fmt = "JPEG";
- QApplication::setOverrideCursor( Qt::waitCursor );
- bOk = img.save( fileName, fmt.latin1() );
- QApplication::restoreOverrideCursor();
- }
- else {
- bOk = true; // cancelled
- }
+ if ( myManager && myManager->study() && myManager->study()->application() )
+ {
+ // get file name
+ SUIT_Application* app = myManager->study()->application();
+ QString fileName = app->getFileName( false, QString::null, filter(), tr( "TLT_DUMP_VIEW" ), 0 );
+ if( !fileName.isEmpty() )
+ {
+ QString fmt = SUIT_Tools::extension( fileName ).upper();
+ bOk = dumpViewToFormat( fileName, fmt );
+ }
+ else
+ {
+ bOk = true; // cancelled
}
}
if ( !bOk ) {
#include "SUIT.h"
#include <qmainwindow.h>
-#include <qimage.h>
class SUIT_Desktop;
class SUIT_ViewManager;
+class QImage;
class SUIT_EXPORT SUIT_ViewWindow: public QMainWindow
{
Q_OBJECT
public:
- SUIT_ViewWindow(SUIT_Desktop* theDesktop);
+ SUIT_ViewWindow( SUIT_Desktop* );
virtual ~SUIT_ViewWindow();
- void setViewManager(SUIT_ViewManager* theManager) { myManager = theManager;}
- SUIT_ViewManager* getViewManager() const { return myManager; }
+ void setViewManager( SUIT_ViewManager* );
+ SUIT_ViewManager* getViewManager() const;
bool event(QEvent*);
- virtual QImage dumpView() { return QImage(); }
+ virtual QImage dumpView();
+ virtual bool dumpViewToFormat( const QString& fileName, const QString& format );
+
void onAccelAction( int );
public slots:
virtual void onDumpView();
signals:
- void closing(SUIT_ViewWindow*);
- void mousePressed(SUIT_ViewWindow*, QMouseEvent*);
- void mouseReleased(SUIT_ViewWindow*, QMouseEvent*);
- void mouseDoubleClicked(SUIT_ViewWindow*, QMouseEvent*);
- void mouseMoving(SUIT_ViewWindow*, QMouseEvent*);
- void wheeling(SUIT_ViewWindow*, QWheelEvent*);
- void keyPressed(SUIT_ViewWindow*, QKeyEvent*);
- void keyReleased(SUIT_ViewWindow*, QKeyEvent*);
+ void closing( SUIT_ViewWindow* );
+ void mousePressed( SUIT_ViewWindow*, QMouseEvent* );
+ void mouseReleased( SUIT_ViewWindow*, QMouseEvent* );
+ void mouseDoubleClicked( SUIT_ViewWindow*, QMouseEvent* );
+ void mouseMoving( SUIT_ViewWindow*, QMouseEvent* );
+ void wheeling( SUIT_ViewWindow*, QWheelEvent* );
+ void keyPressed( SUIT_ViewWindow*, QKeyEvent* );
+ void keyReleased( SUIT_ViewWindow*, QKeyEvent* );
void contextMenuRequested( QContextMenuEvent *e );
protected:
- void closeEvent(QCloseEvent* theEvent);
- virtual void contextMenuEvent( QContextMenuEvent * e );
-
+ void closeEvent( QCloseEvent* );
+ virtual void contextMenuEvent( QContextMenuEvent* );
+ virtual QString filter() const;
virtual void action( const int );
SUIT_Desktop* myDesktop;
#include "SALOME_Actor.h"
#include <qapplication.h>
+#include <qimage.h>
#include <vtkTextProperty.h>
#include <vtkActorCollection.h>
#include "SUIT_ResourceMgr.h"
#include <qapplication.h>
+#include <qimage.h>
#include <vtkRenderer.h>
#include <vtkCamera.h>