]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
*** empty log message ***
authorvsv <vsv@opencascade.com>
Fri, 10 Sep 2010 13:26:46 +0000 (13:26 +0000)
committervsv <vsv@opencascade.com>
Fri, 10 Sep 2010 13:26:46 +0000 (13:26 +0000)
src/OCCViewer/OCCViewer_ViewFrame.cxx [new file with mode: 0644]
src/OCCViewer/OCCViewer_ViewFrame.h [new file with mode: 0644]
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/resources/OCCViewer_images.ts
src/OCCViewer/resources/OCCViewer_msg_en.ts
src/OCCViewer/resources/occ_view_maximized.png [new file with mode: 0644]
src/OCCViewer/resources/occ_view_minimized.png [new file with mode: 0644]
src/SOCC/SOCC_ViewModel.cxx
src/SOCC/SOCC_ViewModel.h
src/SOCC/SOCC_ViewWindow.h
src/SUIT/SUIT_ViewWindow.h

diff --git a/src/OCCViewer/OCCViewer_ViewFrame.cxx b/src/OCCViewer/OCCViewer_ViewFrame.cxx
new file mode 100644 (file)
index 0000000..1fa170d
--- /dev/null
@@ -0,0 +1,183 @@
+
+#include "OCCViewer_ViewFrame.h"
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewModel.h"
+
+#include <SUIT_ViewManager.h>
+
+#include <QFrame>
+#include <QLayout>
+
+
+OCCViewer_ViewFrame::OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel)
+  : OCCViewer_ViewWindow( theDesktop, theModel )
+{
+  QFrame* centralFrame = new QFrame( this );
+  setCentralWidget( centralFrame );
+
+   OCCViewer_ViewWindow* view0 = theModel->createSubWindow();
+  view0->setParent( centralFrame );
+  myViews.append( view0 ); // MAIN_VIEW
+
+  myLayout = new QGridLayout( centralFrame );
+  myLayout->setMargin( 0 );
+  myLayout->setSpacing( 1 );
+
+  myLayout->addWidget( view0, 1, 1 );
+  connectViewSignals(view0);
+}
+
+OCCViewer_ViewFrame::~OCCViewer_ViewFrame()
+{
+}
+
+//**************************************************************************************
+OCCViewer_ViewWindow* OCCViewer_ViewFrame::getView( const int i ) const
+{
+  return ( i < myViews.count() ) ? myViews.at( i ) : 0 ;
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setViewManager( SUIT_ViewManager* theMgr )
+{
+  OCCViewer_ViewWindow::setViewManager(theMgr);
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    aView->setViewManager(theMgr); 
+  }
+}
+
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::onMaximizedView( OCCViewer_ViewWindow* theView, bool isMaximized)
+{
+  if (isMaximized) {
+    if (myViews.count() <= 1)
+      return;
+
+    myLayout->setColumnStretch(0 , 0);
+    myLayout->setColumnStretch(1, 0);
+   int i = 0;
+    OCCViewer_ViewWindow* aView = 0;
+    for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++) {
+      aView = myViews.at(i);
+      if (aView != theView)
+        aView->hide();
+    }
+  } else {
+
+    OCCViewer_Viewer* aModel = dynamic_cast<OCCViewer_Viewer*>(myManager->getViewModel());
+    if (!aModel) return;
+
+    myLayout->setColumnStretch(0 , 10);
+    myLayout->setColumnStretch(1, 10);
+
+    int i = 0;
+    if (myViews.count() == 1) {
+      QColor aColor = myViews.at( MAIN_VIEW )->backgroundColor();
+      OCCViewer_ViewWindow* view = 0;
+      for ( i = BOTTOM_LEFT; i <= TOP_RIGHT; i++) {
+        view = aModel->createSubWindow();
+        view->set2dMode( (Mode2dType) i );
+        view->setParent( centralWidget() );
+        view->setViewManager(myManager); 
+        myViews.append( view ); 
+        aModel->initView(view);
+        view->setMaximized(false, false);
+        connectViewSignals(view);
+        view->setBackgroundColor(aColor);
+     }
+      myLayout->addWidget( myViews.at(BOTTOM_LEFT), 1, 0 );
+      myLayout->addWidget( myViews.at(TOP_LEFT), 0, 0 );
+      myLayout->addWidget( myViews.at(TOP_RIGHT), 0, 1 );
+    }
+    for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++) 
+      myViews.at(i)->show();
+  }
+  myLayout->invalidate();
+}
+
+OCCViewer_ViewPort3d* OCCViewer_ViewFrame::getViewPort(int theView) 
+{ 
+  return getView(theView)? getView(theView)->getViewPort() : 0;
+}
+  
+void OCCViewer_ViewFrame::updateEnabledDrawMode() 
+{ 
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    aView->updateEnabledDrawMode(); 
+  }
+}
+
+void OCCViewer_ViewFrame::setCuttingPlane( bool on, const double x , const double y , const double z,
+                                           const double dx, const double dy, const double dz)  
+{ 
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    aView->setCuttingPlane(on, x, y, z, dx, dy, dz); 
+  }
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setCuttingPlane( bool on, const gp_Pln thePln ) 
+{ 
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    aView->setCuttingPlane(on, thePln); 
+  }
+}
+  
+//**************************************************************************************
+void OCCViewer_ViewFrame::setInteractionStyle( const int i ) 
+{ 
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    aView->setInteractionStyle(i); 
+  }
+}
+
+  
+//**************************************************************************************
+void OCCViewer_ViewFrame::connectViewSignals(OCCViewer_ViewWindow* theView)
+{
+  connect( theView, SIGNAL( maximized( OCCViewer_ViewWindow*, bool ) ), 
+           this, SLOT( onMaximizedView( OCCViewer_ViewWindow*, bool ) ) );
+
+  connect( theView, SIGNAL( wheeling(SUIT_ViewWindow*, QWheelEvent*) ), 
+           this, SIGNAL( wheeling(SUIT_ViewWindow*, QWheelEvent*) ) );
+
+  connect( theView, SIGNAL( keyReleased(SUIT_ViewWindow*, QKeyEvent*) ), 
+           this, SIGNAL( keyReleased(SUIT_ViewWindow*, QKeyEvent*) ) );
+  connect( theView, SIGNAL( keyPressed(SUIT_ViewWindow*, QKeyEvent*) ), 
+           this, SIGNAL( keyPressed(SUIT_ViewWindow*, QKeyEvent*) ) );
+
+  connect( theView, SIGNAL( mouseDoubleClicked(SUIT_ViewWindow*, QMouseEvent*) ), 
+           this, SIGNAL( mouseDoubleClicked(SUIT_ViewWindow*, QMouseEvent*) ) );
+  connect( theView, SIGNAL( mousePressed(SUIT_ViewWindow*, QMouseEvent*) ), 
+           this, SIGNAL( mousePressed(SUIT_ViewWindow*, QMouseEvent*) ) );
+  connect( theView, SIGNAL( mouseReleased(SUIT_ViewWindow*, QMouseEvent*) ), 
+           this, SIGNAL( mouseReleased(SUIT_ViewWindow*, QMouseEvent*) ) );
+  connect( theView, SIGNAL( mouseMoving(SUIT_ViewWindow*, QMouseEvent*) ), 
+           this, SIGNAL( mouseMoving(SUIT_ViewWindow*, QMouseEvent*) ) );
+
+  connect( theView, SIGNAL( contextMenuRequested(QContextMenuEvent*) ), 
+           this, SIGNAL( contextMenuRequested(QContextMenuEvent*) ) );
+}
+
+void OCCViewer_ViewFrame::setBackgroundColor( const QColor& theColor)
+{
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    aView->setBackgroundColor(theColor); 
+  }
+}
+
+
+void OCCViewer_ViewFrame::onViewFitAll()
+{
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    aView->onViewFitAll(); 
+  }
+}
+
+void OCCViewer_ViewFrame::onFitAll()
+{
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    aView->onFitAll(); 
+  }
+}
diff --git a/src/OCCViewer/OCCViewer_ViewFrame.h b/src/OCCViewer/OCCViewer_ViewFrame.h
new file mode 100644 (file)
index 0000000..4307479
--- /dev/null
@@ -0,0 +1,116 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef OCCVIEWER_VIEWFRAME_H
+#define OCCVIEWER_VIEWFRAME_H
+
+#include "OCCViewer.h"
+#include "OCCViewer_ViewWindow.h"
+
+#include <gp_Pln.hxx>
+
+class SUIT_Desktop;
+class OCCViewer_Viewer;
+class QGridLayout;
+
+class OCCVIEWER_EXPORT OCCViewer_ViewFrame : public OCCViewer_ViewWindow  
+{
+  Q_OBJECT
+public:
+  enum { MAIN_VIEW, BOTTOM_RIGHT=MAIN_VIEW, BOTTOM_LEFT, TOP_LEFT, TOP_RIGHT };
+
+  OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
+  virtual ~OCCViewer_ViewFrame();
+
+  OCCViewer_ViewWindow*   getView( const int ) const;
+
+  virtual OCCViewer_ViewPort3d* getViewPort() { return 0; }
+  OCCViewer_ViewPort3d* getViewPort(int theView);
+
+  virtual void performRestoring( const viewAspect& theAspect) { getView(MAIN_VIEW)->performRestoring(theAspect); }
+  virtual void initLayout() {}
+
+  virtual void updateEnabledDrawMode();
+  virtual void setCuttingPlane( bool on, const double x = 0 , const double y = 0 , const double z = 0,
+                                const double dx = 0, const double dy = 0, const double dz = 1);
+
+  virtual void setCuttingPlane( bool on, const gp_Pln thePln );
+
+  virtual bool isCuttingPlane() { return getView(MAIN_VIEW)->isCuttingPlane(); }
+
+  virtual QString getVisualParameters() { return getView(MAIN_VIEW)->getVisualParameters(); }
+  virtual void setVisualParameters( const QString& parameters ) { getView(MAIN_VIEW)->setVisualParameters(parameters); }
+
+  virtual void initSketchers() { getView(MAIN_VIEW)->initSketchers(); }
+  virtual OCCViewer_ViewSketcher* getSketcher( const int i)  { return getView(MAIN_VIEW)->getSketcher(i); }
+  virtual void activateSketching( int i ) { getView(MAIN_VIEW)->activateSketching(i); }
+
+  virtual int  interactionStyle() const { return getView(MAIN_VIEW)->interactionStyle(); }
+  virtual void setInteractionStyle( const int i );
+
+  virtual void setViewManager( SUIT_ViewManager* );
+
+  virtual bool eventFilter(QObject* watched, QEvent* e) { return SUIT_ViewWindow::eventFilter(watched, e); }
+
+  virtual QColor backgroundColor() const { return getView(MAIN_VIEW)->backgroundColor(); }
+  virtual void    setBackgroundColor( const QColor& );
+
+public slots:
+  virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); }
+  virtual void onViewFitAll();
+  virtual void onBackView() { getView(MAIN_VIEW)->onBackView(); }
+  virtual void onTopView() { getView(MAIN_VIEW)->onTopView(); }
+  virtual void onBottomView() { getView(MAIN_VIEW)->onBottomView(); }
+  virtual void onLeftView() { getView(MAIN_VIEW)->onLeftView(); }
+  virtual void onRightView() { getView(MAIN_VIEW)->onRightView(); }
+  virtual void onResetView() { getView(MAIN_VIEW)->onResetView(); }
+  virtual void onFitAll();
+  virtual void activateZoom() {}
+  virtual void activateWindowFit() {}
+  virtual void activateRotation() {}
+  virtual void activatePanning() {}
+  virtual void activateGlobalPanning() {}
+  virtual void onSetRotationPoint( bool on ) {}
+  virtual void onAxialScale() {}
+  virtual void onAmbientToogle() {}
+  virtual void onMemorizeView() {}
+  virtual void onRestoreView() {}
+  virtual void onSwitchInteractionStyle( bool on ) {}
+
+  virtual void activateSetRotationGravity() {}
+  virtual void activateSetRotationSelected( double theX, double theY, double theZ ) {}
+  virtual void activateStartPointSelection() {}
+  virtual void updateGravityCoords() {}
+   
+  void onMaximizedView( OCCViewer_ViewWindow*, bool );
+
+  virtual void onDumpView() { getView(MAIN_VIEW)->onDumpView(); }
+
+private:
+  void connectViewSignals(OCCViewer_ViewWindow* theView);
+
+
+  QList<OCCViewer_ViewWindow*> myViews;
+  QGridLayout* myLayout;
+};
+
+#endif
index aa79b3254ad9217871e4ce3ff63cbbfed4297f18..640277e4c30deb581033a746e62e06206c548b1f 100755 (executable)
@@ -1974,7 +1974,6 @@ void OCCViewer_ViewWindow::setMaximized(bool toMaximize, bool toSendSignal)
     anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MINIMIZE" ) ) );
     anAction->setStatusTip( tr( "DSC_MINIMIZE_VIEW" ) );
     if (toSendSignal) {
-      printf("### OCCViewer_ViewWindow::emitMaximised\n");
       emit maximized( this, true );
     }
   }
