vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function DART_CheckButton_OnClick() |
2 | DART_Update_Setting(this:GetChecked()); |
||
3 | DART_Run_Functions(this:GetChecked()); |
||
4 | end |
||
5 | |||
6 | function DART_ColorPicker_OnClick() |
||
7 | local basecolor = DART_Get_Setting(this.index); |
||
8 | local color = {}; |
||
9 | color.r = basecolor.r; |
||
10 | color.g = basecolor.g; |
||
11 | color.b = basecolor.b; |
||
12 | ColorPickerFrame.previousValues = color; |
||
13 | ColorPickerFrame.cancelFunc = DART_ColorPicker_ColorCancelled; |
||
14 | ColorPickerFrame.opacityFunc = DART_ColorPicker_ColorChanged; |
||
15 | ColorPickerFrame.func = DART_ColorPicker_ColorChanged; |
||
16 | ColorPickerFrame.colorBox = this:GetName(); |
||
17 | ColorPickerFrame.index = this.index; |
||
18 | ColorPickerFrame.subindex = this.subindex; |
||
19 | ColorPickerFrame:SetColorRGB(color.r, color.g, color.b); |
||
20 | ColorPickerFrame:ClearAllPoints(); |
||
21 | if (DART_Options:GetRight() < UIParent:GetWidth() / 2) then |
||
22 | ColorPickerFrame:SetPoint("LEFT", "DART_Options", "RIGHT", 10, 0); |
||
23 | else |
||
24 | ColorPickerFrame:SetPoint("RIGHT", "DART_Options", "LEFT", -10, 0); |
||
25 | end |
||
26 | ColorPickerFrame:Show(); |
||
27 | end |
||
28 | |||
29 | function DART_ColorPicker_ColorCancelled() |
||
30 | local color = ColorPickerFrame.previousValues; |
||
31 | DART_Update_Setting(color, ColorPickerFrame.index, ColorPickerFrame.subindex); |
||
32 | getglobal(ColorPickerFrame.colorBox):SetBackdropColor(color.r, color.g, color.b); |
||
33 | if (ColorPickerFrame.index ~= "CONDITION") then |
||
34 | DART_Run_Functions(1, 1, getglobal(ColorPickerFrame.colorBox).updatepreview); |
||
35 | end |
||
36 | end |
||
37 | |||
38 | function DART_ColorPicker_ColorChanged() |
||
39 | local r, g, b = ColorPickerFrame:GetColorRGB(); |
||
40 | local color = { r=r, g=g, b=b }; |
||
41 | DART_Update_Setting(color, ColorPickerFrame.index, ColorPickerFrame.subindex); |
||
42 | getglobal(ColorPickerFrame.colorBox):SetBackdropColor(color.r, color.g, color.b); |
||
43 | if (ColorPickerFrame.index ~= "CONDITION") then |
||
44 | DART_Run_Functions(1, 1, getglobal(ColorPickerFrame.colorBox).updatepreview); |
||
45 | end |
||
46 | end |
||
47 | |||
48 | function DART_ConditionMenu_Update() |
||
49 | local list, frame, numButtons; |
||
50 | list = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions; |
||
51 | if (not list) then list = {}; end |
||
52 | frame = DART_ControlOptions_ConditionMenu; |
||
53 | numButtons = 7; |
||
54 | |||
55 | local numOptions = #list; |
||
56 | local offset = FauxScrollFrame_GetOffset(frame); |
||
57 | if (not offset) then offset = 0; end |
||
58 | local index, button, text; |
||
59 | |||
60 | for i=1, numButtons do |
||
61 | button = getglobal(frame:GetName().."_Button"..i); |
||
62 | index = offset + i; |
||
63 | if ( list[index] ) then |
||
64 | button:Disable(); |
||
65 | button:Show(); |
||
66 | button.index = index; |
||
67 | button.cboxbase = frame:GetName(); |
||
68 | text = DL_Get_MenuText(DL_CONDITIONS_MENU, list[index].condition); |
||
69 | if (not text) then text = ""; end |
||
70 | local conditionsIndex; |
||
71 | for cindex, value in pairs(DL_CONDITIONS_MENU) do |
||
72 | if (value.value == list[index].condition) then |
||
73 | conditionsIndex = cindex; |
||
74 | break; |
||
75 | end |
||
76 | end |
||
77 | local params = DL_CONDITIONS_MENU[conditionsIndex].params; |
||
78 | if (params == 1 or params == 2) then |
||
79 | text = text..": |cFFFFFFFF"..DL_Get_MenuText(DL_ACTIONS, list[index].action); |
||
80 | if (list[index].ignoreGlobal) then |
||
81 | text = text..",|cFFCCCCCC "..DART_TEXT.IgnoreGlobal; |
||
82 | end |
||
83 | elseif (params == 3) then |
||
84 | text = text.." on "..list[index].unit..": |cFFFFFFFF"..list[index].buff; |
||
85 | elseif (params == 4) then |
||
86 | text = text.." |cFFFFFFFF"..DL_Get_MenuText(DL_COMPARE_MENU, list[index].compare).." "..list[index].number; |
||
87 | elseif (params == 5) then |
||
88 | text = text..": |cFFFFFFFF"..list[index].unit..", "..list[index].text; |
||
89 | elseif (params == 6) then |
||
90 | text = text.." Applications "..DL_Get_MenuText(DL_COMPARE_MENU, list[index].compare).." "..list[index].number.." on "..list[index].unit..": |cFFFFFFFF"..list[index].text; |
||
91 | elseif (params == 7) then |
||
92 | local number = list[index].number; |
||
93 | if (number < 1) then |
||
94 | number = (number * 100).."%"; |
||
95 | end |
||
96 | text = text.." "..list[index].unit.." "..DL_Get_MenuText(DL_COMPARE_MENU, list[index].compare).." "..number; |
||
97 | elseif (params == 8) then |
||
98 | local form = DL_Get_MenuText(DL_FORMS, list[index].form); |
||
99 | if (form == "") then |
||
100 | form = list[index].form; |
||
101 | end |
||
102 | text = text..": |cFFFFFFFF"..form; |
||
103 | elseif (params == 9) then |
||
104 | text = text..": |cFFFFFFFF"..DL_Get_MenuText(DL_TARGET_PARAMS, list[index].target); |
||
105 | elseif (params == 10) then |
||
106 | text = text..": |cFFFFFFFF"..list[index].number; |
||
107 | elseif (params == 11) then |
||
108 | text = text..": |cFFFFFFFF"..DL_Get_MenuText(DL_ACTIONS, list[index].action).." "..DL_Get_MenuText(DL_COMPARE_MENU, list[index].compare).." "..list[index].number; |
||
109 | elseif (params == 12) then |
||
110 | text = text..": |cFFFFFFFF"..list[index].text; |
||
111 | elseif (params == 13) then |
||
112 | text = text..": |cFFFFFFFF"..list[index].unit; |
||
113 | elseif (params == 14) then |
||
114 | text = text..": |cFFFFFFFF"..list[index].unit.." and "..list[index].unit2; |
||
115 | end |
||
116 | getglobal(frame:GetName().."_Button"..i.."ConditionText"):SetText(text); |
||
117 | |||
118 | text = DART_TEXT.Response.." |cFFFFFF00"..DL_Get_MenuText(DART_RESPONSES, list[index].response); |
||
119 | if (list[index].response == 3 or list[index].response == 4) then |
||
120 | text = text..": |cFFFFFFFF"..list[index].texture; |
||
121 | elseif (list[index].response == 7 or list[index].response == 8 or list[index].response == 9 or list[index].response == 11 or list[index].response == 23 or list[index].response == 15 or list[index].response == 19 or list[index].response == 20 or list[index].response == 28) then |
||
122 | text = text..": |cFFFFFFFF"..list[index].amount; |
||
123 | elseif (list[index].response == 10) then |
||
124 | text = text..": |cFFFFFFFF"..list[index].rx..", "..list[index].ry; |
||
125 | elseif (list[index].response == 12 or list[index].response == 13 or list[index].response == 16 or list[index].response == 21 or list[index].response == 24) then |
||
126 | text = text.." to "..(list[index].alpha * 100).."%"; |
||
127 | elseif (list[index].response == 14 or list[index].response == 17 or list[index].response == 18 or list[index].response == 22 or list[index].response == 25) then |
||
128 | local hex = DL_Get_HexColor(list[index].color.r, list[index].color.g, list[index].color.b); |
||
129 | text = text.." to "..hex.."this color"; |
||
130 | elseif (list[index].response == 26 or list[index].response == 27) then |
||
131 | text = text..": |cFFFFFFFF"..list[index].rtext; |
||
132 | end |
||
133 | getglobal(frame:GetName().."_Button"..i.."ResponseText"):SetText(text); |
||
134 | |||
135 | text = DART_TEXT.Overrides.." |cFFFFFFFF"; |
||
136 | for i,o in pairs(list[index].overrides) do |
||
137 | if (i == #list[index].overrides) then |
||
138 | text = text..o; |
||
139 | else |
||
140 | text = text..o..", "; |
||
141 | end |
||
142 | end |
||
143 | getglobal(frame:GetName().."_Button"..i.."OverrideText"):SetText(text); |
||
144 | getglobal(frame:GetName().."_Button"..i.."Index"):SetText(index); |
||
145 | else |
||
146 | button:Hide(); |
||
147 | end |
||
148 | end |
||
149 | |||
150 | FauxScrollFrame_Update(frame, numOptions, numButtons, 40); |
||
151 | frame:Show(); |
||
152 | end |
||
153 | |||
154 | function DART_Add_Condition() |
||
155 | if (not DART_CONDITION_BUFFER) then return; end |
||
156 | local baseOptions = "DART_ControlOptions_"; |
||
157 | |||
158 | local option = getglobal(baseOptions.."Buff"); |
||
159 | if (option:IsShown()) then |
||
160 | DART_CONDITION_BUFFER.buff = option:GetText(); |
||
161 | if (not DART_CONDITION_BUFFER.buff) then DART_CONDITION_BUFFER.buff = ""; end |
||
162 | end |
||
163 | option = getglobal(baseOptions.."Text"); |
||
164 | if (option:IsShown()) then |
||
165 | DART_CONDITION_BUFFER.text = option:GetText(); |
||
166 | if (not DART_CONDITION_BUFFER.text) then DART_CONDITION_BUFFER.text = ""; end |
||
167 | end |
||
168 | option = getglobal(baseOptions.."Number"); |
||
169 | if (option:IsShown()) then |
||
170 | DART_CONDITION_BUFFER.number = option:GetNumber(); |
||
171 | if (not DART_CONDITION_BUFFER.number) then DART_CONDITION_BUFFER.number = 1; end |
||
172 | end |
||
173 | option = getglobal(baseOptions.."ResponseText"); |
||
174 | if (option:IsShown()) then |
||
175 | DART_CONDITION_BUFFER.rtext = option:GetText(); |
||
176 | if (not DART_CONDITION_BUFFER.rtext) then DART_CONDITION_BUFFER.rtext = ""; end |
||
177 | end |
||
178 | option = getglobal(baseOptions.."ResponseX"); |
||
179 | if (option and option:IsShown()) then |
||
180 | DART_CONDITION_BUFFER.rx = option:GetNumber(); |
||
181 | if (not DART_CONDITION_BUFFER.rx) then DART_CONDITION_BUFFER.rx = 0; end |
||
182 | end |
||
183 | option = getglobal(baseOptions.."ResponseY"); |
||
184 | if (option and option:IsShown()) then |
||
185 | DART_CONDITION_BUFFER.ry = option:GetNumber(); |
||
186 | if (not DART_CONDITION_BUFFER.ry) then DART_CONDITION_BUFFER.ry = 0; end |
||
187 | end |
||
188 | |||
189 | local orbox = getglobal(baseOptions.."Overrides"); |
||
190 | DART_CONDITION_BUFFER.overrides = orbox:GetText(); |
||
191 | orbox:SetText(""); |
||
192 | orbox:ClearFocus(); |
||
193 | if (DART_CONDITION_BUFFER.overrides and DART_CONDITION_BUFFER.overrides ~= "") then |
||
194 | local overrides = {}; |
||
195 | local num = ""; |
||
196 | local index = 1; |
||
197 | local char; |
||
198 | for i=1, string.len(DART_CONDITION_BUFFER.overrides) do |
||
199 | char = string.sub(DART_CONDITION_BUFFER.overrides, i, i); |
||
200 | if (char == ",") then |
||
201 | num = tonumber(num); |
||
202 | if (num) then |
||
203 | overrides[index] = num; |
||
204 | index = index + 1; |
||
205 | end |
||
206 | num = ""; |
||
207 | else |
||
208 | num = num..char; |
||
209 | end |
||
210 | end |
||
211 | num = tonumber(num); |
||
212 | if (num) then |
||
213 | overrides[index] = num; |
||
214 | end |
||
215 | DART_CONDITION_BUFFER.overrides = {}; |
||
216 | DL_Copy_Table(overrides, DART_CONDITION_BUFFER.overrides); |
||
217 | else |
||
218 | DART_CONDITION_BUFFER.overrides = {}; |
||
219 | end |
||
220 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions) then |
||
221 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions = {}; |
||
222 | end |
||
223 | local index = #DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions + 1; |
||
224 | if (DART_CONDITION_EDITTING) then |
||
225 | index = DART_CONDITION_EDITTING; |
||
226 | end |
||
227 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions[index] = {}; |
||
228 | DL_Copy_Table(DART_CONDITION_BUFFER, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions[index]); |
||
229 | DART_ControlOptions_Condition_Setting:SetText(""); |
||
230 | DART_ControlOptions_Response_Setting:SetText(""); |
||
231 | DART_Reset_Parameters("DART_ControlOptions"); |
||
232 | getglobal("DART_Texture_"..DART_TEXTURE_INDEX).activeConditions = {}; |
||
233 | DART_ConditionMenu_Update(); |
||
234 | DART_CONDITION_BUFFER = nil; |
||
235 | DART_CONDITION_EDITTING = nil; |
||
236 | end |
||
237 | |||
238 | function DART_Select_Condition(condition, menucontrol) |
||
239 | if (not condition) then |
||
240 | DART_CONDITION_EDITTING = nil; |
||
241 | condition = this.value; |
||
242 | DART_CONDITION_BUFFER = { condition = condition }; |
||
243 | else |
||
244 | DART_CONDITION_EDITTING = condition; |
||
245 | DART_CONDITION_BUFFER = {}; |
||
246 | DL_Copy_Table(DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions[condition], DART_CONDITION_BUFFER); |
||
247 | DL_Init_MenuControl(DART_ControlOptions_Condition, DART_CONDITION_BUFFER.condition); |
||
248 | DART_CONDITION_BUFFER.overrides = ""; |
||
249 | for i,o in pairs(DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions[condition].overrides) do |
||
250 | if (i == #DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions[condition].overrides) then |
||
251 | DART_CONDITION_BUFFER.overrides = DART_CONDITION_BUFFER.overrides..o; |
||
252 | else |
||
253 | DART_CONDITION_BUFFER.overrides = DART_CONDITION_BUFFER.overrides..o..", "; |
||
254 | end |
||
255 | DART_ControlOptions_Overrides:SetText(DART_CONDITION_BUFFER.overrides); |
||
256 | end |
||
257 | condition = DART_CONDITION_BUFFER.condition; |
||
258 | end |
||
259 | if (not menucontrol) then menucontrol = DART_ScrollMenu.cboxbase; end |
||
260 | local options = getglobal(menucontrol):GetParent():GetName(); |
||
261 | DART_Reset_Parameters(options); |
||
262 | local conditionsIndex; |
||
263 | for index, value in pairs(DL_CONDITIONS_MENU) do |
||
264 | if (value.value == condition) then |
||
265 | conditionsIndex = index; |
||
266 | break; |
||
267 | end |
||
268 | end |
||
269 | local params = DL_CONDITIONS_MENU[conditionsIndex].params; |
||
270 | if (params == 1) then |
||
271 | DART_Show_Parameters({"_ActionID", "_IgnoreGlobal"}, {1, 2}, options); |
||
272 | elseif (params == 2) then |
||
273 | DART_Show_Parameters({"_ActionID"}, {1}, options); |
||
274 | elseif (params == 3) then |
||
275 | if (not DART_CONDITION_EDITTING) then |
||
276 | DART_CONDITION_BUFFER.unit = "player"; |
||
277 | end |
||
278 | DART_Show_Parameters({"_Unit", "_Buff"}, {1, 3}, options); |
||
279 | elseif (params == 4) then |
||
280 | DL_Set_Anchor("_Condition", 0, -15, nil, nil, nil, getglobal(options.."_Comparison")); |
||
281 | DL_Set_Anchor("_Condition", 0, -40, nil, nil, nil, getglobal(options.."_Number")); |
||
282 | DART_Show_Parameters({"_Comparison", "_Number"}, {1, 3}, options); |
||
283 | elseif (params == 5) then |
||
284 | if (not DART_CONDITION_EDITTING) then |
||
285 | DART_CONDITION_BUFFER.unit = "player"; |
||
286 | end |
||
287 | DART_Show_Parameters({"_Unit", "_Text"}, {1, 3}, options); |
||
288 | elseif (params == 6) then |
||
289 | DL_Set_Anchor("_Condition", 0, -65, nil, nil, nil, getglobal(options.."_Comparison")); |
||
290 | DL_Set_Anchor("_Comparison", 5, 0, "LEFT", "RIGHT", nil, getglobal(options.."_Number")); |
||
291 | if (not DART_CONDITION_EDITTING) then |
||
292 | DART_CONDITION_BUFFER.unit = "player"; |
||
293 | end |
||
294 | DART_Show_Parameters({"_Unit", "_Text", "_Comparison", "_Number"}, {1, 3, 1, 3}, options); |
||
295 | elseif (params == 7) then |
||
296 | DL_Set_Anchor("_Condition", 0, -40, nil, nil, nil, getglobal(options.."_Comparison")); |
||
297 | DL_Set_Anchor("_Condition", 0, -65, nil, nil, nil, getglobal(options.."_Number")); |
||
298 | if (not DART_CONDITION_EDITTING) then |
||
299 | DART_CONDITION_BUFFER.unit = "player"; |
||
300 | end |
||
301 | DART_Show_Parameters({"_Unit", "_Comparison", "_Number"}, {1, 1, 3}, options); |
||
302 | elseif (params == 8) then |
||
303 | DART_Show_Parameters({"_Forms"}, {1}, options); |
||
304 | elseif (params == 9) then |
||
305 | DART_Show_Parameters({"_Targets"}, {1}, options); |
||
306 | elseif (params == 10) then |
||
307 | DL_Set_Anchor("_Condition", 0, -15, nil, nil, nil, getglobal(options.."_Number")); |
||
308 | DART_Show_Parameters({"_Number"}, {3}, options); |
||
309 | elseif (params == 11) then |
||
310 | DL_Set_Anchor("_Condition", 0, -40, nil, nil, nil, getglobal(options.."_Comparison")); |
||
311 | DL_Set_Anchor("_Condition", 0, -65, nil, nil, nil, getglobal(options.."_Number")); |
||
312 | DART_Show_Parameters({"_ActionID", "_Comparison", "_Number"}, {1, 1, 3}, options); |
||
313 | elseif (params == 12) then |
||
314 | DART_Show_Parameters({"_Text"}, {3}, options); |
||
315 | elseif (params == 13) then |
||
316 | if (not DART_CONDITION_EDITTING) then |
||
317 | DART_CONDITION_BUFFER.unit = "player"; |
||
318 | end |
||
319 | DART_Show_Parameters({"_Unit"}, {1}, options); |
||
320 | elseif (params == 14) then |
||
321 | if (not DART_CONDITION_EDITTING) then |
||
322 | DART_CONDITION_BUFFER.unit = "player"; |
||
323 | DART_CONDITION_BUFFER.unit2 = "player"; |
||
324 | end |
||
325 | DART_Show_Parameters({"_Unit", "_Unit2"}, {1, 1}, options); |
||
326 | end |
||
327 | end |
||
328 | |||
329 | function DART_Select_Response(response, menucontrol) |
||
330 | if (not DART_CONDITION_BUFFER) then return; end |
||
331 | if (not menucontrol) then menucontrol = DART_ScrollMenu.cboxbase; end |
||
332 | local options = getglobal(menucontrol):GetParent():GetName(); |
||
333 | if (not response) then |
||
334 | response = this.value; |
||
335 | DART_CONDITION_BUFFER.response = response; |
||
336 | else |
||
337 | response = DART_CONDITION_BUFFER.response; |
||
338 | DL_Init_MenuControl(getglobal(options.."_Response"), response); |
||
339 | end |
||
340 | DART_Reset_Parameters(options, 1); |
||
341 | if (response == 3 or response == 4) then |
||
342 | DART_Show_Parameters({"_ResponseTexture"}, {1}, options); |
||
343 | elseif (response == 7 or response == 8 or response == 9 or response == 11 or response == 23 or response == 15 or response == 19 or response == 20 or response == 28) then |
||
344 | DART_Show_Parameters({"_Amount"}, {4}, options); |
||
345 | elseif (response == 10) then |
||
346 | DART_Show_Parameters({"_ResponseX","_ResponseY"}, {3,3}, options); |
||
347 | elseif (response == 12 or response == 13 or response == 16 or response == 21 or response == 24) then |
||
348 | DART_Show_Parameters({"_Alpha"}, {4}, options); |
||
349 | elseif (response == 14 or response == 17 or response == 18 or response == 22 or response == 25) then |
||
350 | DART_Show_Parameters({"_Color"}, {5}, options); |
||
351 | elseif (response == 26 or response == 27) then |
||
352 | DART_Show_Parameters({"_ResponseText"}, {3}, options); |
||
353 | end |
||
354 | end |
||
355 | |||
356 | function DART_Show_Parameters(parameters, types, base) |
||
357 | for i, param in pairs(parameters) do |
||
358 | local frame = getglobal(base..param); |
||
359 | frame:Show(); |
||
360 | if (DART_CONDITION_EDITTING) then |
||
361 | if (types[i] == 1) then |
||
362 | DL_Init_MenuControl(frame, DART_CONDITION_BUFFER[frame.subindex]); |
||
363 | elseif (types[i] == 2) then |
||
364 | DL_Init_CheckBox(frame, DART_CONDITION_BUFFER[frame.subindex]); |
||
365 | elseif (types[i] == 3) then |
||
366 | DL_Init_EditBox(frame, DART_CONDITION_BUFFER[frame.subindex]); |
||
367 | elseif (types[i] == 4) then |
||
368 | if (not DART_CONDITION_BUFFER[frame.subindex]) then |
||
369 | local min, max = frame:GetMinMaxValues(); |
||
370 | if (frame.scale) then |
||
371 | max = max / frame.scale; |
||
372 | end |
||
373 | DART_CONDITION_BUFFER[frame.subindex] = max; |
||
374 | end |
||
375 | DL_Init_Slider(frame, DART_CONDITION_BUFFER[frame.subindex]); |
||
376 | elseif (types[i] == 5) then |
||
377 | if (not DART_CONDITION_BUFFER[frame.subindex]) then |
||
378 | DART_CONDITION_BUFFER[frame.subindex] = {r=1, g=1, b=1}; |
||
379 | end |
||
380 | DL_Init_ColorPicker(frame, DART_CONDITION_BUFFER[frame.subindex]); |
||
381 | end |
||
382 | elseif (param == "_Unit" or param == "_Unit2") then |
||
383 | DL_Init_MenuControl(frame, "player"); |
||
384 | end |
||
385 | end |
||
386 | end |
||
387 | |||
388 | function DART_Reset_Parameters(options, toggle) |
||
389 | if (not toggle) then |
||
390 | getglobal(options.."_ActionID"):Hide(); |
||
391 | getglobal(options.."_ActionID_Setting"):SetText(""); |
||
392 | getglobal(options.."_IgnoreGlobal"):Hide(); |
||
393 | getglobal(options.."_IgnoreGlobal"):SetChecked(0); |
||
394 | getglobal(options.."_Unit"):Hide(); |
||
395 | getglobal(options.."_Unit_Setting"):SetText(""); |
||
396 | getglobal(options.."_Unit2"):Hide(); |
||
397 | getglobal(options.."_Unit2_Setting"):SetText(""); |
||
398 | getglobal(options.."_Buff"):Hide(); |
||
399 | getglobal(options.."_Buff"):SetText(""); |
||
400 | getglobal(options.."_Comparison"):Hide(); |
||
401 | getglobal(options.."_Comparison_Setting"):SetText(""); |
||
402 | getglobal(options.."_Number"):Hide(); |
||
403 | getglobal(options.."_Number"):SetText(""); |
||
404 | getglobal(options.."_Text"):Hide(); |
||
405 | getglobal(options.."_Text"):SetText(""); |
||
406 | getglobal(options.."_Forms"):Hide(); |
||
407 | getglobal(options.."_Forms_Setting"):SetText(""); |
||
408 | getglobal(options.."_Targets"):Hide(); |
||
409 | getglobal(options.."_Targets_Setting"):SetText(""); |
||
410 | end |
||
411 | getglobal(options.."_ResponseTexture"):Hide(); |
||
412 | getglobal(options.."_ResponseTexture_Setting"):SetText(""); |
||
413 | getglobal(options.."_Amount"):Hide(); |
||
414 | getglobal(options.."_Amount_Display"):SetText(""); |
||
415 | getglobal(options.."_Alpha"):Hide(); |
||
416 | getglobal(options.."_Alpha_Display"):SetText(""); |
||
417 | getglobal(options.."_ResponseX"):Hide(); |
||
418 | getglobal(options.."_ResponseX"):SetText(""); |
||
419 | getglobal(options.."_ResponseY"):Hide(); |
||
420 | getglobal(options.."_ResponseY"):SetText(""); |
||
421 | getglobal(options.."_Color"):Hide(); |
||
422 | getglobal(options.."_ResponseText"):Hide(); |
||
423 | end |
||
424 | |||
425 | function DART_Condition_Delete() |
||
426 | local list = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions; |
||
427 | getglobal("DART_Texture_"..DART_TEXTURE_INDEX).activeConditions = {}; |
||
428 | |||
429 | for i=1, #list do |
||
430 | if (i > this:GetParent().index and i > 1) then |
||
431 | list[i - 1] = {}; |
||
432 | DL_Copy_Table(list[i], list[i - 1]); |
||
433 | end |
||
434 | end |
||
435 | list[#list] = nil; |
||
436 | DART_ConditionMenu_Update(); |
||
437 | end |
||
438 | |||
439 | function DART_Condition_Edit() |
||
440 | local ci = this:GetParent().index; |
||
441 | DART_Select_Condition(ci, this:GetParent().cboxbase); |
||
442 | DART_Select_Response(DART_CONDITION_BUFFER.response, this:GetParent().cboxbase); |
||
443 | end |
||
444 | |||
445 | function DART_Condition_MoveDown() |
||
446 | local list; |
||
447 | local index = this:GetParent().index; |
||
448 | local newindex = index + 1; |
||
449 | |||
450 | list = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions; |
||
451 | |||
452 | if (newindex > #list) then return; end |
||
453 | |||
454 | local buffer = {}; |
||
455 | DL_Copy_Table(list[index], buffer); |
||
456 | local buffer2 = {}; |
||
457 | DL_Copy_Table(list[newindex], buffer2); |
||
458 | |||
459 | DL_Copy_Table(buffer2, list[index]); |
||
460 | DL_Copy_Table(buffer, list[newindex]); |
||
461 | DART_ConditionMenu_Update(); |
||
462 | end |
||
463 | |||
464 | function DART_Condition_MoveUp() |
||
465 | local list; |
||
466 | local index = this:GetParent().index; |
||
467 | local newindex = index - 1; |
||
468 | if (newindex == 0) then return; end |
||
469 | |||
470 | list = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions; |
||
471 | |||
472 | local buffer = {}; |
||
473 | DL_Copy_Table(list[index], buffer); |
||
474 | local buffer2 = {}; |
||
475 | DL_Copy_Table(list[newindex], buffer2); |
||
476 | |||
477 | DL_Copy_Table(buffer2, list[index]); |
||
478 | DL_Copy_Table(buffer, list[newindex]); |
||
479 | DART_ConditionMenu_Update(); |
||
480 | end |
||
481 | |||
482 | function DART_EditBox_Update() |
||
483 | local value = this:GetText(); |
||
484 | if (not value) then value = ""; end |
||
485 | if (this.number) then |
||
486 | value = this:GetNumber(); |
||
487 | if (not value) then |
||
488 | value = 0; |
||
489 | this:SetText("0"); |
||
490 | end |
||
491 | end |
||
492 | this:ClearFocus(); |
||
493 | if (this.index or this.miscindex) then |
||
494 | DART_Update_Setting(value); |
||
495 | DART_Run_Functions(); |
||
496 | end |
||
497 | if (this.index == "name") then |
||
498 | DART_BaseOptions_SelectTexture_Setting:SetText(DART_TEXTURE_LIST[DART_TEXTURE_INDEX].text); |
||
499 | elseif (this.index == "texture") then |
||
500 | DART_Update_Preview(); |
||
501 | end |
||
502 | end |
||
503 | |||
504 | function DART_Get_Setting() |
||
505 | if (this.index == "CONDITION") then |
||
506 | if (DART_CONDITION_BUFFER[this.subindex]) then |
||
507 | return DART_CONDITION_BUFFER[this.subindex]; |
||
508 | elseif (this.subindex == "color") then |
||
509 | return {r=1, g=1, b=1}; |
||
510 | else |
||
511 | return 1; |
||
512 | end |
||
513 | elseif (this.miscindex) then |
||
514 | return DART_Settings[DART_INDEX][this.miscindex]; |
||
515 | elseif (this.subindex) then |
||
516 | return DART_Settings[DART_INDEX][DART_TEXTURE_INDEX][this.index][this.subindex]; |
||
517 | elseif (this.index) then |
||
518 | return DART_Settings[DART_INDEX][DART_TEXTURE_INDEX][this.index]; |
||
519 | end |
||
520 | end |
||
521 | |||
522 | function DART_Initialize_MiscOptions() |
||
523 | DL_Init_Slider(DART_MiscOptions_UpdateSpeed, DART_Settings[DART_INDEX].updatespeed); |
||
524 | DL_Init_MenuControl(DART_MiscOptions_OptionsScale, DART_Settings[DART_INDEX].optionsscale); |
||
525 | DL_Init_CheckBox(DART_MiscOptions_AutoLock, DART_Settings[DART_INDEX].AutoLock); |
||
526 | local aloffset = DART_MiscOptions_AutoLock_Label:GetWidth() / 2; |
||
527 | DART_MiscOptions_AutoLock:ClearAllPoints(); |
||
528 | DART_MiscOptions_AutoLock:SetPoint("TOP", "DART_MiscOptions", "TOP", -aloffset, -95); |
||
529 | DART_MiscOptions_CurrentProfile:SetText(DART_TEXT.CurrentProfile..DART_INDEX); |
||
530 | DART_MiscOptions_MaxTextures_Display:SetText(DART_Get_MaxTextureIndex()); |
||
531 | end |
||
532 | |||
533 | function DART_Initialize_ProfileList() |
||
534 | DART_PROFILE_LIST = {}; |
||
535 | local i = 0; |
||
536 | for profile in pairs(DART_Settings) do |
||
537 | if (profile ~= "CustomTextures" and (not string.find(profile, " : "))) then |
||
538 | i = i + 1; |
||
539 | DART_PROFILE_LIST[i] = { text=profile, value=profile }; |
||
540 | end |
||
541 | end |
||
542 | end |
||
543 | |||
544 | function DART_Initialize_TextureList() |
||
545 | DART_TEXTURE_LIST = {}; |
||
546 | local ti = 0; |
||
547 | for ti = 1, DART_Get_MaxTextureIndex() do |
||
548 | DART_TEXTURE_LIST[ti] = { text="["..ti.."] "..DART_Settings[DART_INDEX][ti].name, value=ti }; |
||
549 | end |
||
550 | end |
||
551 | |||
552 | function DART_Initialize_TextureOptions() |
||
553 | local settings = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX]; |
||
554 | DART_Update_Preview(); |
||
555 | |||
556 | DL_Init_EditBox(DART_MainTextureOptions_Name, settings.name); |
||
557 | |||
558 | DL_Init_CheckBox(DART_TextureOptions_Hide, settings.hide); |
||
559 | DL_Init_CheckBox(DART_TextureOptions_Highlight, settings.highlight); |
||
560 | DL_Init_CheckBox(DART_BackdropOptions_HideBackground, settings.hidebg); |
||
561 | DL_Init_CheckBox(DART_TextOptions_HideText, settings.text.hide); |
||
562 | DL_Init_CheckBox(DART_TextureOptions_DisableMouse, settings.disablemouse); |
||
563 | DL_Init_CheckBox(DART_TextureOptions_DisableMousewheel, settings.disableMousewheel); |
||
564 | DL_Init_Slider(DART_TextureOptions_Height, settings.height); |
||
565 | DL_Init_Slider(DART_TextureOptions_Width, settings.width); |
||
566 | DL_Init_Slider(DART_TextureOptions_Scale, settings.scale); |
||
567 | DL_Init_Slider(DART_TextureOptions_Alpha, settings.alpha); |
||
568 | DL_Init_Slider(DART_BackdropOptions_BackgroundAlpha, settings.bgalpha); |
||
569 | DL_Init_Slider(DART_BackdropOptions_BorderAlpha, settings.borderalpha); |
||
570 | DL_Init_Slider(DART_TextOptions_TextAlpha, settings.text.alpha); |
||
571 | DL_Init_Slider(DART_TextureOptions_HighlightAlpha, settings.highlightalpha); |
||
572 | DL_Init_Slider(DART_BackdropOptions_Padding, settings.padding); |
||
573 | DL_Init_Slider(DART_TextOptions_TextHeight, settings.text.height); |
||
574 | DL_Init_Slider(DART_TextOptions_TextWidth, settings.text.width); |
||
575 | DL_Init_Slider(DART_TextOptions_FontSize, settings.text.fontsize); |
||
576 | DL_Init_EditBox(DART_TextOptions_Text, settings.text.text); |
||
577 | for i=1,4 do |
||
578 | DL_Init_EditBox(getglobal("DART_TextureOptions_AttachFrame"..i), settings.attachframe[i]); |
||
579 | DL_Init_EditBox(getglobal("DART_TextureOptions_XOffset"..i), settings.xoffset[i]); |
||
580 | DL_Init_EditBox(getglobal("DART_TextureOptions_YOffset"..i), settings.yoffset[i]); |
||
581 | DL_Init_MenuControl(getglobal("DART_TextureOptions_AttachPoint"..i), settings.attachpoint[i]); |
||
582 | DL_Init_MenuControl(getglobal("DART_TextureOptions_AttachTo"..i), settings.attachto[i]); |
||
583 | end |
||
584 | DL_Init_EditBox(DART_TextureOptions_XOffsetT, settings.text.xoffset); |
||
585 | DL_Init_EditBox(DART_MainTextureOptions_TextureFile, settings.texture); |
||
586 | DL_Init_EditBox(DART_MainTextureOptions_X1, settings.coords[1]); |
||
587 | DL_Init_EditBox(DART_MainTextureOptions_X2, settings.coords[2]); |
||
588 | DL_Init_EditBox(DART_MainTextureOptions_Y1, settings.coords[3]); |
||
589 | DL_Init_EditBox(DART_MainTextureOptions_Y2, settings.coords[4]); |
||
590 | DL_Init_EditBox(DART_TextureOptions_FrameLevel, settings.framelevel); |
||
591 | DL_Init_EditBox(DART_TextureOptions_YOffsetT, settings.text.yoffset); |
||
592 | DL_Init_EditBox(DART_TextureOptions_HighlightTexture, settings.highlighttexture); |
||
593 | DL_Init_EditBox(DART_TextOptions_Font, settings.font); |
||
594 | DL_Init_EditBox(DART_TextureOptions_Parent, settings.parent); |
||
595 | DL_Init_MenuControl(DART_TextureOptions_AttachPointT, settings.text.attachpoint); |
||
596 | DL_Init_MenuControl(DART_TextureOptions_AttachToT, settings.text.attachto); |
||
597 | DL_Init_MenuControl(DART_TextOptions_JustifyH, settings.text.justifyH); |
||
598 | DL_Init_MenuControl(DART_TextOptions_JustifyV, settings.text.justifyV); |
||
599 | DL_Init_MenuControl(DART_TextOptions_DrawLayer, settings.text.drawlayer); |
||
600 | DL_Init_MenuControl(DART_TextureOptions_FrameStrata, settings.strata); |
||
601 | DL_Init_MenuControl(DART_TextureOptions_DrawLayer, settings.drawlayer); |
||
602 | DL_Init_MenuControl(DART_TextureOptions_BlendMode, settings.blendmode); |
||
603 | DL_Init_ColorPicker(DART_TextureOptions_Color, settings.color); |
||
604 | DL_Init_ColorPicker(DART_BackdropOptions_BGColor, settings.bgcolor); |
||
605 | DL_Init_ColorPicker(DART_BackdropOptions_BorderColor, settings.bordercolor); |
||
606 | DL_Init_ColorPicker(DART_TextureOptions_HighlightColor, settings.highlightcolor); |
||
607 | DL_Init_ColorPicker(DART_TextOptions_TextColor, settings.text.color); |
||
608 | |||
609 | DL_Init_EditBox(DART_BackdropOptions_BackgroundTexture, settings.bgtexture); |
||
610 | DL_Init_EditBox(DART_BackdropOptions_BorderTexture, settings.bordertexture); |
||
611 | DL_Init_CheckBox(DART_BackdropOptions_Tile, settings.Backdrop.tile); |
||
612 | DL_Init_EditBox(DART_BackdropOptions_InsetLeft, settings.Backdrop.left); |
||
613 | DL_Init_EditBox(DART_BackdropOptions_InsetRight, settings.Backdrop.right); |
||
614 | DL_Init_EditBox(DART_BackdropOptions_InsetTop, settings.Backdrop.top); |
||
615 | DL_Init_EditBox(DART_BackdropOptions_InsetBottom, settings.Backdrop.bottom); |
||
616 | DL_Init_EditBox(DART_BackdropOptions_EdgeSize, settings.Backdrop.edgeSize); |
||
617 | DL_Init_EditBox(DART_BackdropOptions_TileSize, settings.Backdrop.tileSize); |
||
618 | |||
619 | for i=1,14 do |
||
620 | if (settings.scripts[i] and settings.scripts[i] ~= "") then |
||
621 | getglobal("DART_ScriptOptions_"..DART_SCRIPT_LABEL[i]):SetText(DART_SCRIPT_LABEL[i].." *"); |
||
622 | else |
||
623 | getglobal("DART_ScriptOptions_"..DART_SCRIPT_LABEL[i]):SetText(DART_SCRIPT_LABEL[i]); |
||
624 | end |
||
625 | end |
||
626 | if (DART_SCRIPT_INDEX and settings.scripts[DART_SCRIPT_INDEX]) then |
||
627 | DART_ScriptOptions_ScrollFrame_Text:SetText(settings.scripts[DART_SCRIPT_INDEX]); |
||
628 | elseif (DART_SCRIPT_INDEX) then |
||
629 | DART_ScriptOptions_ScrollFrame_Text:SetText(""); |
||
630 | end |
||
631 | |||
632 | if (DART_ControlOptions:IsShown()) then |
||
633 | DART_ConditionMenu_Update(); |
||
634 | end |
||
635 | end |
||
636 | |||
637 | function DART_Copy_ControlSettings() |
||
638 | DART_CONTROL_BUFFER = {}; |
||
639 | DL_Copy_Table(DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions, DART_CONTROL_BUFFER); |
||
640 | end |
||
641 | |||
642 | function DART_Paste_ControlSettings() |
||
643 | if (not DART_CONTROL_BUFFER) then return; end |
||
644 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions) then |
||
645 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions = {}; |
||
646 | end |
||
647 | DL_Copy_Table(DART_CONTROL_BUFFER, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Conditions); |
||
648 | DART_ConditionMenu_Update(); |
||
649 | end |
||
650 | |||
651 | function DART_Menu_OnClick() |
||
652 | getglobal(DART_DropMenu.controlbox):SetText(getglobal(this:GetName().."_Text"):GetText()); |
||
653 | DART_DropMenu:Hide(); |
||
654 | if (DART_DropMenu.index) then |
||
655 | DART_Update_Setting(this.value, DART_DropMenu.index, DART_DropMenu.subindex); |
||
656 | elseif (DART_DropMenu.miscindex) then |
||
657 | DART_Settings[DART_INDEX][DART_DropMenu.miscindex] = this.value; |
||
658 | end |
||
659 | if (DART_DropMenu.initFunc) then |
||
660 | DART_DropMenu.initFunc(); |
||
661 | else |
||
662 | DART_Initialize_Texture(DART_TEXTURE_INDEX); |
||
663 | end |
||
664 | end |
||
665 | |||
666 | function DART_Nudge_OnClick(button) |
||
667 | if (DART_NUDGE_INDEX < 5) then |
||
668 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].attachframe[DART_NUDGE_INDEX]) then return; end |
||
669 | end |
||
670 | local amt = 1; |
||
671 | if (button == "RightButton") then |
||
672 | amt = 10; |
||
673 | elseif (this.moving) then |
||
674 | amt = 3; |
||
675 | end |
||
676 | local id = this:GetID(); |
||
677 | if (id == 1) then |
||
678 | if (DART_NUDGE_INDEX == 5) then |
||
679 | DART_TextMoveLeft(DART_TEXTURE_INDEX, amt); |
||
680 | else |
||
681 | DART_MoveLeft(DART_TEXTURE_INDEX, DART_NUDGE_INDEX, amt); |
||
682 | end |
||
683 | elseif (id == 2) then |
||
684 | if (DART_NUDGE_INDEX == 5) then |
||
685 | DART_TextMoveRight(DART_TEXTURE_INDEX, amt); |
||
686 | else |
||
687 | DART_MoveRight(DART_TEXTURE_INDEX, DART_NUDGE_INDEX, amt); |
||
688 | end |
||
689 | elseif (id == 3) then |
||
690 | if (DART_NUDGE_INDEX == 5) then |
||
691 | DART_TextMoveUp(DART_TEXTURE_INDEX, amt); |
||
692 | else |
||
693 | DART_MoveUp(DART_TEXTURE_INDEX, DART_NUDGE_INDEX, amt); |
||
694 | end |
||
695 | elseif (id == 4) then |
||
696 | if (DART_NUDGE_INDEX == 5) then |
||
697 | DART_TextMoveDown(DART_TEXTURE_INDEX, amt); |
||
698 | else |
||
699 | DART_MoveDown(DART_TEXTURE_INDEX, DART_NUDGE_INDEX, amt); |
||
700 | end |
||
701 | end |
||
702 | |||
703 | if (DART_NUDGE_INDEX < 5) then |
||
704 | getglobal("DART_TextureOptions_XOffset"..DART_NUDGE_INDEX):SetText(DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].xoffset[DART_NUDGE_INDEX]); |
||
705 | getglobal("DART_TextureOptions_YOffset"..DART_NUDGE_INDEX):SetText(DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].yoffset[DART_NUDGE_INDEX]); |
||
706 | else |
||
707 | DART_TextureOptions_XOffsetT:SetText(DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].text.xoffset); |
||
708 | DART_TextureOptions_YOffsetT:SetText(DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].text.yoffset); |
||
709 | end |
||
710 | end |
||
711 | |||
712 | function DART_Nudge_OnUpdate(elapsed) |
||
713 | if (not this.moving) then return; end |
||
714 | if (not this.timer) then |
||
715 | this.timer = .05; |
||
716 | end |
||
717 | this.timer = this.timer - elapsed; |
||
718 | if (this.timer < 0) then |
||
719 | this.timer = .05; |
||
720 | DART_Nudge_OnClick(); |
||
721 | end |
||
722 | end |
||
723 | |||
724 | function DART_Options_AddTexture() |
||
725 | local file = DART_TextureBrowser_File:GetText(); |
||
726 | if ((not file) or file == "") then |
||
727 | DART_TextureBrowser_File:SetFocus(); |
||
728 | return; |
||
729 | end |
||
730 | if (not string.find(file, "\\")) then |
||
731 | file = "Interface\\AddOns\\DiscordArt\\CustomTextures\\"..file; |
||
732 | end |
||
733 | local x1 = tonumber(DART_TextureBrowser_X1:GetText()); |
||
734 | if ((not x1) or x1 == "") then |
||
735 | DART_TextureBrowser_X1:SetFocus(); |
||
736 | return; |
||
737 | end |
||
738 | local x2 = tonumber(DART_TextureBrowser_X2:GetText()); |
||
739 | if ((not x2) or x2 == "") then |
||
740 | DART_TextureBrowser_X2:SetFocus(); |
||
741 | return; |
||
742 | end |
||
743 | local y1 = tonumber(DART_TextureBrowser_Y1:GetText()); |
||
744 | if ((not y1) or y1 == "") then |
||
745 | DART_TextureBrowser_Y1:SetFocus(); |
||
746 | return; |
||
747 | end |
||
748 | local y2 = tonumber(DART_TextureBrowser_Y2:GetText()); |
||
749 | if ((not y2) or y2 == "") then |
||
750 | DART_TextureBrowser_Y2:SetFocus(); |
||
751 | return; |
||
752 | end |
||
753 | local height = tonumber(DART_TextureBrowser_Height:GetText()); |
||
754 | if (not height) then |
||
755 | DART_TextureBrowser_Height:SetFocus(); |
||
756 | return; |
||
757 | end |
||
758 | local width = tonumber(DART_TextureBrowser_Width:GetText()); |
||
759 | if (not width) then |
||
760 | DART_TextureBrowser_Width:SetFocus(); |
||
761 | return; |
||
762 | end |
||
763 | local index = #DART_Settings.CustomTextures + 1; |
||
764 | DART_Settings.CustomTextures[index] = {}; |
||
765 | DART_Settings.CustomTextures[index].file = file; |
||
766 | DART_Settings.CustomTextures[index].x1 = x1; |
||
767 | DART_Settings.CustomTextures[index].x2 = x2; |
||
768 | DART_Settings.CustomTextures[index].y1 = y1; |
||
769 | DART_Settings.CustomTextures[index].y2 = y2; |
||
770 | DART_Settings.CustomTextures[index].height = height; |
||
771 | DART_Settings.CustomTextures[index].width = width; |
||
772 | local customindex = index; |
||
773 | index = #DART_TEXTURES + 1; |
||
774 | DART_TEXTURES[index] = {}; |
||
775 | DART_TEXTURES[index].file = file; |
||
776 | DART_TEXTURES[index].x1 = x1; |
||
777 | DART_TEXTURES[index].x2 = x2; |
||
778 | DART_TEXTURES[index].y1 = y1; |
||
779 | DART_TEXTURES[index].y2 = y2; |
||
780 | DART_TEXTURES[index].height = height; |
||
781 | DART_TEXTURES[index].width = width; |
||
782 | DART_TEXTURES[index].customindex = customindex; |
||
783 | DART_TextureBrowser_Update(); |
||
784 | DART_STICKY_TEXTURE = {file="", x1="", x2="", y1="", y2="", height="", width=""}; |
||
785 | DART_TextureBrowser_UpdatePreview(); |
||
786 | end |
||
787 | |||
788 | function DART_Options_CopySettings() |
||
789 | DART_CLIPBOARD = {}; |
||
790 | DL_Copy_Table(DART_Settings[DART_INDEX][DART_TEXTURE_INDEX], DART_CLIPBOARD); |
||
791 | end |
||
792 | |||
793 | function DART_Options_DeleteProfile(index) |
||
794 | if (not index) then |
||
795 | index = DART_MiscOptions_SetProfile_Setting:GetText(); |
||
796 | end |
||
797 | if (index == "" or (not index)) then return; end |
||
798 | if (index == DART_TEXT.Default) then |
||
799 | DL_Debug(DART_TEXT.CantDeleteDefault); |
||
800 | return; |
||
801 | elseif (index == DART_INDEX) then |
||
802 | DL_Debug(DART_TEXT.CantDeleteCurrent); |
||
803 | return; |
||
804 | end |
||
805 | DART_Settings[index] = nil; |
||
806 | for profile in pairs(DART_Settings) do |
||
807 | if (DART_Settings[profile] == index) then |
||
808 | DART_Settings[profile] = DART_TEXT.Default; |
||
809 | end |
||
810 | end |
||
811 | DART_Initialize_ProfileList(); |
||
812 | DART_MiscOptions_SetProfile_Setting:SetText(""); |
||
813 | DL_Debug(DART_TEXT.ProfileDeleted..index); |
||
814 | end |
||
815 | |||
816 | function DART_Options_CreateTexture() |
||
817 | local ti = DART_Get_MaxTextureIndex() + 1; |
||
818 | local texture = getglobal("DART_Texture_"..ti); |
||
819 | DART_Set_DefaultSettings(DART_INDEX, ti); |
||
820 | if (texture) then |
||
821 | DART_Initialize_Texture(ti); |
||
822 | else |
||
823 | DART_Create_Texture(ti); |
||
824 | end |
||
825 | DART_MiscOptions_MaxTextures_Display:SetText(ti); |
||
826 | DART_Initialize_TextureList(); |
||
827 | end |
||
828 | |||
829 | function DART_Options_DeleteTexture() |
||
830 | local ti = DART_Get_MaxTextureIndex(); |
||
831 | if (ti == 1) then |
||
832 | DL_Error("You must have at least 1 texture."); |
||
833 | return; |
||
834 | end |
||
835 | local texture = getglobal("DART_Texture_"..ti); |
||
836 | texture:Hide(); |
||
837 | texture:UnregisterAllEvents(); |
||
838 | for i=1,DART_NUMBER_OF_SCRIPTS do |
||
839 | RunScript("function DART_Texture"..ti.."_Script_"..DART_SCRIPT_LABEL[i].."()\nend"); |
||
840 | end |
||
841 | DART_Settings[DART_INDEX][ti] = nil; |
||
842 | DART_MiscOptions_MaxTextures_Display:SetText(ti - 1); |
||
843 | DART_Initialize_TextureList(); |
||
844 | if (ti == DART_TEXTURE_INDEX) then |
||
845 | DART_TEXTURE_INDEX = DART_TEXTURE_INDEX - 1; |
||
846 | DART_Initialize_TextureOptions(); |
||
847 | DART_BaseOptions_SelectTexture_Setting:SetText(DART_TEXTURE_LIST[DART_TEXTURE_INDEX].text); |
||
848 | end |
||
849 | end |
||
850 | |||
851 | function DART_Options_FrameLevelMinus() |
||
852 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].framelevel = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].framelevel - 1; |
||
853 | DART_Initialize_Texture(DART_TEXTURE_INDEX); |
||
854 | DL_Init_EditBox(DART_TextureOptions_FrameLevel, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].framelevel); |
||
855 | end |
||
856 | |||
857 | function DART_Options_FrameLevelPlus() |
||
858 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].framelevel = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].framelevel + 1; |
||
859 | DART_Initialize_Texture(DART_TEXTURE_INDEX); |
||
860 | DL_Init_EditBox(DART_TextureOptions_FrameLevel, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].framelevel); |
||
861 | end |
||
862 | |||
863 | function DART_Options_LoadPresetBackdrop() |
||
864 | if (this.value == 1) then |
||
865 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bgtexture = "Interface\\AddOns\\DiscordLibrary\\PlainBackdrop"; |
||
866 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bordertexture = "Interface\\AddOns\\DiscordLibrary\\PlainBackdrop"; |
||
867 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Backdrop = { tile=true, tileSize=8, edgeSize=1, left=1, right=1, top=1, bottom=1}; |
||
868 | elseif (this.value == 2) then |
||
869 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bgtexture = "Interface\\AddOns\\DiscordLibrary\\PlainBackdrop"; |
||
870 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bordertexture = "Interface\\Tooltips\\UI-Tooltip-Border"; |
||
871 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Backdrop = { tile=true, tileSize=16, edgeSize=16, left=5, right=5, top=5, bottom=5}; |
||
872 | elseif (this.value == 3) then |
||
873 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bgtexture = "Interface\\AddOns\\DiscordLibrary\\PlainBackdrop"; |
||
874 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bordertexture = "Interface\\DialogFrame\\UI-DialogBox-Border"; |
||
875 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Backdrop = { tile=true, tileSize=32, edgeSize=32, left=11, right=12, top=12, bottom=11}; |
||
876 | elseif (this.value == 4) then |
||
877 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bgtexture = "Interface\\AddOns\\DiscordLibrary\\PlainBackdrop"; |
||
878 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bordertexture = "Interface\\Buttons\\UI-SliderBar-Border"; |
||
879 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Backdrop = { tile=true, tileSize=8, edgeSize=8, left=3, right=3, top=6, bottom=6}; |
||
880 | elseif (this.value == 5) then |
||
881 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bgtexture = "Interface\\Glues\\Common\\Glue-Tooltip-Background"; |
||
882 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].bordertexture = "Interface\\Glues\\Common\\Glue-Tooltip-Border"; |
||
883 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].Backdrop = { tile=true, tileSize=16, edgeSize=16, left=10, right=5, top=4, bottom=9}; |
||
884 | end |
||
885 | DART_Initialize_TextureOptions(); |
||
886 | DART_Initialize_Texture(DART_TEXTURE_INDEX); |
||
887 | end |
||
888 | |||
889 | function DART_Options_NewProfile(index) |
||
890 | if (not index) then |
||
891 | index = DART_MiscOptions_NewProfile:GetText(); |
||
892 | end |
||
893 | if (index == "" or (not index)) then return; end |
||
894 | if (index == DART_INDEX) then |
||
895 | DL_Feedback("This is not a save option. Discord Art saves your changes as you make them."); |
||
896 | return; |
||
897 | end |
||
898 | DART_Settings[index] = {}; |
||
899 | DL_Copy_Table(DART_Settings[DART_INDEX], DART_Settings[index]); |
||
900 | DART_INDEX = index; |
||
901 | DART_Settings[DART_PROFILE_INDEX] = index; |
||
902 | DART_Initialize_ProfileList(); |
||
903 | DART_MiscOptions_CurrentProfile:SetText(DART_TEXT.CurrentProfile..DART_INDEX); |
||
904 | DL_Feedback(DART_TEXT.NewProfileCreated..DART_INDEX); |
||
905 | end |
||
906 | |||
907 | function DART_Options_OnHide() |
||
908 | if (DART_Settings[DART_INDEX].autolock and DART_DRAGGING_UNLOCKED) then |
||
909 | DART_Toggle_Dragging(); |
||
910 | end |
||
911 | end |
||
912 | |||
913 | function DART_Options_OnShow() |
||
914 | |||
915 | end |
||
916 | |||
917 | function DART_Options_PasteSettings() |
||
918 | if (not DART_CLIPBOARD) then return; end |
||
919 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX] = {}; |
||
920 | DL_Copy_Table(DART_CLIPBOARD, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX]); |
||
921 | DART_Initialize_TextureList(); |
||
922 | DART_BaseOptions_SelectTexture_Setting:SetText(DART_TEXTURE_LIST[DART_TEXTURE_INDEX].text); |
||
923 | DART_Initialize_TextureOptions(); |
||
924 | DART_Initialize_Texture(DART_TEXTURE_INDEX); |
||
925 | end |
||
926 | |||
927 | function DART_Options_SelectTexture() |
||
928 | this:GetParent():Hide(); |
||
929 | local text = ""; |
||
930 | local list = getglobal(DART_ScrollMenu.table); |
||
931 | for _, value in pairs(list) do |
||
932 | if (value.value == this.value) then |
||
933 | text = value.text; |
||
934 | end |
||
935 | end |
||
936 | getglobal(DART_ScrollMenu.controlbox):SetText(text); |
||
937 | if (DART_ScrollMenu.table == "DL_CONDITIONS_MENU") then |
||
938 | DART_Select_Condition(); |
||
939 | elseif (DART_ScrollMenu.table == "DART_RESPONSES") then |
||
940 | DART_Select_Response(); |
||
941 | elseif (DART_ScrollMenu.index == "CONDITION") then |
||
942 | DART_Update_Setting(this.value, DART_ScrollMenu.index, DART_ScrollMenu.subindex); |
||
943 | else |
||
944 | DART_TEXTURE_INDEX = this.value; |
||
945 | DART_Initialize_TextureOptions(); |
||
946 | end |
||
947 | end |
||
948 | |||
949 | function DART_Options_SelectTexture_OnMouseWheel(direction) |
||
950 | local saved = DART_TEXTURE_INDEX; |
||
951 | if (direction > 0) then |
||
952 | DART_TEXTURE_INDEX = DART_TEXTURE_INDEX - 1; |
||
953 | else |
||
954 | DART_TEXTURE_INDEX = DART_TEXTURE_INDEX + 1; |
||
955 | end |
||
956 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX]) then |
||
957 | DART_TEXTURE_INDEX = saved; |
||
958 | return; |
||
959 | end |
||
960 | DART_BaseOptions_SelectTexture_Setting:SetText(DART_TEXTURE_LIST[DART_TEXTURE_INDEX].text); |
||
961 | DART_Initialize_TextureOptions(); |
||
962 | end |
||
963 | |||
964 | function DART_Options_SelectNudgeIndex() |
||
965 | DART_NUDGE_INDEX = this.value; |
||
966 | end |
||
967 | |||
968 | function DART_Run_Functions(value, override, preview) |
||
969 | if (override or (not this.initFunc)) then |
||
970 | DART_Initialize_Texture(DART_TEXTURE_INDEX); |
||
971 | else |
||
972 | this.initFunc(DART_TEXTURE_INDEX, value); |
||
973 | end |
||
974 | if (this.updatepreview or preview) then |
||
975 | DART_Update_Preview(); |
||
976 | end |
||
977 | end |
||
978 | |||
979 | function DART_ScrollMenu_Update() |
||
980 | local list = getglobal(this:GetParent().table); |
||
981 | if (not list) then return; end |
||
982 | local numOptions = #list; |
||
983 | local offset = FauxScrollFrame_GetOffset(DART_ScrollMenu_ScrollFrame); |
||
984 | if (not offset) then offset = 0; end |
||
985 | local index, button; |
||
986 | |||
987 | for i=1, 10 do |
||
988 | button = getglobal("DART_ScrollMenu_Button"..i); |
||
989 | buttontext = getglobal("DART_ScrollMenu_Button"..i.."Text"); |
||
990 | index = offset + i; |
||
991 | if ( list[index] ) then |
||
992 | buttontext:SetText(list[index].text); |
||
993 | button:Show(); |
||
994 | button:SetChecked(0); |
||
995 | button.value = list[index].value; |
||
996 | button.desc = list[index].desc; |
||
997 | else |
||
998 | button:Hide(); |
||
999 | end |
||
1000 | end |
||
1001 | |||
1002 | FauxScrollFrame_Update(DART_ScrollMenu_ScrollFrame, numOptions, 10, 20 ); |
||
1003 | end |
||
1004 | |||
1005 | function DART_Show_Script(script) |
||
1006 | DART_ScriptOptions_Label:SetText(DART_SCRIPT_LABEL[script]); |
||
1007 | DART_SCRIPT_INDEX = script; |
||
1008 | DART_ScriptOptions_ScrollFrame_Text:SetText(""); |
||
1009 | if (DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].scripts[DART_SCRIPT_INDEX]) then |
||
1010 | DART_ScriptOptions_ScrollFrame_Text:SetText(DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].scripts[DART_SCRIPT_INDEX]); |
||
1011 | end |
||
1012 | DART_ScriptOptions_ScrollFrame_Text:SetFocus(); |
||
1013 | end |
||
1014 | |||
1015 | function DART_Slider_Update() |
||
1016 | if (not DART_INITIALIZED) then return; end |
||
1017 | local setting = DART_Get_Setting(); |
||
1018 | if (this.scale) then |
||
1019 | setting = setting * this.scale; |
||
1020 | end |
||
1021 | local min, max = this:GetMinMaxValues(); |
||
1022 | if (setting < min or setting > max) then |
||
1023 | return; |
||
1024 | end |
||
1025 | local value = this:GetValue(); |
||
1026 | getglobal(this:GetName().."_Display"):SetText(value); |
||
1027 | if (this.scale) then |
||
1028 | value = value / this.scale; |
||
1029 | end |
||
1030 | DART_Update_Setting(value); |
||
1031 | DART_Run_Functions(value); |
||
1032 | end |
||
1033 | |||
1034 | function DART_Slider_UpdateFromEditBox() |
||
1035 | local value = this:GetNumber(); |
||
1036 | if (not value) then value = 0; end |
||
1037 | local min, max = this:GetParent():GetMinMaxValues(); |
||
1038 | if (this:GetParent().minlocked and value < min) then value = min; end |
||
1039 | if (this:GetParent().maxlocked and value > max) then value = max; end |
||
1040 | this:SetText(value); |
||
1041 | if (value >= min and value <= max) then |
||
1042 | this:GetParent():SetValue(value); |
||
1043 | end |
||
1044 | this:ClearFocus(); |
||
1045 | if (this:GetParent().scale) then |
||
1046 | value = value / this:GetParent().scale; |
||
1047 | end |
||
1048 | this.index = this:GetParent().index; |
||
1049 | this.subindex = this:GetParent().subindex; |
||
1050 | DART_Update_Setting(value, this.index, this.subindex); |
||
1051 | DART_Run_Functions(value); |
||
1052 | end |
||
1053 | |||
1054 | function DART_TextureBrowser_AdjustCoord(button) |
||
1055 | local amt = .01; |
||
1056 | if (button == "MiddleButton") then |
||
1057 | amt = .0001; |
||
1058 | elseif (button == "RightButton") then |
||
1059 | amt = .001; |
||
1060 | end |
||
1061 | if (this:GetID() == 1) then |
||
1062 | DART_STICKY_TEXTURE.x1 = DART_STICKY_TEXTURE.x1 - amt; |
||
1063 | elseif (this:GetID() == 2) then |
||
1064 | DART_STICKY_TEXTURE.x1 = DART_STICKY_TEXTURE.x1 + amt; |
||
1065 | elseif (this:GetID() == 3) then |
||
1066 | DART_STICKY_TEXTURE.x2 = DART_STICKY_TEXTURE.x2 - amt; |
||
1067 | elseif (this:GetID() == 4) then |
||
1068 | DART_STICKY_TEXTURE.x2 = DART_STICKY_TEXTURE.x2 + amt; |
||
1069 | elseif (this:GetID() == 5) then |
||
1070 | DART_STICKY_TEXTURE.y1 = DART_STICKY_TEXTURE.y1 - amt; |
||
1071 | elseif (this:GetID() == 6) then |
||
1072 | DART_STICKY_TEXTURE.y1 = DART_STICKY_TEXTURE.y1 + amt; |
||
1073 | elseif (this:GetID() == 7) then |
||
1074 | DART_STICKY_TEXTURE.y2 = DART_STICKY_TEXTURE.y2 - amt; |
||
1075 | elseif (this:GetID() == 8) then |
||
1076 | DART_STICKY_TEXTURE.y2 = DART_STICKY_TEXTURE.y2 + amt; |
||
1077 | end |
||
1078 | DART_TextureBrowser_OnLeave(); |
||
1079 | DART_TextureBrowser_UpdatePreview(); |
||
1080 | end |
||
1081 | |||
1082 | function DART_TextureBrowser_AdjustCoord2(button) |
||
1083 | local amt = .01; |
||
1084 | if (button == "MiddleButton") then |
||
1085 | amt = .0001; |
||
1086 | elseif (button == "RightButton") then |
||
1087 | amt = .001; |
||
1088 | end |
||
1089 | if (this:GetID() == 1) then |
||
1090 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[1] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[1] - amt; |
||
1091 | elseif (this:GetID() == 2) then |
||
1092 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[1] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[1] + amt; |
||
1093 | elseif (this:GetID() == 3) then |
||
1094 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[2] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[2] - amt; |
||
1095 | elseif (this:GetID() == 4) then |
||
1096 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[2] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[2] + amt; |
||
1097 | elseif (this:GetID() == 5) then |
||
1098 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[3] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[3] - amt; |
||
1099 | elseif (this:GetID() == 6) then |
||
1100 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[3] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[3] + amt; |
||
1101 | elseif (this:GetID() == 7) then |
||
1102 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[4] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[4] - amt; |
||
1103 | elseif (this:GetID() == 8) then |
||
1104 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[4] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[4] + amt; |
||
1105 | elseif (this:GetID() == 9) then |
||
1106 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[5]) then |
||
1107 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[5] = 0; |
||
1108 | end |
||
1109 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[5] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[5] - amt; |
||
1110 | elseif (this:GetID() == 10) then |
||
1111 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[5]) then |
||
1112 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[5] = 0; |
||
1113 | end |
||
1114 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[5] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[5] + amt; |
||
1115 | elseif (this:GetID() == 11) then |
||
1116 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[6]) then |
||
1117 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[6] = 0; |
||
1118 | end |
||
1119 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[6] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[6] - amt; |
||
1120 | elseif (this:GetID() == 12) then |
||
1121 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[6]) then |
||
1122 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[6] = 0; |
||
1123 | end |
||
1124 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[6] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[6] + amt; |
||
1125 | elseif (this:GetID() == 13) then |
||
1126 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[7]) then |
||
1127 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[7] = 0; |
||
1128 | end |
||
1129 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[7] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[7] - amt; |
||
1130 | elseif (this:GetID() == 14) then |
||
1131 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[7]) then |
||
1132 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[7] = 0; |
||
1133 | end |
||
1134 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[7] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[7] + amt; |
||
1135 | elseif (this:GetID() == 15) then |
||
1136 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[8]) then |
||
1137 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[8] = 0; |
||
1138 | end |
||
1139 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[8] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[8] - amt; |
||
1140 | elseif (this:GetID() == 16) then |
||
1141 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[8]) then |
||
1142 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[8] = 0; |
||
1143 | end |
||
1144 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[8] = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[8] + amt; |
||
1145 | end |
||
1146 | DART_Initialize_Texture(DART_TEXTURE_INDEX); |
||
1147 | DART_Update_Preview(); |
||
1148 | DL_Init_EditBox(DART_MainTextureOptions_X1, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[1]); |
||
1149 | DL_Init_EditBox(DART_MainTextureOptions_X2, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[2]); |
||
1150 | DL_Init_EditBox(DART_MainTextureOptions_Y1, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[3]); |
||
1151 | DL_Init_EditBox(DART_MainTextureOptions_Y2, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[4]); |
||
1152 | DL_Init_EditBox(DART_MainTextureOptions_URx, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[5]); |
||
1153 | DL_Init_EditBox(DART_MainTextureOptions_URy, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[6]); |
||
1154 | DL_Init_EditBox(DART_MainTextureOptions_LRx, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[7]); |
||
1155 | DL_Init_EditBox(DART_MainTextureOptions_LRy, DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[8]); |
||
1156 | end |
||
1157 | |||
1158 | function DART_TextureBrowser_OnClick(button) |
||
1159 | this:SetChecked(0); |
||
1160 | if (button == "RightButton" and (not IsShiftKeyDown())) then |
||
1161 | DART_STICKY_TEXTURE.file = DART_TEXTURES[this.textureindex].file; |
||
1162 | DART_STICKY_TEXTURE.x1 = DART_TEXTURES[this.textureindex].x1; |
||
1163 | DART_STICKY_TEXTURE.x2 = DART_TEXTURES[this.textureindex].x2; |
||
1164 | DART_STICKY_TEXTURE.y1 = DART_TEXTURES[this.textureindex].y1; |
||
1165 | DART_STICKY_TEXTURE.y2 = DART_TEXTURES[this.textureindex].y2; |
||
1166 | DART_STICKY_TEXTURE.height = DART_TEXTURES[this.textureindex].height; |
||
1167 | DART_STICKY_TEXTURE.width = DART_TEXTURES[this.textureindex].width; |
||
1168 | DART_TextureBrowser_UpdatePreview(); |
||
1169 | elseif (button == "MiddleButton" or (button == "RightButton" and IsShiftKeyDown())) then |
||
1170 | if (not DART_TextureBrowser_CustomTab:GetChecked()) then return; end |
||
1171 | if (#DART_Settings.CustomTextures > 1) then |
||
1172 | local max = #DART_Settings.CustomTextures; |
||
1173 | DART_Settings.CustomTextures[this.textureindex] = {}; |
||
1174 | for i=this.textureindex + 1, max do |
||
1175 | DL_Copy_Table(DART_Settings.CustomTextures[i], DART_Settings.CustomTextures[i - 1]); |
||
1176 | DART_Settings.CustomTextures[i] = {}; |
||
1177 | end |
||
1178 | DART_Settings.CustomTextures[max] = nil; |
||
1179 | else |
||
1180 | DART_Settings.CustomTextures = {}; |
||
1181 | end |
||
1182 | DART_TEXTURES = {}; |
||
1183 | if (not DART_Settings.CustomTextures) then |
||
1184 | DART_Settings.CustomTextures = {}; |
||
1185 | end |
||
1186 | DL_Copy_Table(DART_Settings.CustomTextures, DART_TEXTURES); |
||
1187 | DART_TextureBrowser_Update(); |
||
1188 | else |
||
1189 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].texture = DART_TEXTURES[this.textureindex].file; |
||
1190 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[1] = DART_TEXTURES[this.textureindex].x1; |
||
1191 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[2] = DART_TEXTURES[this.textureindex].x2; |
||
1192 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[3] = DART_TEXTURES[this.textureindex].y1; |
||
1193 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[4] = DART_TEXTURES[this.textureindex].y2; |
||
1194 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].height = DART_TEXTURES[this.textureindex].height + DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].padding * 2; |
||
1195 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].width = DART_TEXTURES[this.textureindex].width + DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].padding * 2; |
||
1196 | |||
1197 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[1]) then |
||
1198 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[1] = 0; |
||
1199 | end |
||
1200 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[2]) then |
||
1201 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[2] = 1; |
||
1202 | end |
||
1203 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[3]) then |
||
1204 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[3] = 0; |
||
1205 | end |
||
1206 | if (not DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[4]) then |
||
1207 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].coords[4] = 1; |
||
1208 | end |
||
1209 | |||
1210 | DART_TextureBrowser:Hide(); |
||
1211 | DART_Initialize_Texture(DART_TEXTURE_INDEX); |
||
1212 | DART_Initialize_TextureOptions(); |
||
1213 | DART_STICKY_TEXTURE = {file="", x1="0", x2="1", y1="0", y2="1", height="256", width="256"}; |
||
1214 | end |
||
1215 | end |
||
1216 | |||
1217 | function DART_TextureBrowser_OnEnter() |
||
1218 | DART_TextureBrowser_File:SetText(DART_TEXTURES[this.textureindex].file); |
||
1219 | DART_TextureBrowser_X1:SetText(DART_TEXTURES[this.textureindex].x1); |
||
1220 | DART_TextureBrowser_X2:SetText(DART_TEXTURES[this.textureindex].x2); |
||
1221 | DART_TextureBrowser_Y1:SetText(DART_TEXTURES[this.textureindex].y1); |
||
1222 | DART_TextureBrowser_Y2:SetText(DART_TEXTURES[this.textureindex].y2); |
||
1223 | DART_TextureBrowser_Height:SetText(DART_TEXTURES[this.textureindex].height); |
||
1224 | DART_TextureBrowser_Width:SetText(DART_TEXTURES[this.textureindex].width); |
||
1225 | GameTooltip:SetOwner(DART_TextureBrowser, "ANCHOR_TOPLEFT", 50); |
||
1226 | if (DART_TextureBrowser_CustomTab:GetChecked()) then |
||
1227 | GameTooltip:SetText(DART_TEXT.TextureTip..DART_TEXT.CustomTextureTip, 1, 1, 1, 1, 1); |
||
1228 | else |
||
1229 | GameTooltip:SetText(DART_TEXT.TextureTip, 1, 1, 1, 1, 1); |
||
1230 | end |
||
1231 | end |
||
1232 | |||
1233 | function DART_TextureBrowser_OnLeave() |
||
1234 | DART_TextureBrowser_File:SetText(DART_STICKY_TEXTURE.file); |
||
1235 | DART_TextureBrowser_X1:SetText(DART_STICKY_TEXTURE.x1); |
||
1236 | DART_TextureBrowser_X2:SetText(DART_STICKY_TEXTURE.x2); |
||
1237 | DART_TextureBrowser_Y1:SetText(DART_STICKY_TEXTURE.y1); |
||
1238 | DART_TextureBrowser_Y2:SetText(DART_STICKY_TEXTURE.y2); |
||
1239 | DART_TextureBrowser_Height:SetText(DART_STICKY_TEXTURE.height); |
||
1240 | DART_TextureBrowser_Width:SetText(DART_STICKY_TEXTURE.width); |
||
1241 | GameTooltip:Hide(); |
||
1242 | end |
||
1243 | |||
1244 | function DART_TextureBrowser_Update() |
||
1245 | local numMacroIcons = #DART_TEXTURES; |
||
1246 | local macroPopupIcon, macroPopupButton; |
||
1247 | local macroPopupOffset = FauxScrollFrame_GetOffset(DART_TextureBrowser_ScrollFrame); |
||
1248 | if (not macroPopupOffset) then macroPopupOffset = 0; end |
||
1249 | local index; |
||
1250 | |||
1251 | for i=1, 20 do |
||
1252 | macroPopupIcon = getglobal("DART_TextureBrowser_Button"..i.."Icon"); |
||
1253 | macroPopupButton = getglobal("DART_TextureBrowser_Button"..i); |
||
1254 | index = (macroPopupOffset * 5) + i; |
||
1255 | if ( DART_TEXTURES[index] ) then |
||
1256 | macroPopupIcon:SetTexture(DART_TEXTURES[index].file); |
||
1257 | macroPopupIcon:SetTexCoord(DART_TEXTURES[index].x1, DART_TEXTURES[index].x2, DART_TEXTURES[index].y1, DART_TEXTURES[index].y2); |
||
1258 | macroPopupButton:Show(); |
||
1259 | macroPopupButton.textureindex = index; |
||
1260 | else |
||
1261 | macroPopupIcon:SetTexture(""); |
||
1262 | macroPopupButton:Hide(); |
||
1263 | macroPopupButton.textureindex = nil; |
||
1264 | end |
||
1265 | end |
||
1266 | |||
1267 | FauxScrollFrame_Update(DART_TextureBrowser_ScrollFrame, ceil(numMacroIcons / 5) , 4, 36 ); |
||
1268 | end |
||
1269 | |||
1270 | function DART_TextureBrowser_UpdatePreview() |
||
1271 | local texture = DART_STICKY_TEXTURE.file; |
||
1272 | if (not texture) then texture = ""; end |
||
1273 | if (not string.find(texture, "\\")) then |
||
1274 | texture = "Interface\\AddOns\\DiscordArt\\CustomTextures\\"..texture; |
||
1275 | end |
||
1276 | DART_TextureBrowser_PreviewTexture:SetTexture(texture); |
||
1277 | local height = tonumber(DART_STICKY_TEXTURE.height); |
||
1278 | if ((not height) or height <= 0 or height == "") then |
||
1279 | height = 30; |
||
1280 | end |
||
1281 | local width = tonumber(DART_STICKY_TEXTURE.width); |
||
1282 | if ((not width) or width <= 0 or width == "") then |
||
1283 | width = 30; |
||
1284 | end |
||
1285 | local x1 = tonumber(DART_STICKY_TEXTURE.x1); |
||
1286 | if ((not x1) or x1 == "") then |
||
1287 | x1 = 0; |
||
1288 | end |
||
1289 | local x2 = tonumber(DART_STICKY_TEXTURE.x2); |
||
1290 | if ((not x2) or x2 == "") then |
||
1291 | x2 = 1; |
||
1292 | end |
||
1293 | local y1 = tonumber(DART_STICKY_TEXTURE.y1); |
||
1294 | if ((not y1) or y1 == "") then |
||
1295 | y1 = 0; |
||
1296 | end |
||
1297 | local y2 = tonumber(DART_STICKY_TEXTURE.y2); |
||
1298 | if ((not y2) or y2 == "") then |
||
1299 | y2 = 1; |
||
1300 | end |
||
1301 | DART_TextureBrowser_PreviewTexture:SetTexCoord(x1, x2, y1, y2); |
||
1302 | DART_TextureBrowser_Preview:SetHeight(height + 10); |
||
1303 | DART_TextureBrowser_Preview:SetWidth(width + 10); |
||
1304 | DART_TextureBrowser:SetHeight(400 + height); |
||
1305 | end |
||
1306 | |||
1307 | function DART_Update_FrameFinder() |
||
1308 | local obj = GetMouseFocus(); |
||
1309 | local text = DART_TEXT.FrameFinder; |
||
1310 | if (obj and obj ~= WorldFrame and obj:GetName()) then |
||
1311 | text = text..obj:GetName(); |
||
1312 | if (obj:GetParent() and obj:GetParent() ~= WorldFrame and obj:GetParent():GetName() ) then |
||
1313 | text = text..DART_TEXT.Parent..obj:GetParent():GetName(); |
||
1314 | if (obj:GetParent():GetParent() and obj:GetParent():GetParent() ~= WorldFrame and obj:GetParent():GetParent():GetName()) then |
||
1315 | text = text..DART_TEXT.ParentsParent..obj:GetParent():GetParent():GetName(); |
||
1316 | end |
||
1317 | end |
||
1318 | end |
||
1319 | if ((not string.find(text, "DART_Options")) and (not string.find(text, "DART_MiscOptions")) and (not string.find(text, "DART_TextureOptions")) and (not string.find(text, "DART_TextOptions")) and (not string.find(text, "DART_TextureBrowser")) and (not string.find(text, "DART_DropMenu")) and (not string.find(text, "DART_ScriptOptions")) and (not string.find(text, "DART_BaseOptions")) and (not string.find(text, "DART_ControlOptions"))) then |
||
1320 | DART_Options_FrameFinder_Text:SetText(text); |
||
1321 | else |
||
1322 | DART_Options_FrameFinder_Text:SetText(DART_TEXT.FrameFinder); |
||
1323 | end |
||
1324 | end |
||
1325 | |||
1326 | function DART_Update_Preview() |
||
1327 | local settings = DART_Settings[DART_INDEX][DART_TEXTURE_INDEX]; |
||
1328 | DART_MainTextureOptions_Texture_Texture:SetTexture(settings.texture); |
||
1329 | if (settings.coords[5] and settings.coords[6] and settings.coords[7] and settings.coords[8]) then |
||
1330 | DART_MainTextureOptions_Texture_Texture:SetTexCoord(settings.coords[1], settings.coords[2], settings.coords[3], settings.coords[4], settings.coords[5], settings.coords[6], settings.coords[7], settings.coords[8]); |
||
1331 | else |
||
1332 | DART_MainTextureOptions_Texture_Texture:SetTexCoord(settings.coords[1], settings.coords[2], settings.coords[3], settings.coords[4]); |
||
1333 | end |
||
1334 | DART_MainTextureOptions_Texture:SetBackdrop({bgFile = settings.bgtexture, edgeFile = settings.bordertexture, tile = settings.Backdrop.tile, tileSize = settings.Backdrop.tileSize, edgeSize = settings.Backdrop.edgeSize, insets = { left = settings.Backdrop.left, right = settings.Backdrop.right, top = settings.Backdrop.top, bottom = settings.Backdrop.bottom }}); |
||
1335 | DART_MainTextureOptions_Texture:SetBackdropColor(settings.bgcolor.r, settings.bgcolor.g, settings.bgcolor.b, settings.bgalpha); |
||
1336 | DART_MainTextureOptions_Texture:SetBackdropBorderColor(settings.bordercolor.r, settings.bordercolor.g, settings.bordercolor.b, settings.borderalpha); |
||
1337 | DART_MainTextureOptions_Texture_Texture:SetVertexColor(settings.color.r, settings.color.g, settings.color.b); |
||
1338 | DART_MainTextureOptions_Texture_Texture:SetAlpha(settings.alpha); |
||
1339 | DART_MainTextureOptions_Texture_Texture:ClearAllPoints(); |
||
1340 | DART_MainTextureOptions_Texture_Texture:SetPoint("TOPLEFT", "DART_MainTextureOptions_Texture", "TOPLEFT", settings.padding, -settings.padding); |
||
1341 | DART_MainTextureOptions_Texture_Texture:SetPoint("BOTTOMRIGHT", "DART_MainTextureOptions_Texture", "BOTTOMRIGHT", -settings.padding, settings.padding); |
||
1342 | if (settings.hidebg) then |
||
1343 | DART_MainTextureOptions_Texture:SetBackdropColor(0, 0, 0, 0); |
||
1344 | DART_MainTextureOptions_Texture:SetBackdropBorderColor(0, 0, 0, 0); |
||
1345 | end |
||
1346 | end |
||
1347 | |||
1348 | function DART_Update_Script() |
||
1349 | local scrollBar = getglobal(this:GetParent():GetName().."ScrollBar") |
||
1350 | this:GetParent():UpdateScrollChildRect(); |
||
1351 | local min; |
||
1352 | local max; |
||
1353 | min, max = scrollBar:GetMinMaxValues(); |
||
1354 | if ( max > 0 and (this.max ~= max) ) then |
||
1355 | this.max = max; |
||
1356 | scrollBar:SetValue(max); |
||
1357 | end |
||
1358 | if (DART_SCRIPT_INDEX) then |
||
1359 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX].scripts[DART_SCRIPT_INDEX] = this:GetText(); |
||
1360 | if (this:GetText() and this:GetText() ~= "") then |
||
1361 | getglobal("DART_ScriptOptions_"..DART_SCRIPT_LABEL[DART_SCRIPT_INDEX]):SetText(DART_SCRIPT_LABEL[DART_SCRIPT_INDEX].." *"); |
||
1362 | else |
||
1363 | getglobal("DART_ScriptOptions_"..DART_SCRIPT_LABEL[DART_SCRIPT_INDEX]):SetText(DART_SCRIPT_LABEL[DART_SCRIPT_INDEX]); |
||
1364 | end |
||
1365 | end |
||
1366 | end |
||
1367 | |||
1368 | function DART_Update_Setting(value, index, subindex) |
||
1369 | if (index == "CONDITION") then |
||
1370 | DART_CONDITION_BUFFER[subindex] = value; |
||
1371 | elseif (this.index == "CONDITION") then |
||
1372 | DART_CONDITION_BUFFER[this.subindex] = value; |
||
1373 | elseif (subindex) then |
||
1374 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX][index][subindex] = value; |
||
1375 | elseif (index) then |
||
1376 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX][index] = value; |
||
1377 | elseif (this.miscindex) then |
||
1378 | DART_Settings[DART_INDEX][this.miscindex] = value; |
||
1379 | elseif (this.subindex) then |
||
1380 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX][this.index][this.subindex] = value; |
||
1381 | elseif (this.index) then |
||
1382 | DART_Settings[DART_INDEX][DART_TEXTURE_INDEX][this.index] = value; |
||
1383 | end |
||
1384 | end |