#include <SalomeApp_Study.h>
#include <SalomeApp_Application.h>
#include <SalomeApp_CheckFileDlg.h>
+#include <SalomeApp_DataObject.h>
#include <LightApp_DataOwner.h>
#include <LightApp_Preferences.h>
// Qt includes
// #define INCLUDE_MENUITEM_DEF // VSR commented ????????
+#include <QApplication>
#include <QMenu>
#include <QTextStream>
#endif
}
+void SMESHGUI::message( const QString& msg )
+{
+ // dispatch message
+ QStringList data = msg.split("/");
+ if ( data.count() > 0 ) {
+ if ( data.first() == "mesh_loading" ) {
+ // get mesh entry
+ QString entry = data.count() > 1 ? data[1] : QString();
+ if ( entry.isEmpty() )
+ return;
+ // get study
+ _PTR(Study) study = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() )->studyDS();
+ // get mesh name
+ _PTR(SObject) obj = study->FindObjectID( entry.toLatin1().constData() );
+ QString name;
+ if ( obj )
+ name = obj->GetName().c_str();
+ if ( name.isEmpty() )
+ return;
+
+ if ( data.last() == "stop" )
+ application()->putInfo( tr( "MESH_LOADING_MSG_FINISHED" ).arg( name ) );
+ else
+ application()->putInfo( tr( "MESH_LOADING_MSG" ).arg( name ) );
+ QApplication::processEvents();
+ }
+ }
+}
+
/*!
\brief Connects or disconnects signals about activating and cloning view on the module slots
\param pview view which is connected/disconnected
if( !anApp )
return false;
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
- if( !aStudy )
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() );
+ if( !appStudy )
+ return false;
+
+ SalomeApp_DataObject* obj = dynamic_cast<SalomeApp_DataObject*>(appStudy->findObjectByEntry(entry));
+
+ if(!obj)
return false;
- bool appRes = SalomeApp_Module::renameAllowed(entry);
- if( !appRes )
+ if(appStudy->isComponent(entry) || obj->isReference())
return false;
// check type to prevent renaming of inappropriate objects
- int aType = SMESHGUI_Selection::type(qPrintable(entry), aStudy);
+ int aType = SMESHGUI_Selection::type(qPrintable(entry), SMESH::GetActiveStudyDocument());
if (aType == MESH || aType == GROUP ||
aType == SUBMESH || aType == SUBMESH_COMPOUND ||
aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( application() );
if( !anApp )
return false;
+
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( anApp->activeStudy() );
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument(); //Document OCAF de l'etude active
- if( !aStudy )
+ if(!appStudy)
return false;
-
- bool appRes = SalomeApp_Module::renameObject(entry,name);
- if( !appRes )
+
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ if(!aStudy)
+ return false;
+
+ bool aLocked = (_PTR(AttributeStudyProperties)(appStudy->studyDS()->GetProperties()))->IsLocked();
+ if ( aLocked ) {
+ SUIT_MessageBox::warning ( anApp->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED") );
return false;
+ }
+
_PTR(SObject) obj = aStudy->FindObjectID( qPrintable(entry) );
_PTR(GenericAttribute) anAttr;
if ( obj->FindAttribute(anAttr, "AttributeName") ) {
aName = anAttr;
// check type to prevent renaming of inappropriate objects
- int aType = SMESHGUI_Selection::type( qPrintable(entry), aStudy );
+ int aType = SMESHGUI_Selection::type( qPrintable(entry), SMESH::GetActiveStudyDocument() );
if (aType == MESH || aType == GROUP ||
aType == SUBMESH || aType == SUBMESH_COMPOUND ||
aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||