[Orxonox-commit 2698] r7403 - in code/trunk: . data/gui/layouts data/gui/scripts data/levels data/levels/old src/libraries/core src/modules/notifications src/modules/notifications/dispatchers src/modules/objects/triggers src/modules/questsystem src/orxonox/interfaces

dafrick at orxonox.net dafrick at orxonox.net
Sat Sep 11 10:20:45 CEST 2010


Author: dafrick
Date: 2010-09-11 10:20:44 +0200 (Sat, 11 Sep 2010)
New Revision: 7403

Added:
   code/trunk/data/gui/layouts/NotificationLayer.layout
   code/trunk/data/gui/scripts/NotificationLayer.lua
Removed:
   code/trunk/src/modules/notifications/NotificationOverlay.cc
   code/trunk/src/modules/notifications/NotificationOverlay.h
Modified:
   code/trunk/
   code/trunk/data/gui/scripts/GUISheet.lua
   code/trunk/data/gui/scripts/KeyBindMenu.lua
   code/trunk/data/gui/scripts/MiscConfigMenu.lua
   code/trunk/data/gui/scripts/SheetManager.lua
   code/trunk/data/levels/Fight in our Back.oxw
   code/trunk/data/levels/Quest_PirateAttack.oxw
   code/trunk/data/levels/old/princessaeryn.oxw
   code/trunk/data/levels/old/questsystem.oxw
   code/trunk/data/levels/princessaeryn.oxw
   code/trunk/data/levels/tutorial.oxw
   code/trunk/src/libraries/core/GUIManager.cc
   code/trunk/src/libraries/core/GUIManager.h
   code/trunk/src/modules/notifications/CMakeLists.txt
   code/trunk/src/modules/notifications/Notification.cc
   code/trunk/src/modules/notifications/Notification.h
   code/trunk/src/modules/notifications/NotificationDispatcher.cc
   code/trunk/src/modules/notifications/NotificationDispatcher.h
   code/trunk/src/modules/notifications/NotificationManager.cc
   code/trunk/src/modules/notifications/NotificationManager.h
   code/trunk/src/modules/notifications/NotificationQueue.cc
   code/trunk/src/modules/notifications/NotificationQueue.h
   code/trunk/src/modules/notifications/NotificationsPrereqs.h
   code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc
   code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
   code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
   code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h
   code/trunk/src/modules/questsystem/Quest.cc
   code/trunk/src/modules/questsystem/QuestDescription.cc
   code/trunk/src/modules/questsystem/QuestDescription.h
   code/trunk/src/modules/questsystem/QuestHint.cc
   code/trunk/src/modules/questsystem/QuestNotification.cc
   code/trunk/src/modules/questsystem/QuestNotification.h
   code/trunk/src/orxonox/interfaces/NotificationListener.h
Log:
Merged notifications branch back to trunk.



Property changes on: code/trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/doc:7290-7400
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
   + /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/doc:7290-7400
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890

Copied: code/trunk/data/gui/layouts/NotificationLayer.layout (from rev 7401, code/branches/notifications/data/gui/layouts/NotificationLayer.layout)
===================================================================
--- code/trunk/data/gui/layouts/NotificationLayer.layout	                        (rev 0)
+++ code/trunk/data/gui/layouts/NotificationLayer.layout	2010-09-11 08:20:44 UTC (rev 7403)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+    <Window Type="DefaultWindow" Name="orxonox/NotificationLayer/Root" >
+        <Property Name="InheritsAlpha" Value="False" />
+        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+    </Window>
+</GUILayout>

Modified: code/trunk/data/gui/scripts/GUISheet.lua
===================================================================
--- code/trunk/data/gui/scripts/GUISheet.lua	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/gui/scripts/GUISheet.lua	2010-09-11 08:20:44 UTC (rev 7403)
@@ -39,6 +39,10 @@
 function P:onHide()
 end
 
+-- Override this function if you need to do work just after the sheet has been hidden
+function P:afterHide()
+end
+
 function P:load()
     -- Load the layout that describes the sheet
     self.window = winMgr:loadWindowLayout(self.name .. ".layout")

Modified: code/trunk/data/gui/scripts/KeyBindMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/KeyBindMenu.lua	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/gui/scripts/KeyBindMenu.lua	2010-09-11 08:20:44 UTC (rev 7403)
@@ -112,7 +112,7 @@
     elseif( string.find(group, "JoyStickButtons") ~= nil ) then
         return "Joystick " .. name
     elseif( string.find(group, "JoyStickAxes") ~= nil ) then
-        return "Joystick Axis" .. string.sub(name, 5, 6) .. string.sub(name, string.find(name, 'Axis%d%d(.*)')+6)
+        return "Joystick Axis " .. string.sub(name, 5, 6) .. string.sub(name, string.find(name, 'Axis%d%d(.*)')+6)
     elseif( group == "MouseAxes" ) then
         return "Mouse " .. string.sub(name, string.find(name, '.(.*)')+1) .. " " .. string.sub(name, 1, 1) .. "-Axis"
     end

Modified: code/trunk/data/gui/scripts/MiscConfigMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/MiscConfigMenu.lua	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/gui/scripts/MiscConfigMenu.lua	2010-09-11 08:20:44 UTC (rev 7403)
@@ -50,7 +50,7 @@
     table.insert(P.nameList, "Autostart")
     table.insert(P.nameList, "Number of Bots")
     table.insert(P.nameList, "UnderAttack: game time")
-    table.insert(P.nameList, "TeamDeathmatch: Numer of teams")
+    table.insert(P.nameList, "TeamDeathmatch: Number of teams")
     table.insert(P.nameList, "Playername")
     table.insert(P.nameList, "Chat: display time")
 