@@ -1983,7 +1982,6 @@ void OCCViewer_ViewWindow::setMaximized(bool toMaximize, bool toSendSignal)
     anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MAXIMIZE" ) ) );
     anAction->setStatusTip( tr( "DSC_MAXIMIZE_VIEW" ) );
     if (toSendSignal) {
-      printf("### OCCViewer_ViewWindow::emitMinimised\n");
       emit maximized( this, false );
     }
   }
index bdd523e49e659f0458877d0cef1922a09ce17fa7..e6a032c7a7165a3350a207a5224097a17bac0f36 100644 (file)
         <source>ICON_OCCVIEWER_STYLE_SWITCH</source>
         <translation>occ_view_style_switch.png</translation>
     </message>
+    <message>
+        <source>ICON_OCCVIEWER_MAXIMIZE</source>
+        <translation>occ_view_maximized.png</translation>
+    </message>
+    <message>
+        <source>ICON_OCCVIEWER_MINIMIZE</source>
+        <translation>occ_view_minimized.png</translation>
+    </message>
 </context>
 </TS>
index 5fcc11b74551cd9be5f3eca3be098da8c570193d..0019b35dd87067051bcd2a03d29e941198a2afcd 100644 (file)
         <source>OCC_IMAGE_FILES</source>
         <translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
     </message>
