vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 local tablet = AceLibrary("Tablet-2.0")
2 local L = AceLibrary("AceLocale-2.0"):new("SWStatsFu")
3  
4 SWStatsFu = AceLibrary("AceAddon-2.0"):new("FuBarPlugin-2.0", "AceEvent-2.0", "AceConsole-2.0", "AceDB-2.0")
5  
6 local optionsTable = {
7 type = 'group',
8 args = {
9 showConsole = {
10 order = 1,
11 type = "execute",
12 name = L["Show Console"],
13 desc = L["Shows the console"],
14 func = "ToggleConsole",
15 },
16 showGeneral = {
17 order = 2,
18 type = "execute",
19 name = L["Show General Settings"],
20 desc = L["Shows the general settings"],
21 func = "ToggleGeneralSettings",
22 },
23 showSync = {
24 order = 3,
25 type = "execute",
26 name = L["Show Sync Settings"],
27 desc = L["Shows the sync settings"],
28 func = "ToggleSync",
29 },
30 showTimeline = {
31 order = 4,
32 type = "execute",
33 name = L["Show Timeline"],
34 desc = L["Shows the timeline"],
35 func = "ToggleTimeline",
36 },
37 ["-blank-"] = {
38 order = 5,
39 type = 'header',
40 },
41 resetData = {
42 order = 6,
43 type = "execute",
44 name = L["Reset Data"],
45 desc = L["Reset the stored data"],
46 func = "ResetCheck",
47 },
48 ["-blank2-"] = {
49 order = 7,
50 type = 'header',
51 },
52 updateFriends = {
53 order = 8,
54 type = "execute",
55 name = L["Update GroupInfo"],
56 desc = L["Rebuilds friends list"],
57 func = "RebuildFriendList",
58 },
59 ["-blank3-"] = {
60 order = 9,
61 type = 'header',
62 },
63 hideIcon = {
64 order = 10,
65 type = 'toggle',
66 name = L["HIDE_LABEL"],
67 desc = L["HIDE_LABEL"],
68 set = "ToggleHideIcon",
69 get = "IsHideIcon",
70 },
71 }
72 }
73  
74 SWStatsFu.OnMenuRequest = optionsTable
75 SWStatsFu:RegisterChatCommand( { "/SWStatsFu" }, optionsTable )
76 SWStatsFu.hasIcon = true
77  
78 SWStatsFu:RegisterDB("Fubar_SWStatsDB")
79 SWStatsFu:RegisterDefaults('profile', {
80 enabled =0,
81 hideIcon = true,
82 })
83  
84 function SWStatsFu:IsHideIcon()
85 return self.db.profile.hideIcon;
86 end
87  
88 function SWStatsFu:ToggleConsole()
89 SW_ToggleConsole();
90 end
91  
92 function SWStatsFu:ToggleGeneralSettings()
93 SW_ToggleGeneralSettings();
94 end
95  
96 function SWStatsFu:ToggleSync()
97 SW_ToggleSync();
98 end
99  
100 function SWStatsFu:ToggleTimeline()
101 SW_ToggleTL();
102 end
103  
104 function SWStatsFu:ResetCheck()
105 SW_ResetCheck();
106 end
107  
108 function SWStatsFu:RebuildFriendList()
109 SW_RebuildFriendList();
110 end
111  
112  
113 function SWStatsFu:ToggleHideIcon()
114 self.db.profile.hideIcon = not self.db.profile.hideIcon;
115 if (SW_IconFrame) then
116 if self.db.profile.hideIcon == true then
117 SW_IconFrame:Hide();
118 else
119 SW_IconFrame:Show();
120 end
121 end
122 end
123  
124 function SWStatsFu:OnInitialize()
125 end
126  
127 function SWStatsFu:OnEnable()
128 --self:ScheduleRepeatingEvent("SWStatsFu_Update",self.Update, 1, self);
129 --self:RegisterEvent("UNIT_AURA");
130 if (SW_IconFrame) then
131 if self.db.profile.hideIcon == true then
132 SW_IconFrame:Hide();
133 else
134 SW_IconFrame:Show();
135 end
136 end
137 end
138  
139 function SWStatsFu:OnDisable()
140 --self:CancelScheduledEvent("SWStatsFu_Update")
141 SW_IconFrame:Show();
142 end
143  
144 function SWStatsFu:OnTextUpdate()
145 self:SetText("SWStats")
146 end
147  
148 function SWStatsFu:OnClick()
149 --DEFAULT_CHAT_FRAME:AddMessage("click "..self.db.profile.enabled);
150 -- if ( self.db.profile.enabled == 1) then
151 --self.db.profile.enabled = 0;
152 -- else
153 -- self.db.profile.enabled = 1;
154 --end
155 SW_ToggleBarFrame();
156 end
157  
158 function SWStatsFu:OnTooltipUpdate()
159  
160 local cat = tablet:AddCategory(
161 'columns', 2,
162 'child_textR', 1,
163 'child_textG', 1,
164 'child_textB', 0,
165 'child_text2R', 1,
166 'child_text2G', 1,
167 'child_text2B', 1
168 )
169  
170 cat:AddLine(
171 'text', "",
172 'text2', ""
173 )
174  
175 cat:AddLine(
176 'text', "",
177 'text2', ""
178 )
179 end