# HG changeset patch # User Jay Bird # Date 1290433197 18000 # Node ID 6e160ec1ef0fd0ba6d1bc89da1623dbf5e977e04 # Parent b68bfda72a47472da73291c8ffecbeb1477fed91 locale, add DBIcon, experiment with frames diff -r b68bfda72a47 -r 6e160ec1ef0f Main.lua --- a/Main.lua Sun Nov 21 20:38:20 2010 -0500 +++ b/Main.lua Mon Nov 22 08:39:57 2010 -0500 @@ -1,25 +1,70 @@ - - -RTT = LibStub("AceAddon-3.0"):NewAddon("RaidTargetTactics", "AceConsole-3.0") ---local L = LibStub("AceLocale-3.0"):GetLocale("RaidTargetTactics") - - -function RTT:OnInitialize() - self.db = LibStub("AceDB-3.0"):New("TacticsSettings", defaults, true) - local AceGUI = LibStub("AceGUI-3.0") - -- Create a container frame - local f = AceGUI:Create("Frame") - f:SetCallback("OnClose",function(widget) AceGUI:Release(widget) end) - f:SetTitle("AceGUI-3.0 Example") - f:SetStatusText("Status Bar") - f:SetLayout("Flow") - -- Create a button - local btn = AceGUI:Create("Button") - btn:SetWidth(170) - btn:SetText("Button !") - btn:SetCallback("OnClick", function() print("Click!") end) - -- Add the button to the container - f:AddChild(btn) - -end - + + +RTT = LibStub("AceAddon-3.0"):NewAddon("RaidTargetTactics", "AceConsole-3.0") +local L = LibStub("AceLocale-3.0"):GetLocale("RaidTargetTactics") + + +local LDB = LibStub("LibDataBroker-1.1", true) +local LDBIcon = LibStub("LibDBIcon-1.0", true) + +local RTTIcon = LibStub("LibDataBroker-1.1"):NewDataObject("RTTIcon", { + type = "data source", + text = "Raid Target Tactics", + icon = "Interface\\TARGETINGFRAME\\UI-RaidTargetingIcon_8", + OnClick = function() RTT:OnIconClick() end, + OnTooltipShow = function(tooltip) + tooltip:AddLine("Raid Target Tactics") + tooltip:AddLine(L.Minimap_Icon_Tooltip) + end, +}) + +local defaults = { + profile = { + visible = true, + minimap = { + hide = false, + }, + }, +} + +function RTT:OnInitialize() + self.db = LibStub("AceDB-3.0"):New("TacticsSettings", defaults, true) + + LDBIcon:Register("RTTIcon", RTTIcon, self.db.profile.minimap) + self:InitFrame() + if self.f:IsShown() != self.db.profile.visible then + if self.db.profile.visible then + self:ShowFrame() + else + self:HideFrame() + end + end +end + +function RTT:InitFrame() + self.f = CreateFrame("Frame", nil, UIParent) + self.f:SetWidth(100) + self.f:SetHeight(200) + self.f:SetPoint("LEFT", UIParent, "LEFT", 10, 0) +end + +function RTT:OnIconClick() + if self.db.profile.visible then + self:HideFrame() + else + self:ShowFrame() + end + self.db.profile.visible = !self.db.profile.visible +end + +function RTT:HideFrame() + self.f:Hide() +end + +function RTT:ShowFrame() + self.f:Show() +end + + + + diff -r b68bfda72a47 -r 6e160ec1ef0f RaidTargetTactics.toc --- a/RaidTargetTactics.toc Sun Nov 21 20:38:20 2010 -0500 +++ b/RaidTargetTactics.toc Mon Nov 22 08:39:57 2010 -0500 @@ -1,13 +1,17 @@ - -## Interface: 40000 -## Title: Tactics -## Title-ruRU: Тактика -## Notes: Assign different roles to raid signs and post them to the chat -## SavedVariables: TacticsGlobalSettings -## SavedVariablesPerCharacter: TacticsProfileSettings -## Author: jay - -_requires.xml -#_locale.xml - -Main.lua + +## Interface: 40000 +## Title: Tactics +## Title-ruRU: Тактика +## Notes: Assign different roles to raid signs and post them to the chat +## SavedVariables: TacticsGlobalSettings +## SavedVariablesPerCharacter: TacticsProfileSettings +## Author: jay +## X-Curse-Packaged-Version: r5 +## X-Curse-Project-Name: Raid Target Tactics +## X-Curse-Project-ID: raid-target-tactics +## X-Curse-Repository-ID: wow/raid-target-tactics/mainline + +_requires.xml +_locale.xml + +Main.lua diff -r b68bfda72a47 -r 6e160ec1ef0f _requires.xml --- a/_requires.xml Sun Nov 21 20:38:20 2010 -0500 +++ b/_requires.xml Mon Nov 22 08:39:57 2010 -0500 @@ -1,11 +1,12 @@ - - -