+    <message>
+        <source>DSC_MAXIMIZE_VIEW</source>
+        <translation>Maximize view</translation>
+    </message>
+    <message>
+        <source>DSC_MINIMIZE_VIEW</source>
+        <translation>Minimize view</translation>
+    </message>
+    <message>
+        <source>MNU_MAXIMIZE_VIEW</source>
+        <translation>Maximize</translation>
+    </message>
+    <message>
+        <source>MNU_MINIMIZE_VIEW</source>
+        <translation>Minimize</translation>
+    </message>
 </context>
 <context>
     <name>OCCViewer_CreateRestoreViewDlg</name>
diff --git a/src/OCCViewer/resources/occ_view_maximized.png b/src/OCCViewer/resources/occ_view_maximized.png
new file mode 100644 (file)
index 0000000..8e19d6a
Binary files /dev/null and b/src/OCCViewer/resources/occ_view_maximized.png differ
diff --git a/src/OCCViewer/resources/occ_view_minimized.png b/src/OCCViewer/resources/occ_view_minimized.png
new file mode 100644 (file)
index 0000000..b38bbeb
Binary files /dev/null and b/src/OCCViewer/resources/occ_view_minimized.png differ
index 260bed36e5692ef21b8d2a56c520b18d6fd0c7b7..4d8fa63cf3a3785e0951b37e47a45ae1e251b7ce 100755 (executable)
@@ -706,9 +706,18 @@ void SOCC_Viewer::Repaint()
 /*!
   create SOCC_ViewWindow
 */
-SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
+/*SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
 {
   SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this);
-  initView( view );
+  //initView( view );
+  initView( view->getView(OCCViewer_ViewFrame::MAIN_VIEW) );
   return view;
+  }*/
+
+/* 
+ * Returns a new OCCViewer_ViewWindow instance which will be placed as a sub window in ViewFrame
+ */
+OCCViewer_ViewWindow* SOCC_Viewer::createSubWindow()
+{
+  return new SOCC_ViewWindow( 0,  this);
 }
index 7a5b10ef436ae9ce458c2a39f524da459e0d1ba1..92c919032973bbf5d029581b8298b04d5a2bd78c 100755 (executable)
@@ -51,7 +51,8 @@ public:
 
   void      rename( const Handle(SALOME_InteractiveObject)&, const QString& );
 
-  virtual   SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
+  //virtual   SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
+  virtual OCCViewer_ViewWindow* createSubWindow();
 
   /* Reimplemented from SALOME_View */
   virtual void                Display( const SALOME_OCCPrs* );
index 90338fbef304598ed7defb39489e6e635e6cafce..ac18551a168147a49019056cae0a7cb3b5e654dd 100644 (file)
@@ -28,7 +28,7 @@
 #endif
 
 #include "SOCC.h"
-#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewFrame.h"
 
 class SOCC_EXPORT SOCC_ViewWindow : public OCCViewer_ViewWindow
 {
index 5b09273dab913c222b9fcf11b6e265b55e69a774..7043c8497e18d3538bb08545d2b41b0c9c92fa40 100755 (executable)
@@ -43,7 +43,7 @@ public:
   SUIT_ViewWindow( SUIT_Desktop* );
   virtual ~SUIT_ViewWindow();
 
-  void              setViewManager( SUIT_ViewManager* );
+  virtual void      setViewManager( SUIT_ViewManager* );
   SUIT_ViewManager* getViewManager() const;
 
   bool              event(QEvent*);