[Orxonox-commit 1515] r6233 - in code/branches/presentation2/data/gui: layouts scripts

cmueri at orxonox.net cmueri at orxonox.net
Thu Dec 3 20:10:07 CET 2009


Author: cmueri
Date: 2009-12-03 20:10:07 +0100 (Thu, 03 Dec 2009)
New Revision: 6233

Modified:
   code/branches/presentation2/data/gui/layouts/AudioMenu.layout
   code/branches/presentation2/data/gui/layouts/SettingsMenu.layout
   code/branches/presentation2/data/gui/scripts/AudioMenu.lua
Log:
The audio menu and all its functions are now enabled.

Modified: code/branches/presentation2/data/gui/layouts/AudioMenu.layout
===================================================================
--- code/branches/presentation2/data/gui/layouts/AudioMenu.layout	2009-12-03 18:48:42 UTC (rev 6232)
+++ code/branches/presentation2/data/gui/layouts/AudioMenu.layout	2009-12-03 19:10:07 UTC (rev 6233)
@@ -14,14 +14,14 @@
             <Property Name="HorzFormatting" Value="HorzCentred" />
             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
             <Property Name="VertFormatting" Value="TopAligned" />
-            <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.325,0},{0.85,0},{0.6,0}}" />
+            <Property Name="UnifiedAreaRect" Value="{{0.2,0},{0.325,0},{0.8,0},{0.6,0}}" />
             <Window Type="TaharezLook/StaticText" Name="orxonox/MasterVolume" >
-                <Property Name="Text" Value="Master volume" />
+                <Property Name="Text" Value="Master volume               " />
                 <Property Name="InheritsAlpha" Value="False" />
                 <Property Name="HorzFormatting" Value="HorzCentred" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="VertFormatting" Value="TopAligned" />
-                <Property Name="UnifiedAreaRect" Value="{{0.03,0},{0.2,0},{0.34,0},{0.4,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.041666,0},{0.2,0},{0.5625,0},{0.4,0}}" />
                 <Window Type="TaharezLook/HorizontalScrollbar" Name="orxonox/MasterScrollbar" >
                     <Property Name="PageSize" Value="0" />
                     <Property Name="StepSize" Value="1" />
@@ -30,19 +30,25 @@
                     <Property Name="ScrollPosition" Value="0" />
                     <Property Name="StepSize" Value="0.1" />
                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.8,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.6,0},{0.71,0},{0.8,0}}" />
                     <Event Name="ThumbTrackStarted" Function="AudioMenu.AudioMasterScrollbar_started" />
                     <Event Name="ThumbTrackEnded" Function="AudioMenu.AudioMasterScrollbar_ended" />
                     <Event Name="ScrollPosChanged" Function="AudioMenu.AudioMasterScrollbar_changed" />
                 </Window>
+                <Window Type="TaharezLook/Checkbox" Name="orxonox/MasterCheckbox" >
+                    <Property Name="Text" Value="Mute" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.775,0},{0.45,0},{0.96,0},{0.9,0}}" />
+                    <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteMasterCheckbox_clicked"/>
+                </Window>
             </Window>
             <Window Type="TaharezLook/StaticText" Name="orxonox/MusicVolume" >
-                <Property Name="Text" Value="Music volume" />
+                <Property Name="Text" Value="Music volume               " />
                 <Property Name="InheritsAlpha" Value="False" />
                 <Property Name="HorzFormatting" Value="HorzCentred" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="VertFormatting" Value="TopAligned" />
-                <Property Name="UnifiedAreaRect" Value="{{0.03,0},{0.45,0},{0.34,0},{0.65,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.041666,0},{0.45,0},{0.5625,0},{0.65,0}}" />
                 <Window Type="TaharezLook/HorizontalScrollbar" Name="orxonox/MusicScrollbar" >
                     <Property Name="PageSize" Value="0" />
                     <Property Name="StepSize" Value="1" />
@@ -51,19 +57,25 @@
                     <Property Name="ScrollPosition" Value="0" />
                     <Property Name="StepSize" Value="0.1" />
                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.8,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.6,0},{0.71,0},{0.8,0}}" />
                     <Event Name="ThumbTrackStarted" Function="AudioMenu.AudioMusicScrollbar_started" />
                     <Event Name="ThumbTrackEnded" Function="AudioMenu.AudioMusicScrollbar_ended" />
                     <Event Name="ScrollPosChanged" Function="AudioMenu.AudioMusicScrollbar_changed" />
                 </Window>
+                <Window Type="TaharezLook/Checkbox" Name="orxonox/MusicCheckbox" >
+                    <Property Name="Text" Value="Mute" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.775,0},{0.45,0},{0.96,0},{0.9,0}}" />
+                    <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteMusicCheckbox_clicked"/>
+                </Window>
             </Window>
             <Window Type="TaharezLook/StaticText" Name="orxonox/EffectsVolume" >