Copied: code/trunk/data/gui/scripts/NotificationLayer.lua (from rev 7401, code/branches/notifications/data/gui/scripts/NotificationLayer.lua)
===================================================================
--- code/trunk/data/gui/scripts/NotificationLayer.lua	                        (rev 0)
+++ code/trunk/data/gui/scripts/NotificationLayer.lua	2010-09-11 08:20:44 UTC (rev 7403)
@@ -0,0 +1,483 @@
+-- NotificationLayer.lua
+
+local P = createMenuSheet("NotificationLayer", true, TriBool.True, TriBool.True)
+
+P.queueList = {}
+P.editMode = false
+
+P.sampleWindow = nil
+
+-- Loads the queues from the NotificationManager and creates the sample window, that is used to measure the width various strings need.
+function P.onLoad()
+    orxonox.NotificationManager:getInstance():loadQueues()
+    P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/SampleWindow")
+end
+
+-- Creates a queue in the GUI.
+function P.createQueue(name, size)
+    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
+    local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
+    queue:setProperty("BackgroundColor", "00FFFFFF") -- Set background to be fully transparent.
+    root:addChildWindow(queue)
+
+    queue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
+    queue:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queue, size))))
+
+    local queueTuple =
+    {
+        ["window"]  = queue,
+        ["name"]    = name,
+        ["edit"]    = nil,
+        ["visible"] = false
+    }
+
+    P.queueList[name] = queueTuple -- name access
+    P.setVisible(queueTuple, false) -- Set the queue to invisible as long as there are no notifications in it.
+end
+
+-- Removes a queue from the GUI.
+function P.removeQueue(queueName)
+    local queue = P.queueList[queueName]
+
+    if queue ~= nil then
+        winMgr:destroyWindow(queue.window)
+    end
+    P.queueList[queueName] = nil
+end
+
+-- Pushes an input notification to the input queue. 
+function P.pushNotification(queueName, notification)
+    local queue = P.queueList[queueName]
+    if queue == nil then
+        return
+    end
+    item = CEGUI.createListboxTextItem(notification)
+    local listbox = CEGUI.toListbox(queue.window)
+    -- Add the item to the top of the listbox.
+    if listbox:getItemCount() == 0 then
+        listbox:addItem(item)
+    else
+        listbox:insertItem(item, listbox:getListboxItemFromIndex(0))
+    end
+
+    -- If the queue has been invisible, set it to visible.
+    if queue.visible == false then
+        P.setVisible(queue, true)
+    end
+end
+
+-- Pops the least recently added notification from the queue.
+function P.popNotification(queueName)
+    local queue = P.queueList[queueName]
+    if queue == nil then
+        return
+    end
+    local listbox = CEGUI.toListbox(queue.window)
+    -- Removes the item from the bottom of the listbox.
+    listbox:removeItem(listbox:getListboxItemFromIndex(listbox:getItemCount()-1))
+
+    -- Sets the queue to invisible if there are no more notifications in it.
+    if listbox:getItemCount() == 0 then
+        P.setVisible(queue, false)
+    end
+end
+
+-- Removes a notification at a given index from the queue.
+function P.removeNotification(queueName, index)
+    local queue = P.queueList[queueName]
+    if queue == nil then
+        return
+    end
+    local listbox = CEGUI.toListbox(queue.window)
+    -- Removes the item.
+    listbox:removeItem(listbox:getListboxItemFromIndex(tonumber(index)))
+
+    -- Sets the queue to invisible if there are no more notifications in it.
+    if listbox:getItemCount() == 0 then
+        P.setVisible(queue, false)
+    end
+end
+
+-- Clears the queue. Removes all notifications from it.
+function P.clearQueue(queueName)
+    local queue = P.queueList[queueName]
+    if queue == nil then
+        return
+    end
+    local listbox = CEGUI.toListbox(queue.window)
+    CEGUI.toListbox(queue.window):resetList()
+
+    -- Sets the queue to invisible.
+    P.setVisible(queue, false)
+end
+
+-- Sets the visibility of the queue.
+function P.setVisible(queue, visible)
+    if queue == nil then
+        return
+    end
+    queue.window:setVisible(visible)
+    queue.visible = visible
+end
+
+-- Enter the edit mode of the notification layer.
+function P.enterEditMode()
+    P.editMode = true
+
+    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
+
+    --Add control frame window.
+    local window = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/ControlWindow")
+    local frame = tolua.cast(window, "CEGUI::FrameWindow")
+    frame:setCloseButtonEnabled(false)
+    frame:setText("NotificationLayer Control Window")
+    frame:setSize(CEGUI.UVector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.2, 0)))
+    root:addChildWindow(window)
+    local pane = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/ScrollingPane")
+    pane:setSize(CEGUI.UVector2(CEGUI.UDim(1,-20), CEGUI.UDim(1,-30)))
+    pane:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 10), CEGUI.UDim(0, 26)))
+    window:addChildWindow(pane)
+
+    vertOffset = 0
+    horzOffset = 0
+    -- Line to be able to create a new queue.
+    local newQueueTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/NewQueueTitle")
+    newQueueTitle:setText("Create a new NotificationQueue:")
+    local size = getMinTextSize(newQueueTitle)
+    local textHeight = size[1]
+    newQueueTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
+    newQueueTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    pane:addChildWindow(newQueueTitle)
+    horzOffset = horzOffset + size[2] + 5
+    local newQueueName = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/NewQueueName")
+    newQueueName:setProperty("ReadOnly", "set:False")
+    newQueueName:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
+    newQueueName:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    horzOffset = horzOffset + size[2] + 5
+    pane:addChildWindow(newQueueName)
+    local create = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/CreateNewQueue")
+    create:setText("create")
+    P.sampleWindow:setText("create")
+    size = getMinTextSize(P.sampleWindow)
+    create:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]+20), CEGUI.UDim(0, textHeight)))
+    create:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    orxonox.GUIManager:subscribeEventHelper(create, "Clicked", P.name .. ".createNewQueue_clicked")
+    pane:addChildWindow(create)
+    horzOffset = horzOffset + size[2]+20 + 5
+    vertOffset = vertOffset + textHeight + 5
+
+    horzOffset = 0
+    -- Button to leave the edit mode.
+    local leave = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/LeaveEditModeButton")
+    leave:setText("leave Edit Mode")
+    P.sampleWindow:setText("leave Edit Mode")
+    size = getMinTextSize(P.sampleWindow)
+    leave:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]+20), CEGUI.UDim(0, textHeight)))
+    leave:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    orxonox.GUIManager:subscribeEventHelper(leave, "Clicked", P.name .. ".leaveEditMode_clicked")
+    pane:addChildWindow(leave)
+    horzOffset = horzOffset + size[2]+20 + 5
+    vertOffset = vertOffset + textHeight + 5
+
+    --Replace all queues with FrameWindows
+    for k,v in pairs(P.queueList) do
+        if v ~= nil then
+            local queue = P.queueList[k]
+            -- Remove the window that displays the queue from the root window such that it is no longer displayed.
+            root:removeChildWindow(v.window)
+
+            -- Create the frame window, with options to edit the queue, that is displayed instead of the queue.
+            local window = P.createQueueEditFrame(v.name)
+            window:setArea(v.window:getArea()) -- Set the frame window size and position to the same as the queue.
+
+            v.edit = window
+        end
+    end
+end
+
+-- Helper function. Creates a frame for the input queue.
+function P.createQueueEditFrame(queueName)
+    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
+
+    window = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/" .. queueName)
+    local frame = tolua.cast(window, "CEGUI::FrameWindow")
+    frame:setCloseButtonEnabled(true)
+    orxonox.GUIManager:subscribeEventHelper(frame, "CloseClicked", P.name .. ".closeQueue_clicked")
+    frame:setText("NotificationQueue \"" .. queueName .. "\"")
+    root:addChildWindow(window)
+    local pane = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/ScrollingPane")
+    pane:setSize(CEGUI.UVector2(CEGUI.UDim(1,-20), CEGUI.UDim(1,-30)))
+    pane:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 10), CEGUI.UDim(0, 26)))
+    window:addChildWindow(pane)
+
+    local horzOffset = 0
+    local vertOffset = 0
+
+    -- The line that lets you edit the targets of the queue.
+    local targetsTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/TargetsTitle")
+    targetsTitle:setText("Targets:")
+    local size = getMinTextSize(targetsTitle)
+    local textHeight = size[1]
+    targetsTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
+    targetsTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    pane:addChildWindow(targetsTitle)
+    horzOffset = horzOffset + size[2] + 5
+    local targets = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets")
+    targets:setProperty("ReadOnly", "set:False")
+    local targetsText = orxonox.NotificationManager:getInstance():getQueue(queueName):getTargets()
+    targets:setText(targetsText)
+    P.sampleWindow:setText(targetsText)
+    size = getMinTextSize(P.sampleWindow)
+    targets:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
+    targets:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    horzOffset = horzOffset + size[2]*2+20 + 5
+    pane:addChildWindow(targets)
+    local save = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets/Save")
+    save:setText("save")
+    P.sampleWindow:setText("save")
+    size = getMinTextSize(P.sampleWindow)
+    local saveTextWidth = size[2]+20
+    save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
+    save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveTargets_clicked")
+    pane:addChildWindow(save)
+    horzOffset = horzOffset + saveTextWidth
+    vertOffset = vertOffset + textHeight + 5
+
+    horzOffset = 0
+    -- The line that lets you edit the size of the queue.
+    local sizeTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/SizeTitle")
+    sizeTitle:setText("Size:")
+    size = getMinTextSize(sizeTitle)
+    sizeTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
+    sizeTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    pane:addChildWindow(sizeTitle)
+    horzOffset = horzOffset + size[2] + 5
+    local queueSize = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size")
+    queueSize:setProperty("ReadOnly", "set:False")
+    local maxSize = orxonox.NotificationManager:getInstance():getQueue(queueName):getMaxSize()
+    queueSize:setText(maxSize)
+    P.sampleWindow:setText(maxSize)
+    size = getMinTextSize(P.sampleWindow)
+    queueSize:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
+    queueSize:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    horzOffset = horzOffset + size[2]*2+20 + 5
+    pane:addChildWindow(queueSize)
+    save = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size/Save")
+    save:setText("save")
+    P.sampleWindow:setText("save")
+    size = getMinTextSize(P.sampleWindow)
+    local saveTextWidth = size[2]+20
+    save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
+    save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveSize_clicked")
+    pane:addChildWindow(save)
+    horzOffset = horzOffset + saveTextWidth
+    vertOffset = vertOffset + textHeight + 5
+
+    horzOffset = 0
+    -- The line that lets you edit the display time of the queue.
+    local displayTimeTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTimeTitle")
+    displayTimeTitle:setText("Display time:")
+    size = getMinTextSize(displayTimeTitle)
+    displayTimeTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
+    displayTimeTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    pane:addChildWindow(displayTimeTitle)
+    horzOffset = horzOffset + size[2] + 5
+    local displayTime = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime")
+    displayTime:setProperty("ReadOnly", "set:False")
+    local time = orxonox.NotificationManager:getInstance():getQueue(queueName):getDisplayTime()
+    displayTime:setText(time)
+    P.sampleWindow:setText(time)
+    size = getMinTextSize(P.sampleWindow)
+    displayTime:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
+    displayTime:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    horzOffset = horzOffset + size[2]*2+20 + 5
+    pane:addChildWindow(displayTime)
+    save = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime/Save")
+    save:setText("save")
+    P.sampleWindow:setText("save")
+    size = getMinTextSize(P.sampleWindow)
+    local saveTextWidth = size[2]+20
+    save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
+    save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
+    orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveDisplayTime_clicked")
+    pane:addChildWindow(save)
+    horzOffset = horzOffset + saveTextWidth
+    vertOffset = vertOffset + textHeight + 5
+
+    return window
+end
+
+-- Leave the edit mode.
+function P.leaveEditMode()
+    P.editMode = false
+
+    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
+    --Replace all queues with FrameWindows
+    for k,v in pairs(P.queueList) do
+        if v ~= nil then
+            -- Add the queue window to the root window to have it displayed again.
+            root:addChildWindow(v.window)
+            -- Set the size and position of the queue window to the size and position of the queue edit frame.
+            v.window:setArea(v.edit:getArea())
+            -- Destroy the edit frame.
+            winMgr:destroyWindow(v.edit)
+            v.edit = nil
+        end
+    end
+
+    --Remove control window
+    winMgr:destroyWindow(winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/ControlWindow"))
+end
+
+-- Is called after the sheet has been hidden.
+function P.afterHide()
+    -- If we leave the edit mode we show the sheet again.
+    if P.editMode then
+        P.leaveEditMode()
+        showMenuSheet(P.name, false, true)
+    end
+end
+
+-- If the button to save the targets of a queue has been clicked.
+function P. saveTargets_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "EditMode/.*/Targets/Save")
+    local nameStr = match()
+    local queueName = string.sub(nameStr, 10, string.len(nameStr)-13)
+
+    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets")
+    local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets/Save")
+    local width = window:getWidth():asAbsolute(1)
+
+    local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
+    -- Set the new targets.
+    queue:setTargets(window:getText())
+    local targets = queue:getTargets()
+
+    window:setText(targets)
+    P.sampleWindow:setText(targets)
+    local size = getMinTextSize(P.sampleWindow)
+    -- Adjust the width of the targets field.
+    window:setWidth(CEGUI.UDim(0, size[2]*2+20))
+    -- Adjust the position of the save button after the targets field.
+    save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
+end
+
+-- If the button to save the size if a queue has been clicked.
+function P. saveSize_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "EditMode/.*/Size/Save")
+    local nameStr = match()
+    local queueName = string.sub(nameStr, 10, string.len(nameStr)-10)
+
+    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size")
+    local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size/Save")
+    local width = window:getWidth():asAbsolute(1)
+
+    local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
+    -- Set the new size.
+    queue:setMaxSize(tonumber(window:getText()))
+    local maxSize = queue:getMaxSize()
+
+    window:setText(maxSize)
+    P.sampleWindow:setText(maxSize)
+    local size = getMinTextSize(P.sampleWindow)
+    -- Adjust the width of the size field.
+    window:setWidth(CEGUI.UDim(0, size[2]*2+20))
+    -- Adjust the position of the save button after the size field.
+    save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
+end
+
+-- If the button to save the display time if a queue has been clicked.
+function P. saveDisplayTime_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "EditMode/.*/DisplayTime/Save")
+    local nameStr = match()
+    local queueName = string.sub(nameStr, 10, string.len(nameStr)-17)
+
+    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime")
+    local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime/Save")
+    local width = window:getWidth():asAbsolute(1)
+
+    local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
+    -- Set the new display time.
+    queue:setDisplayTime(tonumber(window:getText()))
+    local time = queue:getDisplayTime()
+
+    window:setText(time)
+    P.sampleWindow:setText(time)
+    local size = getMinTextSize(P.sampleWindow)
+    -- Adjust the width of the display time field.
+    window:setWidth(CEGUI.UDim(0, size[2]*2+20))
+    -- Adjust the position of the save button after the display time field.
+    save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
+end
+
+-- if the button to create a new queue has been clicked.
+function P.createNewQueue_clicked(e)
+    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/ControlWindow/NewQueueName")
+    local name = window:getText()
+    -- Creates the new queue.
+    orxonox.NotificationManager:getInstance():createQueue(name)
+
+    local queue = P.queueList[name]
+    if queue == nil then
+        return
+    end
+
+    -- Create the frame that represents the queue in edit mode, since that's what we're in.
+    local frame = P.createQueueEditFrame(name)
+    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
+    -- Remove the queue window from the root window, since we're in edit mode.
+    root:removeChildWindow(queue.window)
+    -- Set the frame window size and position to that of the queue window.
+    frame:setArea(queue.window:getArea())
+    queue.edit = frame
+
+    -- Reset the text to create a new queue.
+    window:setText("")
+end
+
+-- If the button to leave the edit mode has been clicked.
+function P.leaveEditMode_clicked(e)
+    hideMenuSheet(P.name)
+end
+
+-- If the button to close the queue has been clicked.
+function P.closeQueue_clicked(e)
+    local we = CEGUI.toWindowEventArgs(e)
+    local name = we.window:getName()
+
+    local match = string.gmatch(name, "EditMode/.*")
+    local nameStr = match()
+    local queueName = string.sub(nameStr, 10, string.len(nameStr))
+
+    -- Destroy the frame window,
+    winMgr:destroyWindow(P.queueList[queueName].edit)
+    P.queueList[queueName].edit = nil
+    -- Destroy the queue.
+    orxonox.NotificationManager:getInstance():getQueue(queueName):destroy()
+end
+
+-- Helper function. Returns height a queue needs to have to display 'size' items.
+function P.queueHeightHelper(queue, size)
+    local listbox = CEGUI.toListbox(queue)
+    local item = CEGUI.createListboxTextItem("Text")
+    listbox:addItem(item)
+    local singleItemHeight = listbox:getTotalItemsHeight()
+    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue:getLookNFeel())
+    local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue)
+    local frameHeight = queue:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
+    listbox:removeItem(item)
+    return frameHeight + singleItemHeight*size
+end
+
+return P

Modified: code/trunk/data/gui/scripts/SheetManager.lua
===================================================================
--- code/trunk/data/gui/scripts/SheetManager.lua	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/gui/scripts/SheetManager.lua	2010-09-11 08:20:44 UTC (rev 7403)
@@ -42,14 +42,14 @@
 end
 
 -- ?
-function showMenuSheet(name, bHidePrevious, ptr)
-    local sheet = showMenuSheet(name, bHidePrevious)
+function showMenuSheet(name, bHidePrevious, bNoInput, ptr)
+    local sheet = showMenuSheet(name, bHidePrevious, bNoInput)
     sheet.overlay = ptr
     return sheet
 end
 
 -- Shows the specified menu sheet and loads it if neccessary
-function showMenuSheet(name, bHidePrevious)
+function showMenuSheet(name, bHidePrevious, bNoInput)
     if name == "" then
         return nil
     end
@@ -62,9 +62,16 @@
         assert(bHidePrevious ~= nil)
     end
 
+    -- Set bNoInput to false if it hasn't been set.
+    if bNoInput == nil then
+        bNoInput = false
+    end
+
+    -- Count the number of sheets that don't need input till the first that does.
+    local counter = noInputSheetCounter()
     -- Pause game control if this is the first menu to be displayed
     -- HUGE HACK?
-    if activeMenuSheets.size == 0 then
+    if bNoInput == false and counter == 0 then
         orxonox.HumanController:pauseControl()
     end
 
@@ -73,11 +80,16 @@
         hideMenuSheet(name)
     end
 
+    if bNoInput == true then
+        menuSheet.tShowCursor = TriBool.Dontcare
+    end
+
     -- Add the sheet in a tuple of additional information
     local sheetTuple =
     {
         ["sheet"]          = menuSheet,
-        ["bHidePrevious"]  = bHidePrevious
+        ["bHidePrevious"]  = bHidePrevious,
+        ["bNoInput"]       = bNoInput
     }
     table.insert(activeMenuSheets, sheetTuple) -- indexed array access
     activeMenuSheets[name] = sheetTuple -- name access
@@ -88,7 +100,9 @@
     menuSheetsRoot:addChildWindow(menuSheet.window)
 
     -- Handle input distribution
-    inputMgr:enterState(menuSheet.inputState)
+    if bNoInput == false then
+        inputMgr:enterState(menuSheet.inputState)
+    end
 
     -- Only change cursor situation if menuSheet.tShowCursor ~= TriBool.Dontcare
     if menuSheet.tShowCursor == TriBool.True then
@@ -147,7 +161,9 @@
     activeMenuSheets.topSheetTuple = activeMenuSheets[activeMenuSheets.size]
 
     -- Leave the input state
-    inputMgr:leaveState(sheetTuple.sheet.inputState)
+    if not sheetTuple.bNoInput then
+        inputMgr:leaveState(sheetTuple.sheet.inputState)
+    end
     
     -- CURSOR SHOWING
     local i = activeMenuSheets.size
@@ -161,11 +177,15 @@
         hideCursor()
     end
 
-    -- Resume control if the last menu is hidden
-    if activeMenuSheets.size == 0 then
+    -- Count the number of sheets that don't need input till the first that does.
+    local counter = noInputSheetCounter()
+    -- Resume control if the last (non-noInput) menu is hidden
+    if counter == 0 then
         orxonox.HumanController:resumeControl()
         hideCursor()
     end
+
+    sheetTuple.sheet:afterHide()
 end
 
 -- Hides all menu GUI sheets
@@ -177,10 +197,16 @@
 
 function keyESC()
     -- HUGE, very HUGE hacks!
-    if activeMenuSheets.size == 1 and activeMenuSheets[1].sheet.name == "MainMenu" then
+
+    -- Count the number of sheets that don't need input till the first that does.
+    local counter = noInputSheetCounter()
+
+    -- If the first sheet that needs input is the MainMenu.
+    if counter == 1 and activeMenuSheets[1].sheet.name == "MainMenu" then
         orxonox.execute("exit")
-    elseif activeMenuSheets.size > 0 then
-        orxonox.execute("hideGUI "..activeMenuSheets.topSheetTuple.sheet.name)
+    -- If there is at least one sheet that needs input.
+    elseif counter > 0 then
+        orxonox.execute("hideGUI "..activeMenuSheets[counter].sheet.name)
     else
         showMenuSheet("InGameMenu")
     end
@@ -190,6 +216,15 @@
     guiMgr:setBackgroundImage(imageSet, imageName)
 end
 
+function noInputSheetCounter()
+    -- Count the number of sheets that don't need input till the first that does.
+    local counter = activeMenuSheets.size
+    while counter > 0 and activeMenuSheets[counter].bNoInput do
+        counter = counter - 1
+    end
+    return counter
+end
+
 ----------------------
 --- Initialisation ---
 ----------------------

Modified: code/trunk/data/levels/Fight in our Back.oxw
===================================================================
--- code/trunk/data/levels/Fight in our Back.oxw	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/levels/Fight in our Back.oxw	2010-09-11 08:20:44 UTC (rev 7403)
@@ -7,15 +7,6 @@
     include("templates/spaceship_Transporter.oxt")
 ?>
 
