Salome HOME
IPAL9285,9292,9314
[modules/visu.git] / src / VISUGUI / VisuGUI_VectorsDlg.cxx
index 2e471d3f4dc20ee31f9b724512f40216ae191227..86a10e9c7fc38ea1e605e76b52bb0d6305ab2d4d 100644 (file)
 //  $Header$
 
 #include "VisuGUI_VectorsDlg.h"
+
+#include "VisuGUI.h"
+//#include "VisuGUI_Selection.h"
+#include "VisuGUI_Tools.h"
+
 #include "VISU_Vectors_i.hh"
 
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
+#include "SalomeApp_Module.h"
+#include "SUIT_Desktop.h"
 
 #include <qlayout.h>
 #include <qcolordialog.h>
+#include <qtabwidget.h>
 
 using namespace std;
 
 /*!
   Constructor
 */
-VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
-    : QDialog( QAD_Application::getDesktop(), "VisuGUI_VectorsDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule)
+    : QDialog(VISU::GetDesktop(theModule), "VisuGUI_VectorsDlg", true,
+      WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
 {
-  setCaption( tr( "Vector Field Representation" ) );
-  setSizeGripEnabled( TRUE );
+  setCaption(tr("DLG_TITLE"));
+  setSizeGripEnabled(TRUE);
 
   QVBoxLayout* TopLayout = new QVBoxLayout( this ); 
   TopLayout->setSpacing( 6 );
   TopLayout->setMargin( 11 );
 
-  TopGroup = new QButtonGroup( this, "TopGroup" );
+  QTabWidget* aTabBox = new QTabWidget(this);
+
+  QVBox* aBox = new QVBox(this);
+  aBox->setMargin( 11 );
+
+  TopGroup = new QButtonGroup( aBox, "TopGroup" );
   TopGroup->setColumnLayout(0, Qt::Vertical );
   TopGroup->layout()->setSpacing( 0 );
-  TopGroup->layout()->setMargin( 0 );
+  TopGroup->layout()->setMargin( 5 );
   QGridLayout* TopGroupLayout = new QGridLayout( TopGroup->layout() );
   TopGroupLayout->setAlignment( Qt::AlignTop );
   TopGroupLayout->setSpacing( 6 );
   TopGroupLayout->setMargin( 11 );
 
   // Scale factor
-  ScaleLabel = new QLabel( tr( "Scale factor:" ), TopGroup, "ScaleLabel" );
+  ScaleLabel = new QLabel (tr("LBL_SCALE_FACTOR"), TopGroup, "ScaleLabel");
 
-  ScalFact = new QAD_SpinBoxDbl( TopGroup, 1e-20, 1.0E+38, 0.1, 5);
+  ScalFact = new QtxDblSpinBox( 1e-20, 1.0E+38, 0.1, TopGroup );
+  ScalFact->setPrecision( 5 );
   ScalFact->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
   ScalFact->setValue( 0.1 );
 
@@ -70,7 +83,7 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
   TopGroupLayout->addWidget( ScalFact, 0, 1 );
 
   // Line width
-  LineWidLabel = new QLabel( tr( "Line width:" ), TopGroup, "LineWidLabel" );
+  LineWidLabel = new QLabel (tr("LBL_LINE_WIDTH"), TopGroup, "LineWidLabel");
 
   LinWid = new QSpinBox( 1, 10, 1, TopGroup, "LinWid" );
   LinWid->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
@@ -80,22 +93,22 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
   TopGroupLayout->addWidget( LinWid, 1, 1 );
 
   // Color
-  UseMagn = new QCheckBox( tr( "Magnitude coloring" ), TopGroup, "UseMagn" );
-  UseMagn->setText( tr( "Magnitude coloring" ) );
-  SelColor = new QPushButton( tr( "Select Color" ), TopGroup, "SelColor" );
+  UseMagn = new QCheckBox (tr("MAGNITUDE_COLORING_CHK"), TopGroup, "UseMagn");
+  //UseMagn->setText(tr("MAGNITUDE_COLORING_CHK"));
+  SelColor = new QPushButton (tr("SEL_COLOR_BTN"), TopGroup, "SelColor");
 
   /*  ColorLab = new QLabel( TopGroup, "ColorLab" );
   ColorLab->setFixedSize( SelColor->sizeHint().height(), SelColor->sizeHint().height() );
   ColorLab->setFrameStyle( QLabel::Plain | QLabel::Box );
-  */  
+  */
   TopGroupLayout->addWidget( UseMagn,  2, 0 );
   //TopGroupLayout->addWidget( ColorLab, 2, 1 );
   TopGroupLayout->addWidget( SelColor, 2, 1 );
 
   // Gliphs
-  UseGlyph = new QCheckBox( tr( "Use glyphs" ), TopGroup, "UseGlyph" );
+  UseGlyph = new QCheckBox (tr("USE_GLYPHS_CHK"), TopGroup, "UseGlyph");
   
-  TypeGlyph = new QButtonGroup( tr( "Glyph type" ), TopGroup, "TypeGlyph" );
+  TypeGlyph = new QButtonGroup (tr("GLYPH_TYPE_GRP"), TopGroup, "TypeGlyph");
   TypeGlyph->setColumnLayout(0, Qt::Vertical );
   TypeGlyph->layout()->setSpacing( 0 );
   TypeGlyph->layout()->setMargin( 0 );
@@ -104,14 +117,14 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
   TypeGlyphLayout->setSpacing( 6 );
   TypeGlyphLayout->setMargin( 11 );
 
-  RBArrows = new QRadioButton( tr( "Arrows" ), TypeGlyph, "RBArrows" );
+  RBArrows = new QRadioButton (tr("ARROWS_BTN") , TypeGlyph, "RBArrows");
   TypeGlyphLayout->addWidget( RBArrows, 0, 0 );
-  RBCones2 = new QRadioButton( tr( "Cones (2)" ), TypeGlyph, "RBCones2" );
+  RBCones2 = new QRadioButton (tr("CONES2_BTN"), TypeGlyph, "RBCones2");
   TypeGlyphLayout->addWidget( RBCones2, 1, 0 );
-  RBCones6 = new QRadioButton( tr( "Cones (6)" ), TypeGlyph, "RBCones6" );
+  RBCones6 = new QRadioButton (tr("CONES6_BTN"), TypeGlyph, "RBCones6");
   TypeGlyphLayout->addWidget( RBCones6, 2, 0 );
 
-  PosGlyph = new QButtonGroup( tr( "Glyph position" ), TopGroup, "PosGlyph" );
+  PosGlyph = new QButtonGroup (tr("GLYPH_POSITION_GRP"), TopGroup, "PosGlyph");
   PosGlyph->setColumnLayout(0, Qt::Vertical );
   PosGlyph->layout()->setSpacing( 0 );
   PosGlyph->layout()->setMargin( 0 );
@@ -120,11 +133,11 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
   PosGlyphLayout->setSpacing( 6 );
   PosGlyphLayout->setMargin( 11 );
   
-  RBTail = new QRadioButton( tr( "Tail" ), PosGlyph, "RBTail" );
+  RBTail = new QRadioButton (tr("TAIL_BTN"  ), PosGlyph, "RBTail");
   PosGlyphLayout->addWidget( RBTail, 0, 0 );
-  RBCent = new QRadioButton( tr( "Center" ), PosGlyph, "RBCent" );
+  RBCent = new QRadioButton (tr("CENTER_BTN"), PosGlyph, "RBCent");
   PosGlyphLayout->addWidget( RBCent, 1, 0 );
-  RBHead = new QRadioButton( tr( "Head" ), PosGlyph, "RBHead" );
+  RBHead = new QRadioButton (tr("HEAD_BTN"  ), PosGlyph, "RBHead");
   PosGlyphLayout->addWidget( RBHead, 2, 0 );
 
   TopGroupLayout->addMultiCellWidget( UseGlyph, 3, 3, 0, 2 );
@@ -151,7 +164,12 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
   GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
 
   // top layout
-  TopLayout->addWidget( TopGroup );
+  aTabBox->addTab(aBox, "Vectors");
+  myScalarPane = new VisuGUI_ScalarBarPane(this, false);
+  myScalarPane->setMargin( 5 );
+  aTabBox->addTab(myScalarPane, "Scalar Bar");  
+
+  TopLayout->addWidget( aTabBox );
   TopLayout->addWidget( GroupButtons );
   
   // signals and slots connections
@@ -171,15 +189,10 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg()
   enableSetColor();
 }
 
-/*!
-  Destructor
-*/
-VisuGUI_VectorsDlg::~VisuGUI_VectorsDlg()
-{
-}
 
 
 void VisuGUI_VectorsDlg::initFromPrsObject(VISU::Vectors_i* thePrs) {
+  myScalarPane->initFromPrsObject(thePrs);
   setScaleFactor(thePrs->GetScale());
   setLineWidth((int)thePrs->GetLineWidth());
   setUseMagnColor(thePrs->IsColored());
@@ -198,7 +211,8 @@ void VisuGUI_VectorsDlg::initFromPrsObject(VISU::Vectors_i* thePrs) {
 }
 
 
-void VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
+int VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
+  myScalarPane->storeToPrsObject(thePrs);
   thePrs->SetScale(getScaleFactor());
   thePrs->SetLineWidth(getLineWidth());
   thePrs->ShowColored(getUseMagnColor());
@@ -214,6 +228,7 @@ void VisuGUI_VectorsDlg::storeToPrsObject(VISU::Vectors_i* thePrs) {
     thePrs->SetGlyphType(getGlyphType());
   } else 
     thePrs->SetGlyphType(VISU::Vectors::NONE);
+  return 1;
 }
 
 
@@ -392,4 +407,7 @@ void VisuGUI_VectorsDlg::enableMagnColor( bool enable )
 }
 
 
+void VisuGUI_VectorsDlg::accept() {
+  if (myScalarPane->check())  QDialog::accept();
+}