]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Merge from V6_1_BR (TRIPOLI development)
authorvsr <vsr@opencascade.com>
Tue, 23 Nov 2010 11:23:41 +0000 (11:23 +0000)
committervsr <vsr@opencascade.com>
Tue, 23 Nov 2010 11:23:41 +0000 (11:23 +0000)
29 files changed:
src/LightApp/LightApp_Application.cxx
src/LightApp/resources/LightApp.xml
src/LightApp/resources/LightApp_msg_en.ts
src/OCCViewer/Makefile.am
src/OCCViewer/OCCViewer_AxialScaleDlg.cxx
src/OCCViewer/OCCViewer_AxialScaleDlg.h
src/OCCViewer/OCCViewer_ClippingDlg.cxx
src/OCCViewer/OCCViewer_ClippingDlg.h
src/OCCViewer/OCCViewer_SetRotationPointDlg.cxx
src/OCCViewer/OCCViewer_SetRotationPointDlg.h
src/OCCViewer/OCCViewer_ViewFrame.cxx [new file with mode: 0644]
src/OCCViewer/OCCViewer_ViewFrame.h [new file with mode: 0644]
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewPort3d.cxx
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h
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_LicenseDlg.cxx
src/SUIT/SUIT_SelectionMgr.cxx
src/SUIT/SUIT_ViewWindow.cxx
src/SUIT/SUIT_ViewWindow.h
src/SalomeApp/resources/SalomeApp.xml

index b1b027d9292aa5191717bf432738cf63c00b5146..63252a82266d2104681c3ce543cd80355f4a9585 100644 (file)
 
 #ifndef DISABLE_OCCVIEWER
   #include <OCCViewer_ViewManager.h>
+  #include <OCCViewer_ViewFrame.h>
 #ifndef DISABLE_SALOMEOBJECT
   #include <SOCC_ViewModel.h>
 #else
@@ -1343,7 +1344,16 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType
 #else
     vm = new OCCViewer_Viewer( true, resMgr->booleanValue( "OCCViewer", "static_trihedron", true ) );
 #endif
-    vm->setBackgroundColor( resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) );
+    vm->setBackgroundColor( OCCViewer_ViewFrame::TOP_LEFT, 
+                            resMgr->colorValue( "OCCViewer", "xz_background", vm->backgroundColor() ) );
+    vm->setBackgroundColor( OCCViewer_ViewFrame::TOP_RIGHT, 
+                           resMgr->colorValue( "OCCViewer", "yz_background", vm->backgroundColor() ) );
+    
+    vm->setBackgroundColor( OCCViewer_ViewFrame::BOTTOM_LEFT,
+                            resMgr->colorValue( "OCCViewer", "xy_background", vm->backgroundColor() ) );
+    vm->setBackgroundColor( OCCViewer_ViewFrame::BOTTOM_RIGHT, 
+                           resMgr->colorValue( "OCCViewer", "background", vm->backgroundColor() ) );
+    
     vm->setTrihedronSize( resMgr->doubleValue( "OCCViewer", "trihedron_size", vm->trihedronSize() ) );
     int u( 1 ), v( 1 );
     vm->isos( u, v );
@@ -1902,22 +1912,32 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
   pref->setItemProperty( "min", 1.0E-06, occTS );
   pref->setItemProperty( "max", 1000, occTS );
 
+  int occStyleMode = pref->addPreference( tr( "PREF_NAVIGATION" ), occGroup,
+                                          LightApp_Preferences::Selector, "OCCViewer", "navigation_mode" );
+
 
   int isoU = pref->addPreference( tr( "PREF_ISOS_U" ), occGroup,
                                   LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_u" );
   pref->setItemProperty( "min", 0, isoU );
   pref->setItemProperty( "max", 100000, isoU );
 
-  pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup,
-                       LightApp_Preferences::Color, "OCCViewer", "background" );
-
   int isoV = pref->addPreference( tr( "PREF_ISOS_V" ), occGroup,
                                   LightApp_Preferences::IntSpin, "OCCViewer", "iso_number_v" );
   pref->setItemProperty( "min", 0, isoV );
   pref->setItemProperty( "max", 100000, isoV );
 
-  int occStyleMode = pref->addPreference( tr( "PREF_NAVIGATION" ), occGroup,
-                                          LightApp_Preferences::Selector, "OCCViewer", "navigation_mode" );
+  //pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup,
+  //                     LightApp_Preferences::Color, "OCCViewer", "background" );
+  pref->addPreference( tr( "PREF_XZVIEWER_BACKGROUND" ), occGroup,
+                       LightApp_Preferences::Color, "OCCViewer", "xz_background" );
+  pref->addPreference( tr( "PREF_YZVIEWER_BACKGROUND" ), occGroup,
+                       LightApp_Preferences::Color, "OCCViewer", "yz_background" );
+
+  pref->addPreference( tr( "PREF_XYVIEWER_BACKGROUND" ), occGroup,
+                       LightApp_Preferences::Color, "OCCViewer", "xy_background" );
+  pref->addPreference( tr( "PREF_3DVIEWER_BACKGROUND" ), occGroup,
+                       LightApp_Preferences::Color, "OCCViewer", "background" );
+
   QStringList aStyleModeList;
   aStyleModeList.append( tr("PREF_STANDARD_STYLE") );
   aStyleModeList.append( tr("PREF_KEYFREE_STYLE") );
index eceb4911315bca79454fd3df6c938b26837f6d44..2da459c325bdf7a9cf94c57d2f8af174484c2609 100644 (file)
   </section>
   <section name="OCCViewer" >
     <!-- OCC viewer preferences -->
-    <parameter name="background"     value="35, 136, 145" />
+    <parameter name="xz_background"     value="35, 136, 145" />
+    <parameter name="yz_background"     value="35, 136, 145" />
+    <parameter name="xy_background"     value="35, 136, 145" />
+    <parameter name="background"        value="35, 136, 145" />
     <parameter name="iso_number_u"   value="1" />
     <parameter name="iso_number_v"   value="1" />
     <parameter name="trihedron_size" value="100" />
index 2c9178de5908dfb2535e3039a84b9b27abc746db..9e799934b25cd4192dbbae9dd5382aad3d30ccd5 100644 (file)
@@ -434,6 +434,22 @@ CEA/DEN, CEDRAT, EDF R&amp;D, LEG, PRINCIPIA R&amp;D, BUREAU VERITAS</translatio
         <source>PREF_VIEWER_BACKGROUND</source>
         <translation>Background color</translation>
     </message>
