changeset 8:6e160ec1ef0f

locale, add DBIcon, experiment with frames
author Jay Bird <a4blank@yahoo.com>
date Mon, 22 Nov 2010 08:39:57 -0500
parents b68bfda72a47
children 7201711b23e9
files Main.lua RaidTargetTactics.toc _requires.xml locale/locale.lua locale/locale.ru.lua
diffstat 5 files changed, 105 insertions(+), 152 deletions(-) [+]
line wrap: on
line diff
--- 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
+
+
+
+
--- 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
--- 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 @@
-
-<Ui xmlns="http://www.blizzard.com/wow/ui/">
-    <Script file="libs\LibStub\LibStub.lua"/>
-    <Include file="libs\AceAddon-3.0\AceAddon-3.0.xml"/>
-    <Include file="libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
-    <Include file="libs\AceEvent-3.0\AceEvent-3.0.xml"/>
-    <Include file="libs\AceConsole-3.0\AceConsole-3.0.xml"/>
-    <Include file="libs\AceLocale-3.0\AceLocale-3.0.xml"/>
-
-    <Script file="libs\LibDataBroker-1.1.lua"/>
-</Ui>
+
+<Ui xmlns="http://www.blizzard.com/wow/ui/">
+    <Script file="libs\LibStub\LibStub.lua"/>
+    <Include file="libs\AceAddon-3.0\AceAddon-3.0.xml"/>
+    <Include file="libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
+    <Include file="libs\AceEvent-3.0\AceEvent-3.0.xml"/>
+    <Include file="libs\AceConsole-3.0\AceConsole-3.0.xml"/>
+    <Include file="libs\AceLocale-3.0\AceLocale-3.0.xml"/>
+
+    <Script file="libs/LibDataBroker/LibDataBroker-1.1.lua"/>
+    <Script file="libs/LibDBIcon-1.0/LibDBIcon-1.0.lua"/>
+</Ui>
--- a/locale/locale.lua	Sun Nov 21 20:38:20 2010 -0500
+++ b/locale/locale.lua	Mon Nov 22 08:39:57 2010 -0500
@@ -1,55 +1,7 @@
 --[[
-	Bagnon Localization Information: English Language
-		This file must be present to have partial translations
+    Raid Target Tactics Locale: English
 --]]
 
-local L = LibStub('AceLocale-3.0'):NewLocale('Bagnon', 'enUS', true)
+local L = LibStub('AceLocale-3.0'):NewLocale('RaidTargetTactics', 'enUS', true)
 
---keybinding text
-L.ToggleBags = 'Toggle Inventory'
-L.ToggleBank = 'Toggle Bank'
-L.ToggleKeys = 'Toggle Keyring'
-
-
---system messages
-L.NewUser = 'New user detected, default settings loaded'
-L.Updated = 'Updated to v%s'
-L.UpdatedIncompatible = 'Updating from an incompatible version, defaults loaded'
-
-
---slash commands
-L.Commands = 'Commands:'
-L.CmdShowInventory = 'Toggles the inventory frame'
-L.CmdShowBank = 'Toggles the bank frame'
-L.CmdShowKeyring = 'Toggles the keyring'
-L.CmdShowVersion = 'Prints the current verison'
-
-
---frame text
-L.TitleBags = '%s\'s Inventory'
-L.TitleBank = '%s\'s Bank'
-L.TitleKeys = '%s\'s Keys'
-
-
---tooltips
-L.TipBank = 'Bank'
-L.TipChangePlayer = 'Click to view another character\'s items.'
-L.TipGoldOnRealm = '%s Totals'
-L.TipHideBag = 'Click to hide this bag.'
-L.TipHideBags = 'Click to hide the bag frame.'
-L.TipHideSearch = 'Click to hide the search frame.'
-L.TipPurchaseBag = 'Click to purchase this bank slot.'
-L.TipShowBag = 'Click to show this bag.'
-L.TipShowBags = 'Click to show the bag frame.'
-L.TipShowMenu = 'Right-Click to configure this frame.'
-L.TipShowSearch = 'Click to show the search frame.'
-L.TipShowSearch = 'Click to search.'
-L.TipShowFrameConfig = 'Click to configure this frame.'
-L.TipDoubleClickSearch = 'Alt-Drag to move.\nRight-Click to configure.\nDouble-Click to search.'
-L.Total = 'Total'
-
---databroker plugin tooltips
-L.TipShowBank = '<Shift Left Click> to toggle your bank.'
-L.TipShowInventory = '<Left Click> to toggle your inventory.'
-L.TipShowKeyring = '<Alt Left Click> to toggle your keyring.'
-L.TipShowOptions = '<Right Click> to open the options menu.'
\ No newline at end of file
+L.Minimap_Icon_Tooltip = "Click to toggle addon window"
--- a/locale/locale.ru.lua	Sun Nov 21 20:38:20 2010 -0500
+++ b/locale/locale.ru.lua	Mon Nov 22 08:39:57 2010 -0500
@@ -1,57 +1,8 @@
 --[[
-	Bagnon Localization Information: Russian Localization by kutensky
-	Updated by StingerSoft
-		This file must be present to have partial translations
+    Raid Target Tactics Russian locale
 --]]
 
