6f9efe3 - Remove font option
[wowui.git] / OmaRFConfig / IndicatorsConfig.lua
1 local function createOptionsTable(self)
2     local options = {
3         type = "group",
4         get = function(item) return self.db.profile[item[#item]] end,
5         set = function(item, value) self.db.profile[item[#item]] = value; self:RefreshConfig() end,
6         args = {
7             enabled = {
8                 type = "toggle",
9                 name = "Enable",
10             },
11         }
12     };
13
14     for _, pos in ipairs(self.positions) do
15         options.args[pos] = {
16             type = "group",
17             name = pos,
18             get = function(item)
19                 return self.db.profile.indicators[pos][item[#item]];
20             end,
21             set = function(item, value)
22                 self.db.profile.indicators[pos][item[#item]] = value;
23                 self:RefreshConfig();
24             end,
25             args = {
26                 auras = {
27                     type = "input",
28                     name = "Auras",
29                     multiline = true,
30                     width = "full",
31                     get = function(item)
32                         return table.concat(self.db.profile.indicators[pos]["auras"], "\n");
33                     end,
34                     set = function(item, value)
35                         local t = {};
36                         for aura in string.gmatch(value, "[^\n]+") do
37                             aura = string.gsub(aura, "^%s*(.-)%s$", "%1");
38                             if tonumber(aura) then
39                                 table.insert(t, tonumber(aura));
40                             else
41                                 table.insert(t, aura);
42                             end
43                         end
44                         self.db.profile.indicators[pos]["auras"] = t;
45                         self:RefreshConfig();
46                     end,
47                 },
48                 mine = {
49                     type = "toggle",
50                     name = "Only cast by me",
51                 },
52                 showText = {
53                     type = "toggle",
54                     name = "Show remaining time",
55                 },
56                 textSize = {
57                     type = "range",
58                     name = "Text size",
59                     min = 1,
60                     max = 30,
61                     step = 1,
62                     width = "full",
63                 },
64                 textColor = {
65                     type = "color",
66                     name = "Text color",
67                     get = function(item)
68                         return unpack(self.db.profile.indicators[pos]["textColor"]);
69                     end,
70                     set = function(item, r, g, b, a)
71                         self.db.profile.indicators[pos]["textColor"] = {r, g, b, a};
72                         self:RefreshConfig();
73                     end,
74                 },
75                 stack = {
76                     type = "toggle",
77                     name = "Show stacks",
78                 },
79                 showIcon = {
80                     type = "toggle",
81                     name = "Show icon",
82                 },
83                 useDefaultIcon = {
84                     type = "toggle",
85                     name = "Use default icon",
86                     disabled = function() return not self.db.profile.indicators[pos]["showIcon"] end,
87                 },
88                 iconSize = {
89                     type = "range",
90                     name = "Icon size",
91                     min = 1,
92                     max = 30,
93                     step = 1,
94                     width = "full",
95                 },
96                 iconColor = {
97                     type = "color",
98                     name = "Icon tint",
99                     get = function(item)
100                         return unpack(self.db.profile.indicators[pos]["iconColor"]);
101                     end,
102                     set = function(item, r, g, b, a)
103                         self.db.profile.indicators[pos]["iconColor"] = {r, g, b, a};
104                         self:RefreshConfig();
105                     end,
106                 },
107             }
108         };
109     end
110     return options;
111 end
112
113 local profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(OmaRF.db);
114 local options = createOptionsTable(OmaRF);
115 local config = LibStub("AceConfig-3.0");
116 config:RegisterOptionsTable("Indicators", options);
117 config:RegisterOptionsTable("Indicators Profiles", profiles);
118
119 local dialog = LibStub("AceConfigDialog-3.0");
120 OmaRF.optionsFrames = {};
121 OmaRF.optionsFrames.Indicators = dialog:AddToBlizOptions("Indicators", "Indicators");
122 OmaRF.optionsFrames.Profile = dialog:AddToBlizOptions("Indicators Profiles", "Profiles", "Indicators");