// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// ----- create popup for object browser items -------------
QtxPopupMgr* mgr = popupMgr();
mgr->insert( action( 311 ), -1, -1 ); // rename dataflow
- mgr->setRule( action( 311 ), "$type in {'Dataflow'} and selcount=1", true );
+ mgr->setRule( action( 311 ), "$type in {'Dataflow'} and selcount>0", true );
mgr->insert( action( 312 ), -1, -1 ); // display dataflow
mgr->setRule( action( 312 ), "$type in {'Dataflow'} and selcount=1", true );
mgr->insert( separator(), -1, -1 ); // -----------
if ( !SalomeApp_Module::activateModule( theStudy ) )
return false;
-
-
//---------------------------------------
setMenuShown( true );
setToolShown( true );
+ action(311)->setEnabled(true); // Rename: Key_F2
+ action(313)->setEnabled(true); // Delete: Key_Delete
+
study = application()->activeStudy();
connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
setMenuShown( false );
setToolShown( false );
+ action(311)->setEnabled(false); // Rename: Key_F2
+ action(313)->setEnabled(false); // Delete: Key_Delete
+
disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( setMain( SUIT_ViewWindow* ) ) );
//---------------------------------------
}
}
// mkr: PAL12449 <---
-
+
unregisterGraph(aGraph);
SUPERV_Graph aDataFlow = aGraph->getDataflow();
if ( !SUPERV_isNull( aDataFlow ) ) {
// Kill() sends KillEvent and KillState to SUPERVGUI_Thread
// while sets myIsActive flag to false when it receives such event/state
// after myIsActive is false it calls QThread::exit() to terminate.
-
+
// why while() { qApp->processEvents() } ?
// because: SUPERVGUI_Thread::run() receives events, and calls myMain->execute()
// method using SALOME_Event paradigm, ProcessVoidEvent() function -
}
-void SUPERVGUI::renameDataflow() {
+void SUPERVGUI::renameDataflow()
+{
SALOME_ListIO aList;
aList.Clear();
(( SalomeApp_Application* )application())->selectionMgr()->selectedObjects( aList );
+ bool isAny = false;
SALOME_ListIteratorOfListIO It( aList );
for ( ; It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
if ( obj->FindAttribute(anAttr, "AttributeName") ) {
_PTR(AttributeName) aName ( anAttr );
QString nm = QString( aName->Value().c_str() );
- bool ok;
- nm = QInputDialog::getText( tr( "Rename" ), tr( "Enter new name:" ), QLineEdit::Normal,
- nm, &ok, application()->desktop() );
- if ( ok && !nm.isEmpty() ) {
- // sak : 24.11.04 : fix for PAL6898 : if rename fails (study locked),
- // a message box is displayed, and cursor is "wait cursor". We think that "wait cursor"
- // is not neccessary here, because the rename operation is fast.
- //QApplication::setOverrideCursor( Qt::waitCursor );
- //study->renameIObject( IObject, nm );
-
- //--->
- aName->SetValue( nm.latin1() );
- //rename Interactive object
- IObject->setName( ( char* )nm.latin1() );
- //<---
-
- updateObjBrowser();
- //QApplication::restoreOverrideCursor();
-
- // mkr : PAL7037 => rename engine of the graph (i.e. corresponding SUPERV_Graph) -->
- if ( obj->FindAttribute(anAttr, "AttributeIOR") ) {
- _PTR(AttributeIOR) anIOR ( anAttr );
- SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value().c_str());
- if ( !SUPERV_isNull(aDataFlow) ) {
+
+ if ( obj->FindAttribute(anAttr, "AttributeIOR") ) {
+ _PTR(AttributeIOR) anIOR ( anAttr );
+ SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value().c_str());
+ if ( !SUPERV_isNull(aDataFlow) ) {
+ isAny = true;
+ bool ok;
+ nm = QInputDialog::getText( tr( "Rename" ), tr( "Enter new name:" ), QLineEdit::Normal,
+ nm, &ok, application()->desktop() );
+ if ( ok && !nm.isEmpty() ) {
+ // sak : 24.11.04 : fix for PAL6898 : if rename fails (study locked),
+ // a message box is displayed, and cursor is "wait cursor". We think that "wait cursor"
+ // is not neccessary here, because the rename operation is fast.
+ //QApplication::setOverrideCursor( Qt::waitCursor );
+ //study->renameIObject( IObject, nm );
+
+ //--->
+ aName->SetValue( nm.latin1() );
+ //rename Interactive object
+ IObject->setName( ( char* )nm.latin1() );
+ //<---
+
+ updateObjBrowser();
+ //QApplication::restoreOverrideCursor();
+
+ // mkr : PAL7037 => rename engine of the graph (i.e. corresponding SUPERV_Graph) -->
if ( aDataFlow->IsStreamGraph() ) {
SUPERV_StreamGraph aStreamDataFlow = aDataFlow->ToStreamGraph();
if ( !SUPERV_isNull(aStreamDataFlow) )
}
// update "Save" icon and menu state, if dataflow is published
- SUPERVGUI_Main::setModifiedFlag();
+ SUPERVGUI_Main::setModifiedFlag();
+ // mkr : PAL7037 <--
}
}
- // mkr : PAL7037 <--
}
}
}
+ } // for
+
+ if (!isAny) {
+ SUIT_MessageBox::warn1(application()->desktop(),
+ tr("WARNING"),
+ tr("SUPERV_WRN_NO_APPROPRIATE_SELECTION"),
+ tr("BUT_OK") );
}
}
}
}
-void SUPERVGUI::deleteObject() {
+void SUPERVGUI::deleteObject()
+{
SALOME_ListIO aList;
aList.Clear();
(( SalomeApp_Application* )application())->selectionMgr()->selectedObjects( aList, QString::null, false );
QMessageBox::Yes, QMessageBox::No) != QMessageBox::Yes)
return;
+ bool isAny = false;
SALOME_ListIteratorOfListIO It( aList );
- for(;It.More();It.Next()) {
+ for (; It.More(); It.Next()) {
Handle(SALOME_InteractiveObject) anIObj = It.Value();
- //bool aIsOwner, aIsDataflow;
- //whatIsSelected(anIObj, aIsOwner, aIsDataflow);
_PTR(SObject) aObj ( aStudy->FindObjectID( anIObj->getEntry() ) );
if ( aObj ) {
- SUIT_Operation* op = new SalomeApp_ImportOperation( application() );
- _PTR(StudyBuilder) aBuilder ( aStudy->NewBuilder() );
- op->start();
- aBuilder->RemoveObjectWithChildren( aObj );
- op->commit();
+ bool aIsOwner, aIsDataflow;
+ whatIsSelected(aObj, aIsOwner, aIsDataflow);
+ if (aIsOwner) {
+ isAny = true;
+ SUIT_Operation* op = new SalomeApp_ImportOperation( application() );
+ _PTR(StudyBuilder) aBuilder ( aStudy->NewBuilder() );
+ op->start();
+ aBuilder->RemoveObjectWithChildren( aObj );
+ op->commit();
+ }
}
+ } // for
+
+ if (!isAny) {
+ SUIT_MessageBox::warn1(application()->desktop(),
+ tr("WARNING"),
+ tr("SUPERV_WRN_NO_APPROPRIATE_SELECTION"),
+ tr("BUT_OK") );
+ }
+ else {
+ (( SalomeApp_Application* )application())->selectionMgr()->clearSelected();
+ updateObjBrowser();
}
- (( SalomeApp_Application* )application())->selectionMgr()->clearSelected();
- updateObjBrowser();
}
void SUPERVGUI::OnGUIEvent()
aName->SetValue( theDataflow->Name() );
updateObjBrowser();
return true;
- }
+ }
}
return false;
}