Salome HOME
Merge branch 'oscar/imps_2017' V8_5_0b1
authorvsr <vsr@opencascade.com>
Mon, 9 Apr 2018 10:30:52 +0000 (13:30 +0300)
committervsr <vsr@opencascade.com>
Mon, 9 Apr 2018 10:30:52 +0000 (13:30 +0300)
18 files changed:
src/GraphicsView/GraphicsView_ViewFrame.cxx
src/GraphicsView/GraphicsView_ViewFrame.h
src/GraphicsView/GraphicsView_ViewManager.cxx
src/GraphicsView/GraphicsView_ViewManager.h
src/GraphicsView/GraphicsView_ViewPort.cxx
src/GraphicsView/GraphicsView_ViewPort.h
src/GraphicsView/GraphicsView_Viewer.cxx
src/GraphicsView/GraphicsView_Viewer.h
src/GraphicsView/resources/GraphicsView_images.ts
src/GraphicsView/resources/GraphicsView_msg_en.ts
src/GraphicsView/resources/GraphicsView_msg_fr.ts
src/GraphicsView/resources/GraphicsView_msg_ja.ts
src/SUIT/SUIT_ViewManager.cxx
src/SUIT/SUIT_ViewWindow.cxx
src/SUIT/resources/SUIT_msg_en.ts
src/SUIT/resources/SUIT_msg_fr.ts
src/SUIT/resources/SUIT_msg_ja.ts
src/SalomeApp/SalomeApp_Application.cxx

index ea7a4a912292c5357f495eb86de338c3db3cb36d..899d64faf9372681d77c74d8c609fd7780f185b2 100644 (file)
@@ -49,7 +49,7 @@
 //=======================================================================
 GraphicsView_ViewFrame::GraphicsView_ViewFrame( SUIT_Desktop* d, GraphicsView_Viewer* vw, QWidget* w )
 : SUIT_ViewWindow( d ),
