Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 9, 2010, 10:59:01 PM (14 years ago)
Author:
dafrick
Message:

Finished EditMode, needs some polish (no not the language…) though.
Took better advantage of lua tables in NotificationLayer.lua
Fixed a lot of bugs, it really is a miracle that the Notifications worked as well as they did.

Location:
code/branches/notifications/data/gui/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/notifications/data/gui/scripts/GUISheet.lua

    r6748 r7395  
    4040end
    4141
     42-- Override this function if you need to do work just after the sheet has been hidden
     43function P:afterHide()
     44end
     45
    4246function P:load()
    4347    -- Load the layout that describes the sheet
  • code/branches/notifications/data/gui/scripts/MiscConfigMenu.lua

    r7284 r7395  
    5151    table.insert(P.nameList, "Number of Bots")
    5252    table.insert(P.nameList, "UnderAttack: game time")
    53     table.insert(P.nameList, "TeamDeathmatch: Numer of teams")
     53    table.insert(P.nameList, "TeamDeathmatch: Number of teams")
    5454    table.insert(P.nameList, "Playername")
    5555    table.insert(P.nameList, "Chat: display time")
  • code/branches/notifications/data/gui/scripts/NotificationLayer.lua

    r7362 r7395  
    11-- NotificationLayer.lua
    22
    3 local P = createMenuSheet("NotificationLayer")
     3local P = createMenuSheet("NotificationLayer", true, TriBool.True, TriBool.True)
    44
    55P.queueList = {}
    6 P.nameList = {}
    7 P.visible = nil
    86P.editMode = false
    9 P.editList = {}
     7
     8P.sampleWindow = nil
     9
     10function P.onLoad()
     11    orxonox.NotificationManager:getInstance():loadQueues()
     12    P.sampleWindow = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/SampleWindow")
     13end
    1014
    1115function P.createQueue(name, size)
     
    1822    queue:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queue, size))))
    1923
    20     P.setVisible(queue, false)
    21 
    22     table.insert(P.queueList, queue)
    23     table.insert(P.nameList, name)
    24     --TODO: Check name for uniqueness.
     24    local queueTuple =
     25    {
     26        ["window"]  = queue,
     27        ["name"]    = name,
     28        ["edit"]    = nil,
     29        ["visible"] = false
     30    }
     31
     32    P.queueList[name] = queueTuple -- name access
     33    P.setVisible(queueTuple, false)
    2534end
    2635
    2736function P.removeQueue(name)
    28     local queue = nil
    29 
    30     for k,v in pairs(P.nameList) do
    31         if v == name then
    32             P.nameList[k] = nil
    33             queue = P.queueList[k]
    34             P.queueList[k] = nil
    35             break
    36         end
    37     end
     37    local queue = P.queueList[name]
    3838
    3939    if queue ~= nil then
    40         winMgr:destroyWindow(queue)
    41     end
     40        winMgr:destroyWindow(queue.window)
     41    end
     42    queue = nil
    4243end
    4344
    4445function P.pushNotification(queueName, notification)
    45     local queue = P.nameToQueueHelper(queueName)
    46     if queue == nil then
    47         cout(0, "Queue is nil!")
     46    local queue = P.queueList[queueName]
     47    if queue == nil then
     48        cout(0, "0Queue is nil! " .. queueName)
    4849        return
    4950    end
    5051    item = CEGUI.createListboxTextItem(notification)
    51     local listbox = CEGUI.toListbox(queue)
     52    local listbox = CEGUI.toListbox(queue.window)
    5253    if listbox:getItemCount() == 0 then
    5354        listbox:addItem(item)
     
    5657    end
    5758
    58     if P.visible == false then
     59    if queue.visible == false then
    5960        P.setVisible(queue, true)
    6061    end
     
    6263
    6364function P.popNotification(queueName)
    64     local queue = P.nameToQueueHelper(queueName)
    65     if queue == nil then
    66         cout(0, "Queue is nil!")
    67         return
    68     end
    69     local listbox = CEGUI.toListbox(queue)
     65    local queue = P.queueList[queueName]
     66    if queue == nil then
     67        cout(0, "1Queue is nil! " .. queueName)
     68        return
     69    end
     70    local listbox = CEGUI.toListbox(queue.window)
    7071    listbox:removeItem(listbox:getListboxItemFromIndex(listbox:getItemCount()-1))
    7172
     
    7677
    7778function P.removeNotification(queueName, index)
    78     local queue = P.nameToQueueHelper(queueName)
    79     if queue == nil then
    80         cout(0, "Queue is nil!")
    81         return
    82     end
    83     local listbox = CEGUI.toListbox(queue)
     79    local queue = P.queueList[queueName]
     80    if queue == nil then
     81        cout(0, "2Queue is nil! " .. queueName)
     82        return
     83    end
     84    local listbox = CEGUI.toListbox(queue.window)
    8485    listbox:removeItem(listbox:getListboxItemFromIndex(tonumber(index)))
    8586
     
    9091
    9192function P.clearQueue(name)
    92     local queue = P.nameToQueueHelper(name)
    93     if queue == nil then
    94         cout(0, "Queue is nil!")
    95         return
    96     end
    97     local listbox = CEGUI.toListbox(queue)
    98     CEGUI.toListbox(queue):resetList()
     93    local queue = P.queueList[name]
     94    if queue == nil then
     95        cout(0, "3Queue is nil! " .. name)
     96        return
     97    end
     98    local listbox = CEGUI.toListbox(queue.window)
     99    CEGUI.toListbox(queue.window):resetList()
    99100
    100101    P.setVisible(queue, false)
    101102end
    102103
    103 function P.changePosition(name, xPos, yPos)
    104     local queue = P.nameToQueueHelper(name)
    105     if queue == nil then
    106         cout(0, "Queue is nil!")
    107         return
    108     end
    109     queue:setPosition(CEGUI.UVector2(CEGUI.UDim(tonumber(xPos), 0), CEGUI.UDim(tonumber(yPos), 0)))
    110     queue:setWidth(CEGUI.UDim(1.0, -xPos))
    111 end
    112 
    113104function P.changeSize(name, size)
    114     local queue = P.nameToQueueHelper(name)
    115     if queue == nil then
    116         cout(0, "Queue is nil!")
    117         return
    118     end
    119     queue:setHeight(CEGUI.UDim(0, P.queueHeightHelper(queue, size)))
     105    local queue = P.queueList[name]
     106    if queue == nil then
     107        cout(0, "5Queue is nil! " .. name)
     108        return
     109    end
     110    queue.window:setHeight(CEGUI.UDim(0, P.queueHeightHelper(queue.window, size)))
    120111end
    121112
    122113function P.setVisible(queue, visible)
    123     queue:setVisible(visible)
    124     P.visible = visible
     114    if queue == nil then
     115        cout(0, "6Queue is nil! " .. queue.name)
     116        return
     117    end
     118    queue.window:setVisible(visible)
     119    queue.visible = visible
    125120end
    126121
    127122function P.enterEditMode()
    128123    P.editMode = true
     124
     125    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
     126
     127    --Add control frame window.
     128    local window = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/ControlWindow")
     129    local frame = tolua.cast(window, "CEGUI::FrameWindow")
     130    frame:setCloseButtonEnabled(false)
     131    frame:setText("NotificationLayer Control Window")
     132    frame:setSize(CEGUI.UVector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.2, 0)))
     133    root:addChildWindow(window)
     134    local pane = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/ScrollingPane")
     135    pane:setSize(CEGUI.UVector2(CEGUI.UDim(1,-20), CEGUI.UDim(1,-30)))
     136    pane:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 10), CEGUI.UDim(0, 26)))
     137    window:addChildWindow(pane)
     138
     139    vertOffset = 0
     140    horzOffset = 0
     141    local newQueueTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/NewQueueTitle")
     142    newQueueTitle:setText("Create a new NotificationQueue:")
     143    local size = getMinTextSize(newQueueTitle)
     144    local textHeight = size[1]
     145    newQueueTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
     146    newQueueTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     147    pane:addChildWindow(newQueueTitle)
     148    horzOffset = horzOffset + size[2] + 5
     149    local newQueueName = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/NewQueueName")
     150    newQueueName:setProperty("ReadOnly", "set:False")
     151    newQueueName:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
     152    newQueueName:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     153    horzOffset = horzOffset + size[2] + 5
     154    pane:addChildWindow(newQueueName)
     155    local create = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/CreateNewQueue")
     156    create:setText("create")
     157    P.sampleWindow:setText("create")
     158    size = getMinTextSize(P.sampleWindow)
     159    create:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]+20), CEGUI.UDim(0, textHeight)))
     160    create:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     161    orxonox.GUIManager:subscribeEventHelper(create, "Clicked", P.name .. ".createNewQueue_clicked")
     162    pane:addChildWindow(create)
     163    horzOffset = horzOffset + size[2]+20 + 5
     164    vertOffset = vertOffset + textHeight + 5
     165
     166    horzOffset = 0
     167    local leave = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/LeaveEditModeButton")
     168    leave:setText("leave Edit Mode")
     169    P.sampleWindow:setText("leave Edit Mode")
     170    size = getMinTextSize(P.sampleWindow)
     171    leave:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]+20), CEGUI.UDim(0, textHeight)))
     172    leave:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     173    orxonox.GUIManager:subscribeEventHelper(leave, "Clicked", P.name .. ".leaveEditMode_clicked")
     174    pane:addChildWindow(leave)
     175    horzOffset = horzOffset + size[2]+20 + 5
     176    vertOffset = vertOffset + textHeight + 5
     177
     178    --Replace all queues with FrameWindows
     179    for k,v in pairs(P.queueList) do
     180        if v ~= nil then
     181            local queue = P.queueList[k]
     182            root:removeChildWindow(queue.window)
     183           
     184            local window = P.createQueueEditFrame(queue.name)
     185            window:setArea(queue.window:getArea())
     186           
     187            queue.edit = window
     188        end
     189    end
     190end
     191
     192function P.createQueueEditFrame(name)
     193    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
     194    window = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/" .. name)
     195    local frame = tolua.cast(window, "CEGUI::FrameWindow")
     196    frame:setCloseButtonEnabled(false)
     197    frame:setText("NotificationQueue \"" .. name .. "\"")
     198    root:addChildWindow(window)
     199    local pane = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/ScrollingPane")
     200    pane:setSize(CEGUI.UVector2(CEGUI.UDim(1,-20), CEGUI.UDim(1,-30)))
     201    pane:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 10), CEGUI.UDim(0, 26)))
     202    window:addChildWindow(pane)
     203
     204    local horzOffset = 0
     205    local vertOffset = 0
     206
     207    local targetsTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/TargetsTitle")
     208    targetsTitle:setText("Targets:")
     209    local size = getMinTextSize(targetsTitle)
     210    local textHeight = size[1]
     211    targetsTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
     212    targetsTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     213    pane:addChildWindow(targetsTitle)
     214    horzOffset = horzOffset + size[2] + 5
     215    local targets = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/Targets")
     216    targets:setProperty("ReadOnly", "set:False")
     217    local targetsText = orxonox.NotificationManager:getInstance():getQueue(name):getTargets()
     218    targets:setText(targetsText)
     219    P.sampleWindow:setText(targetsText)
     220    size = getMinTextSize(P.sampleWindow)
     221    targets:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
     222    targets:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     223    cout(0, horzOffset .. "|" .. targets:getXPosition():asAbsolute(1) .. "|" .. size[2]*2+20)
     224    horzOffset = horzOffset + size[2]*2+20 + 5
     225    pane:addChildWindow(targets)
     226    local save = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/Targets/Save")
     227    save:setText("save")
     228    P.sampleWindow:setText("save")
     229    size = getMinTextSize(P.sampleWindow)
     230    local saveTextWidth = size[2]+20
     231    save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
     232    save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     233    cout(0, horzOffset .. "|" .. save:getXPosition():asAbsolute(1))
     234    orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveTargets_clicked")
     235    pane:addChildWindow(save)
     236    horzOffset = horzOffset + saveTextWidth
     237    vertOffset = vertOffset + textHeight + 5
     238
     239    horzOffset = 0
     240    local sizeTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/SizeTitle")
     241    sizeTitle:setText("Size:")
     242    size = getMinTextSize(sizeTitle)
     243    sizeTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
     244    sizeTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     245    pane:addChildWindow(sizeTitle)
     246    horzOffset = horzOffset + size[2] + 5
     247    local queueSize = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/Size")
     248    queueSize:setProperty("ReadOnly", "set:False")
     249    local maxSize = orxonox.NotificationManager:getInstance():getQueue(name):getMaxSize()
     250    queueSize:setText(maxSize)
     251    P.sampleWindow:setText(maxSize)
     252    size = getMinTextSize(P.sampleWindow)
     253    queueSize:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
     254    queueSize:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     255    horzOffset = horzOffset + size[2]*2+20 + 5
     256    pane:addChildWindow(queueSize)
     257    save = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/Size/Save")
     258    save:setText("save")
     259    P.sampleWindow:setText("save")
     260    size = getMinTextSize(P.sampleWindow)
     261    local saveTextWidth = size[2]+20
     262    save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
     263    save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     264    orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveSize_clicked")
     265    pane:addChildWindow(save)
     266    horzOffset = horzOffset + saveTextWidth
     267    vertOffset = vertOffset + textHeight + 5
     268
     269    horzOffset = 0
     270    local displayTimeTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/DisplayTimeTitle")
     271    displayTimeTitle:setText("Display time:")
     272    size = getMinTextSize(displayTimeTitle)
     273    displayTimeTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
     274    displayTimeTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     275    pane:addChildWindow(displayTimeTitle)
     276    horzOffset = horzOffset + size[2] + 5
     277    local displayTime = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/DisplayTime")
     278    displayTime:setProperty("ReadOnly", "set:False")
     279    local time = orxonox.NotificationManager:getInstance():getQueue(name):getDisplayTime()
     280    displayTime:setText(time)
     281    P.sampleWindow:setText(time)
     282    size = getMinTextSize(P.sampleWindow)
     283    displayTime:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
     284    displayTime:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     285    horzOffset = horzOffset + size[2]*2+20 + 5
     286    pane:addChildWindow(displayTime)
     287    save = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/" .. name .. "/DisplayTime/Save")
     288    save:setText("save")
     289    P.sampleWindow:setText("save")
     290    size = getMinTextSize(P.sampleWindow)
     291    local saveTextWidth = size[2]+20
     292    save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
     293    save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
     294    orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveDisplayTime_clicked")
     295    pane:addChildWindow(save)
     296    horzOffset = horzOffset + saveTextWidth
     297    vertOffset = vertOffset + textHeight + 5
     298
     299    return window
     300end
     301
     302function P.leaveEditMode()
     303    P.editMode = false
    129304
    130305    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
     
    132307    for k,v in pairs(P.queueList) do
    133308        if v ~= nil then
    134             root:removeChildWindow(v)
    135             local frame = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/" .. P.nameList[k])
    136             frame:setArea(v:getArea())
    137             root:addChildWindow(frame)
    138             P.editList[k] = frame
     309            root:addChildWindow(v.window)
     310            v.window:setArea(v.edit:getArea())
     311            winMgr:destroyWindow(v.edit)
     312            v.edit = nil
    139313        end
    140314    end
    141 end
    142 
    143 function P.leaveEditMode()
    144     P.editMode = false
    145 
    146     local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
    147     --Replace all queues with FrameWindows
    148     for k,v in pairs(P.queueList) do
    149         if v ~= nil then
    150             root:addChildWindow(v)
    151             v:setArea(P.editList[k]:getArea())
    152             winMgr:destroyWindow(P.editList[k])
    153             P.editList[k] = nil
    154         end
    155     end
    156 
    157     showMenuSheet(P.name, false, true)
    158 end
    159 
    160 function P.onHide()
     315
     316    --Remove control window
     317    winMgr:destroyWindow(winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/ControlWindow"))
     318end
     319
     320function P.afterHide()
    161321    if P.editMode then
    162322        P.leaveEditMode()
    163     end
    164 end
    165 
    166 function P.nameToQueueHelper(name)
    167     local queue = nil
    168     for k,v in pairs(P.nameList) do
    169         if v == name then
    170             queue = P.queueList[k]
    171             break
    172         end
    173     end
    174     return queue
     323        showMenuSheet(P.name, false, true)
     324    end
     325end
     326
     327function P. saveTargets_clicked(e)
     328    local we = CEGUI.toWindowEventArgs(e)
     329    local name = we.window:getName()
     330
     331    local match = string.gmatch(name, "EditMode/.*/Targets/Save")
     332    local nameStr = match()
     333    local queueName = string.sub(nameStr, 10, string.len(nameStr)-13)
     334
     335    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets")
     336    local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets/Save")
     337    local width = window:getXPosition():asAbsolute(1)
     338
     339    local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
     340    queue:setTargets(window:getText())
     341    local targets = queue:getTargets()
     342
     343    window:setText(targets)
     344    P.sampleWindow:setText(targets)
     345    local size = getMinTextSize(P.sampleWindow)
     346    window:setWidth(CEGUI.UDim(0, size[2]*2+20))
     347    cout(0, width .. "|" .. size[2]*2+20 .. "|" .. window:getWidth():asAbsolute(1) .. "|" .. save:getXPosition():asAbsolute(1))
     348    save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
     349end
     350
     351function P. saveSize_clicked(e)
     352    local we = CEGUI.toWindowEventArgs(e)
     353    local name = we.window:getName()
     354
     355    local match = string.gmatch(name, "EditMode/.*/Size/Save")
     356    local nameStr = match()
     357    local queueName = string.sub(nameStr, 10, string.len(nameStr)-10)
     358
     359    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size")
     360    local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size/Save")
     361    local width = window:getXPosition():asAbsolute(1)
     362
     363    local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
     364    queue:setMaxSize(tonumber(window:getText()))
     365    local maxSize = queue:getMaxSize()
     366
     367    window:setText(maxSize)
     368    P.sampleWindow:setText(maxSize)
     369    local size = getMinTextSize(P.sampleWindow)
     370    window:setWidth(CEGUI.UDim(0, size[2]*2+20))
     371    save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
     372end
     373
     374function P. saveDisplayTime_clicked(e)
     375    local we = CEGUI.toWindowEventArgs(e)
     376    local name = we.window:getName()
     377
     378    local match = string.gmatch(name, "EditMode/.*/DisplayTime/Save")
     379    local nameStr = match()
     380    local queueName = string.sub(nameStr, 10, string.len(nameStr)-17)
     381
     382    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime")
     383    local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime/Save")
     384    local width = window:getXPosition():asAbsolute(1)
     385
     386    local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
     387    queue:setDisplayTime(tonumber(window:getText()))
     388    local time = queue:getDisplayTime()
     389
     390    window:setText(time)
     391    P.sampleWindow:setText(time)
     392    local size = getMinTextSize(P.sampleWindow)
     393    window:setWidth(CEGUI.UDim(0, size[2]*2+20))
     394    save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
     395end
     396
     397function P.createNewQueue_clicked(e)
     398    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/ControlWindow/NewQueueName")
     399    local name = window:getText()
     400    orxonox.NotificationManager:getInstance():createQueue(name)
     401
     402    local queue = P.queueList[name]
     403    if queue == nil then
     404        cout(0, "7Queue is nil! " .. name)
     405        return
     406    end
     407   
     408    local frame = P.createQueueEditFrame(name)
     409    local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
     410    root:removeChildWindow(queue.window)
     411    frame:setArea(queue.window:getArea())
     412    queue.edit = frame
     413   
     414    window:setText("")
     415end
     416
     417function P.leaveEditMode_clicked(e)
     418    hideMenuSheet(P.name)
    175419end
    176420
     
    188432
    189433return P
    190 
  • code/branches/notifications/data/gui/scripts/SheetManager.lua

    r7342 r7395  
    185185        hideCursor()
    186186    end
     187
     188    sheetTuple.sheet:afterHide()
    187189end
    188190
Note: See TracChangeset for help on using the changeset viewer.