// 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 "SUIT_ResourceMgr.h"
#include "SUIT_Desktop.h"
#include "SUIT_FileDlg.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
#include "SalomeApp_Study.h"
-#include "SalomeApp_DataOwner.h"
-#include "SalomeApp_SelectionMgr.h"
+#include "LightApp_Application.h"
+#include "LightApp_DataOwner.h"
+#include "LightApp_SelectionMgr.h"
#include "SalomeApp_Tools.h"
#include "SALOMEDS_SObject.hxx"
: QDialog( SMESH::GetDesktop( theModule ), theName, false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myViewWindow( SMESH::GetViewWindow( theModule ) ),
- mySelector( myViewWindow->GetSelector() )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
setCaption(tr("CAPTION"));
aDlgLay->setStretchFactor(aMainFrame, 1);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ mySelector = aViewWindow->GetSelector();
+
+ myHelpFileName = "pattern_mapping.htm";
+
Init(theType);
}
//=======================================================================
QFrame* SMESHGUI_CreatePatternDlg::createMainFrame (QWidget* theParent)
{
- QPixmap iconSlct (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
- QPixmap icon2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
- QPixmap icon3d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
- QPixmap iconSample2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
+ QPixmap iconSlct (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap icon2d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
+ QPixmap icon3d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
+ QPixmap iconSample2d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
aMainGrp->setFrameStyle(QFrame::NoFrame);
myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
mySaveBtn = new QPushButton(tr("SAVE" ), aFrame);
myCloseBtn = new QPushButton(tr("SMESH_BUT_CANCEL"), aFrame);
+ myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
aLay->addWidget(mySaveBtn);
aLay->addItem(aSpacer);
aLay->addWidget(myCloseBtn);
+ aLay->addWidget(myHelpBtn);
connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
connect(mySaveBtn, SIGNAL(clicked()), SLOT(onSave()));
+ connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp()));
return aFrame;
}
activateSelection();
onSelectionDone();
- int x, y;
- mySMESHGUI->DefineDlgPosition(this, x, y);
- this->move(x, y);
this->show();
}
_PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in());
//Handle(SALOME_InteractiveObject) anIObj =
// new SALOME_InteractiveObject(aSobj->GetID().c_str(), "SMESH");
- SUIT_DataOwnerPtr anIObj (new SalomeApp_DataOwner(aSobj->GetID().c_str()));
+ SUIT_DataOwnerPtr anIObj (new LightApp_DataOwner(aSobj->GetID().c_str()));
isValidMesh = mySelectionMgr->isOk(anIObj);
}
tr("ERROR_OF_SAVING"), QMessageBox::Ok);
} else {
//SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
- myViewWindow->SetSelectionMode(ActorSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
disconnect(mySMESHGUI, 0, this, 0);
mySMESHGUI->ResetState();
return;
} else {
//SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
- myViewWindow->SetSelectionMode(ActorSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
disconnect(mySMESHGUI, 0, this, 0);
mySMESHGUI->ResetState();
//=======================================================================
void SMESHGUI_CreatePatternDlg::onClose()
{
- myViewWindow->SetSelectionMode(ActorSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
disconnect(mySMESHGUI, 0, this, 0);
mySMESHGUI->ResetState();
emit Close();
}
+//=================================================================================
+// function : onHelp()
+// purpose :
+//=================================================================================
+void SMESHGUI_CreatePatternDlg::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 : loadFromObject()
// purpose : Load pattern from geom object corresponding to the mesh/submesh
if (aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH ) aMess = tr("ERR_LOAD_EMPTY_SUBMESH");
else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE ) aMess = tr("ERR_LOADF_NARROW_FACE");
else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE ) aMess = tr("ERR_LOADF_CLOSED_FACE");
+ else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CANT_PROJECT ) aMess = tr("ERR_LOADF_CANT_PROJECT");
else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE ) aMess = tr("ERR_LOADV_BAD_SHAPE");
else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS) aMess = tr("ERR_LOADV_COMPUTE_PARAMS");
else aMess = tr("ERROR_OF_CREATION");
//=======================================================================
void SMESHGUI_CreatePatternDlg::enterEvent (QEvent*)
{
- mySMESHGUI->EmitSignalDeactivateDialog();
- setEnabled(true);
- activateSelection();
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+ // there is a stange problem that enterEvent() comes after onSave()
+ if ( isVisible () ) {
+ mySMESHGUI->EmitSignalDeactivateDialog();
+ setEnabled(true);
+ activateSelection();
+ connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
+ }
}
//=================================================================================
{
mySelectionMgr->clearFilters();
//SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
- myViewWindow->SetSelectionMode(ActorSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
if (myType == Type_2d) {
mySelectionMgr->installFilter(new SMESH_NumberFilter