+    <message>
+        <source>PREF_XYVIEWER_BACKGROUND</source>
+        <translation>XY View background color</translation>
+    </message>
+    <message>
+        <source>PREF_XZVIEWER_BACKGROUND</source>
+        <translation>XZ View background color</translation>
+    </message>
+    <message>
+        <source>PREF_YZVIEWER_BACKGROUND</source>
+        <translation>YZ View background color</translation>
+    </message>
+    <message>
+        <source>PREF_3DVIEWER_BACKGROUND</source>
+        <translation>3D View background color</translation>
+    </message>
     <message>
         <source>PREF_FONT</source>
         <translation>Font</translation>
index 65d59fc7ecef6c884896fbe143aa07b131fedeec..1a5e494971ba65f436061e803d6d313ea522b1ab 100755 (executable)
@@ -44,7 +44,8 @@ salomeinclude_HEADERS =                               \
        OCCViewer_AxialScaleDlg.h               \
        OCCViewer_SetRotationPointDlg.h         \
        OCCViewer_Trihedron.h                   \
-       OCCViewer_ToolTip.h
+       OCCViewer_ToolTip.h \
+       OCCViewer_ViewFrame.h
 
 dist_libOCCViewer_la_SOURCES =                 \
        OCCViewer_AISSelector.cxx               \
@@ -60,7 +61,8 @@ dist_libOCCViewer_la_SOURCES =                        \
        OCCViewer_ClippingDlg.cxx               \
        OCCViewer_AxialScaleDlg.cxx             \
        OCCViewer_Trihedron.cxx                 \
-       OCCViewer_ToolTip.cxx
+       OCCViewer_ToolTip.cxx \
+       OCCViewer_ViewFrame.cxx
 
 MOC_FILES =                                    \
        OCCViewer_AISSelector_moc.cxx           \
@@ -74,8 +76,9 @@ MOC_FILES =                                   \
        OCCViewer_SetRotationPointDlg_moc.cxx   \
        OCCViewer_ClippingDlg_moc.cxx           \
        OCCViewer_AxialScaleDlg_moc.cxx         \
-       OCCViewer_ToolTip_moc.cxx
-       
+       OCCViewer_ToolTip_moc.cxx \
+       OCCViewer_ViewFrame_moc.cxx
+
 nodist_libOCCViewer_la_SOURCES = $(MOC_FILES)
 
 dist_salomeres_DATA =                          \
@@ -101,7 +104,9 @@ dist_salomeres_DATA =                               \
        resources/occ_view_top.png              \
        resources/occ_view_triedre.png          \
        resources/occ_view_zoom.png             \
-       resources/occ_view_rotation_point.png
+       resources/occ_view_rotation_point.png \
+       resources/occ_view_maximized.png \
+       resources/occ_view_minimized.png
 
 nodist_salomeres_DATA =                \
        OCCViewer_images.qm     \
index df14c95620512ba580e8a8ab9efc2d1327cdd0f2..55eed127873246ca3693194cd95710c9ca2947c1 100644 (file)
@@ -39,8 +39,8 @@
   \param view - view window
   \param parent - parent widget
 */
-OCCViewer_AxialScaleDlg::OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* view, QWidget* parent )
-  : QDialog( parent ),
+OCCViewer_AxialScaleDlg::OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* view )
+  : QDialog( view ),
     myView( view )
 {
   setWindowTitle( tr( "DLG_SCALING" ) );
index 17f55f4003164e21c258eec1047a47f324dc37a6..3c6cde4c783dfb2d25f9eee00db0e815e2758044 100644 (file)
@@ -33,7 +33,7 @@ class OCCVIEWER_EXPORT OCCViewer_AxialScaleDlg : public QDialog
   Q_OBJECT
 
 public:
-  OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow*, QWidget* = 0 );
+  OCCViewer_AxialScaleDlg( OCCViewer_ViewWindow* );
   ~OCCViewer_AxialScaleDlg();
 
   void Update();
index 4fb3b48b0108377375bcc0c8a739e5cce6d5b18e..dab14bd5ff5e13d99a4bc254846974a8dc8a7297 100644 (file)
@@ -62,8 +62,8 @@
   \param modal - is this dialog modal
   \param fl - flags
 */
-OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl )
-: QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+OCCViewer_ClippingDlg::OCCViewer_ClippingDlg( OCCViewer_ViewWindow* view, const char* name, bool modal, Qt::WindowFlags fl )
+: QDialog( view, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
   myView( view )
 {
   setObjectName( "OCCViewer_ClippingDlg" );
@@ -266,9 +266,9 @@ void OCCViewer_ClippingDlg::closeEvent( QCloseEvent* e )
   erasePreview();
   
   // Set the clipping plane back
-  Handle(V3d_View) aView3d = myView->getViewPort()->getView();
+  /*Handle(V3d_View) aView3d = myView->getViewPort()->getView();
   if ( !aView3d.IsNull() && !myClippingPlane.IsNull() )
-    aView3d->SetPlaneOn( myClippingPlane );
+  aView3d->SetPlaneOn( myClippingPlane );*/
   
   myAction->setChecked( false );
   
@@ -281,7 +281,7 @@ void OCCViewer_ClippingDlg::closeEvent( QCloseEvent* e )
 */
 void OCCViewer_ClippingDlg::showEvent( QShowEvent* e )
 {
-  ReserveClippingPlane();
+  //ReserveClippingPlane();
   
   QDialog::showEvent( e );
   onPreview( PreviewChB->isChecked() );
@@ -306,10 +306,10 @@ void OCCViewer_ClippingDlg::ClickOnClose()
   erasePreview();
 
   // Set the clipping plane back
-  Handle(V3d_View) aView3d = myView->getViewPort()->getView();
+  /*Handle(V3d_View) aView3d = myView->getViewPort()->getView();
   if ( !aView3d.IsNull() && !myClippingPlane.IsNull() )
     aView3d->SetPlaneOn( myClippingPlane );
-
+  */
   myAction->setChecked( false );
   
   reject();
@@ -332,7 +332,7 @@ void OCCViewer_ClippingDlg::ClickOnApply()
   
   erasePreview();
   
-  ReserveClippingPlane();
+  //ReserveClippingPlane();
 }
 
 /*!
@@ -504,7 +504,8 @@ void OCCViewer_ClippingDlg::displayPreview()
   myPreviewPlane->SetSize( aSize, aSize );
   
   // Deactivate clipping planes
-  myView->getViewPort()->getView()->SetPlaneOff();
+  //myView->getViewPort()->getView()->SetPlaneOff();
+  //myView->setPlaneOff();
 
   ic->Display( myPreviewPlane, 1, -1, false );
   ic->SetWidth( myPreviewPlane, 10, false );
@@ -575,13 +576,13 @@ bool OCCViewer_ClippingDlg::isValid()
 */
 void OCCViewer_ClippingDlg::ReserveClippingPlane()
 {
-  Handle(V3d_View) aView3d = myView->getViewPort()->getView();
+  /*Handle(V3d_View) aView3d = myView->getViewPort()->getView();
   if ( !aView3d.IsNull() )
     {
       aView3d->InitActivePlanes();
       if ( aView3d->MoreActivePlanes() )
         myClippingPlane = aView3d->ActivePlane();
-    }
+        }*/
 }
 
 void OCCViewer_ClippingDlg::onViewShow()
index 8639661b7e93427f39dbdf4deea8d94b774b68c8..2baa05360b63a410240feb25bd062792053dfa9f 100644 (file)
@@ -50,7 +50,7 @@ class OCCViewer_ClippingDlg : public QDialog
     Q_OBJECT
     
     public:
-    OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
+    OCCViewer_ClippingDlg(OCCViewer_ViewWindow* , const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
     ~OCCViewer_ClippingDlg();
 
     void SetAction( QtxAction* theAction ) { myAction = theAction; }
@@ -94,7 +94,7 @@ private :
     OCCViewer_ViewWindow* myView;
 
     Handle(AIS_Plane) myPreviewPlane;
-    Handle(V3d_Plane) myClippingPlane;
+    //Handle(V3d_Plane) myClippingPlane;
     
     bool myBusy;
 
index d5d1310143c75026c3b7bc0c5f59a982e2615b99..fefc08a51316bfd476df8ca2096d4f727226a18d 100644 (file)
@@ -43,8 +43,8 @@
   \param modal - is this dialog modal
   \param fl - flags
 */
-OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWindow* view, QWidget* parent, const char* name, bool modal, Qt::WindowFlags fl )
-: QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
+OCCViewer_SetRotationPointDlg::OCCViewer_SetRotationPointDlg( OCCViewer_ViewWindow* view, const char* name, bool modal, Qt::WindowFlags fl )
+: QDialog( view, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
   myView( view )
 {
   setObjectName( "OCCViewer_SetRotationPointDlg" );
index 83cccad42043291622e7ddc17abddeab5f0f9cf6..31a2a5461490d95b7c0fafc56e1d7320338eb6e2 100644 (file)
@@ -41,7 +41,7 @@ class OCCVIEWER_EXPORT OCCViewer_SetRotationPointDlg : public QDialog
   Q_OBJECT
 
 public:
-  OCCViewer_SetRotationPointDlg(OCCViewer_ViewWindow* , QWidget* parent = 0, 
+  OCCViewer_SetRotationPointDlg(OCCViewer_ViewWindow* , 
                                 const char* name = 0, bool modal = FALSE, Qt::WindowFlags fl = 0);
   ~OCCViewer_SetRotationPointDlg();
 
diff --git a/src/OCCViewer/OCCViewer_ViewFrame.cxx b/src/OCCViewer/OCCViewer_ViewFrame.cxx
new file mode 100644 (file)
index 0000000..e0eedf6
--- /dev/null
@@ -0,0 +1,248 @@
+//  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
+//
+
+#include "OCCViewer_ViewFrame.h"
+#include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewModel.h"
+
+#include <SUIT_ViewManager.h>
+
+#include <QFrame>
+#include <QLayout>
+#include <QApplication>
+
+OCCViewer_ViewFrame::OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel)
+  : OCCViewer_ViewWindow( theDesktop, theModel ), myPopupRequestedView(0)
+{
+  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(aModel->backgroundColor(i));
+      }
+      myLayout->addWidget( myViews.at(BOTTOM_LEFT), 1, 0 );
+      myLayout->addWidget( myViews.at(TOP_LEFT), 0, 0 );
+      myLayout->addWidget( myViews.at(TOP_RIGHT), 0, 1 );
+    }
+    OCCViewer_ViewWindow* view = 0;
+    for ( i = BOTTOM_RIGHT; i <= TOP_RIGHT; i++) {
+      view = myViews.at(i);
+      view->show();
+      QApplication::processEvents();
+      if (view != theView)
+        view->onViewFitAll();
+    }
+  }
+  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); 
+    aView->update();
+  }
+}
+
+//**************************************************************************************
+void OCCViewer_ViewFrame::setCuttingPlane( bool on, const gp_Pln thePln ) 
+{ 
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    aView->setCuttingPlane(on, thePln); 
+    aView->update();
+  }
+}
+  
+//**************************************************************************************
+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*) ) );
+
+  // The signal is used to process get/set bacgrounf\d color from popup
+  connect( theView, SIGNAL( contextMenuRequested(QContextMenuEvent*) ), 
+           this, SLOT( onContextMenuRequested(QContextMenuEvent*) ) );
+
+  connect( theView, SIGNAL( contextMenuRequested(QContextMenuEvent*) ), 
+           this, SIGNAL( contextMenuRequested(QContextMenuEvent*) ) );
+}
+
+void OCCViewer_ViewFrame::setBackgroundColor( const QColor& theColor)
+{
+  if (myPopupRequestedView)
+    myPopupRequestedView->setBackgroundColor(theColor); 
+  else {
+    foreach (OCCViewer_ViewWindow* aView, myViews) {
+      if (aView->isVisible())
+        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(); 
+  }
+}
+  
+QColor OCCViewer_ViewFrame::backgroundColor() const 
+{ 
+  if (myPopupRequestedView)
+    return myPopupRequestedView->backgroundColor(); 
+
+  foreach (OCCViewer_ViewWindow* aView, myViews) {
+    if (aView->isVisible())
+      return aView->backgroundColor(); 
+  }
+  return getView(MAIN_VIEW)->backgroundColor(); 
+}
+
+void OCCViewer_ViewFrame::onContextMenuRequested(QContextMenuEvent*)
+{
+  myPopupRequestedView = dynamic_cast<OCCViewer_ViewWindow*>(sender());
+}
+
+void OCCViewer_ViewFrame::onDumpView()
+{
+  if (myPopupRequestedView) {
+    myPopupRequestedView->onDumpView(); 
+  }
+  else {
+    getView(MAIN_VIEW)->onDumpView(); 
+  }
+}
diff --git a/src/OCCViewer/OCCViewer_ViewFrame.h b/src/OCCViewer/OCCViewer_ViewFrame.h
new file mode 100644 (file)
index 0000000..19212da
--- /dev/null
@@ -0,0 +1,122 @@
+//  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 getView(MAIN_VIEW)->getViewPort(); }
+  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;
+  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();
+
+private slots:
+  void onContextMenuRequested(QContextMenuEvent*);
+
+private:
+  void connectViewSignals(OCCViewer_ViewWindow* theView);
+
+
+  QList<OCCViewer_ViewWindow*> myViews;
+  QGridLayout* myLayout;
+
+  OCCViewer_ViewWindow* myPopupRequestedView;
+};
+
+#endif
index caea7732622cc0079fde91928e4af40e6dde6e0a..ebc094f48e0f5c8c775e891ca7a965aa48d42edb 100755 (executable)
@@ -22,6 +22,7 @@
 
 #include "OCCViewer_ViewModel.h"
 #include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewFrame.h"
 #include "OCCViewer_VService.h"
 #include "OCCViewer_ViewPort3d.h"
 
