Changeset 7398 for code/branches
- Timestamp:
- Sep 10, 2010, 7:50:06 PM (14 years ago)
- Location:
- code/branches/notifications
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/notifications/data/gui/scripts/NotificationLayer.lua
r7395 r7398 40 40 winMgr:destroyWindow(queue.window) 41 41 end 42 queue= nil42 P.queueList[name] = nil 43 43 end 44 44 … … 194 194 window = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/" .. name) 195 195 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") 197 198 frame:setText("NotificationQueue \"" .. name .. "\"") 198 199 root:addChildWindow(window) … … 221 222 targets:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight))) 222 223 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 224 horzOffset = horzOffset + size[2]*2+20 + 5 225 225 pane:addChildWindow(targets) … … 231 231 save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight))) 232 232 save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset))) 233 cout(0, horzOffset .. "|" .. save:getXPosition():asAbsolute(1))234 233 orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveTargets_clicked") 235 234 pane:addChildWindow(save) … … 335 334 local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets") 336 335 local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets/Save") 337 local width = window:get XPosition():asAbsolute(1)336 local width = window:getWidth():asAbsolute(1) 338 337 339 338 local queue = orxonox.NotificationManager:getInstance():getQueue(queueName) … … 345 344 local size = getMinTextSize(P.sampleWindow) 346 345 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 346 save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1))) 349 347 end … … 359 357 local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size") 360 358 local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size/Save") 361 local width = window:get XPosition():asAbsolute(1)359 local width = window:getWidth():asAbsolute(1) 362 360 363 361 local queue = orxonox.NotificationManager:getInstance():getQueue(queueName) … … 382 380 local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime") 383 381 local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime/Save") 384 local width = window:get XPosition():asAbsolute(1)382 local width = window:getWidth():asAbsolute(1) 385 383 386 384 local queue = orxonox.NotificationManager:getInstance():getQueue(queueName) … … 417 415 function P.leaveEditMode_clicked(e) 418 416 hideMenuSheet(P.name) 417 end 418 419 function 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() 419 430 end 420 431 -
code/branches/notifications/src/modules/notifications/NotificationManager.cc
r7395 r7398 165 165 this->listenerCounter_[notification] = this->listenerCounter_[notification] - 1; 166 166 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; 168 168 } 169 169 … … 212 212 // 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. 213 213 bool bAll = set.find(NotificationManager::ALL) != set.end(); 214 std::multimap<std::time_t, Notification*> map;214 std::multimap<std::time_t, Notification*>* map; 215 215 if(bAll) 216 216 this->notificationLists_[index] = &this->allNotificationsList_; … … 218 218 { 219 219 this->notificationLists_[index] = new std::multimap<std::time_t, Notification*>; 220 map = *this->notificationLists_[index];220 map = this->notificationLists_[index]; 221 221 } 222 222 … … 227 227 { 228 228 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)); 230 230 std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(it->second); 231 231 if(counterIt == this->listenerCounter_.end()) … … 254 254 std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second; 255 255 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. 257 257 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; 262 266 } 263 267 264 268 this->listenerList_.erase(listener); 265 269 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;270 270 271 271 COUT(4) << "NotificationListener unregistered with the NotificationManager." << std::endl; -
code/branches/notifications/src/modules/notifications/NotificationQueue.cc
r7395 r7398 100 100 NotificationManager::getInstance().unregisterListener(this); 101 101 NotificationManager::getInstance().unregisterQueue(this); 102 103 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() + "\")"); 102 104 } 103 105 } … … 360 362 this->targets_.clear(); 361 363 364 //TODO: Do with SubString. 362 365 std::string* pTemp; 363 366 unsigned int index = 0; -
code/branches/notifications/src/modules/notifications/NotificationQueue.h
r7395 r7398 75 75 NotificationQueue(const std::string& name, const std::string& senders = NotificationManager::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME); 76 76 virtual ~NotificationQueue(); 77 78 void destroy(void) { this->OrxonoxClass::destroy(); } // tolua_export 77 79 78 80 virtual void tick(float dt); //!< To update from time to time.
Note: See TracChangeset
for help on using the changeset viewer.