WoWInterface SVN JustTheArt

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 4 to Rev 5
    Reverse comparison

Rev 4 → Rev 5

trunk/JustTheArt.xml
1,252 → 1,206
<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>
trunk/JustTheArt.lua New file
0,0 → 1,72
local parent = InterfaceOptionsActionBarsPanel
if not parent.userControls then
parent.userControls = {}
local function insecureChildrenUpdater(message)
return function (frame)
for control, input in pairs(frame.userControls) do
local action = control[message]
local inputType = type(input)
if inputType == 'function' then
action(control, input(control, message))
elseif inputType == 'table' then
action(control, unpack(input))
else
action(control, input)
end
end
end
end
for _, message in ipairs{"okay", "cancel", "default", "refresh"} do
hooksecurefunc(parent, message, insecureChildrenUpdater(message))
end
end
 
 
local function refresh(self)
local parent = self:GetParent()
self.value = parent.options[self:GetAttribute("option")]
if self.setFunc then
self.setFunc(self.value)
end
self:SetChecked(self.value)
return self.value
end
 
local function default(self)
local parent = self:GetParent()
parent.options[self:GetAttribute("option")] = self:GetAttribute("default")
return self:refresh()
end
 
local cancel = refresh
 
local function okay(self)
local parent = self:GetParent()
local option = self:GetAttribute("option")
parent.options[option] = self.value
if self.setFunc then
self.setFunc(self.value)
end
end
 
function JustTheArtCheckBox_OnLoad(self)
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:GetParent():GetParent().userControls[self] = true
self.refresh = refresh
self.default = default
self.cancel = cancel
self.okay = okay
 
local dependsOn = self:GetAttribute("depends")
if dependsOn then
dependsOn = self:GetParent()[dependsOn];
if dependsOn then
BlizzardOptionsPanel_SetupDependentControl(dependsOn, self)
end
end
self:RegisterEvent("ADDON_LOADED")
end
\ No newline at end of file
trunk/JustTheArt.toc
1,7 → 1,8
## Interface: 30000
## Title: JustTheArt
## Version: 1.2b
## Version: 1.3b
## Notes: Allows text labels to be hidden on action buttons
## SavedVariables: JustTheArt_defaults
## SavedVariablesPerCharacter: JustTheArt_settings
JustTheArt.lua
JustTheArt.xml
\ No newline at end of file