From: imn Date: Fri, 19 Feb 2016 13:35:12 +0000 (+0300) Subject: INT PAL 0052872: 'Make 0D Elements on Element Nodes' dialog does not restore local... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fe79fa39214829a1d322619bee152c3405a88665;p=modules%2Fsmesh.git INT PAL 0052872: 'Make 0D Elements on Element Nodes' dialog does not restore local selection of nodes and elements. --- diff --git a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx index 8578dbf34..ffd1be740 100644 --- a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx @@ -78,13 +78,13 @@ SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg() // Seletction type radio buttons - QGroupBox* selTypeGrBox = new QGroupBox( mainFrame() ); + mySelTypeGrBox = new QGroupBox( mainFrame() ); // - QRadioButton* objBtn = new QRadioButton( tr( "SMESH_SUBMESH_GROUP"),selTypeGrBox ); - QRadioButton* elemBtn = new QRadioButton( tr( "SMESH_ELEMENTS" ),selTypeGrBox ); - QRadioButton* nodeBtn = new QRadioButton( tr( "SMESH_NODES" ),selTypeGrBox ); + QRadioButton* objBtn = new QRadioButton( tr( "SMESH_SUBMESH_GROUP"),mySelTypeGrBox ); + QRadioButton* elemBtn = new QRadioButton( tr( "SMESH_ELEMENTS" ),mySelTypeGrBox ); + QRadioButton* nodeBtn = new QRadioButton( tr( "SMESH_NODES" ),mySelTypeGrBox ); // - QHBoxLayout* selTypeLay = new QHBoxLayout( selTypeGrBox ); + QHBoxLayout* selTypeLay = new QHBoxLayout( mySelTypeGrBox ); selTypeLay->setMargin(MARGIN); selTypeLay->setSpacing(SPACING); selTypeLay->addWidget( objBtn ); @@ -126,7 +126,7 @@ SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg() aLay->setMargin(MARGIN); aLay->setSpacing(SPACING); // - aLay->addWidget( selTypeGrBox, 0, 0, 1, 5 ); + aLay->addWidget( mySelTypeGrBox, 0, 0, 1, 5 ); // aLay->addWidget( objectWg( 0, Label ), 1, 0 ); aLay->addWidget( objectWg( 0, Btn ), 1, 1 ); @@ -137,9 +137,10 @@ SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg() // Signals - connect( myGroupBox, SIGNAL( toggled( bool )), SLOT( onGroupChecked() )); + connect( myGroupBox, SIGNAL( toggled( bool )), SLOT( onGroupChecked( bool ) )); connect( mySelTypeBtnGrp, SIGNAL( buttonClicked(int) ), SLOT( onSelTypeChange(int))); - + connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), + this, SLOT( DeactivateActiveDialog() ) ); onSelTypeChange( SEL_OBJECT ); } @@ -193,6 +194,67 @@ int SMESHGUI_Add0DElemsOnAllNodesDlg::getSelectionType() const return mySelTypeBtnGrp->checkedId(); } +//================================================================================= +/*! + \brief Reactivate dialog box, when mouse pointer goes into it. +*/ +//================================================================================= +void SMESHGUI_Add0DElemsOnAllNodesDlg::enterEvent( QEvent* event) +{ + ActivateThisDialog(); +} + +//================================================================================= +/*! + * \brief SLOT to deactivate dialog + */ +//================================================================================= + +void SMESHGUI_Add0DElemsOnAllNodesDlg::DeactivateActiveDialog() +{ + if (myGroupBox->isEnabled()) { + mySelTypeGrBox->setEnabled(false); + myGroupBox->setEnabled(false); + myGroupLabel->setEnabled(false); + myGroupListCmBox->setEnabled(false); + myFilterBtn->setEnabled(false); + objectWg( 0, Label )->setEnabled(false); + objectWg( 0, Btn )->setEnabled(false); + objectWg( 0, Control )->setEnabled(false); + button( QtxDialog::OK )->setEnabled(false); + button( QtxDialog::Apply )->setEnabled(false); + button( QtxDialog::Close )->setEnabled(false); + button( QtxDialog::Help )->setEnabled(false); + setObjectText( 0, "" ); + SMESHGUI::GetSMESHGUI()->ResetState(); + SMESHGUI::GetSMESHGUI()->SetActiveDialogBox(0); + } +} +//================================================================================= +/*! + * \brief SLOT to activate dialog + */ +//================================================================================= + +void SMESHGUI_Add0DElemsOnAllNodesDlg::ActivateThisDialog() +{ + if (!myGroupBox->isEnabled()) { + SMESHGUI::GetSMESHGUI()->SetActiveDialogBox( this ); + mySelTypeGrBox->setEnabled(true); + myGroupBox->setEnabled(true); + myGroupLabel->setEnabled(true); + myGroupListCmBox->setEnabled(true); + myFilterBtn->setEnabled(true); + objectWg( 0, Label )->setEnabled(true); + objectWg( 0, Btn )->setEnabled(true); + objectWg( 0, Control )->setEnabled(true); + button( QtxDialog::OK )->setEnabled(true); + button( QtxDialog::Apply )->setEnabled(true); + button( QtxDialog::Close )->setEnabled(true); + button( QtxDialog::Help )->setEnabled(true); + } + emit selTypeChanged( getSelectionType() ); +} //================================================================================ /*! * \brief Checks consistency of data @@ -270,15 +332,16 @@ void SMESHGUI_Add0DElemsOnAllNodesOp::selectionDone() if (!myDlg->myGroupBox->isEnabled()) return; // inactive myIO.Nullify(); - myDlg->setObjectText( 0, ""); updateButtons(); SALOME_ListIO aList; selectionMgr()->selectedObjects( aList ); if ( aList.Extent() == 1 ) myIO = aList.First(); - else + else { + myDlg->setObjectText( 0, "" ); return; + } QString ids; switch ( myDlg->getSelectionType() ) { diff --git a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h index 805b9316b..6d03042e4 100644 --- a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h @@ -57,18 +57,25 @@ signals: void selTypeChanged( int selType ); + protected: + + virtual void enterEvent( QEvent* ); private slots: void onGroupChecked ( bool on ); void onSelTypeChange( int selType ); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + private: friend class SMESHGUI_Add0DElemsOnAllNodesOp; QButtonGroup* mySelTypeBtnGrp; QPushButton* myFilterBtn; + QGroupBox* mySelTypeGrBox; QGroupBox* myGroupBox; QLabel* myGroupLabel; QComboBox* myGroupListCmBox; diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx index f578c1c2f..26eb64fb3 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.cxx @@ -122,15 +122,15 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) QPixmap iconSelect (rm->loadPixmap("SMESH", tr("ICON_SELECT"))); // constructor - QGroupBox* aPixGrp = new QGroupBox(tr("MOVE_NODE"), this); - aPixGrp->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + myGroupBox = new QGroupBox(tr("MOVE_NODE"), this); + myGroupBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myButtonGroup = new QButtonGroup(this); - QHBoxLayout* aPixGrpLayout = new QHBoxLayout(aPixGrp); + QHBoxLayout* aPixGrpLayout = new QHBoxLayout(myGroupBox); aPixGrpLayout->setMargin(MARGIN); aPixGrpLayout->setSpacing(SPACING); - myRButNodeToMove = new QRadioButton(aPixGrp); - myRButMoveWithoutNode = new QRadioButton(aPixGrp); + myRButNodeToMove = new QRadioButton(myGroupBox); + myRButMoveWithoutNode = new QRadioButton(myGroupBox); myRButNodeToMove->setIcon(iconMoveNode); myRButMoveWithoutNode->setIcon(iconMoveWithoutNode); myRButNodeToMove->setChecked(true); @@ -260,14 +260,16 @@ QWidget* SMESHGUI_MakeNodeAtPointDlg::createMainFrame (QWidget* theParent) myPreviewChkBox = new QCheckBox( tr("PREVIEW"), aFrame); QVBoxLayout* aLay = new QVBoxLayout(aFrame); - aLay->addWidget(aPixGrp); + aLay->addWidget(myGroupBox); aLay->addWidget(myNodeToMoveGrp); aLay->addWidget(myDestinationGrp); aLay->addWidget(myPreviewChkBox); - connect(myDestBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); - connect(myIdBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); - connect(myButtonGroup, SIGNAL (buttonClicked(int)), SLOT(ConstructorsClicked(int))); + connect(myDestBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); + connect(myIdBtn, SIGNAL (toggled(bool)), this, SLOT(ButtonToggled(bool))); + connect(myButtonGroup, SIGNAL (buttonClicked(int)), SLOT(ConstructorsClicked(int))); + connect(SMESHGUI::GetSMESHGUI(), SIGNAL (SignalDeactivateActiveDialog()), + this, SLOT(DeactivateActiveDialog())); myIdBtn->setChecked(true); @@ -343,6 +345,59 @@ void SMESHGUI_MakeNodeAtPointDlg::ConstructorsClicked (int constructorId) resize(minimumSizeHint()); } +//================================================================================= +/*! + \brief Reactivate dialog box, when mouse pointer goes into it. +*/ +//================================================================================= +void SMESHGUI_MakeNodeAtPointDlg::enterEvent( QEvent* event) +{ + ActivateThisDialog(); +} + +//================================================================================= +/*! + * \brief SLOT to deactivate dialog + */ +//================================================================================= + +void SMESHGUI_MakeNodeAtPointDlg::DeactivateActiveDialog() +{ + if (myGroupBox->isEnabled()) { + myGroupBox->setEnabled(false); + myNodeToMoveGrp->setEnabled(false); + myDestinationGrp->setEnabled(false); + myPreviewChkBox->setEnabled(false); + button( QtxDialog::OK )->setEnabled(false); + button( QtxDialog::Apply )->setEnabled(false); + button( QtxDialog::Close )->setEnabled(false); + button( QtxDialog::Help )->setEnabled(false); + SMESHGUI::GetSMESHGUI()->ResetState(); + SMESHGUI::GetSMESHGUI()->SetActiveDialogBox(0); + emit deactivatedDialog(); + } +} +//================================================================================= +/*! + * \brief SLOT to activate dialog + */ +//================================================================================= + +void SMESHGUI_MakeNodeAtPointDlg::ActivateThisDialog() +{ + if (!myGroupBox->isEnabled()) { + myGroupBox->setEnabled(true); + myNodeToMoveGrp->setEnabled(true); + myDestinationGrp->setEnabled(true); + myPreviewChkBox->setEnabled(true); + button( QtxDialog::OK )->setEnabled(true); + button( QtxDialog::Apply )->setEnabled(true); + button( QtxDialog::Close )->setEnabled(true); + button( QtxDialog::Help )->setEnabled(true); + emit activatedDialog(); + } +} + //================================================================================ /*! * \brief Constructor @@ -376,6 +431,8 @@ SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp() // note: this slot seems to be lost together with removed obsolete SMESHGUI_MoveNodesDlg class connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(onTextChange(const QString&))); connect(myDlg->myUpdateBtn, SIGNAL (clicked()), this, SLOT(onUpdateDestination())); + connect(myDlg, SIGNAL (activatedDialog()), this, SLOT(onActivatedDialog())); + connect(myDlg, SIGNAL (deactivatedDialog()), this, SLOT(onDeactivatedDialog())); } void SMESHGUI_MakeNodeAtPointOp::onUpdateDestination() @@ -605,7 +662,6 @@ void SMESHGUI_MakeNodeAtPointOp::onSelectionDone() { if ( !myDlg->isVisible() || !myDlg->isEnabled() ) return; - myNoPreview = true; try { SALOME_ListIO aList; @@ -699,7 +755,7 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview() bool moveShown = false; if ( myMeshActor) { - const bool isPreview = myDlg->myPreviewChkBox->isChecked(); + const bool isPreview = myDlg->myPreviewChkBox->isChecked() && myDlg->myPreviewChkBox->isEnabled(); const bool isMoveNode = myDlg->myRButMoveWithoutNode->isChecked(); QString msg; if ( isValid( msg ) ) @@ -850,6 +906,46 @@ void SMESHGUI_MakeNodeAtPointOp::onCloseView() mySimulation = 0; } +//================================================================================= +/*! + * \brief SLOT called when the activated dialog + */ +//================================================================================= +void SMESHGUI_MakeNodeAtPointOp::onActivatedDialog() +{ + mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( getSMESHGUI() ) ); + vtkProperty* aProp = vtkProperty::New(); + aProp->SetRepresentationToWireframe(); + aProp->SetColor(250, 0, 250); + aProp->SetPointSize(5); + aProp->SetLineWidth( SMESH::GetFloat("SMESH:element_width",1) + 1); + mySimulation->GetActor()->SetProperty(aProp); + aProp->Delete(); + SMESHGUI_SelectionOp::startOperation(); + SMESH::SetPointRepresentation( true ); + onSelectionDone(); +} + +//================================================================================= +/*! + * \brief SLOT called when the deactivated dialog + */ +//================================================================================= +void SMESHGUI_MakeNodeAtPointOp::onDeactivatedDialog() +{ + if ( mySimulation ) + { + mySimulation->SetVisibility(false); + delete mySimulation; + mySimulation = 0; + } + if ( myMeshActor ) { + myMeshActor = 0; + } + SMESH::SetPointRepresentation( false ); + SMESHGUI_SelectionOp::stopOperation(); +} + //================================================================================ /*! * \brief SLOT called when the node id is manually changed diff --git a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h index 805f9505e..ecbe6fe87 100644 --- a/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h +++ b/src/SMESHGUI/SMESHGUI_MakeNodeAtPointDlg.h @@ -75,6 +75,8 @@ private slots: void onDestCoordChanged(); void onOpenView(); void onCloseView(); + void onActivatedDialog(); + void onDeactivatedDialog(); private: int GetConstructorId(); @@ -107,6 +109,7 @@ private: QWidget* myMainFrame; + QGroupBox* myGroupBox; QButtonGroup* myButtonGroup; QRadioButton* myRButNodeToMove; QRadioButton* myRButMoveWithoutNode; @@ -134,9 +137,18 @@ private: friend class SMESHGUI_MakeNodeAtPointOp; +protected: + virtual void enterEvent( QEvent* ); + +signals: + void activatedDialog(); + void deactivatedDialog(); + private slots: void ButtonToggled( bool ); void ConstructorsClicked( int ); + void ActivateThisDialog(); + void DeactivateActiveDialog(); }; #endif // SMESHGUI_MAKENODEATPOINTDLG_H