WoWInterface SVN JustTheArt

[/] [trunk/] [JustTheArt/] [JustTheArt.xml] - Rev 9

Compare with Previous | Blame | View Log

<Ui 
        xmlns="http://www.blizzard.com/wow/ui/" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\UI.xsd">
        <CheckButton name="JustTheArtCheckBox" inherits="InterfaceOptionsSmallCheckButtonTemplate" virtual="true">
                <Scripts>
                        <OnLoad function="JustTheArtCheckBox_OnLoad" />
                        <OnClick>
                                local checked = self:GetChecked()
                                if ( checked ) then
                                        PlaySound("igMainMenuOptionCheckBoxOn");
                                else
                                        PlaySound("igMainMenuOptionCheckBoxOff");
                                end
                                if ( self.dependentControls ) then
                                        if ( checked ) then
                                                for _, control in next, self.dependentControls do
                                                        control:Enable();
                                                end
                                        else
                                                for _, control in next, self.dependentControls do
                                                        control:Disable();
                                                end
                                        end
                                end
                                if self.invert then checked = not checked; end
                                self.value = checked
                                if self.setFunc then
                                        self.setFunc(checked)
                                end
                        </OnClick>
                </Scripts>
        </CheckButton>
        <Frame name="JustTheArt" parent="InterfaceOptionsActionBarsPanel">
                <Size x="100" y="75" />
                <Anchors>
                        <Anchor point="TOPLEFT" relativeTo="$parentSecureAbilityToggle" relativePoint="BOTTOMLEFT">
                                <Offset x="0" y="-12" />
                        </Anchor>
                </Anchors>
                <Layers>
                        <Layer level="ARTWORK">
                                <FontString name="$parentLabel" parentKey="Label" inherits="GameFontHighlight" justifyH="RIGHT">
                                        <Anchors>
                                                <Anchor point="TOPLEFT" />
                                        </Anchors>
                                </FontString>
                        </Layer>
                </Layers>
                <Frames>
                        <CheckButton name="$parentMacros" parentKey="Macros" inherits="JustTheArtCheckBox" hidden="false">
                                <Anchors>
                                        <Anchor  point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentLabel">
                                                <Offset x="0" y="-8"/>
                                        </Anchor>
                                </Anchors>
                                <Attributes>
                                        <Attribute name="text" value="Macro Names" />
                                        <Attribute name="option" value="hide-macros" />
                                        <Attribute name="default" value="true" type="boolean" />
                                </Attributes>
                                <Scripts>
                                        <OnEvent>
                                                if (...) ~= "JustTheArt" then return; end
                                                function self.setFunc(value)
                                                        local fixLabel = (value and tonumber(value) ~= 0) and 'Hide' or 'Show'
                                                        for bar, buttons in pairs(self:GetParent().bars) do
                                                                for j, button in ipairs(buttons) do
                                                                        if button.action then
                                                                                local label = button.Name
                                                                                label[fixLabel](label)
                                                                        end
                                                                end
                                                        end
                                                end
                                        </OnEvent>
                                </Scripts>
                        </CheckButton>
                        <CheckButton name="$parentCounts" parentKey="Counts" inherits="JustTheArtCheckBox" hidden="false">
                                <Anchors>
                                        <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentMacros">
                                                <Offset x="0" y="-2"/>
                                        </Anchor>
                                </Anchors>
                                <Attributes>
                                        <Attribute name="text" value="Reagent Counts" />
                                        <Attribute name="option" value="hide-counts" />
                                </Attributes>
                                <Scripts>
                                        <OnEvent>
                                                if (...) ~= "JustTheArt" then return; end
                                                function self.setFunc(value)
                                                        local fixLabel = (value and tonumber(value) ~= 0) and 'Hide' or 'Show'
                                                        for bar, buttons in pairs(self:GetParent().bars) do
                                                                for j, button in ipairs(buttons) do
                                                                        if button.action then
                                                                                local label = button.Count
                                                                                label[fixLabel](label)
                                                                        end
                                                                end
                                                        end
                                                end
                                        </OnEvent>
                                </Scripts>
                        </CheckButton>
                        <CheckButton name="$parentHotKeys" parentKey="HotKeys" inherits="JustTheArtCheckBox" hidden="false">
                                <Anchors>
                                        <Anchor  point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentCounts">
                                                <Offset x="0" y="-2"/>
                                        </Anchor>
                                </Anchors>
                                <Attributes>
                                        <Attribute name="text" value="Key Bindings" />
                                        <Attribute name="option" value="range-only" />
                                        <Attribute name="default" value="true" type="boolean" />
                                </Attributes>
                                <Scripts>
                                        <OnEvent>
                                                if (...) ~= "JustTheArt" then return; end
                                                function self.setFunc(value)
                                                        for bar, buttons in pairs(self:GetParent().bars) do
                                                                for j, button in ipairs(buttons) do
                                                                        if button.action then
                                                                                button.HotKey:SetText(value and RANGE_INDICATOR or button._bindtext)
                                                                                if (not value) and button._bindtext ~= RANGE_INDICATOR then
                                                                                        button.HotKey:Show()
                                                                                end
                                                                        end
                                                                end
                                                        end
                                                end
                                        </OnEvent>
                                </Scripts>
                        </CheckButton>
                        <CheckButton name="$parentRange" parentKey="Range" inherits="JustTheArtCheckBox" hidden="false">
                                <Anchors>
                                        <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentHotKeys">
                                                <Offset x="16" y="-2"/>
                                        </Anchor>
                                </Anchors>
                                <Attributes>
                                        <Attribute name="text" value="Range Markers" />
                                        <Attribute name="option" value="hide-ranges" />
                                        <Attribute name="depends" value="HotKeys" />
                                </Attributes>
                                <Scripts>
                                        <OnEvent>
                                                if (...) ~= "JustTheArt" then return; end
                                                function self:Disable()
                                                        self:default()
                                                        getmetatable(self).__index.Disable(self)
                                                end
                                        </OnEvent>
                                </Scripts>
                        </CheckButton>
                </Frames>
                <Scripts>
                        <OnLoad>
                                self.Label:SetText("Hide with JustTheArt:")
                                self:RegisterEvent("VARIABLES_LOADED")
                                self.bars = {}
                                for i, bar in ipairs{ MainMenuBarArtFrame, BonusActionBarFrame, MultiBarBottomLeft, MultiBarBottomRight, MultiBarLeft, MultiBarRight, VehicleMenuBarActionButtonFrame } do
                                        self.bars[bar] = {bar:GetChildren()}
                                        for j,button in ipairs(self.bars[bar]) do
                                                if button.action then
                                                        local name = button:GetName()
                                                        button.Name = _G[name.."Name"]
                                                        button.HotKey = _G[name.."HotKey"]
                                                        button.Count = _G[name.."Count"]
                                                        button._bindtext = button.HotKey:GetText()
                                                end
                                        end
                                end
                        </OnLoad>
                        <OnEvent>
                                JustTheArt_options = JustTheArt_options or JustTheArt_defaults or {["hide-macros"] =  true, ["range-only"] = true}
                                self.options = JustTheArt_options
                                JustTheArt_defaults = JustTheArt_options
                                hooksecurefunc("ActionButton_UpdateHotkeys", 
                                        function (self, actionButtonType)
                                                if self.HotKey then
                                                        self._bindtext = self.HotKey:GetText()
        
                                                        if JustTheArt_options["range-only"] then
                                                                self.HotKey:SetText(RANGE_INDICATOR)
                                                                self.HotKey:SetPoint("TOPLEFT", self, "TOPLEFT", 1, -2);
                                                        end
                                                end
                                        end
                                )
                                hooksecurefunc("ActionButton_OnUpdate",
                                        function (self, elapsed)
                                                if JustTheArt_options["hide-ranges"] then
                                                        self.HotKey:Hide()
                                                end
                                        end
                                )
                                JustTheArtMacros.setFunc(JustTheArtMacros:refresh())
                                JustTheArtCounts.setFunc(JustTheArtCounts:refresh())
                                JustTheArtHotKeys.setFunc(JustTheArtHotKeys:refresh())
                                JustTheArtRange:refresh()
                        </OnEvent>
                </Scripts>
        </Frame>
</Ui>

Compare with Previous | Blame