X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ExtrusionAlongPathDlg.cxx;h=f8a3903a505625cb3471ed55e8076fa8a6a81c42;hp=b65bd3c3e1906f783ea7c6bd00bb8c044f6b0080;hb=c3dcb1d5ce71049bef3434d77e015095d92ff646;hpb=81248260b728e052732f6197265c5b123e19324e diff --git a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx index b65bd3c3e..f8a3903a5 100644 --- a/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ExtrusionAlongPathDlg.cxx @@ -17,7 +17,7 @@ // 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 +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -48,6 +48,9 @@ #include "SUIT_OverrideCursor.h" #include "SUIT_Desktop.h" #include "SUIT_MessageBox.h" +#include "SUIT_Session.h" + +#include "LightApp_Application.h" #include "SVTK_ViewModel.h" #include "SVTK_ViewWindow.h" @@ -97,9 +100,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_ExtrusionAlongPathDlg", modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose), mySMESHGUI( theModule ), - mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), - myViewWindow( SMESH::GetViewWindow( theModule ) ), - mySelector( myViewWindow->GetSelector() ) + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ) { SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI ); QPixmap edgeImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE"))); @@ -297,10 +298,14 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod CloseButton = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons); CloseButton->setAutoDefault(true); + HelpButton = new QPushButton(tr("SMESH_BUT_HELP"), GroupButtons); + HelpButton->setAutoDefault(true); + // layouting GroupButtonsLayout->addWidget(OkButton, 0, 0); GroupButtonsLayout->addWidget(ApplyButton, 0, 1); GroupButtonsLayout->addWidget(CloseButton, 0, 3); + GroupButtonsLayout->addWidget(HelpButton, 0, 4); GroupButtonsLayout->addColSpacing(2, 10); GroupButtonsLayout->setColStretch(2, 10); @@ -317,6 +322,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod ZSpin->RangeStepAndValidator(-999999.999, +999999.999, 10.0, 3); AngleSpin->RangeStepAndValidator(-999999.999, +999999.999, 5.0, 3); + mySelector = (SMESH::GetViewWindow( mySMESHGUI ))->GetSelector(); + mySMESHGUI->SetActiveDialogBox(this); // Costruction of the logical filter for the elements: mesh/sub-mesh/group @@ -330,6 +337,8 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod myElementsFilter = new SMESH_LogicalFilter (aListOfFilters, SMESH_LogicalFilter::LO_OR); myPathMeshFilter = new SMESH_TypeFilter (MESH); + myHelpFileName = "extrusion_along_a_path.htm"; + Init(); /***************************************************************/ @@ -337,6 +346,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod connect(OkButton, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(CloseButton, SIGNAL(clicked()), this, SLOT(reject())); connect(ApplyButton, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(HelpButton, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(AddAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleAdded())); connect(RemoveAngleButton, SIGNAL(clicked()), this, SLOT(OnAngleRemoved())); @@ -370,10 +380,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod ZSpin->editor()->installEventFilter(this); /***************************************************************/ - // set position and show dialog box - int x, y; - mySMESHGUI->DefineDlgPosition(this, x, y); - this->move(x, y); + this->show(); // displays Dialog } @@ -448,13 +455,20 @@ void SMESHGUI_ExtrusionAlongPathDlg::ConstructorsClicked (int type) SMESH::SetPointRepresentation(false); if (MeshCheck->isChecked()) { - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(myElementsFilter); } else { if (type == 0) - myViewWindow->SetSelectionMode(EdgeSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(EdgeSelection); + } if (type == 1) - myViewWindow->SetSelectionMode(FaceSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(FaceSelection); + } } } connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -632,8 +646,9 @@ bool SMESHGUI_ExtrusionAlongPathDlg::ClickOnApply() return false; } - mySelectionMgr->clearSelected(); - SMESH::UpdateView(); + //mySelectionMgr->clearSelected(); + SMESH::Update( myMeshActor->getIO(), myMeshActor->GetVisibility() ); + //SMESH::UpdateView(); Init(false); ConstructorsClicked(GetConstructorId()); return true; @@ -649,6 +664,23 @@ void SMESHGUI_ExtrusionAlongPathDlg::ClickOnOk() reject(); } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void SMESHGUI_ExtrusionAlongPathDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName), + QObject::tr("BUT_OK")); + } +} + //================================================================================= // function : reject() // purpose : Called when dialog box is closed @@ -657,10 +689,11 @@ void SMESHGUI_ExtrusionAlongPathDlg::reject() { disconnect(mySelectionMgr, 0, this, 0); mySelectionMgr->clearFilters(); - mySelectionMgr->clearSelected(); + //mySelectionMgr->clearSelected(); SMESH::SetPickable(); // ??? SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySMESHGUI->ResetState(); QDialog::reject(); } @@ -713,7 +746,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::onTextChange (const QString& theNewText) } } mySelector->AddOrRemoveIndex(anIO, newIndices, false); - myViewWindow->highlight( anIO, true, true ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( anIO, true, true ); } } else if (send == StartPointLineEdit && myEditCurrentArgument == StartPointLineEdit) { @@ -738,7 +772,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::onTextChange (const QString& theNewText) TColStd_MapOfInteger newIndices; newIndices.Add(n->GetID()); mySelector->AddOrRemoveIndex( aPathActor->getIO(), newIndices, false ); - myViewWindow->highlight( aPathActor->getIO(), true, true ); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->highlight( aPathActor->getIO(), true, true ); } } } @@ -851,8 +886,12 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument() // try to get shape from selection Handle(SALOME_InteractiveObject) IO = aList.First(); + SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh); + if ( !aPathActor ) + return; + QString aString; - int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, myMeshActor->getIO(), aString); + int aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aPathActor->getIO(), aString); if (aNbUnits == 1) StartPointLineEdit->setText(aString.stripWhiteSpace()); @@ -940,24 +979,33 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button myEditCurrentArgument = ElementsLineEdit; SMESH::SetPointRepresentation(false); if (MeshCheck->isChecked()) { - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(myElementsFilter); } else { if (Elements1dRB->isChecked()) - myViewWindow->SetSelectionMode(EdgeSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(EdgeSelection); + } else if (Elements2dRB->isChecked()) - myViewWindow->SetSelectionMode(FaceSelection); + { + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(FaceSelection); + } } } else if (button == SelectPathMeshButton) { myEditCurrentArgument = PathMeshLineEdit; SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); mySelectionMgr->installFilter(myPathMeshFilter); } else if (button == SelectPathShapeButton) { myEditCurrentArgument = PathShapeLineEdit; SMESH::SetPointRepresentation(false); - myViewWindow->SetSelectionMode(ActorSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(ActorSelection); if (!myPathMesh->_is_nil()) { GEOM::GEOM_Object_var aMainShape = myPathMesh->GetShapeToMesh(); @@ -975,7 +1023,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button SMESH_Actor* aPathActor = SMESH::FindActorByObject(myPathMesh); if (aPathActor) { SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); SMESH::SetPickable(aPathActor); } } @@ -983,7 +1032,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button else if (button == SelectBasePointButton) { myEditCurrentArgument = XSpin; SMESH::SetPointRepresentation(true); - myViewWindow->SetSelectionMode(NodeSelection); + if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) + aViewWindow->SetSelectionMode(NodeSelection); SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(MESHorSUBMESH); SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter(GROUP);