<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">
- <Script>
- function JustTheArt_GetOption( self )
- local parent = self:GetParent()
- local option = parent.options[self:GetAttribute("option")]
- self.value = option and "1" or "0" |
self:SetChecked(option)
- return self.value
- end
-
- function JustTheArt_SetOption( self, value )
- if type(value) == 'boolean' then |
self.value = value and "1" or "0" |
else |
self.value = value |
value = tonumber(value) == 1 |
end
- local parent = self:GetParent()
- local option = self:GetAttribute("option")
- parent.options[option] = value
- parent.defaults[option] = value
- if self.setFunc then
- self.setFunc(value)
- end
- end
- </Script>
- <CheckButton name="JustTheArtCheckBox" inherits="InterfaceOptionsSmallCheckButtonTemplate" virtual="true">
- <Scripts>
- <OnLoad>
- self.Text = _G[self:GetName().."Text"]
- self.Text:SetText(self:GetAttribute("text"))
- self.tooltipText = self:GetAttribute("tooltiptext")
- self.defaultValue = self:GetAttribute("default")
- BlizzardOptionsPanel_RegisterControl(self, self:GetParent():GetParent())
- self.GetValue = JustTheArt_GetOption
- self.SetValue = JustTheArt_SetOption
- local dependsOn = self:GetAttribute("depends")
- if dependsOn then
- dependsOn = _G[self:GetParent():GetName()..dependsOn];
- if dependsOn then
- BlizzardOptionsPanel_SetupDependentControl(dependsOn, self)
- end
- end
- self:RegisterEvent("ADDON_LOADED")
- </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:SetValue(checked)
- </OnClick>
- </Scripts>
- </CheckButton>
- <Frame name="JustTheArt" parent="InterfaceOptionsActionBarsPanel">
- <Size x="100" y="75" />
- <Anchors>
- <Anchor point="TOPLEFT" relativeTo="$parentSecureAbilityToggle" relativePoint="BOTTOMLEFT">
- <Offset>
- <AbsDimension x="0" y="-12" />
- </Offset>
- </Anchor>
- </Anchors>
- <Layers>
- <Layer level="ARTWORK">
- <FontString name="$parentLabel" inherits="GameFontHighlight" justifyH="RIGHT">
- <Anchors>
- <Anchor point="TOPLEFT" />
- </Anchors>
- </FontString>
- </Layer>
- </Layers>
- <Frames>
- <CheckButton name="$parentMacros" inherits="JustTheArtCheckBox" hidden="false">
- <Anchors>
- <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentLabel">
- <Offset>
- <AbsDimension x="0" y="-8"/>
- </Offset>
- </Anchor>
- </Anchors>
- <Attributes>
- <Attribute name="text" value="Macro Names" />
- <Attribute name="option" value="hide-macros" />
- <Attribute name="default" value="1" />
- </Attributes>
- <Scripts>
- <OnEvent>
- 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" inherits="JustTheArtCheckBox" hidden="false">
- <Anchors>
- <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentMacros">
- <Offset>
- <AbsDimension x="0" y="-2"/>
- </Offset>
- </Anchor>
- </Anchors>
- <Attributes>
- <Attribute name="text" value="Reagent Counts" />
- <Attribute name="option" value="hide-counts" />
- </Attributes>
- <Scripts>
- <OnEvent>
- 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" inherits="JustTheArtCheckBox" hidden="false">
- <Anchors>
- <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentCounts">
- <Offset>
- <AbsDimension x="0" y="-2"/>
- </Offset>
- </Anchor>
- </Anchors>
- <Attributes>
- <Attribute name="text" value="Key Bindings" />
- <Attribute name="option" value="range-only" />
- <Attribute name="default" value="1" />
- </Attributes>
- <Scripts>
- <OnEvent>
- function self.setFunc(value)
- if type(value) ~= 'boolean' then value = tonumber(value) ~= 0; end |
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" inherits="JustTheArtCheckBox" hidden="false">
- <Anchors>
- <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parentHotKeys">
- <Offset>
- <AbsDimension x="16" y="-2"/>
- </Offset>
- </Anchor>
- </Anchors>
- <Attributes>
- <Attribute name="text" value="Range Markers" />
- <Attribute name="option" value="hide-ranges" />
- <Attribute name="depends" value="HotKeys" />
- </Attributes>
- <Scripts>
- <OnEvent>
- function self:Disable()
- self:SetValue(false)
- getmetatable(self).__index.Disable(self)
- end
- </OnEvent>
- </Scripts>
- </CheckButton>
- </Frames>
- <Scripts>
- <OnLoad>
- _G[self:GetName().."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_defaults = JustTheArt_defaults or {["hide-macros"] = true, ["range-only"] = true}
- self.defaults = JustTheArt_defaults
- JustTheArt_options = JustTheArt_options or JustTheArt_defaults
- self.options = 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:GetValue())
- JustTheArtCounts.setFunc(JustTheArtCounts:GetValue())
- JustTheArtHotKeys.setFunc(JustTheArtHotKeys:GetValue())
- JustTheArtRange:GetValue()
- </OnEvent>
- </Scripts>
- </Frame>
-</Ui>
+<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> |