Skip to content

Commit

Permalink
Added Interface Options panel. (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrogaski committed Feb 10, 2014
1 parent 9a67c90 commit cdef0b9
Show file tree
Hide file tree
Showing 2 changed files with 121 additions and 127 deletions.
224 changes: 100 additions & 124 deletions GreenWall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,133 +37,109 @@
<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/
C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
<Script file="GreenWall_Core.lua"/>
<Frame name="GreenWallCoreFrame">
<Scripts>
<OnLoad>GreenWall_OnLoad(self);</OnLoad>
<OnEvent>GreenWall_OnEvent(self, event, ...);</OnEvent>
<OnShow>GreenWallInterfaceFrame_OnShow(self);</OnShow></Scripts>
<Layers>
<Layer level="OVERLAY">
<FontString name="$parentTitle" text="GreenWall" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="16" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentSubText" text="These options affect the communications between co-guilds in a GreenWall confederation. However, you do not need to configure anything to use GreenWall." inherits="GameFontHighlightSmall" nonspacewrap="true" maxLines="3" justifyH="LEFT" justifyV="TOP">
<Size>
<AbsDimension y="32" x="0"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="-32" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<CheckButton name="$parentOptionTag" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText"
<Script file="GreenWall_Core.lua"/>
<Frame name="GreenWallInterfaceFrame">
<Scripts>
<OnLoad>GreenWall_OnLoad(self);</OnLoad>
<OnEvent>GreenWall_OnEvent(self, event, ...);</OnEvent>
<OnShow>GreenWallInterfaceFrame_OnShow(self);</OnShow>
</Scripts>
<Layers>
<Layer level="OVERLAY">
<FontString name="$parentTitle" text="GreenWall" inherits="GameFontNormalLarge" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="16" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentSubText" text="These options affect the communications between co-guilds in a GreenWall confederation. However, you do not need to configure anything to use GreenWall." inherits="GameFontHighlightSmall" nonspacewrap="true" maxLines="3" justifyH="LEFT" justifyV="TOP">
<Size>
<AbsDimension y="32" x="0"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTitle" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
<Anchor point="RIGHT">
<Offset>
<AbsDimension x="-32" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<CheckButton name="$parentOptionTag" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentSubText"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="-2" y="-8"></AbsDimension></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Show Co-Guild Tags");</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentOptionAchievements" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionTag"
<Offset>
<AbsDimension x="-2" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Show Co-Guild Tags");</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentOptionAchievements" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionTag"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"></AbsDimension></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Show Co-Guild Achievement Announcements");</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentOptionRoster" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionAchievements"
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Show Co-Guild Achievement Announcements");</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentOptionRoster" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionAchievements"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"></AbsDimension></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Show Co-Guild Roster Announcements");</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentOptionRank" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionRoster"
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Show Co-Guild Roster Announcements");</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentOptionRank" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionRoster"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"></AbsDimension></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Show Co-Guild Rank Announcements");</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentOptionOfficerChat" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionRank"
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Show Co-Guild Rank Announcements");</OnLoad>
</Scripts>
</CheckButton>
<CheckButton name="$parentOptionOfficerChat" inherits="InterfaceOptionsCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentOptionRank"
relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-8"></AbsDimension></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Bridge Officer Chat");</OnLoad>
</Scripts>
</CheckButton>
<Frame name="$parentOptionDebug" inherits="UIDropDownMenuTemplate" enableMouse="true">
<Anchors>
<Anchor point="TOPLEFT"
relativeTo="$parentOptionOfficerChat" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="-40"></AbsDimension></Offset>
</Anchor></Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentLabel"
inherits="GameFontHighlight" text="Debugging Level">
<Anchors>
<Anchor point="BOTTOMLEFT"
relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="4"></AbsDimension></Offset>
</Anchor></Anchors>
</FontString></Layer></Layers>
<Scripts>
<OnLoad>self.type = CONTROLTYPE_DROPDOWN;</OnLoad>
<OnEnter>
if ( not self.isDisabled ) then
GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT");
<!-- GameTooltip:SetText(self.tooltip, nil, nil, nil, nil, 1); -->
end
</OnEnter>
<OnEvent function="InterfaceOptionsCameraPanelStyleDropDown_OnEvent"/>
<OnLeave function="GameTooltip_Hide"/>
</Scripts>
</Frame>
</Frames>
</Frame>
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>getglobal(self:GetName().."Text"):SetText("Bridge Officer Chat");</OnLoad>
</Scripts>
</CheckButton>
</Frames>
</Frame>
</Ui>
24 changes: 21 additions & 3 deletions GreenWall_Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1033,6 +1033,24 @@ function GreenWallInterfaceFrame_OnShow(self)
end
end

function GreenWallInterfaceFrame_SaveUpdates(self)
GreenWall.tag = getglobal(self:GetName().."OptionTag"):GetChecked() and true or false;
GreenWall.achievements = getglobal(self:GetName().."OptionAchievements"):GetChecked() and true or false;
GreenWall.roster = getglobal(self:GetName().."OptionRoster"):GetChecked() and true or false;
GreenWall.rank = getglobal(self:GetName().."OptionRank"):GetChecked() and true or false;
if (GwIsOfficer()) then
GreenWall.ochat = getglobal(self:GetName().."OptionOfficerChat"):GetChecked() and true or false;
end
end

function GreenWallInterfaceFrame_SetDefaults(self)
GreenWall.tag = gwDefaults['tag']['default'];
GreenWall.achievements = gwDefaults['achievements']['default'];
GreenWall.roster = gwDefaults['roster']['default'];
GreenWall.rank = gwDefaults['rank']['default'];
GreenWall.ochat = gwDefaults['ochat']['default'];
end


--[[-----------------------------------------------------------------------
Expand Down Expand Up @@ -1225,10 +1243,10 @@ function GreenWall_OnLoad(self)
-- Add a tab to the Interface Options panel.
--
self.name = 'GreenWall ' .. gwVersion;
self.refresh = function (self) return; end;
self.okay = function (self) return; end;
self.refresh = function (self) GreenWallInterfaceFrame_OnShow(self); end;
self.okay = function (self) GreenWallInterfaceFrame_SaveUpdates(self); end;
self.cancel = function (self) return; end;
self.default = function (self) return; end;
self.default = function (self) GreenWallInterfaceFrame_SetDefaults(self); end;
InterfaceOptions_AddCategory(self);

end
Expand Down

0 comments on commit cdef0b9

Please sign in to comment.