]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
redesign of the export to PostScript oscar/imps_2017
authorasl <asl@opencascade.com>
Mon, 19 Mar 2018 11:55:49 +0000 (14:55 +0300)
committerasl <asl@opencascade.com>
Mon, 19 Mar 2018 11:58:19 +0000 (14:58 +0300)
src/GraphicsView/GraphicsView_ViewFrame.cxx
src/GraphicsView/GraphicsView_ViewFrame.h
src/GraphicsView/GraphicsView_ViewPort.cxx
src/GraphicsView/GraphicsView_ViewPort.h
src/GraphicsView/resources/GraphicsView_msg_en.ts
src/GraphicsView/resources/GraphicsView_msg_fr.ts
src/GraphicsView/resources/GraphicsView_msg_ja.ts
src/SUIT/SUIT_ViewWindow.cxx
src/SUIT/SUIT_ViewWindow.h
src/SUIT/resources/SUIT_msg_en.ts

index 342778427e68c2b27892fd012ad0b0b7a8479e57..899d64faf9372681d77c74d8c609fd7780f185b2 100644 (file)
@@ -211,12 +211,15 @@ QImage GraphicsView_ViewFrame::dumpView()
 }
 
 //================================================================
-// 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;
 }
 
 //================================================================
@@ -456,3 +459,13 @@ void GraphicsView_ViewFrame::hideEvent( QHideEvent* theEvent )
 {
   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( ";;" );
+}
index 9e2408b7b84eca994a7d3b78bef2cb9dc03fe225..8068f9e9fda309c50cc45442b48065adaa0a7397 100644 (file)
@@ -54,8 +54,7 @@ public:
   GraphicsView_ViewPort*  getViewPort() const  { return myViewPort; }
 
   virtual QImage          dumpView();
-  virtual bool            dumpViewToPSFormat(const QString& fileName);
-
+  
   virtual QString         getVisualParameters();
   virtual void            setVisualParameters( const QString& theParameters );
 
@@ -98,6 +97,8 @@ signals:
 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;
index 6753aa5f6b28c3bbcf18696befd9f8afc5a787ea..aa60c1f63dcefaabf280d8b692c3c681b285a953 100644 (file)
@@ -474,8 +474,11 @@ QImage GraphicsView_ViewPort::dumpView( bool theWholeScene,
   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);
index 50ac0b65f641c601b0a10862fed33f53b638cde3..c99a881d79443128b6cb5262662bf5ed8bb82ac5 100644 (file)
@@ -94,7 +94,7 @@ public:
   QImage                           dumpView( bool theWholeScene = false,
                                              QSizeF theSize = QSizeF() );
 
-  bool                             dumpViewToPSFormat(const QString& fileName);
+  bool                             dumpViewToFormat(const QString& fileName, const QString& format);
 
 public:
   // scene
index 919919ebaf7850e6fcc6fea6b51523b1b127d4ce..a6ee6ba23b5d27effe9cb45f59cd0092980180a5 100644 (file)
       <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>
index fe21b49279148c35a11b78ee586623fa2d461be8..031620364b6d775c5f3560c60beb8d49f4903cac 100644 (file)
         <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>
index 23d0692327fdc5ba0a904d47ec5a66aeca9b3381..efc189b5b0987b8a4bb967b82e68b821aa71b378 100644 (file)
       <source>MNU_ZOOM_VIEW</source>
       <translation>&#x30BA;&#x30FC;&#x30E0;</translation>
     </message>
+    <message>
+        <source>POSTSCRIPT_FILES</source>
+        <translation>PostScript files (*.ps *.eps)</translation>
+    </message>
   </context>
   <context>
     <name>GraphicsView_Viewer</name>
index 040926319f35426dbc65eb8f0e08669553dd461d..d0ac1a06697c4474a2f5e467b61312faaa3b5740 100755 (executable)
@@ -94,11 +94,6 @@ QImage SUIT_ViewWindow::dumpView()
   return QImage();
 }
 
-bool SUIT_ViewWindow::dumpViewToPSFormat(const QString& fileName)
-{
-  return false;
-}
-
 /*!
   Saves image to file according to the format
   \param image - image
@@ -177,16 +172,9 @@ void SUIT_ViewWindow::onDumpView()
 /*!
   \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.
@@ -199,26 +187,20 @@ bool SUIT_ViewWindow::event( QEvent* 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
index 3e49587ab75c2f161a3a1069328dbaae9df79ac8..fd717f617adeb8e96a33fac802e7b8c7391028f6 100755 (executable)
@@ -53,7 +53,6 @@ public:
   bool              event(QEvent*);
 
   virtual QImage    dumpView();
-  virtual bool      dumpViewToPSFormat(const QString& fileName);
   bool              dumpViewToFormat( const QString& fileName, const QString& format );
 
   bool              onAccelAction( int );
@@ -94,7 +93,7 @@ signals:
 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 );
 
index 5c3012b86c0dd1133305a0a569dbda5ef7f83bdb..03659c6a841208d23bbadf6f9bac35975f0bf44f 100644 (file)
         <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>&amp;Cascade</translation>
@@ -174,9 +170,5 @@ Do you want to overwrite it?</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>