-<NotificationQueue
-    name     = "notification"
-    position = "0.40, 0.05"
-    font     = "VeraMono"
-    textsize = 0.020
-    length   = 3
-    width    = 50
-/>
-
 <!--*****************************************************************************************************************************************************************************************-->
 <!--Including Template for triggering on player-->
 

Modified: code/trunk/data/levels/Quest_PirateAttack.oxw
===================================================================
--- code/trunk/data/levels/Quest_PirateAttack.oxw	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/levels/Quest_PirateAttack.oxw	2010-09-11 08:20:44 UTC (rev 7403)
@@ -18,18 +18,7 @@
 <?lua
     dofile("includes/CuboidSpaceStation.lua")
 ?>
-
-<NotificationQueue
-     name     = "notification"
-     position = "0.40, 0.05"
-     font     = "VeraMono"
-     textsize = 0.020
-     length   = 3
-     width    = 50
-/>
     
-    
-    
 <Level
 name="Dani's Testlevel"
 description="Erste Versuche mit den Quests"

Modified: code/trunk/data/levels/old/princessaeryn.oxw
===================================================================
--- code/trunk/data/levels/old/princessaeryn.oxw	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/levels/old/princessaeryn.oxw	2010-09-11 08:20:44 UTC (rev 7403)
@@ -8,12 +8,6 @@
     dofile("includes/CuboidSpaceStation.lua")
 ?>
 
-<NotificationQueue
- name  = "notification"
- position = "1.0, 1.0"
- targets = "questsystem"
-/>
-
 <Level
  name         = "The Tale of Princess Aeryn"
  description  = "The Tale of Princess Aeryn"

Modified: code/trunk/data/levels/old/questsystem.oxw
===================================================================
--- code/trunk/data/levels/old/questsystem.oxw	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/levels/old/questsystem.oxw	2010-09-11 08:20:44 UTC (rev 7403)
@@ -4,12 +4,6 @@
   include("templates/spaceship_assff.oxt")
 ?>
 
-<NotificationQueue
- name  = "notification"
- position = "1.0, 1.0"
- targets = "all"
-/>
-
 <Level
  name         = "Questsystem"
  description  = "Just a few tests"

Modified: code/trunk/data/levels/princessaeryn.oxw
===================================================================
--- code/trunk/data/levels/princessaeryn.oxw	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/levels/princessaeryn.oxw	2010-09-11 08:20:44 UTC (rev 7403)
@@ -14,15 +14,6 @@
  description  = "The Tale of Princess Aeryn"
 >
 
-  <NotificationQueue
-   name   = "notification"
-   position = "0.55, 0.05"
-   font   = "VeraMono"
-   textsize = 0.020
-   length   = 3
-   width  = 50
-  />
-
   <templates>
     <Template link=lodtemplate_default />
   </templates>

Modified: code/trunk/data/levels/tutorial.oxw
===================================================================
--- code/trunk/data/levels/tutorial.oxw	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/data/levels/tutorial.oxw	2010-09-11 08:20:44 UTC (rev 7403)
@@ -13,66 +13,33 @@
     <Template link=lodtemplate_default />
   </templates>
 
-  <NotificationQueue
-   name   = "notification"
-   position = "0.05, 0.05"
-   font   = "VeraMono"
-   textsize = 0.020
-   length   = 3
-   width  = 50
-  />
-
   <Scene
    ambientlight = "0.5, 0.5, 0.5"
    skybox       = "Orxonox/skypanoramagen1"
   >
 
-      <CommandNotification preMessage="Press '" postMessage="' to fire your primary weapon." command="fire 0">
+      <CommandNotification preMessage="Move '" postMessage="' to look left." command="scale 1 rotateYaw">
         <events>
             <trigger>
-                <DistanceTrigger name=trigger position="0,0,-100" distance=10 target="Pawn">
-                    <attached>
-                        <Billboard position="0,0,0" colour="1.0,1.0,0" material="Examples/Flare" />
-                    </attached>
-                </DistanceTrigger>
+                <DistanceTrigger name=trigger position="0,0,-100" distance=10 target="Pawn" />
             </trigger>
         </events>
     </CommandNotification>
+    <Billboard position="0,0,-100" colour="1.0,1.0,0" material="Examples/Flare" />
 
     <SimpleNotification message="Awesome!!!">
         <events>
             <trigger>
-                <DistanceTrigger name=trigger position="0,0,100" distance=10 target="Pawn">
-                    <attached>
-                        <Billboard position="0,0,0" colour="1.0,0,1.0" material="Examples/Flare" />
-                    </attached>
-                </DistanceTrigger>
+                <DistanceTrigger name=trigger position="0,0,100" distance=10 target="Pawn" />
             </trigger>
         </events>
     </SimpleNotification>
+    <Billboard position="0,0,100" colour="1.0,0,1.0" material="Examples/Flare" />
   
-<Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
-  <attached>
-    <Model scale="1" mesh="drone.mesh"/>
-  </attached>
-  <collisionShapes>
-    <BoxCollisionShape position="0,0,0"      halfExtents="10, 10, 10" />
-  </collisionShapes>
-</Drone>
 
-    <Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
-      <attached>
-        <Model scale="1" mesh="rocket.mesh"/>
-      </attached>
-      <collisionShapes>
-        <BoxCollisionShape position="0,0,0"      halfExtents="10, 10, 10" />
-      </collisionShapes>
-    </Drone>
 
     <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
 
-    <Model mesh="hs-w01.mesh" scale=10 position="0,0,-100" />
-    <Model mesh="hs-w01s.mesh" scale=10 position="0,0,-100" />
 
     <?lua
       for i = 1, 10, 1 do
@@ -80,58 +47,6 @@
       <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
     <?lua end ?>
 
-    <GlobalShader compositor="Bloom" visible=false>
-      <events>
-        <visibility>
-          <DistanceTrigger position="0,0,0" distance=30 target="Spectator" switch=true />
-        </visibility>
-      </events>
-    </GlobalShader>
-    <Model position="0,0,0" scale=8 mesh="ast1.mesh" />
-    <StaticEntity position="0,0,0" collisionType=static>
-      <collisionShapes>
-        <SphereCollisionShape radius="20" />
-      </collisionShapes>
-    </StaticEntity>
 
-<!--
-    <?lua
-      for i = 1, 70, 1 do
-    ?>
-      <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 1000 + 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
-        <attached>
-          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
-        </attached>
-      </MovableEntity>
-      <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * -1000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
-        <attached>
-          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
-        </attached>
-      </MovableEntity>
-
-      <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * 1000 + 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
-        <attached>
-          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
-        </attached>
-      </MovableEntity>
-      <MovableEntity position="<?lua print(math.random() * 6000 - 3000)?>, <?lua print(math.random() * -1000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
-        <attached>
-          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
-        </attached>
-      </MovableEntity>
-
-      <MovableEntity position="<?lua print(math.random() * 1000 + 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
-        <attached>
-          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
-        </attached>
-      </MovableEntity>
-      <MovableEntity position="<?lua print(math.random() * -1000 - 3000)?>, <?lua print(math.random() * 6000 - 3000) ?>, <?lua print(math.random() * 6000 - 3000) ?>" rotationaxis="<?lua print(math.random()) ?>, <?lua print(math.random()) ?>, <?lua print(math.random()) ?>" rotationrate="<?lua print(math.random() * 30 + 5) ?>">
-        <attached>
-          <Model scale="<?lua print(math.random() * 30 + 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" shadow=false />
-        </attached>
-      </MovableEntity>
-    <?lua end ?>
--->
-
   </Scene>
 </Level>

Modified: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/libraries/core/GUIManager.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -98,7 +98,7 @@
 
     GUIManager* GUIManager::singletonPtr_s = 0;
 
-    SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, true);
+    SetConsoleCommand("showGUI", &GUIManager::showGUI).defaultValue(1, false).defaultValue(2, false);
     SetConsoleCommand("hideGUI", &GUIManager::hideGUI);
 
     /**
@@ -236,21 +236,23 @@
         The name of the GUI
     @param bHidePrevious
         If true all displayed GUIs on the stack, that are below this GUI are hidden.
+    @param bNoInput
+        If true the GUI is transparent to input.
 
         The function executes the Lua function with the same name in case the GUIManager is ready.
     */
-    /*static*/ void GUIManager::showGUI(const std::string& name, bool bHidePrevious)
+    /*static*/ void GUIManager::showGUI(const std::string& name, bool bHidePrevious, bool bNoInput)
     {
-        GUIManager::getInstance().executeCode("showMenuSheet(\"" + name + "\", " + multi_cast<std::string>(bHidePrevious) + ")");
+        GUIManager::getInstance().executeCode("showMenuSheet(\"" + name + "\", " + multi_cast<std::string>(bHidePrevious) + ", " + multi_cast<std::string>(bNoInput) + ")");
     }
 
     /**
     @brief
         Hack-ish. Needed for GUIOverlay.
     */
-    void GUIManager::showGUIExtra(const std::string& name, const std::string& ptr, bool bHidePrevious)
+    void GUIManager::showGUIExtra(const std::string& name, const std::string& ptr, bool bHidePrevious, bool bNoInput)
     {
-        this->executeCode("showMenuSheet(\"" + name + "\", " + multi_cast<std::string>(bHidePrevious) + ", " + ptr + ")");
+        this->executeCode("showMenuSheet(\"" + name + "\", " + multi_cast<std::string>(bHidePrevious) + ", " + multi_cast<std::string>(bNoInput) + ", " + ptr + ")");
     }
 
     /**

Modified: code/trunk/src/libraries/core/GUIManager.h
===================================================================
--- code/trunk/src/libraries/core/GUIManager.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/libraries/core/GUIManager.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -79,8 +79,8 @@
         void preUpdate(const Clock& time);
 
         void loadGUI(const std::string& name);
-        static void showGUI(const std::string& name, bool bHidePrevious = false);
-        void showGUIExtra(const std::string& name, const std::string& ptr, bool bHidePrevious = false);
+        static void showGUI(const std::string& name, bool bHidePrevious = false, bool bNoInput = false);
+        void showGUIExtra(const std::string& name, const std::string& ptr, bool bHidePrevious = false, bool bNoInput = false);
         static void hideGUI(const std::string& name);
         void keyESC();
         void setBackgroundImage(const std::string& imageSet, const std::string imageName); // tolua_export

Modified: code/trunk/src/modules/notifications/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/notifications/CMakeLists.txt	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/CMakeLists.txt	2010-09-11 08:20:44 UTC (rev 7403)
@@ -2,7 +2,6 @@
   Notification.cc
   NotificationDispatcher.cc
   NotificationManager.cc
-  NotificationOverlay.cc
   NotificationQueue.cc
 )
 
@@ -12,10 +11,11 @@
   MODULE
   FIND_HEADER_FILES
   TOLUA_FILES
+    NotificationManager.h
+    NotificationQueue.h
   PCH_FILE
     NotificationsPrecompiledHeaders.h
   LINK_LIBRARIES
     orxonox
-    overlays
   SOURCE_FILES ${NOTIFICATIONS_SRC_FILES}
 )

Modified: code/trunk/src/modules/notifications/Notification.cc
===================================================================
--- code/trunk/src/modules/notifications/Notification.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/Notification.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -34,6 +34,7 @@
 #include "Notification.h"
 
 #include "core/CoreIncludes.h"
+#include "network/NetworkFunction.h"
 #include "NotificationManager.h"
 
 namespace orxonox
@@ -41,29 +42,35 @@
 
     CreateUnloadableFactory(Notification);
 
+    registerMemberNetworkFunction(Notification, sendHelper);
+
     /**
     @brief
         Default constructor. Initializes the object.
+    @param creator
+        The object that created this Notification 
     */
-    Notification::Notification(BaseObject* creator) : BaseObject(creator)
+    Notification::Notification(BaseObject* creator) : BaseObject(creator), Synchronisable(creator)
     {
         RegisterObject(Notification);
         this->initialize();
+        this->registerVariables();
     }
 
     /**
     @brief
         Constructor. Creates a Notification with the input message.
     @param creator
-        The object that created this Notification
+        The creator.
     @param message
         The message of the Notification.
     */
-    Notification::Notification(BaseObject* creator, const std::string & message) : BaseObject(creator)
+    Notification::Notification(BaseObject* creator, const std::string & message) : BaseObject(creator), Synchronisable(creator)
     {
         RegisterObject(Notification);
         this->initialize();
         this->message_ = message;
+        this->registerVariables();
     }
 
     /**
@@ -86,15 +93,11 @@
         this->sent_ = false;
     }
 
-    /**
-    @brief
-        Sends the Notification to the Notificationmanager, with sender NetificationManager::NONE.
-    @return
-        Returns true if successful.
-    */
-    bool Notification::send(void)
+    void Notification::registerVariables(void)
     {
-        return this->send(NotificationManager::NONE);
+        registerVariable(this->message_);
+        registerVariable(this->sender_);
+        registerVariable(this->sent_);
     }
 
     /**
@@ -105,11 +108,26 @@
     @return
         Returns true if successful.
     */