-  myViewer( vw )
+  myViewer( vw ), myToolBarId( -1 )
 {
   QFrame* aFrame = new QFrame( this );
   setCentralWidget( aFrame );
@@ -65,9 +65,6 @@ GraphicsView_ViewFrame::GraphicsView_ViewFrame( SUIT_Desktop* d, GraphicsView_Vi
 
   aLayout->addWidget( myViewPort );
 
-  createActions();
-  myToolBarId = createToolBar();
-
   connect( myViewPort, SIGNAL( vpKeyEvent( QKeyEvent* ) ),
            this, SLOT( keyEvent( QKeyEvent* ) ) );
   connect( myViewPort, SIGNAL( vpMouseEvent( QGraphicsSceneMouseEvent* ) ),
@@ -176,17 +173,19 @@ int GraphicsView_ViewFrame::createToolBar()
                                      false );                                 // disable floatable toolbar
   toolMgr()->append( DumpId, tid );
 
-  myScaleAction = new QtxMultiAction( this );
-  myScaleAction->insertAction( toolMgr()->action( FitAllId ) );
-  myScaleAction->insertAction( toolMgr()->action( FitRectId ) );
-  myScaleAction->insertAction( toolMgr()->action( FitSelectId ) );
-  myScaleAction->insertAction( toolMgr()->action( ZoomId ) );
-  toolMgr()->append( myScaleAction, tid );
+  QtxMultiAction* aScaleAction = new QtxMultiAction( this );
+  aScaleAction->insertAction( toolMgr()->action( FitAllId ) );
+  aScaleAction->insertAction( toolMgr()->action( FitRectId ) );
+  aScaleAction->insertAction( toolMgr()->action( FitSelectId ) );
+  aScaleAction->insertAction( toolMgr()->action( ZoomId ) );
+  toolMgr()->append( aScaleAction, tid );
+  myScaleAction = aScaleAction;
 
-  myPanAction = new QtxMultiAction( this );
-  myPanAction->insertAction( toolMgr()->action( PanId ) );
-  myPanAction->insertAction( toolMgr()->action( GlobalPanId ) );
-  toolMgr()->append( myPanAction, tid );
+  QtxMultiAction* aPanAction = new QtxMultiAction( this );
+  aPanAction->insertAction( toolMgr()->action( PanId ) );
+  aPanAction->insertAction( toolMgr()->action( GlobalPanId ) );
+  toolMgr()->append( aPanAction, tid );
+  myPanAction = aPanAction;
 
   toolMgr()->append( toolMgr()->action( ResetId ), tid );
 
@@ -211,6 +210,18 @@ QImage GraphicsView_ViewFrame::dumpView()
   return myViewPort->dumpView();
 }
 
+//================================================================
+// Function : dumpViewToFormat
+// Purpose  : 
+//================================================================
+bool GraphicsView_ViewFrame::dumpViewToFormat( const QImage& image, const QString& fileName, const QString& format )
+{
+  bool isOK = myViewPort->dumpViewToFormat(fileName, format);
+  if( !isOK )
+    isOK = SUIT_ViewWindow::dumpViewToFormat( image, fileName, format );
+  return isOK;
+}
+
 //================================================================
 // Function : getVisualParameters
 // Purpose  : 
@@ -261,14 +272,15 @@ void GraphicsView_ViewFrame::setVisualParameters( const QString& theParameters )
 //================================================================
 void GraphicsView_ViewFrame::expandToolBarActions()
 {
-  QList<QtxMultiAction*> anExpandableActions;
+  QList<QAction*> anExpandableActions;
   anExpandableActions.append( myScaleAction );
   anExpandableActions.append( myPanAction );
 
-  QListIterator<QtxMultiAction*> anIter( anExpandableActions );
+  QListIterator<QAction*> anIter( anExpandableActions );
   while( anIter.hasNext() )
   {
-    if( QtxMultiAction* aMultiAction = anIter.next() )
+    QtxMultiAction* aMultiAction = dynamic_cast<QtxMultiAction*>( anIter.next() );
+    if( aMultiAction )
     {
       QList<QAction*> aLocalActions = aMultiAction->actions();
       QListIterator<QAction*> aLocalIter( aLocalActions );
@@ -417,3 +429,43 @@ void GraphicsView_ViewFrame::contextMenuEvent( QGraphicsSceneContextMenuEvent* e
   emit contextMenuRequested( anEvent );
   delete anEvent;
 }
+
+/*!
+  \brief Handle show event.
+
+  Emits Show() signal.
+
+  \param theEvent show event
+*/
+void GraphicsView_ViewFrame::showEvent( QShowEvent* theEvent )
+{
+  if( myToolBarId < 0 )
+  {
+    createActions();
+    myToolBarId = createToolBar();
+  }
+
+  emit Show( theEvent );
+}
+
+/*!
+  \brief Handle hide event.
+
+  Emits Hide() signal.
+
+  \param theEvent hide event
+*/
+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 537c81052e7a16946371cfb61871647964a90b41..c5d2b3aff7eec4ed2ed84d7751f8daf6242cf04a 100644 (file)
@@ -28,7 +28,7 @@ class QGraphicsSceneContextMenuEvent;
 class QGraphicsSceneMouseEvent;
 class QGraphicsSceneWheelEvent;
 
-class QtxMultiAction;
+class QAction;
 
 class SUIT_Desktop;
 
@@ -50,18 +50,21 @@ public:
   GraphicsView_ViewFrame( SUIT_Desktop*, GraphicsView_Viewer*, QWidget* w = NULL );
   ~GraphicsView_ViewFrame();
 
-public:
   GraphicsView_Viewer*    getViewer() const { return myViewer; }
   GraphicsView_ViewPort*  getViewPort() const  { return myViewPort; }
 
   virtual QImage          dumpView();
-
+  
   virtual QString         getVisualParameters();
   virtual void            setVisualParameters( const QString& theParameters );
 
-  void                    expandToolBarActions();
+  virtual void            expandToolBarActions();
   int                     getToolBarId();
 
+public slots:
+  virtual void showEvent( QShowEvent* );
+  virtual void hideEvent( QHideEvent* );
+
 protected slots:
   void                    onViewPan();
   void                    onViewZoom();
@@ -88,17 +91,22 @@ signals:
 
   void                    sketchingFinished( QPainterPath );
 
-private:
-  void                    createActions();
-  int                     createToolBar();
+  void Show( QShowEvent* );
+  void Hide( QHideEvent* );
+
+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;
   GraphicsView_ViewPort*  myViewPort;
 
   int                     myToolBarId;
-  QtxMultiAction*         myScaleAction;
-  QtxMultiAction*         myPanAction;
+  QAction*                myScaleAction;
+  QAction*                myPanAction;
 };
 
 #endif
index 4b32e1cc5118c9e87477794471c367ac857c12b6..562cfb8d0730a55effd0c555ee7ce59c11490ee9 100644 (file)
 // Purpose : Constructor
 //=======================================================================
 GraphicsView_ViewManager::GraphicsView_ViewManager( SUIT_Study* theStudy,
-                                                    SUIT_Desktop* theDesktop )
-: SUIT_ViewManager( theStudy, theDesktop, new GraphicsView_Viewer( "GraphicsView" ) )
+                                                    SUIT_Desktop* theDesktop,
+                                                    SUIT_ViewModel* theModel )
+: SUIT_ViewManager( theStudy, theDesktop, 
+    theModel ? theModel : new GraphicsView_Viewer( "GraphicsView" ) )
 {
   setTitle( tr( "GRAPHICS_VIEW_TITLE" ) );
 }
index 0b7e93b57111c3217a77dc12dc83fa8619b7598a..64f926b0067efb80cdce65ae0e795f78a40df686 100644 (file)
@@ -36,7 +36,8 @@ class GRAPHICSVIEW_API GraphicsView_ViewManager : public SUIT_ViewManager
 
 public:
   GraphicsView_ViewManager( SUIT_Study* theStudy,
-                            SUIT_Desktop* theDesktop );
+                            SUIT_Desktop* theDesktop,
+                            SUIT_ViewModel* theModel = 0 );
   virtual ~GraphicsView_ViewManager();
 
   GraphicsView_Viewer* getViewer();
index 40086a4f8c9754e8b4a0bed8a673c5db99d75643..4b3dafd5fc58e358995eb5757971ef61e8cc68c7 100644 (file)
@@ -34,6 +34,8 @@
 #include <QRectF>
 #include <QRubberBand>
 #include <QScrollBar>
+#include <QPrinter>
+#include <QPainter>
 
 #include <math.h>
 
@@ -132,6 +134,7 @@ GraphicsView_ViewPort::GraphicsView_ViewPort( QWidget* theParent )
   myForegroundItem( 0 ),
   myGridItem( 0 ),
   myIsTransforming( false ),
+  myUnlimitedPanning( false ),
   myHighlightedObject( 0 ),
   myHighlightX( 0 ),
   myHighlightY( 0 ),
@@ -145,9 +148,11 @@ GraphicsView_ViewPort::GraphicsView_ViewPort( QWidget* theParent )
   myIsSketchingByPath( false ),
   myIsDragging( false ),
   myIsDragPositionInitialized( false ),
+  myDraggingSelectedByLeftButton( false ),
   myIsPulling( false ),
   myPullingObject( 0 ),
-  myStoredCursor( Qt::ArrowCursor )
+  myStoredCursor( Qt::ArrowCursor ),
+  myZoomCoeff( 100 )
 {
   // scene
   myScene = new GraphicsView_Scene( this );
@@ -191,6 +196,9 @@ GraphicsView_ViewPort::GraphicsView_ViewPort( QWidget* theParent )
                   QPainter::SmoothPixmapTransform |
                   QPainter::HighQualityAntialiasing );
 
+  myHBarPolicy = horizontalScrollBarPolicy();
+  myVBarPolicy = verticalScrollBarPolicy();
+
   connect( myScene, SIGNAL( gsKeyEvent( QKeyEvent* ) ),
            this, SLOT( onKeyEvent( QKeyEvent* ) ) );
   connect( myScene, SIGNAL( gsMouseEvent( QGraphicsSceneMouseEvent* ) ),
@@ -310,6 +318,15 @@ void GraphicsView_ViewPort::removeItem( QGraphicsItem* theItem )
   onBoundingRectChanged();
 }
 
+void GraphicsView_ViewPort::clearItems()
+{
+  myHighlightedObject = 0;
+  mySelectedObjects.clear();
+  myObjects.clear();
+  myScene->clear();
+  onBoundingRectChanged();
+}
+
 //================================================================
 // Function : getObjects
 // Purpose  : 
@@ -457,6 +474,38 @@ QImage GraphicsView_ViewPort::dumpView( bool theWholeScene,
   return anImage;
 }
 
+bool GraphicsView_ViewPort::dumpViewToFormat(const QString& fileName, const QString& format)
+{
+  if( format!="PS" && format!="EPS" )
+    return false;
+
+  QPrinter printer(QPrinter::ScreenResolution);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+  printer.setOutputFormat(QPrinter::PostScriptFormat);
+#else
+  printer.setOutputFormat(QPrinter::PdfFormat);
+#endif
+  printer.setOutputFileName(fileName);
+  QPainter painter;  
+  if (!painter.begin(&printer))
+    return false;
+
+  QRect view( 0, 0, printer.pageRect().width(), printer.paperRect().height() );
+  QRectF bounds = myScene->itemsBoundingRect();
+    
+  if( !view.isEmpty() && !bounds.isEmpty() )
+  {
+    float SCALE = 0.5;//qMin( view.width()/bounds.width(), view.height()/bounds.height() );
+    painter.setViewport( view );
+    painter.scale( SCALE, SCALE );
+  }
+  myScene->render( &painter, QRectF( view ), bounds );
+
+  if (!painter.end())
+    return false;
+  return true;
+}
+
 //================================================================
 // Function : setSceneGap
 // Purpose  : 
@@ -805,9 +854,29 @@ void GraphicsView_ViewPort::pan( double theDX, double theDY )
     myViewLabel->setAcceptMoveEvents( false );
 
   if( QScrollBar* aHBar = horizontalScrollBar() )
+  {
+    if( isUnlimitedPanning() )
+    {
+      int aNewValue = aHBar->value() - theDX;
+      if( aNewValue < aHBar->minimum() )
+        aHBar->setMinimum( aNewValue );
+      if( aNewValue > aHBar->maximum() )
+        aHBar->setMaximum( aNewValue );
+    }
     aHBar->setValue( aHBar->value() - theDX );
+  }
   if( QScrollBar* aVBar = verticalScrollBar() )
+  {
+    if( isUnlimitedPanning() )
+    {
+      int aNewValue = aVBar->value() + theDY;
+      if( aNewValue < aVBar->minimum() )
+        aVBar->setMinimum( aNewValue );
+      if( aNewValue > aVBar->maximum() )
+        aVBar->setMaximum( aNewValue );
+    }
     aVBar->setValue( aVBar->value() + theDY );
+  }
 
   if( myViewLabel )
     myViewLabel->setAcceptMoveEvents( true );
@@ -857,7 +926,7 @@ void GraphicsView_ViewPort::zoom( double theX1, double theY1, double theX2, doub
 
   // increasing of diagonal coefficients (>300) leads to a crash sometimes
   // at the values of 100 some primitives are drawn incorrectly
-  if( qMax( aM11, aM22 ) < 100 )
+  if( myZoomCoeff < 0 || qMax( aM11, aM22 ) < myZoomCoeff )
     setTransform( aTransform );
 
   myIsTransforming = false;
@@ -973,6 +1042,41 @@ void GraphicsView_ViewPort::applyTransform()
       anObject->setViewTransform( transform() );
 }
 
+//================================================================
+// Function : setZoomCoeff
+// Purpose  : 
+//================================================================
+void GraphicsView_ViewPort::setZoomCoeff( const int& theZoomCoeff )
+{
+  myZoomCoeff = theZoomCoeff;
+}
+
+//================================================================
+// Function : setUnlimitedPanning
+// Purpose  : 
+//================================================================
+void GraphicsView_ViewPort::setUnlimitedPanning( const bool& theValue )
+{
+  if ( myUnlimitedPanning == theValue )
+    return;
+
+  myUnlimitedPanning = theValue;
+
+  if( myUnlimitedPanning )
+  {
+    myHBarPolicy = horizontalScrollBarPolicy();
+    myVBarPolicy = verticalScrollBarPolicy();
+
+    setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
+    setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
+  }
+  else
+  {
+    setHorizontalScrollBarPolicy( myHBarPolicy );
+    setVerticalScrollBarPolicy( myVBarPolicy );
+  }
+}
+
 //================================================================
 // Function : currentBlock
 // Purpose  : 
@@ -1469,6 +1573,15 @@ bool GraphicsView_ViewPort::isSketching( bool* theIsPath ) const
   return myIsSketching;
 }
 