@@ -61,8 +62,8 @@
 */
 OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron, bool DisplayStaticTrihedron )
 : SUIT_ViewModel(),
-  myBgColor( Qt::black ),
-  myShowStaticTrihedron( DisplayStaticTrihedron )
+  myShowStaticTrihedron( DisplayStaticTrihedron ),
+  myColors(4, Qt::black)
 {
   // init CasCade viewers
   myV3dViewer = OCCViewer_VService::Viewer3d( "", (short*) "Viewer3d", "", 1000.,
@@ -114,7 +115,7 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron, bool DisplayStaticTri
 
     myAISContext->Display(myTrihedron);
     myAISContext->Deactivate(myTrihedron);
-  }
+    }
 
   // set interaction style to standard
   myInteractionStyle = 0;
@@ -136,7 +137,7 @@ OCCViewer_Viewer::~OCCViewer_Viewer()
 */
 QColor OCCViewer_Viewer::backgroundColor() const
 {
-  return myBgColor;
+  return myColors[0];
 }
 
 /*!
@@ -145,8 +146,7 @@ QColor OCCViewer_Viewer::backgroundColor() const
 */
 void OCCViewer_Viewer::setBackgroundColor( const QColor& c )
 {
-  if ( c.isValid() )
-    myBgColor = c;
+  setBackgroundColor( 0, c );
 }
 
 /*!
@@ -162,7 +162,7 @@ void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
     
     OCCViewer_ViewPort3d* vp3d = view->getViewPort();
     if ( vp3d )
-      vp3d->setBackgroundColor( myBgColor );
+      vp3d->setBackgroundColor( myColors[0] );
   }
 }
 
@@ -172,8 +172,9 @@ void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view )
 */
 SUIT_ViewWindow* OCCViewer_Viewer::createView( SUIT_Desktop* theDesktop )
 {
-  OCCViewer_ViewWindow* view = new OCCViewer_ViewWindow(theDesktop, this);
-  initView( view );
+  //OCCViewer_ViewWindow* view = new OCCViewer_ViewWindow(theDesktop, this);
+  OCCViewer_ViewFrame* view = new OCCViewer_ViewFrame(theDesktop, this);
+  initView( view->getView(OCCViewer_ViewFrame::MAIN_VIEW) );
   return view;
 }
 
@@ -218,12 +219,16 @@ void OCCViewer_Viewer::onMouseMove(SUIT_ViewWindow* theWindow, QMouseEvent* theE
   OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*) theWindow;
 
   if ( isSelectionEnabled() ) {
-    if (aView->getViewPort()->isBusy()) return; // Check that the ViewPort initialization completed
+    if (aView->getViewPort()->isBusy()) {
+      QCoreApplication::processEvents();
+      return; // Check that the ViewPort initialization completed
                                                 // To Prevent call move event if the View port is not initialized
                                                 // IPAL 20883
+    }
     Handle(V3d_View) aView3d = aView->getViewPort()->getView();
-    if ( !aView3d.IsNull() )
+    if ( !aView3d.IsNull() ) {
       myAISContext->MoveTo(theEvent->x(), theEvent->y(), aView3d);
+    }
   }
 }
 
@@ -402,17 +407,12 @@ void OCCViewer_Viewer::onDumpView()
 */
 void OCCViewer_Viewer::onChangeBgColor()
 {
-  OCCViewer_ViewWindow* aView = (OCCViewer_ViewWindow*)(myViewManager->getActiveView());
-  if( !aView )
-    return;
-  OCCViewer_ViewPort3d* aViewPort3d = aView->getViewPort();
-  if( !aViewPort3d )
+  OCCViewer_ViewWindow* aView = dynamic_cast<OCCViewer_ViewWindow*>(myViewManager->getActiveView());
+  if ( !aView )
     return;
-  QColor aColorActive = aViewPort3d->backgroundColor();
-
-  QColor selColor = QColorDialog::getColor( aColorActive, aView);
+  QColor selColor = QColorDialog::getColor( aView->backgroundColor(), aView );
   if ( selColor.isValid() )
-    aViewPort3d->setBackgroundColor(selColor);
+    aView->setBackgroundColor(selColor);
 }
 
 /*!
@@ -708,3 +708,22 @@ void OCCViewer_Viewer::isos( int& u, int& v ) const
     v = ic->IsoNumber( AIS_TOI_IsoV );
   }
 }
+
+/* 
+ * Returns a new OCCViewer_ViewWindow instance which will be placed as a sub window in ViewFrame
+ */
+OCCViewer_ViewWindow* OCCViewer_Viewer::createSubWindow()
+{
+  return new OCCViewer_ViewWindow( 0,  this);
+}
+  
+QColor OCCViewer_Viewer::backgroundColor(int theViewId) const
+{
+  return ( theViewId >= 0 && theViewId < myColors.count() ) ? myColors[theViewId] : Qt::black;
+}
+
+void OCCViewer_Viewer::setBackgroundColor( int theViewId, const QColor& theColor)
+{
+  if ( theColor.isValid() && theViewId >= 0 && theViewId < myColors.count() )
+    myColors[theViewId] = theColor;
+}
index 925b2dc05d7aa1e4e481eaaa0c4d56f8f162979a..94f28153c682996786737063e9c2052bdcfbcc26 100755 (executable)
@@ -25,6 +25,7 @@
 
 #include <QColor>
 #include <QPoint>
+#include <QVector>
 
 #include "OCCViewer.h"
 
@@ -107,6 +108,9 @@ public:
   QColor                          backgroundColor() const;
   void                            setBackgroundColor( const QColor& );
 
+  QColor                          backgroundColor(int theViewId) const;
+  void                            setBackgroundColor( int theViewId, const QColor& );
+
   //! returns true if 3d Trihedron in viewer was created
   bool                            trihedronActivated() const { return !myTrihedron.IsNull(); }
 
@@ -117,6 +121,8 @@ public:
   double                          trihedronSize() const;
   virtual void                    setTrihedronSize( const double );
 
