[Orxonox-commit 3697] r8378 - in code/branches/tutoriallevel2: data/gui/scripts src/modules/notifications src/orxonox/interfaces
dafrick at orxonox.net
dafrick at orxonox.net
Mon May 2 13:58:12 CEST 2011
Author: dafrick
Date: 2011-05-02 13:58:12 +0200 (Mon, 02 May 2011)
New Revision: 8378
Modified:
code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua
code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.cc
code/branches/tutoriallevel2/src/orxonox/interfaces/NotificationListener.h
Log:
Notification text alignment can be set per queue.
Modified: code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua 2011-05-02 11:33:24 UTC (rev 8377)
+++ code/branches/tutoriallevel2/data/gui/scripts/NotificationLayer.lua 2011-05-02 11:58:12 UTC (rev 8378)
@@ -31,6 +31,7 @@
["visible"] = false,
["fontSize"] = 12,
["fontColor"] = "FFFFFFFF",
+ ["alignment"] = "LeftAligned",
["items"] = {},
["first"] = 1,
["last"] = 1
@@ -78,6 +79,7 @@
item:setProperty("InheritsAlpha", "false")
item:setProperty("BackgroundEnabled", "false")
item:setProperty("FrameEnabled", "false")
+ item:setProperty("HorzFormatting", queue.alignment)
queue.items[queue.last] = item
queue.last = queue.last+1
@@ -214,6 +216,21 @@
end
end
+function P.changeQueueAlignment(queueName, alignment)
+ local queue = P.queueList[queueName]
+ local queueWindow = queue.window
+ if queueWindow == nil then
+ return
+ end
+
+ queue.alignment = alignment
+ local item = nil
+ for i=queue.first,queue.last-1 do
+ item = queue.items[i]
+ item:setProperty("HorzFormatting", queue.alignment)
+ end
+end
+
-- Helper function to set the font size and color of a item of a queue.
-- The parameters are (in order) 'the ListboxItem', 'the queue table', 'whether color should be changed as well'
function P.setItemFontHelper(item, queue, changeColor)
@@ -227,7 +244,6 @@
end
if changeColor then
item:setProperty("TextColours", "tl:" .. queue.fontColor .. " tr:" .. queue.fontColor .. " bl:" .. queue.fontColor .. " br:" .. queue.fontColor .. "")
- cout(0, "tl:[" .. queue.fontColor .. "] tr:[" .. queue.fontColor .. "] bl:[" .. queue.fontColor .. "] br:[" .. queue.fontColor .. "]")
end
end
Modified: code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.cc 2011-05-02 11:33:24 UTC (rev 8377)
+++ code/branches/tutoriallevel2/src/modules/notifications/NotificationManager.cc 2011-05-02 11:58:12 UTC (rev 8378)
@@ -366,6 +366,7 @@
GUIManager::getInstance().getLuaState()->doString("NotificationLayer.changeQueueFont(\"info\", 24, \"FFFFFF00\")");
GUIManager::getInstance().getLuaState()->doString("NotificationLayer.resizeQueue(\"info\", 0.6, 0, " + multi_cast<std::string>(infoQueue->getMaxSize()) + ")");
GUIManager::getInstance().getLuaState()->doString("NotificationLayer.moveQueue(\"info\", 0.2, 0, 0.8, 0)");
+ GUIManager::getInstance().getLuaState()->doString("NotificationLayer.changeQueueAlignment(\"info\", \"HorzCentred\")");
}
/**
Modified: code/branches/tutoriallevel2/src/orxonox/interfaces/NotificationListener.h
===================================================================
--- code/branches/tutoriallevel2/src/orxonox/interfaces/NotificationListener.h 2011-05-02 11:33:24 UTC (rev 8377)
+++ code/branches/tutoriallevel2/src/orxonox/interfaces/NotificationListener.h 2011-05-02 11:58:12 UTC (rev 8378)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabian 'x3n' Landau
+ * Damian 'Mozork' Frick
* Co-authors:
* ...
*
@@ -65,6 +65,7 @@
};
}
+ // TODO: Update doc.
/**
@brief
NotificationListener interface.
@@ -73,8 +74,8 @@
When inheriting from a NotificationListener it is important to register (in the constructor) and unregister (in the destructor) it to and from the @ref orxonox::NotificationManager "NotificationManager".
@author
- Fabian 'x3n' Landau
-
+ Damian 'Mozork' Frick
+
@ingroup Notifications
*/
class _OrxonoxExport NotificationListener : virtual public OrxonoxClass
@@ -89,8 +90,7 @@
static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, notificationMessageMode::Value messageMode = notificationMessageMode::message, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0);
static void sendNotificationHelper(const std::string& message, const std::string& sender, unsigned int messageMode);
- virtual bool registerNotification(const std::string& message, const std::string& sender)
- { return false; }
+ virtual bool registerNotification(const std::string& message, const std::string& sender) { return false; }
virtual void executeCommand(const std::string& command, const std::string& sender) {}
};
}
More information about the Orxonox-commit
mailing list