X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARDGUI%2FHOMARDGUI_Utils.cxx;h=ec600c8ffe451de8985a8ed21e2b9d4c450630b1;hb=refs%2Ftags%2FV9_13_0b1;hp=89d7de235deae147ddb5c6130ac3431d82304177;hpb=97e4e858387f05b6260ff7ed68c9b73f99aecb22;p=modules%2Fhomard.git diff --git a/src/HOMARDGUI/HOMARDGUI_Utils.cxx b/src/HOMARDGUI/HOMARDGUI_Utils.cxx index 89d7de23..ec600c8f 100644 --- a/src/HOMARDGUI/HOMARDGUI_Utils.cxx +++ b/src/HOMARDGUI/HOMARDGUI_Utils.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2011-2013 CEA/DEN, EDF R&D +// Copyright (C) 2011-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,7 +32,6 @@ #include "SalomeApp_Study.h" #include "SALOME_ListIO.hxx" -#include "SALOME_ListIteratorOfListIO.hxx" #include "SALOMEconfig.h" #include "utilities.h" @@ -43,20 +42,12 @@ #include #include #include +#ifndef WIN32 #include +#endif SALOME_ListIO HOMARD_UTILS::mySelected; -//================================================================ -// Function : GetCStudy -// Returne un pointeur sur l'etude courante -//================================================================ - _PTR(Study) HOMARD_UTILS::GetCStudy(const SalomeApp_Study* theStudy) -{ - return theStudy->studyDS(); -} - - //================================================================ // Function : GetActiveStudy // Returne un pointeur sur l'etude active @@ -71,17 +62,15 @@ SUIT_Study* HOMARD_UTILS::GetActiveStudy() } //================================================================ -// Function : GetActiveStudyDocument +// Function : getStudy // Returne un pointeur sur l'etude active //================================================================ -_PTR(Study) HOMARD_UTILS::GetActiveStudyDocument() +_PTR(Study) HOMARD_UTILS::getStudy() { - SalomeApp_Study* aStudy = dynamic_cast(GetActiveStudy()); - if (aStudy){ - return aStudy->studyDS(); - } - else - return _PTR(Study)(); + static _PTR(Study) _study; + if(!_study) + _study = SalomeApp_Application::getStudy(); + return _study; } //================================================================ @@ -116,11 +105,10 @@ const SALOME_ListIO& HOMARD_UTILS::selectedIO() if( aSelectionMgr ) { aSelectionMgr->selectedObjects( mySelected ); - for (SALOME_ListIteratorOfListIO it (mySelected); it.More(); it.Next()) - SCRUTE(it.Value()->getEntry()); + for (SALOME_ListIteratorOfListIO it (mySelected); it.More(); it.Next()) + SCRUTE(it.Value()->getEntry()); }; return mySelected; - } //================================================================ @@ -135,7 +123,7 @@ int HOMARD_UTILS::IObjectCount() { aSelectionMgr->selectedObjects( mySelected ); SCRUTE(mySelected.Extent()); - return mySelected.Extent(); + return mySelected.Extent(); } return 0; } @@ -161,20 +149,7 @@ Handle(SALOME_InteractiveObject) HOMARD_UTILS::lastIObject() } //================================================================ -// Function : isXmgrace -// Retourne vrai si le fichier associe est de type ASCII -//================================================================ -bool HOMARD_UTILS::isXmgrace(_PTR(SObject) MonObj) -{ - _PTR(GenericAttribute) anAttr; - if (!MonObj->FindAttribute(anAttr, "AttributeComment")) return false; - _PTR(AttributeComment) aFileComment (anAttr); - std::string Type = aFileComment->Value(); - if (QString(Type.c_str()) == QString("HomardOuputQual")) return true; - return false; -} -//================================================================ -// Retourne vrai si l objet est du type voulu +// Retourne vrai si l'objet est du type voulu // . Dans le cas d'un cas, d'une hypothese, d'une zone, on se contente // d'une comparaison simple entre le type stocke et TypeObject. // . Pour l'iteration, le type stocke en attribut est sous la forme @@ -201,6 +176,7 @@ bool HOMARD_UTILS::isObject(_PTR(SObject) MonObj, QString TypeObject, int option if ( option == 0 ) { int position = Type.lastIndexOf(TypeObject); +// MESSAGE("position = "<moduleName(aHomardGUI->moduleName()) : QString("") ; - // Recherche de la langue + // WARNING/ATTENTION : si on savait recuperer la langue depuis les preferences, on ne ferait pas le passage par argument // SUIT_ResourceMgr* resMgr = getApp()->resourceMgr(); // SUIT_ResourceMgr* resMgr = myModule->getApp()->resourceMgr(); // QString langue = resMgr->stringValue("language", "language", "en"); - QString langue = "fr" ; - MESSAGE(". langue " << langue.toStdString().c_str()) ; +// QString langue = "fr" ; + MESSAGE(". LanguageShort " << LanguageShort.toStdString().c_str()) ; // Complement du fichier - QString fichier = QString(langue+"/"+monFichierAide) ; + QString fichier = QString(LanguageShort+"/"+monFichierAide) ; MESSAGE(". Appel de onHelpContextModule avec :"); MESSAGE(" rep = "<< rep.toStdString().c_str()); MESSAGE(" fichier = "<< fichier.toStdString().c_str());