-    bool Notification::send(const std::string & sender)
+    bool Notification::send(unsigned int clientId, const std::string & sender = NotificationManager::NONE)
     {
+
+        if(GameMode::isStandalone())
+        {
+            this->sendHelper(sender);
+        }
+        else
+        {
+            callMemberNetworkFunction(Notification, sendHelper, this->getObjectID(), clientId, sender);
+        }
+
+        return true;
+    }
+
+    bool Notification::sendHelper(const std::string& sender)
+    {
         if(this->isSent()) //TODO: Needed?
             return false;
-        
+
         this->sender_ = sender;
         bool successful = NotificationManager::getInstance().registerNotification(this);
         if(!successful)

Modified: code/trunk/src/modules/notifications/Notification.h
===================================================================
--- code/trunk/src/modules/notifications/Notification.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/Notification.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -38,6 +38,7 @@
 
 #include <string>
 #include "core/BaseObject.h"
+#include "network/synchronisable/Synchronisable.h"
 
 namespace orxonox
 {
@@ -48,15 +49,15 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _NotificationsExport Notification : public BaseObject
+    class _NotificationsExport Notification : public BaseObject, public Synchronisable
     {
         public:
             Notification(BaseObject* creator);
             Notification(BaseObject* creator, const std::string & message);
             virtual ~Notification();
 
-            bool send(void); //!< Sends the Notification to the Notificationmanager, with sender NotificationManager::NONE;
-            bool send(const std::string & sender); //!< Sends the Notification to the Notificationmanager.
+            bool send(unsigned int clientId, const std::string & sender); //!< Sends the Notification to the Notificationmanager.
+            bool sendHelper(const std::string& sender);
 
             /**
             @brief Checks whether the Notification was sent.
@@ -82,6 +83,7 @@
             bool sent_; //!< Whether Notification has been sent, if so it cannot be changed.
 
             void initialize(void);
+            void registerVariables(void);
 
     };
 

Modified: code/trunk/src/modules/notifications/NotificationDispatcher.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationDispatcher.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/NotificationDispatcher.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -38,6 +38,9 @@
 #include "core/EventIncludes.h"
 #include "Notification.h"
 #include "NotificationManager.h"
+#include "interfaces/PlayerTrigger.h"
+#include "infos/PlayerInfo.h"
+#include "worldentities/pawns/Pawn.h"
 
 namespace orxonox
 {
@@ -85,13 +88,15 @@
     /**
     @brief
         Dispatches a Notification with a message supplied by the createNotificationMessage() method, which can be overloaded.
+    @param clientId
+        The id of the client the notification should be dispatched to.
     */
-    void NotificationDispatcher::dispatch(void)
+    void NotificationDispatcher::dispatch(unsigned int clientId)
     {
         const std::string message = this->createNotificationMessage();
         Notification* notification = new Notification(this, message);
 
-        notification->send(this->getSender());
+        notification->send(clientId, this->getSender());
     }
 
     /**
@@ -102,15 +107,44 @@
     @return
         Returns true if the NotificationDispatcher was successfully triggered.
     */
-    bool NotificationDispatcher::trigger(bool triggered)
+    bool NotificationDispatcher::trigger(bool triggered, BaseObject* trigger)
     {
         if(!triggered || !this->isActive()) // If the NotificationDispatcher is inactive it cannot be executed.
             return false;
 
         COUT(4) << "NotificationDispatcher (&" << this << ") triggered." << std::endl;
 
-        this->dispatch();
+        PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
+        Pawn* pawn = NULL;
 
+        // If the trigger is a PlayerTrigger.
+        if(pTrigger != NULL)
+        {
+            if(!pTrigger->isForPlayer())  //!< The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
+                return false;
+            else
+                pawn = pTrigger->getTriggeringPlayer();
+        }
+        else
+            return false;
+
+        if(pawn == NULL)
+        {
+            COUT(4) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
+            return false;
+        }
+
+        //! Extract the PlayerInfo from the Pawn.
+        PlayerInfo* player = pawn->getPlayer();
+
+        if(player == NULL)
+        {
+            COUT(3) << "The PlayerInfo* is NULL." << std::endl;
+            return false;
+        }
+
+        this->dispatch(player->getClientID());
+
         return true;
     }
 

Modified: code/trunk/src/modules/notifications/NotificationDispatcher.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationDispatcher.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/NotificationDispatcher.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -64,8 +64,8 @@
             const std::string& getSender(void)
                 { return this->sender_; }
 
-            void dispatch(void); //!< Dispatches a specific Notification.
-            bool trigger(bool triggered); //!< Is called when the NotificationDispatcher is triggered.
+            void dispatch(unsigned int clientId); //!< Dispatches a specific Notification.
+            bool trigger(bool triggered, BaseObject* trigger); //!< Is called when the NotificationDispatcher is triggered.
 
         protected:
             std::string sender_; //!< The name of the sender of the Notification dispatched by this NotificationDispatcher.

Modified: code/trunk/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/NotificationManager.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -27,27 +27,38 @@
  */
 
 /**
-    @file
+    @file NotificationManager.cc
     @brief Implementation of the NotificationManager class.
 */
 
 #include "NotificationManager.h"
 
-#include <set>
+#include "core/command/ConsoleCommand.h"
+#include "core/CoreIncludes.h"
+#include "core/GUIManager.h"
+#include "core/LuaState.h"
+#include "util/ScopedSingletonManager.h"
 
-#include "util/ScopedSingletonManager.h"
-#include "core/CoreIncludes.h"
-#include "Notification.h"
 #include "interfaces/NotificationListener.h"
 
+#include "Notification.h"
+#include "NotificationQueue.h"
+
+#include "ToluaBindNotifications.h"
+
 namespace orxonox
 {
 
     const std::string NotificationManager::ALL("all");
     const std::string NotificationManager::NONE("none");
 
-    ManageScopedSingleton(NotificationManager, ScopeID::Root, false);
+    // Register tolua_open function when loading the library.
+    DeclareToluaInterface(Notifications);
 
+    ManageScopedSingleton(NotificationManager, ScopeID::Graphics, false);
+
+    SetConsoleCommand("enterEditMode", &NotificationManager::enterEditMode);
+
     /**
     @brief
         Constructor. Registers the Object.
@@ -57,6 +68,10 @@
         RegisterRootObject(NotificationManager);
 
         this->highestIndex_ = 0;
+
+        ModifyConsoleCommand("enterEditMode").setObject(this);
+
+        COUT(3) << "NotificatioManager created." << std::endl;
     }
 
     /**
@@ -65,11 +80,29 @@
     */
     NotificationManager::~NotificationManager()
     {
+        ModifyConsoleCommand("enterEditMode").setObject(NULL);
 
+        COUT(3) << "NotificationManager destroyed." << std::endl;
     }
 
     /**
     @brief
+        Is called before the object is destroyed.
+    */
+    void NotificationManager::preDestroy(void)
+    {
+        // Destroys all NotificationQueues that have been registered with the NotificationManager.
+        for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); )
+        {
+            NotificationQueue* queue = (*it).second;
+            it++;
+            queue->destroy();
+        }
+        this->queues_.clear();
+    }
+
+    /**
+    @brief
         Registers a Notification within the NotificationManager and makes sure that the Notification is sent to all the NotificationListeners associated with its sender.
     @param notification
         The Notification to be registered.
@@ -78,45 +111,42 @@
     */
     bool NotificationManager::registerNotification(Notification* notification)
     {
+        assert(notification);
 
-        if(notification == NULL) //!< A NULL-Notification cannot be registered.
-            return false;
-
         std::time_t time = std::time(0); //TODO: Doesn't this expire? //!< Get current time.
 
-        this->allNotificationsList_.insert(std::pair<std::time_t,Notification*>(time,notification));
+        // Add the Notification to the list that holds all Notifications.
+        this->allNotificationsList_.insert(std::pair<std::time_t, Notification*>(time, notification));
 
-        if(notification->getSender() == NONE) //!< If the sender has no specific name, then the Notification is only added to the list of all Notifications.
+        if(notification->getSender() == NotificationManager::NONE) // If the sender has no specific name, then the Notification is only added to the list of all Notifications.
             return true;
 
         bool all = false;
-        if(notification->getSender() == ALL) //!< If all are the sender, then the Notifications is added to every NotificationListener.
+        if(notification->getSender() == NotificationManager::ALL) // If all are the sender, then the Notifications is added to every NotificationListener.
             all = true;
 
-        //!< Insert the notification in all listeners that have its sender as target.
-        for(std::map<NotificationListener*,int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) //!< Iterate through all listeners.
+        // Insert the Notification in all NotificationListeners that have its sender as target.
+        for(std::map<NotificationListener*, unsigned int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) // Iterate through all NotificationListeners.
         {
-            std::set<std::string> set = it->first->getTargetsSet();
-            if(all || set.find(notification->getSender()) != set.end() || set.find(ALL) != set.end()) //TODO: Make sure this works.
+            std::set<std::string, NotificationListenerStringCompare> set = it->first->getTargetsSet();
+            bool bAll = set.find(NotificationManager::ALL) != set.end();
+            // If either the Notification has as sender 'all', the NotificationListener displays all Notifications or the NotificationListener has the sender of the Notification as target.
+            if(all || bAll || set.find(notification->getSender()) != set.end())
             {
-                this->notificationLists_[it->second]->insert(std::pair<std::time_t,Notification*>(time,notification)); //!< Insert the Notification in the Notifications list of the current NotificationListener.
-                it->first->update(notification, time); //!< Update the listener.
-                std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(notification);
-                if(counterIt == this->listenerCounter_.end())
-                    this->listenerCounter_[notification] = 1;
-                else
-                    this->listenerCounter_[notification] = counterIt->second + 1;
+                if(!bAll)
+                    this->notificationLists_[it->second]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationListener.
+                it->first->update(notification, time); // Update the NotificationListener.
             }
         }
 
-        COUT(4) << "Notification registered with the NotificationManager." << std::endl;
+        COUT(4) << "Notification (&" << notification << ") registered with the NotificationManager." << std::endl;
 
         return true;
     }
 
     /**
     @brief
-        Unregisters a Notification within the NotificationManager.
+        Unregisters a Notification within the NotificationManager for a given NotificationListener.
     @param notification
         A pointer to the Notification to be unregistered.
     @param listener
@@ -127,28 +157,19 @@
         assert(notification);
         assert(listener);
 
-        // If the Notification was removed from the list of Notifications of the input NotificationListener, the counter for the Notification of the number of NotificationListeners it is present in is decremented.
-        if(this->removeNotification(notification, *(this->notificationLists_.find(this->listenerList_.find(listener)->second)->second)))
-            this->listenerCounter_[notification] = this->listenerCounter_[notification] - 1;
+        // Remove the Notification from the list of Notifications of the input NotificationListener.
+        this->removeNotification(notification, *(this->notificationLists_.find(this->listenerList_.find(listener)->second)->second));
 
-        // If the Notification is no longer present in any of the NotificationListeners it can be removed from the map of all Notifications and be destroyed.
-        if(this->listenerCounter_[notification] == (unsigned int) 0)
-        {
-            this->removeNotification(notification, this->allNotificationsList_);
-            this->listenerCounter_.erase(notification);
-            notification->destroy();
-        }
-
-        COUT(4) << "Notification unregistered with the NotificationManager." << std::endl;
+        COUT(4) << "Notification (&" << notification << ") unregistered with the NotificationManager from listener (&" << listener << ")" << std::endl;
     }
 
     /**
     @brief
-        Helper method that removes an input notification form an input map.
+        Helper method that removes an input Notification form an input map.
     @param notification
-        A pointer to the notification to be removed.
+        A pointer to the Notification to be removed.
     @param map
-        The map the notification should be removed from.
+        The map the Notification should be removed from.
     @return
         Returns true if successful.
     */
@@ -173,43 +194,43 @@
     @param listener
         The NotificationListener to be registered.
     @return
-        Returns true if successful.
+        Returns true if successful.  Fales if the NotificationListener is already registered.
     */
     bool NotificationManager::registerListener(NotificationListener* listener)
     {
+        assert(listener);
+
+        // If the NotificationListener is already registered.
+        if(this->listenerList_.find(listener) != this->listenerList_.end())
+            return false;
+
         this->highestIndex_ += 1;
-        int index = this->highestIndex_;
+        unsigned int index = this->highestIndex_; // An identifier that identifies each registered NotificationListener uniquely.
 
-        this->listenerList_[listener] = index; //!< Add the NotificationListener to the list of listeners.
+        this->listenerList_[listener] = index; // Add the NotificationListener to the list of NotificationListeners.
 
-        std::set<std::string> set = listener->getTargetsSet(); //TODO: Does this work?
+        std::set<std::string, NotificationListenerStringCompare> set = listener->getTargetsSet();
 
-        //! If all senders are the target of the listener, then the list of notification for that specific listener is te same as the list of all Notifications.
-        if(set.find(ALL) != set.end())
+        // If all senders are the target of the NotificationListener, then the list of Notifications for that specific NotificationListener is the same as the list of all Notifications.
+        bool bAll = set.find(NotificationManager::ALL) != set.end();
+        std::multimap<std::time_t, Notification*>* map;
+        if(bAll)
+            this->notificationLists_[index] = &this->allNotificationsList_;
+        // Else a new list (resp. multimap) is created and added to the list of Notification lists for NotificationListeners.
+        else
         {
-            this->notificationLists_[index] = &this->allNotificationsList_;
-            COUT(4) << "NotificationListener registered with the NotificationManager." << std::endl;
-            return true;
+            this->notificationLists_[index] = new std::multimap<std::time_t, Notification*>;
+            map = this->notificationLists_[index];
         }
 
-        this->notificationLists_[index] = new std::multimap<std::time_t,Notification*>;
-        std::multimap<std::time_t,Notification*> map = *this->notificationLists_[index];
-
-        //! Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationListener.
-        for(std::multimap<std::time_t,Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)
+        // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationListener.
+        for(std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)
         {
-            if(set.find(it->second->getSender()) != set.end()) //!< Checks whether the overlay has the sender of the current notification as target.
-            {
-                map.insert(std::pair<std::time_t, Notification*>(it->first, it->second));
-                std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(it->second);
-                if(counterIt == this->listenerCounter_.end())
-                    this->listenerCounter_[it->second] = 1;
-                else
-                    this->listenerCounter_[it->second] = counterIt->second + 1;
-            }
+            if(!bAll && set.find(it->second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.
+                map->insert(std::pair<std::time_t, Notification*>(it->first, it->second));
         }
 
-        listener->update(); //!< Update the listener.
+        listener->update(); // Update the listener.
 
         COUT(4) << "NotificationListener registered with the NotificationManager." << std::endl;
 
@@ -218,40 +239,45 @@
 
     /**
     @brief
-        Unregisters a NotificationListener withing the NotificationManager.
+        Unregisters a NotificationListener within the NotificationManager.
+    @param listener
+        The NotificationListener to be unregistered.
     */
     void NotificationManager::unregisterListener(NotificationListener* listener)
     {
         assert(listener);
 
-        int identifier = this->listenerList_.find(listener)->second;
+        //TODO: Make unsigned int.
+        unsigned int identifier = this->listenerList_.find(listener)->second;
         std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second;
 
-        // Make sure all Notifications are removed.
+        // If the map is not the map of all Notifications, make sure all Notifications are unregistered.
         std::multimap<std::time_t, Notification*>::iterator it = map->begin();
-        while(it != map->end())
+        if(map != &this->allNotificationsList_)
         {
-            this->unregisterNotification(it->second, listener);
-            it = map->begin();
+            while(it != map->end())
+            {
+                this->unregisterNotification(it->second, listener);
+                it = map->begin();
+            }
+            delete map;
         }
 
+        // Remove the NotificationListener from the list of NotificationListeners.
         this->listenerList_.erase(listener);
+        // Remove the Notifications list that was associated with the input NotificationListener.
         this->notificationLists_.erase(identifier);
 
-        // If the map is not the map of all notifications, delete it.
-        if(map != &this->allNotificationsList_)
-            delete map;
-
         COUT(4) << "NotificationListener unregistered with the NotificationManager." << std::endl;
     }
 
     /**
     @brief
-        Fetches the Notifications for a specific NotificationListener in a specified timeframe.
+        Fetches the Notifications for a specific NotificationListener in a specified timeframe and stores them in the input map.
     @param listener
         The NotificationListener the Notifications are fetched for.
     @param map
-        A multimap, in which the notifications are stored.
+        A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
     @param timeFrameStart
         The start time of the timeframe.
     @param timeFrameEnd
@@ -259,26 +285,95 @@
     @return
         Returns true if successful.
     */
-    bool NotificationManager::getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd)
+    void NotificationManager::getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd)
     {
-        if(listener == NULL || map == NULL)
-            return false;
+        assert(listener);
+        assert(map);
 
-        std::multimap<std::time_t,Notification*>* notifications = this->notificationLists_[this->listenerList_[listener]]; //!< The Notifications for the input NotificationListener.
+        std::multimap<std::time_t, Notification*>* notifications = this->notificationLists_[this->listenerList_[listener]]; // All the Notifications for the input NotificationListener.
 
-        if(notifications == NULL) //!< Returns NULL, if there are no Notifications.
-            return true;
-
         std::multimap<std::time_t,Notification*>::iterator it, itLowest, itHighest;
+        // Iterators pointing to the bounds specified by the specified start and end times of the time frame.
         itLowest = notifications->lower_bound(timeFrameStart);
-        itHighest = notifications->upper_bound(timeFrameStart);
+        itHighest = notifications->upper_bound(timeFrameEnd);
 
-        for(it = itLowest; it != itHighest; it++) //!< Iterate through the Notifications from the start of the time Frame to the end of it.
-        {
-            map->insert(std::pair<std::time_t,Notification*>(it->first,it->second)); //!< Add the found Notifications to the map.
-        }
+        for(it = itLowest; it != itHighest; it++) // Iterate through the Notifications from the start of the time frame to the end of it.
+            map->insert(std::pair<std::time_t, Notification*>(it->first, it->second)); // Add the found Notifications to the map.
+    }
 
-        return true;
+    /**
+    @brief
+        Enters the edit mode of the NotificationLayer.
+    */
+    void NotificationManager::enterEditMode(void)
+    {
+        GUIManager::getInstance().hideGUI("NotificationLayer");
+        GUIManager::getInstance().showGUI("NotificationLayer", false, false);
+        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.enterEditMode()");
     }
 
+    /**
+    @brief
+        Registers a NotificationQueue.
+        This makes sure that the NotificationQueue can be attained through lua by name. It also makes sure that the NotificationQueue is destroyed upon destruction of the NotificationManager.
+    @param queue
+        A pointer to the NotificationQueue to be registered.
+    @return
+        Returns true if successful. If e.g. the a NotificationQueue with that name already exists this returns false.
+    */
+    bool NotificationManager::registerQueue(NotificationQueue* queue)
+    {
+        return this->queues_.insert(std::pair<const std::string, NotificationQueue*>(queue->getName(), queue)).second;
+    }
+
+    /**
+    @brief
+        Unregisters a NotificationQueue.
+    @param queue
+        A pointer to the NotificationQueue to be unregistered.
+    */
+    void NotificationManager::unregisterQueue(NotificationQueue* queue)
+    {
+        this->queues_.erase(queue->getName());
+    }
+
+    /**
+    @brief
+        Loads all the NotificationQueues that should exist.
+    */
+    void NotificationManager::loadQueues(void)
+    {
+        new NotificationQueue("all");
+    }
+
+    /**
+    @brief
+        Creates a new NotificationQueue.
+        This is used in lua.
+    @param name
+        The name of the new NotificationQueue.
+    */
+    void NotificationManager::createQueue(const std::string& name)
+    {
+        new NotificationQueue(name);
+    }
+
+    /**
+    @brief
+        Get the NotificationQueue with the input name.
+    @param name
+        The name of the NotificationQueue.
+    @return
+        Returns a pointer to the NotificationQueue with the input name. Returns NULL if no NotificationQueue with such a name exists.
+    */
+    NotificationQueue* NotificationManager::getQueue(const std::string & name)
+    {
+        std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.find(name);
+        // Returns NULL if no such NotificationQueue exists.
+        if(it == this->queues_.end())
+            return NULL;
+
+        return (*it).second;
+    }
+
 }

Modified: code/trunk/src/modules/notifications/NotificationManager.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/NotificationManager.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -27,7 +27,7 @@
  */
 
 /**
-    @file
+    @file NotificationManager.h
     @brief Definition of the NotificationManager class.
 */
 
@@ -43,8 +43,9 @@
 #include "util/Singleton.h"
 #include "core/OrxonoxClass.h"
 
-namespace orxonox
-{
+namespace orxonox // tolua_export
+{ // tolua_export
+
     /**
     @brief
         The Singleton NotificationManager functions as a gateway between Notifications and NotificationListeners.
@@ -52,56 +53,64 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _NotificationsExport NotificationManager : public Singleton<NotificationManager>, public OrxonoxClass
-    {
+    class _NotificationsExport NotificationManager // tolua_export
+        : public Singleton<NotificationManager>, public OrxonoxClass
+    { // tolua_export
             friend class Singleton<NotificationManager>;
         public:
             NotificationManager();
             virtual ~NotificationManager();
 
+            virtual void preDestroy(void); //!< Is called before the object is destroyed.
+
+            static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export
+
             static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners.
             static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener.
 
             bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
-            void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager.
+            void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager for a given NotificationListener.
             bool registerListener(NotificationListener* listener); //!< Registers a NotificationListener within the NotificationManager.
             void unregisterListener(NotificationListener* listener); //!< Unregisters a NotificationListener withing the NotificationManager.
 
-            bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Returns the Notifications for a specific NotificationListener in a specified timeframe.
+            void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Fetches the Notifications for a specific NotificationListener in a specified timeframe and stores them in the input map.
 
             /**
-            @brief Fetches the Notifications for a specific NotificationListener starting at a specified time.
+            @brief Fetches the Notifications for a specific NotificationListener in a timeframe from now-timeDelay to now and stores them in the input map.
             @param listener The NotificationListener the Notifications are fetched for.
-            @param map A multimap, in which the notifications are stored.
-            @param timeFrameStart The start time the Notifications are fetched from.
-            @return Returns true if successful.
-            */
-            bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart)
-                { return this->getNotifications(listener, map, timeFrameStart, std::time(0)); }
-            /**
-            @brief Fetches the Notifications for a specific NotificationListener starting at a specified timespan before now.
-            @param listener The NotificationListener the Notifications are fetched for.
-            @param map A multimap, in which the notifications are stored.
+            @param map A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
             @param timeDelay The timespan.
             @return Returns true if successful.
             */
-            bool getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, int timeDelay)
-                { return this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); }
+            void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int timeDelay)
+                { this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); }
 