-                <Property Name="Text" Value="Effects volume" />
+                <Property Name="Text" Value="Effects volume               " />
                 <Property Name="InheritsAlpha" Value="False" />
                 <Property Name="HorzFormatting" Value="HorzCentred" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="VertFormatting" Value="TopAligned" />
-                <Property Name="UnifiedAreaRect" Value="{{0.03,0},{0.7,0},{0.34,0},{0.9,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.041666,0},{0.7,0},{0.5625,0},{0.9,0}}" />
                 <Window Type="TaharezLook/HorizontalScrollbar" Name="orxonox/EffectsScrollbar" >
                     <Property Name="PageSize" Value="0" />
                     <Property Name="StepSize" Value="1" />
@@ -72,11 +84,17 @@
                     <Property Name="ScrollPosition" Value="0" />
                     <Property Name="StepSize" Value="0.1" />
                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                    <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.6,0},{0.95,0},{0.8,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.6,0},{0.71,0},{0.8,0}}" />
                     <Event Name="ThumbTrackStarted" Function="AudioMenu.AudioEffectsScrollbar_started" />
                     <Event Name="ThumbTrackEnded" Function="AudioMenu.AudioEffectsScrollbar_ended" />
                     <Event Name="ScrollPosChanged" Function="AudioMenu.AudioEffectsScrollbar_changed" />
                 </Window>
+                <Window Type="TaharezLook/Checkbox" Name="orxonox/EffectsCheckbox" >
+                    <Property Name="Text" Value="Mute" />
+                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+                    <Property Name="UnifiedAreaRect" Value="{{0.775,0},{0.45,0},{0.96,0},{0.9,0}}" />
+                    <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteEffectsCheckbox_clicked"/>
+                </Window>
             </Window>
             <Window Type="TaharezLook/StaticText" Name="orxonox/AudioTheme" >
                 <Property Name="Text" Value="Theme" />
@@ -84,7 +102,7 @@
                 <Property Name="HorzFormatting" Value="HorzCentred" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="VertFormatting" Value="TopAligned" />
-                <Property Name="UnifiedAreaRect" Value="{{0.66,0},{0.2,0},{0.97,0},{0.9,0}}" />
+                <Property Name="UnifiedAreaRect" Value="{{0.604166,0},{0.2,0},{0.958333,0},{0.9,0}}" />
                 <Window Type="TaharezLook/Combobox" Name="orxonox/AudioThemeCombobox" >
                     <Property Name="AlwaysOnTop" Value="True" />
                     <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
@@ -94,24 +112,6 @@
                     <Event Name="ListSelectionAccepted" Function="AudioMenu.AudioThemeCombobox_changed" />
                 </Window>
             </Window>
-            <Window Type="TaharezLook/Checkbox" Name="orxonox/MasterCheckbox" >
-                <Property Name="Text" Value="Mute master" />
-                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="UnifiedAreaRect" Value="{{0.375,0},{0.275,0},{0.625,0},{0.375,0}}" />
-                <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteMasterCheckbox_clicked"/>
-            </Window>
-            <Window Type="TaharezLook/Checkbox" Name="orxonox/MusicCheckbox" >
-                <Property Name="Text" Value="Mute music" />
-                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="UnifiedAreaRect" Value="{{0.375,0},{0.525,0},{0.625,0},{0.625,0}}" />
-                <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteMusicCheckbox_clicked"/>
-            </Window>
-            <Window Type="TaharezLook/Checkbox" Name="orxonox/EffectsCheckbox" >
-                <Property Name="Text" Value="Mute effects" />
-                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-                <Property Name="UnifiedAreaRect" Value="{{0.375,0},{0.775,0},{0.625,0},{0.875,0}}" />
-                <Event Name="CheckStateChanged" Function="AudioMenu.AudioMuteEffectsCheckbox_clicked"/>
-            </Window>
         </Window>
         <Window Type="TaharezLook/Button" Name="orxonox/AudioBackButton" >
             <Property Name="Text" Value="Back" />
@@ -119,14 +119,5 @@
             <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.625,0},{0.6,0},{0.675,0}}" />
             <Event Name="Clicked" Function="AudioMenu.AudioBackButton_clicked"/>
         </Window>
-        <Window Type="TaharezLook/StaticText" Name="orxonox/AudioAvailable" >
-            <Property Name="Text" Value="Changes in audio settings are not yet available." />
-            <Property Name="TextColours" Value="FFFF0000" />
-            <Property Name="InheritsAlpha" Value="False" />
-            <Property Name="HorzFormatting" Value="HorzCentred" />
-            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
-            <Property Name="VertFormatting" Value="TopAligned" />
-            <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.75,0},{0.75,0},{0.8,0}}" />
-        </Window>
     </Window>
 </GUILayout>

