}
//================================================================
-// Function : dumpViewToPSFormat
+// Function : dumpViewToFormat
// Purpose :
//================================================================
-bool GraphicsView_ViewFrame::dumpViewToPSFormat(const QString& fileName)
+bool GraphicsView_ViewFrame::dumpViewToFormat( const QImage& image, const QString& fileName, const QString& format )
{
- return myViewPort->dumpViewToPSFormat(fileName);
+ bool isOK = myViewPort->dumpViewToFormat(fileName, format);
+ if( !isOK )
+ isOK = SUIT_ViewWindow::dumpViewToFormat( image, fileName, format );
+ return isOK;
}
//================================================================
{
emit Hide( theEvent );
}
+
+/*!
+ \return filters for image files
+*/
+QString GraphicsView_ViewFrame::filter() const
+{
+ QStringList filters = SUIT_ViewWindow::filter().split( ";;", QString::SkipEmptyParts );
+ filters << tr( "POSTSCRIPT_FILES" );
+ return filters.join( ";;" );
+}
GraphicsView_ViewPort* getViewPort() const { return myViewPort; }
virtual QImage dumpView();
- virtual bool dumpViewToPSFormat(const QString& fileName);
-
+
virtual QString getVisualParameters();
virtual void setVisualParameters( const QString& theParameters );
protected:
virtual void createActions();
virtual int createToolBar();
+ virtual QString filter() const;
+ virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
private:
GraphicsView_Viewer* myViewer;
return anImage;
}
-bool GraphicsView_ViewPort::dumpViewToPSFormat(const QString& fileName)
+bool GraphicsView_ViewPort::dumpViewToFormat(const QString& fileName, const QString& format)
{
+ if( format!="PS" && format!="EPS" )
+ return false;
+
QPrinter printer(QPrinter::ScreenResolution);
printer.setOutputFormat(QPrinter::PostScriptFormat);
printer.setOutputFileName(fileName);
QImage dumpView( bool theWholeScene = false,
QSizeF theSize = QSizeF() );
- bool dumpViewToPSFormat(const QString& fileName);
+ bool dumpViewToFormat(const QString& fileName, const QString& format);
public:
// scene
<source>MNU_ZOOM_VIEW</source>
<translation>Zoom</translation>
</message>
+ <message>
+ <source>POSTSCRIPT_FILES</source>
+ <translation>PostScript files (*.ps *.eps)</translation>
+ </message>
</context>
<context>
<name>GraphicsView_Viewer</name>
<source>MNU_ZOOM_VIEW</source>
<translation>Zoom</translation>
</message>
+ <message>
+ <source>POSTSCRIPT_FILES</source>
+ <translation>Fichiers PostScript (*.ps *.eps)</translation>
+ </message>
</context>
<context>
<name>GraphicsView_Viewer</name>
<source>MNU_ZOOM_VIEW</source>
<translation>ズーム</translation>
</message>
+ <message>
+ <source>POSTSCRIPT_FILES</source>
+ <translation>PostScript files (*.ps *.eps)</translation>
+ </message>
</context>
<context>
<name>GraphicsView_Viewer</name>
return QImage();
}
-bool SUIT_ViewWindow::dumpViewToPSFormat(const QString& fileName)
-{
- return false;
-}
-
/*!
Saves image to file according to the format
\param image - image
/*!
\return filters for image files
*/
-QString SUIT_ViewWindow::filter(bool includePS) const
+QString SUIT_ViewWindow::filter() const
{
- QString aFilter = tr( "TLT_IMAGE_FILES" );
- if (!includePS)
- return aFilter;
- else
- {
- aFilter+=";;"+tr( "POSTSCRIPT_FILES" );
- return aFilter;
- }
+ return tr( "TLT_IMAGE_FILES" );
}
/*! Reaction view window on event \a e.
SUIT_Application* app = NULL;
if (myManager && myManager->study() && myManager->study()->application())
app = myManager->study()->application();
- bool IncludePs = true;
QString fileName;
if (app)
- fileName = app->getFileName( false, QString(), filter(IncludePs), tr( "TLT_DUMP_VIEW" ), 0 ); //old way
+ fileName = app->getFileName( false, QString(), filter(), tr( "TLT_DUMP_VIEW" ), 0 ); //old way
else
{
- QStringList fls = filter(IncludePs).split( ";;", QString::SkipEmptyParts );
+ QStringList fls = filter().split( ";;", QString::SkipEmptyParts );
fileName = SUIT_FileDlg::getFileName( NULL, QString(), fls, tr( "TLT_DUMP_VIEW" ), false, true );
}
if ( !fileName.isEmpty() )
{
QString fmt = SUIT_Tools::extension( fileName ).toUpper();
- if (fmt == "PS" || fmt == "EPS" )
- bOk = dumpViewToPSFormat(fileName);
- else
- {
- QImage im = dumpView();
- Qtx::Localizer loc;
- bOk = dumpViewToFormat( im, fileName, fmt );
- }
+ QImage im = dumpView();
+ Qtx::Localizer loc;
+ bOk = dumpViewToFormat( im, fileName, fmt );
}
else
bOk = true; // cancelled
bool event(QEvent*);
virtual QImage dumpView();
- virtual bool dumpViewToPSFormat(const QString& fileName);
bool dumpViewToFormat( const QString& fileName, const QString& format );
bool onAccelAction( int );
protected:
void closeEvent( QCloseEvent* );
virtual void contextMenuEvent( QContextMenuEvent* );
- virtual QString filter(bool includePS = false) const;
+ virtual QString filter() const;
virtual bool action( const int );
virtual bool dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
<source>TLT_IMAGE_FILES</source>
<translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
</message>
- <message>
- <source>POSTSCRIPT_FILES</source>
- <translation>PostScript files (*.ps *.eps)</translation>
- </message>
<message>
<source>MEN_DESK_WINDOW_CASCADE</source>
<translation>&Cascade</translation>
<source>TLT_IMAGE_FILES</source>
<translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
</message>
- <message>
- <source>POSTSCRIPT_FILES</source>
- <translation>PostScript files (*.ps *.eps)</translation>
- </message>
</context>
</TS>