+//================================================================
+// Function : setDraggingSelectedByLeftButton
+// Purpose  : 
+//================================================================
+void GraphicsView_ViewPort::setDraggingSelectedByLeftButton( const bool& theValue )
+{
+  myDraggingSelectedByLeftButton = theValue;
+}
+
 //================================================================
 // Function : dragObjects
 // Purpose  : 
@@ -1496,8 +1609,9 @@ void GraphicsView_ViewPort::dragObjects( QGraphicsSceneMouseEvent* e )
     else
       anObjectsToMove.append( anObject );
   }
-  else if( hasInteractionFlag( DraggingByMiddleButton ) &&
-           nbSelected() && ( e->buttons() & Qt::MidButton ) )
+  else if( ( hasInteractionFlag( DraggingByMiddleButton ) && ( e->buttons() & Qt::MidButton ) ||
+             isDraggingSelectedByLeftButton() && ( e->buttons() & Qt::LeftButton ) ) &&
+           nbSelected() )
   {
     for( initSelected(); moreSelected(); nextSelected() )
       if( GraphicsView_Object* aMovingObject = selectedObject() )
@@ -1692,8 +1806,9 @@ void GraphicsView_ViewPort::onMouseEvent( QGraphicsSceneMouseEvent* e )
         if( ( getHighlightedObject() &&
               getHighlightedObject()->isMovable() &&
               !( anAccel || e->button() != Qt::LeftButton ) ) ||
-            ( hasInteractionFlag( DraggingByMiddleButton ) &&
-              nbSelected() && !anAccel && e->button() == Qt::MidButton ) )
+            ( ( hasInteractionFlag( DraggingByMiddleButton ) && e->button() == Qt::MidButton ||
+                isDraggingSelectedByLeftButton() && e->button() == Qt::LeftButton ) &&
+              nbSelected() && !anAccel ) )
         {
           myIsDragging = true;
           myStoredCursor = cursor();
index 303f6f8f44ac3020055dd3372cc01a48effb851f..f19c5b205d953bedb617b6b12385ad38c9cf06eb 100644 (file)
@@ -86,6 +86,7 @@ public:
   void                             addItem( QGraphicsItem* theItem );
   bool                             isItemAdded( QGraphicsItem* theItem );
   void                             removeItem( QGraphicsItem* theItem );
+  void                             clearItems();
 
   enum SortType { NoSorting, SelectedFirst, SortByZLevel };
   GraphicsView_ObjectList          getObjects( SortType theSortType = NoSorting ) const;
@@ -95,6 +96,8 @@ public:
   QImage                           dumpView( bool theWholeScene = false,
                                              QSizeF theSize = QSizeF() );
 
+  bool                             dumpViewToFormat(const QString& fileName, const QString& format);
+
 public:
   // scene
   void                             setSceneGap( double theSceneGap );
@@ -160,6 +163,12 @@ public:
 
   void                             applyTransform();
 
+  int                              zoomCoeff() const { return myZoomCoeff; }
+  void                             setZoomCoeff( const int& theZoomCoeff );
+
+  bool                             isUnlimitedPanning() const { return myUnlimitedPanning; }
+  void                             setUnlimitedPanning( const bool& theValue );
+
   // block status
   BlockStatus                      currentBlock();
 
@@ -201,6 +210,9 @@ public:
   // dragging
   bool                             isDragging() { return myIsDragging; }
 
+  bool                             isDraggingSelectedByLeftButton() const { return myDraggingSelectedByLeftButton; }
+  void                             setDraggingSelectedByLeftButton( const bool& theValue );
+
   // pulling
   bool                             startPulling( const QPointF& );
   void                             drawPulling( const QPointF& );
@@ -296,6 +308,10 @@ private:
   bool                             myIsTransforming;
   QTransform                       myCurrentTransform;
 
+  bool                             myUnlimitedPanning;
+  Qt::ScrollBarPolicy              myHBarPolicy;
+  Qt::ScrollBarPolicy              myVBarPolicy;
+
   // highlighting
   GraphicsView_Object*             myHighlightedObject;
   double                           myHighlightX;
@@ -323,6 +339,7 @@ private:
   int                              myIsDragging;
   QPointF                          myDragPosition;
   bool                             myIsDragPositionInitialized;
+  bool                             myDraggingSelectedByLeftButton;
 
   // pulling
   bool                             myIsPulling;
@@ -330,6 +347,9 @@ private:
 
   // cursor
   QCursor                          myStoredCursor;
+
+  // zoom diagonal coefficient
+  int                              myZoomCoeff;
 };
 
 Q_DECLARE_OPERATORS_FOR_FLAGS( GraphicsView_ViewPort::InteractionFlags )
