From: srn Date: Wed, 29 Jun 2005 06:53:20 +0000 (+0000) Subject: Modified method SetCurrentStudy, enclosed GUI calls in SALOME_Event. X-Git-Tag: V3_0_1~42 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ee919bc9e211e2a3ba05ce0a5e21f9a716f2321a;p=modules%2Fvisu.git Modified method SetCurrentStudy, enclosed GUI calls in SALOME_Event. --- diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index 0df04a87..a6a49953 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -406,6 +406,39 @@ namespace VISU{ void VISU_Gen_i::SetCurrentStudy (SALOMEDS::Study_ptr theStudy) { + class TEvent: public SALOME_Event { + QString myStudyName; + public: + TEvent(const QString& theStudyName):myStudyName(theStudyName) + {} + virtual void Execute() + { + bool isActive = false; + SUIT_Session* aSession = SUIT_Session::session(); + QPtrList anApplications = aSession->applications(); + QPtrListIterator anIter (anApplications); + SUIT_Application* aFirstApp = anIter.current(); + while (SUIT_Application* anApp = anIter.current()) { + ++anIter; + if (SUIT_Study* aSStudy = anApp->activeStudy()) { + if (SalomeApp_Study* aStudy = dynamic_cast(aSStudy)) { + MESSAGE("There is an application with active study : " << aStudy->studyName()); + if (myStudyName == aStudy->studyName()) { + isActive = true; + break; + } + } + } + } + if (!isActive) { + MESSAGE("!!! anApp->onLoadDoc(myStudyName) !!!"); + // Has to be loaded in an empty or in a new application + SalomeApp_Application* anApp = dynamic_cast(aFirstApp); + anApp->onLoadDoc(myStudyName); + } + } + }; + if (!CORBA::is_nil(theStudy)) { CORBA::String_var aName = theStudy->Name(); @@ -413,29 +446,7 @@ namespace VISU{ MESSAGE("StudyId = " << theStudy->StudyId() << "; Name = '" << aName.in() << "'"); myStudyDocument = SALOMEDS::Study::_duplicate(theStudy); - bool isActive = false; - SUIT_Session* aSession = SUIT_Session::session(); - QPtrList anApplications = aSession->applications(); - QPtrListIterator anIter (anApplications); - SUIT_Application* aFirstApp = anIter.current(); - while (SUIT_Application* anApp = anIter.current()) { - ++anIter; - if (SUIT_Study* aSStudy = anApp->activeStudy()) { - if (SalomeApp_Study* aStudy = dynamic_cast(aSStudy)) { - MESSAGE("There is an application with active study : " << aStudy->studyName()); - if (aStudyName == aStudy->studyName()) { - isActive = true; - break; - } - } - } - } - if (!isActive) { - MESSAGE("!!! anApp->onLoadDoc(aName.in()) !!!"); - // Has to be loaded in an empty or in a new application - SalomeApp_Application* anApp = dynamic_cast(aFirstApp); - anApp->onLoadDoc(aName.in()); - } + ProcessVoidEvent(new TEvent(aStudyName)); } else { MESSAGE("CORBA::is_nil(theStudy)"); }