Salome HOME
Merge from V5_1_main 14/05/2010
[modules/visu.git] / src / VISUGUI / VisuGUI_FeatureEdgesPanel.cxx
index fc7f1929da3114a65ac1540297aefa0d1e5553da..d005dcbfe21c06b4f8019e76cecee9966a16de0a 100644 (file)
@@ -1,7 +1,4 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 //  This library is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU Lesser General Public
@@ -19,6 +16,7 @@
 //
 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  VISU VISUGUI : GUI of VISU component
 //  File   : VisuGUI_FeatureEdgesPanel.cxx
 //  Author : Oleg Uvarov
 #include <QLayout>
 #include <QPushButton>
 
-#include <QtxDoubleSpinBox.h>
-
 #include <SUIT_MessageBox.h>
 #include <SUIT_Session.h>
 #include <SUIT_ResourceMgr.h>
 
 #include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
 
 #include <LightApp_SelectionMgr.h>
 
-VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule, QWidget* theParent ) :
+VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( VisuGUI* theModule, QWidget* theParent ) :
   VisuGUI_Panel( tr( "WINDOW_TITLE" ), theModule, theParent, ApplyBtn | CloseBtn | HelpBtn ),
   myActor( 0 )
 {
+  setWindowTitle( tr( "WINDOW_TITLE" ) );
+  setObjectName( tr( "WINDOW_TITLE" ) );
+
   QVBoxLayout* aTopLayout = new QVBoxLayout( mainFrame() );
   myGrp = new QGroupBox( tr( "FEATURE_EDGES_PROPERTIES" ), mainFrame() );
 
@@ -58,7 +58,8 @@ VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule,
   aLayout->setAlignment( Qt::AlignTop );
 
   QLabel* anAngleLbl = new QLabel( tr( "FEATURE_EDGES_ANGLE" ), myGrp );
-  myAngleSpinBox = new QtxDoubleSpinBox( 0.0, 90.0, 10.0, myGrp );
+  myAngleSpinBox = new SalomeApp_DoubleSpinBox( myGrp );
+  VISU::initSpinBox( myAngleSpinBox, 0.0, 90.0, 10.0, "angle_precision" );
 
   myFeatureEdgesCB = new QCheckBox( tr( "SHOW_FEATURE_EDGES" ), myGrp );
   myBoundaryEdgesCB = new QCheckBox( tr( "SHOW_BOUNDARY_EDGES" ), myGrp );
@@ -77,10 +78,8 @@ VisuGUI_FeatureEdgesPanel::VisuGUI_FeatureEdgesPanel( const VisuGUI* theModule,
 
   aTopLayout->addWidget( myGrp );
 
-  SalomeApp_Application* anApp =
-    dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
-  LightApp_SelectionMgr* aSelectionMgr = anApp->selectionMgr();
-  connect( aSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionEvent() ) );
+  connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+           this,                               SLOT( onSelectionEvent() ) );
 }
 
 VisuGUI_FeatureEdgesPanel::~VisuGUI_FeatureEdgesPanel()
@@ -144,11 +143,11 @@ void VisuGUI_FeatureEdgesPanel::onSelectionEvent()
        anIsManifoldEdges = false,
        anIsNonManifoldEdges = false;
   myActor->GetFeatureEdgesFlags( anIsFeatureEdges,
-                                anIsBoundaryEdges,
-                                anIsManifoldEdges,
-                                anIsNonManifoldEdges );
+                                 anIsBoundaryEdges,
+                                 anIsManifoldEdges,
+                                 anIsNonManifoldEdges );
 
-  float aColoring = myActor->GetFeatureEdgesColoring();
+  //float aColoring = myActor->GetFeatureEdgesColoring();
 
   myAngleSpinBox->setValue( anAngle );
   myFeatureEdgesCB->setChecked( anIsFeatureEdges );
@@ -164,9 +163,9 @@ void VisuGUI_FeatureEdgesPanel::onApply()
   {
     myActor->SetFeatureEdgesAngle( myAngleSpinBox->value() );
     myActor->SetFeatureEdgesFlags( myFeatureEdgesCB->isChecked(),
-                                  myBoundaryEdgesCB->isChecked(),
-                                  myManifoldEdgesCB->isChecked(),
-                                  myNonManifoldEdgesCB->isChecked() );
+                                   myBoundaryEdgesCB->isChecked(),
+                                   myManifoldEdgesCB->isChecked(),
+                                   myNonManifoldEdgesCB->isChecked() );
     //myActor->SetFeatureEdgesColoring( myColoringCB->isChecked() );
     myActor->Update();
   }
@@ -176,7 +175,7 @@ void VisuGUI_FeatureEdgesPanel::onApply()
 
 void VisuGUI_FeatureEdgesPanel::onClose()
 {
-  close();
+  //  hide();
   VisuGUI_Panel::onClose();
 }
 
@@ -213,3 +212,19 @@ void VisuGUI_FeatureEdgesPanel::keyPressEvent( QKeyEvent* e )
       onHelp();
     }
 }
+
+void VisuGUI_FeatureEdgesPanel::onModuleActivated()
+{
+  disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+              this,                               SLOT( onSelectionEvent() ) );
+  connect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+           this,                               SLOT( onSelectionEvent() ) );
+  VisuGUI_Panel::onModuleActivated();
+}
+
+void VisuGUI_FeatureEdgesPanel::onModuleDeactivated()
+{
+  disconnect( myModule->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+              this,                               SLOT( onSelectionEvent() ) );
+  VisuGUI_Panel::onModuleDeactivated();
+}