Salome HOME
SMH: 3.0.0 preparation - merged and adopted version (POLYWORK+HEAD)
[modules/visu.git] / src / VISUGUI / VisuGUI_CutPlanesDlg.cxx
index 7758df1e5f2e3cb768499dd7b63551ee6539a28f..185a6c819fda94950ca889842f74c29b0dfc379c 100644 (file)
@@ -1,41 +1,49 @@
 //  VISU VISUGUI : GUI of VISU component
 //
 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
 //
 //
 //
 //  File   : VisuGUI_CutPlanesDlg.cxx
-//  Author : Laurent CORNABE & Hubert ROLLAND 
+//  Author : Laurent CORNABE & Hubert ROLLAND
 //  Module : VISU
 //  $Header$
 
 #include "VisuGUI_CutPlanesDlg.h"
+
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
 #include "VISU_CutPlanes_i.hh"
 #include "VISU_CutPlanesPL.hxx"
 
-#include "VisuGUI.h"
-#include "VTKViewer_ViewFrame.h"
+#include "OB_Browser.h"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_RightFrame.h"
+#include "SVTK_ViewWindow.h"
+
+#include "SalomeApp_Application.h"
+
+#include "SUIT_Application.h"
+#include "SUIT_Desktop.h"
+#include "SUIT_ViewWindow.h"
+#include "SUIT_ViewManager.h"
 
 #include <qlayout.h>
 #include <qcheckbox.h>
 #include <vtkAppendPolyData.h>
 #include <vtkDataSetMapper.h>
 
-
-#define GET_VTK_VIEWFRAME(aStudy) dynamic_cast<VTKViewer_ViewFrame*>(aStudy->getActiveStudyFrame()->getRightFrame()->getViewFrame())
-
 using namespace std;
 
-extern VisuGUI *visuGUI;
+//extern VisuGUI *visuGUI;
 
-VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theStudy)
-  :QFrame(theParent), myPreviewActor(0),myStudy(theStudy)
+VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent/*, SUIT_ViewManager* theMgr*/)
+     : QFrame(theParent), myPreviewActor(0)//, myMgr(theMgr)
 {
-  QGridLayout* TopLayout = new QGridLayout( this ); 
+  QGridLayout* TopLayout = new QGridLayout( this );
   TopLayout->setSpacing( 6 );
   TopLayout->setMargin( 10 );
 
@@ -93,12 +98,12 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theS
   myPosTable->setNumCols(2);
   myPosTable->setNumRows(0);
   connect( myPosTable, SIGNAL(valueChanged(int, int)), this, SLOT(onValueChanged(int, int)) );
-  
+
   QHeader *th = myPosTable->horizontalHeader();
   th->setLabel( 0, "Position" );
   th->setLabel( 1, "Set default" );
   th->setStyle("QStyle::CE_PushButton");
-    
+
   QGroupBox* GBrot = new QGroupBox( tr( "Rotations" ), this, "GBrot" );
   GBrot->setColumnLayout(0, Qt::Vertical );
   GBrot->layout()->setSpacing( 0 );
@@ -111,7 +116,7 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theS
   LabelRot1 = new QLabel( tr( "Rotation around X (Y to Z):" ), GBrot, "LabelRot1" );
   GBrotLayout->addWidget( LabelRot1, 0, 0 );
 
-  Rot1 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
+  Rot1 = new QtxDblSpinBox( -180, 180, 10, GBrot );
   Rot1->setValue( 0 );
   Rot1->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   connect( Rot1, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
@@ -119,15 +124,15 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theS
 
   LabelRot2 = new QLabel( tr( "Rotation around Y (Z to X):" ), GBrot, "LabelRot2" );
   GBrotLayout->addWidget( LabelRot2, 1, 0 );
-  
-  Rot2 = new QAD_SpinBoxDbl( GBrot, -180, 180, 10 );
+
+  Rot2 = new QtxDblSpinBox( -180, 180, 10, GBrot );
   Rot2->setValue( 0 );
   Rot2->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   connect( Rot2, SIGNAL( valueChanged( double )), this, SLOT( onRotation( double ) ) );
   GBrotLayout->addWidget( Rot2, 1, 1 );
 
   QLabel* aPosLbl = new QLabel(tr( "LBL_POS" ), this);
-  myPosSpn = new QAD_SpinBoxDbl( this, 0, 1, 0.1 );
+  myPosSpn = new QtxDblSpinBox( 0, 1, 0.1, this );
 
   myPreviewCheck = new QCheckBox(tr("LBL_SHOW_PREVIEW"), this);
   myPreviewCheck->setChecked(false);
@@ -156,20 +161,20 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane(QWidget* theParent, QAD_Study* theS
   Y1 = 0; Y2 = 0;
   Z1 = 0; Z2 = 0;
   RByz->setChecked( true );
-  
-} // End of Constructor
 
+} // End of Constructor
 
 VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
 {
   deletePlanes();
-  if(myCutPlanes) myCutPlanes->Destroy();
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+  if (myCutPlanes)
+    myCutPlanes->Destroy();
+  if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
     vf->Repaint();
 }
 
-
-void VisuGUI_CutPlanesPane::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
+void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs)
+{
   setNbPlanes(thePrs->GetNbPlanes());
   setRotation(thePrs->GetRotateX()*180./PI, thePrs->GetRotateY()*180./PI);
   setPlanePos(thePrs->GetOrientationType());
@@ -186,9 +191,9 @@ void VisuGUI_CutPlanesPane::initFromPrsObject(VISU::CutPlanes_i* thePrs) {
   }
 }
 
