// 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_MagnitudeDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
+// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
#include "VisuGUI_DeformedShapeDlg.h"
+
+#include "VisuGUI_Tools.h"
+
#include "VISU_DeformedShape_i.hh"
+#include "SalomeApp_Module.h"
+#include "SUIT_Desktop.h"
+
#include <qlayout.h>
#include <qtabwidget.h>
using namespace std;
/*!
- Constructor
-*/
-VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg(QWidget* parent)
- : QDialog( parent, "VisuGUI_DeformedShapeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+ * Constructor
+ */
+VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule)
+ : QDialog(VISU::GetDesktop(theModule), "VisuGUI_DeformedShapeDlg", true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- setCaption( tr( "Deformed Shape" ) );
- setSizeGripEnabled( TRUE );
-
- QVBoxLayout* TopLayout = new QVBoxLayout( this );
- TopLayout->setSpacing( 6 );
- TopLayout->setMargin( 11 );
-
- QTabWidget* aTabBox = new QTabWidget(this);
-
- QVBox* aBox = new QVBox(this);
- aBox->setMargin( 11 );
- QFrame* TopGroup = new QFrame( aBox, "TopGroup" );
+ setCaption(tr("DLG_TITLE"));
+ setSizeGripEnabled(TRUE);
+
+ QVBoxLayout* TopLayout = new QVBoxLayout (this);
+ TopLayout->setSpacing(6);
+ TopLayout->setMargin(11);
+
+ QTabWidget* aTabBox = new QTabWidget (this);
+
+ // Deformed shape pane
+ QVBox* aBox = new QVBox (this);
+ aBox->setMargin(11);
+ QFrame* TopGroup = new QFrame (aBox, "TopGroup");
TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
TopGroup->setLineWidth(1);
- QGridLayout* TopGroupLayout = new QGridLayout( TopGroup );
- TopGroupLayout->setAlignment( Qt::AlignTop | Qt::AlignCenter );
- TopGroupLayout->setSpacing( 6 );
- TopGroupLayout->setMargin( 11 );
+ QGridLayout* TopGroupLayout = new QGridLayout (TopGroup);
+ TopGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+ TopGroupLayout->setSpacing(6);
+ TopGroupLayout->setMargin(11);
- QLabel* ScaleLabel = new QLabel( tr( "Scale Factor:" ), TopGroup, "ScaleLabel" );
- TopGroupLayout->addWidget( ScaleLabel, 0, 0 );
+ // Scale factor
+ QLabel* ScaleLabel = new QLabel (tr("SCALE_FACTOR"), TopGroup, "ScaleLabel");
+ TopGroupLayout->addWidget(ScaleLabel, 0, 0);
- ScalFact = new QtxDblSpinBox( 0.0, 1.0E+38, 0.1, TopGroup);
+ ScalFact = new QtxDblSpinBox (0.0, 1.0E+38, 0.1, TopGroup);
+ ScalFact->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
ScalFact->setPrecision(5);
- ScalFact->setValue( 0.1 );
- TopGroupLayout->addWidget( ScalFact, 0, 1 );
-
- UseMagn = new QCheckBox( tr( "Magnitude coloring" ), TopGroup, "UseMagn" );
- UseMagn->setChecked( true );
- TopGroupLayout->addMultiCellWidget( UseMagn, 1, 1, 0, 1 );
- //if (!enableUM)
- // UseMagn->hide();
- aTabBox->addTab(aBox, "Deformed Shape");
-
- myScalarPane = new VisuGUI_ScalarBarPane(this, false);
- myScalarPane->setMargin( 5 );
- aTabBox->addTab(myScalarPane, "Scalar Bar");
-
-
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
- 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( aTabBox );
- TopLayout->addWidget( GroupButtons );
+ ScalFact->setValue(0.1);
+ TopGroupLayout->addWidget(ScalFact, 0, 1);
+
+ // Magnitude coloring
+ UseMagn = new QCheckBox (tr("MAGNITUDE_COLORING"), TopGroup, "UseMagn");
+ UseMagn->setChecked(true);
+ TopGroupLayout->addMultiCellWidget(UseMagn, 1, 1, 0, 1);
+
+ aTabBox->addTab(aBox, tr("DEFORMED_SHAPE_TAB"));
+
+ // Scalar bar pane
+ myScalarPane = new VisuGUI_ScalarBarPane (this, false);
+ myScalarPane->setMargin(5);
+
+ aTabBox->addTab(myScalarPane, tr("SCALAR_BAR_TAB"));
+
+ // Buttons
+ QGroupBox* GroupButtons = new QGroupBox (this, "GroupButtons");
+ GroupButtons->setGeometry(QRect(10, 10, 281, 48));
+ 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);
+
+ // Add Tab box and Buttons to the top layout
+ TopLayout->addWidget(aTabBox);
+ TopLayout->addWidget(GroupButtons);
// signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
+ connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
+ connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
}
-
-void VisuGUI_DeformedShapeDlg::initFromPrsObject(VISU::DeformedShape_i* thePrs) {
+void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::DeformedShape_i* thePrs)
+{
myScalarPane->initFromPrsObject(thePrs);
setFactor(thePrs->GetScale());
UseMagn->setChecked(thePrs->IsColored());
}
-
int VisuGUI_DeformedShapeDlg::storeToPrsObject(VISU::DeformedShape_i* thePrs) {
myScalarPane->storeToPrsObject(thePrs);
thePrs->SetScale(getFactor());
return 1;
}
-
void VisuGUI_DeformedShapeDlg::accept() {
if (myScalarPane->check()) QDialog::accept();
}
-