Modified: code/branches/presentation2/data/gui/layouts/SettingsMenu.layout
===================================================================
--- code/branches/presentation2/data/gui/layouts/SettingsMenu.layout	2009-12-03 18:48:42 UTC (rev 6232)
+++ code/branches/presentation2/data/gui/layouts/SettingsMenu.layout	2009-12-03 19:10:07 UTC (rev 6233)
@@ -25,6 +25,7 @@
             </Window>
             <Window Type="TaharezLook/Button" Name="orxonox/MultiplayerOptionsButton" >
                 <Property Name="Text" Value="Multiplayer options" />
+                <Property Name="Disabled" Value="True" />
                 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
                 <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.454545,0},{0.45,0},{0.636363,0}}" />
                 <Event Name="Clicked" Function="SettingsMenu.SettingsMultiplayerOptionsButton_clicked"/>

Modified: code/branches/presentation2/data/gui/scripts/AudioMenu.lua
===================================================================
--- code/branches/presentation2/data/gui/scripts/AudioMenu.lua	2009-12-03 18:48:42 UTC (rev 6232)
+++ code/branches/presentation2/data/gui/scripts/AudioMenu.lua	2009-12-03 19:10:07 UTC (rev 6233)
@@ -13,34 +13,51 @@
 
 function P:init()
     soundMgr = orxonox.SoundManager:getInstance()
+    block = false
     masterscrollbar_active = false
     musicscrollbar_active = false
     effectsscrollbar_active = false
     mastervolume = soundMgr:getVolume(orxonox.SoundType.none)
     musicvolume = soundMgr:getVolume(orxonox.SoundType.ambient)
     effectsvolume = soundMgr:getVolume(orxonox.SoundType.effects)
-    window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
-    window:setScrollPosition(mastervolume)
-    window = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
-    window:setScrollPosition(musicvolume)
-    window = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")
-    window:setScrollPosition(effectsvolume)
-    dropdown = winMgr:getWindow("orxonox/AudioThemeCombobox")
+    mastermute = soundMgr:getMute(orxonox.SoundType.none)
+    musicmute = soundMgr:getMute(orxonox.SoundType.ambient)
+    effectsmute = soundMgr:getMute(orxonox.SoundType.effects)
+    masterscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
+    musicscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
+    effectsscrollbarwindow = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")
+    mastermutewindow = tolua.cast(winMgr:getWindow("orxonox/MasterCheckbox"),"CEGUI::Checkbox")
+    musicmutewindow = tolua.cast(winMgr:getWindow("orxonox/MusicCheckbox"),"CEGUI::Checkbox")
+    effectsmutewindow = tolua.cast(winMgr:getWindow("orxonox/EffectsCheckbox"),"CEGUI::Checkbox")
+    masterscrollbarwindow:setScrollPosition(mastervolume)
+    musicscrollbarwindow:setScrollPosition(musicvolume)
+    effectsscrollbarwindow:setScrollPosition(effectsvolume)
+    mastermutewindow:setSelected(mastermute)
+    musicmutewindow:setSelected(musicmute)
+    effectsmutewindow:setSelected(effectsmute)
+    choice = "Default"
+    dropdownwindow = winMgr:getWindow("orxonox/AudioThemeCombobox")
     local themeList = {}
     table.insert(themeList, "Default")
     table.insert(themeList, "Drum n' Bass")
     for k,v in pairs(themeList) do
         item = CEGUI.createListboxTextItem(v)        
         item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
-        CEGUI.toCombobox(dropdown):addItem(item)
+        CEGUI.toCombobox(dropdownwindow):addItem(item)
     end
+    dropdownwindow:setItemSelectState(0,true)
 end
 
 function P.AudioMasterScrollbar_changed(e)
+    if mastermute then
+        block = true
+        mastermutewindow:setSelected(false)
+        block = false
+        mastermute = false
+    end
     if masterscrollbar_active == false then
-        window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
-        volume = window:getScrollPosition()
-        orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. volume)
+        mastervolume = masterscrollbarwindow:getScrollPosition()
+        orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. mastervolume)
     end
 end
 
@@ -49,17 +66,21 @@
 end
 
 function P.AudioMasterScrollbar_ended(e)
-    window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
-    volume = window:getScrollPosition()
-    orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. volume)
+    mastervolume = masterscrollbarwindow:getScrollPosition()
+    orxonox.CommandExecutor:execute("config SoundManager soundVolume_ " .. mastervolume)
     masterscrollbar_active = false
 end
 
 function P.AudioMusicScrollbar_changed(e)
