vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1  
2 assert(oRA, "oRA not found!")
3  
4 ------------------------------
5 -- Are you local? --
6 ------------------------------
7  
8 local L = AceLibrary("AceLocale-2.2"):new("oRAOptions")
9 local Tablet = AceLibrary("Tablet-2.0")
10  
11 ----------------------------
12 -- Localization --
13 ----------------------------
14  
15 L:RegisterTranslations("enUS", function() return {
16 tablethint = "|cffeda55fCtrl-Alt-Click|r to disable oRA completely. |cffeda55fAlt-Drag|r to move MT,PT and the monitors.",
17 tablethint_disabled = "oRA is currently disabled. |cffeda55fClick|r to enable.",
18 ["oRA Options"] = true,
19 ["Active boss modules"] = true,
20 ["Hidden"] = true,
21 ["Shown"] = true,
22 ["minimap"] = true,
23 ["Minimap"] = true,
24 ["Toggle the minimap button."] = true,
25 } end)
26  
27 L:RegisterTranslations("koKR", function() return {
28 tablethint = "|cffeda55fCtrl Alt 클릭시|r oRA를 완전히 사용하지 않습니다. Alt키를 누른 상태에서 메인탱커창와 플레이어탱커창과 각종 모니터창을 드래그해서 이동할 수 있습니다.",
29 tablethint_disabled = "oRA 는 현재 사용중지 중입니다. |cffeda55f클릭시|r 사용합니다.",
30 ["oRA Options"] = "oRA 설정",
31 ["Active boss modules"] = "보스 모듈 활성화",
32 ["Hidden"] = "숨김",
33 ["Shown"] = "표시",
34 ["Minimap"] = "미니맵",
35 ["Toggle the minimap button."] = "미니맵 버튼 토글",
36 } end)
37  
38  
39 L:RegisterTranslations("zhCN", function() return {
40 tablethint = "|cffeda55fCtrl-Alt-点击|r 来关闭oRA.|cffeda55f按住Alt-拖动|r来移动MT,PT和监视器",
41 tablethint_disabled = "oRA目前关闭。|cffeda55f点击|r来激活。",
42 ["Active boss modules"] = "激活boss模块",
43 ["Hidden"] = "隐藏",
44 ["Shown"] = "显示",
45 ["minimap"] = "小地图",
46 ["Minimap"] = "小地图",
47 ["Toggle the minimap button."] = "显示小地图图标",
48 } end)
49  
50 L:RegisterTranslations("zhTW", function() return {
51 tablethint = "|cffeda55fCtrl-Alt-點擊|r 可關閉 oRA。 |cffeda55fAlt-拖曳|r 可移動 MT、PT 及監視框架。",
52 tablethint_disabled = "oRA 目前已關閉。|cffeda55f點擊|r可啟動 oRA。",
53 ["oRA Options"] = "oRA 選項",
54 ["Active boss modules"] = "啟動BOSS模組",
55 ["Hidden"] = "隱藏",
56 ["Shown"] = "顯示",
57 ["minimap"] = "小地圖",
58 ["Minimap"] = "小地圖",
59 ["Toggle the minimap button."] = "顯示小地圖按鈕。",
60 } end)
61  
62 L:RegisterTranslations("frFR", function() return {
63 tablethint = "|cffeda55fCtrl-Alt-Clic|r pour d\195\169sactiver compl\195\168tement oRA. Maintenez enfoncer la touche Alt pour saisir les cadres des MTs & PTs ainsi que les moniteurs.",
64 tablethint_disabled = "oRA est actuellement d\195\169sactiv\195\169. |cffeda55fCliquez|r pour l'activer.",
65 ["oRA Options"] = "Options concernant oRA",
66 ["Active boss modules"] = "Modules boss actifs",
67 ["Hidden"] = "Cach\195\169",
68 ["Shown"] = "Affich\195\169",
69 --["minimap"] = true,
70 ["Minimap"] = "Minicarte",
71 ["Toggle the minimap button."] = "Affiche ou non le bouton de la minicarte.",
72 } end)
73  
74 ----------------------------------
75 -- Module Declaration --
76 ----------------------------------
77  
78 local deuce = oRA:NewModule("Options Menu")
79 deuce.hasFuBar = IsAddOnLoaded("FuBar") and FuBar
80 deuce.consoleCmd = not deuce.hasFuBar and L["minimap"]
81 deuce.consoleOptions = not deuce.hasFuBar and {
82 type = "toggle",
83 name = L["Minimap"],
84 desc = L["Toggle the minimap button."],
85 get = function() return oRAOptions.minimapFrame and oRAOptions.minimapFrame:IsVisible() or false end,
86 set = function(v) if v then oRAOptions:Show() else oRAOptions:Hide() end end,
87 map = {[false] = L["Hidden"], [true] = L["Shown"]},
88 hidden = function() return deuce.hasFuBar and true end,
89 }
90  
91 ----------------------------
92 -- FuBar Plugin --
93 ----------------------------
94  
95 oRAOptions = AceLibrary("AceAddon-2.0"):new("AceEvent-2.0", "AceConsole-2.0", "AceDB-2.0", "FuBarPlugin-2.0")
96 oRAOptions.name = "FuBar - oRA"
97 oRAOptions:RegisterDB("oRAFubarDB")
98  
99 oRAOptions.hasNoColor = true
100 oRAOptions.hasIcon = "Interface\\AddOns\\oRA2\\Icons\\core_enabled"
101 oRAOptions.defaultMinimapPosition = 180
102 oRAOptions.hideWithoutStandby = true
103 oRAOptions.clickableTooltip = true
104  
105 -- XXX total hack
106 oRAOptions.OnMenuRequest = deuce.core.consoleOptions
107 local args = AceLibrary("FuBarPlugin-2.0"):GetAceOptionsDataTable(oRAOptions)
108 for k,v in pairs(args) do
109 if oRAOptions.OnMenuRequest.args[k] == nil then
110 oRAOptions.OnMenuRequest.args[k] = v
111 end
112 end
113 -- XXX end hack
114  
115 -----------------------------
116 -- Icon Handling --
117 -----------------------------
118  
119 function oRAOptions:OnEnable()
120 self:RegisterEvent("oRA_CoreEnabled", "CoreState")
121 self:RegisterEvent("oRA_CoreDisabled", "CoreState")
122 self:RegisterEvent("oRA_UpdateConfigGUI", "Update")
123  
124 self:CoreState()
125 end
126  
127 function oRAOptions:CoreState()
128 if oRA:IsActive() then
129 self:SetIcon("Interface\\AddOns\\oRA2\\Icons\\core_enabled")
130 else
131 self:SetIcon("Interface\\AddOns\\oRA2\\Icons\\core_disabled")
132 end
133  
134 self:UpdateTooltip()
135 end
136  
137 -----------------------------
138 -- FuBar Methods --
139 -----------------------------
140  
141 function oRAOptions:OnTooltipUpdate()
142 -- local cat = Tablet:AddCategory("columns", 1)
143 -- cat:AddLine("text", L["oRA Options"], "justify", "CENTER")
144 if oRA:IsActive() then
145 Tablet:SetHint(L["tablethint"])
146 for k,module in pairs(oRA.moduletooltips) do
147 module:OnTooltipUpdate()
148 end
149 else
150 Tablet:SetHint(L["tablethint_disabled"])
151 end
152 end
153  
154 function oRAOptions:OnClick()
155 if oRA:IsActive() then
156 if IsControlKeyDown() and IsAltKeyDown() then
157 oRA:ToggleActive(false)
158 end
159 else
160 oRA:ToggleActive(true)
161 end
162  
163 self:UpdateTooltip()
164 end
165