index a8e1511b2c360aec3bb3d834f2eda335abd788f5..cc55ba5d7361d6457e0bc8f6f97680ee21e72fc0 100644 (file)
@@ -68,13 +68,18 @@ GraphicsView_Viewer::~GraphicsView_Viewer()
   delete mySelector;
 }
 
+GraphicsView_ViewFrame* GraphicsView_Viewer::createViewFrame( SUIT_Desktop* theDesktop, QWidget* theWidget )
+{
+  return new GraphicsView_ViewFrame( theDesktop, this, theWidget );
+}
+
 //================================================================
 // Function : createView
 // Purpose  : 
 //================================================================
 SUIT_ViewWindow* GraphicsView_Viewer::createView( SUIT_Desktop* theDesktop )
 {
-  GraphicsView_ViewFrame* aViewFrame = new GraphicsView_ViewFrame( theDesktop, this, myWidget );
+  GraphicsView_ViewFrame* aViewFrame = createViewFrame( theDesktop, myWidget );
 
   connect( aViewFrame, SIGNAL( keyPressed( QKeyEvent* ) ),
            this, SLOT( onKeyEvent( QKeyEvent* ) ) );
@@ -401,7 +406,9 @@ void GraphicsView_Viewer::handleMousePress( QGraphicsSceneMouseEvent* e )
       }
       else if( e->button() == Qt::LeftButton &&
                !( aViewPort->currentBlock() & GraphicsView_ViewPort::BS_Selection ) &&
-               !aViewPort->getHighlightedObject() )
+               !aViewPort->getHighlightedObject() &&
+               ( !aViewPort->isDraggingSelectedByLeftButton() ||
+                 aViewPort->isDraggingSelectedByLeftButton() && aViewPort->nbSelected() == 0 ) )
       {
         // Start rectangular selection if pulling was not started
         QPoint p = aViewPort->mapFromScene( e->scenePos() );
index 5ca25ecccca2d86c7b1c4d8110a3b524262d882c..eeb7cd854024444e1ec2d50d18972b483718405b 100644 (file)
@@ -81,6 +81,7 @@ signals:
 
 protected:
   virtual GraphicsView_ViewTransformer* createTransformer( int );
+  virtual GraphicsView_ViewFrame* createViewFrame( SUIT_Desktop* theDesktop, QWidget* theWidget );
 
   virtual void                  onTransformationStarted();
   virtual void                  onTransformationFinished();
@@ -111,13 +112,13 @@ protected slots:
   void                          onTestCropOperatorPerform( QPainterPath thePath );
   */
 
-private:
-  void                          handleKeyPress( QKeyEvent* );
-  void                          handleKeyRelease( QKeyEvent* );
-  void                          handleMouseMove( QGraphicsSceneMouseEvent* );
-  void                          handleMousePress( QGraphicsSceneMouseEvent* );
-  void                          handleMouseRelease( QGraphicsSceneMouseEvent* );
-  void                          handleWheel( QGraphicsSceneWheelEvent* );
+protected:
+  virtual void                  handleKeyPress( QKeyEvent* );
+  virtual void                  handleKeyRelease( QKeyEvent* );
+  virtual void                  handleMouseMove( QGraphicsSceneMouseEvent* );
+  virtual void                  handleMousePress( QGraphicsSceneMouseEvent* );
+  virtual void                  handleMouseRelease( QGraphicsSceneMouseEvent* );
+  virtual void                  handleWheel( QGraphicsSceneWheelEvent* );
 
   // testing ImageViewer
   enum QueueOperation { BringToFront, SendToBack, BringForward, SendBackward };
index ca607b209355ee1def90339582b4556907f49c93..f90a6c49cecdf80e7fdcdc3f1edc975f146a4776 100644 (file)
@@ -1,6 +1,6 @@
 <!DOCTYPE TS><TS>
 <context>
-    <name>@default</name>
+    <name>GraphicsView_ViewFrame</name>
     <message>
         <source>ICON_GV_DUMP</source>
         <translation>graphics_view_dump.png</translation>
         <source>ICON_GV_GLOBALPAN</source>
         <translation>graphics_view_glpan.png</translation>
     </message>
-    <message>
-        <source>ICON_GV_CURSOR_ZOOM</source>
-        <translation>graphics_view_cursor_zoom.png</translation>
-    </message>
     <message>
         <source>ICON_GV_FITALL</source>
         <translation>graphics_view_fitall.png</translation>
         <translation>graphics_view_rotate.png</translation>
     </message>
 </context>
+<context>
+    <name>GraphicsView_ViewPort</name>
+    <message>
+        <source>ICON_GV_CURSOR_ZOOM</source>
+        <translation>graphics_view_cursor_zoom.png</translation>
+    </message>
+</context>
 </TS>
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 b9e850cdf61d6c8a9d1ba6a0b7343b6f5d383d61..559c3258895029af6c8422668ed378b043829922 100755 (executable)
@@ -58,8 +58,11 @@ SUIT_ViewManager::SUIT_ViewManager( SUIT_Study* theStudy,
 
   myId = useNewId( getType() );
 
-  connect( theDesktop, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
-           this,       SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+  if( theDesktop )
+  {
+    connect( theDesktop, SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
+             this,       SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
+  }
 
   myStudy = theStudy;
   if ( myStudy )
index 0a40235768c90dc2d25424a90919714d9b031921..d5d9032faeed6fff80f6bbf0b1d9f253a446034e 100755 (executable)
@@ -32,6 +32,7 @@
 #include "SUIT_Application.h"
 #include "SUIT_ViewManager.h"
 #include "SUIT_ResourceMgr.h"
+#include "SUIT_FileDlg.h"
 #include "QtxActionToolMgr.h"
 #include "QtxMultiAction.h"
 
@@ -183,21 +184,27 @@ bool SUIT_ViewWindow::event( QEvent* e )
   if ( e->type() == DUMP_EVENT )
   {
     bool bOk = false;
-    if ( myManager && myManager->study() && myManager->study()->application() )
+    SUIT_Application* app = NULL;
+    if (myManager && myManager->study() && myManager->study()->application())
+      app = myManager->study()->application();
+    QString fileName;
+    if (app)
+      fileName = app->getFileName( false, QString(), filter(), tr( "TLT_DUMP_VIEW" ), 0 ); //old way
+    else
     {
-      // get file name
-      SUIT_Application* app = myManager->study()->application();
-      QString fileName = app->getFileName( false, QString(), filter(), tr( "TLT_DUMP_VIEW" ), 0 );
-      if ( !fileName.isEmpty() )
-      {
-        QImage im = dumpView();
-       QString fmt = SUIT_Tools::extension( fileName ).toUpper();
-       Qtx::Localizer loc;
-       bOk = dumpViewToFormat( im, fileName, fmt );
-      }
-      else
-       bOk = true; // cancelled
+      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();
+      QImage im = dumpView();  
+      Qtx::Localizer loc;
+      bOk = dumpViewToFormat( im, fileName, fmt );
+    }
+    else
+      bOk = true; // cancelled
+
     if ( !bOk )
       SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) );
 
index 31bbc382a8d46ff7f789c34ebf8e6cf918ff57f0..03659c6a841208d23bbadf6f9bac35975f0bf44f 100644 (file)
@@ -160,4 +160,15 @@ Do you want to overwrite it?</translation>
         <translation>All files (*)</translation>
     </message>
 </context>
+<context>
+    <name>SUIT_ViewWindow</name>
+    <message>
+        <source>TLT_DUMP_VIEW</source>
+        <translation>Dump view to file</translation>
+    </message>
+    <message>
+        <source>TLT_IMAGE_FILES</source>
+        <translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
+    </message>
+</context>     
 </TS>
index d3785c28da1ece546f7d5a85e0f6c922cc31c496..97f2cf33def5d1571587908cea522fe80abf3b6b 100755 (executable)
@@ -160,4 +160,15 @@ Voulez-vous l&apos;écraser ?</translation>
         <translation>Tous les fichiers (*)</translation>
     </message>
 </context>
+<context>
+    <name>SUIT_ViewWindow</name>
+    <message>
+        <source>TLT_DUMP_VIEW</source>
+        <translation>Enregistrer la vue dans le fichier</translation>
+    </message>
+    <message>
+        <source>TLT_IMAGE_FILES</source>
+        <translation>Fichiers images (*.bmp *.png *.jpg *.jpeg)</translation>
+    </message>
+</context>     
 </TS>
index f641779cf716b72c1e1debfdfeba00e8fa4f7f77..8da7266dbb2c71e43d0bb2ca53bcdf0a05b7b6da 100644 (file)
       <translation>すべてのファイル (*)</translation>
     </message>
   </context>
+<context>
+    <name>SUIT_ViewWindow</name>
+    <message>
+      <source>TLT_DUMP_VIEW</source>
+      <translation>ビューでファイルを保存します。</translation>
+    </message>
+    <message>
+      <source>TLT_IMAGE_FILES</source>
+      <translation>イメージ (*.bmp *.png *.jpg *.jpeg) ファイル</translation>
+    </message>
+</context>     
 </TS>
index 95c0e878b0d6869688e76da003da25b1ef5a4c93..97b4a077ae54d2ae12eb6b82caa8ef3791cc1502 100644 (file)
@@ -580,6 +580,8 @@ void SalomeApp_Application::onDesktopMessage( const QString& message )
 /*!SLOT. Copy objects to study maneger from selection maneger..*/
 void SalomeApp_Application::onCopy()
 {
+  LightApp_Application::onCopy();
+
   SALOME_ListIO list;
   LightApp_SelectionMgr* mgr = selectionMgr();
   mgr->selectedObjects(list);
@@ -594,11 +596,14 @@ void SalomeApp_Application::onCopy()
   if(it.More())
     {
       _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
-      try {
-        studyMgr()->Copy(so);
-        onSelectionChanged();
-      }
-      catch(...) {
+      if( so )
+      {
+        try {
+          studyMgr()->Copy(so);
+          onSelectionChanged();
+        }
+        catch(...) {
+        }
       }
     }
 }
@@ -606,6 +611,8 @@ void SalomeApp_Application::onCopy()
 /*!SLOT. Paste objects to study maneger from selection manager.*/
 void SalomeApp_Application::onPaste()
 {
+  LightApp_Application::onPaste();
+
   SALOME_ListIO list;
   LightApp_SelectionMgr* mgr = selectionMgr();
   mgr->selectedObjects(list);
@@ -627,12 +634,15 @@ void SalomeApp_Application::onPaste()
   if(it.More())
     {
       _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
-      try {
-        studyMgr()->Paste(so);
-        updateObjectBrowser( true );
-        updateActions(); //SRN: BugID IPAL9377, case 3
-      }
-      catch(...) {
+      if( so )
+      {
+        try {
+          studyMgr()->Paste(so);
+          updateObjectBrowser( true );
+          updateActions(); //SRN: BugID IPAL9377, case 3
+        }
+        catch(...) {
+        }
       }
     }
 }