+    if musicmute then
+        block = true
+        musicmutewindow:setSelected(false)
+        block = false
+        musicmute = false
+    end
     if musicscrollbar_active == false then
-        window = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
-        volume = window:getScrollPosition()
-        orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. volume)
+        musicvolume = musicscrollbarwindow:getScrollPosition()
+        orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. musicvolume)
     end
 end
 
@@ -68,17 +89,22 @@
 end
 
 function P.AudioMusicScrollbar_ended(e)
-    window = tolua.cast(winMgr:getWindow("orxonox/MusicScrollbar"),"CEGUI::Scrollbar")
-    volume = window:getScrollPosition()
-    orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. volume)
+    musicmutewindow:setSelected(false)
+    musicvolume = musicscrollbarwindow:getScrollPosition()
+    orxonox.CommandExecutor:execute("config SoundManager ambientVolume_ " .. musicvolume)
     musicscrollbar_active = false
 end
 
 function P.AudioEffectsScrollbar_changed(e)
+    if effectsmute then
+        block = true
+        effectsmutewindow:setSelected(false)
+        block = false
+        effectsmute = false
+    end
     if effectsscrollbar_active == false then
-        window = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")
-        volume = window:getScrollPosition()
-        orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. volume)
+        effectsvolume = effectsscrollbarwindow:getScrollPosition()
+        orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. effectsvolume)
     end
 end
 
@@ -87,39 +113,63 @@
 end
 
 function P.AudioEffectsScrollbar_ended(e)
-    window = tolua.cast(winMgr:getWindow("orxonox/EffectsScrollbar"),"CEGUI::Scrollbar")
-    volume = window:getScrollPosition()
-    orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. volume)
+    effectsmutewindow:setSelected(false)
+    effectsvolume = effectsscrollbarwindow:getScrollPosition()
+    orxonox.CommandExecutor:execute("config SoundManager effectsVolume_ " .. effectsvolume)
     effectsscrollbar_active = false
 end
 
 function P.AudioMuteMasterCheckbox_clicked(e)
---    if
---        mastervolume = soundMgr:getVolume(orxonox.SoundType.none)
---        window = tolua.cast(winMgr:getWindow("orxonox/MasterScrollbar"),"CEGUI::Scrollbar")
---        window:setScrollPosition(0)
---    end
-    soundMgr:toggleMute(orxonox.SoundType.none)
+    if block == false then
+        if mastermute then
+            masterscrollbarwindow:setScrollPosition(mastervolume)
+            mastermute = false
+        else
+            temp = masterscrollbarwindow:getScrollPosition()
+            masterscrollbarwindow:setScrollPosition(0)
+            mastervolume = temp
+            mastermute = true
+        end
+        soundMgr:toggleMute(orxonox.SoundType.none)
+    end
 end
 
 function P.AudioMuteMusicCheckbox_clicked(e)
-    soundMgr:toggleMute(orxonox.SoundType.ambient)
+    if block == false then
+        if musicmute then
+            musicscrollbarwindow:setScrollPosition(musicvolume)
+            musicmute = false
+        else
+            temp = musicscrollbarwindow:getScrollPosition()
+            musicscrollbarwindow:setScrollPosition(0)
+            musicvolume = temp
+            musicmute = true
+        end
+        soundMgr:toggleMute(orxonox.SoundType.ambient)
+    end
 end
 
 function P.AudioMuteEffectsCheckbox_clicked(e)
-    soundMgr:toggleMute(orxonox.SoundType.effects)
+    if block == false then
+        if effectsmute then
+            effectsscrollbarwindow:setScrollPosition(effectsvolume)
+            effectsmute = false
+        else
+            temp = effectsscrollbarwindow:getScrollPosition()
+            effectsscrollbarwindow:setScrollPosition(0)
+            effectsvolume = temp
+            effectsmute = true
+        end
+        soundMgr:toggleMute(orxonox.SoundType.effects)
+    end
 end
 
 function P.AudioThemeCombobox_changed(e)
---    local choice = winMgr:getWindow("orxonox/AudioThemeCombobox"):getFirstSelectedItem()
---    if choice == "Default" then
---        orxonox.CommandExecutor:execute("setMood default")
---        debug("default selected")
---    end
---    if choice == "Drum 'n Bass" then
---        orxonox.CommandExecutor:execute("setMood dnb")
---        debug("dnb selected")
---    end
+    if dropdownwindow:isItemSelected(1) then
+        orxonox.CommandExecutor:execute("setMood dnb")
+    else
+        orxonox.CommandExecutor:execute("setMood default")
+    end
 end
 
 function P.AudioBackButton_clicked(e)




More information about the Orxonox-commit mailing list