// 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_IsoSurfacesDlg.cxx
-// Author : Laurent CORNABE & Hubert ROLLAND
+// Author : Laurent CORNABE & Hubert ROLLAND
// Module : VISU
// $Header$
#include "VisuGUI_IsoSurfacesDlg.h"
-#include "VISU_IsoSurfaces_i.hh"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_MessageBox.h"
+#include "VisuGUI.h"
+#include "VisuGUI_Tools.h"
+
+#include "SalomeApp_Application.h"
+
+#include "SUIT_Desktop.h"
+#include "SUIT_MessageBox.h"
#include <limits.h>
#include <qvalidator.h>
#include <qtabwidget.h>
-
using namespace std;
-VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane(QWidget* parent)
- : QVBox(parent)
+VisuGUI_IsoSurfPane::VisuGUI_IsoSurfPane (QWidget* parent)
+ : QVBox(parent)
{
QFrame* TopGroup = new QFrame( this, "TopGroup" );
TopGroup->setFrameStyle(QFrame::Box | QFrame::Sunken);
TopGroupLayout->setSpacing( 6 );
TopGroupLayout->setMargin( 11 );
- QLabel* LabelNbr = new QLabel( tr( "Number of surfaces:" ), TopGroup, "LabelNbr" );
+ QLabel* LabelNbr = new QLabel (tr("NB_SURFACES"), TopGroup, "LabelNbr");
TopGroupLayout->addWidget( LabelNbr, 0, 0 );
NbrIso = new QSpinBox( 1, 100, 1, TopGroup, "NbrIso" );
NbrIso->setValue( 1 );
TopGroupLayout->addWidget( NbrIso, 0, 1 );
- QLabel* LabelMin = new QLabel( tr( "Minimum value:" ), TopGroup, "LabelMin" );
- TopGroupLayout->addWidget( LabelMin, 1, 0 );
- //MinIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1 );
+ QLabel* LabelMin = new QLabel (tr("MIN_VALUE"), TopGroup, "LabelMin");
+ TopGroupLayout->addWidget(LabelMin, 1, 0);
+ //MinIso = new QtxDblSpinBox( -DBL_MAX, DBL_MAX, 0.1, TopGroup );
MinIso = new QLineEdit( TopGroup );
- MinIso->setValidator( new QDoubleValidator(TopGroup) );
+ MinIso->setValidator( new QDoubleValidator(TopGroup) );
MinIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
MinIso->setMinimumSize( 70, 0 );
LabelMin->setBuddy(MinIso);
TopGroupLayout->addWidget( MinIso, 1, 1 );
- QLabel* LabelMax = new QLabel( tr( "Maximum value:" ), TopGroup, "LabelMax" );
+ QLabel* LabelMax = new QLabel (tr("MAX_VALUE"), TopGroup, "LabelMax");
TopGroupLayout->addWidget( LabelMax, 2, 0 );
- //MaxIso = new QAD_SpinBoxDbl( TopGroup, -DBL_MAX, DBL_MAX, 0.1);
+ //MaxIso = new QtxSpinBoxDbl( -DBL_MAX, DBL_MAX, 0.1, TopGroup );
MaxIso = new QLineEdit( TopGroup );
MaxIso->setValidator( new QDoubleValidator(TopGroup) );
MaxIso->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
MaxIso->setMinimumSize( 70, 0 );
LabelMax->setBuddy(MaxIso);
TopGroupLayout->addWidget( MaxIso, 2, 1 );
-
-
+
+
// CBUpdate = new QCheckBox ( tr( "Update scalar bar with these values" ), TopGroup);
// CBUpdate->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
// TopGroupLayout->addMultiCellWidget( CBUpdate, 4, 4, 0, 1);
// CBUpdate->setChecked(false);
QPushButton* aUpdateBtn = new QPushButton( "Update scalar bar range with these values", TopGroup);
TopGroupLayout->addMultiCellWidget( aUpdateBtn, 3, 3, 0, 1);
- connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
-
+ connect( aUpdateBtn, SIGNAL( clicked() ), this, SLOT(onCBUpdate() ) );
+
// CBLog = new QCheckBox ( tr( "Logarithmic scaling" ), TopGroup);
// CBLog->setSizePolicy( QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed) );
// TopGroupLayout->addMultiCellWidget( CBLog, 3, 3, 0, 1);
-
}
-
-
-void VisuGUI_IsoSurfPane::initFromPrsObject(VISU::IsoSurfaces_i* thePrs) {
+void VisuGUI_IsoSurfPane::initFromPrsObject (VISU::IsoSurfaces_i* thePrs)
+{
NbrIso->setValue(thePrs->GetNbSurfaces());
MinIso->setText(QString::number(thePrs->GetSubMin()));
MaxIso->setText(QString::number(thePrs->GetSubMax()));
// switch(thePrs->GetScaling()){
-// case VISU::LOGARITHMIC :
+// case VISU::LOGARITHMIC :
// CBLog->setChecked(true);
// break;
-// default:
+// default:
// CBLog->setChecked(false);
// }
}
-int VisuGUI_IsoSurfPane::storeToPrsObject(VISU::IsoSurfaces_i* thePrs) {
+int VisuGUI_IsoSurfPane::storeToPrsObject (VISU::IsoSurfaces_i* thePrs)
+{
thePrs->SetNbSurfaces(NbrIso->value());
thePrs->SetSubRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
return 1;
// thePrs->SetRange(MinIso->text().toDouble(), MaxIso->text().toDouble());
// if (CBLog->isChecked())
// thePrs->SetScaling(VISU::LOGARITHMIC);
-// else
+// else
// thePrs->SetScaling(VISU::LINEAR);
// }
}
// else CBLog->setDisabled(true);
}
-
-bool VisuGUI_IsoSurfPane::check() {
+bool VisuGUI_IsoSurfPane::check()
+{
if (MinIso->text().toDouble() >= MaxIso->text().toDouble()) {
- QAD_MessageBox::warn1( this,tr("VISU_WARNING"),
- tr("MSG_MINMAX_VALUES"),
- tr("VISU_BUT_OK"));
+ MESSAGE(tr("MSG_MINMAX_VALUES"));
+ SUIT_MessageBox::warn1( this,tr("WRN_VISU"),
+ tr("MSG_MINMAX_VALUES"),
+ tr("BUT_OK"));
return false;
} // else if (/* CBUpdate->isChecked() && CBLog->isChecked() && */
// (MinIso->text().toDouble() <=0 || MaxIso->text().toDouble() <=0) ) {
-// QAD_MessageBox::warn1( this,
-// tr("VISU_WARNING"),
+// SUIT_MessageBox::warn1( this,
+// tr("WRN_VISU"),
// tr("WRN_LOGARITHMIC_RANGE_ISOSURF"),
-// tr("VISU_BUT_OK"));
+// tr("BUT_OK"));
// return false;
// }
return true;
/*!
Constructor
*/
-VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg()
- : QDialog( QAD_Application::getDesktop(), "VisuGUI_IsoSurfacesDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule)
+ : QDialog(VISU::GetDesktop(theModule), "VisuGUI_IsoSurfacesDlg", true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- setCaption( tr( "Iso Surfaces Definition" ) );
+ setCaption(tr("DEFINE_ISOSURFACES"));
setSizeGripEnabled( TRUE );
-
+
QVBoxLayout* TopLayout = new QVBoxLayout(this);
TopLayout->setSpacing( 6 );
TopLayout->setMargin(11);
-
+
QTabWidget* aTabBox = new QTabWidget(this);
myIsoPane = new VisuGUI_IsoSurfPane(this);
myIsoPane->setMargin( 5 );
aTabBox->addTab(myScalarPane, "Scalar Bar");
TopLayout->addWidget(aTabBox);
-
+
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
+ GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
-
+
QPushButton* buttonOk = new QPushButton( tr( "&OK" ), GroupButtons, "buttonOk" );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
-
+
TopLayout->addWidget(GroupButtons);
-
+
// signals and slots connections
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
}
-void VisuGUI_IsoSurfacesDlg::accept() {
- if (myIsoPane->check() && myScalarPane->check()) QDialog::accept();
+void VisuGUI_IsoSurfacesDlg::accept()
+{
+ if (myIsoPane->check() && myScalarPane->check())
+ {
+ myScalarPane->deletePreview();
+ QDialog::accept();
+ }
}
+void VisuGUI_IsoSurfacesDlg::reject()
+{
+ myScalarPane->deletePreview();
+ QDialog::reject();
+}