// 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 "SVTK_ViewWindow.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_RightFrame.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 <qtabwidget.h>
#include <vtkRenderer.h>
+#include <vtkPolyData.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)
+ : QFrame(theParent), myPreviewActor(0)
{
- QGridLayout* TopLayout = new QGridLayout( this );
+ QGridLayout* TopLayout = new QGridLayout( this );
TopLayout->setSpacing( 6 );
TopLayout->setMargin( 10 );
- QButtonGroup* SelPlane = new QButtonGroup( tr( "Orientation" ), this, "SelPlane" );
- SelPlane->setTitle( tr( "Orientation" ) );
- SelPlane->setColumnLayout(0, Qt::Vertical );
+ QButtonGroup* SelPlane = new QButtonGroup (tr("TXT_ORIENTATION"), this, "SelPlane");
+ //SelPlane->setTitle(tr("TXT_ORIENTATION"));
+ SelPlane->setColumnLayout(0, Qt::Vertical);
SelPlane->layout()->setSpacing( 0 );
SelPlane->layout()->setMargin( 0 );
QGridLayout* SelPlaneLayout = new QGridLayout( SelPlane->layout() );
SelPlaneLayout->setSpacing( 6 );
SelPlaneLayout->setMargin( 11 );
- RBxy = new QRadioButton( tr( "// X-Y" ), SelPlane, "RBxy" );
- RByz = new QRadioButton( tr( "// Y-Z" ), SelPlane, "RByz" );
- RBzx = new QRadioButton( tr( "// Z-X" ), SelPlane, "RBzx" );
+ RBxy = new QRadioButton (tr("PARALLEL_XOY"), SelPlane, "RBxy");
+ RByz = new QRadioButton (tr("PARALLEL_YOZ"), SelPlane, "RByz");
+ RBzx = new QRadioButton (tr("PARALLEL_ZOX"), SelPlane, "RBzx");
SelPlaneLayout->addWidget( RBxy, 0, 0 );
SelPlaneLayout->addWidget( RByz, 0, 1 );
SelPlaneLayout->addWidget( RBzx, 0, 2 );
- QLabel* LabelPosi_3 = new QLabel( tr( "Number of planes:" ), this, "LabelPosi_3" );
+ QLabel* LabelPosi_3 = new QLabel (tr("LBL_NB_PLANS"), this, "LabelPosi_3");
nbPlan = new QSpinBox( 1, 100, 1, this, "nbPlan" );
nbPlan->setValue( 1 );
nbPlan->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- myPosTable = new QTable(this, "Positions of planes" );
+ myPosTable = new QTable (this, "Positions of planes");
myPosTable->setMaximumHeight( 227 );
myPosTable->setMinimumWidth( 294 );
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 );
+
+ QGroupBox* GBrot = new QGroupBox (tr("LBL_ROTATION"), this, "GBrot");
+ GBrot->setColumnLayout(0, Qt::Vertical);
GBrot->layout()->setSpacing( 0 );
GBrot->layout()->setMargin( 0 );
QGridLayout* GBrotLayout = new QGridLayout( GBrot->layout() );
GBrotLayout->setSpacing( 6 );
GBrotLayout->setMargin( 11 );
- LabelRot1 = new QLabel( tr( "Rotation around X (Y to Z):" ), GBrot, "LabelRot1" );
+ LabelRot1 = new QLabel (tr("LBL_ROT_X"), 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 ) ) );
GBrotLayout->addWidget( Rot1, 0, 1 );
- LabelRot2 = new QLabel( tr( "Rotation around Y (Z to X):" ), GBrot, "LabelRot2" );
+ LabelRot2 = new QLabel (tr("LBL_ROT_Y"), 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);
Y1 = 0; Y2 = 0;
Z1 = 0; Z2 = 0;
RByz->setChecked( true );
-
-} // End of Constructor
+} // End of Constructor
VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane()
{
+ cout<<"### VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane"<<endl;
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());
}
}
-
-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;
vtkAppendPolyData* aPolyData = myCutPlanes->GetCutPlanesPL()->GetAppendPolyData();
- vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
if (!aPolyData->GetOutput()->GetNumberOfCells()) {
onPreviewCheck(false);
return;
}
+ vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New();
aPlaneMapper->SetInput(aPolyData->GetOutput());
aPlaneMapper->ScalarVisibilityOff();
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()
- LabelRot1->setText( tr( "Rotation around X (Y to Z):" ) );
- LabelRot2->setText( tr( "Rotation around Y (Z to X):" ) );
- } 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 {
- LabelRot1->setText( tr( "Rotation around Z (X to Y):" ) );
- LabelRot2->setText( tr( "Rotation around X (Y to Z):" ) );
+ if (Id == 0) { // RBxy->isChecked()
+ LabelRot1->setText(tr("LBL_ROT_X"));
+ LabelRot2->setText(tr("LBL_ROT_Y"));
+ } else if (Id == 1) { // RByz->isChecked()
+ LabelRot1->setText(tr("LBL_ROT_Y"));
+ LabelRot2->setText(tr("LBL_ROT_Z"));
+ } else {
+ LabelRot1->setText(tr("LBL_ROT_Z"));
+ LabelRot2->setText(tr("LBL_ROT_X"));
}
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 );
RBzx->setChecked( true );
orientationChanged( 2 );
}
-
+
}
/*!
/*!
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 );
/*!
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);
if (!aItem->isChecked())
myCutPlanes->SetPlanePosition(i, myPosTable->text(i, 0).toDouble());
}
-
+
if (aNbPlanes > aNbRows)
myPosTable->insertRows(aNbRows, aNbPlanes - aNbRows );
else if (aNbPlanes < aNbRows)
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));
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();
}
}
-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();
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();
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();
}
}
-
-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();
}
}
-
-
-
//###################################################################
-
/*!
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 (SalomeApp_Module* theModule)
+ : QDialog(VISU::GetDesktop(theModule), "VisuGUI_CutPlanesDlg", false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- myStudyFrame = myStudy -> getActiveStudyFrame();
- if (!theIsModal) {
- setWFlags(getWFlags() | WDestructiveClose);
- }
- setCaption( tr( "Cut Planes Definition" ) );
- setSizeGripEnabled( TRUE );
- myIsCreation = theIsCreation;
+ setCaption("Cut Planes Definition");
+ setSizeGripEnabled(true);
- 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::initFromPrsObject (VISU::CutPlanes_i* thePrs)
+{
+ myPrs = thePrs;
+ myScalarPane->initFromPrsObject(thePrs);
+ myCutPane->initFromPrsObject(thePrs);
+}
-void VisuGUI_CutPlanesDlg::accept() {
- if (myScalarPane->check()) {
- if (!isModal()) {
- if (storeToPrsObject(myPrs)) {
- if (myIsCreation) {
- if (myStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
- try {
- visuGUI->CreateActor(myPrs);
- }
- catch (...) {
- reject();
- return;
- }
- GET_VTK_VIEWFRAME(myStudy)->onViewFitAll();
- }
- } else {
- visuGUI->RecreateActor(myPrs);
- if (VTKViewer_ViewFrame* vf = GET_VTK_VIEWFRAME(myStudy)) {
- if ( vf->getRenderer()->GetActors()->GetNumberOfItems () > 0 ) {
- vf->getRenderer()->ResetCameraClippingRange();
- vf->Repaint();
- }
- }
- }
- } else {
- if (myIsCreation) {
- visuGUI->DeletePresentation(myPrs);
- }
- }
- }
+int VisuGUI_CutPlanesDlg::storeToPrsObject (VISU::CutPlanes_i* thePrs)
+{
+ return (myScalarPane->storeToPrsObject(thePrs) &&
+ myCutPane->storeToPrsObject(thePrs));
+}
+
+void VisuGUI_CutPlanesDlg::accept()
+{
+ //if ( !VisuGUI::CheckActiveStudyLock() ) {
+ // reject();
+ // return;
+ //}
+ if (myScalarPane->check())
QDialog::accept();
- }
}
void VisuGUI_CutPlanesDlg::reject() {
- if (myIsCreation && (!isModal())) {
- visuGUI->DeletePresentation(myPrs);
- myStudy -> updateObjBrowser();
- }
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());