+
+//****************************************************************
+void SUIT_ViewWindow::onDumpView()
+{
+ qApp->postEvent( this, new QPaintEvent( QRect( 0, 0, width(), height() ), TRUE ) );
+ qApp->postEvent( this, new QCustomEvent( DUMP_EVENT ) );
+}
+
+//****************************************************************
+bool SUIT_ViewWindow::event( QEvent* e )
+{
+ 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 ( !bOk ) {
+ SUIT_MessageBox::error1( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ), tr( "BUT_OK" ) );
+ }
+ return TRUE;
+ }
+ return QMainWindow::event( e );
+}
+
+//****************************************************************