[Orxonox-commit 3331] r8019 - in code/branches/usability/data/gui: layouts scripts
landauf at orxonox.net
landauf at orxonox.net
Sat Mar 5 17:59:17 CET 2011
Author: landauf
Date: 2011-03-05 17:59:17 +0100 (Sat, 05 Mar 2011)
New Revision: 8019
Modified:
code/branches/usability/data/gui/layouts/GraphicsMenu.layout
code/branches/usability/data/gui/scripts/GraphicsMenu.lua
Log:
two changes in graphics menu:
- fsaa and vsync are only updated if they have actually changed
- red "restart required" label is hidden again if the settings are changed back
Modified: code/branches/usability/data/gui/layouts/GraphicsMenu.layout
===================================================================
--- code/branches/usability/data/gui/layouts/GraphicsMenu.layout 2011-03-05 16:31:27 UTC (rev 8018)
+++ code/branches/usability/data/gui/layouts/GraphicsMenu.layout 2011-03-05 16:59:17 UTC (rev 8019)
@@ -131,8 +131,7 @@
</Window>
<Window Type="MenuWidgets/StaticText" Name="orxonox/Display/NoticeRed" >
<Property Name="Font" Value="BlueHighway-12" />
- <Property Name="Text" >Changing the theme, FSAA,
-or VSync requires a restart</Property>
+ <Property Name="Text" >Restart required</Property>
<Property Name="TextColours" Value="tl:FFFF0000 tr:FFFF8888 bl:FFFF8888 br:FFFFFFFF" />
<Property Name="HorzFormatting" Value="HorzCentred" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
Modified: code/branches/usability/data/gui/scripts/GraphicsMenu.lua
===================================================================
--- code/branches/usability/data/gui/scripts/GraphicsMenu.lua 2011-03-05 16:31:27 UTC (rev 8018)
+++ code/branches/usability/data/gui/scripts/GraphicsMenu.lua 2011-03-05 16:59:17 UTC (rev 8019)
@@ -91,11 +91,11 @@
-- themes combobox
local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
- local currentScheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
+ local currentTheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
for i = 0, themeCombobox:getDropList():getItemCount() - 1 do
local item = themeCombobox:getListboxItemFromIndex(i)
- themeCombobox:setItemSelectState(item, (item:getText() == currentScheme))
+ themeCombobox:setItemSelectState(item, (item:getText() == currentTheme))
end
-- vsync checkbox
@@ -113,10 +113,7 @@
end
-- notice
- local notice = winMgr:getWindow("orxonox/Display/Notice")
- notice:setVisible(true)
- local noticeRed = winMgr:getWindow("orxonox/Display/NoticeRed")
- noticeRed:setVisible(false)
+ self:updateRedLabel()
------------------
-- Settings tab --
@@ -251,11 +248,28 @@
end
end
-function P.makeLabelRed()
+function P.updateRedLabel()
+ -- theme
+ local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
+ local currentTheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
+ local themeChanged = (currentTheme ~= themeCombobox:getText())
+
+ -- vsync
+ local vsyncCheckbox = winMgr:getWindow("orxonox/Display/More/VSync")
+ local hasVSync = orxonox.GraphicsManager:getInstance():hasVSyncEnabled()
+ local vsyncChanged = (hasVSync ~= CEGUI.toCheckbox(vsyncCheckbox):isSelected())
+
+ -- fsaa
+ local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
+ local currentFSAAMode = orxonox.GraphicsManager:getInstance():getFSAAMode()
+ local fsaaChanged = (currentFSAAMode ~= fsaaCombobox:getText())
+
+ local needRestart = themeChanged or vsyncChanged or fsaaChanged
+
local notice = winMgr:getWindow("orxonox/Display/Notice")
- notice:setVisible(false)
+ notice:setVisible(not needRestart)
local noticeRed = winMgr:getWindow("orxonox/Display/NoticeRed")
- noticeRed:setVisible(true)
+ noticeRed:setVisible(needRestart)
end
---------------------
@@ -283,19 +297,19 @@
-- theme
function P.callback_ThemeCombobox_ListSelectionAccepted(e)
- P.makeLabelRed()
+ P.updateRedLabel()
end
-- vsync
function P.callback_VSyncCheckbox_CheckStateChanged(e)
- P.makeLabelRed()
+ P.updateRedLabel()
end
-- fsaa
function P.callback_FSAACombobox_ListSelectionAccepted(e)
- P.makeLabelRed()
+ P.updateRedLabel()
end
-- buttons
@@ -324,11 +338,17 @@
-- vsync
local vsyncCheckbox = winMgr:getWindow("orxonox/Display/More/VSync")
- orxonox.CommandExecutor:execute("GraphicsManager setVSync " .. tostring(CEGUI.toCheckbox(vsyncCheckbox):isSelected()))
+ local hasVSync = orxonox.GraphicsManager:getInstance():hasVSyncEnabled()
+ if hasVSync ~= CEGUI.toCheckbox(vsyncCheckbox):isSelected() then
+ orxonox.CommandExecutor:execute("GraphicsManager setVSync " .. tostring(CEGUI.toCheckbox(vsyncCheckbox):isSelected()))
+ end
-- fsaa
local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
- orxonox.CommandExecutor:execute("GraphicsManager setFSAA {" .. fsaaCombobox:getText() .. "}") -- enclose argument in { ... } because it can contain [brackets] (conflicts with tcl)
+ local currentFSAAMode = orxonox.GraphicsManager:getInstance():getFSAAMode()
+ if currentFSAAMode ~= fsaaCombobox:getText() then
+ orxonox.CommandExecutor:execute("GraphicsManager setFSAA {" .. fsaaCombobox:getText() .. "}") -- enclose argument in { ... } because it can contain [brackets] (conflicts with tcl)
+ end
-- fov
local fovEditbox = winMgr:getWindow("orxonox/Settings/Fov")
More information about the Orxonox-commit
mailing list