vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 function DAB_PickupAction(action)
2 DAB_Old_PickupAction(action);
3 DAB_Update_ActionList();
4 end
5  
6 function DAB_PlaceAction(action)
7 DAB_Old_PlaceAction(action);
8 DAB_Update_ActionList();
9 end
10  
11 function DAB_ReputationWatchBar_Update(newLevel)
12 DAB_Old_ReputationWatchBar_Update(newLevel);
13 if (DAB_Settings[DAB_INDEX].MainMenuBar.showXP) then
14 if ( not newLevel ) then
15 newLevel = UnitLevel("player");
16 end
17 ReputationWatchBar:ClearAllPoints();
18 if ( newLevel < MAX_PLAYER_LEVEL ) then
19 ReputationWatchBar:SetPoint("TOP", MainMenuExpBar, "BOTTOM", 0, 0);
20 else
21 ReputationWatchBar:SetPoint("TOP", DAB_XPBar, "TOP", 0, 0);
22 end
23 end
24 end
25  
26 function DAB_Initialize()
27 if (DAB_INITIALIZED) then return; end
28  
29 if (DAB_DL_VERSION > DL_VERSION) then
30 DL_Error("** You need to install the latest version of the Discord Library, v"..DAB_DL_VERSION..", for Discord Action Bars to work right. It should be included in the same .zip file from which you extracted this mod. **");
31 return;
32 end
33  
34 DAB_Old_SaveBindings = SaveBindings;
35 SaveBindings = DAB_SaveBindings;
36 for i=1,12 do
37 setglobal("BINDING_NAME_ACTIONBUTTON"..i, DAB_TEXT.KBWarning);
38 setglobal("BINDING_NAME_SELFACTIONBUTTON"..i, DAB_TEXT.KBWarning);
39 end
40 UpdateTalentButton = function () end;
41 TalentMicroButton:UnregisterEvent("UNIT_LEVEL");
42 TalentMicroButton:UnregisterEvent("PLAYER_ENTERING_WORLD");
43 ActionBarUpButton:SetScript("OnClick", function() DAB_Bar_PageUp(1); PlaySound("UChatScrollButton"); end);
44 ActionBarDownButton:SetScript("OnClick", function() DAB_Bar_PageDown(1); PlaySound("UChatScrollButton"); end);
45  
46 DAB_Old_PickupAction = PickupAction;
47 PickupAction = DAB_PickupAction;
48 DAB_Old_PlaceAction = PlaceAction;
49 PlaceAction = DAB_PlaceAction;
50  
51 DAB_Old_ReputationWatchBar_Update = ReputationWatchBar_Update;
52 ReputationWatchBar_Update = DAB_ReputationWatchBar_Update;
53  
54 if (not DAB_Settings) then
55 DAB_Settings = {};
56 elseif (not DAB_Settings["INITIALIZED3.0"]) then
57 DAB_Settings = {};
58 end
59 DAB_Settings["INITIALIZED3.0"] = 1;
60  
61 DAB_PROFILE_INDEX = UnitName("player").." :: "..GetCVar("realmName");
62 if (DAB_Settings[DAB_PROFILE_INDEX]) then
63 DAB_INDEX = DAB_Settings[DAB_PROFILE_INDEX];
64 else
65 DAB_INDEX = DAB_TEXT.Default;
66 DAB_Settings[DAB_PROFILE_INDEX] = DAB_TEXT.Default;
67 end
68  
69 if (not DAB_Settings[DAB_INDEX]) then
70 local err = DAB_Load_DefaultSettings();
71 if (err) then
72 DL_Error("** Default settings not found for Discord Action Bars. Unable to initialize. **");
73 return;
74 end
75 end
76  
77 if (DAB_CUSTOM_SETTINGS) then
78 DAB_Settings.Custom = {};
79 DL_Copy_Table(DAB_CUSTOM_SETTINGS, DAB_Settings.Custom);
80 DAB_CUSTOM_SETTINGS = nil;
81 end
82  
83 ActionButtonDown = function() DL_Error("You are trying to use the default UI's action button keybindings. They will not work with Discord Action Bars."); end
84  
85 if (CT_ActionButton1) then
86 DL_Error("You are running CT_BarMod along with Discord Action Bars. Discord Action Bars will not run until you disable CT_BarMod.");
87 return;
88 end
89  
90 if (CT_BottomBarFrame) then
91 DL_Error("You are running CT_BottomBar along with Discord Action Bars. Discord Action Bars will not run until you disable CT_BottomBar.");
92 return;
93 end
94  
95 DAB_INITIALIZED = true;
96 DAB_Conditions();
97 DAB_Initialize_Everything();
98 end
99  
100 function DAB_Get_NumButtonsAndBars()
101 local count = 1;
102 while (getglobal("DAB_ActionButton_"..count)) do
103 DAB_NUM_BUTTONS = count;
104 count = count + 1;
105 end
106 count = 1;
107 while (getglobal("DAB_ActionBar_"..count)) do
108 DAB_NUM_BARS = count;
109 count = count + 1;
110 end
111 end
112  
113 function DAB_Initialize_Everything()
114 if (not DAB_INITIALIZED) then return; end
115 DAB_Get_NumButtonsAndBars();
116 DAB_Initialize_NewSettings();
117 DAB_UPDATE_SPEED = 1 / DAB_Settings[DAB_INDEX].UpdateSpeed;
118 for i=1,DAB_NUM_BARS do
119 DAB_Bar_Location(i);
120 DAB_Bar_Initialize(i);
121 DAB_Bar_Label(i);
122 DAB_Bar_Backdrop(i);
123 DAB_Bar_ButtonTextures(i);
124 DAB_Bar_ButtonText(i);
125 DAB_Bar_ButtonSize(i);
126 DAB_Bar_ButtonAlpha(i);
127 DAB_Bar_Update(i);
128 DAB_ControlBox_Initialize(i);
129 DAB_Compile_Scripts("Bar", i);
130 DAB_Compile_Scripts("ControlBox", i);
131 end
132 for i=11,14 do
133 DAB_OtherBar_Initialize(i);
134 end
135 for i in DAB_Settings[DAB_INDEX].Floaters do
136 DAB_Floater_Initialize(i);
137 DAB_Compile_Scripts("Floaters", i);
138 end
139 DAB_VL_CHANGED = 1;
140 DAB_EventMacro_Compile();
141 DAB_Update_MainMenuBar();
142 DAB_Set_Keybindings();
143 DAB_Update_Keybindings();
144 if (DAB_Options) then
145 DAB_Init_MainMenuOptions();
146 DAB_Init_MiscOptions();
147 DAB_Set_OptionsScale(DAB_Settings[DAB_INDEX].optionsScale);
148 DAB_Init_ButtonLayout();
149 end
150 DAB_Update_Locations();
151 DAB_Update_ObjectList();
152 DAB_Update_ActionList();
153 DAB_Update_AnchorsList();
154 DAB_Update_TextureList();
155 DAB_Update_GroupList();
156 DAB_Update_UnitList();
157 DAB_Update_FontList();
158 DAB_Update_FloaterList();
159 DAB_Update_EventList();
160 DAB_Update_ProfileList();
161 DL_Update_Forms();
162 for _,button in DAB_Settings[DAB_INDEX].FreeButtons do
163 DAB_Settings[DAB_INDEX].Buttons[button] = {Conditions={}, Scripts={}, action=button};
164 getglobal("DAB_ActionButton_"..button):Hide();
165 end
166 end
167  
168 function DAB_Initialize_NewSettings()
169 if (not DAB_INITIALIZED) then return; end
170 if (not DAB_Settings[DAB_INDEX]["INITIALIZED3.0H"]) then
171 for i=1,DAB_NUM_BARS do
172 DAB_Settings[DAB_INDEX].ControlBox[i].changePageBar = 1;
173 DAB_Settings[DAB_INDEX].ControlBox[i].changePageType = 1;
174 DAB_Settings[DAB_INDEX].ControlBox[i].changePagePage = 1;
175 end
176 end
177 if (not DAB_Settings[DAB_INDEX]["INITIALIZED3.1"]) then
178 for bar=1, DAB_NUM_BARS do
179 DAB_Settings[DAB_INDEX].Bar[bar].pages = {};
180 DAB_Settings[DAB_INDEX].Bar[bar].pageconditions = {};
181 for page=1, DAB_Settings[DAB_INDEX].Bar[bar].numBars do
182 DAB_Settings[DAB_INDEX].Bar[bar].pages[page] = {};
183 DAB_Settings[DAB_INDEX].Bar[bar].pageconditions[page] = {};
184 local count = 0;
185 for b=1,DAB_NUM_BUTTONS do
186 if (DAB_Settings[DAB_INDEX].Buttons[b].Bar == bar and DAB_Settings[DAB_INDEX].Buttons[b].Bar2 == page) then
187 count = count + 1;
188 DAB_Settings[DAB_INDEX].Bar[bar].pages[page][count] = b;
189 DAB_Settings[DAB_INDEX].Bar[bar].pageconditions[page][count] = {};
190 DL_Copy_Table(DAB_Settings[DAB_INDEX].Buttons[b].Conditions, DAB_Settings[DAB_INDEX].Bar[bar].pageconditions[page][count]);
191 end
192 end
193 end
194 end
195 local count = {};
196 for i=1,DAB_NUM_BUTTONS do
197 DAB_Settings[DAB_INDEX].Buttons[i].action = i;
198 local bar = DAB_Settings[DAB_INDEX].Buttons[i].Bar;
199 local page = DAB_Settings[DAB_INDEX].Buttons[i].Bar2;
200 DAB_Settings[DAB_INDEX].Buttons[i].Bar2 = nil;
201 if (bar and bar ~= "F" and page > 1) then
202 tinsert(DAB_Settings[DAB_INDEX].FreeButtons, i);
203 DAB_Settings[DAB_INDEX].Buttons[i].Bar = nil;
204 DAB_Settings[DAB_INDEX].Buttons[i].Conditions={};
205 DAB_Settings[DAB_INDEX].Buttons[i].Scripts={};
206 end
207 end
208 end
209 -- Fixing some corrupted settings from the first 3.1 beta
210 for bar = 1,10 do
211 for page=1, DAB_Settings[DAB_INDEX].Bar[bar].numBars do
212 if (not DAB_Settings[DAB_INDEX].Bar[bar].pages) then
213 DAB_Settings[DAB_INDEX].Bar[bar].pages = {};
214 end
215 if (not DAB_Settings[DAB_INDEX].Bar[bar].pageconditions) then
216 DAB_Settings[DAB_INDEX].Bar[bar].pageconditions = {};
217 end
218 if (not DAB_Settings[DAB_INDEX].Bar[bar].pages[page]) then
219 DAB_Settings[DAB_INDEX].Bar[bar].pages[page] = {};
220 for button = 1, DAB_Settings[DAB_INDEX].Bar[bar].numButtons do
221 DAB_Settings[DAB_INDEX].Bar[bar].pages[page][button] = 1;
222 end
223 end
224 if (not DAB_Settings[DAB_INDEX].Bar[bar].pageconditions[page]) then
225 DAB_Settings[DAB_INDEX].Bar[bar].pageconditions[page] = {};
226 for button = 1, DAB_Settings[DAB_INDEX].Bar[bar].numButtons do
227 DAB_Settings[DAB_INDEX].Bar[bar].pageconditions[page][button] = {};
228 end
229 end
230 for button = 1, DAB_Settings[DAB_INDEX].Bar[bar].numButtons do
231 if (not DAB_Settings[DAB_INDEX].Bar[bar].pageconditions[page][button]) then
232 DAB_Settings[DAB_INDEX].Bar[bar].pageconditions[page][button] = {};
233 end
234 if (not DAB_Settings[DAB_INDEX].Bar[bar].pages[page][button]) then
235 DAB_Settings[DAB_INDEX].Bar[bar].pages[page][button] = 1;
236 end
237 end
238 end
239 end
240 if (not DAB_Settings[DAB_INDEX]["INITIALIZED3.1g"]) then
241 DAB_Settings[DAB_INDEX].SelfCast = 1;
242 DAB_Settings[DAB_INDEX].DragLockOverride = 2;
243 DAB_Settings[DAB_INDEX].ButtonLockOverride = 3;
244 DAB_Settings[DAB_INDEX].CDFormat = 1;
245 end
246 if (not DAB_Settings[DAB_INDEX]["INITIALIZED3.1i"]) then
247 DAB_Settings[DAB_INDEX].OtherBar[11].Cooldown = {color={r=1, g=1, b=0}, size=16, font="Fonts\\FRIZQT__.TTF"};
248 DAB_Settings[DAB_INDEX].OtherBar[12].Cooldown = {color={r=1, g=1, b=0}, size=16, font="Fonts\\FRIZQT__.TTF"};
249 end
250 if (not DAB_Settings[DAB_INDEX]["INITIALIZED3.16"]) then
251 DAB_Settings[DAB_INDEX].MainMenuBar.keyringscale = 1
252 end
253 DAB_Settings[DAB_INDEX]["INITIALIZED3.0H"] = 1;
254 DAB_Settings[DAB_INDEX]["INITIALIZED3.1"] = 1;
255 DAB_Settings[DAB_INDEX]["INITIALIZED3.1g"] = 1;
256 DAB_Settings[DAB_INDEX]["INITIALIZED3.1i"] = 1;
257 DAB_Settings[DAB_INDEX]["INITIALIZED3.16"] = 1;
258 end
259  
260 function DAB_Compile_Scripts(object, index)
261 for i = 1, 14 do
262 local script = DAB_Settings[DAB_INDEX][object][index].Scripts[i];
263 local name = DL_Get_MenuText(DAB_SCRIPTS, i);
264 if (string.sub(name, -2) == " *") then
265 name = string.sub(name, 1, -2);
266 end
267 if (i == 2) then
268 name = "OnClickAfter"
269 elseif (i == 12) then
270 name = "OnClickBefore"
271 elseif (i == 10) then
272 name = "OnKeybindingDownAfter"
273 elseif (i == 13) then
274 name = "OnKeybindingDownBefore"
275 elseif (i == 11) then
276 name = "OnKeybindingUpAfter"
277 elseif (i == 14) then
278 name = "OnKeybindingUpBefore"
279 end
280 if (script and script ~= "") then
281 RunScript("function DAB_"..object.."_"..index.."_"..name.."(param)\n"..script.."\nend");
282 else
283 RunScript("DAB_"..object.."_"..index.."_"..name.." = nil");
284 end
285 end
286 if (getglobal("DAB_"..object.."_"..index.."_OnLoad")) then
287 if (object == "Bar") then
288 this = getglobal("DAB_ActionBar_"..index);
289 else
290 this = getglobal("DAB_ActionButton_"..index);
291 end
292 getglobal("DAB_"..object.."_"..index.."_OnLoad")();
293 end
294 end
295  
296 function DAB_Conditions()
297 DL_Alphabetic_Insert(DL_CONDITIONS_MENU, { text="Bar's Current Page", value=200, params=200, desc="Detects what page the specified bar is currently on." }, "text", 2);
298 DL_CheckCondition[200] = function(conditions)
299 if (DL_Compare(DAB_Bar_GetRealPage(conditions.bar), conditions.number, conditions.compare)) then
300 return true;
301 end
302 end
303 end
304  
305 function DAB_Load_Options()
306 if (DAB_Options) then return; end
307 UIParentLoadAddOn("DiscordActionBarsOptions");
308 DL_Set_OptionsTitle("DAB_Options", "DiscordActionBarsOptions\\title", DAB_VERSION);
309 DL_Layout_Menu("DAB_DropMenu", DAB_DropMenu_OnClick);
310 DL_Layout_ScrollButtons("DAB_Options_BarBrowser_Button", 15, DAB_BarBrowser_OnClick);
311 DL_Layout_ScrollButtons("DAB_KeybindingOptions_KeybindingBrowser_Button", 10);
312 DAB_Options_BarBrowser_Button2:SetChecked(1);
313 DAB_Options_BarBrowser_Button2Text:SetTextColor(1, 0, 0);
314 DL_Layout_ScrollButtons("DAB_ScrollMenu_Button", 10, DAB_ScrollMenu_OnClick);
315 DL_Layout_ScrollButtons("DAB_BarOptions_BarControl_ConditionMenu_Button", 5);
316 DL_Layout_ScrollButtons("DAB_FloaterOptions_Control_ConditionMenu_Button", 5);
317 DL_Layout_ScrollButtons("DAB_SetActionIDs_ScrollMenu_Button", 19);
318 DL_Layout_ScrollButtons("DAB_ChangeActions_ScrollMenu_Button", 13);
319 DL_Layout_ScrollButtons("DAB_BarOptions_ButtonControl_ButtonsMenu_Button", 4, DAB_Select_BarButton);
320 DAB_BarOptions_BarAppearance_PaddingLabel:SetText(DAB_TEXT.Padding);
321 DAB_BarOptions_BarAppearance_InsetsLabel:SetText(DAB_TEXT.Insets);
322 DAB_OtherBarOptions_PaddingLabel:SetText(DAB_TEXT.Padding);
323 DAB_OtherBarOptions_InsetsLabel:SetText(DAB_TEXT.Insets);
324 DAB_BarOptions_Label_InsetsLabel:SetText(DAB_TEXT.Insets);
325 DAB_BarOptions_ButtonAppearance_PaddingLabel:SetText(DAB_TEXT.ButtonBorderPadding);
326 DAB_BarOptions_ButtonAppearance_TextLabel:SetText(DAB_TEXT.ButtonText);
327 DAB_BarOptions_ButtonAppearance_TextureLabel:SetText(DAB_TEXT.ButtonTextures);
328 DAB_BarOptions_ButtonAppearance_ColorLabel:SetText(DAB_TEXT.ButtonConditionalColor);
329 DAB_BarOptions_BarControl_ParamLabel:SetText(DAB_TEXT.Parameters);
330 DAB_BarOptions_BarControl_ResponseLabel:SetText(DAB_TEXT.Parameters);
331 DAB_NumButtons_ButtonLabel:SetText(DAB_TEXT.Buttons);
332 DAB_NumButtons_PagesLabel:SetText(DAB_TEXT.Pages);
333 DAB_NumButtons_Floaters_Label:SetText(DAB_TEXT.Floaters);
334 DAB_NumButtons_Floaters_Label:SetTextColor(1, 1, 0);
335 DAB_CBoxOptions_Config_AnchorLabel:SetText(DAB_TEXT.AnchorFrame);
336 DAB_CBoxOptions_Config_AnchorPointLabel:SetText(DAB_TEXT.AnchorPoint);
337 DAB_CBoxOptions_Config_AnchorToLabel:SetText(DAB_TEXT.AnchorTo);
338 DAB_CBoxOptions_Config_HideLabel:SetText(DAB_TEXT.Hide);
339 DAB_CBoxOptions_Config_BorderLabel:SetText(DAB_TEXT.Border);
340 DAB_CBoxOptions_Config_WidthLabel:SetText(DAB_TEXT.Width);
341 DAB_CBoxOptions_Config_TextureLabel:SetText(DAB_TEXT.Texture);
342 DAB_FloaterOptions_AdvConfig_PaddingLabel:SetText(DAB_TEXT.ButtonBorderPadding);
343 DAB_FloaterOptions_AdvConfig_TextLabel:SetText(DAB_TEXT.ButtonText);
344 DAB_KeybindingOptions_KeybindingBrowser_OptionsLabel:SetText(DAB_TEXT.Options);
345 DAB_KeybindingOptions_KeybindingBrowser_Key1Label:SetText(DAB_TEXT.Key1);
346 DAB_KeybindingOptions_KeybindingBrowser_Key2Label:SetText(DAB_TEXT.Key2);
347 DL_Init_MenuControl(DAB_SetActionIDs_FilterMenu1, 1);
348 DAB_Init_BarOptions();
349 DAB_Init_MainMenuOptions();
350 DAB_Init_MiscOptions();
351 DAB_Set_OptionsScale(DAB_Settings[DAB_INDEX].optionsScale);
352 DAB_Init_ButtonLayout();
353 DL_Update_Forms();
354 DAB_Update_ScriptsList();
355 DAB_BarBrowser_Update();
356 DAB_Update_ActionIDsList();
357 end
358  
359 function DAB_Load_DefaultSettings()
360 DAB_Settings[DAB_INDEX] = {};
361 if (DAB_DEFAULT_SETTINGS) then
362 DL_Copy_Table(DAB_DEFAULT_SETTINGS, DAB_Settings[DAB_INDEX]);
363 else
364 return true;
365 end
366 end
367  
368 function DAB_Delete_Profile(index)
369 if ((not index) or index == "") then
370 if (DAB_Options) then
371 index = DAB_MiscOptions_LoadProfile_Setting:GetText();
372 end
373 if ((not index) or index == "") then return; end
374 end
375 if (DAB_Options) then
376 DAB_MiscOptions_LoadProfile_Setting:SetText("");
377 end
378 if (index == DAB_INDEX) then
379 DL_Error("You cannot delete the profile you current have loaded.");
380 return;
381 end
382 DAB_Settings[index] = nil;
383 DAB_Update_ProfileList();
384 DL_Feedback("Profile name "..index.." deleted.");
385 end
386  
387 function DAB_Load_Profile(index)
388 if (not DAB_INITIALIZED) then return; end
389 if ((not index) or index == "") then
390 if (DAB_Options) then
391 index = DAB_MiscOptions_LoadProfile_Setting:GetText();
392 end
393 if ((not index) or index == "") then return; end
394 end
395 if (index == DAB_INDEX) then return; end
396 if (DAB_Options) then
397 DAB_MiscOptions_LoadProfile_Setting:SetText("");
398 end
399 DAB_INDEX = index;
400 DAB_Settings[DAB_PROFILE_INDEX] = index;
401 DAB_Initialize_Everything();
402 DL_Feedback("Profile named "..index.." loaded.");
403 end
404  
405 function DAB_SafeLoad_Profile(index)
406 if (not DAB_INITIALIZED) then return; end
407 if ((not index) or index == "") then
408 if (DAB_Options) then
409 index = DAB_MiscOptions_LoadProfile_Setting:GetText();
410 end
411 if ((not index) or index == "") then return; end
412 end
413 if (index == DAB_INDEX) then return; end
414 DAB_Settings[DAB_PROFILE_INDEX] = index;
415 ReloadUI();
416 end
417  
418 function DAB_New_Profile(index)
419 if ((not index) or index == "") then
420 if (DAB_Options) then
421 index = DAB_MiscOptions_NewProfile:GetText();
422 end
423 if ((not index) or index == "") then return; end
424 end
425 if (DAB_Options) then
426 DAB_MiscOptions_NewProfile:SetText("");
427 DAB_MiscOptions_NewProfile:ClearFocus();
428 end
429 if (DAB_Settings[index]) then
430 DL_Error("You are trying to create a new profile with the same name as another profile. You must delete the other profile first.");
431 return;
432 elseif (string.find(index, " :: ")) then
433 DL_Error("You tried to create a profile using the reserved characters ::. Use a different name.");
434 return;
435 elseif (index == "Custom") then
436 DL_Error("You tried to create a profile using the reserved word Custom. Use a different name.");
437 return;
438 end
439 DAB_Settings[index] = {};
440 DL_Copy_Table(DAB_Settings[DAB_INDEX], DAB_Settings[index]);
441 DAB_INDEX = index;
442 DAB_Settings[DAB_PROFILE_INDEX] = index;
443 DL_Feedback("New profile, "..index..", created.");
444 DAB_Update_ProfileList();
445 if (DAB_Options) then
446 DAB_MiscOptions_CurrentProfile:SetText(DAB_TEXT.CurrentProfile.." |cFFFFFFFF"..index);
447 end
448 end
449  
450 function DAB_Set_Keybindings()
451 local binding, key1, key2;
452 for i=1,120 do
453 binding = "DAB_"..i;
454 key1, key2 = GetBindingKey(binding);
455 if (key1) then SetBinding(key1, ""); end
456 if (key2) then SetBinding(key2, ""); end
457 if (DAB_Settings[DAB_INDEX].Keybindings[i].key1) then
458 SetBinding(DAB_Settings[DAB_INDEX].Keybindings[i].key1, "");
459 SetBinding(DAB_Settings[DAB_INDEX].Keybindings[i].key1, binding);
460 end
461 if (DAB_Settings[DAB_INDEX].Keybindings[i].key2) then
462 SetBinding(DAB_Settings[DAB_INDEX].Keybindings[i].key2, "");
463 SetBinding(DAB_Settings[DAB_INDEX].Keybindings[i].key2, binding);
464 end
465 end
466 SaveBindings(GetCurrentBindingSet());
467 end
468  
469 function DAB_Toggle_State(setting, frame)
470 if (setting) then
471 if (not frame.oldShow) then
472 frame.oldShow = frame.Show;
473 frame.Show = function() end;
474 end
475 frame:Hide();
476 else
477 if (frame.oldShow) then
478 frame.Show = frame.oldShow;
479 frame.oldShow = nil;
480 end
481 frame:Show();
482 end
483 end
484  
485 function DAB_Update_ActionList()
486 DAB_ACTIONS = {};
487 for i=1, 120 do
488 DAB_ACTIONS[i] = { text="["..i.."] "..DAB_Get_ActionName(i), value=i };
489 end
490 end
491  
492 function DAB_Update_AnchorsList()
493 for i=1,10 do
494 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_TEXT.Bar.." "..i, "DAB_ActionBar_"..i);
495 end
496 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_TEXT.PetBar, "DAB_OtherBar_Pet");
497 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_TEXT.ShapeshiftBar, "DAB_OtherBar_Form");
498 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_TEXT.BagBar, "DAB_OtherBar_Bag");
499 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_TEXT.MenuBar, "DAB_OtherBar_Menu");
500 for i=1,10 do
501 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_TEXT.ControlBox.." "..i, "DAB_ControlBox_"..i);
502 end
503 for i=1,120 do
504 if (DAB_Settings[DAB_INDEX].Floaters[i]) then
505 DL_AddToMenu(DL_ANCHOR_FRAMES, "[F "..i.."] "..DAB_Get_ActionName(DAB_Settings[DAB_INDEX].Buttons[i].action), "DAB_ActionButton_"..i);
506 end
507 end
508 for i=1,10 do
509 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_Settings[DAB_INDEX].Bar[i].Anchor.frame);
510 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_Settings[DAB_INDEX].ControlBox[i].Anchor.frame);
511 end
512 for i=11,14 do
513 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_Settings[DAB_INDEX].OtherBar[i].Anchor.frame);
514 end
515 for i in DAB_Settings[DAB_INDEX].Floaters do
516 DL_AddToMenu(DL_ANCHOR_FRAMES, DAB_Settings[DAB_INDEX].Floaters[i].Anchor.frame);
517 end
518 end
519  
520 function DAB_Update_EventList()
521 for event, val in DAB_Settings[DAB_INDEX].CustomEvents do
522 DL_AddToMenu(DAB_EVENTS, val.text, event, val.desc);
523 end
524 for index,val in DAB_EVENTS do
525 if (DAB_Settings[DAB_INDEX].EventMacros[val.value] and DAB_Settings[DAB_INDEX].EventMacros[val.value] ~= "") then
526 if (string.sub(DAB_EVENTS[index].text, -2) ~= " *") then
527 DAB_EVENTS[index].text = DAB_EVENTS[index].text.." *";
528 end
529 elseif (string.sub(DAB_EVENTS[index].text, -2) == " *") then
530 DAB_EVENTS[index].text = string.sub(DAB_EVENTS[index].text, 1, -2);
531 end
532 end
533 end
534  
535 function DAB_Update_FloaterList()
536 DAB_FLOATERS = {};
537 for i=1,120 do
538 if (DAB_Settings[DAB_INDEX].Floaters[i]) then
539 DL_AddToMenu(DAB_FLOATERS, "[F "..i.."] "..DAB_Get_ActionName(DAB_Settings[DAB_INDEX].Buttons[i].action), i);
540 end
541 end
542 end
543  
544 function DAB_Update_FontList()
545 for i=1,10 do
546 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].Bar[i].Keybinding.font, nil, 1);
547 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].Bar[i].Cooldown.font, nil, 1);
548 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].Bar[i].Macro.font, nil, 1);
549 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].Bar[i].Count.font, nil, 1);
550 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].Bar[i].Label.font, nil, 1);
551 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].ControlBox[i].font, nil, 1);
552 end
553 for i in DAB_Settings[DAB_INDEX].Floaters do
554 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].Floaters[i].Keybinding.font);
555 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].Floaters[i].Cooldown.font);
556 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].Floaters[i].Macro.font);
557 DL_AddToMenu(DL_FONTS_LIST, DAB_Settings[DAB_INDEX].Floaters[i].Count.font);
558 end
559 end
560  
561 function DAB_Update_GroupList()
562 DAB_GROUPS = {};
563 DAB_GROUPS[1] = {text=""};
564 for i=1,10 do
565 DAB_GROUPS[i + 1] = {text=i, value=i};
566 end
567 for i=1,10 do
568 DL_AddToMenu(DAB_GROUPS, DAB_Settings[DAB_INDEX].Bar[i].cbgroup);
569 end
570 for i=11,14 do
571 DL_AddToMenu(DAB_GROUPS, DAB_Settings[DAB_INDEX].OtherBar[i].cbgroup);
572 end
573 for i in DAB_Settings[DAB_INDEX].Floaters do
574 DL_AddToMenu(DAB_GROUPS, DAB_Settings[DAB_INDEX].Floaters[i].cbgroup);
575 end
576 end
577  
578 function DAB_Update_Keybindings()
579 if (not DAB_INITIALIZED) then return; end
580 local kb, name, kbtext, button;
581 for i=1,120 do
582 getglobal("DAB_ActionButton_"..i.."_HotKey"):SetText("");
583 getglobal("DAB_ActionButton_"..i).basekb = "";
584 end
585 for i=1,120 do
586 kb = DAB_Settings[DAB_INDEX].Keybindings[i];
587 kbtext = DL_Get_KeybindingText("DAB_"..i, nil, 1);
588 if (kb.option == 1 or kb.option == 10) then
589 name = "|cFF"..DAB_KB_COLOR[kb.option][kb.suboption].." ";
590 elseif (kb.option == 12) then
591 local _, _, bar, page = string.find(kb.suboption, "(%d*)_(%d*)");
592 bar = tonumber(bar);
593 page = tonumber(page);
594 name = "|cFF"..DAB_KB_COLOR[kb.option][bar].." ";
595 else
596 name = "|cFF"..DAB_KB_COLOR[kb.option].." ";
597 end
598 if (kb.option == 1) then
599 name = name.."["..DAB_TEXT.Bar.." "..kb.suboption.."] "..DAB_Settings[DAB_INDEX].Bar[kb.suboption].Label.text.." :: "..DAB_TEXT.Button.." "..kb.suboption2;
600 for page = 1, DAB_Settings[DAB_INDEX].Bar[kb.suboption].numBars do
601 local button = DAB_Get_BarButtonID(kb.suboption, page, kb.suboption2);
602 if (button and kbtext ~= "") then
603 getglobal("DAB_ActionButton_"..button.."_HotKey"):SetText(kbtext);
604 getglobal("DAB_ActionButton_"..button).basekb = kbtext;
605 end
606 end
607 elseif (kb.option == 2) then
608 name = name..DAB_TEXT.Group.." "..kb.suboption.." :: "..DAB_TEXT.Button.." "..kb.suboption2;
609 elseif (kb.option == 3) then
610 name = name.."[F "..kb.suboption.."] "..DAB_Get_ActionName(DAB_Settings[DAB_INDEX].Buttons[kb.suboption].action);
611 if (kbtext ~= "") then
612 getglobal("DAB_ActionButton_"..kb.suboption.."_HotKey"):SetText(kbtext);
613 end
614 elseif (kb.option == 4) then
615 name = name..DAB_TEXT.ControlBox.." "..kb.suboption;
616 elseif (kb.option == 5) then
617 name = name..DAB_TEXT.SetKBGroup;
618 name = string.gsub(name, "$g", kb.suboption);
619 name = string.gsub(name, "$b", kb.suboption2);
620 elseif (kb.option == 6) then
621 name = name..DAB_TEXT.SetBarPage;
622 name = string.gsub(name, "$b", kb.suboption);
623 name = string.gsub(name, "$p", kb.suboption2);
624 elseif (kb.option == 7) then
625 name = name..DAB_TEXT.BarPageUp;
626 name = string.gsub(name, "$b", kb.suboption);
627 elseif (kb.option == 8) then
628 name = name..DAB_TEXT.BarPageDown;
629 name = string.gsub(name, "$b", kb.suboption);
630 elseif (kb.option == 9) then
631 if (DAB_VARIABLE_KEYBINDINGS[kb.suboption] ~= 1) then
632 DAB_VARIABLE_KEYBINDINGS[kb.suboption] = 2;
633 end
634 name = name..DAB_TEXT.VariableKeybinding;
635 name = string.gsub(name, "$n", kb.suboption);
636 elseif (kb.option == 10) then
637 name = name.."Self-cast ["..DAB_TEXT.Bar.." "..kb.suboption.."] "..DAB_Settings[DAB_INDEX].Bar[kb.suboption].Label.text.." :: "..DAB_TEXT.Button.." "..kb.suboption2;
638 elseif (kb.option == 11) then
639 name = name.."Self-cast [F "..kb.suboption.."] "..DAB_Get_ActionName(DAB_Settings[DAB_INDEX].Buttons[kb.suboption].action);
640 elseif (kb.option == 12) then
641 local _, _, bar, page = string.find(kb.suboption, "(%d*)_(%d*)");
642 bar = tonumber(bar);
643 page = tonumber(page);
644 name = name.."["..DAB_TEXT.Bar.." "..bar..", "..DAB_TEXT.Page.." "..page.."] "..DAB_Settings[DAB_INDEX].Bar[bar].Label.text.." :: "..DAB_TEXT.Button.." "..kb.suboption2;
645 local button = DAB_Get_BarButtonID(bar, page, kb.suboption2);
646 if (button and kbtext ~= "") then
647 getglobal("DAB_ActionButton_"..button.."_HotKey"):SetText(kbtext);
648 getglobal("DAB_ActionButton_"..button).basekb = kbtext;
649 end
650 elseif (kb.option == 13) then
651 name = name.."Use Action: "..DAB_Get_ActionName(kb.suboption);
652 elseif (kb.option == 14) then
653 name = name.."Self-cast Action: "..DAB_Get_ActionName(kb.suboption);
654 else
655 name = name..DAB_TEXT.Undefined;
656 end
657 setglobal("BINDING_NAME_DAB_"..i, name);
658 end
659  
660 for group, bar in DAB_Settings[DAB_INDEX].KBGroups do
661 DAB_Set_KeybindingGroup(group, bar);
662 end
663 end
664  
665 function DAB_Update_Locations()
666 for frameName, settings in DAB_Settings[DAB_INDEX].FrameLocs do
667 frame = getglobal(frameName);
668 frame:ClearAllPoints();
669 frame:SetPoint(settings.point, settings.frame, settings.to, settings.x, settings.y);
670 end
671 end
672  
673 function DAB_Update_MainMenuBar()
674 local settings = DAB_Settings[DAB_INDEX].MainMenuBar;
675 BonusActionBarFrame.Show = function() end;
676 BonusActionBarFrame:SetScript("OnEvent", function() end);
677 BonusActionBarFrame:Hide();
678 for i=1,12 do
679 local button = getglobal("ActionButton"..i);
680 button.Show = function() end;
681 button:SetScript("OnEvent", function() end);
682 button:SetParent(UIParent);
683 button:Hide();
684 button = getglobal("BonusActionButton"..i);
685 button.Show = function() end;
686 button:SetScript("OnEvent", function() end);
687 button:SetParent(UIParent);
688 button:Hide();
689 if (i <= 10) then
690 button = getglobal("ShapeshiftButton"..i.."NormalTexture");
691 button.Show = function() end;
692 button:SetAlpha(0);
693 button:Hide();
694 end
695 end
696 DAB_Toggle_State(settings.hideEverything, MainMenuBar);
697 DAB_Toggle_State(settings.hideEverything, MainMenuBarArtFrame);
698 if (settings.showXP) then
699 MainMenuExpBar:SetParent(DAB_XPBar);
700 MainMenuExpBar:SetFrameStrata("LOW");
701 MainMenuExpBar:SetFrameLevel(DAB_XPBar:GetFrameLevel() - 1);
702 MainMenuExpBar:Show();
703 MainMenuExpBar:ClearAllPoints();
704 MainMenuExpBar:SetPoint("TOP", DAB_XPBar, "TOP", 0, 0);
705 ExhaustionTick:SetParent(MainMenuExpBar);
706 DAB_XPBar:Show();
707 MainMenuBarPerformanceBarFrame:Hide();
708 MainMenuExpBar:SetStatusBarColor(settings.xpcolor.r, settings.xpcolor.g, settings.xpcolor.b);
709 for i=1,4 do
710 if (settings.hideXPborder) then
711 getglobal("DAB_XPBar_"..i):Hide();
712 else
713 getglobal("DAB_XPBar_"..i):Show();
714 end
715 end
716 DAB_XPBar:SetScale(settings.xpscale);
717 DAB_XPBar:SetAlpha(settings.xpalpha);
718 ReputationWatchBar:SetParent(DAB_XPBar);
719 ReputationWatchBar:SetFrameStrata("LOW");
720 else
721 ReputationWatchBar:SetParent(MainMenuBar);
722 MainMenuExpBar:SetParent(MainMenuBar);
723 MainMenuExpBar:ClearAllPoints();
724 MainMenuExpBar:SetPoint("TOP", MainMenuBar, "TOP", 0, 0);
725 DAB_XPBar:Hide();
726 end
727 if (settings.showLatency) then
728 DAB_LatencyBar:Show();
729 MainMenuBarPerformanceBarFrame:SetParent(DAB_LatencyBar);
730 MainMenuBarPerformanceBarFrame:SetFrameStrata("BACKGROUND");
731 MainMenuBarPerformanceBarFrame:Show();
732 if (not MainMenuBarPerformanceBarFrame.OLD_SetPoint) then
733 MainMenuBarPerformanceBarFrame:ClearAllPoints();
734 MainMenuBarPerformanceBarFrame:SetPoint("CENTER", DAB_LatencyBar, "CENTER", 4, 0);
735 MainMenuBarPerformanceBarFrame.OLD_SetPoint = MainMenuBarPerformanceBarFrame.SetPoint
736 MainMenuBarPerformanceBarFrame.SetPoint = function() MainMenuBarPerformanceBarFrame:OLD_SetPoint("CENTER", DAB_LatencyBar, "CENTER", 4, 0); end
737 end
738 DAB_LatencyBar:SetScale(settings.latencyscale);
739 else
740 DAB_LatencyBar:Hide();
741 MainMenuBarPerformanceBarFrame:SetParent(MainMenuExpBar);
742 MainMenuBarPerformanceBarFrame:SetFrameStrata("LOW");
743 if (MainMenuBarPerformanceBarFrame.OLD_SetPoint) then
744 MainMenuBarPerformanceBarFrame.SetPoint = MainMenuBarPerformanceBarFrame.OLD_SetPoint
745 MainMenuBarPerformanceBarFrame.OLD_SetPoint = nil
746 end
747 MainMenuBarPerformanceBarFrame:ClearAllPoints();
748 MainMenuBarPerformanceBarFrame:SetPoint("BOTTOMRIGHT", MainMenuExpBar, "BOTTOMRIGHT", -227, -50);
749 end
750 if (settings.showKeyring) then
751 DAB_KeyringBox:Show()
752 KeyRingButton:SetParent(DAB_KeyringBox)
753 KeyRingButton:SetFrameStrata("LOW")
754 KeyRingButton:Show()
755 if (not KeyRingButton.OLD_SetPoint) then
756 KeyRingButton:ClearAllPoints()
757 KeyRingButton:SetPoint("CENTER", DAB_KeyringBox, "CENTER", 0, 0)
758 KeyRingButton.OLD_SetPoint = KeyRingButton.SetPoint
759 KeyRingButton.SetPoint = function() KeyRingButton:OLD_SetPoint("CENTER", DAB_KeyringBox, "CENTER", 0, 0) end
760 end
761 DAB_KeyringBox:SetScale(settings.keyringscale)
762 else
763 DAB_KeyringBox:Hide()
764 KeyRingButton:SetParent(MainMenuBarArtFrame)
765 if (KeyRingButton.OLD_SetPoint) then
766 KeyRingButton.SetPoint = KeyRingButton.OLD_SetPoint
767 KeyRingButton.OLD_SetPoint = nil
768 end
769 KeyRingButton:ClearAllPoints()
770 KeyRingButton:SetPoint("RIGHT", CharacterBag3Slot, "LEFT", -5, 0)
771 end
772 ReputationWatchBar_Update();
773 end
774  
775 function DAB_Update_ObjectList()
776 DAB_BAR_LIST = {};
777 DAB_BAR_LIST[1] = { text=DAB_TEXT.Bars, header=true };
778 for i=1,10 do
779 DAB_BAR_LIST[i + 1] = { text="[Bar "..i.."] "..DAB_Settings[DAB_INDEX].Bar[i].Label.text, value=i };
780 DAB_BAR_LIST[i + 17] = { text="[CB "..i.."] "..DAB_Settings[DAB_INDEX].ControlBox[i].text, value=i };
781 end
782 DAB_BAR_LIST[12] = { text=DAB_TEXT.OtherBars, header=true };
783 DAB_BAR_LIST[13] = { text=DAB_TEXT.PetBar, value=11 };
784 DAB_BAR_LIST[14] = { text=DAB_TEXT.ShapeshiftBar, value=12 };
785 DAB_BAR_LIST[15] = { text=DAB_TEXT.BagBar, value=13 };
786 DAB_BAR_LIST[16] = { text=DAB_TEXT.MenuBar, value=14 };
787 DAB_BAR_LIST[17] = { text=DAB_TEXT.ControlBoxes, header=true };
788 DAB_BAR_LIST[28] = { text=DAB_TEXT.Floaters, header=true };
789 local index = 29;
790 for i=1,120 do
791 if (DAB_Settings[DAB_INDEX].Floaters[i]) then
792 DAB_BAR_LIST[index] = { text="[F "..i.."] "..DAB_Get_ActionName(DAB_Settings[DAB_INDEX].Buttons[i].action), value=i };
793 index = index + 1;
794 end
795 end
796 end
797  
798 function DAB_Update_ProfileList()
799 DAB_PROFILES = {};
800 for profile in DAB_Settings do
801 if ((not string.find(profile, " :: ")) and profile ~= "INITIALIZED3.0") then
802 if (profile == DAB_TEXT.Default) then
803 DL_AddToMenu(DAB_PROFILES, profile, nil, "All new characters will start out using this profile.");
804 elseif (profile == "Custom") then
805 DL_AddToMenu(DAB_PROFILES, profile, nil, "You cannot make changes to this profile. It is used only to load settings from your current DAB_Custom.lua file. Start a new profile before making any changes.");
806 else
807 DL_AddToMenu(DAB_PROFILES, profile);
808 end
809 end
810 end
811 end
812  
813 function DAB_Update_TextureList()
814 for i=1,10 do
815 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Bar[i].Background.texture, nil, 1);
816 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Bar[i].Background.btexture, nil, 1);
817 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Bar[i].buttonbg, nil, 1);
818 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Bar[i].checked, nil, 1);
819 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Bar[i].highlight, nil, 1);
820 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Bar[i].Label.texture, nil, 1);
821 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Bar[i].Label.btexture, nil, 1);
822 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Bar[i].ButtonBorder.texture, nil, 1);
823 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].ControlBox[i].texture, nil, 1);
824 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].ControlBox[i].b1texture, nil, 1);
825 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].ControlBox[i].b2texture, nil, 1);
826 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].ControlBox[i].b3texture, nil, 1);
827 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].ControlBox[i].b4texture, nil, 1);
828 end
829 for i=11,14 do
830 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].OtherBar[i].Background.texture, nil, 1);
831 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].OtherBar[i].Background.btexture, nil, 1);
832 end
833 for i in DAB_Settings[DAB_INDEX].Floaters do
834 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Floaters[i].buttonbg, nil, 1);
835 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Floaters[i].checked, nil, 1);
836 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Floaters[i].highlight, nil, 1);
837 DL_AddToMenu(DL_TEXTURES_LIST, DAB_Settings[DAB_INDEX].Floaters[i].ButtonBorder.texture, nil, 1);
838 end
839 end
840  
841 function DAB_Update_UnitList()
842 for i=1,10 do
843 DL_AddToMenu(DL_UNITS_LIST, DAB_Settings[DAB_INDEX].Bar[i].target);
844 end
845 for i in DAB_Settings[DAB_INDEX].Floaters do
846 DL_AddToMenu(DL_UNITS_LIST, DAB_Settings[DAB_INDEX].Floaters[i].target);
847 end
848 end
849  
850 function DAB_SaveBindings(flag)
851 DAB_Old_SaveBindings(flag);
852 DAB_Save_Keybindings();
853 DAB_Update_Keybindings();
854 end