956383a - Update all libraries
[wowui.git] / Core.lua
1 RaidFrameCustomization = LibStub("AceAddon-3.0"):NewAddon("RaidFrameCustomization", "AceTimer-3.0");
2
3 RaidFrameCustomization.normalBarColor = CreateColor(0.3, 0.3, 0.3);
4 RaidFrameCustomization.dispelBarColor = CreateColor(1, 0.5, 0);
5 RaidFrameCustomization.normalBackColor = {0.7, 0.7, 0.7};
6 RaidFrameCustomization.dispelBackColor = {0.5, 0.2, 0};
7
8 RaidFrameCustomization.frames = {};
9 RaidFrameCustomization.positions = {
10     "TOPLEFT", "TOPRIGHT", "CENTER", "BOTTOMLEFT", "BOTTOMRIGHT"
11 };
12
13 local defaults = {
14     profile = {
15         indicatorFont = "Arial Narrow",
16         showIcons = true,
17         enabled = true,
18         indicators = {
19             ['**'] = {
20                 textSize = 10,
21                 textColor = {1, 1, 1, 1},
22                 mine = false,
23                 stack = true,
24                 showText = true,
25                 showIcon = true,
26                 useDefaultIcon = true,
27                 iconSize = 10,
28                 iconColor = {1, 1, 1, 1},
29             },
30         },
31     }
32 };
33
34 function RaidFrameCustomization:OnInitialize()
35     self.db = LibStub("AceDB-3.0"):New("RaidFrameCustomizationDB", defaults);
36     self.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig");
37     self.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig");
38     self.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig");
39     self:SetupOptions();
40 end
41
42 function RaidFrameCustomization:OnEnable()
43     self:RefreshConfig();
44 end
45
46 function RaidFrameCustomization:OnDisable()
47     self:CancelAllTimers();
48     for _, frame in pairs(self.frames) do
49         for _, ind in pairs(frame) do
50             ind.text:SetText("");
51             ind.icon:SetTexture("");
52         end
53     end
54 end