}
/*!
- \brief Get displayer proxy for given module, by its title (user name).
+ \brief Get displayer proxy for given module, by its title (user name) or by its name.
\param title module title (user name)
\return name of module which provides displayer for requested module
*/
-QString CAM_Application::moduleDisplayer( const QString& title )
+QString CAM_Application::moduleDisplayer( const QString& title_or_name )
{
QString res;
+ if (title_or_name.isEmpty())
+ return res;
+
for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
{
- if ( (*it).title == title )
+ if ( (*it).title == title_or_name ||
+ (*it).name == title_or_name ) {
res = (*it).displayer;
+ if (res.isEmpty())
+ res = (*it).title;
+ }
}
- return res.isEmpty() ? title : res;
+ return res;
}
/*!
if ( !obj || aStudy->isComponent( obj->entry() ) )
continue;
- QString mod_name = moduleTitle(aStudy->componentDataType(obj->entry()));
- LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(mod_name, false);
+ QString mname = aStudy->componentDataType(obj->entry());
+ LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(mname, false);
if ( aDisplayer ) {
Qtx::VisibilityState anObjState = Qtx::UnpresentableState;
if ( aDisplayer->canBeDisplayed( obj->entry(), theViewModel->getType() ) ) {
/*!
\return displayer, corresponding to module
- \param mod_name - name of module
+ \param mod_name - name or title of module.
+ \note It is better to use name (component data type)
+ in any case when you are not sure the title is not empty.
\param load - is module has to be forced loaded
*/
LightApp_Displayer* LightApp_Displayer::FindDisplayer( const QString& mod_name, const bool load )
QString oneAndNotActive = "( count( $component ) = 1 ) and ( not( activeModule in $component ) ) and ( not($displayer={'%3'}) )";
QString uniform = "true in $canBeDisplayed and %1 and ( activeModule = '%2' )";
- uniform = uniform.arg( oneAndNotActive ).arg( name() ).arg( LightApp_Application::moduleDisplayer( moduleName() ) );
+ uniform = uniform.arg( oneAndNotActive ).arg( name() ).arg( LightApp_Application::moduleDisplayer( name() ) );
myPopupMgr->setRule( disp, /*QString( "( not isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule );
myPopupMgr->setRule( erase, /*QString( "( isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule );
myPopupMgr->setRule( dispOnly, uniform, QtxPopupMgr::VisibleRule );
QString e = entry( idx );
if ( !e.isEmpty() ) {
if ( p == "isVisible" ) {
- QString mod_name = app->moduleTitle( myStudy->componentDataType( e ) );
- LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false );
+ QString mname = myStudy->componentDataType( e );
+ LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, false );
// false in last parameter means that now we doesn't load module, if it isn't loaded
bool vis = false;
vis = LightApp_Displayer().IsDisplayed( e );
v = vis;
}
-
- //else if ( p == "component" || p == "displayer" )
- // v = myStudy->componentDataType( e );
else if ( p == "component" )
v = myStudy->componentDataType( e );
- else if ( p == "displayer" ) {
- QString mod_name = app->moduleTitle( myStudy->componentDataType( e ) );
- v = LightApp_Application::moduleDisplayer( mod_name );
- }
-
+ else if ( p == "displayer" )
+ v = LightApp_Application::moduleDisplayer( myStudy->componentDataType( e ) );
else if ( p == "isComponent" )
v = myStudy->isComponent( e );
else if ( p == "isReference" )
v = isReference( idx );
else if ( p == "canBeDisplayed" ) {
- QString mod_name = app->moduleTitle( myStudy->componentDataType( e ) );
- LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false );
+ QString mname = myStudy->componentDataType( e ) ;
+ LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, false );
// false in last parameter means that now we doesn't load module, if it isn't loaded
if ( d )
QStringList::const_iterator anIt = comps.begin(), aLast = comps.end();
for( ; anIt!=aLast; anIt++ )
{
- LightApp_Displayer* disp = LightApp_Displayer::FindDisplayer( app->moduleTitle( *anIt ), false );
+ LightApp_Displayer* disp = LightApp_Displayer::FindDisplayer( *anIt, false );
if( disp )
disp->EraseAll( false, false, 0 );
}
QString mod_name;
if( sel->count()>0 )
{
- QString aStr = sel->parameter( 0, "displayer" ).toString();
- mod_name = app->moduleTitle( aStr );
+ QString aStr = sel->parameter( 0, "displayer" ).toString();
+ mod_name = aStr;
}
else if( app->activeModule() )
- mod_name = app->moduleTitle( app->activeModule()->name() );
+ mod_name = app->activeModule()->name();
LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, true );
if( !d )
LightApp_Application* anApp = getApplication();
LightApp_Study* aStudy = getActiveStudy();
if ( anApp && aStudy ) {
- QString mname = anApp->moduleTitle( aStudy->componentDataType( myEntry ) );
+ QString mname = aStudy->componentDataType( myEntry );
LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, true );
if ( d ) {
QStringList entries;
QStringList comps;
aStudy->components( comps );
foreach( QString comp, comps ) {
- LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), false );
+ LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( comp, false );
if ( d ) d->EraseAll( false, false, 0 );
}
- QString mname = anApp->moduleTitle( aStudy->componentDataType( myEntry ) );
+ QString mname = aStudy->componentDataType( myEntry );
LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, true );
if ( d ) {
QStringList entries;
LightApp_Application* anApp = getApplication();
LightApp_Study* aStudy = getActiveStudy();
if ( anApp && aStudy ) {
- QString mname = anApp->moduleTitle( aStudy->componentDataType( myEntry ) );
+ QString mname = aStudy->componentDataType( myEntry );
LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mname, true );
if ( d ) {
QStringList entries;
QStringList comps;
aStudy->components( comps );
foreach( QString comp, comps ) {
- LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), true );
+ LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( comp, true );
if ( d ) {
QStringList entries;
aStudy->children( aStudy->centry( comp ), entries );
QStringList comps;
aStudy->components( comps );
foreach( QString comp, comps ) {
- LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), false );
+ LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( comp, false );
if ( d ) d->EraseAll( false, false, 0 );
}
}
Handle(SALOME_InteractiveObject) aIObj = aList.First();
QString aModuleName(aIObj->getComponentDataType());
QString aModuleTitle = moduleTitle(aModuleName);
+ if (aModuleTitle.isEmpty()) // no gui
+ aModuleTitle = moduleDisplayer(aModuleName);
activateModule(aModuleTitle);
QApplication::restoreOverrideCursor();
}
if ( !entry.startsWith( tr( "SAVE_POINT_DEF_NAME" ) ) ) {
QString aModuleName( aIObj->getComponentDataType() );
QString aModuleTitle = moduleTitle( aModuleName );
+ if (aModuleTitle.isEmpty()) {
+ // use displayer module, if given
+ aModuleTitle = moduleDisplayer( aModuleName );
+ }
CAM_Module* currentModule = activeModule();
- if ( ( !currentModule || currentModule->moduleName() != aModuleTitle ) && !aModuleTitle.isEmpty() )
+ if ( ( !currentModule || currentModule->moduleName() != aModuleTitle ) && !aModuleTitle.isEmpty() ) {
thePopup->addAction( tr( "MEN_OPENWITH" ).arg( aModuleTitle ), this, SLOT( onOpenWith() ) );
+ }
}
}
/* Define visibility state */
bool isComponent = dynamic_cast<SalomeApp_ModuleObject*>( suit_obj ) != 0;
if ( suit_obj && !isComponent && myStudy->visibilityState( theID.c_str() ) == Qtx::UnpresentableState ) {
- QString moduleTitle = ((CAM_Application*)myStudy->application())->moduleTitle(suit_obj->componentDataType());
- if (!moduleTitle.isEmpty()) {
- LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(moduleTitle,false);
- if (aDisplayer) {
- if(aDisplayer->canBeDisplayed(theID.c_str())) {
- myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState ); //hide the just added object
- //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
- }
- //else
- //MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
+ LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer
+ (suit_obj->componentDataType(),false);
+ if (aDisplayer) {
+ if (aDisplayer->canBeDisplayed(theID.c_str())) {
+ //hide the just added object
+ myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
+ //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
}
+ //else
+ // MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
}
}
} // END: work with tree nodes structure
/* Define visibility state */
bool isComponent = dynamic_cast<SalomeApp_ModuleObject*>( suit_obj ) != 0;
if ( suit_obj && !isComponent ) {
- QString moduleTitle = ((CAM_Application*)myStudy->application())->moduleTitle(suit_obj->componentDataType());
- if (!moduleTitle.isEmpty()) {
- LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer(moduleTitle,false);
- if (aDisplayer) {
- if(aDisplayer->canBeDisplayed(theID.c_str())) {
- myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
- //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
- }
- //else
- //MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
+ LightApp_Displayer* aDisplayer = LightApp_Displayer::FindDisplayer
+ (suit_obj->componentDataType(),false);
+ if (aDisplayer) {
+ if (aDisplayer->canBeDisplayed(theID.c_str())) {
+ myStudy->setVisibilityState( theID.c_str(), Qtx::HiddenState );
+ //MESSAGE("Object with entry : "<< theID <<" CAN be displayed !!!");
}
+ //else
+ // MESSAGE("Object with entry : "<< theID <<" CAN'T be displayed !!!");
}
}
break;