Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7398


Ignore:
Timestamp:
Sep 10, 2010, 7:50:06 PM (14 years ago)
Author:
dafrick
Message:

Done some selective testing and it finally seems to work.

Location:
code/branches/notifications
Files:
4 edited

Legend:

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

    r7395 r7398  
    4040        winMgr:destroyWindow(queue.window)
    4141    end
    42     queue = nil
     42    P.queueList[name] = nil
    4343end
    4444
     
    194194    window = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/" .. name)
    195195    local frame = tolua.cast(window, "CEGUI::FrameWindow")
    196     frame:setCloseButtonEnabled(false)
     196    frame:setCloseButtonEnabled(true)
     197    orxonox.GUIManager:subscribeEventHelper(frame, "CloseClicked", P.name .. ".closeQueue_clicked")
    197198    frame:setText("NotificationQueue \"" .. name .. "\"")
    198199    root:addChildWindow(window)
     
    221222    targets:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
    222223    targets:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
    223     cout(0, horzOffset .. "|" .. targets:getXPosition():asAbsolute(1) .. "|" .. size[2]*2+20)
    224224    horzOffset = horzOffset + size[2]*2+20 + 5
    225225    pane:addChildWindow(targets)
     
    231231    save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
    232232    save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
    233     cout(0, horzOffset .. "|" .. save:getXPosition():asAbsolute(1))
    234233    orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveTargets_clicked")
    235234    pane:addChildWindow(save)
     
    335334    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets")
    336335    local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets/Save")
    337     local width = window:getXPosition():asAbsolute(1)
     336    local width = window:getWidth():asAbsolute(1)
    338337
    339338    local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
     
    345344    local size = getMinTextSize(P.sampleWindow)
    346345    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))
    348346    save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
    349347end
     
    359357    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size")
    360358    local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size/Save")
    361     local width = window:getXPosition():asAbsolute(1)
     359    local width = window:getWidth():asAbsolute(1)
    362360
    363361    local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
     
    382380    local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime")
    383381    local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime/Save")
    384     local width = window:getXPosition():asAbsolute(1)
     382    local width = window:getWidth():asAbsolute(1)
    385383
    386384    local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
     
    417415function P.leaveEditMode_clicked(e)
    418416    hideMenuSheet(P.name)
     417end
     418
     419function P.closeQueue_clicked(e)
     420    local we = CEGUI.toWindowEventArgs(e)
     421    local name = we.window:getName()
     422
     423    local match = string.gmatch(name, "EditMode/.*")
     424    local nameStr = match()
     425    local queueName = string.sub(nameStr, 10, string.len(nameStr))
     426
     427    winMgr:destroyWindow(P.queueList[queueName].edit)
     428    P.queueList[queueName].edit = nil
     429    orxonox.NotificationManager:getInstance():getQueue(queueName):destroy()
    419430end
    420431
  • code/branches/notifications/src/modules/notifications/NotificationManager.cc

    r7395 r7398  
    165165            this->listenerCounter_[notification] = this->listenerCounter_[notification] - 1;
    166166
    167         COUT(4) << "Notification (&" << notification << ")unregistered with the NotificationManager from listener (&" << listener << ")" << std::endl;
     167        COUT(4) << "Notification (&" << notification << ") unregistered with the NotificationManager from listener (&" << listener << ")" << std::endl;
    168168    }
    169169
     
    212212        // 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.
    213213        bool bAll = set.find(NotificationManager::ALL) != set.end();
    214         std::multimap<std::time_t, Notification*> map;
     214        std::multimap<std::time_t, Notification*>* map;
    215215        if(bAll)
    216216            this->notificationLists_[index] = &this->allNotificationsList_;
     
    218218        {
    219219            this->notificationLists_[index] = new std::multimap<std::time_t, Notification*>;
    220             map = *this->notificationLists_[index];
     220            map = this->notificationLists_[index];
    221221        }
    222222
     
    227227            {
    228228                if(!bAll)
    229                     map.insert(std::pair<std::time_t, Notification*>(it->first, it->second));
     229                    map->insert(std::pair<std::time_t, Notification*>(it->first, it->second));
    230230                std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(it->second);
    231231                if(counterIt == this->listenerCounter_.end())
     
    254254        std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second;
    255255
    256         // Make sure all Notifications are removed.
     256        // If the map is not the map of all notifications, make sure all Notifications are removed and delete it.
    257257        std::multimap<std::time_t, Notification*>::iterator it = map->begin();
    258         while(it != map->end())
    259         {
    260             this->unregisterNotification(it->second, listener);
    261             it = map->begin();
     258        if(map != &this->allNotificationsList_)
     259        {
     260            while(it != map->end())
     261            {
     262                this->unregisterNotification(it->second, listener);
     263                it = map->begin();
     264            }
     265            delete map;
    262266        }
    263267
    264268        this->listenerList_.erase(listener);
    265269        this->notificationLists_.erase(identifier);
    266 
    267         // If the map is not the map of all notifications, delete it.
    268         if(map != &this->allNotificationsList_)
    269             delete map;
    270270
    271271        COUT(4) << "NotificationListener unregistered with the NotificationManager." << std::endl;
  • code/branches/notifications/src/modules/notifications/NotificationQueue.cc

    r7395 r7398  
    100100            NotificationManager::getInstance().unregisterListener(this);
    101101            NotificationManager::getInstance().unregisterQueue(this);
     102
     103            GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() +  "\")");
    102104        }
    103105    }
     
    360362        this->targets_.clear();
    361363
     364        //TODO: Do with SubString.
    362365        std::string* pTemp;
    363366        unsigned int index = 0;
  • code/branches/notifications/src/modules/notifications/NotificationQueue.h

    r7395 r7398  
    7575            NotificationQueue(const std::string& name, const std::string& senders = NotificationManager::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME);
    7676            virtual ~NotificationQueue();
     77
     78            void destroy(void) { this->OrxonoxClass::destroy(); } // tolua_export
    7779
    7880            virtual void tick(float dt); //!< To update from time to time.
Note: See TracChangeset for help on using the changeset viewer.