setDesktop( desk );
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
- QPixmap aLogo = aResMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ) );
+ QPixmap aLogo = aResMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ), false );
desktop()->setIcon( aLogo );
desktop()->setDockableMenuBar( true );
registerAction( MRUId, mru );
// default icon for neutral point ('SALOME' module)
- QPixmap defIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ) );
+ QPixmap defIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_DEFAULT_ICO" ), false );
if ( defIcon.isNull() )
defIcon = QPixmap( imageEmptyIcon );
// default icon for any module
- QPixmap modIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_MODULE_ICO" ) );
+ QPixmap modIcon = resMgr->loadPixmap( "SalomeApp", tr( "APP_MODULE_ICO" ), false );
if ( modIcon.isNull() )
modIcon = QPixmap( imageEmptyIcon );
QString modName = moduleName( *it );
- QPixmap icon = resMgr->loadPixmap( modName, iconName );
+ QPixmap icon = resMgr->loadPixmap( modName, iconName, false );
if ( icon.isNull() )
icon = modIcon;
// Force user to create/open a study before module activation
QMap<QString, QString> iconMap;
moduleIconNames( iconMap );
- QPixmap icon = resourceMgr()->loadPixmap( moduleName( modName ), iconMap[ modName ] );
+ QPixmap icon = resourceMgr()->loadPixmap( moduleName( modName ), iconMap[ modName ], false );
+ if ( icon.isNull() )
+ icon = resourceMgr()->loadPixmap( "SalomeApp", tr( "APP_MODULE_BIG_ICO" ), false ); // default icon for any module
bool cancelled = false;
while ( !modName.isEmpty() && !activeStudy() && !cancelled ){
return res;
}
+bool SalomeApp_Application::onLoadDoc( const QString& aName )
+{
+ bool res = CAM_Application::onLoadDoc( aName );
+
+ /*jfa tmp:QAction* a = action( MRUId );
+ if ( a && a->inherits( "QtxMRUAction" ) )
+ {
+ QtxMRUAction* mru = (QtxMRUAction*)a;
+ if ( res )
+ mru->insert( aName );
+ else
+ mru->remove( aName );
+ }*/
+ return res;
+}
+
void SalomeApp_Application::onSelection()
{
onSelectionChanged();
((SalomeApp_Module*)activeModule())->selectionChanged();
}
-void SalomeApp_Application::onSelectionChanged()
+void SalomeApp_Application::onCopy()
{
- /*
- SalomeApp_Module* module = dynamic_cast<SalomeApp_Module*>(activeModule());
- if(module == NULL) return;
-
- QString ior = module->engineIOR();
- if(ior.length() < 5) return; //Not a real CORBA IOR
- CORBA::Object_var obj = orb()->string_to_object(ior.latin1());
- if(CORBA::is_nil(obj)) return;
-
- SALOMEDS::Driver_var engine = SALOMEDS::Driver::_narrow(obj);
- if(CORBA::is_nil(engine)) return;
-*/
+ SALOME_ListIO list;
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
+ mgr->selectedObjects(list);
+
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
+ if(study == NULL) return;
+
+ _PTR(Study) stdDS = study->studyDS();
+ if(!stdDS) return;
+
+ SALOME_ListIteratorOfListIO it( list );
+ if(it.More())
+ {
+ _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
+ try {
+ studyMgr()->Copy(so);
+ onSelectionChanged();
+ }
+ catch(...) {
+ }
+ }
+}
+
+void SalomeApp_Application::onPaste()
+{
+ SALOME_ListIO list;
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
+ mgr->selectedObjects(list);
+
+ SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
+ if(study == NULL) return;
+
+ _PTR(Study) stdDS = study->studyDS();
+ if(!stdDS) return;
+
+ SALOME_ListIteratorOfListIO it( list );
+ if(it.More())
+ {
+ _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
+ try {
+ studyMgr()->Paste(so);
+ updateObjectBrowser( true );
+ }
+ catch(...) {
+ }
+ }
+}
+void SalomeApp_Application::onSelectionChanged()
+{
SALOME_ListIO list;
SalomeApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(list);
if(!stdDS) return;
QAction* qaction;
- //Varibales isEnabledCopy and isEnabledPaste are used for multi selection.
- bool isEnabledCopy = true;
- bool isEnabledPaste = true;
- for ( SALOME_ListIteratorOfListIO it( list ); it.More() && (isEnabledCopy || isEnabledPaste); it.Next() )
+ SALOME_ListIteratorOfListIO it( list );
+ if(it.More() && list.Extent() == 1)
{
_PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
qaction = action(EditCopyId);
- if( isEnabledCopy && studyMgr()->CanCopy(so) ) qaction->setEnabled(true);
- else {
- isEnabledCopy = false;
- qaction->setEnabled(false);
- }
-
+ if(studyMgr()->CanCopy(so) ) qaction->setEnabled(true);
+ else qaction->setEnabled(false);
+
qaction = action(EditPasteId);
- if( isEnabledPaste && studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
- else {
- isEnabledPaste = false;
- qaction->setEnabled(false);
- }
+ if( studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
+ else qaction->setEnabled(false);
}
+ else {
+ qaction = action(EditCopyId);
+ qaction->setEnabled(false);
+ qaction = action(EditPasteId);
+ qaction->setEnabled(false);
+ }
}
void SalomeApp_Application::onRefresh()
SALOME_ListIO aList;
SalomeApp_SelectionMgr* mgr = selectionMgr();
mgr->selectedObjects(aList);
- if (aList.Extent() > 1) return;
+ if (aList.Extent() != 1)
+ {
+ QApplication::restoreOverrideCursor();
+ return;
+ }
Handle(SALOME_InteractiveObject) aIObj = aList.First();
QString aModuleName(aIObj->getComponentDataType());
QString aModuleTitle = moduleTitle(aModuleName);
QApplication::restoreOverrideCursor();
}
+bool SalomeApp_Application::useStudy(const QString& theName)
+{
+ createEmptyStudy();
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
+ bool res = false;
+ if (aStudy)
+ res = aStudy->loadDocument( theName );
+ updateDesktopTitle();
+ updateCommandsStatus();
+ return res;
+}
+
void SalomeApp_Application::setActiveStudy( SUIT_Study* study )
{
CAM_Application::setActiveStudy( study );
vm->isos( u, v );
u = resMgr->integerValue( "OCCViewer", "iso_number_u", u );
v = resMgr->integerValue( "OCCViewer", "iso_number_v", v );
- // vm->setIsos( u, v );
+ vm->setIsos( u, v );
viewMgr->setViewModel( vm );// custom view model, which extends SALOME_View interface
new SalomeApp_OCCSelector( (OCCViewer_Viewer*)viewMgr->getViewModel(), mySelMgr );
}
vtkVM->Repaint();
}
}
- /*
+
if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) )
{
QPtrList<SUIT_ViewManager> lst;
for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it )
((OCCViewer_Viewer*)it.current())->setIsos( u, v );
}
- */
+
}
void SalomeApp_Application::afterCloseDoc()
CAM_Application::contextMenuPopup( type, thePopup, title );
thePopup->insertSeparator();
thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) );
+
+ // "Activate module" item should appear only if it's necessary
+ OB_Browser* ob = objectBrowser();
+ if ( !ob || type != ob->popupClientType() )
+ return;
+ SALOME_ListIO aList;
+ SalomeApp_SelectionMgr* mgr = selectionMgr();
+ mgr->selectedObjects(aList);
+ if (aList.Extent() != 1)
+ return;
+ Handle(SALOME_InteractiveObject) aIObj = aList.First();
+ QString aModuleName(aIObj->getComponentDataType());
+ QString aModuleTitle = moduleTitle(aModuleName);
+ CAM_Module* currentModule = activeModule();
+ if (currentModule && currentModule->moduleName() == aModuleTitle)
+ return;
thePopup->insertItem( tr( "MEN_OPENWITH" ), this, SLOT( onOpenWith() ) );
}
if ( objectBrowser() )
objectBrowser()->updateTree();
}
+
+
+//************************************************************
+void SalomeApp_Application::onDesktopActivated()
+{
+ CAM_Application::onDesktopActivated();
+ SalomeApp_Module* aModule = dynamic_cast<SalomeApp_Module*>(activeModule());
+ if(aModule)
+ aModule->studyActivated();
+}