Mercurial > wow > buffalo2
comparison Config/Config.lua @ 49:16465f3fd919
- remove UpdateAnchorAnchors and use hardlink for the one frame that this applied to
author | Nenue |
---|---|
date | Fri, 29 Apr 2016 10:50:27 -0400 |
parents | 1a322b92dbfa |
children | 07ef62fe201f |
comparison
equal
deleted
inserted
replaced
48:9837069e366a | 49:16465f3fd919 |
---|---|
1 --- All the control GUI stuff, including chat command functions | 1 --- All the control GUI stuff, including chat command functions |
2 -- @file-author@ | 2 -- @file-author@ |
3 -- @project-revision@ @project-hash@ | 3 -- @project-revision@ @project-hash@ |
4 -- @file-revision@ @file-hash@ | 4 -- @file-revision@ @file-hash@ |
5 -- Created: 3/12/2016 12:49 AM | 5 -- Created: 3/12/2016 12:49 AM |
6 local B, _G = select(2,...).frame, _G | 6 local vn, _G = select(2,...).frame, _G |
7 local M = B:RegisterModule("Options") | 7 local M = vn:RegisterModule("Options") |
8 local tostring, tonumber, floor, format = tostring, tonumber, floor, string.format | 8 local tostring, tonumber, floor, max, assert = tostring, tonumber, floor, math.max, assert |
9 local unpack, select, pairs, ipairs, type, wipe = unpack, select, pairs, ipairs, type, table.wipe | 9 local unpack, setmetatable, pairs, ipairs, type, wipe = unpack, setmetatable, pairs, ipairs, type, table.wipe |
10 local CreateFrame, IsControlKeyDown = _G.CreateFrame, _G.IsControlKeyDown | 10 local CreateFrame, IsControlKeyDown = _G.CreateFrame, _G.IsControlKeyDown |
11 local max = math.max | |
12 local OpacitySliderFrame, ColorPickerFrame = _G.OpacitySliderFrame, _G.ColorPickerFrame | 11 local OpacitySliderFrame, ColorPickerFrame = _G.OpacitySliderFrame, _G.ColorPickerFrame |
13 local print = B.print('Cfgl') | 12 local print = vn.print('Cfgl') |
14 local function round(number, decimals) | 13 local function round(number, decimals) |
15 if floor(number) == number then | 14 if floor(number) == number then |
16 return ('%d'):format(number) | 15 return ('%d'):format(number) |
17 end | 16 end |
18 | 17 |
19 return (("%%.%df"):format(decimals)):format(number) | 18 return (("%%.%df"):format(decimals)):format(number) |
20 end | 19 end |
21 | 20 |
21 --- Set up this way to ensure that all the necessary data exists before things domino into something inscrutable | |
22 M.prototypes = { | |
23 value = setmetatable({}, {__call = function(self, frame) | |
24 assert(frame, 'Expected table (received '..type(frame.OptInfo)..')') | |
25 assert(frame.OptRoot, 'Invalid config table for frame '.. frame:GetName().. '') | |
26 return self[frame.ValueType](frame.OptTab, frame.OptKey, frame.OptRoot) | |
27 end}), | |
28 reset = setmetatable({}, {__call = function(self, frame) | |
29 assert(frame.GetName, 'Invalid frame reference (received '..type(frame.OptInfo)..')') | |
30 assert(frame.OptInfo, 'Expecting a table (received '..type(frame.OptInfo)..')') | |
31 return self[frame.OptType](frame, frame.OptInfo) | |
32 end}) | |
33 } | |
34 M.config = {} | |
22 M.defaults = { | 35 M.defaults = { |
23 enable = true | 36 enable = true |
24 } | 37 } |
25 | 38 local GetValue = M.prototypes.value |
39 local ResetField = M.prototypes.reset | |
26 --- STATE VARIABLES | 40 --- STATE VARIABLES |
27 local configInit | 41 local configInit |
28 --- Dummies for addon table upvalues | 42 --- Dummies for addon table upvalues |
29 local configFrames = {} -- actual frame objects | 43 local configFrames = {} -- actual frame objects |
30 local displays = B.displays -- anchor objects dummy | 44 local displays = vn.displays -- anchor objects dummy |
31 | 45 |
32 | 46 |
33 --- Returns a value retreival function and the current value stored in config | 47 --- Returns a value retreival function and the current value stored in config |
34 -- @paramsig value, previousValue = configInteger(key) | 48 -- @paramsig value, previousValue = configInteger(key) |
35 -- @param key Name of the config field being represented. | 49 -- @param key Name of the config field being represented. |
36 local defaultGroup = 'BuffButton' | 50 local defaultGroup = 'BuffButton' |
37 local configInteger = function(group, key) | 51 |
38 return function(self ,display) | 52 GetValue.Integer = function(group, key, parent) |
53 return function(self) | |
39 return floor(tonumber(self:GetValue()) + 0.5) | 54 return floor(tonumber(self:GetValue()) + 0.5) |
40 end, (B.Conf[group ..key] or B.Conf[defaultGroup..key]) | 55 end, (parent[group ..key] or parent[defaultGroup..key]) |
41 end | 56 end |
42 local configPercent = function(group, key) | 57 GetValue.Percent = function(group, key, parent) |
43 return function(self, display) | 58 return function(self, display) |
44 local value = self:GetValue() | 59 local value = self:GetValue() |
45 if display then | 60 if display then |
46 return tostring(floor(value*100+0.5))..' %' | 61 return tostring(floor(value*100+0.5))..' %' |
47 else | 62 else |
48 return floor((value*100+0.5))/100 | 63 return floor((value*100+0.5))/100 |
49 end | 64 end |
50 end, (B.Conf[group ..key] or B.Conf[defaultGroup..key]) | 65 end, (parent[group ..key] or parent[defaultGroup..key]) |
51 end | 66 end |
52 local configColor = function(group, key) | 67 GetValue.Color = function(group, key, parent) |
53 -- table for config, color value list for text | 68 -- table for config, color value list for text |
54 return function(self, display) | 69 return function(self, display) |
55 if display then | 70 if display then |
56 return "|cFFFF4444" .. round(self.rgba[1], 1) .. "|r, |cFF44FF44" .. round(self.rgba[2], 1) .. "|r, |cFF4488FF" .. | 71 return "|cFFFF4444" .. round(self.rgba[1], 1) .. "|r, |cFF44FF44" .. round(self.rgba[2], 1) .. "|r, |cFF4488FF" .. |
57 round(self.rgba[3], 1) .. "|r, " .. round(self.rgba[4], 1) | 72 round(self.rgba[3], 1) .. "|r, " .. round(self.rgba[4], 1) |
58 else | 73 else |
59 return self.rgba | 74 return self.rgba |
60 end | 75 end |
61 end, (B.Conf[group ..key] or B.Conf[defaultGroup..key]) | 76 end, (parent[group ..key] or parent[defaultGroup..key]) |
62 end | 77 end |
63 local configCheck = function(group, key) | 78 GetValue.Check = function(group, key, parent) |
64 return function(self) return self:GetChecked() end, B.Conf[group ..key] or B.Conf[defaultGroup..key] | 79 return function(self) return self:GetChecked() end, parent[group ..key] or vn.Conf[defaultGroup..key] |
65 end | 80 end |
66 -- initializes the corresponding type of config field | 81 -- initializes the corresponding type of config field |
67 local frameTypeConv = { | 82 local frameTypeConv = { |
68 Color = 'Button', | 83 Color = 'Button', |
69 Font = 'Frame', | 84 Font = 'Frame', |
70 } | 85 } |
71 local configTypeParams = { | 86 |
72 Slider = function(frame, optionInfo) | 87 |
88 ResetField.Slider = function(frame, optionInfo) | |
73 frame:SetMinMaxValues(optionInfo[5], optionInfo[6]) | 89 frame:SetMinMaxValues(optionInfo[5], optionInfo[6]) |
74 frame:SetValueStep(optionInfo[7]) | 90 frame:SetValueStep(optionInfo[7]) |
75 frame:SetStepsPerPage(optionInfo[8]) | 91 frame:SetStepsPerPage(optionInfo[8]) |
76 print(frame.OptName, '\n {', optionInfo[5], optionInfo[6], optionInfo[7], optionInfo[8], '}') | 92 print(frame.OptName, '\n {', optionInfo[5], optionInfo[6], optionInfo[7], optionInfo[8], '}') |
77 end, | 93 end |
78 CheckButton = function(frame, optionInfo) | 94 ResetField.CheckButton = function(frame, optionInfo) |
79 frame.SetValue = function(self, ...) | 95 frame.SetValue = function(self, ...) |
80 self:SetChecked(...) | 96 self:SetChecked(...) |
81 B.Conf[self.OptName] = self:GetChecked() | 97 self.OptRoot[self.OptName] = self:GetChecked() |
82 print(self.OptTab) | 98 print(self.OptTab) |
83 B.UpdateAll() | 99 vn.UpdateAll() |
84 end | 100 end |
85 frame:SetScript("OnClick",function(self) | 101 frame:SetScript("OnClick",function(self) |
86 B.Conf[self.OptName] = self:GetChecked() | 102 self.OptRoot[self.OptName] = self:GetChecked() |
87 print(B.Conf[self.OptName], self:GetChecked()) | 103 print(self.OptRoot[self.OptName], self:GetChecked()) |
88 B.UpdateAll() | 104 vn.UpdateAll() |
89 end) | 105 end) |
90 end, | 106 end |
91 Color = function(frame, optionInfo) | 107 ResetField.Color = function(frame, optionInfo) |
92 frame.rgba = { frame.current:GetVertexColor() } | 108 frame.rgba = { frame.current:GetVertexColor() } |
93 local colorPickerCallback = function(restore) | 109 local colorPickerCallback = function(restore) |
94 local newR, newG, newB, newA | 110 local newR, newG, newB, newA |
95 if restore then | 111 if restore then |
96 newR, newG, newB, newA = unpack(restore) | 112 newR, newG, newB, newA = unpack(restore) |
97 else | 113 else |
98 newA, newR, newG, newB = OpacitySliderFrame:GetValue(), ColorPickerFrame:GetColorRGB() | 114 newA, newR, newG, newB = OpacitySliderFrame:GetValue(), ColorPickerFrame:GetColorRGB() |
99 print('not cancel', newA, newR, newB, newG) | 115 print('not cancel', newA, newR, newB, newG) |
100 end | 116 end |
101 frame:SetValue({newR, newG, newB, newA}) | 117 frame:SetValue({newR, newG, newB, newA}) |
102 B.UpdateBuffs(frame.OptTab) | 118 vn.UpdateBuffs(frame.OptTab) |
103 end | 119 end |
104 frame:SetScript("OnClick", function(self) | 120 frame:SetScript("OnClick", function(self) |
105 print('got a click') | 121 print('got a click') |
106 local r, g, b, a = frame.current:GetVertexColor() | 122 local r, g, b, a = frame.current:GetVertexColor() |
107 ColorPickerFrame:SetColorRGB(r, g, b) | 123 ColorPickerFrame:SetColorRGB(r, g, b) |
108 ColorPickerFrame.hasOpacity = (a ~= nil) | 124 ColorPickerFrame.hasOpacity = (a ~= nil) |
109 ColorPickerFrame.opacity = a | 125 ColorPickerFrame.opacity = a |
110 ColorPickerFrame.previousValues = {r,g,b,a} | 126 ColorPickerFrame.previousValues = {r,g,b,a} |
111 ColorPickerFrame.func, ColorPickerFrame.opacityFunc, ColorPickerFrame.cancelFunc = | 127 ColorPickerFrame.func, ColorPickerFrame.opacityFunc, ColorPickerFrame.cancelFunc = |
112 colorPickerCallback, colorPickerCallback,colorPickerCallback | 128 colorPickerCallback, colorPickerCallback,colorPickerCallback |
113 ColorPickerFrame:Hide() | 129 ColorPickerFrame:Hide() |
114 ColorPickerFrame:Show() | 130 ColorPickerFrame:Show() |
115 end) | 131 end) |
116 frame.SetValue = function(self, rgba) | 132 frame.SetValue = function(self, rgba) |
117 print(rgba) | 133 print(rgba) |
118 frame.rgba = rgba | 134 frame.rgba = rgba |
119 B.Conf[self.OptName] = rgba | 135 self.OptRoot[self.OptName] = rgba |
120 frame.current:SetVertexColor(unpack(rgba)) | 136 frame.current:SetVertexColor(unpack(rgba)) |
121 frame.fieldvalue:SetText(frame.OptValue(frame, true)) | 137 frame.fieldvalue:SetText(frame.OptValue(frame, true)) |
122 end | 138 end |
123 end | 139 end |
124 } | 140 |
125 --- configDialog | 141 --- configDialog |
126 -- @usage tinsert(configDialog, {prefix, row, [...] }) | 142 -- @usage tinsert(configDialog, {prefix, row, [...] }) |
127 -- Each top level member defines a group of config value handlers, structured as an iterative table where the | 143 -- Each top level member defines a group of config value handlers, structured as an iterative table where the |
128 -- first member is a key prefix, the second member is an integer row value, and all following members are treated | 144 -- first member is a key prefix, the second member is an integer row value, and all following members are treated |
129 -- as a widget resource, defined initially as a complete sub-table, which can be re-used further down by passing | 145 -- as a widget resource, defined initially as a complete sub-table, which can be re-used further down by passing |
130 -- the string literal widget suffix. | 146 -- the string literal widget suffix. |
131 -- widget table: ... {'suffix', 'description', valueCallback, 'template', [widget parameters]} | 147 -- widget table: ... {'suffix', 'description', valueCallback, 'template', [widget parameters]} |
132 -- widget copy: ... 'suffix', ... | 148 -- widget copy: ... 'suffix', ... |
133 local configDialog = { | 149 M.config.BuffFrame = { |
134 {'BuffButton', 1, | 150 {'BuffButton', 1, |
135 | 151 |
136 {'Max', 'Max', configInteger, 'Slider', | 152 {'Max', 'Max', 'Integer', 'Slider', |
137 1, _G.BUFF_MAX_DISPLAY, 1, 1}, -- valueMin, valueMax, valueStep, stepsPerPage | 153 1, _G.BUFF_MAX_DISPLAY, 1, 1}, -- valueMin, valueMax, valueStep, stepsPerPage |
138 {'PerRow', 'Per Row', configInteger, 'Slider', | 154 {'PerRow', 'Per Row', 'Integer', 'Slider', |
139 1, _G.BUFF_MAX_DISPLAY, 1, 1}, -- valueMin, valueMax, valueStep, stepsPerPage, | 155 1, _G.BUFF_MAX_DISPLAY, 1, 1}, -- valueMin, valueMax, valueStep, stepsPerPage, |
140 {'Size', 'Icon Size', configInteger, 'Slider', | 156 {'Size', 'Icon Size', 'Integer', 'Slider', |
141 1, 256, 1, 1}, | 157 1, 256, 1, 1}, |
142 {'Spacing', 'Icon Spacing', configInteger, 'Slider', | 158 {'Spacing', 'Icon Spacing', 'Integer', 'Slider', |
143 1, 50, 1, 1}, | 159 1, 50, 1, 1}, |
144 {'DurationSize', 'Duration Text Height', configInteger, 'Slider', | 160 {'DurationSize', 'Duration Text Height', 'Integer', 'Slider', |
145 1, 72, 1, 1}, | 161 1, 72, 1, 1}, |
146 {'Zoom', 'Icon Zoom', configInteger, 'Slider', | 162 {'Zoom', 'Icon Zoom', 'Integer', 'Slider', |
147 0, 100, 1, 1}, | 163 0, 100, 1, 1}, |
148 {'Border', 'Border', configInteger, 'Slider', | 164 {'Border', 'Border', 'Integer', 'Slider', |
149 1, 16, 1, 1}, | 165 1, 16, 1, 1}, |
150 {'Color', 'Default Border', configColor, 'Color'}, | 166 {'Color', 'Default Border', 'Color', 'Color'}, |
151 {'RaidColor', 'RaidBuff Border', configColor, 'Color'}, | 167 {'RaidColor', 'RaidBuff Border', 'Color', 'Color'}, |
152 {'PlayerColor', 'Player Buffs', configColor, 'Color'}, | 168 {'PlayerColor', 'Player Buffs', 'Color', 'Color'}, |
153 {'BossColor', 'Encounter Buffs', configColor, 'Color'}, | 169 {'BossColor', 'Encounter Buffs', 'Color', 'Color'}, |
154 {'ShowSelfCast', 'Show name for self-casts', configCheck, 'CheckButton'} | 170 {'ShowSelfCast', 'Show name for self-casts', 'Check', 'CheckButton'} |
155 }, | 171 }, |
156 { 'DebuffButton', 1, | 172 { 'DebuffButton', 1, |
157 {'Max', 'Max', configInteger, 'Slider', | 173 {'Max', 'Max', 'Integer', 'Slider', |
158 1, _G.DEBUFF_MAX_DISPLAY, 1, 1 } | 174 1, _G.DEBUFF_MAX_DISPLAY, 1, 1 } |
159 , | 175 , |
160 {'PerRow', 'Per Row', configInteger, 'Slider', | 176 {'PerRow', 'Per Row', 'Integer', 'Slider', |
161 1, _G.DEBUFF_MAX_DISPLAY, 1, 1 }, | 177 1, _G.DEBUFF_MAX_DISPLAY, 1, 1 }, |
162 'Size', 'Spacing', 'DurationSize', 'Zoom', 'Border', | 178 'Size', 'Spacing', 'DurationSize', 'Zoom', 'Border', |
163 'Color', 'RaidColor', 'PlayerColor', 'BossColor', | 179 'Color', 'RaidColor', 'PlayerColor', 'BossColor', |
164 }, | 180 }, |
165 { 'TempEnchant', 1, | 181 { 'TempEnchant', 1, |
166 {'Max', 'Max', configInteger, 'Slider', | 182 {'Max', 'Max', 'Integer', 'Slider', |
167 1, _G.NUM_TEMP_ENCHANT_FRAMES, 1, 1 }, | 183 1, _G.NUM_TEMP_ENCHANT_FRAMES, 1, 1 }, |
168 {'PerRow', 'Per Row', configInteger, 'Slider', | 184 {'PerRow', 'Per Row', 'Integer', 'Slider', |
169 1, _G.NUM_TEMP_ENCHANT_FRAMES, 1, 1}, | 185 1, _G.NUM_TEMP_ENCHANT_FRAMES, 1, 1}, |
170 'Size', 'Spacing', 'DurationSize', 'Zoom', 'Border', | 186 'Size', 'Spacing', 'DurationSize', 'Zoom', 'Border', |
171 'Color', 'RaidColor', 'PlayerColor', 'BossColor', | 187 'Color', 'RaidColor', 'PlayerColor', 'BossColor', |
172 }, | 188 }, |
173 { 'ConsolidatedBuff', 2, | 189 { 'ConsolidatedBuff', 2, |
174 {'Position', 'Slot Position', configInteger, 'Slider', | 190 {'Position', 'Slot Position', 'Integer', 'Slider', |
175 1, _G.BUFF_MAX_DISPLAY, 1, 1 } | 191 1, _G.BUFF_MAX_DISPLAY, 1, 1 } |
176 | 192 |
177 }, | 193 }, |
178 { 'ConsolidatedBuff', 2, | 194 { 'ConsolidatedBuff', 2, |
179 'Size' | 195 'Size' |
180 }, | 196 }, |
181 { 'Raid', 3, | 197 { 'Raid', 3, |
182 {'ShowMissing', 'Verbose missing raid buffs', configCheck, 'CheckButton'} | 198 {'ShowMissing', 'Verbose missing raid buffs', 'Check', 'CheckButton'} |
183 } | 199 } |
184 } | 200 } |
185 | 201 |
186 | 202 |
187 | 203 |
191 local configPadding, configSpacing = 3, 3 | 207 local configPadding, configSpacing = 3, 3 |
192 | 208 |
193 --- Walks the structure table to generate a pretty config panel | 209 --- Walks the structure table to generate a pretty config panel |
194 local InitConfig = function() | 210 local InitConfig = function() |
195 configInit = true | 211 configInit = true |
196 local configWidth = B:GetWidth() | 212 local configWidth = vn:GetWidth() |
197 local optionWidth = (configWidth - configPadding) / 3 - configSpacing | 213 local optionWidth = (configWidth - configPadding) / 3 - configSpacing |
198 local configHeight = 0 | 214 local configHeight = 0 |
199 local bottom_extent = 0 | 215 local bottom_extent = 0 |
200 local clusterHeight = 0 | 216 local clusterHeight = 0 |
201 local clusterOffset = 0 | 217 local clusterOffset = 0 |
202 local lastCluster | 218 local lastCluster |
203 local cluster = 1 | 219 local cluster = 1 |
204 local col = 0 | 220 local col = 0 |
205 for t, taboptions in ipairs(configDialog) do | 221 for moduleName, moduleOpts in pairs(M.config) do |
222 for t, taboptions in ipairs(moduleOpts) do | |
206 local group = taboptions[1] | 223 local group = taboptions[1] |
207 cluster = taboptions[2] | 224 cluster = taboptions[2] |
208 col = col + 1 | 225 col = col + 1 |
209 | 226 |
210 | 227 |
228 row = row + 1 | 245 row = row + 1 |
229 local optionInfo = taboptions[i] | 246 local optionInfo = taboptions[i] |
230 if type(optionInfo) == 'string' then | 247 if type(optionInfo) == 'string' then |
231 optionInfo = optionTemplates[optionInfo] | 248 optionInfo = optionTemplates[optionInfo] |
232 end | 249 end |
233 local key, fieldname, valueFuncGenerator, configType = unpack(optionInfo) | 250 local key, fieldname, valueType, configType = unpack(optionInfo) |
251 assert(GetValue[valueType], 'Invalid valueType \''..tostring(valueType)..'\' ('..type(valueType)..')') | |
252 assert(ResetField[configType], 'Invalid fieldType \''..tostring(configType)..'\' ('..type(configType)..')') | |
234 | 253 |
235 if not optionTemplates[key] then | 254 if not optionTemplates[key] then |
236 optionTemplates[key] = optionInfo | 255 optionTemplates[key] = optionInfo |
237 end | 256 end |
238 | 257 |
241 | 260 |
242 if not configFrames[t][row] then | 261 if not configFrames[t][row] then |
243 print('building frame', t, group, row) | 262 print('building frame', t, group, row) |
244 local frameTemplate = 'VeneerConfig'..configType | 263 local frameTemplate = 'VeneerConfig'..configType |
245 local frameType = frameTypeConv[configType] or configType | 264 local frameType = frameTypeConv[configType] or configType |
246 configFrames[t][row] = CreateFrame(frameType, fullkey, B, frameTemplate) | 265 configFrames[t][row] = CreateFrame(frameType, 'Vn_'.. moduleName ..'_'.. fullkey, vn, frameTemplate) |
247 local f = configFrames[t][row] | 266 local f = configFrames[t][row] |
267 f.ValueType = valueType | |
268 f.OptType = configType | |
269 f.FrameType = frameType | |
248 f.OptKey = key | 270 f.OptKey = key |
271 f.OptRoot = vn.Conf[moduleName] | |
249 f.OptTab = group | 272 f.OptTab = group |
250 f.OptName = fullkey | 273 f.OptName = fullkey |
251 local valueFunc, initialValue = valueFuncGenerator(group, key) | 274 f.OptInfo = optionInfo |
252 print(' value getter', fullkey,'->', valueFunc,initialValue) | 275 local valueFunc, initialValue = GetValue(f) |
253 configTypeParams[configType](f, optionInfo) | 276 print(' value getter', '|cFFFFFF00'..moduleName..'|r.|cFF00FFFF'.. tostring(fullkey),'|r->', valueFunc,initialValue) |
277 ResetField(f) | |
254 f.OptValue = valueFunc | 278 f.OptValue = valueFunc |
255 | 279 |
256 --- Enclosing these to | 280 --- Enclosing these to |
257 -- a) make the panel easy to bring up externally | 281 -- a) make the panel easy to bring up externally |
258 -- b) limit gameplay risk from config frame errors | 282 -- b) limit gameplay risk from config frame errors |
274 end | 298 end |
275 end | 299 end |
276 configInit = nil | 300 configInit = nil |
277 end | 301 end |
278 local newValue = valueFunc(self) | 302 local newValue = valueFunc(self) |
279 if newValue ~= B.Conf[fullkey] then | 303 if newValue ~= self.OptRoot[fullkey] then |
280 print(newValue, fullkey) | 304 print(newValue, fullkey) |
281 f.fieldvalue:SetText(valueFunc(self, true)) | 305 f.fieldvalue:SetText(valueFunc(self, true)) |
282 B.Conf[fullkey] = valueFunc(self) | 306 self.OptRoot[fullkey] = valueFunc(self) |
283 -- prepare to update | 307 -- prepare to update |
284 wipe(B.drawn[f.OptTab]) | 308 vn[moduleName]:OnUpdate() |
285 B.UpdateBuffs(self.OptTab) | 309 vn.UpdateConfigLayers() |
286 B.UpdateConfigLayers() | |
287 end | 310 end |
288 | 311 |
289 end | 312 end |
290 | 313 |
291 f:SetValue(initialValue) | 314 f:SetValue(initialValue) |
301 local point, relative, x, y = 'TOPLEFT', 'BOTTOMLEFT', 0, -3 | 324 local point, relative, x, y = 'TOPLEFT', 'BOTTOMLEFT', 0, -3 |
302 | 325 |
303 local base | 326 local base |
304 if (row == 1) then | 327 if (row == 1) then |
305 bottom_extent = 0 | 328 bottom_extent = 0 |
306 base = B.header | 329 base = vn.header |
307 x = (col-1) * (optionWidth+configSpacing) | 330 x = (col-1) * (optionWidth+configSpacing) |
308 y = -configPadding | 331 y = -configPadding |
309 else | 332 else |
310 base = configFrames[t][row-1] | 333 base = configFrames[t][row-1] |
311 end | 334 end |
326 | 349 |
327 clusterHeight = max(clusterHeight, bottom_extent) | 350 clusterHeight = max(clusterHeight, bottom_extent) |
328 --print('y', floor(yBuffer+0.5), 'f:H', floor(f:GetHeight()+0.5), 'hTally', floor(bottom_extent+0.5), 'hMax', floor(configHeight+0.5)) | 351 --print('y', floor(yBuffer+0.5), 'f:H', floor(f:GetHeight()+0.5), 'hTally', floor(bottom_extent+0.5), 'hMax', floor(configHeight+0.5)) |
329 end | 352 end |
330 end | 353 end |
331 end | 354 end |
355 end | |
356 | |
332 | 357 |
333 -- grab the last cluster | 358 -- grab the last cluster |
334 if lastCluster == cluster then | 359 if lastCluster == cluster then |
335 print('|cFF00FF00##scooping up last cluster info') | 360 print('|cFF00FF00##scooping up last cluster info') |
336 configHeight = configHeight + clusterHeight | 361 configHeight = configHeight + clusterHeight |
337 end | 362 end |
338 | 363 |
339 if not B.configFramesCreated then | 364 if not vn.configFramesCreated then |
340 B.configFramesCreated = true | 365 vn.configFramesCreated = true |
341 B:SetHeight(B.header:GetStringHeight() + configSpacing*3 + configHeight) | 366 vn:SetHeight(vn.header:GetStringHeight() + configSpacing*3 + configHeight) |
342 end | 367 end |
343 if configInit then configInit = nil end | 368 if configInit then configInit = nil end |
344 end | 369 end |
345 | 370 |
346 M.Command = function(enable, editbox) | 371 M.Command = function(enable, editbox) |
347 displays = B.displays | 372 displays = vn.displays |
348 if type(enable) == 'boolean' then | 373 if type(enable) == 'boolean' then |
349 B.Conf.ConfigMode = enable | 374 vn.Conf.ConfigMode = enable |
350 else | 375 else |
351 B.Conf.ConfigMode = (B.Conf.ConfigMode == false) and true or false | 376 vn.Conf.ConfigMode = (vn.Conf.ConfigMode == false) and true or false |
352 end | 377 end |
353 | 378 |
354 print('/BUFF', B.Conf.ConfigMode, type(B.Conf.ConfigMode)) | 379 print('/BUFF', vn.Conf.ConfigMode, type(vn.Conf.ConfigMode)) |
355 if B.Conf.ConfigMode then | 380 if vn.Conf.ConfigMode then |
356 if not B.configFramesCreated then | 381 if not vn.configFramesCreated then |
357 InitConfig() | 382 InitConfig() |
358 end | 383 end |
359 print('Veneer config') | 384 print('Veneer config') |
360 B:Show() | 385 vn:Show() |
361 else | 386 else |
362 B:Hide() | 387 vn:Hide() |
363 end | 388 end |
364 B.UpdateAll() | 389 vn.UpdateAll() |
365 B.UpdateConfigLayers() | 390 vn.UpdateConfigLayers() |
366 end | 391 end |
367 | 392 |
368 B.Close = function () | 393 vn.Close = function () |
369 M.Command() | 394 M.Command() |
370 end | 395 end |
371 | 396 |
372 B.ToggleGuides = function(_, self) | 397 vn.ToggleGuides = function(_, self) |
373 B.Conf.GuidesMode = (not B.Conf.GuidesMode) | 398 vn.Conf.GuidesMode = (not vn.Conf.GuidesMode) |
374 if B.Conf.GuidesMode then | 399 if vn.Conf.GuidesMode then |
375 self:GetNormalTexture():SetTexture(0.94, 0.21, 0.21, 1) | 400 self:GetNormalTexture():SetTexture(0.94, 0.21, 0.21, 1) |
376 else | 401 else |
377 self:GetNormalTexture():SetTexture(0, 0, 0, 1) | 402 self:GetNormalTexture():SetTexture(0, 0, 0, 1) |
378 end | 403 end |
379 | 404 |
380 B.UpdateConfigLayers() | 405 vn.UpdateConfigLayers() |
381 end | 406 end |
382 | 407 |
383 M.OnEnable = function() | 408 M.OnEnable = function() |
384 print('|cFFFF0088config module', B.Conf.ConfigMode) | 409 print('|cFFFF0088config module', vn.Conf.ConfigMode) |
385 M.Command(B.Conf.ConfigMode) | 410 M.Command(vn.Conf.ConfigMode) |
386 end | 411 end |
387 | 412 |
388 M.OnInitialize = function() | 413 M.OnInitialize = function() |
389 DEFAULT_CHAT_FRAME:AddMessage("|cFF22D822Veneer|r") | 414 DEFAULT_CHAT_FRAME:AddMessage("|cFF22D822Veneer|r confogulator loaded. Type |cFF00FFFF/vn|r to begin.") |
390 SLASH_BUFFALO1, SLASH_BUFFALO2 = "/buffalo", "/buff" | 415 SLASH_VENEER1, SLASH_VENEER2 = "/veneer", "/vn" |
391 SlashCmdList.BUFFALO = M.Command | 416 SlashCmdList.VENEER = M.Command |
392 | 417 |
393 end | 418 end |