Index: code/branches/core5/src/libraries/core/BaseObject.cc
===================================================================
--- code/branches/core5/src/libraries/core/BaseObject.cc	(revision 5881)
+++ code/branches/core5/src/libraries/core/BaseObject.cc	(revision 5882)
@@ -118,4 +118,5 @@
 
         XMLPortObjectTemplate(BaseObject, Template, "templates", addTemplate, getTemplate, xmlelement, mode, Template*);
+        XMLPortObject(BaseObject, BaseObject, "eventlisteners", addEventListener, getEventListener, xmlelement, mode);
         
         Element* events = 0;
@@ -123,5 +124,5 @@
             events = xmlelement.FirstChildElement("events", false);
         else if (mode == XMLPort::SaveObject)
-            ;
+            {}
         if (events)
             this->XMLEventPort(*events, mode);
@@ -137,4 +138,5 @@
         XMLPortEventState(BaseObject, BaseObject, "activity", setActive, xmlelement, mode);
         XMLPortEventState(BaseObject, BaseObject, "visibility", setVisible, xmlelement, mode);
+        XMLPortEventState(BaseObject, BaseObject, "mainstate", setMainState, xmlelement, mode);
         
         this->bRegisteredEventStates_ = true;
@@ -242,4 +244,28 @@
     }
 
+    /**
+        @brief Adds an object which listens to the events of this object.
+    */
+    void BaseObject::addEventListener(BaseObject* listener)
+    {
+        this->eventListenersXML_.insert(listener);
+        listener->addEventSource(this, "mainstate");
+    }
+    
+    /**
+        @brief Returns an event listener with a given index.
+    */
+    BaseObject* BaseObject::getEventListener(unsigned int index) const
+    {
+        unsigned int i = 0;
+        for (std::set<BaseObject*>::const_iterator it = this->eventListenersXML_.begin(); it != this->eventListenersXML_.end(); ++it)
+        {
+            if (i == index)
+                return *it;
+            ++i;
+        }
+        return 0;
+    }
+
     void BaseObject::addEventState(const std::string& name, EventState* state)
     {
Index: code/branches/core5/src/libraries/core/BaseObject.h
===================================================================
--- code/branches/core5/src/libraries/core/BaseObject.h	(revision 5881)
+++ code/branches/core5/src/libraries/core/BaseObject.h	(revision 5882)
@@ -157,4 +157,7 @@
             void removeEventSource(BaseObject* source);
             BaseObject* getEventSource(unsigned int index, const std::string& state) const;
+            
+            void addEventListener(BaseObject* listener);
+            BaseObject* getEventListener(unsigned int index) const;
 
             void fireEvent();
@@ -208,4 +211,5 @@
             std::map<BaseObject*, std::string>  eventSources_;           //!< List of objects which send events to this object, mapped to the state which they affect
             std::set<BaseObject*>               eventListeners_;         //!< List of objects which listen to the events of this object
+            std::set<BaseObject*>               eventListenersXML_;      //!< List of objects which listen to the events of this object through the "eventlisteners" subsection in XML
             std::map<std::string, EventState*>  eventStates_;            //!< Maps the name of the event states to their helper objects
             bool                                bRegisteredEventStates_; //!< Becomes true after the object registered its event states (with XMLEventPort)
Index: code/branches/core5/src/modules/objects/eventsystem/EventDispatcher.cc
===================================================================
--- code/branches/core5/src/modules/objects/eventsystem/EventDispatcher.cc	(revision 5881)
+++ code/branches/core5/src/modules/objects/eventsystem/EventDispatcher.cc	(revision 5882)
@@ -54,5 +54,5 @@
         SUPER(EventDispatcher, XMLPort, xmlelement, mode);
 
-        XMLPortObject(EventDispatcher, EventTarget, "targets", addTarget, getTarget, xmlelement, mode);
+        XMLPortObject(EventDispatcher, BaseObject, "targets", addTarget, getTarget, xmlelement, mode);
     }
 
@@ -60,5 +60,5 @@
     {
         for (std::list<EventTarget*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)
-            (*it)->fireEvent(event);
+            (*it)->processEvent(event);
     }
 
Index: code/branches/core5/src/modules/objects/eventsystem/EventTarget.cc
===================================================================
--- code/branches/core5/src/modules/objects/eventsystem/EventTarget.cc	(revision 5881)
+++ code/branches/core5/src/modules/objects/eventsystem/EventTarget.cc	(revision 5882)
@@ -42,4 +42,9 @@
     {
     }
+    
+    void EventTarget::processEvent(Event& event)
+    {
+        this->fireEvent(event);
+    }
 
     void EventTarget::changedName()
Index: code/branches/core5/src/modules/objects/eventsystem/EventTarget.h
===================================================================
--- code/branches/core5/src/modules/objects/eventsystem/EventTarget.h	(revision 5881)
+++ code/branches/core5/src/modules/objects/eventsystem/EventTarget.h	(revision 5882)
@@ -42,4 +42,6 @@
             EventTarget(BaseObject* creator);
             virtual ~EventTarget();
+            
+            virtual void processEvent(Event& event);
 
             virtual void changedName();