+            void enterEditMode(void); //!< Enters the edit mode of the NotificationLayer.
+
+            bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue.
+            void unregisterQueue(NotificationQueue* queue); //!< Unregisters a NotificationQueue.
+
+            // tolua_begin
+            void loadQueues(void); //!< Loads all the NotificationQueues that should exist.
+            void createQueue(const std::string& name); //!< Creates a new NotificationQueue.
+            orxonox::NotificationQueue* getQueue(const std::string & name); //!< Get the NotificationQueue with the input name.
+            // tolua_end
+
         private:
             static NotificationManager* singletonPtr_s;
 
-            int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
+            unsigned int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
 
-            std::multimap<std::time_t,Notification*> allNotificationsList_; //!< Container where all notifications are stored.
-            std::map<NotificationListener*,int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier.
-            std::map<int,std::multimap<std::time_t,Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored.
-            std::map<Notification*, unsigned int> listenerCounter_; //!< A container to store the number of NotificationListeners a Notification is registered with.
+            std::multimap<std::time_t, Notification*> allNotificationsList_; //!< Container where all Notifications are stored.
+            std::map<NotificationListener*, unsigned int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier.
+            std::map<int,std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored.
 
-            bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input notification form an input map.
+            std::map<const std::string, NotificationQueue*> queues_; //!< The list of NotificationQueues created by the NotificationManager.
 
-    };
+            bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input Notification form an input map.
 
-}
+    }; // tolua_export
 
+} // tolua_export
+
 #endif /* _NotificationManager_H__ */

Deleted: code/trunk/src/modules/notifications/NotificationOverlay.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationOverlay.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/NotificationOverlay.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -1,136 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Damian 'Mozork' Frick
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @brief Implementation of the NotificationOverlay class.
-*/
-
-#include "NotificationOverlay.h"
-
-#include "util/Exception.h"
-#include "core/CoreIncludes.h"
-#include "Notification.h"
-#include "NotificationQueue.h"
-
-namespace orxonox
-{
-
-    /**
-    @brief
-        Constructor. Intializes the class.
-    */
-    NotificationOverlay::NotificationOverlay(BaseObject* creator) : OverlayText(creator)
-    {
-        RegisterObject(NotificationOverlay);
-        this->initialize();
-    }
-
-    /**
-    @brief
-        Constructor. Initializes the class creates a graphical representation of the input Notification for the input Queue.
-    @param queue
-        A pointer to the queue the NotificatonOverlay belongs to.
-    @param notification
-        A pointer to the Notification represented by this overlay.
-    @throws Argument
-        Throws an Argument-Exception if either no Notification or no NotificationQueue were input.
-    */
-    NotificationOverlay::NotificationOverlay(NotificationQueue* queue, Notification* notification) : OverlayText(NULL)
-    {
-        this->initialize();
-
-        if(notification == NULL || queue == NULL) //!> If either notification or queue are not given an Exception is thrown.
-        {
-            ThrowException(Argument, "There were NULL-Pointer arguments in NotificationOverlay creation.");
-        }
-
-        this->queue_ = queue;
-        this->defineOverlay();
-
-        this->processNotification(notification);
-    }
-
-    /**
-    @brief
-        Initializes and Registers the object.
-    */
-    void NotificationOverlay::initialize(void)
-    {
-        this->queue_ = NULL;
-    }
-
-    /**
-    @brief
-        Set some Overlay-specific values.
-    */
-    void NotificationOverlay::defineOverlay(void)
-    {
-        this->setFont(this->queue_->getFont());
-        this->setTextSize(this->queue_->getFontSize());
-
-        this->setPosition(this->queue_->getPosition());
-    }
-
-    /**
-    @brief
-        Destructor.
-    */
-    NotificationOverlay::~NotificationOverlay()
-    {
-    }
-
-    /**
-    @brief
-        Processes the input notification, resp. sees to it. that the NotificationOverlay displays the Notification message.
-    @param notification
-        A pointer to the notification that should be processed.
-    @return
-        Returns true if successful.
-    */
-    bool NotificationOverlay::processNotification(Notification* notification)
-    {
-        if(notification == NULL)
-            return false;
-        this->setCaption(clipMessage(notification->getMessage()));
-        this->notification_ = notification;
-        return true;
-    }
-
-    /**
-    @brief
-        Clips the input message so that it meets the requirements for the maximal length of Notifications given by the NotificationQueue.
-    */
-    std::string NotificationOverlay::clipMessage(const std::string & message)
-    {
-        if(message.length() <= static_cast<unsigned int>(this->queue_->getNotificationLength())) //!< If the message is not too long.
-            return message;
-        return message.substr(0, this->queue_->getNotificationLength());
-    }
-
-}

Deleted: code/trunk/src/modules/notifications/NotificationOverlay.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationOverlay.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/NotificationOverlay.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -1,83 +0,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Damian 'Mozork' Frick
- *   Co-authors:
- *      ...
- *
- */
-
-/**
-    @file
-    @brief Definition of the NotificationOverlay class.
-*/
-
-
-#ifndef _NotificationOverlay_H__
-#define _NotificationOverlay_H__
-
-#include "notifications/NotificationsPrereqs.h"
-
-#include <string>
-#include "overlays/OverlayText.h"
-
-namespace orxonox
-{
-
-    /**
-    @brief
-        The NotificationOverlay is used to display single Notifications, then bundled in a NotificationQueue.
-    @author
-        Damian 'Mozork' Frick
-    */
-    class _NotificationsExport NotificationOverlay : public OverlayText
-    {
-
-        public:
-            NotificationOverlay(BaseObject* creator);
-            NotificationOverlay(NotificationQueue* queue, Notification* notification);
-            virtual ~NotificationOverlay();
-
-            bool processNotification(Notification* notification); //!< Processes the input Notification.
-
-            /**
-            @brief Sets the font size of this overlay's text.
-            @param size The font size.
-            */
-            inline void setFontSize(float size)
-                { this->setTextSize(size); }
-
-        protected:
-            std::string clipMessage(const std::string & message); //!< Clips the input message if too long.
-
-        private:
-            NotificationQueue* queue_; //!< The NotificationQeue this overlay belongs to.
-            Notification* notification_; //!< The Notification this overlay displays.
-
-            void initialize(void); //!< Initializes the object.
-            void defineOverlay(void); //!< Sets some overlay-specific values.
-
-    };
-
-}
-
-#endif /* _NotificationOverlay_H__ */

