Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 5, 2011, 5:59:17 PM (13 years ago)
Author:
landauf
Message:

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
Location:
code/branches/usability/data/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/data/gui/layouts/GraphicsMenu.layout

    r8018 r8019  
    132132                    <Window Type="MenuWidgets/StaticText" Name="orxonox/Display/NoticeRed" >
    133133                        <Property Name="Font" Value="BlueHighway-12" />
    134                         <Property Name="Text" >Changing the theme, FSAA,
    135 or VSync requires a restart</Property>
     134                        <Property Name="Text" >Restart required</Property>
    136135                        <Property Name="TextColours" Value="tl:FFFF0000 tr:FFFF8888 bl:FFFF8888 br:FFFFFFFF" />
    137136                        <Property Name="HorzFormatting" Value="HorzCentred" />
  • code/branches/usability/data/gui/scripts/GraphicsMenu.lua

    r8018 r8019  
    9292    -- themes combobox
    9393    local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
    94     local currentScheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
     94    local currentTheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
    9595
    9696    for i = 0, themeCombobox:getDropList():getItemCount() - 1 do
    9797        local item = themeCombobox:getListboxItemFromIndex(i)
    98         themeCombobox:setItemSelectState(item, (item:getText() == currentScheme))
     98        themeCombobox:setItemSelectState(item, (item:getText() == currentTheme))
    9999    end
    100100
     
    114114
    115115    -- notice
    116     local notice = winMgr:getWindow("orxonox/Display/Notice")
    117     notice:setVisible(true)
    118     local noticeRed = winMgr:getWindow("orxonox/Display/NoticeRed")
    119     noticeRed:setVisible(false)
     116    self:updateRedLabel()
    120117
    121118    ------------------
     
    252249end
    253250
    254 function P.makeLabelRed()
     251function P.updateRedLabel()
     252    -- theme
     253    local themeCombobox = winMgr:getWindow("orxonox/Display/Theme/Combobox")
     254    local currentTheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
     255    local themeChanged = (currentTheme ~= themeCombobox:getText())
     256
     257    -- vsync
     258    local vsyncCheckbox = winMgr:getWindow("orxonox/Display/More/VSync")
     259    local hasVSync = orxonox.GraphicsManager:getInstance():hasVSyncEnabled()
     260    local vsyncChanged = (hasVSync ~= CEGUI.toCheckbox(vsyncCheckbox):isSelected())
     261
     262    -- fsaa
     263    local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
     264    local currentFSAAMode = orxonox.GraphicsManager:getInstance():getFSAAMode()
     265    local fsaaChanged = (currentFSAAMode ~= fsaaCombobox:getText())
     266
     267    local needRestart = themeChanged or vsyncChanged or fsaaChanged
     268
    255269    local notice = winMgr:getWindow("orxonox/Display/Notice")
    256     notice:setVisible(false)
     270    notice:setVisible(not needRestart)
    257271    local noticeRed = winMgr:getWindow("orxonox/Display/NoticeRed")
    258     noticeRed:setVisible(true)
     272    noticeRed:setVisible(needRestart)
    259273end
    260274
     
    284298
    285299function P.callback_ThemeCombobox_ListSelectionAccepted(e)
    286     P.makeLabelRed()
     300    P.updateRedLabel()
    287301end
    288302
     
    290304
    291305function P.callback_VSyncCheckbox_CheckStateChanged(e)
    292     P.makeLabelRed()
     306    P.updateRedLabel()
    293307end
    294308
     
    296310
    297311function P.callback_FSAACombobox_ListSelectionAccepted(e)
    298     P.makeLabelRed()
     312    P.updateRedLabel()
    299313end
    300314
     
    325339    -- vsync
    326340    local vsyncCheckbox = winMgr:getWindow("orxonox/Display/More/VSync")
    327     orxonox.CommandExecutor:execute("GraphicsManager setVSync " .. tostring(CEGUI.toCheckbox(vsyncCheckbox):isSelected()))
     341    local hasVSync = orxonox.GraphicsManager:getInstance():hasVSyncEnabled()
     342    if hasVSync ~= CEGUI.toCheckbox(vsyncCheckbox):isSelected() then
     343        orxonox.CommandExecutor:execute("GraphicsManager setVSync " .. tostring(CEGUI.toCheckbox(vsyncCheckbox):isSelected()))
     344    end
    328345
    329346    -- fsaa
    330347    local fsaaCombobox = winMgr:getWindow("orxonox/Display/More/FSAA")
    331     orxonox.CommandExecutor:execute("GraphicsManager setFSAA {" .. fsaaCombobox:getText() .. "}") -- enclose argument in { ... } because it can contain [brackets] (conflicts with tcl)
     348    local currentFSAAMode = orxonox.GraphicsManager:getInstance():getFSAAMode()
     349    if currentFSAAMode ~= fsaaCombobox:getText() then
     350        orxonox.CommandExecutor:execute("GraphicsManager setFSAA {" .. fsaaCombobox:getText() .. "}") -- enclose argument in { ... } because it can contain [brackets] (conflicts with tcl)
     351    end
    332352
    333353    -- fov
Note: See TracChangeset for help on using the changeset viewer.