+  virtual OCCViewer_ViewWindow*   createSubWindow();
+
 public slots:
   void                            onClearViewAspects();
  
@@ -150,12 +156,13 @@ public:
   void    setIsos( const int u, const int v ); // number of isolines
   void    isos( int& u, int& v ) const;
 
+  void    initView( OCCViewer_ViewWindow* view );
+
 signals:
   void selectionChanged();
   void deselection();
 
 protected:
-  void initView( OCCViewer_ViewWindow* view );
 
 protected slots:
   void onMousePress(SUIT_ViewWindow*, QMouseEvent*);
@@ -180,10 +187,12 @@ private:
   bool                            mySelectionEnabled;
   bool                            myMultiSelectionEnabled;
 
-  QColor                          myBgColor;
+  //QColor                          myBgColor;
   QPoint                          myStartPnt, myEndPnt;
 
   bool                            myShowStaticTrihedron;
+
+  QVector<QColor>                 myColors;
 };
 
 #ifdef WIN32
index 4b2ebd62cf5481466994efa6840ffca1149ff546..f0cbe3d13efa2f87dbbdbe5ba438676d83f0420e 100755 (executable)
@@ -119,7 +119,7 @@ bool OCCViewer_ViewPort3d::mapView( const Handle(V3d_View)& view )
   }
 
   /* create static trihedron (16551: EDF PAL 501) */