Modified: code/trunk/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueue.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/NotificationQueue.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -27,102 +27,112 @@
  */
 
 /**
-    @file
+    @file NotificationQueue.cc
     @brief Implementation of the NotificationQueue class.
 */
 
 #include "NotificationQueue.h"
 
-#include "util/Convert.h"
+#include <map>
+#include <sstream>
+
 #include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "NotificationOverlay.h"
-#include "NotificationManager.h"
+#include "core/GUIManager.h"
+#include "core/LuaState.h"
+#include "util/Convert.h"
+#include "util/SubString.h"
 
+#include "Notification.h"
+
 namespace orxonox
 {
 
-    CreateFactory(NotificationQueue);
-
-    const std::string NotificationQueue::DEFAULT_FONT("VeraMono");
-    const Vector2 NotificationQueue::DEFAULT_POSITION(0.0,0.0);
-    const float NotificationQueue::DEFAULT_FONT_SIZE = 0.025f;
-
     /**
     @brief
         Constructor. Creates and initializes the object.
+    @param name
+        The name of the new NotificationQueue.
+    @param senders
+        The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays.
+        The senders need to be seperated by commas.
+    @param size
+        The size (the maximum number of displayed Notifications) of this NotificationQueue.
+    @param displayTime
+        The time during which a Notification is (at most) displayed.
     */
-    NotificationQueue::NotificationQueue(BaseObject* creator) : OverlayGroup(creator)
+    NotificationQueue::NotificationQueue(const std::string& name, const std::string& senders, unsigned int size, unsigned int displayTime)
     {
         this->registered_ = false;
 
-        RegisterObject(NotificationQueue);
-        this->initialize();
-    }
+        RegisterRootObject(NotificationQueue);
 
-    /**
-    @brief
-        Destructor.
-    */
-    NotificationQueue::~NotificationQueue()
-    {
-        this->targets_.clear();
-        this->clear();
-
-        if(this->registered_)
-            NotificationManager::getInstance().unregisterListener(this);
-    }
-
-    /**
-    @brief
-        Initializes the object.
-        Registers the object, initializes variables, sets default values and registers the queue with the NotificationManager.
-    */
-    void NotificationQueue::initialize(void)
-    {
+        // Initialize.
         this->size_ = 0;
         this->tickTime_ = 0.0;
 
-        NotificationManager::getInstance().registerListener(this);
+        // Sets the input values.
+        this->setTargets(senders);
+        this->name_ = name;
+        this->maxSize_ = size;
+        this->setDisplayTime(displayTime);
+
+        //TODO: Destroy if registration fails?
+
+        // Register the NotificationQueue with the NotificationManager.
+        bool queueRegistered = NotificationManager::getInstance().registerQueue(this);
         this->registered_ = true;
+        if(!queueRegistered) // If the registration has failed.
+        {
+            this->registered_ = false;
+            COUT(1) << "Error: Notification Queue '" << this->getName() << "' could not be registered." << std::endl;
+            return;
+        }
+
+        this->create(); // Creates the NotificationQueue in lua.
+
+        // register the NotificationQueue as NotificationListener with the NotificationManager.
+        bool listenerRegistered = NotificationManager::getInstance().registerListener(this);
+        if(!listenerRegistered) // If the registration has failed.
+        {
+            this->registered_ = false;
+            // Remove the NotificationQueue in lua.
+            GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
+            NotificationManager::getInstance().unregisterQueue(this);
+            COUT(1) << "Error: Notification Queue '" << this->getName() << "' could not be registered." << std::endl;
+            return;
+        }
+
+        COUT(3) << "NotificationQueue '" << this->getName() << "' created." << std::endl;
     }
 
     /**
     @brief
-        Sets the defaults.
+        Destructor.
     */
-    void NotificationQueue::setDefaults(void)
+    NotificationQueue::~NotificationQueue()
     {
-        this->setMaxSize(DEFAULT_SIZE);
-        this->setNotificationLength(DEFAULT_LENGTH);
-        this->setDisplayTime(DEFAULT_DISPLAY_TIME);
-        this->setPosition(DEFAULT_POSITION);
+        this->targets_.clear();
 
-        this->setTargets(NotificationManager::ALL);
+        if(this->registered_) // If the 
+        {
+            this->clear();
 
-        this->setFontSize(DEFAULT_FONT_SIZE);
-        this->setFont(DEFAULT_FONT);
+            // Unregister with the NotificationManager.
+            NotificationManager::getInstance().unregisterListener(this);
+            NotificationManager::getInstance().unregisterQueue(this);
+
+            // Remove the NotificationQueue in lua.
+            GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
+        }
     }
 
     /**
     @brief
-        Method for creating a NotificationQueue object through XML.
+        Creates the NotificationQueue in lua.
     */
-    void NotificationQueue::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    void NotificationQueue::create(void)
     {
-        SUPER(NotificationQueue, XMLPort, xmlelement, mode);
-
-        this->setDefaults();
-
-        XMLPortParam(NotificationQueue, "maxSize", setMaxSize, getMaxSize, xmlelement, mode);
-        XMLPortParam(NotificationQueue, "notificationLength", setNotificationLength, getNotificationLength, xmlelement, mode);
-        XMLPortParam(NotificationQueue, "displayTime", setDisplayTime, getDisplayTime, xmlelement, mode);
-        XMLPortParam(NotificationQueue, "targets", setTargets, getTargets, xmlelement, mode);
-        XMLPortParam(NotificationQueue, "font", setFont, getFont, xmlelement, mode);
-        XMLPortParam(NotificationQueue, "fontSize", setFontSize, getFontSize, xmlelement, mode);
-        XMLPortParam(NotificationQueue, "position", setPosition, getPosition, xmlelement, mode);
-
-        COUT(3) << "NotificationQueue '" << this->getName() << "' created." << std::endl;
+        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.createQueue(\"" + this->getName() +  "\", " + multi_cast<std::string>(this->getMaxSize()) + ")");
     }
 
     /**
@@ -133,46 +143,42 @@
     */
     void NotificationQueue::tick(float dt)
     {
-        this->tickTime_ += dt; //!< Add the time interval that has passed to the time counter.
-        if(this->tickTime_ >= 1.0) //!< If the time counter is greater than 1s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
+        this->tickTime_ += dt; // Add the time interval that has passed to the time counter.
+        if(this->tickTime_ >= 1.0) // If the time counter is greater than 1s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
         {
-            this->timeLimit_.time = std::time(0)-this->displayTime_; //!< Container containig the current time.
+            this->timeLimit_.time = std::time(0)-this->displayTime_; // Container containig the current time.
 
-            std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it;
-            it = this->containers_.begin();
-            while(it != this->containers_.upper_bound(&this->timeLimit_)) //!< Iterate through all elements whose creation time is smaller than the current time minus the display time.
+            std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator it = this->ordering_.begin();
+            // Iterate through all elements whose creation time is smaller than the current time minus the display time.
+            while(it != this->ordering_.upper_bound(&this->timeLimit_))
             {
-                this->removeContainer(*it);
-                this->scroll(Vector2(0.0f,-(1.1f*this->getFontSize())));
-                it = this->containers_.begin(); //TODO: Needed?
+                NotificationContainer* temp = *it;
+                it++;
+                this->remove(temp); // Remove the Notifications that have expired.
             }
 
-            this->tickTime_ = 0.0f; //!< Reset time counter.
+            this->tickTime_ = this->tickTime_ - (int)this->tickTime_; // Reset time counter.
         }
     }
 
     /**
     @brief
         Updates the NotificationQueue.
-        Updates by clearing the queue and requesting all relevant Notifications from the NotificationManager and inserting the in the queue.
+        Updates by clearing the queue and requesting all relevant Notifications from the NotificationManager and inserting them into the queue.
     */
     void NotificationQueue::update(void)
     {
         this->clear();
 
-        std::multimap<std::time_t,Notification*>* notifications = new std::multimap<std::time_t,Notification*>;
-        if(!NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_)) //!< Get the Notifications sent in the interval form now to minus the display time.
-        {
-            COUT(1) << "NotificationQueue update failed due to undetermined cause." << std::endl;
-            return;
-        }
+        std::multimap<std::time_t, Notification*>* notifications = new std::multimap<std::time_t, Notification*>;
+        // Get the Notifications sent in the interval from now to now minus the display time.
+        NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_);
 
-        if(notifications->empty())
-            return;
-
-        for(std::multimap<std::time_t,Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++) //!> Add all Notifications.
+        if(!notifications->empty())
         {
-            this->addNotification(it->second, it->first);
+            // Add all Notifications.
+            for(std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)
+                this->push(it->second, it->first);
         }
 
         delete notifications;
@@ -190,266 +196,190 @@
     */
     void NotificationQueue::update(Notification* notification, const std::time_t & time)
     {
-        this->addNotification(notification, time);
+        this->push(notification, time);
 
-        std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it;
-        while(this->getSize() > this->getMaxSize())
-        {
-            it = this->containers_.begin();
-            this->removeContainer(*it);
-            this->scroll(Vector2(0.0f,-(1.1f*this->getFontSize())));
-        }
-
-        COUT(4) << "NotificationQueue '" << this->getName() << "' updated. A new Notifications has been added." << std::endl;
+        COUT(4) << "NotificationQueue '" << this->getName() << "' updated. A new Notification has been added." << std::endl;
     }
 
     /**
     @brief
-        Sets the maximum number of displayed Notifications.
-    @param size
-        The size to be set.
-    @return
-        Returns true if successful.
+        Adds (pushes) a Notification to the NotificationQueue.
+        It inserts it into the storage containers, creates a corresponding container and pushes the Notification message to the GUI.
+    @param notification
+        The Notification to be pushed.
+    @param time
+        The time when the Notification has been sent.
     */
-    bool NotificationQueue::setMaxSize(int size)
+    void NotificationQueue::push(Notification* notification, const std::time_t & time)
     {
-        if(size < 0)
-            return false;
-        this->maxSize_ = size;
-        this->update();
-        return true;
-    }
+        NotificationContainer* container = new NotificationContainer;
+        container->notification = notification;
+        container->time = time;
 
-    /**
-    @brief
-        Sets the maximum number of characters a Notification message displayed by this queue is allowed to have.
-    @param length
-        The length to be set.
-    @return
-        Returns true if successful.
-    */
-    bool NotificationQueue::setNotificationLength(int length)
-    {
-        if(length < 0)
-            return false;
-        this->notificationLength_ = length;
-        this->update();
-        return true;
-    }
+        // If the maximum size of the NotificationQueue has been reached the last (least recently added) Notification is removed.
+        if(this->getSize() >= this->getMaxSize())
+            this->pop();
 
-    /**
-    @brief
-        Sets the maximum number of seconds a Notification is displayed.
-    @param time
-        The number of seconds the Notifications is displayed.
-    @return
-        Returns true if successful.
-    */
-    bool NotificationQueue::setDisplayTime(int time)
-    {
-        if(time < 0)
-            return false;
-        this->displayTime_ = time;
-        this->update();
-        return true;
-    }
+        this->size_++;
 
-    /**
-    @brief
-        Produces all targets concatinated as string, with kommas (',') as seperators.
-    @param string
-        Pointer to a string which will be used by the method to fill with the concatination of the targets.
-    @return
-        Returns true if successful.
-    */
-    bool NotificationQueue::getTargets(std::string* string) const
-    {
-        if(string == NULL)
-        {
-            COUT(4) << "Input string must have memory allocated." << std::endl;
-            return false;
-        }
-        string->clear();
-        bool first = true;
-        for(std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++) //!< Iterate through the set of targets.
-        {
-            if(!first)
-            {
-                *string += ',';
-            }
-            else
-            {
-                first = false;
-            }
-            *string += *it;
-        }
+        this->ordering_.insert(container);
+        // Insert the Notification at the begin of the list (vector, actually).
+        this->notifications_.insert(this->notifications_.begin(), container);
 
-        return true;
+        // Push the Notification to the GUI.
+        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")");
     }
 
     /**
     @brief
-        Sets the targets of the queue.
-        The targets are the senders whose Notifications are displayed in this queue.
-    @param targets
-        Accepts a string of targets, each seperated by commas (','), spaces are ignored.
-    @return
-        Returns true if successful.
+        Removes (pops) the least recently added Notification form the NotificationQueue.
     */
-    bool NotificationQueue::setTargets(const std::string & targets)
+    void NotificationQueue::pop(void)
     {
-        this->targets_.clear();
+        NotificationContainer* container = this->notifications_.back();
+        this->ordering_.erase(container);
+        this->notifications_.pop_back();
 
-        std::string* pTemp;
-        unsigned int index = 0;
-        while( index < targets.size() ) //!< Go through the string, character by character until the end is reached.
-        {
-            pTemp = new std::string();
-            while(index < targets.size() && targets[index] != ',' && targets[index] != ' ')
-            {
-                *pTemp += targets[index];
-                index++;
-            }
-            index++;
-            this->targets_.insert(*pTemp);
-        }
+        this->size_--;
 
-        return true;
+        delete container;
+
+        // Pops the Notification from the GUI.
+        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.popNotification(\"" + this->getName() + "\")");
     }
 
     /**
     @brief
-        Sets the font size.
-    @param size
-        The font size.
-    @return
-        Returns true if successful.
+        Removes the Notification that is stored in the input NotificationContainer.
+    @param container
+        The NotificationContainer with the Notification to be removed.
     */
-    bool NotificationQueue::setFontSize(float size)
+    void NotificationQueue::remove(NotificationContainer* container)
     {
-        if(size <= 0)
-            return false;
-        this->fontSize_ = size;
-        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); it++) //!< Set the font size for each overlay.
-        {
-            it->second->overlay->setFontSize(size);
-        }
-        return true;
+        std::vector<NotificationContainer*>::iterator it = std::find(this->notifications_.begin(), this->notifications_.end(), container);
+        // Get the index at which the Notification is.
+        std::vector<NotificationContainer*>::difference_type index = it - this->notifications_.begin ();
+        this->ordering_.erase(container);
+        this->notifications_.erase(it);
+
+        this->size_--;
+
+        delete container;
+
+        // Removes the Notification from the GUI.
+        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")");
     }
 
     /**
     @brief
-        Sets the font.
-    @param font
-        The font.
-    @return
-        Returns true if successful.
+        Clears the NotificationQueue by removing all NotificationContainers.
     */
