Skip to content

Commit

Permalink
Added a GwSetDefaults() function and some starting XML for the Interf…
Browse files Browse the repository at this point in the history
…ace Options pane. (#13)
  • Loading branch information
mrogaski committed Nov 22, 2013
1 parent dee9fd2 commit ebecdd0
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 17 deletions.
38 changes: 34 additions & 4 deletions GreenWall.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,40 @@
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>
<Frame name="GreenWallCoreFrame">
<Scripts>
<OnLoad>GreenWall_OnLoad(self);</OnLoad>
<OnEvent>GreenWall_OnEvent(self, event, ...);</OnEvent>
</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>
</Frame>
</Ui>
52 changes: 39 additions & 13 deletions GreenWall_Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,44 @@ function GreenWall_OnLoad(self)
self:RegisterEvent('PLAYER_GUILD_UPDATE');
self:RegisterEvent('PLAYER_LOGIN');

--
-- 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.cancel = function (self) return; end;
self.default = function (self) return; end;
InterfaceOptions_AddCategory(self);

end


--- Initialize options to default values.
-- @param soft If true, set only undefined options to the default values.
local function GwSetDefaults(soft)

if soft == nil then
soft = false;
else
soft = true;
end

if GreenWall == nil then
GreenWall = {};
end

for k, p in pairs(gwDefaults) do
if not soft or GreenWall[k] == nil then
GreenWall[k] = p['default'];
end
end
GreenWall.version = gwVersion;

if GreenWallLog == nil then
GreenWallLog = {};
end

end


Expand All @@ -1210,19 +1248,7 @@ function GreenWall_OnEvent(self, event, ...)
--
-- Initialize the saved variables
--
if GreenWall == nil then
GreenWall = {};
end
for k, p in pairs(gwDefaults) do
if GreenWall[k] == nil then
GreenWall[k] = p['default'];
end
end
GreenWall.version = gwVersion;

if GreenWallLog == nil then
GreenWallLog = {};
end
GwSetDefaults(true);

--
-- Thundercats are go!
Expand Down

0 comments on commit ebecdd0

Please sign in to comment.