// 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
//
//
//
#include "SMESH_Actor.h"
#include "SMDS_Mesh.hxx"
-#include "SalomeApp_SelectionMgr.h"
+#include "LightApp_SelectionMgr.h"
+#include "LightApp_Application.h"
#include "SUIT_ResourceMgr.h"
#include "SUIT_MessageBox.h"
#include "SUIT_Desktop.h"
+#include "SUIT_Session.h"
#include "SVTK_Selector.h"
#include "SVTK_ViewWindow.h"
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
- myViewWindow(SMESH::GetViewWindow(theModule)),
mySMESHGUI(theModule)
{
QVBoxLayout* aDlgLay = new QVBoxLayout(this, MARGIN, SPACING);
{
QGroupBox* aMainGrp = new QGroupBox(1, Qt::Vertical, tr("EDGE_BETWEEN"), theParent);
- QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
new QLabel(tr("SMESH_EDGE"), aMainGrp);
(new QPushButton(aMainGrp))->setPixmap(aPix);
myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
+ myHelpBtn = new QPushButton (tr("SMESH_BUT_HELP"), aFrame);
QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
aLay->addWidget(myApplyBtn);
aLay->addItem(aSpacer);
aLay->addWidget(myCloseBtn);
+ aLay->addWidget(myHelpBtn);
return aFrame;
}
connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply()));
+ connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp()));
// selection and SMESHGUI
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
myApplyBtn->setEnabled(false);
setEnabled(true);
- int x, y;
- mySMESHGUI->DefineDlgPosition(this, x, y);
- this->move(x, y);
this->show();
// set selection mode
- myViewWindow->SetSelectionMode(EdgeOfCellSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeOfCellSelection);
onSelectionDone();
}
//=======================================================================
void SMESHGUI_SingleEditDlg::onClose()
{
- myViewWindow->SetSelectionMode(ActorSelection);
- mySelectionMgr->clearSelected();
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
+ //mySelectionMgr->clearSelected();
disconnect(mySelectionMgr, 0, this, 0);
disconnect(mySMESHGUI, 0, this, 0);
mySMESHGUI->ResetState();
reject();
}
+//=================================================================================
+// function : onHelp()
+// purpose :
+//=================================================================================
+void SMESHGUI_SingleEditDlg::onHelp()
+{
+ 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 : findTriangles()
//purpose : find triangles sharing theNode1-theNode2 link
// find a triangle and an edge nb
const SMDS_MeshElement* tria[2];
allOk &= a2Nodes[0] != a2Nodes[1] && findTriangles(a2Nodes[0],a2Nodes[1],tria[0],tria[1]);
- if(allOk){
- myBusy = true; // block onSelectionDone()
+ myBusy = true; // block onSelectionDone()
+ if(allOk)
+ {
newIndices.Add(tria[0]->GetID());
- mySelector->AddOrRemoveIndex(anIO,newIndices, true);
const SMDS_MeshNode* a3Nodes [3];
SMDS_ElemIteratorPtr it;
}
}
}
-
- newIndices.Clear();
newIndices.Add(-edgeInd-1);
- mySelector->AddOrRemoveIndex(anIO,newIndices,true);
- myBusy = false;
myOkBtn->setEnabled(true);
myApplyBtn->setEnabled(true);
}
+ mySelector->AddOrRemoveIndex(anIO,newIndices, false);
+ SMESH::GetViewWindow(mySMESHGUI)->highlight( anIO, true, true );
+
+ myBusy = false;
}
}
}
myActor = SMESH::FindActorByEntry(anIO->getEntry());
if(myActor){
TVisualObjPtr aVisualObj = myActor->GetObject();
- if(SMDS_Mesh* aMesh = aVisualObj->GetMesh()){
- if(SMESH::GetEdgeNodes(mySelector, aVisualObj, anId1, anId2) >= 1){
+ if(SMDS_Mesh* aMesh = aVisualObj->GetMesh())
+ {
+ const SMDS_MeshElement* tria[2];
+ if( SMESH::GetEdgeNodes( mySelector, aVisualObj, anId1, anId2 ) >= 1 &&
+ findTriangles( aMesh->FindNode( anId1 ), aMesh->FindNode( anId2 ), tria[0],tria[1] ) )
+ {
QString aText = QString("%1-%2").arg(anId1).arg(anId2);
myBusy = true;
myEdge->setText(aText);
myBusy = false;
- const SMDS_MeshElement* tria[2];
- if (findTriangles(aMesh->FindNode(anId1), aMesh->FindNode(anId2), tria[0],tria[1])) {
- myOkBtn->setEnabled(true);
- myApplyBtn->setEnabled(true);
- }
- } else {
+ myOkBtn->setEnabled(true);
+ myApplyBtn->setEnabled(true);
+ }
+ else
+ {
myEdge->clear();
}
}
{
if (!isEnabled()) {
mySMESHGUI->EmitSignalDeactivateDialog();
- myViewWindow->SetSelectionMode(EdgeOfCellSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(EdgeOfCellSelection);
setEnabled(true);
}
}
// update actor
if (aResult) {
+ mySelector->ClearIndex();
mySelectionMgr->setSelectedObjects(aList, false);
+ onSelectionDone();
SMESH::UpdateView();
}
return aResult;
}
+//=================================================================================
+// function : keyPressEvent()
+// purpose :
+//=================================================================================
+void SMESHGUI_SingleEditDlg::keyPressEvent( QKeyEvent* e )
+{
+ QDialog::keyPressEvent( e );
+ if ( e->isAccepted() )
+ return;
+
+ if ( e->key() == Key_F1 )
+ {
+ e->accept();
+ onHelp();
+ }
+}
+
/*!
* Class : SMESHGUI_TrianglesInversionDlg
* Description : Inversion of the diagonal of a pseudo-quadrangle formed by
: SMESHGUI_SingleEditDlg(theModule,theName)
{
setCaption(tr("CAPTION"));
+ myHelpFileName = "/files/diagonal_iversion_of_elements.htm";
}
SMESHGUI_TrianglesInversionDlg::~SMESHGUI_TrianglesInversionDlg()
: SMESHGUI_SingleEditDlg(theModule,theName)
{
setCaption(tr("CAPTION"));
+ myHelpFileName = "/files/uniting_two_triangles.htm";
}
SMESHGUI_UnionOfTwoTrianglesDlg::~SMESHGUI_UnionOfTwoTrianglesDlg()