1 // Copyright (C) 2006-2008 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "RuntimeSALOME.hxx"
20 #include "guiContext.hxx"
22 #include "Container.hxx"
23 #include "ComponentInstance.hxx"
24 #include "commandsProc.hxx"
25 #include "guiObservers.hxx"
28 #include "YacsTrace.hxx"
33 using namespace YACS::ENGINE;
34 using namespace YACS::HMI;
36 GuiContext * GuiContext::_current = 0;
38 GuiContext::GuiContext()
41 _builtinCatalog = getSALOMERuntime()->getBuiltinCatalog();
46 _invoc = new ProcInvoc();
51 _mapOfSubjectNode.clear();
52 _mapOfSubjectDataPort.clear();
53 _mapOfSubjectLink.clear();
54 _mapOfSubjectControlLink.clear();
55 _mapOfSubjectComponent.clear();
56 _mapOfSubjectContainer.clear();
57 _mapOfSubjectDataType.clear();
58 _mapOfExecSubjectNode.clear();
59 _lastErrorMessage ="";
61 _YACSEngineContainer = pair<string, string>("YACSServer","localhost");
64 GuiContext::~GuiContext()
66 if (_invoc) delete _invoc;
70 _subjectProc->clean();
77 void GuiContext::setProc(YACS::ENGINE::Proc* proc)
79 DEBTRACE("GuiContext::setProc ");
82 Subject::erase(_subjectProc);
86 _mapOfSubjectNode.clear();
87 _mapOfSubjectDataPort.clear();
88 _mapOfSubjectLink.clear();
89 _mapOfSubjectControlLink.clear();
90 _mapOfSubjectComponent.clear();
91 _mapOfSubjectContainer.clear();
92 _mapOfSubjectDataType.clear();
94 _subjectProc = new SubjectProc(proc, this);
95 _mapOfSubjectNode[static_cast<Node*>(proc)] = _subjectProc;
96 update(YACS::HMI::NEWROOT, 0, _subjectProc);
97 _subjectProc->loadProc();
98 update(YACS::HMI::ENDLOAD, 0, _subjectProc);
101 long GuiContext::getNewId(YACS::HMI::TypeOfElem type)