-local L = LibStub('AceLocale-3.0'):NewLocale('Bagnon', 'ruRU')
+local L = LibStub('AceLocale-3.0'):NewLocale('RaidTargetTactics', 'ruRU')
 if not L then return end
 
---keybinding text
-L.ToggleBags = 'Открыть/закрыть инвентарь'
-L.ToggleBank = 'Открыть/закрыть банк'
-L.ToggleKeys = 'Открыть/закрыть связку ключей'
-
-
---system messages
-L.NewUser = 'Обнаружен новый пользователь, загружены стандартные настройки'
-L.Updated = 'Обновлено до v%s'
-L.UpdatedIncompatible = 'Обновление от несовместимой версии, загружены стандартные настройки'
-
-
---slash commands
-L.Commands = 'Команды:'
-L.CmdShowInventory = 'Открыть/закрыть инвентарь'
-L.CmdShowBank = 'Открыть/закрыть банк'
-L.CmdShowKeyring = 'Открыть/закрыть связку ключей'
-L.CmdShowVersion = 'Сообщить текущую версию модификации'
-
-
---frame text
-L.TitleBags = 'Инвентарь |3-1(%s)'
-L.TitleBank = 'Банк |3-1(%s)'
-L.TitleKeys = 'Связка ключей |3-1(%s)'
-
-
---tooltips
-L.TipBank = 'Банк'
-L.TipChangePlayer = '<Клик> - просмотр предметов другого персонажа.'
-L.TipGoldOnRealm = 'Всего денег на %s'
-L.TipHideBag = '<Клик> - скрыть сумку.'
-L.TipHideBags = '<Клик> - скрыть область сумок.'
-L.TipHideSearch = '<Клик> скрыть область поиска.'
-L.TipPurchaseBag = '<Клик> - купить ячейку в банке.'
-L.TipShowBag = '<Клик> - показать сумку.'
-L.TipShowBags = '<Клик> - показать область сумки.'
-L.TipShowMenu = '<Правый-клик> - настройки.'
-L.TipShowSearch = '<Клик> - показать область поиска.'
-L.TipShowSearch = '<Клик> - поиск.'
-L.TipShowFrameConfig = '<Правый-клик> - настройки.'
-L.TipDoubleClickSearch = '<Alt-тищить> - переместить.\n<Правый-клик> - настройка.\n<Двойной-клик> - поиск.'
-L.Total = 'Всего'
-
---databroker plugin tooltips
-L.TipShowBank = '<Shift-Левый клик> - открыть/закрыть банк.'
-L.TipShowInventory = '<Левый клик> - открыть/закрыть инвентарь.'
-L.TipShowKeyring = '<Alt-левый клик> - открыть/закрыть связку ключей.'
-L.TipShowOptions = '<Правый-клик> - настройки.'
\ No newline at end of file
+L.Minimap_Icon_Tooltip = "Открыть/закрыть окно с тактикой"