-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_GroupOpDlg.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S.
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
+// SALOME KERNEL includes
+#include <SALOMEDSClient_SObject.hxx>
+
// Qt includes
#include <QHBoxLayout>
#include <QVBoxLayout>
SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( SMESHGUI* theModule )
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myIsApplyAndClose( false )
{
setModal(false);
QLabel* aColorLab = new QLabel(tr( "SMESH_CHECK_COLOR" ), aColorBox );
myColorBtn = new QtxColorButton(aColorBox);
myColorBtn->setSizePolicy( QSizePolicy::MinimumExpanding,
- myColorBtn->sizePolicy().verticalPolicy() );
+ myColorBtn->sizePolicy().verticalPolicy() );
aColorBoxLayout->addWidget(aColorLab);
aColorBoxLayout->addWidget(myColorBtn);
if ( theListGrp.isEmpty() )
{
SUIT_MessageBox::information( this, tr("SMESH_INSUFFICIENT_DATA"),
- tr("INCORRECT_ARGUMENTS") );
+ tr("INCORRECT_ARGUMENTS") );
return false;
}
if ( aMeshId == -1 )
{
SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"),
- tr("DIFF_MESHES"));
+ tr("DIFF_MESHES"));
return false;
}
if ( aGrpType == -1 )
{
SUIT_MessageBox::information(this, tr("SMESH_INSUFFICIENT_DATA"),
- tr("DIFF_TYPES"));
+ tr("DIFF_TYPES"));
return false;
}
*/
void SMESHGUI_GroupOpDlg::onOk()
{
+ setIsApplyAndClose( true );
if ( onApply() )
onClose();
+ setIsApplyAndClose( false );
}
/*!
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
return false;
}
+/*!
+ \brief Set value of the flag indicating that the dialog is
+ accepted by Apply & Close button
+ \param theFlag value of the flag
+ \sa isApplyAndClose()
+*/
+void SMESHGUI_GroupOpDlg::setIsApplyAndClose( const bool theFlag )
+{
+ myIsApplyAndClose = theFlag;
+}
+
+/*!
+ \brief Get value of the flag indicating that the dialog is
+ accepted by Apply & Close button
+ \return value of the flag
+ \sa setApplyAndClose()
+*/
+bool SMESHGUI_GroupOpDlg::isApplyAndClose() const
+{
+ return myIsApplyAndClose;
+}
+
// === === === === === === === === === === === === === === === === === === === === ===
/*!
QString aName = getName();
bool aRes = false;
+ QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList = convert( myGroups );
if ( !CORBA::is_nil( aNewGrp ) )
{
aNewGrp->SetColor( getColor() );
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aNewGrp ) )
+ anEntryList.append( aSObject->GetID().c_str() );
aRes = true;
}
}
if ( aRes )
{
+ SMESHGUI::Modified();
getSMESHGUI()->updateObjBrowser(true);
reset();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
return true;
}
else
{
SUIT_MessageBox::critical(this, tr("SMESH_ERROR"),
- tr("SMESH_OPERATION_FAILED"));
+ tr("SMESH_OPERATION_FAILED"));
return false;
}
}
QString aName = getName();
bool aRes = false;
+ QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList = convert( myGroups );
if ( !CORBA::is_nil( aNewGrp ) )
{
aNewGrp->SetColor( getColor() );
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aNewGrp ) )
+ anEntryList.append( aSObject->GetID().c_str() );
aRes = true;
}
}
if ( aRes )
{
+ SMESHGUI::Modified();
getSMESHGUI()->updateObjBrowser(true);
reset();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
return true;
}
else
{
SUIT_MessageBox::critical(this, tr("SMESH_ERROR"),
- tr("SMESH_OPERATION_FAILED"));
+ tr("SMESH_OPERATION_FAILED"));
return false;
}
}
QString aName = getName();
bool aRes = false;
+ QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList1 = convert( myGroups1 );
if ( !CORBA::is_nil( aNewGrp ) )
{
aNewGrp->SetColor( getColor() );
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aNewGrp ) )
+ anEntryList.append( aSObject->GetID().c_str() );
aRes = true;
}
}
if ( aRes )
{
+ SMESHGUI::Modified();
getSMESHGUI()->updateObjBrowser(true);
reset();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
return true;
}
else
{
SUIT_MessageBox::critical(this, tr("SMESH_ERROR"),
- tr("SMESH_OPERATION_FAILED"));
+ tr("SMESH_OPERATION_FAILED"));
return false;
}
}
QString aName = getName();
bool aRes = false;
+ QStringList anEntryList;
try
{
SMESH::ListOfGroups_var aList = convert( myGroups );
if ( !CORBA::is_nil( aNewGrp ) )
{
aNewGrp->SetColor( getColor() );
+ if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( aNewGrp ) )
+ anEntryList.append( aSObject->GetID().c_str() );
aRes = true;
}
}
if ( aRes )
{
+ SMESHGUI::Modified();
getSMESHGUI()->updateObjBrowser(true);
reset();
+ if( LightApp_Application* anApp =
+ dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
+ anApp->browseObjects( anEntryList, isApplyAndClose() );
return true;
}
else
{
SUIT_MessageBox::critical(this, tr("SMESH_ERROR"),
- tr("SMESH_OPERATION_FAILED"));
+ tr("SMESH_OPERATION_FAILED"));
return false;
}
}