-    bool NotificationQueue::setFont(const std::string & font)
+    void NotificationQueue::clear(void)
     {
-        this->font_ = font;
-        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); it++) //!< Set the font for each overlay.
-        {
-            it->second->overlay->setFont(font);
-        }
-        return true;
+        this->ordering_.clear();
+        // Delete all NotificationContainers in the list.
+        for(std::vector<NotificationContainer*>::iterator it = this->notifications_.begin(); it != this->notifications_.end(); it++)
+            delete *it;
+
+        this->notifications_.clear();
+
+        this->size_ = 0;
+
+        // Clear the NotificationQueue in the GUI.
+        GUIManager::getInstance().getLuaState()->doString("NotificationLayer.clearQueue(\"" + this->getName() + "\")");
     }
 
     /**
     @brief
-        Scrolls the NotificationQueue, meaning all NotificationOverlays are moved the input vector.
-    @param pos
-        The vector the NotificationQueue is scrolled.
+        Sets the name of the NotificationQueue.
+    @param name
+        The name to be set.
     */
-    void NotificationQueue::scroll(const Vector2 pos)
+    void NotificationQueue::setName(const std::string& name)
     {
-        for (std::map<Notification*, NotificationOverlayContainer*>::iterator it = this->overlays_.begin(); it != this->overlays_.end(); ++it) //!< Scroll each overlay.
-        {
-            it->second->overlay->scroll(pos);
-        }
+        this->name_ = name;
     }
 
     /**
     @brief
-        Aligns all the Notifications to the position of the NotificationQueue.
+        Sets the maximum number of displayed Notifications.
+    @param size
+        The size to be set.
     */
-    void NotificationQueue::positionChanged(void)
+    void NotificationQueue::setMaxSize(unsigned int size)
     {
-        int counter = 0;
-        for (std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it = this->containers_.begin(); it != this->containers_.end(); it++) //!< Set the position for each overlay.
-        {
-            (*it)->overlay->setPosition(this->getPosition());
-            (*it)->overlay->scroll(Vector2(0.0f,(1.1f*this->getFontSize())*counter));
-            counter++;
-        }
+        if(this->maxSize_ == size)
+            return;
+
+        this->maxSize_ = size;
+
+        if(this->registered_)
+            this->update();
     }
 
     /**
     @brief
-        Adds a Notification, to the queue.
-        It inserts it into the storage containers, creates an corresponding overlay and a container.
-    @param notification
-        The Notification.
+        Sets the maximum number of seconds a Notification is displayed.
     @param time
-        The time.
+        The number of seconds the Notifications is displayed.
+    @return
+        Returns true if successful.
     */
-    void NotificationQueue::addNotification(Notification* notification, const std::time_t & time)
+    void NotificationQueue::setDisplayTime(unsigned int time)
     {
-        NotificationOverlayContainer* container = new NotificationOverlayContainer;
-        container->overlay = new NotificationOverlay(this, notification);
-        container->notification = notification;
-        container->time = time;
-        std::string timeString = std::ctime(&time);
-        timeString.erase(timeString.length()-1);
-        const std::string& addressString = multi_cast<std::string>(reinterpret_cast<unsigned long>(notification));
-        container->name = "NotificationOverlay(" + timeString + ")&" + addressString;
+        if(this->displayTime_ == time)
+            return;
 
-        this->containers_.insert(container);
-        this->overlays_[notification] = container;
-        this->addElement(container->overlay);
-        this->size_= this->size_+1;
+        this->displayTime_ = time;
 
-        container->overlay->scroll(Vector2(0.0f,(1.1f*this->getFontSize())*(this->getSize()-1)));
+        if(this->registered_)
+            this->update();
     }
 
     /**
     @brief
-        Removes a container from the queue.
-    @param container
-        A pointer to the container.
+        Produces all targets of the NotificationQueue concatinated as string, with kommas (',') as seperators.
     @return
-        Returns true if successful.
+        Returns the targets as a string.
     */
-    bool NotificationQueue::removeContainer(NotificationOverlayContainer* container)
+    const std::string& NotificationQueue::getTargets(void) const
     {
-        if(this->size_ == 0) //!< You cannot remove anything if the queue is empty.
-            return false;
+        std::stringstream stream;
+        bool first = true;
+        // Iterate through the set of targets.
+        for(std::set<std::string, NotificationListenerStringCompare>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)
+        {
+            if(!first)
+                stream << ", ";
+            else
+                first = false;
+            stream << *it;
+        }
 
-        // Unregister the NotificationQueue with the NotificationManager.
-        NotificationManager::getInstance().unregisterNotification(container->notification, this);
-
-        this->removeElement(container->overlay);
-        this->containers_.erase(container);
-        this->overlays_.erase(container->notification);
-        container->overlay->destroy();
-        delete container;
-        this->size_= this->size_-1;
-
-        return true;
+        return *(new std::string(stream.str()));
     }
 
     /**
     @brief
-        Clears the queue by removing all containers.
+        Sets the targets of the NotificationQueue.
+        The targets are the senders whose Notifications are displayed in this queue.
+    @param targets
+        Accepts a string of targets, each seperated by commas (','), spaces are ignored.
     */
-    void NotificationQueue::clear(void)
+    void NotificationQueue::setTargets(const std::string & targets)
     {
-        std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare>::iterator it = this->containers_.begin();
-        while(it != this->containers_.end())
+        this->targets_.clear();
+
+        SubString string = SubString(targets, ",", " ", false);
+        for(unsigned int i = 0; i < string.size(); i++)
+            this->targets_.insert(string[i]);
+
+        if(this->registered_)
         {
-            this->removeContainer(*it);
-            it = this->containers_.begin();
+            NotificationManager::getInstance().unregisterListener(this);
+            NotificationManager::getInstance().registerListener(this);
         }
     }
 
 }
+

Modified: code/trunk/src/modules/notifications/NotificationQueue.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueue.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/NotificationQueue.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -27,7 +27,7 @@
  */
 
 /**
-    @file
+    @file NotificationQueue.h
     @brief Definition of the NotificationQueue class.
 */
 
@@ -37,180 +37,132 @@
 #include "notifications/NotificationsPrereqs.h"
 
 #include <ctime>
-#include <map>
 #include <set>
 #include <string>
+#include <vector>
 
-#include "util/Math.h"
 #include "tools/interfaces/Tickable.h"
-#include "overlays/OverlayGroup.h"
+
 #include "interfaces/NotificationListener.h"
+#include "NotificationManager.h"
 
-namespace orxonox
-{
+namespace orxonox // tolua_export
+{ // tolua_export
 
     //! Container to allow easy handling.
-    struct NotificationOverlayContainer
+    struct NotificationContainer
     {
-        NotificationOverlay* overlay; //!< Pointer to the NotificationOverlay, everything is about.
-        Notification* notification; //!< The Notification displayed by the overlay.
+        Notification* notification; //!< The Notification displayed.
         time_t time; //!< The time the Notification was sent and thus first displayed.
-        std::string name; //!< The name of the overlay.
     };
 
-    //! Struct to allow ordering of NotificationOverlayContainers.
-    struct NotificationOverlayContainerCompare {
-        bool operator() (const NotificationOverlayContainer* const & a, const NotificationOverlayContainer* const & b) const
+    //! Struct to allow ordering of NotificationContainers.
+    struct NotificationContainerCompare {
+        bool operator() (const NotificationContainer* const & a, const NotificationContainer* const & b) const
             { return a->time < b->time; } //!< Ordered by time.
     };
 
     /**
     @brief
         Displays Notifications from specific senders.
-        Beware! The NotificationQueue is an OverlayGruop and thus cannot be be a sub-element of an OverlayGroup (at least no for now.)
-
-        Creating a NotificationQueue through XML goes as follows:
-        Be aware that the NotificationQueue must be inside the @code <Level></Level> @endcode tags or bad things will happen.
-        
-        @code
-        <NotificationQueue
-            name = "SuperQueue" //Name of your OverlayQueue.
-            maxSize = "5" //The maximum number of Notifications displayed. (Default is 5)
-            notificationLength = "64" //The maximum number of characters of a Notification, that are displayed. (Default is 64)
-            displayTime = "30" //The time a Notification is displayed in seconds. (Default is 30)
-            targets = "target1, target2" //The senders this NotificationQueue displays Notifications from. (all, if all Notifications should be displayed.)
-            font = "VeraMono" //The font (Default is VeraMono)
-            fontSize = '0.4' //The font size. (Default is 0.025)
-            position = "0.0, 0.0" //The position of the NotificationQueue. (Default is 0.0,0.0)
-        />
-        @endcode
     @author
         Damian 'Mozork' Frick
     */
+    class _NotificationsExport NotificationQueue // tolua_export
+        : public Tickable, public NotificationListener
+    { // tolua_export
 
-    class _NotificationsExport NotificationQueue : public OverlayGroup, public Tickable, public NotificationListener
-    {
-
         public:
-            NotificationQueue(BaseObject* creator);
+            NotificationQueue(const std::string& name, const std::string& senders = NotificationManager::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME);
             virtual ~NotificationQueue();
 
-            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a NotificationQueue object through XML.
+            /**
+            @brief Destroys the NotificationQueue.
+                   Used in lua.
+            */
+            void destroy(void) { this->OrxonoxClass::destroy(); } // tolua_export
 
             virtual void tick(float dt); //!< To update from time to time.
 
-            void update(void); //!< Updates the queue.
-            void update(Notification* notification, const std::time_t & time); //!< Adds a Notification to the queue.
+            void update(void); //!< Updates the NotificationQueue.
+            void update(Notification* notification, const std::time_t & time); //!< Updates the NotificationQueue by adding an new Notification.
 
+            // tolua_begin
             /**
+            @brief Get the name of the NotificationQueue.
+            @return Returns the name.
+            */
+            inline const std::string& getName() const
+                { return this->name_; }
+
+            void setMaxSize(unsigned int size); //!< Sets the maximum number of displayed Notifications.
+            /**
             @brief Returns the maximum number of Notifications displayed.
             @return Returns maximum size.
             */
-            inline int getMaxSize() const
+            inline unsigned int getMaxSize() const
                 { return this->maxSize_; }
+
+            void setDisplayTime(unsigned int time); //!< Sets the maximum number of seconds a Notification is displayed.
             /**
-            @brief Returns the current number of Notifications displayed.
-            @return Returns the size of the queue.
-            */
-            inline int getSize() const
-                { return this->size_; }
-            /**
-            @brief Returns the maximum length in characters a Notification message is allowed to have.
-            @return Returns the maximum Notification length.
-            */
-            inline int getNotificationLength() const
-                { return this->notificationLength_; }
-            /**
             @brief Returns the time interval the Notification is displayed.
             @return Returns the display time.
             */
-            inline int getDisplayTime() const
+            inline float getDisplayTime() const
                 { return this->displayTime_; }
+            // tolua_end
+
             /**
-            @brief Returns the position of the NotificationQueue.
-            @return Returns the position.
+            @brief Returns the current number of Notifications displayed.
+            @return Returns the size of the NotificationQueue.
             */
-            inline const Vector2 & getPosition() const
-                { return this->position_; }
-            /**
-            @brief Returns the font size used to display the Notifications.
-            @return  Returns the font size.
-            */
-            inline float getFontSize() const
-                { return this->fontSize_; }
-            /**
-            @brief Returns the font used to display the Notifications.
-            @return Returns the font.
-            */
-            inline const std::string & getFont() const
-                { return this->font_; }
+            inline unsigned int getSize() const
+                { return this->size_; }
 
             /**
-            @brief Returns the targets of this queue, reps. the senders which Notifications are displayed in this queue.
-            @return Retuns a set of string holding the different targets.
+            @brief Returns the targets of this NotificationQueue, reps. the senders which Notifications are displayed in this NotificationQueue.
+            @return Returns a set of strings holding the different targets.
             */
-            inline const std::set<std::string> & getTargetsSet()
+            inline const std::set<std::string, NotificationListenerStringCompare> & getTargetsSet()
                 { return this->targets_; }
-            bool getTargets(std::string* string) const; //!< Returns a string consisting of the concatination of the targets.
 
-            /**
-            @brief Sets the position of the NotificationQueue.
-            @param pos The position.
-            */
-            inline void setPosition(Vector2 pos)
-                { this->position_ = pos; this->positionChanged(); }
+            // tolua_begin
+            void setTargets(const std::string & targets); //!< Set the targets of this NotificationQueue.
+            const std::string& getTargets(void) const; //!< Returns a string consisting of the concatination of the targets.
+            // tolua_end
 
-            void scroll(const Vector2 pos); //!< Scrolls the NotificationQueue, meaning all NotificationOverlays are moved the input vector.
-
         private:
-            static const int DEFAULT_SIZE = 5; //!< The default maximum number of Notifications displayed.
-            static const int DEFAULT_LENGTH = 64; //!< The default maximum number of characters displayed.
-            static const int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
-            static const float DEFAULT_FONT_SIZE; //!< The default font size.
+            static const unsigned int DEFAULT_SIZE = 5; //!< The default maximum number of Notifications displayed.
+            static const unsigned int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
 
-            static const std::string DEFAULT_FONT; //!< The default font.
-            static const Vector2 DEFAULT_POSITION; //!< the default position.
+            std::string name_; //!< The name of the NotificationQueue.
 
-            int maxSize_; //!< The maximal number of Notifications displayed.
-            int size_; //!< The number of Notifications displayed.
-            int notificationLength_; //!< The maximal number of characters a Notification-message is allowed to have.
-            int displayTime_; //!< The time a Notification is displayed.
-            Vector2 position_; //!< The position of the NotificationQueue.
+            unsigned int maxSize_; //!< The maximal number of Notifications displayed.
+            unsigned int size_; //!< The number of Notifications displayed.
+            unsigned int displayTime_; //!< The time a Notification is displayed.
 
-            std::set<std::string> targets_; //!< The targets the Queue displays Notifications of.
-
-            float fontSize_; //!< The font size.
-            std::string font_; //!< The font.
-
-            std::multiset<NotificationOverlayContainer*, NotificationOverlayContainerCompare> containers_; //!< Multiset, because the ordering is based on, not necessarily unique, timestamps.
-            std::map<Notification*, NotificationOverlayContainer*> overlays_; //!< Mapping notifications to their corresponding overlay containers, for easier association and finding.
-
-            float tickTime_; //!< Helper variable, to not have to check for overlays that have been displayed too long, every tick.
-            NotificationOverlayContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired.
-
             bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
 
-            void initialize(void); //!< Initializes the object.
-            void setDefaults(void); //!< Helper method to set the default values.
+            std::set<std::string, NotificationListenerStringCompare> targets_; //!< The targets the NotificationQueue displays Notifications of.
 
-            bool setMaxSize(int size); //!< Sets the maximum number of displayed Notifications.
-            bool setNotificationLength(int length); //!< Sets the maximum number of characters a Notification message displayed by this queue is allowed to have.
-            bool setDisplayTime(int time); //!< Sets the maximum number of seconds a Notification is displayed.
+            std::multiset<NotificationContainer*, NotificationContainerCompare> ordering_; //!< The NotificationContainers ordered by the time they were registered.
+            std::vector<NotificationContainer*> notifications_; //!< The NotificationContainers in the order they were added to the NotificationQueue.
 
-            bool setTargets(const std::string & targets); //!< Set the targets of this queue.
+            float tickTime_; //!< Helper variable, to not have to check for Notifications that have been displayed too long, every tick.
+            NotificationContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired.
 
-            bool setFontSize(float size); //!< Set the font size.
-            bool setFont(const std::string & font); //!< Set the font.
+            void create(void); //!< Creates the NotificationQueue in lua.
 
-            void positionChanged(void); //!< Aligns all the Notifications to the position of the NotificationQueue.
+            void setName(const std::string& name); //!< Sets the name of the NotificationQueue.
 
-            void addNotification(Notification* notification, const std::time_t & time); //!< Add a notification to the queue.
-            bool removeContainer(NotificationOverlayContainer* container); //!< Remove a container from the queue.
+            void push(Notification* notification, const std::time_t & time); //!< Adds (pushes) a Notification to the NotificationQueue.
+            void pop(void); //!< Removes (pops) the least recently added Notification form the NotificationQueue.
+            void remove(NotificationContainer* container); //!< Removes the Notification that is stored in the input NotificationContainer.
 
-            void clear(void); //!< Clear the queue.
+            void clear(void); //!< Clears the NotificationQueue by removing all NotificationContainers.
 
-    };
+    }; // tolua_export
 
-}
+} // tolua_export
 
 #endif /* _NotificationOverlay_H__ */

Modified: code/trunk/src/modules/notifications/NotificationsPrereqs.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationsPrereqs.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/NotificationsPrereqs.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -67,7 +67,6 @@
     class Notification;
     class NotificationDispatcher;
     class NotificationManager;
-    class NotificationOverlay;
     class NotificationQueue;
     
     //dispatchers

Modified: code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -37,6 +37,7 @@
 #include "core/XMLPort.h"
 #include "core/input/KeyBinderManager.h"
 #include "core/input/KeyBinder.h"
+#include "util/SubString.h"
 
 #include <sstream>
 
@@ -87,11 +88,51 @@
     {
         std::stringstream stream;
         stream << this->getPreMessage();
-        //TODO: Add niceifyer.
-        stream << KeyBinderManager::getInstance().getCurrent()->getBinding(this->getCommand());
+        stream << this->bindingNiceifyer(KeyBinderManager::getInstance().getCurrent()->getBinding(this->getCommand()));
         stream << this->getPostMessage();
-        std::string* message = new std::string(stream.str());
-        return *message;
+        return *(new std::string(stream.str()));
     }
+
+    /**
+    @brief
+        Transforms the input binding into a human readable form.
+    @param binding
+        The binding to be transformed
+    @return
+        Returns a human readable version of the input binding.
+    */
+    const std::string& CommandNotification::bindingNiceifyer(const std::string& binding)
+    {
+        SubString string = SubString(binding, ".");
+        std::string name;
+        std::string group;
+        switch(string.size())
+        {
+            case 0:
+                return binding;
+            case 1:
+                return binding;
+            case 2:
+                group = string[0];
+            default:
+                name = string.subSet(1, string.size()).join(".");
+        }
+
+        std::stringstream stream;
+        if(group.compare("Keys") == 0)
+            stream << "Key " << name.substr(3);
+        else if(group.compare("MouseButtons") == 0)
+            stream << "Mouse " << name;
+        else if(group.compare("JoyStickButtons") == 0)
+            stream << "Joystick " << name;
+        else if(group.compare("JoyStickAxes") == 0)
+            stream << "Joystick Axis" << name.substr(5, 6) << name.substr(name.find("Axis")+6);
+        else if(group.compare("MouseAxes") == 0)
+            stream << "Mouse " << name.substr(1,3) << " " << name.substr(0, 1) << "-Axis";
+        else
+            return binding;
+
+        return *(new std::string(stream.str()));
+    }
     
 }