-  OCCViewer_ViewWindow* aVW = dynamic_cast<OCCViewer_ViewWindow*>( parentWidget() );
+  OCCViewer_ViewWindow* aVW = dynamic_cast<OCCViewer_ViewWindow*>( parentWidget()->parentWidget()->parentWidget() );
   if ( aVW ) {
     OCCViewer_Viewer* aViewModel = dynamic_cast<OCCViewer_Viewer*>( aVW->getViewManager()->getViewModel() );
     if ( aViewModel && aViewModel->isStaticTrihedronDisplayed() ){
index ee2ba5cb823795d487d40e4c94c7db276cbc5cd0..a82f2b9832eac83cd2a8559fad9411ecda29d2f0 100755 (executable)
@@ -216,6 +216,7 @@ OCCViewer_ViewWindow::OCCViewer_ViewWindow( SUIT_Desktop*     theDesktop,
 
   mypSketcher = 0;
   myCurSketch = -1;
+  my2dMode = No2dMode;
 
   myInteractionStyle = SUIT_ViewModel::STANDARD;
 }
@@ -250,6 +251,17 @@ void OCCViewer_ViewWindow::initLayout()
 
   createActions();
   createToolBar();
+  switch (my2dMode) {
+  case XYPlane:
+    onTopView();
+    break;
+  case XZPlane:
+    onLeftView();
+    break;
+  case YZPlane:
+    onFrontView();
+    break;
+  }
 }
 
 /*!
@@ -270,7 +282,8 @@ OCCViewer_ViewWindow::getButtonState( QMouseEvent* theEvent, int theInteractionS
            (theEvent->buttons() == SUIT_ViewModel::myButtonMap[aStyle][SUIT_ViewModel::PAN]) )
     aOp = PANVIEW;
   else if( (theEvent->modifiers()  == SUIT_ViewModel::myStateMap[aStyle][SUIT_ViewModel::ROTATE]) &&
-           (theEvent->buttons() == SUIT_ViewModel::myButtonMap[aStyle][SUIT_ViewModel::ROTATE]) )
+           (theEvent->buttons() == SUIT_ViewModel::myButtonMap[aStyle][SUIT_ViewModel::ROTATE]) &&
+           (my2dMode == No2dMode))
     aOp = ROTATE;
 
   return aOp;
@@ -1137,6 +1150,13 @@ void OCCViewer_ViewWindow::createActions()
   aAction->setCheckable(true);
   connect(aAction, SIGNAL(toggled(bool)), this, SLOT(onSwitchInteractionStyle(bool)));
   toolMgr()->registerAction( aAction, SwitchInteractionStyleId );
+
+ // Maximized view
+  aAction = new QtxAction(tr("MNU_MINIMIZE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MINIMIZE" ) ),
+                          tr( "MNU_MINIMIZE_VIEW" ), 0, this );
+  aAction->setStatusTip(tr("DSC_MINIMIZE_VIEW"));
+  connect(aAction, SIGNAL(triggered()), this, SLOT(onMaximizedView()));
+  toolMgr()->registerAction( aAction, MaximizedId );
 }
 
 /*!
@@ -1144,11 +1164,26 @@ void OCCViewer_ViewWindow::createActions()
 */
 void OCCViewer_ViewWindow::createToolBar()
 {
-  int tid = toolMgr()->createToolBar( tr( "LBL_TOOLBAR_LABEL" ), false );
+  QString aToolbarName;
+  switch (my2dMode) {
+  case XYPlane:
+    aToolbarName = tr( "LBL_XYTOOLBAR_LABEL" );
+    break;
+  case XZPlane:
+    aToolbarName = tr( "LBL_XZTOOLBAR_LABEL" );
+    break;
+  case YZPlane:
+    aToolbarName = tr( "LBL_YZTOOLBAR_LABEL" );
+    break;
+  default:
+    aToolbarName = tr( "LBL_3DTOOLBAR_LABEL" );
+  }
+  
+  int tid = toolMgr()->createToolBar( aToolbarName, false );
 
   toolMgr()->append( DumpId, tid );
   toolMgr()->append( SwitchInteractionStyleId, tid );
-  if( myModel->trihedronActivated() 
+  if( myModel->trihedronActivated() && (my2dMode == No2dMode) )
     toolMgr()->append( TrihedronShowId, tid );
 
   QtxMultiAction* aScaleAction = new QtxMultiAction( this );
@@ -1162,32 +1197,37 @@ void OCCViewer_ViewWindow::createToolBar()
   aPanningAction->insertAction( toolMgr()->action( GlobalPanId ) );
   toolMgr()->append( aPanningAction, tid );
 
-  toolMgr()->append( ChangeRotationPointId, tid );
-  toolMgr()->append( RotationId, tid );
-
-  QtxMultiAction* aViewsAction = new QtxMultiAction( this );
-  aViewsAction->insertAction( toolMgr()->action( FrontId ) );
-  aViewsAction->insertAction( toolMgr()->action( BackId ) );
-  aViewsAction->insertAction( toolMgr()->action( TopId ) );
-  aViewsAction->insertAction( toolMgr()->action( BottomId ) );
-  aViewsAction->insertAction( toolMgr()->action( LeftId ) );
-  aViewsAction->insertAction( toolMgr()->action( RightId ) );
-  toolMgr()->append( aViewsAction, tid );
-
-  toolMgr()->append( ResetId, tid );
+  if (my2dMode == No2dMode) {
+    toolMgr()->append( ChangeRotationPointId, tid );
+    toolMgr()->append( RotationId, tid );
+
+    QtxMultiAction* aViewsAction = new QtxMultiAction( this );
+    aViewsAction->insertAction( toolMgr()->action( FrontId ) );
+    aViewsAction->insertAction( toolMgr()->action( BackId ) );
+    aViewsAction->insertAction( toolMgr()->action( TopId ) );
+    aViewsAction->insertAction( toolMgr()->action( BottomId ) );
+    aViewsAction->insertAction( toolMgr()->action( LeftId ) );
+    aViewsAction->insertAction( toolMgr()->action( RightId ) );
+    toolMgr()->append( aViewsAction, tid );
+  
+    toolMgr()->append( ResetId, tid );
 
-  QtxMultiAction* aMemAction = new QtxMultiAction( this );
-  aMemAction->insertAction( toolMgr()->action( MemId ) );
-  aMemAction->insertAction( toolMgr()->action( RestoreId ) );
-  toolMgr()->append( aMemAction, tid );
+    QtxMultiAction* aMemAction = new QtxMultiAction( this );
+    aMemAction->insertAction( toolMgr()->action( MemId ) );
+    aMemAction->insertAction( toolMgr()->action( RestoreId ) );
+    toolMgr()->append( aMemAction, tid );
 
-  toolMgr()->append( toolMgr()->separator(), tid );
-  toolMgr()->append( CloneId, tid );
+    toolMgr()->append( toolMgr()->separator(), tid );
+    toolMgr()->append( CloneId, tid );
   
-  toolMgr()->append( toolMgr()->separator(), tid );
-  toolMgr()->append( ClippingId, tid );
-  toolMgr()->append( AxialScaleId, tid );
-  toolMgr()->append( AmbientId, tid );
+    toolMgr()->append( toolMgr()->separator(), tid );
+    toolMgr()->append( ClippingId, tid );
+    toolMgr()->append( AxialScaleId, tid );
+    toolMgr()->append( AmbientId, tid );
+  } else {
+    toolMgr()->append( AxialScaleId, tid );
+  }
+  toolMgr()->append( MaximizedId,  tid);
 }
 
 /*!
@@ -1306,7 +1346,7 @@ void OCCViewer_ViewWindow::onSetRotationPoint( bool on )
   {
     if (!mySetRotationPointDlg)
     {
-      mySetRotationPointDlg = new OCCViewer_SetRotationPointDlg (this, myDesktop);
+      mySetRotationPointDlg = new OCCViewer_SetRotationPointDlg (this);
       mySetRotationPointDlg->SetAction(mySetRotationPointAction);
     }
 
@@ -1355,23 +1395,26 @@ void OCCViewer_ViewWindow::onClipping( bool on )
   else
     myActionsMap[ ClippingId ]->setIcon(aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_CLIPPING" )));
   */
+  OCCViewer_ViewWindow* aParent = dynamic_cast<OCCViewer_ViewWindow*>(parent()->parent());
+  if (!aParent)
+    aParent = this;
   if ( on )
-  {
-    if ( !myClippingDlg )
     {
-      myClippingDlg = new OCCViewer_ClippingDlg( this, myDesktop );
-      myClippingDlg->SetAction( myClippingAction );
-    }
+      if ( !myClippingDlg )
+        {
+          myClippingDlg = new OCCViewer_ClippingDlg( aParent );
+          myClippingDlg->SetAction( myClippingAction );
+        }
     
-    if ( !myClippingDlg->isVisible() )
-      myClippingDlg->show();
-  }
+      if ( !myClippingDlg->isVisible() )
+        myClippingDlg->show();
+    }
   else
-  {
-    if ( myClippingDlg->isVisible() )
-      myClippingDlg->hide();
-    setCuttingPlane(false);
-  }
+    {
+      if ( myClippingDlg->isVisible() )
+        myClippingDlg->hide();
+      aParent->setCuttingPlane(false);
+    }
 }
 
 /*!
@@ -1380,7 +1423,7 @@ void OCCViewer_ViewWindow::onClipping( bool on )
 void OCCViewer_ViewWindow::onAxialScale()
 {
   if ( !myScalingDlg )
-    myScalingDlg = new OCCViewer_AxialScaleDlg( this, myDesktop );
+    myScalingDlg = new OCCViewer_AxialScaleDlg( this );
   
   if ( !myScalingDlg->isVisible() )
     myScalingDlg->show();
@@ -1504,14 +1547,18 @@ QImage OCCViewer_ViewWindow::dumpView()
   Handle(V3d_View) view = myViewPort->getView();
   if ( view.IsNull() )
     return QImage();
+  
   int aWidth = myViewPort->width();
   int aHeight = myViewPort->height();
   QApplication::syncX();
-  view->Update();
+  view->Redraw(); // In order to reactivate GL context
+  //view->Update();
 
   OpenGLUtils_FrameBuffer aFrameBuffer;
   if( aFrameBuffer.init( aWidth, aHeight ) )
   {
+    QImage anImage( aWidth, aHeight, QImage::Format_RGB32 );
+   
     glPushAttrib( GL_VIEWPORT_BIT );
     glViewport( 0, 0, aWidth, aHeight );
     aFrameBuffer.bind();
@@ -1522,8 +1569,6 @@ QImage OCCViewer_ViewWindow::dumpView()
     aFrameBuffer.unbind();
     glPopAttrib();
 
-    QImage anImage( aWidth, aHeight, QImage::Format_RGB32 );
-
     aFrameBuffer.bind();
     glReadPixels( 0, 0, aWidth, aHeight, GL_RGBA, GL_UNSIGNED_BYTE, anImage.bits() );
     aFrameBuffer.unbind();
@@ -1532,9 +1577,8 @@ QImage OCCViewer_ViewWindow::dumpView()
     anImage = anImage.mirrored();
     return anImage;
   }
-
   // if frame buffers are unsupported, use old functionality
-  view->Redraw();
+  //view->Redraw();
 
   unsigned char* data = new unsigned char[ aWidth*aHeight*4 ];
 
@@ -1616,6 +1660,14 @@ void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x,  const doub
   view->Redraw();
 }
 
+void OCCViewer_ViewWindow::setCuttingPlane( bool on, const gp_Pln pln )
+{
+  gp_Dir aDir = pln.Axis().Direction();
+  gp_Pnt aPnt = pln.Location();
+  setCuttingPlane(on, aPnt.X(), aPnt.Y(), aPnt.Z(), aDir.X(), aDir.Y(), aDir.Z());
+}
+
+
 /*!
   \brief Check if any cutting plane is enabled
   \return \c true if at least one cutting plane is enabled
@@ -1927,3 +1979,56 @@ bool OCCViewer_ViewWindow::transformEnabled( const OperationType id ) const
 {
   return myStatus.contains( id ) ? myStatus[ id ] : true;
 }
+
+void OCCViewer_ViewWindow::onMaximizedView()
+{
+  setMaximized(!isMaximized());
+}
+
+
+void OCCViewer_ViewWindow::setMaximized(bool toMaximize, bool toSendSignal)
+{
+  QAction* anAction =  toolMgr()->action( MaximizedId );
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  if ( toMaximize ) {
+    anAction->setText( tr( "MNU_MINIMIZE_VIEW" ) );  
+    anAction->setToolTip( tr( "MNU_MINIMIZE_VIEW" ) );  
+    anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MINIMIZE" ) ) );
+    anAction->setStatusTip( tr( "DSC_MINIMIZE_VIEW" ) );
+    if (toSendSignal) {
+      emit maximized( this, true );
+    }
+  }
+  else {
+    anAction->setText( tr( "MNU_MAXIMIZE_VIEW" ) );  
+    anAction->setToolTip( tr( "MNU_MAXIMIZE_VIEW" ) );  
+    anAction->setIcon( aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_MAXIMIZE" ) ) );
+    anAction->setStatusTip( tr( "DSC_MAXIMIZE_VIEW" ) );
+    if (toSendSignal) {
+      emit maximized( this, false );
+    }
+  }
+}
+
+
+bool OCCViewer_ViewWindow::isMaximized() const
+{
+  return !(toolMgr()->action( MaximizedId )->text() == tr( "MNU_MAXIMIZE_VIEW" ));
+}
+
+
+void OCCViewer_ViewWindow::set2dMode(Mode2dType theType)
+{
+  my2dMode = theType;
+}
+   
+QColor OCCViewer_ViewWindow::backgroundColor() const
+{
+  return myViewPort ? myViewPort->backgroundColor() : Qt::black;
+}
+   
+void OCCViewer_ViewWindow::setBackgroundColor( const QColor& theColor)
+{
+  if ( myViewPort ) myViewPort->setBackgroundColor( theColor );
+}
+
index 56558b5b7e64939dbc90910403eee34fcba0b77d..498748a7c02e67600757a22d68f4d149cc5dbffa 100755 (executable)
@@ -26,6 +26,7 @@
 #include "OCCViewer.h"
 #include "SUIT_ViewWindow.h"
 #include <gp_Pnt.hxx>
+#include <V3d_Plane.hxx>
 
 class QtxRectRubberBand;
 class SUIT_Desktop;
@@ -35,7 +36,7 @@ class OCCViewer_ClippingDlg;
 class OCCViewer_AxialScaleDlg;
 class OCCViewer_SetRotationPointDlg;
 class OCCViewer_Viewer;
-class viewAspect;
+struct viewAspect;
 class QtxAction;
 
 #ifdef WIN32
@@ -50,7 +51,7 @@ public:
   enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId,
          ChangeRotationPointId, RotationId,
          FrontId, BackId, TopId, BottomId, LeftId, RightId, ResetId, CloneId, ClippingId, MemId, RestoreId,
-         TrihedronShowId, AxialScaleId, AmbientId, SwitchInteractionStyleId };
+         TrihedronShowId, AxialScaleId, AmbientId, SwitchInteractionStyleId, MaximizedId, UserId };
 
   enum OperationType{ NOTHING, PANVIEW, ZOOMVIEW, ROTATE, 
                       PANGLOBAL, WINDOWFIT, FITALLVIEW, RESETVIEW,
@@ -60,72 +61,90 @@ public:
 
   enum SketchingType { NoSketching, Rect, Polygon };
 
+  enum Mode2dType { No2dMode, XYPlane, XZPlane, YZPlane};
+
+
   OCCViewer_ViewWindow(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
   virtual ~OCCViewer_ViewWindow();
 
-  OCCViewer_ViewPort3d* getViewPort();
+  virtual OCCViewer_ViewPort3d* getViewPort();
 
-  bool eventFilter(QObject* watched, QEvent* e);
+  virtual bool eventFilter(QObject* watched, QEvent* e);
 
-  void performRestoring( const viewAspect& );
+  virtual void performRestoring( const viewAspect& );
   
   virtual void initLayout();
 
-  void updateEnabledDrawMode();
+  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);
 
-  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 );
 
-  bool isCuttingPlane();
+  virtual bool isCuttingPlane();
 
   virtual QString   getVisualParameters();
   virtual void      setVisualParameters( const QString& parameters );
 
-  virtual void            initSketchers();
-  OCCViewer_ViewSketcher* getSketcher( const int );
+  virtual void                    initSketchers();
+  virtual OCCViewer_ViewSketcher* getSketcher( const int );
 
-  void                    activateSketching( int );
+  virtual void                    activateSketching( int );
 
-  int                     interactionStyle() const;
-  void                    setInteractionStyle( const int );
+  virtual int                     interactionStyle() const;
+  virtual void                    setInteractionStyle( const int );
  
   void setTransformEnabled( const OperationType, const bool );
   bool transformEnabled( const OperationType ) const;
 
+
+  void            set2dMode( Mode2dType );
+  Mode2dType      get2dMode() const { return my2dMode; }
+
+  void            setMaximized( bool, bool = true );
+  bool            isMaximized() const;
+
+  virtual QColor  backgroundColor() const;
+  virtual void    setBackgroundColor( const QColor& );
+
+
 public slots:
-  void onFrontView();
-  void onViewFitAll();
-  void onBackView();
-  void onTopView();
-  void onBottomView();
-  void onLeftView();
-  void onRightView();
-  void onResetView();
-  void onFitAll();
-  void activateZoom();
-  void activateWindowFit();
-  void activateRotation();
-  void activatePanning();
-  void activateGlobalPanning();
-  void onSetRotationPoint( bool on );
-  void onCloneView();
-  void onClipping( bool on );
-  void onAxialScale();
-  void onAmbientToogle();
-  void onMemorizeView();
-  void onRestoreView();
-  void onTrihedronShow();
-  void setRestoreFlag();
-  void onSwitchInteractionStyle( bool on );
-
-  void activateSetRotationGravity();
-  void activateSetRotationSelected( double theX, double theY, double theZ );
-  void activateStartPointSelection();
-  void updateGravityCoords();
+  virtual void onFrontView();
+  virtual void onViewFitAll();
+  virtual void onBackView();
+  virtual void onTopView();
+  virtual void onBottomView();
+  virtual void onLeftView();
+  virtual void onRightView();
+  virtual void 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 onCloneView();
+  virtual void onClipping( bool on );
+  virtual void onAxialScale();
+  virtual void onAmbientToogle();
+  virtual void onMemorizeView();
+  virtual void onRestoreView();
+  virtual void onTrihedronShow();
+  virtual void setRestoreFlag();
+  virtual void onSwitchInteractionStyle( bool on );
+
+  virtual void activateSetRotationGravity();
+  virtual void activateSetRotationSelected( double theX, double theY, double theZ );
+  virtual void activateStartPointSelection();
+  virtual void updateGravityCoords();
    
   virtual void showEvent( QShowEvent * );
   virtual void hideEvent( QHideEvent * );
 
+  void onMaximizedView();
+
 
 signals:
   void vpTransformationStarted(OCCViewer_ViewWindow::OperationType type);
@@ -134,6 +153,7 @@ signals:
 
   void Show( QShowEvent * );
   void Hide( QHideEvent * );
+  void maximized( OCCViewer_ViewWindow*, bool );
 
 protected:
   virtual QImage dumpView();
@@ -216,6 +236,10 @@ private:
 
   typedef QMap<OperationType, bool> MapOfTransformStatus;
   MapOfTransformStatus myStatus;
+
+  Mode2dType my2dMode;
+
+  Handle(V3d_Plane) myReserveClippingPlane;
 };
 
 #ifdef WIN32
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..764efc208ab964cc18112b631cf3484c4088a7fa 100644 (file)
         <translation>Restore view</translation>
     </message>
     <message>
-        <source>LBL_TOOLBAR_LABEL</source>
-        <translation>View Operations</translation>
+        <source>LBL_XYTOOLBAR_LABEL</source>
+        <translation>XY View Operations</translation>
+    </message>
+    <message>
+        <source>LBL_XZTOOLBAR_LABEL</source>
+        <translation>XZ View Operations</translation>
+    </message>
+    <message>
+        <source>LBL_YZTOOLBAR_LABEL</source>
+        <translation>YZ View Operations</translation>
+    </message>
+    <message>
+        <source>LBL_3DTOOLBAR_LABEL</source>
+        <translation>3D View Operations</translation>
     </message>
     <message>
         <source>DSC_BACK_VIEW</source>
         <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>Set axonometric projections</translation>
+    </message>
+    <message>
+        <source>MNU_MAXIMIZE_VIEW</source>
+        <translation>Maximize</translation>
+    </message>
+    <message>
+        <source>MNU_MINIMIZE_VIEW</source>
+        <translation>Axonometric views</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 21c6517b2e5f342ca8893de2141ad3d50f52c2d4..77b01f9a68dc100f87eef059bac98cde4f486700 100755 (executable)
@@ -48,10 +48,10 @@ SUIT_LicenseDlg::SUIT_LicenseDlg( bool firstShow, QWidget* parent, const char* n
   setObjectName( name );
   setModal( modal );
   QString env;
-  if ( ::getenv( "TRIPOLI_ROOT_DIR" ) )
-    env = ::getenv( "TRIPOLI_ROOT_DIR" );
+  if ( ::getenv( "SALOME_LICENSE_FILE" ) )
+    env = ::getenv( "SALOME_LICENSE_FILE" );
  
-  QFile file( env + "/share/salome/resources/License.txt" ); // Read the text from a file
+  QFile file( env ); // Read the text from a file
   
   if ( !file.exists() || !file.open( QIODevice::ReadOnly ) )
     return;
index 042631603c8c3bb2e7041264afd8ab8ff147802e..28e204a55d1e3a192177891e39af8cb4f09c68a5 100755 (executable)
@@ -96,6 +96,8 @@ void SUIT_SelectionMgr::selected( SUIT_DataOwnerPtrList& lst, const QString& typ
 
   for ( SelectorList::const_iterator it = mySelectors.begin(); it != mySelectors.end(); ++it )
   {
+    if ( !(*it)->isEnabled() )
+      continue;
     if ( !type.isEmpty() && (*it)->type() != type )
       continue;
 
index ebf0055c94aa6a9d2e11861fa9271fefb0b50ecf..9d41d22d347e786e1f2b90b852f5e37097576d71 100755 (executable)
@@ -157,7 +157,8 @@ void SUIT_ViewWindow::contextMenuEvent( QContextMenuEvent* e )
 */
 void SUIT_ViewWindow::onDumpView()
 {
-  QApplication::postEvent( this, new QPaintEvent( QRect( 0, 0, width(), height() ) ) );
+  // VSV (TRIPOLI dev): next line commented: causes error messages
+  //QApplication::postEvent( this, new QPaintEvent( QRect( 0, 0, width(), height() ) ) );
   QApplication::postEvent( this, new QEvent( (QEvent::Type)DUMP_EVENT ) );
 }
 