-
-void VisuGUI_CutPlanesPane::createPlanes() {
-  if (myStudy->getActiveStudyFrame()->getTypeView() != VIEW_VTK) return;
+void VisuGUI_CutPlanesPane::createPlanes()
+{
+  if (VISU::GetViewWindow() == NULL) return;
   if (myCutPlanes == NULL) return;
   if (myPreviewActor != 0) return;
 
@@ -205,57 +210,55 @@ void VisuGUI_CutPlanesPane::createPlanes() {
   myPreviewActor->PickableOff();
   myPreviewActor->SetMapper(aPlaneMapper);
   aPlaneMapper->Delete();
-  GET_VTK_VIEWFRAME(myStudy)->AddActor(myPreviewActor);
+  VISU::GetViewWindow()->AddActor(myPreviewActor);
 }
 
-
-
-int VisuGUI_CutPlanesPane::storeToPrsObject(VISU::CutPlanes_i* thePrs) {
-  thePrs->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
+int VisuGUI_CutPlanesPane::storeToPrsObject (VISU::CutPlanes_i* thePrs)
+{
+  thePrs->SetOrientation(getOrientaion(), getRotation1()*PI/180., getRotation2()*PI/180.);
   thePrs->SetNbPlanes(getNbPlanes());
   thePrs->SetDisplacement(myPosSpn->value());
-  for (int i = 0; i < getNbPlanes(); ++i) 
-    {
-      if (!((QCheckTableItem*)myPosTable->item(i, 1))->isChecked())
-       thePrs->SetPlanePosition( i, myPosTable->text(i, 0).toDouble());
-      else thePrs->SetDefault(i);
-    }
+  for (int i = 0; i < getNbPlanes(); ++i) {
+    QCheckTableItem* anItem = (QCheckTableItem*)myPosTable->item(i, 1);
+    if (!anItem)
+      break;
+    if (!anItem->isChecked())
+      thePrs->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
+    else
+      thePrs->SetDefault(i);
+  }
   return 1;
 }
 
-
 /*!
   Called when orientation is changed
 */
-void VisuGUI_CutPlanesPane::orientationChanged( int Id )
+void VisuGUI_CutPlanesPane::orientationChanged (int Id)
 {
-  if ( Id == 0 ) { // RBxy->isChecked()
+  if (Id == 0) { // RBxy->isChecked()
     LabelRot1->setText( tr( "Rotation around X (Y to Z):" ) );
     LabelRot2->setText( tr( "Rotation around Y (Z to X):" ) );
-  } else if ( Id == 1 ) { // RByz->isChecked()
+  } else if (Id == 1) { // RByz->isChecked()
     LabelRot1->setText( tr( "Rotation around Y (Z to X):" ) );
     LabelRot2->setText( tr( "Rotation around Z (X to Y):" ) );
-  } else { 
+  } else {
     LabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
     LabelRot2->setText( tr( "Rotation around X (Y to Z):" ) );
   }
   DrawTable();
 }
 
-
-
-
 /*!
   Sets planes orientation and position
 */
-void VisuGUI_CutPlanesPane::setPlanePos( const VISU::CutPlanes::Orientation  orient)
+void VisuGUI_CutPlanesPane::setPlanePos (const VISU::CutPlanes::Orientation orient)
 {
-  if ( orient == VISU::CutPlanes::XY )           // xy
+  if (orient == VISU::CutPlanes::XY)           // xy
     {
       RBxy->setChecked( true );
       orientationChanged( 0 );
     }
-  else if ( orient == VISU::CutPlanes::YZ )       // yz
+  else if (orient == VISU::CutPlanes::YZ)       // yz
     {
       RByz->setChecked( true );
       orientationChanged( 1 );
@@ -265,7 +268,7 @@ void VisuGUI_CutPlanesPane::setPlanePos( const VISU::CutPlanes::Orientation  ori
      RBzx->setChecked( true );
      orientationChanged( 2 );
    }
-  
+
 }
 
 /*!
@@ -286,7 +289,7 @@ VISU::CutPlanes::Orientation VisuGUI_CutPlanesPane::getOrientaion()
 /*!
   Sets planes rotation
 */
-void VisuGUI_CutPlanesPane::setRotation( const double r1, const double r2 )
+void VisuGUI_CutPlanesPane::setRotation (const double r1, const double r2)
 {
   Rot1->setValue( r1 );
   Rot2->setValue( r2 );
@@ -295,14 +298,13 @@ void VisuGUI_CutPlanesPane::setRotation( const double r1, const double r2 )
 /*!
   Draw the table of planes positions
 */
-
 void VisuGUI_CutPlanesPane::DrawTable()
 {
   if (myCutPlanes == NULL) return;
   if (!hasInit) return;
 
   int aNbRows = myPosTable->numRows();
-  int aNbPlanes = getNbPlanes();  
+  int aNbPlanes = getNbPlanes();
 
   myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
   myCutPlanes->SetNbPlanes(aNbPlanes);
@@ -314,7 +316,7 @@ void VisuGUI_CutPlanesPane::DrawTable()
       if (!aItem->isChecked())
        myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
     }
-  
+
   if (aNbPlanes > aNbRows)
     myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
   else if (aNbPlanes < aNbRows)
@@ -329,8 +331,8 @@ void VisuGUI_CutPlanesPane::DrawTable()
   QHeader *vh = myPosTable->verticalHeader();
   QString str("Plane# %1");
   for (int i=aMin; i<aNbPlanes; i++) {
-    VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable, 
-                                                            QTableItem::OnTyping, 
+    VisuGUI_NumEditItem* aEditItem = new VisuGUI_NumEditItem(myPosTable,
+                                                            QTableItem::OnTyping,
                                                             QString::number(myCutPlanes->GetPlanePosition(i)));
     aEditItem->setReplaceable(false);
     aEditItem->setEnabled(!myCutPlanes->IsDefault(i));
@@ -340,13 +342,13 @@ void VisuGUI_CutPlanesPane::DrawTable()
     aCheck->setChecked(myCutPlanes->IsDefault(i));
     aCheck->setReplaceable(false);
     myPosTable->setItem(i, 1, aCheck);
-    
+
     vh->setLabel( i, str.arg(i+1) );
   }
 
   // Update preview
   if (myPreviewCheck->isChecked()) {
-    if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
       myCutPlanes->GetPL()->Update();
       deletePlanes();
       createPlanes();
@@ -355,26 +357,27 @@ void VisuGUI_CutPlanesPane::DrawTable()
   }
 }
 
-void VisuGUI_CutPlanesPane::setDefault(int all)
+void VisuGUI_CutPlanesPane::setDefault (int all)
 {
   myPosTable->setCurrentCell(-1, 1);
   myPosTable->clearSelection();
   if (all == 0) return;
   if (all == 1)
-    for (int i = 0; i < getNbPlanes(); ++i) 
+    for (int i = 0; i < getNbPlanes(); ++i)
       ((QCheckTableItem*)myPosTable->item( i, 1 ))->setChecked(true);
-       
+
   for (int i = 0; i < getNbPlanes(); ++i) {
     if ( ((QCheckTableItem*)myPosTable->item( i, 1 ))->isChecked() ) {
       myCutPlanes->SetDefault(i);
       myPosTable->setText( i, 0, QString::number(myCutPlanes->GetPlanePosition(i)));
       myPosTable->item( i, 0 )->setEnabled(false);
-    } else 
-      myPosTable->item( i, 0 )->setEnabled(true); 
+    } else
+      myPosTable->item( i, 0 )->setEnabled(true);
   }
 }
 
-void VisuGUI_CutPlanesPane::onValueChanged(int theRow, int theCol) {
+void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
+{
   if (theCol == 0) {
     QString aTxt = myPosTable->text(theRow, 0);
     bool isChanged = !aTxt.isEmpty();
@@ -382,7 +385,7 @@ void VisuGUI_CutPlanesPane::onValueChanged(int theRow, int theCol) {
 
     if (myPreviewCheck->isChecked()) {
       //Update Preview
-      if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+      if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
        myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble());
        myCutPlanes->GetPL()->Update();
        deletePlanes();
@@ -397,7 +400,7 @@ void VisuGUI_CutPlanesPane::onValueChanged(int theRow, int theCol) {
       myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow)));
 
       if (myPreviewCheck->isChecked()) {
-       if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+       if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
          //Update Preview
          myCutPlanes->GetPL()->Update();
          deletePlanes();
@@ -410,36 +413,37 @@ void VisuGUI_CutPlanesPane::onValueChanged(int theRow, int theCol) {
   }
 }
 
-
-void VisuGUI_CutPlanesPane::deletePlanes() {
+void VisuGUI_CutPlanesPane::deletePlanes()
+{
   if (myPreviewActor == 0) return;
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy))
+  if (SVTK_ViewWindow* vf = VISU::GetViewWindow())
     vf->RemoveActor(myPreviewActor);
   myPreviewActor->Delete();
   myPreviewActor = 0;
 }
 
-void VisuGUI_CutPlanesPane::onRotation(double theValue) {
+void VisuGUI_CutPlanesPane::onRotation (double theValue)
+{
   if (myCutPlanes == NULL) return;
   if (myPreviewCheck->isChecked()) {
-    if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+    if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
       myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.);
       myCutPlanes->GetPL()->Update();
       deletePlanes();
-      createPlanes();  
-      vf->Repaint();  
+      createPlanes();
+      vf->Repaint();
     }
   }
 }
 
-
-void VisuGUI_CutPlanesPane::onPreviewCheck(bool thePreview) {
-  if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
+void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview)
+{
+  if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
     if (thePreview) {
       storeToPrsObject(myCutPlanes);
       myCutPlanes->GetPL()->Update();
       createPlanes();
-      vf->onViewFitAll();
+      vf->onFitAll();
     } else {
       deletePlanes();
       vf->Repaint();
@@ -447,9 +451,6 @@ void VisuGUI_CutPlanesPane::onPreviewCheck(bool thePreview) {
   }
 }
 
-
-
-
 //###################################################################
 
 
@@ -457,67 +458,73 @@ void VisuGUI_CutPlanesPane::onPreviewCheck(bool thePreview) {
 /*!
   Constructor
 */
-VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg(bool theIsCreation, bool theIsModal)
-  : QDialog(  QAD_Application::getDesktop(), "VisuGUI_CutPlanesDlg", theIsModal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu/* | WDestructiveClose */),
-    myStudy(QAD_Application::getDesktop()->getActiveStudy())
+VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (QWidget* parent, bool theIsCreation, bool theIsModal)
+     : QDialog(parent, "VisuGUI_CutPlanesDlg", theIsModal, WStyle_Customize |
+               WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+       //,myMgr(VisuGUI::application()->activeViewManager())
 {
-  myStudyFrame = myStudy -> getActiveStudyFrame();
+  //myStudyWnd = myMgr->getActiveView();
   if (!theIsModal) {
     setWFlags(getWFlags() | WDestructiveClose);
   }
-  setCaption( tr( "Cut Planes Definition" ) );
-  setSizeGripEnabled( TRUE );
+  setCaption("Cut Planes Definition");
+  setSizeGripEnabled(true);
   myIsCreation = theIsCreation;
 
-  QVBoxLayout* TopLayout = new QVBoxLayout( this ); 
-  TopLayout->setSpacing( 6 );
-  TopLayout->setMargin( 11 );
+  QVBoxLayout* TopLayout = new QVBoxLayout (this);
+  TopLayout->setSpacing(6);
+  TopLayout->setMargin(11);
+
+  // Tab pane
   QTabWidget* aTabBox = new QTabWidget(this);
-  myCutPane = new  VisuGUI_CutPlanesPane(this, myStudy);
+  myCutPane = new VisuGUI_CutPlanesPane(this/*, myMgr*/);
   aTabBox->addTab(myCutPane, "Cut Planes");
   myScalarPane = new VisuGUI_ScalarBarPane(this, false);
-  myScalarPane->setMargin( 5 );
+  myScalarPane->setMargin(5);
   aTabBox->addTab(myScalarPane, "Scalar Bar");
 
   TopLayout->addWidget(aTabBox);
 
-  QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
-  GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); 
-  GroupButtons->setTitle( tr( ""  ) );
-  GroupButtons->setColumnLayout(0, Qt::Vertical );
-  GroupButtons->layout()->setSpacing( 0 );
-  GroupButtons->layout()->setMargin( 0 );
-  QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
-  GroupButtonsLayout->setAlignment( Qt::AlignTop );
-  GroupButtonsLayout->setSpacing( 6 );
-  GroupButtonsLayout->setMargin( 11 );
-
-  QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
-  buttonOk->setAutoDefault( TRUE );
-  buttonOk->setDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
-  GroupButtonsLayout->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 );
-
-  QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ), GroupButtons, "buttonCancel" );
-  buttonCancel->setAutoDefault( TRUE );
-  GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+  QGroupBox* GroupButtons = new QGroupBox(this, "GroupButtons");
+  GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+  GroupButtons->setTitle("");
+  GroupButtons->setColumnLayout(0, Qt::Vertical);
+  GroupButtons->layout()->setSpacing(0);
+  GroupButtons->layout()->setMargin(0);
+  QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
+  GroupButtonsLayout->setAlignment(Qt::AlignTop);
+  GroupButtonsLayout->setSpacing(6);
+  GroupButtonsLayout->setMargin(11);
+
+  QPushButton* buttonOk = new QPushButton(tr("&OK"), GroupButtons, "buttonOk");
+  buttonOk->setAutoDefault(TRUE);
+  buttonOk->setDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonOk, 0, 0);
+  GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
+
+  QPushButton* buttonCancel = new QPushButton(tr("&Cancel"), GroupButtons, "buttonCancel");
+  buttonCancel->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
 
   TopLayout->addWidget(GroupButtons);
 
-  connect( buttonOk,     SIGNAL( clicked() ), this, SLOT( accept() ) );
-  connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-  connect( myStudy, SIGNAL(closed()), this, SLOT( reject() ) );
-  connect( myStudyFrame, SIGNAL(sfStudyFrameActivated(QAD_StudyFrame*)), this, SLOT(onFrameActivated(QAD_StudyFrame*)));
+  connect(buttonOk,     SIGNAL(clicked()), this, SLOT(accept()));
+  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+  //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
+  //connect(VisuGUI::application()->desktop(),
+  //        SIGNAL(windowActivated(SUIT_ViewWindow*)),
+  //        this, SLOT(onWindowActivated(SUIT_ViewWindow*)));
 }
 
-
 void VisuGUI_CutPlanesDlg::accept() {
+  if (myScalarPane->check())
+    QDialog::accept();
+/*
   if (myScalarPane->check()) {
     if (!isModal()) {
       if (storeToPrsObject(myPrs)) {
-       if (myIsCreation) { 
-         if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
+       if (myIsCreation) {
+         if (VISU::GetViewWindow() != NULL) {
            try {
            visuGUI->CreateActor(myPrs);
            }
@@ -525,12 +532,12 @@ void VisuGUI_CutPlanesDlg::accept() {
              reject();
              return;
            }
-           GET_VTK_VIEWFRAME(myStudy)->onViewFitAll(); 
+           VISU::GetViewWindow()->onFitAll();
          }
        } else {
          visuGUI->RecreateActor(myPrs);
-         if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
-           if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
+         if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) {
+            if (vf->getRenderer()->GetActors()->GetNumberOfItems() > 0) {
              vf->getRenderer()->ResetCameraClippingRange();
              vf->Repaint();
            }
@@ -544,26 +551,26 @@ void VisuGUI_CutPlanesDlg::accept() {
     }
     QDialog::accept();
   }
+*/
 }
 
 void VisuGUI_CutPlanesDlg::reject() {
-  if (myIsCreation && (!isModal())) {
-    visuGUI->DeletePresentation(myPrs);
-    myStudy -> updateObjBrowser();
-  }
+  //if (myIsCreation && (!isModal())) {
+  //  visuGUI->DeletePresentation(myPrs);
+  //  VisuGUI::application()->objectBrowser()->updateTree();
+  //}
   QDialog::reject();
 }
 
-void VisuGUI_CutPlanesDlg::onFrameActivated( QAD_StudyFrame* theFrame) {
-  if (theFrame != myStudyFrame) 
-    reject();
-}
+//void VisuGUI_CutPlanesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
+//{
+//  if (theWnd != myStudyWnd)
+//    reject();
+//}
 
 //###################################################################
 
-
-
-QWidget* VisuGUI_NumEditItem::createEditor() const 
+QWidget* VisuGUI_NumEditItem::createEditor() const
 {
   QLineEdit *editline = new QLineEdit(text(), table()->viewport());
   QDoubleValidator *dvalidator = new QDoubleValidator(table()->viewport());