Modified: code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/CommandNotification.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/notifications/dispatchers/CommandNotification.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -103,6 +103,8 @@
             void setPostMessage(const std::string& message)
                  { this->postMessage_ = message; }
 
+            const std::string& bindingNiceifyer(const std::string& binding);
+
     };
 
 }

Modified: code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -34,6 +34,7 @@
 #include "MultiTriggerContainer.h"
 
 #include "core/CoreIncludes.h"
+#include "worldentities/pawns/Pawn.h"
 
 namespace orxonox
 {
@@ -64,6 +65,13 @@
     MultiTriggerContainer::MultiTriggerContainer(BaseObject* creator, MultiTrigger* originator, BaseObject* data) : BaseObject(creator), originator_(originator), data_(data)
     {
         RegisterObject(MultiTriggerContainer);
+
+        Pawn* pawn = orxonox_cast<Pawn*>(data);
+        if(pawn != NULL)
+        {
+            this->setForPlayer(true);
+            this->setTriggeringPlayer(pawn);
+        }
     }
 
     /**

Modified: code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/objects/triggers/MultiTriggerContainer.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -37,6 +37,7 @@
 #include "objects/ObjectsPrereqs.h"
 
 #include "core/BaseObject.h"
+#include "interfaces/PlayerTrigger.h"
 
 namespace orxonox
 {
@@ -47,7 +48,7 @@
     @author
         Damian 'Mozork' Frick
     */
-    class _ObjectsExport MultiTriggerContainer : public BaseObject
+    class _ObjectsExport MultiTriggerContainer : public BaseObject, public PlayerTrigger
     {
 
         public:
@@ -71,6 +72,7 @@
         private:
             MultiTrigger* originator_; //!< The originator.
             BaseObject* data_; //!< The data.
+
     };
 
 }

Modified: code/trunk/src/modules/questsystem/Quest.cc
===================================================================
--- code/trunk/src/modules/questsystem/Quest.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/questsystem/Quest.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -366,7 +366,7 @@
 
         COUT(4) << "Quest {" << this->getId() << "} is failed for player: " << player << " ." <<std::endl;
 
-        this->getDescription()->sendFailQuestNotification();
+        this->getDescription()->sendFailQuestNotification(player);
         return true;
     }
 
@@ -385,7 +385,7 @@
 
         COUT(4) << "Quest {" << this->getId() << "} is completed for player: " << player << " ." <<std::endl;
 
-        this->getDescription()->sendCompleteQuestNotification();
+        this->getDescription()->sendCompleteQuestNotification(player);
         return true;
     }
 
@@ -411,7 +411,7 @@
 
         this->setStatus(player, QuestStatus::Active);
 
-        this->getDescription()->sendAddQuestNotification();
+        this->getDescription()->sendAddQuestNotification(player);
         return true;
     }
 

Modified: code/trunk/src/modules/questsystem/QuestDescription.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestDescription.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/questsystem/QuestDescription.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -83,12 +83,12 @@
         The item the QuestDescription is for.
     @param status
         The status the QuestDescription us for.
+    @param player
+        The player the Notification is sent to.
     @return
         Returns true if successful.
-    @todo
-        Make sure the messages meet the conditions.
     */
-    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status)
+    bool QuestDescription::notificationHelper(const std::string & item, const std::string & status, PlayerInfo* player)
     {
         std::string message;
         if(item == "hint")
@@ -122,7 +122,7 @@
         }
 
         QuestNotification* notification = new QuestNotification(this, message);
-        notification->send();
+        notification->send(player);
         return true;
     }
 

Modified: code/trunk/src/modules/questsystem/QuestDescription.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestDescription.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/questsystem/QuestDescription.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -96,31 +96,35 @@
 
             /**
             @brief Sends a Notification displaying that a QuestHint was added.
+            @param player The player the Notification is sent to.
             @return Returns true if successful.
             */
-            inline bool sendAddHintNotification(void)
-                { return notificationHelper("hint", ""); }
+            inline bool sendAddHintNotification(PlayerInfo* player)
+                { return notificationHelper("hint", "", player); }
 
             /**
             @brief Sends a Notification displaying that a Quest was added.
+            @param player The player the Notification is sent to.
             @return Returns true if successful.
             */
-            inline bool sendAddQuestNotification(void)
-                { return notificationHelper("quest", "start"); }
+            inline bool sendAddQuestNotification(PlayerInfo* player)
+                { return notificationHelper("quest", "start", player); }
 
             /**
             @brief Sends a Notification displaying that a Quest was failed.
+            @param player The player the Notification is sent to.
             @return Returns true if successful.
             */
-            inline bool sendFailQuestNotification(void)
-                { return notificationHelper("quest", "fail"); }
+            inline bool sendFailQuestNotification(PlayerInfo* player)
+                { return notificationHelper("quest", "fail", player); }
 
             /**
             @brief Sends a Notification displaying that a Quest was completed.
+            @param player The player the Notification is sent to.
             @return Returns true if successful.
             */
-            inline bool sendCompleteQuestNotification(void)
-                { return notificationHelper("quest", "complete"); }
+            inline bool sendCompleteQuestNotification(PlayerInfo* player)
+                { return notificationHelper("quest", "complete", player); }
 
         private:
             std::string title_; //!< The title.
@@ -128,7 +132,7 @@
             std::string failMessage_; //!< The message displayed when the Quest is failed.
             std::string completeMessage_; //!< The message displayed when the Quest is completed.
 
-            bool notificationHelper(const std::string & item, const std::string & status); //!< Helper for sending QuestDescriptions as Notifications.
+            bool notificationHelper(const std::string & item, const std::string & status, PlayerInfo* player); //!< Helper for sending QuestDescriptions as Notifications.
 
             /**
             @brief Sets the title.

Modified: code/trunk/src/modules/questsystem/QuestHint.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestHint.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/questsystem/QuestHint.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -120,7 +120,7 @@
             {
                 this->playerStatus_[player] = QuestHintStatus::Active;
 
-                this->getDescription()->sendAddHintNotification();
+                this->getDescription()->sendAddHintNotification(player);
                 return true;
             }
             else

Modified: code/trunk/src/modules/questsystem/QuestNotification.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestNotification.cc	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/questsystem/QuestNotification.cc	2010-09-11 08:20:44 UTC (rev 7403)
@@ -28,6 +28,7 @@
 
 #include "QuestNotification.h"
 #include "core/CoreIncludes.h"
+#include "infos/PlayerInfo.h"
 
 namespace orxonox {
 
@@ -69,12 +70,14 @@
     /**
     @brief
         Send the QuestNotification.
+    @param player
+        The player the Notification is sent to.
     @return
         Returns true if successful.
     */
-    bool QuestNotification::send(void)
+    bool QuestNotification::send(PlayerInfo* player)
     {
-        return this->Notification::send(QuestNotification::SENDER);
+        return this->Notification::send(player->getClientID(), QuestNotification::SENDER);
     }
 
 

Modified: code/trunk/src/modules/questsystem/QuestNotification.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestNotification.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/modules/questsystem/QuestNotification.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -49,7 +49,7 @@
             QuestNotification(BaseObject* creator, const std::string & message); //!< Constructor.
             virtual ~QuestNotification(); //!< Destructor.
 
-            bool send(void); //!< Send the QuestNotification.
+            bool send(PlayerInfo* player); //!< Send the QuestNotification.
 
         private:
             static const std::string SENDER; //!< A string identifying the questsystem as the sender.

Modified: code/trunk/src/orxonox/interfaces/NotificationListener.h
===================================================================
--- code/trunk/src/orxonox/interfaces/NotificationListener.h	2010-09-11 00:31:39 UTC (rev 7402)
+++ code/trunk/src/orxonox/interfaces/NotificationListener.h	2010-09-11 08:20:44 UTC (rev 7403)
@@ -48,6 +48,17 @@
 
     /**
     @brief
+        Struct that overloads the compare operation between two PickupIdentifier pointers.
+    */
+    //TODO: 
+    struct NotificationListenerStringCompare
+    {
+        bool operator() (const std::string& lhs, const std::string& rhs) const
+            { return lhs.compare(rhs) < 0; }
+    };
+
+    /**
+    @brief
         NotificationListener interface.
     @author
         Fabian 'x3n' Landau
@@ -58,7 +69,7 @@
             NotificationListener();
             virtual ~NotificationListener() {}
 
-            virtual const std::set<std::string> & getTargetsSet() = 0;
+            virtual const std::set<std::string, NotificationListenerStringCompare> & getTargetsSet() = 0;
             virtual void update(void) = 0;
             virtual void update(Notification* notification, const std::time_t & time) = 0;
     };




More information about the Orxonox-commit mailing list