@@ -178,18 +179,17 @@ bool SUIT_ViewWindow::event( QEvent* e )
     bool bOk = false;
     if ( myManager && myManager->study() && myManager->study()->application() )
     {
-      QImage im = dumpView();
-
       // get file name
       SUIT_Application* app = myManager->study()->application();
       QString fileName = app->getFileName( false, QString(), filter(), tr( "TLT_DUMP_VIEW" ), 0 );
       if ( !fileName.isEmpty() )
       {
-              QString fmt = SUIT_Tools::extension( fileName ).toUpper();
-              bOk = dumpViewToFormat( im, fileName, fmt );
+        QImage im = dumpView();
+        QString fmt = SUIT_Tools::extension( fileName ).toUpper();
+        bOk = dumpViewToFormat( im, fileName, fmt );
       }
       else
-              bOk = true; // cancelled
+        bOk = true; // cancelled
     }
     if ( !bOk )
       SUIT_MessageBox::critical( this, tr( "ERROR" ), tr( "ERR_CANT_DUMP_VIEW" ) );
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*);
index 1500aedaf036fcfc7cc6790ce648be47a8abf495..970ca1d78c9c9d70ab9367a90fa047246dcc7916 100644 (file)
   </section>
   <section name="OCCViewer" >
     <!-- OCC viewer preferences -->
-    <parameter name="background"     value="35, 136, 145" />
+    <parameter name="xz_background"     value="35, 136, 145" />
+    <parameter name="yz_background"     value="35, 136, 145" />
+    <parameter name="xy_background"     value="35, 136, 145" />
+    <parameter name="background"        value="35, 136, 145" />
     <parameter name="iso_number_u"   value="1" />
     <parameter name="iso_number_v"   value="1" />
     <parameter name="trihedron_size" value="100" />