vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | function DUF_CheckButton_OnClick() |
2 | DUF_Update_Setting(this:GetChecked(), this.index, this.subindex); |
||
3 | DUF_Run_Functions(); |
||
4 | end |
||
5 | |||
6 | function DUF_ColorPicker_OnClick() |
||
7 | local basecolor = DUF_Options_GetSetting(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 = DUF_ColorPicker_ColorCancelled; |
||
14 | ColorPickerFrame.opacityFunc = DUF_ColorPicker_ColorChanged; |
||
15 | ColorPickerFrame.func = DUF_ColorPicker_ColorChanged; |
||
16 | ColorPickerFrame.initfunc = this:GetParent().initFunc; |
||
17 | ColorPickerFrame.colorBox = this:GetName(); |
||
18 | ColorPickerFrame.index = this.index; |
||
19 | ColorPickerFrame:SetColorRGB(color.r, color.g, color.b); |
||
20 | ColorPickerFrame:ClearAllPoints(); |
||
21 | if (DUF_Options:GetRight() < UIParent:GetWidth() / 2) then |
||
22 | ColorPickerFrame:SetPoint("LEFT", "DUF_Options", "RIGHT", 10, 0); |
||
23 | else |
||
24 | ColorPickerFrame:SetPoint("RIGHT", "DUF_Options", "LEFT", -10, 0); |
||
25 | end |
||
26 | ColorPickerFrame:Show(); |
||
27 | end |
||
28 | |||
29 | function DUF_ColorPicker_ColorCancelled() |
||
30 | local color = ColorPickerFrame.previousValues; |
||
31 | DUF_Update_Setting(color, ColorPickerFrame.index, ColorPickerFrame.subindex); |
||
32 | getglobal(ColorPickerFrame.colorBox):SetBackdropColor(color.r, color.g, color.b); |
||
33 | if (ColorPickerFrame.initfunc) then |
||
34 | for _,unit in DUF_INIT_FRAMES do |
||
35 | ColorPickerFrame.initfunc(unit, DUF_ELEMENT_SUBINDEX); |
||
36 | end |
||
37 | end |
||
38 | end |
||
39 | |||
40 | function DUF_ColorPicker_ColorChanged() |
||
41 | local r, g, b = ColorPickerFrame:GetColorRGB(); |
||
42 | local color = { r=r, g=g, b=b }; |
||
43 | DUF_Update_Setting(color, ColorPickerFrame.index, ColorPickerFrame.subindex); |
||
44 | getglobal(ColorPickerFrame.colorBox):SetBackdropColor(color.r, color.g, color.b); |
||
45 | if (ColorPickerFrame.initfunc) then |
||
46 | for _,unit in DUF_INIT_FRAMES do |
||
47 | ColorPickerFrame.initfunc(unit, DUF_ELEMENT_SUBINDEX); |
||
48 | end |
||
49 | end |
||
50 | end |
||
51 | |||
52 | function DUF_CopyFrame(source) |
||
53 | if (not source) then return; end |
||
54 | if (source == DUF_FRAME_INDEX) then return; end |
||
55 | local oldXPBar, oldHonorBar, oldHappiness, oldCombo, oldElite; |
||
56 | if (DUF_FRAME_INDEX == "player" or DUF_FRAME_INDEX == "pet") then |
||
57 | oldXPBar = {}; |
||
58 | DL_Copy_Table(DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].StatusBar[3], oldXPBar); |
||
59 | end |
||
60 | if (DUF_FRAME_INDEX == "player") then |
||
61 | oldHonorBar = {}; |
||
62 | DL_Copy_Table(DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].StatusBar[6], oldHonorBar); |
||
63 | end |
||
64 | if (DUF_FRAME_INDEX == "pet") then |
||
65 | oldHappiness = {}; |
||
66 | DL_Copy_Table(DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].HappinessIcon, oldHappiness); |
||
67 | end |
||
68 | if (DUF_FRAME_INDEX == "target") then |
||
69 | oldCombo = {}; |
||
70 | DL_Copy_Table(DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].ComboPoints, oldCombo); |
||
71 | oldElite = {}; |
||
72 | DL_Copy_Table(DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].EliteTexture, oldElite); |
||
73 | end |
||
74 | local oldx = {}; |
||
75 | local oldy = {}; |
||
76 | DL_Copy_Table(DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].xos, oldx); |
||
77 | DL_Copy_Table(DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].yos, oldy); |
||
78 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX] = {}; |
||
79 | DL_Copy_Table(DUF_Settings[DUF_INDEX][source], DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX]); |
||
80 | if (DUF_FRAME_INDEX ~= "player" and DUF_FRAME_INDEX ~= "pet") then |
||
81 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].StatusBar[3] = nil; |
||
82 | else |
||
83 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].StatusBar[3] = {}; |
||
84 | DL_Copy_Table(oldXPBar, DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].StatusBar[3]); |
||
85 | end |
||
86 | if (DUF_FRAME_INDEX ~= "player") then |
||
87 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Buffs.durationheight = 6; |
||
88 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Buffs.durationcolor = {r=1, g=1, b=1}; |
||
89 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Buffs.durationfont = "DUF_Font1.ttf"; |
||
90 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Buffs.durationalpha = 1; |
||
91 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Buffs.durationx = 0; |
||
92 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Buffs.durationy = -5; |
||
93 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Debuffs.durationheight = 6; |
||
94 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Debuffs.durationcolor = {r=1, g=1, b=1}; |
||
95 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Debuffs.durationfont = "DUF_Font1.ttf"; |
||
96 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Debuffs.durationalpha = 1; |
||
97 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Debuffs.durationx = 0; |
||
98 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].Debuffs.durationy = -5; |
||
99 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].StatusBar[6] = nil; |
||
100 | else |
||
101 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].StatusBar[6] = {}; |
||
102 | DL_Copy_Table(oldHonorBar, DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].StatusBar[6]); |
||
103 | DUF_Settings[DUF_INDEX].player.Buffs.durationheight = 6; |
||
104 | DUF_Settings[DUF_INDEX].player.Buffs.durationcolor = {r=1, g=1, b=1}; |
||
105 | DUF_Settings[DUF_INDEX].player.Buffs.durationfont = "DUF_Font1.ttf"; |
||
106 | DUF_Settings[DUF_INDEX].player.Buffs.durationalpha = 1; |
||
107 | DUF_Settings[DUF_INDEX].player.Buffs.durationx = 0; |
||
108 | DUF_Settings[DUF_INDEX].player.Buffs.durationy = -5; |
||
109 | DUF_Settings[DUF_INDEX].player.Debuffs.durationheight = 6; |
||
110 | DUF_Settings[DUF_INDEX].player.Debuffs.durationcolor = {r=1, g=1, b=1}; |
||
111 | DUF_Settings[DUF_INDEX].player.Debuffs.durationfont = "DUF_Font1.ttf"; |
||
112 | DUF_Settings[DUF_INDEX].player.Debuffs.durationalpha = 1; |
||
113 | DUF_Settings[DUF_INDEX].player.Debuffs.durationx = 0; |
||
114 | DUF_Settings[DUF_INDEX].player.Debuffs.durationy = -5; |
||
115 | end |
||
116 | if (DUF_FRAME_INDEX ~= "pet") then |
||
117 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].HappinessIcon = nil; |
||
118 | else |
||
119 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].HappinessIcon = {}; |
||
120 | DL_Copy_Table(oldHappiness, DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].HappinessIcon); |
||
121 | end |
||
122 | if (DUF_FRAME_INDEX ~= "target") then |
||
123 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].ComboPoints = nil; |
||
124 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].EliteTexture = nil; |
||
125 | else |
||
126 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].ComboPoints = {}; |
||
127 | DL_Copy_Table(oldCombo, DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].ComboPoints); |
||
128 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].EliteTexture = {}; |
||
129 | DL_Copy_Table(oldElite, DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].EliteTexture); |
||
130 | end |
||
131 | DUF_Initialize_AllFrames(); |
||
132 | DUF_Init_BaseOptions(); |
||
133 | end |
||
134 | |||
135 | function DUF_EditBox_Update() |
||
136 | local value = this:GetText(); |
||
137 | if (not value) then value = ""; end |
||
138 | if (this.number) then |
||
139 | value = this:GetNumber(); |
||
140 | if (not value) then |
||
141 | value = 0; |
||
142 | this:SetText("0"); |
||
143 | end |
||
144 | end |
||
145 | this:ClearFocus(); |
||
146 | if (this.index == "FRAMELOC") then |
||
147 | DUF_EditBox_UpdateFrameLoc(this.subindex, value) |
||
148 | else |
||
149 | DUF_Update_Setting(value, this.index, this.subindex); |
||
150 | DUF_Run_Functions(); |
||
151 | if (DUF_FRAME_INDEX) then |
||
152 | for i = 1,10 do |
||
153 | if (DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].TextBox[i].label) then |
||
154 | getglobal("DUF_Options_TextBox"..i):SetText("["..i.."] "..DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].TextBox[i].label); |
||
155 | else |
||
156 | getglobal("DUF_Options_TextBox"..i):SetText(DUF_TEXT["TextBox"..i]); |
||
157 | end |
||
158 | end |
||
159 | end |
||
160 | end |
||
161 | end |
||
162 | |||
163 | function DUF_EditBox_UpdateFrameLoc(locIndex, value) |
||
164 | local index = tonumber(DUF_FrameOptions_FrameChooser_Setting:GetText()) |
||
165 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][locIndex][index] = value |
||
166 | if (string.find(DUF_FRAME_INDEX, "party")) then |
||
167 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX..index) |
||
168 | else |
||
169 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX) |
||
170 | end |
||
171 | end |
||
172 | |||
173 | function DUF_Init_BaseOptions() |
||
174 | local settings = DUF_Options_GetAllSettings(); |
||
175 | DL_Init_EditBox(DUF_ElementOptions_Base_XOffset, settings.xoffset); |
||
176 | DL_Init_EditBox(DUF_ElementOptions_Base_YOffset, settings.yoffset); |
||
177 | DL_Init_EditBox(DUF_ElementOptions_Base_FrameLevel, settings.framelevel); |
||
178 | DL_Init_EditBox(DUF_ElementOptions_Base_BGTexture, settings.bgtexture); |
||
179 | DL_Init_MenuControl(DUF_ElementOptions_Base_FrameStrata, settings.framestrata); |
||
180 | DL_Init_EditBox(DUF_ElementOptions_Base_CustomTooltip, settings.customtooltip); |
||
181 | DL_Init_CheckBox(DUF_ElementOptions_Base_DisableMouse, settings.disablemouse); |
||
182 | DL_Init_CheckBox(DUF_ElementOptions_Base_UseCustomTooltip, settings.usecustomtooltip); |
||
183 | DL_Init_CheckBox(DUF_ElementOptions_Base_DisableTooltip, settings.disabletooltip); |
||
184 | DL_Init_CheckBox(DUF_ElementOptions_Base_Flash, settings.flashlowhealth); |
||
185 | DL_Init_MenuControl(DUF_ElementOptions_Base_MainColorContext, settings.context); |
||
186 | DL_Init_MenuControl(DUF_ElementOptions_Base_BackgroundColorContext, settings.bgcontext); |
||
187 | DL_Init_MenuControl(DUF_ElementOptions_Base_BorderColorContext, settings.bordercontext); |
||
188 | DL_Init_MenuControl(DUF_ElementOptions_Base_LeftClick, settings.leftclick); |
||
189 | DL_Init_MenuControl(DUF_ElementOptions_Base_RightClick, settings.rightclick); |
||
190 | DL_Init_MenuControl(DUF_ElementOptions_Base_MiddleClick, settings.middleclick); |
||
191 | DL_Init_MenuControl(DUF_ElementOptions_Base_AttachFrame, settings.attach); |
||
192 | DL_Init_MenuControl(DUF_ElementOptions_Base_AttachPoint, settings.attachpoint); |
||
193 | DL_Init_MenuControl(DUF_ElementOptions_Base_AttachTo, settings.attachto); |
||
194 | DL_Init_CheckBox(DUF_ElementOptions_Base_Hide, settings.hide); |
||
195 | DL_Init_CheckBox(DUF_ElementOptions_Base_Mouseover, settings.mouseover); |
||
196 | DL_Init_CheckBox(DUF_ElementOptions_Base_HideOnMouseover, settings.hidemouseover); |
||
197 | DL_Init_CheckBox(DUF_ElementOptions_Base_UseMouseoverColor, settings.usemouseovercolor); |
||
198 | DL_Init_ColorPicker(DUF_ElementOptions_Base_MouseoverColor, settings.mouseovercolor); |
||
199 | DL_Init_MenuControl(DUF_ElementOptions_Base_MouseoverGroup, settings.mouseovergroup); |
||
200 | DL_Init_Slider(DUF_ElementOptions_Base_Alpha, settings.alpha); |
||
201 | DL_Init_CheckBox(DUF_ElementOptions_Base_HideBG, settings.hidebg); |
||
202 | DL_Init_ColorPicker(DUF_ElementOptions_Base_BGColor, settings.bgcolor); |
||
203 | DL_Init_Slider(DUF_ElementOptions_Base_BGAlpha, settings.bgalpha); |
||
204 | DL_Init_Slider(DUF_ElementOptions_Base_BGPadding, settings.bgpadding); |
||
205 | DL_Init_ColorPicker(DUF_ElementOptions_Base_BorderColor, settings.bordercolor); |
||
206 | DL_Init_MenuControl(DUF_ElementOptions_Base_BorderStyle, settings.backgroundstyle); |
||
207 | DL_Init_Slider(DUF_ElementOptions_Base_BorderAlpha, settings.borderalpha); |
||
208 | end |
||
209 | |||
210 | function DUF_Init_BuffOptions() |
||
211 | local settings = DUF_Options_GetAllSettings(); |
||
212 | DL_Init_Slider(DUF_BuffOptions_Size, settings.size); |
||
213 | DL_Init_Slider(DUF_BuffOptions_HSpacing, settings.hspacing); |
||
214 | DL_Init_Slider(DUF_BuffOptions_VSpacing, settings.vspacing); |
||
215 | DL_Init_Slider(DUF_BuffOptions_Shown, settings.shown); |
||
216 | DL_Init_CheckBox(DUF_BuffOptions_TwoRows, settings.tworows); |
||
217 | DL_Init_CheckBox(DUF_BuffOptions_DurationFormat, settings.altformat); |
||
218 | DL_Init_CheckBox(DUF_BuffOptions_Vertical, settings.vertical); |
||
219 | DL_Init_CheckBox(DUF_BuffOptions_ReverseFill, settings.reverse); |
||
220 | if (DUF_FRAME_INDEX == "player") then |
||
221 | DUF_BuffOptions_ShowDuration:Show(); |
||
222 | DUF_BuffOptions_DurationFont:Show(); |
||
223 | DUF_BuffOptions_DurationXOffset:Show(); |
||
224 | DUF_BuffOptions_DurationYOffset:Show(); |
||
225 | DUF_BuffOptions_DurationColor:Show(); |
||
226 | DUF_BuffOptions_DurationHeight:Show(); |
||
227 | DUF_BuffOptions_DurationAlpha:Show(); |
||
228 | DUF_BuffOptions_DurationFormat:Show(); |
||
229 | DL_Init_CheckBox(DUF_BuffOptions_ShowDuration, settings.showduration); |
||
230 | DL_Init_CheckBox(DUF_BuffOptions_DurationFormat, settings.altformat); |
||
231 | DL_Init_Slider(DUF_BuffOptions_DurationXOffset, settings.durationx); |
||
232 | DL_Init_Slider(DUF_BuffOptions_DurationYOffset, settings.durationy); |
||
233 | DL_Init_Slider(DUF_BuffOptions_DurationHeight, settings.durationheight); |
||
234 | DL_Init_Slider(DUF_BuffOptions_DurationAlpha, settings.durationalpha); |
||
235 | DL_Init_EditBox(DUF_BuffOptions_DurationFont, settings.durationfont); |
||
236 | DL_Init_ColorPicker(DUF_BuffOptions_DurationColor, settings.durationcolor); |
||
237 | else |
||
238 | DUF_BuffOptions_ShowDuration:Hide(); |
||
239 | DUF_BuffOptions_DurationFont:Hide(); |
||
240 | DUF_BuffOptions_DurationXOffset:Hide(); |
||
241 | DUF_BuffOptions_DurationYOffset:Hide(); |
||
242 | DUF_BuffOptions_DurationColor:Hide(); |
||
243 | DUF_BuffOptions_DurationHeight:Hide(); |
||
244 | DUF_BuffOptions_DurationAlpha:Hide(); |
||
245 | DUF_BuffOptions_DurationFormat:Hide(); |
||
246 | end |
||
247 | end |
||
248 | |||
249 | function DUF_Init_ClassIconOptions() |
||
250 | local settings = DUF_Options_GetAllSettings(); |
||
251 | DL_Init_Slider(DUF_ClassIconOptions_Size, settings.size); |
||
252 | DL_Init_CheckBox(DUF_ClassIconOptions_UseRaceTexture, settings.userace); |
||
253 | end |
||
254 | |||
255 | function DUF_Init_ContextColors() |
||
256 | for i = 1,6 do |
||
257 | DL_Init_ColorPicker(getglobal("DUF_ColorContextOptions_Difficulty"..i), DUF_Settings[DUF_INDEX]["lvlcolor"..i]); |
||
258 | DL_Init_ColorPicker(getglobal("DUF_ColorContextOptions_Reaction"..i), DUF_Settings[DUF_INDEX]["reactioncolor"..i]); |
||
259 | end |
||
260 | DL_Init_ColorPicker(DUF_ColorContextOptions_Health1, DUF_Settings[DUF_INDEX].healthcolor1); |
||
261 | DL_Init_ColorPicker(DUF_ColorContextOptions_Health2, DUF_Settings[DUF_INDEX].healthcolor2); |
||
262 | DL_Init_EditBox(DUF_ColorContextOptions_HealthThreshold1, DUF_Settings[DUF_INDEX].healththreshold1); |
||
263 | DL_Init_EditBox(DUF_ColorContextOptions_HealthThreshold2, DUF_Settings[DUF_INDEX].healththreshold2); |
||
264 | DL_Init_ColorPicker(DUF_ColorContextOptions_Mana1, DUF_Settings[DUF_INDEX].manacolor1); |
||
265 | DL_Init_ColorPicker(DUF_ColorContextOptions_Mana2, DUF_Settings[DUF_INDEX].manacolor2); |
||
266 | DL_Init_EditBox(DUF_ColorContextOptions_ManaThreshold1, DUF_Settings[DUF_INDEX].manathreshold1); |
||
267 | DL_Init_EditBox(DUF_ColorContextOptions_ManaThreshold2, DUF_Settings[DUF_INDEX].manathreshold2); |
||
268 | DL_Init_ColorPicker(DUF_ColorContextOptions_Druid, DUF_Settings[DUF_INDEX].classcolorDruid); |
||
269 | DL_Init_ColorPicker(DUF_ColorContextOptions_Hunter, DUF_Settings[DUF_INDEX].classcolorHunter); |
||
270 | DL_Init_ColorPicker(DUF_ColorContextOptions_Mage, DUF_Settings[DUF_INDEX].classcolorMage); |
||
271 | DL_Init_ColorPicker(DUF_ColorContextOptions_Paladin, DUF_Settings[DUF_INDEX].classcolorPaladin); |
||
272 | DL_Init_ColorPicker(DUF_ColorContextOptions_Priest, DUF_Settings[DUF_INDEX].classcolorPriest); |
||
273 | DL_Init_ColorPicker(DUF_ColorContextOptions_Rogue, DUF_Settings[DUF_INDEX].classcolorRogue); |
||
274 | DL_Init_ColorPicker(DUF_ColorContextOptions_Shaman, DUF_Settings[DUF_INDEX].classcolorShaman); |
||
275 | DL_Init_ColorPicker(DUF_ColorContextOptions_Warlock, DUF_Settings[DUF_INDEX].classcolorWarlock); |
||
276 | DL_Init_ColorPicker(DUF_ColorContextOptions_Warrior, DUF_Settings[DUF_INDEX].classcolorWarrior); |
||
277 | DL_Init_CheckBox(DUF_ColorContextOptions_UseFor0, DUF_Settings[DUF_INDEX].usefor0); |
||
278 | DL_Init_CheckBox(DUF_ColorContextOptions_UseFor1, DUF_Settings[DUF_INDEX].usefor1); |
||
279 | DL_Init_CheckBox(DUF_ColorContextOptions_UseFor2, DUF_Settings[DUF_INDEX].usefor2); |
||
280 | DL_Init_CheckBox(DUF_ColorContextOptions_UseFor3, DUF_Settings[DUF_INDEX].usefor3); |
||
281 | end |
||
282 | |||
283 | function DUF_Init_ComboPointsOptions() |
||
284 | local settings = DUF_Options_GetAllSettings(); |
||
285 | DL_Init_Slider(DUF_ComboPointsOptions_Size, settings.size); |
||
286 | DL_Init_Slider(DUF_ComboPointsOptions_Spacing, settings.spacing); |
||
287 | DL_Init_ColorPicker(DUF_ComboPointsOptions_Color, settings.color); |
||
288 | DL_Init_CheckBox(DUF_ComboPointsOptions_Vertical, settings.vertical); |
||
289 | DL_Init_EditBox(DUF_ComboPointsOptions_CustomTexture, settings.customtexture); |
||
290 | end |
||
291 | |||
292 | function DUF_Init_DebuffOptions() |
||
293 | local settings = DUF_Options_GetAllSettings(); |
||
294 | DL_Init_Slider(DUF_DebuffOptions_Size, settings.size); |
||
295 | DL_Init_Slider(DUF_DebuffOptions_HSpacing, settings.hspacing); |
||
296 | DL_Init_Slider(DUF_DebuffOptions_VSpacing, settings.vspacing); |
||
297 | DL_Init_Slider(DUF_DebuffOptions_Shown, settings.shown); |
||
298 | DL_Init_CheckBox(DUF_DebuffOptions_TwoRows, settings.tworows); |
||
299 | DL_Init_CheckBox(DUF_DebuffOptions_Vertical, settings.vertical); |
||
300 | DL_Init_CheckBox(DUF_DebuffOptions_Flash, settings.flash); |
||
301 | DL_Init_CheckBox(DUF_DebuffOptions_ReverseFill, settings.reverse); |
||
302 | DL_Init_CheckBox(DUF_DebuffOptions_DurationFormat, settings.altformat); |
||
303 | if (DUF_FRAME_INDEX == "player") then |
||
304 | DUF_DebuffOptions_ShowDuration:Show(); |
||
305 | DUF_DebuffOptions_DurationFont:Show(); |
||
306 | DUF_DebuffOptions_DurationXOffset:Show(); |
||
307 | DUF_DebuffOptions_DurationYOffset:Show(); |
||
308 | DUF_DebuffOptions_DurationColor:Show(); |
||
309 | DUF_DebuffOptions_DurationHeight:Show(); |
||
310 | DUF_DebuffOptions_DurationAlpha:Show(); |
||
311 | DUF_DebuffOptions_DurationFormat:Show(); |
||
312 | DL_Init_CheckBox(DUF_DebuffOptions_ShowDuration, settings.showduration); |
||
313 | DL_Init_CheckBox(DUF_DebuffOptions_DurationFormat, settings.altformat); |
||
314 | DL_Init_Slider(DUF_DebuffOptions_DurationXOffset, settings.durationx); |
||
315 | DL_Init_Slider(DUF_DebuffOptions_DurationYOffset, settings.durationy); |
||
316 | DL_Init_Slider(DUF_DebuffOptions_DurationHeight, settings.durationheight); |
||
317 | DL_Init_Slider(DUF_DebuffOptions_DurationAlpha, settings.durationalpha); |
||
318 | DL_Init_EditBox(DUF_DebuffOptions_DurationFont, settings.durationfont); |
||
319 | DL_Init_ColorPicker(DUF_DebuffOptions_DurationColor, settings.durationcolor); |
||
320 | else |
||
321 | DUF_DebuffOptions_ShowDuration:Hide(); |
||
322 | DUF_DebuffOptions_DurationFont:Hide(); |
||
323 | DUF_DebuffOptions_DurationXOffset:Hide(); |
||
324 | DUF_DebuffOptions_DurationYOffset:Hide(); |
||
325 | DUF_DebuffOptions_DurationColor:Hide(); |
||
326 | DUF_DebuffOptions_DurationHeight:Hide(); |
||
327 | DUF_DebuffOptions_DurationAlpha:Hide(); |
||
328 | DUF_DebuffOptions_DurationFormat:Hide(); |
||
329 | end |
||
330 | end |
||
331 | |||
332 | function DUF_Init_Element(unit) |
||
333 | if (DUF_ELEMENT_INDEX == "Buffs") then |
||
334 | DUF_Initialize_Buffs(unit); |
||
335 | elseif (DUF_ELEMENT_INDEX == "ClassIcon") then |
||
336 | DUF_Initialize_ClassIcon(unit); |
||
337 | elseif (DUF_ELEMENT_INDEX == "ComboPoints") then |
||
338 | DUF_Initialize_ComboPoints(); |
||
339 | elseif (DUF_ELEMENT_INDEX == "Debuffs") then |
||
340 | DUF_Initialize_Debuffs(unit); |
||
341 | elseif (DUF_ELEMENT_INDEX == "HappinessIcon") then |
||
342 | DUF_Initialize_HappinessIcon(); |
||
343 | elseif (DUF_ELEMENT_INDEX == "LeaderIcon") then |
||
344 | DUF_Initialize_LeaderIcon(unit); |
||
345 | elseif (DUF_ELEMENT_INDEX == "LootIcon") then |
||
346 | DUF_Initialize_LootIcon(unit); |
||
347 | elseif (DUF_ELEMENT_INDEX == "Portrait") then |
||
348 | DUF_Initialize_Portrait(unit); |
||
349 | elseif (DUF_ELEMENT_INDEX == "PVPIcon") then |
||
350 | DUF_Initialize_PVPIcon(unit); |
||
351 | elseif (DUF_ELEMENT_INDEX == "RaceIcon") then |
||
352 | DUF_Initialize_RaceIcon(unit); |
||
353 | elseif (DUF_ELEMENT_INDEX == "RankIcon") then |
||
354 | DUF_Initialize_RankIcon(unit); |
||
355 | elseif (DUF_ELEMENT_INDEX == "StatusBar") then |
||
356 | DUF_Initialize_StatusBar(unit, DUF_ELEMENT_SUBINDEX); |
||
357 | elseif (DUF_ELEMENT_INDEX == "StatusIcon") then |
||
358 | DUF_Initialize_StatusIcon(unit); |
||
359 | elseif (DUF_ELEMENT_INDEX == "TextBox") then |
||
360 | DUF_Initialize_TextBox(unit, DUF_ELEMENT_SUBINDEX); |
||
361 | elseif (DUF_ELEMENT_INDEX == "EliteTexture") then |
||
362 | DUF_Initialize_EliteTexture(); |
||
363 | end |
||
364 | end |
||
365 | |||
366 | function DUF_Init_EliteTextureOptions() |
||
367 | local settings = DUF_Settings[DUF_INDEX].target.EliteTexture; |
||
368 | DL_Init_Slider(DUF_EliteTextureOptions_Size, settings.size); |
||
369 | DL_Init_CheckBox(DUF_EliteTextureOptions_FacesLeft, settings.faceleft); |
||
370 | DL_Init_EditBox(DUF_EliteTextureOptions_CustomEliteTexture, settings.elitetexture); |
||
371 | DL_Init_EditBox(DUF_EliteTextureOptions_CustomRareTexture, settings.raretexture); |
||
372 | end |
||
373 | |||
374 | function DUF_Init_FrameOptions() |
||
375 | local settings = DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX]; |
||
376 | DL_Init_MenuControl(DUF_FrameOptions_MainColorContext, settings.context); |
||
377 | DL_Init_MenuControl(DUF_FrameOptions_FrameChooser, 1); |
||
378 | DL_Init_MenuControl(DUF_FrameOptions_BackgroundColorContext, settings.bgcontext); |
||
379 | DL_Init_MenuControl(DUF_FrameOptions_BorderColorContext, settings.bordercontext); |
||
380 | DL_Init_MenuControl(DUF_FrameOptions_LeftClick, settings.leftclick); |
||
381 | DL_Init_MenuControl(DUF_FrameOptions_RightClick, settings.rightclick); |
||
382 | DL_Init_MenuControl(DUF_FrameOptions_MiddleClick, settings.middleclick); |
||
383 | DL_Init_CheckBox(DUF_FrameOptions_Hide, settings.hide); |
||
384 | DL_Init_CheckBox(DUF_FrameOptions_DisableMouse, settings.disablemouse); |
||
385 | DL_Init_CheckBox(DUF_FrameOptions_Flash, settings.flash); |
||
386 | DL_Init_CheckBox(DUF_FrameOptions_ShowDefault, settings.showDefault); |
||
387 | DL_Init_ColorPicker(DUF_FrameOptions_MouseoverColor, settings.mouseovercolor); |
||
388 | DL_Init_CheckBox(DUF_FrameOptions_UseMouseoverColor, settings.usemouseovercolor); |
||
389 | DL_Init_MenuControl(DUF_FrameOptions_MouseoverGroup, settings.mouseovergroup); |
||
390 | DL_Init_Slider(DUF_FrameOptions_Height, settings.height); |
||
391 | DL_Init_Slider(DUF_FrameOptions_Width, settings.width); |
||
392 | DL_Init_Slider(DUF_FrameOptions_Scale, settings.scale); |
||
393 | DL_Init_Slider(DUF_FrameOptions_Alpha, settings.alpha); |
||
394 | DL_Init_CheckBox(DUF_FrameOptions_HideBG, settings.hidebg); |
||
395 | DL_Init_ColorPicker(DUF_FrameOptions_BGColor, settings.bgcolor); |
||
396 | DL_Init_Slider(DUF_FrameOptions_BGAlpha, settings.bgalpha); |
||
397 | DL_Init_Slider(DUF_FrameOptions_BGPadding, settings.bgpadding); |
||
398 | DL_Init_ColorPicker(DUF_FrameOptions_BorderColor, settings.bordercolor); |
||
399 | DL_Init_MenuControl(DUF_FrameOptions_BorderStyle, settings.backgroundstyle); |
||
400 | DL_Init_Slider(DUF_FrameOptions_BorderAlpha, settings.borderalpha); |
||
401 | DL_Init_CheckBox(DUF_FrameOptions_DisableTooltip, settings.disabletooltip); |
||
402 | DL_Init_CheckBox(DUF_FrameOptions_UseCustomTooltip, settings.usecustomtooltip); |
||
403 | DL_Init_EditBox(DUF_FrameOptions_CustomTooltip, settings.customtooltip); |
||
404 | DL_Init_EditBox(DUF_FrameOptions_XOffset, settings.xos[1]); |
||
405 | DL_Init_EditBox(DUF_FrameOptions_YOffset, settings.yos[1]); |
||
406 | DL_Init_CheckBox(DUF_FrameOptions_Connect, settings.connect); |
||
407 | DL_Init_MenuControl(DUF_FrameOptions_ConnectMethod, settings.connectmethod); |
||
408 | DL_Init_Slider(DUF_FrameOptions_Spacing, settings.spacing); |
||
409 | end |
||
410 | |||
411 | function DUF_Init_HealthBarOptions() |
||
412 | local settings = DUF_Options_GetAllSettings(); |
||
413 | DL_Init_Slider(DUF_HealthBarOptions_Height, settings.height); |
||
414 | DL_Init_Slider(DUF_HealthBarOptions_Width, settings.width); |
||
415 | DL_Init_ColorPicker(DUF_HealthBarOptions_Color, settings.color); |
||
416 | DL_Init_ColorPicker(DUF_HealthBarOptions_SecondaryColor, settings.color2); |
||
417 | DL_Init_CheckBox(DUF_HealthBarOptions_Fill, settings.fill); |
||
418 | DL_Init_CheckBox(DUF_HealthBarOptions_Fade, settings.fade); |
||
419 | DL_Init_CheckBox(DUF_HealthBarOptions_ResizeMax, settings.resizemax); |
||
420 | DL_Init_CheckBox(DUF_HealthBarOptions_InCombat, settings.incombat); |
||
421 | DL_Init_CheckBox(DUF_HealthBarOptions_HealthUpdating, settings.healthupdating); |
||
422 | DL_Init_CheckBox(DUF_HealthBarOptions_ManaUpdating, settings.manaupdating); |
||
423 | DL_Init_EditBox(DUF_HealthBarOptions_CustomTexture, settings.customtexture); |
||
424 | DL_Init_EditBox(DUF_HealthBarOptions_CustomTexture2, settings.customtexture2); |
||
425 | DL_Init_MenuControl(DUF_HealthBarOptions_Direction, settings.direction); |
||
426 | end |
||
427 | |||
428 | function DUF_Init_IconOptions() |
||
429 | local settings = DUF_Options_GetAllSettings(); |
||
430 | if (DUF_ELEMENT_INDEX == "RaceIcon" or DUF_ELEMENT_INDEX == "RankIcon") then |
||
431 | DUF_IconOptions_TargetIcon:Show() |
||
432 | else |
||
433 | DUF_IconOptions_TargetIcon:Hide() |
||
434 | end |
||
435 | DL_Init_Slider(DUF_IconOptions_Size, settings.size); |
||
436 | DL_Init_CheckBox(DUF_IconOptions_Circle, settings.circle); |
||
437 | DL_Init_CheckBox(DUF_IconOptions_TargetIcon, settings.targetIcon); |
||
438 | end |
||
439 | |||
440 | function DUF_Init_ManaBarOptions() |
||
441 | local settings = DUF_Options_GetAllSettings(); |
||
442 | DL_Init_Slider(DUF_ManaBarOptions_Height, settings.height); |
||
443 | DL_Init_Slider(DUF_ManaBarOptions_Width, settings.width); |
||
444 | DL_Init_ColorPicker(DUF_ManaBarOptions_ManaColor, settings.manacolor); |
||
445 | DL_Init_ColorPicker(DUF_ManaBarOptions_RageColor, settings.ragecolor); |
||
446 | DL_Init_ColorPicker(DUF_ManaBarOptions_FocusColor, settings.focuscolor); |
||
447 | DL_Init_ColorPicker(DUF_ManaBarOptions_EnergyColor, settings.energycolor); |
||
448 | DL_Init_ColorPicker(DUF_ManaBarOptions_SecondaryColor, settings.color2); |
||
449 | DL_Init_CheckBox(DUF_ManaBarOptions_Fill, settings.fill); |
||
450 | DL_Init_CheckBox(DUF_ManaBarOptions_Fade, settings.fade); |
||
451 | DL_Init_CheckBox(DUF_ManaBarOptions_InCombat, settings.incombat); |
||
452 | DL_Init_CheckBox(DUF_ManaBarOptions_HealthUpdating, settings.healthupdating); |
||
453 | DL_Init_CheckBox(DUF_ManaBarOptions_ManaUpdating, settings.manaupdating); |
||
454 | DL_Init_CheckBox(DUF_ManaBarOptions_HideIfNoMana, settings.hideifnomana); |
||
455 | DL_Init_CheckBox(DUF_ManaBarOptions_ResizeMax, settings.resizemax); |
||
456 | DL_Init_EditBox(DUF_ManaBarOptions_CustomTexture, settings.customtexture); |
||
457 | DL_Init_EditBox(DUF_ManaBarOptions_CustomTexture2, settings.customtexture2); |
||
458 | DL_Init_MenuControl(DUF_ManaBarOptions_Direction, settings.direction); |
||
459 | end |
||
460 | |||
461 | function DUF_Init_MiscOptions() |
||
462 | DL_Init_CheckBox(DUF_MiscOptions_HidePartyInRaid, DUF_Settings[DUF_INDEX].hidepartyinraid); |
||
463 | DL_Init_CheckBox(DUF_MiscOptions_HideTargetTarget, DUF_Settings[DUF_INDEX].hidetargettarget); |
||
464 | DL_Init_CheckBox(DUF_MiscOptions_HideBuffFrame, DUF_Settings[DUF_INDEX].hidebuffframe); |
||
465 | DL_Init_Slider(DUF_MiscOptions_UpdateSpeed, DUF_Settings[DUF_INDEX].updatespeedbase); |
||
466 | DL_Init_EditBox(DUF_MiscOptions_LowHealthThreshold, DUF_Settings[DUF_INDEX].flashthreshold); |
||
467 | DL_Init_MenuControl(DUF_MiscOptions_OptionsScale, DUF_Settings[DUF_INDEX].optionscale); |
||
468 | end |
||
469 | |||
470 | function DUF_Init_PortraitOptions() |
||
471 | local settings = DUF_Options_GetAllSettings(); |
||
472 | DL_Init_Slider(DUF_PortraitOptions_Size, settings.size); |
||
473 | DL_Init_CheckBox(DUF_PortraitOptions_UseClassTexture, settings.useclass); |
||
474 | DL_Init_CheckBox(DUF_PortraitOptions_ShowBorder, settings.showborder); |
||
475 | DL_Init_ColorPicker(DUF_PortraitOptions_BorderColor, settings.bordcolor); |
||
476 | end |
||
477 | |||
478 | function DUF_Init_TextBoxOptions() |
||
479 | local settings = DUF_Options_GetAllSettings(); |
||
480 | DL_Init_Slider(DUF_TextBoxOptions_Height, settings.height); |
||
481 | DL_Init_Slider(DUF_TextBoxOptions_Width, settings.width); |
||
482 | DL_Init_EditBox(DUF_TextBoxOptions_Text, settings.text); |
||
483 | DL_Init_EditBox(DUF_TextBoxOptions_Label, settings.label); |
||
484 | DL_Init_EditBox(DUF_TextBoxOptions_MaxCharacters, settings.maxcharacters); |
||
485 | DL_Init_MenuControl(DUF_TextBoxOptions_JustifyH, settings.justify); |
||
486 | DL_Init_MenuControl(DUF_TextBoxOptions_JustifyV, settings.justifyV); |
||
487 | DL_Init_MenuControl(DUF_TextBoxOptions_TextOutline, settings.outline); |
||
488 | DL_Init_EditBox(DUF_TextBoxOptions_Font, settings.font); |
||
489 | DL_Init_ColorPicker(DUF_TextBoxOptions_Color, settings.textcolor); |
||
490 | DL_Init_Slider(DUF_TextBoxOptions_FontHeight, settings.textheight); |
||
491 | DL_Init_CheckBox(DUF_TextBoxOptions_HideIfNoMana, settings.hideifnomana); |
||
492 | DL_Init_CheckBox(DUF_TextBoxOptions_HideIfNoText, settings.hideifnotext); |
||
493 | DL_Init_CheckBox(DUF_TextBoxOptions_InCombat, settings.incombat); |
||
494 | DL_Init_CheckBox(DUF_TextBoxOptions_HealthUpdating, settings.healthupdating); |
||
495 | DL_Init_CheckBox(DUF_TextBoxOptions_ManaUpdating, settings.manaupdating); |
||
496 | DL_Init_CheckBox(DUF_TextBoxOptions_VerticalText, settings.verttext); |
||
497 | end |
||
498 | |||
499 | function DUF_Init_XPBarOptions() |
||
500 | local settings = DUF_Options_GetAllSettings(); |
||
501 | DL_Init_Slider(DUF_XPBarOptions_Height, settings.height); |
||
502 | DL_Init_Slider(DUF_XPBarOptions_Width, settings.width); |
||
503 | DL_Init_ColorPicker(DUF_XPBarOptions_Color, settings.color); |
||
504 | DL_Init_ColorPicker(DUF_XPBarOptions_SecondaryColor, settings.color2); |
||
505 | DL_Init_EditBox(DUF_XPBarOptions_CustomTexture, settings.customtexture); |
||
506 | DL_Init_EditBox(DUF_XPBarOptions_CustomTexture2, settings.customtexture2); |
||
507 | DL_Init_MenuControl(DUF_XPBarOptions_Direction, settings.direction); |
||
508 | DL_Init_CheckBox(DUF_XPBarOptions_Reputation, settings.trackRep); |
||
509 | if (DUF_FRAME_INDEX == "player") then |
||
510 | DUF_XPBarOptions_Reputation:Show() |
||
511 | else |
||
512 | DUF_XPBarOptions_Reputation:Hide() |
||
513 | end |
||
514 | end |
||
515 | |||
516 | function DUF_Menu_OnClick() |
||
517 | getglobal(DUF_DropMenu.controlbox):SetText(getglobal(this:GetName().."_Text"):GetText()); |
||
518 | DUF_DropMenu:Hide(); |
||
519 | if (DUF_DropMenu.index == "attach") then |
||
520 | if (this.value and DUF_FRAME_DATA[DUF_FRAME_INDEX] and getglobal(DUF_FRAME_DATA[DUF_FRAME_INDEX].frame..this.value)) then |
||
521 | local otherindex = getglobal(DUF_FRAME_DATA[DUF_FRAME_INDEX].frame..this.value).index; |
||
522 | local othersubindex = getglobal(DUF_FRAME_DATA[DUF_FRAME_INDEX].frame..this.value).subindex; |
||
523 | local otherattach; |
||
524 | if (othersubindex) then |
||
525 | otherattach = DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][otherindex][othersubindex].attach; |
||
526 | else |
||
527 | otherattach = DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][otherindex].attach; |
||
528 | end |
||
529 | otherattach = DUF_FRAME_DATA[DUF_FRAME_INDEX].frame..otherattach; |
||
530 | local elemext = "_"..DUF_ELEMENT_INDEX; |
||
531 | if (DUF_ELEMENT_SUBINDEX) then |
||
532 | if (DUF_ELEMENT_INDEX == "StatusBar") then |
||
533 | elemext = DUF_STATUSBARS[DUF_ELEMENT_SUBINDEX]; |
||
534 | elseif (DUF_ELEMENT_INDEX == "TextBox") then |
||
535 | elemext = "_TextBox_"..DUF_ELEMENT_SUBINDEX; |
||
536 | end |
||
537 | end |
||
538 | local element = DUF_FRAME_DATA[DUF_FRAME_INDEX].frame..elemext; |
||
539 | if (element == otherattach ) then |
||
540 | DL_Debug("That element is already attached to this element. Cross-attaching the elements will crash WoW. Attach option not applied."); |
||
541 | return; |
||
542 | end |
||
543 | end |
||
544 | end |
||
545 | if (DUF_DropMenu.index) then |
||
546 | DUF_Update_Setting(this.value, DUF_DropMenu.index); |
||
547 | end |
||
548 | DUF_Run_Functions(DUF_DropMenu.initFunc); |
||
549 | end |
||
550 | |||
551 | function DUF_Nudge_Down(button) |
||
552 | local yoffset = DUF_Options_GetSetting("yoffset"); |
||
553 | if (button == "RightButton") then |
||
554 | yoffset = yoffset - 10; |
||
555 | elseif (this.moving) then |
||
556 | yoffset = yoffset - 3; |
||
557 | else |
||
558 | yoffset = yoffset - 1; |
||
559 | end |
||
560 | DUF_ElementOptions_Base_YOffset:SetText(yoffset); |
||
561 | DUF_Update_Setting(yoffset, "yoffset"); |
||
562 | DUF_Run_Functions(); |
||
563 | end |
||
564 | |||
565 | function DUF_Nudge_Left(button) |
||
566 | local xoffset = DUF_Options_GetSetting("xoffset"); |
||
567 | if (button == "RightButton") then |
||
568 | xoffset = xoffset - 10; |
||
569 | elseif (this.moving) then |
||
570 | xoffset = xoffset - 3; |
||
571 | else |
||
572 | xoffset = xoffset - 1; |
||
573 | end |
||
574 | DUF_ElementOptions_Base_XOffset:SetText(xoffset); |
||
575 | DUF_Update_Setting(xoffset, "xoffset"); |
||
576 | DUF_Run_Functions(); |
||
577 | end |
||
578 | |||
579 | function DUF_Nudge_OnUpdate(elapsed) |
||
580 | if (not this.timer) then |
||
581 | this.timer = .05; |
||
582 | end |
||
583 | this.timer = this.timer - elapsed; |
||
584 | if (this.timer < 0) then |
||
585 | this.timer = .05; |
||
586 | if (this.moving) then |
||
587 | this.func(); |
||
588 | end |
||
589 | end |
||
590 | end |
||
591 | |||
592 | function DUF_Nudge_Right(button) |
||
593 | local xoffset = DUF_Options_GetSetting("xoffset"); |
||
594 | if (button == "RightButton") then |
||
595 | xoffset = xoffset + 10; |
||
596 | elseif (this.moving) then |
||
597 | xoffset = xoffset + 3; |
||
598 | else |
||
599 | xoffset = xoffset + 1; |
||
600 | end |
||
601 | DUF_ElementOptions_Base_XOffset:SetText(xoffset); |
||
602 | DUF_Update_Setting(xoffset, "xoffset"); |
||
603 | DUF_Run_Functions(); |
||
604 | end |
||
605 | |||
606 | function DUF_Nudge_Up(button) |
||
607 | local yoffset = DUF_Options_GetSetting("yoffset"); |
||
608 | if (button == "RightButton") then |
||
609 | yoffset = yoffset + 10; |
||
610 | elseif (this.moving) then |
||
611 | yoffset = yoffset + 3; |
||
612 | else |
||
613 | yoffset = yoffset + 1; |
||
614 | end |
||
615 | DUF_ElementOptions_Base_YOffset:SetText(yoffset); |
||
616 | DUF_Update_Setting(yoffset, "yoffset"); |
||
617 | DUF_Run_Functions(); |
||
618 | end |
||
619 | |||
620 | function DUF_UnitFrame_Nudge_Up(button) |
||
621 | local index = tonumber(DUF_FrameOptions_FrameChooser_Setting:GetText()) |
||
622 | local yoffset = DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].yos[index] |
||
623 | if (button == "RightButton") then |
||
624 | yoffset = yoffset + 10; |
||
625 | elseif (this.moving) then |
||
626 | yoffset = yoffset + 3; |
||
627 | else |
||
628 | yoffset = yoffset + 1; |
||
629 | end |
||
630 | DUF_FrameOptions_YOffset:SetText(yoffset); |
||
631 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].yos[index] = yoffset |
||
632 | if (string.find(DUF_FRAME_INDEX, "party")) then |
||
633 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX..index) |
||
634 | else |
||
635 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX) |
||
636 | end |
||
637 | end |
||
638 | |||
639 | function DUF_UnitFrame_Nudge_Down(button) |
||
640 | local index = tonumber(DUF_FrameOptions_FrameChooser_Setting:GetText()) |
||
641 | local yoffset = DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].yos[index] |
||
642 | if (button == "RightButton") then |
||
643 | yoffset = yoffset - 10; |
||
644 | elseif (this.moving) then |
||
645 | yoffset = yoffset - 3; |
||
646 | else |
||
647 | yoffset = yoffset - 1; |
||
648 | end |
||
649 | DUF_FrameOptions_YOffset:SetText(yoffset); |
||
650 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].yos[index] = yoffset |
||
651 | if (string.find(DUF_FRAME_INDEX, "party")) then |
||
652 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX..index) |
||
653 | else |
||
654 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX) |
||
655 | end |
||
656 | end |
||
657 | |||
658 | function DUF_UnitFrame_Nudge_Left(button) |
||
659 | local index = tonumber(DUF_FrameOptions_FrameChooser_Setting:GetText()) |
||
660 | local xoffset = DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].xos[index] |
||
661 | if (button == "RightButton") then |
||
662 | xoffset = xoffset - 10; |
||
663 | elseif (this.moving) then |
||
664 | xoffset = xoffset - 3; |
||
665 | else |
||
666 | xoffset = xoffset - 1; |
||
667 | end |
||
668 | DUF_FrameOptions_XOffset:SetText(xoffset); |
||
669 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].xos[index] = xoffset |
||
670 | if (string.find(DUF_FRAME_INDEX, "party")) then |
||
671 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX..index) |
||
672 | else |
||
673 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX) |
||
674 | end |
||
675 | end |
||
676 | |||
677 | function DUF_UnitFrame_Nudge_Right(button) |
||
678 | local index = tonumber(DUF_FrameOptions_FrameChooser_Setting:GetText()) |
||
679 | local xoffset = DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].xos[index] |
||
680 | if (button == "RightButton") then |
||
681 | xoffset = xoffset + 10; |
||
682 | elseif (this.moving) then |
||
683 | xoffset = xoffset + 3; |
||
684 | else |
||
685 | xoffset = xoffset + 1; |
||
686 | end |
||
687 | DUF_FrameOptions_XOffset:SetText(xoffset); |
||
688 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].xos[index] = xoffset |
||
689 | if (string.find(DUF_FRAME_INDEX, "party")) then |
||
690 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX..index) |
||
691 | else |
||
692 | DUF_Initialize_FrameLoc(DUF_FRAME_INDEX) |
||
693 | end |
||
694 | end |
||
695 | |||
696 | function DUF_Options_UpdateFrameLoc() |
||
697 | local index = tonumber(DUF_FrameOptions_FrameChooser_Setting:GetText()) |
||
698 | local yoffset = DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].yos[index] |
||
699 | local xoffset = DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].xos[index] |
||
700 | DUF_FrameOptions_YOffset:SetText(yoffset) |
||
701 | DUF_FrameOptions_XOffset:SetText(xoffset) |
||
702 | end |
||
703 | |||
704 | function DUF_Options_DeleteSettings(index) |
||
705 | if (not index) then |
||
706 | index = DUF_LOADINDEX; |
||
707 | end |
||
708 | if (index == "" or (not index)) then |
||
709 | return; |
||
710 | end |
||
711 | if (index == DUF_INDEX) then |
||
712 | DL_Error("You cannot delete the profile you're currently using."); |
||
713 | return; |
||
714 | end |
||
715 | if (not DUF_Settings[index]) then |
||
716 | DL_Feedback(DUF_TEXT.NoSettingsFound); |
||
717 | return; |
||
718 | end |
||
719 | DUF_Settings[index] = nil; |
||
720 | DUF_Update_SavedSettings(); |
||
721 | DUF_MiscOptions_LoadSettings_Setting:SetText(""); |
||
722 | DL_Feedback(DUF_TEXT.SettingsDeleted); |
||
723 | end |
||
724 | |||
725 | function DUF_Options_FrameLevelMinus() |
||
726 | local level = DUF_Options_GetSetting("framelevel"); |
||
727 | level = level - 1; |
||
728 | DUF_Update_Setting(level, "framelevel"); |
||
729 | DL_Init_EditBox(DUF_ElementOptions_Base_FrameLevel, level); |
||
730 | DUF_Run_Functions(DUF_ElementOptions_Base_FrameLevel.initFunc); |
||
731 | end |
||
732 | |||
733 | function DUF_Options_FrameLevelPlus() |
||
734 | local level = DUF_Options_GetSetting("framelevel"); |
||
735 | level = level + 1; |
||
736 | DUF_Update_Setting(level, "framelevel"); |
||
737 | DL_Init_EditBox(DUF_ElementOptions_Base_FrameLevel, level); |
||
738 | DUF_Run_Functions(DUF_ElementOptions_Base_FrameLevel.initFunc); |
||
739 | end |
||
740 | |||
741 | function DUF_Options_GetAllSettings() |
||
742 | if (DUF_ELEMENT_SUBINDEX) then |
||
743 | return DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][DUF_ELEMENT_INDEX][DUF_ELEMENT_SUBINDEX]; |
||
744 | elseif (DUF_ELEMENT_INDEX) then |
||
745 | return DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][DUF_ELEMENT_INDEX]; |
||
746 | else |
||
747 | return DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX]; |
||
748 | end |
||
749 | end |
||
750 | |||
751 | function DUF_Options_GetSetting(index) |
||
752 | if (not DUF_FRAME_INDEX) then |
||
753 | return DUF_Settings[DUF_INDEX][index]; |
||
754 | end |
||
755 | if (DUF_ELEMENT_SUBINDEX) then |
||
756 | return DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][DUF_ELEMENT_INDEX][DUF_ELEMENT_SUBINDEX][index]; |
||
757 | elseif (DUF_ELEMENT_INDEX) then |
||
758 | return DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][DUF_ELEMENT_INDEX][index]; |
||
759 | else |
||
760 | return DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][index]; |
||
761 | end |
||
762 | end |
||
763 | |||
764 | function DUF_Options_OnHide() |
||
765 | DUF_OPTIONS_VISIBLE = nil; |
||
766 | DUF_Initialize_AllFrames(); |
||
767 | DUF_Main_UpdatePartyMembers(); |
||
768 | DUF_TargetFrame:Hide(); |
||
769 | DUF_TargetOfTargetFrame:Hide(); |
||
770 | if (UnitName("target")) then |
||
771 | if (not DUF_Settings[DUF_INDEX].target.hide) then |
||
772 | DUF_TargetFrame:Show(); |
||
773 | end |
||
774 | if (UnitName("targettarget") and (not DUF_Settings[DUF_INDEX].targettarget.hide)) then |
||
775 | DUF_TargetOfTargetFrame:Show(); |
||
776 | end |
||
777 | end |
||
778 | DUF_PetFrame:Hide(); |
||
779 | if (UnitName("pet") and (not DUF_Settings[DUF_INDEX].pet.hide)) then |
||
780 | DUF_PetFrame:Show(); |
||
781 | end |
||
782 | if (DUF_Settings[DUF_INDEX].autolock) then |
||
783 | if (DUF_FRAMES_UNLOCKED) then |
||
784 | DUF_Toggle_FramesLock(); |
||
785 | end |
||
786 | if (DUF_ELEMENTS_UNLOCKED) then |
||
787 | DUF_Toggle_ElementsLock(); |
||
788 | end |
||
789 | end |
||
790 | end |
||
791 | |||
792 | function DUF_Options_OnShow() |
||
793 | if (not DUF_INITIALIZED) then return; end |
||
794 | DUF_OPTIONS_VISIBLE = true; |
||
795 | DUF_Initialize_AllFrames(); |
||
796 | for unit, value in DUF_FRAME_DATA do |
||
797 | if (not DUF_Settings[DUF_INDEX][value.index].hide) then |
||
798 | getglobal(value.frame):Show(); |
||
799 | end |
||
800 | end |
||
801 | end |
||
802 | |||
803 | function DUF_Options_OnUpdate() |
||
804 | if (not DUF_INITIALIZED) then return; end |
||
805 | if (not this.scale) then |
||
806 | this.scale = this:GetScale(); |
||
807 | end |
||
808 | if (this.scale ~= this:GetScale()) then |
||
809 | DUF_Options:SetScale(DUF_Settings[DUF_INDEX].optionscale); |
||
810 | this.scale = this:GetScale(); |
||
811 | end |
||
812 | end |
||
813 | |||
814 | function DUF_Options_ResetIndices() |
||
815 | if (DUF_OLD_ELEM_SUBINDEX) then |
||
816 | DUF_ELEMENT_SUBINDEX = DUF_OLD_ELEM_SUBINDEX; |
||
817 | DUF_OLD_ELEM_SUBINDEX = nil; |
||
818 | end |
||
819 | if (DUF_OLD_ELEM_INDEX) then |
||
820 | DUF_ELEMENT_INDEX = DUF_OLD_ELEM_INDEX; |
||
821 | DUF_OLD_ELEM_INDEX = nil; |
||
822 | end |
||
823 | if (DUF_OLD_FRAME_INDEX) then |
||
824 | DUF_FRAME_INDEX = DUF_OLD_FRAME_INDEX; |
||
825 | DUF_OLD_FRAME_INDEX = nil; |
||
826 | end |
||
827 | end |
||
828 | |||
829 | function DUF_Options_SaveSettings(index) |
||
830 | if (not index) then |
||
831 | index = DUF_MiscOptions_SaveSettings:GetText(); |
||
832 | end |
||
833 | DUF_MiscOptions_SaveSettings:ClearFocus(); |
||
834 | DUF_MiscOptions_SaveSettings:SetText(""); |
||
835 | if (index == "" or (not index)) then |
||
836 | return; |
||
837 | end |
||
838 | if (DUF_Settings[index]) then |
||
839 | DL_Error("You are attempting to create a new profile using the same name as an existing profile. You must delete the existing profile first."); |
||
840 | return; |
||
841 | end |
||
842 | DUF_Settings[index] = {}; |
||
843 | DL_Copy_Table(DUF_Settings[DUF_INDEX], DUF_Settings[index]); |
||
844 | DUF_INDEX = index; |
||
845 | DUF_Settings[DUF_PLAYER_INDEX] = index; |
||
846 | DUF_Update_SavedSettings(); |
||
847 | DL_Feedback(DUF_TEXT.ProfileCreated); |
||
848 | end |
||
849 | |||
850 | function DUF_Options_SelectFrameOptions() |
||
851 | DUF_Options_ResetIndices(); |
||
852 | DUF_MiscOptions:Hide(); |
||
853 | DUF_ColorContextOptions:Hide(); |
||
854 | DUF_ElementOptions:Hide(); |
||
855 | if (DUF_ELEMENT_SELECTED) then |
||
856 | local button = getglobal(DUF_ELEMENT_SELECTED); |
||
857 | button:SetTextColor(1, 1, 0); |
||
858 | button:SetBackdropColor(0, 0, 0); |
||
859 | button:SetBackdropBorderColor(.8, 0, 0); |
||
860 | end |
||
861 | DUF_ELEMENT_INDEX = nil; |
||
862 | DUF_ELEMENT_SUBINDEX = nil; |
||
863 | DUF_ELEMENT_SELECTED = "DUF_Options_FrameOptions"; |
||
864 | DUF_Options_FrameOptions:SetTextColor(1, 0, 0); |
||
865 | DUF_Options_FrameOptions:SetBackdropColor(1, 1, 0); |
||
866 | DUF_Options_FrameOptions:SetBackdropBorderColor(1, 1, 1); |
||
867 | end |
||
868 | |||
869 | function DUF_Options_SetLoadIndex() |
||
870 | DUF_LOADINDEX = DUF_MiscOptions_LoadSettings_Setting:GetText(); |
||
871 | end |
||
872 | |||
873 | function DUF_Options_SetOldIndices() |
||
874 | if (not DUF_OLD_ELEM_INDEX) then |
||
875 | DUF_OLD_ELEM_INDEX = DUF_ELEMENT_INDEX; |
||
876 | end |
||
877 | DUF_ELEMENT_INDEX = nil; |
||
878 | if (not DUF_OLD_ELEM_SUBINDEX) then |
||
879 | DUF_OLD_ELEM_SUBINDEX = DUF_ELEMENT_SUBINDEX; |
||
880 | end |
||
881 | DUF_ELEMENT_SUBINDEX = nil; |
||
882 | if (not DUF_OLD_FRAME_INDEX) then |
||
883 | DUF_OLD_FRAME_INDEX = DUF_FRAME_INDEX; |
||
884 | end |
||
885 | DUF_FRAME_INDEX = nil; |
||
886 | end |
||
887 | |||
888 | function DUF_Options_SetScale() |
||
889 | DUF_Options:SetScale(DUF_Settings[DUF_INDEX].optionscale); |
||
890 | DUF_Options.scale = DUF_Options:GetScale(); |
||
891 | DUF_Options:ClearAllPoints(); |
||
892 | DUF_Options:SetPoint("CENTER", "UIParent", "CENTER", 0, 0); |
||
893 | end |
||
894 | |||
895 | function DUF_OptionsSelect_OnClick() |
||
896 | if (DUF_OPTIONS_SELECTED) then |
||
897 | local button = getglobal(DUF_OPTIONS_SELECTED); |
||
898 | button:SetTextColor(1, 1, 0); |
||
899 | button:SetBackdropColor(0, 0, 0); |
||
900 | button:SetBackdropBorderColor(.8, 0, 0); |
||
901 | end |
||
902 | DUF_OPTIONS_SELECTED = this:GetName(); |
||
903 | this:SetTextColor(1, 0, 0); |
||
904 | this:SetBackdropColor(1, 1, 0); |
||
905 | this:SetBackdropBorderColor(1, 1, 1); |
||
906 | end |
||
907 | |||
908 | function DUF_Run_Functions(initFunc) |
||
909 | if (not DUF_INITIALIZED) then return; end |
||
910 | if (not initFunc) then |
||
911 | initFunc = this:GetParent().initFunc; |
||
912 | end |
||
913 | if (not initFunc) then |
||
914 | initFunc = this.initFunc; |
||
915 | end |
||
916 | if (initFunc) then |
||
917 | if (DUF_INIT_FRAMES) then |
||
918 | for _,unit in DUF_INIT_FRAMES do |
||
919 | initFunc(unit, DUF_ELEMENT_SUBINDEX); |
||
920 | end |
||
921 | else |
||
922 | initFunc(); |
||
923 | end |
||
924 | end |
||
925 | end |
||
926 | |||
927 | function DUF_SelectButton_OnLoad() |
||
928 | this:SetTextColor(1, 1, 0); |
||
929 | this:SetBackdropColor(0, 0, 0); |
||
930 | this:SetBackdropBorderColor(.8, 0, 0); |
||
931 | end |
||
932 | |||
933 | function DUF_SelectElement_OnClick(index, subindex) |
||
934 | DUF_Options_ResetIndices(); |
||
935 | DUF_MiscOptions:Hide(); |
||
936 | DUF_ColorContextOptions:Hide(); |
||
937 | if (DUF_ELEMENT_SELECTED) then |
||
938 | local button = getglobal(DUF_ELEMENT_SELECTED); |
||
939 | button:SetTextColor(1, 1, 0); |
||
940 | button:SetBackdropColor(0, 0, 0); |
||
941 | button:SetBackdropBorderColor(.8, 0, 0); |
||
942 | end |
||
943 | DUF_ELEMENT_SELECTED = this:GetName(); |
||
944 | this:SetTextColor(1, 0, 0); |
||
945 | this:SetBackdropColor(1, 1, 0); |
||
946 | this:SetBackdropBorderColor(1, 1, 1); |
||
947 | DUF_ELEMENT_INDEX = index; |
||
948 | DUF_ELEMENT_SUBINDEX = subindex; |
||
949 | if (DUF_ELEMENT_INDEX) then |
||
950 | DUF_ElementOptions:Show(); |
||
951 | DUF_FrameOptions:Hide(); |
||
952 | DUF_Init_BaseOptions(); |
||
953 | DUF_Show_SpecialOptions(); |
||
954 | else |
||
955 | DUF_ElementOptions:Hide(); |
||
956 | DUF_FrameOptions:Show(); |
||
957 | DUF_Init_FrameOptions(); |
||
958 | end |
||
959 | end |
||
960 | |||
961 | function DUF_SelectFrame_OnClick(index, bttn) |
||
962 | if (not bttn) then |
||
963 | bttn = this |
||
964 | end |
||
965 | DUF_Options_ResetIndices(); |
||
966 | DUF_MiscOptions:Hide(); |
||
967 | DUF_ColorContextOptions:Hide(); |
||
968 | if (DUF_FRAME_SELECTED) then |
||
969 | local button = getglobal(DUF_FRAME_SELECTED); |
||
970 | button:SetTextColor(1, 1, 0); |
||
971 | button:SetBackdropColor(0, 0, 0); |
||
972 | button:SetBackdropBorderColor(.8, 0, 0); |
||
973 | end |
||
974 | DUF_FRAME_SELECTED = bttn:GetName(); |
||
975 | bttn:SetTextColor(1, 0, 0); |
||
976 | bttn:SetBackdropColor(1, 1, 0); |
||
977 | bttn:SetBackdropBorderColor(1, 1, 1); |
||
978 | DUF_FRAME_INDEX = index; |
||
979 | DUF_INIT_FRAMES = { index }; |
||
980 | DUF_Options_ComboPoints:Hide(); |
||
981 | DUF_Options_XPBar:Hide(); |
||
982 | DUF_Options_HappinessIcon:Hide(); |
||
983 | DUF_Options_HonorBar:Hide(); |
||
984 | DUF_Options_EliteTexture:Hide(); |
||
985 | DUF_MiscOptions:Hide(); |
||
986 | DUF_ColorContextOptions:Hide(); |
||
987 | if (index == "party") then |
||
988 | DUF_INIT_FRAMES = { "party1", "party2", "party3", "party4" }; |
||
989 | elseif (index == "partypet") then |
||
990 | DUF_INIT_FRAMES = { "partypet1", "partypet2", "partypet3", "partypet4" }; |
||
991 | elseif (index == "player") then |
||
992 | DUF_Options_XPBar:Show(); |
||
993 | DUF_Options_HonorBar:Show(); |
||
994 | elseif (index == "pet") then |
||
995 | DUF_Options_XPBar:Show(); |
||
996 | DUF_Options_HappinessIcon:Show(); |
||
997 | elseif (index == "target") then |
||
998 | DUF_Options_ComboPoints:Show(); |
||
999 | DUF_Options_EliteTexture:Show(); |
||
1000 | end |
||
1001 | if (index == "party" or index == "partypet") then |
||
1002 | DUF_FRAME_CHOICES = { |
||
1003 | {value = 1, text = 1}, |
||
1004 | {value = 2, text = 2}, |
||
1005 | {value = 3, text = 3}, |
||
1006 | {value = 4, text = 4} |
||
1007 | } |
||
1008 | else |
||
1009 | DUF_FRAME_CHOICES = { |
||
1010 | {value = 1, text = 1} |
||
1011 | } |
||
1012 | end |
||
1013 | if (DUF_ELEMENT_INDEX == "StatusBar" and DUF_ELEMENT_SUBINDEX == 3 and DUF_FRAME_INDEX ~= "player" and DUF_FRAME_INDEX ~= "pet") then |
||
1014 | DUF_Options_SelectFrameOptions(); |
||
1015 | elseif (DUF_ELEMENT_INDEX == "StatusBar" and DUF_ELEMENT_SUBINDEX == 6 and DUF_FRAME_INDEX ~= "player") then |
||
1016 | DUF_Options_SelectFrameOptions(); |
||
1017 | elseif (DUF_ELEMENT_INDEX == "HappinessIcon" and DUF_FRAME_INDEX ~= "pet") then |
||
1018 | DUF_Options_SelectFrameOptions(); |
||
1019 | elseif (DUF_ELEMENT_INDEX == "ComboPoints" and DUF_FRAME_INDEX ~= "target") then |
||
1020 | DUF_Options_SelectFrameOptions(); |
||
1021 | elseif (DUF_ELEMENT_INDEX == "EliteTexture" and DUF_FRAME_INDEX ~= "target") then |
||
1022 | DUF_Options_SelectFrameOptions(); |
||
1023 | end |
||
1024 | DUF_Show_SpecialOptions(); |
||
1025 | if (DUF_ELEMENT_INDEX) then |
||
1026 | DUF_Init_BaseOptions(); |
||
1027 | else |
||
1028 | DUF_Init_FrameOptions(); |
||
1029 | end |
||
1030 | for i = 1,10 do |
||
1031 | getglobal("DUF_Options_TextBox"..i):SetText("["..i.."] "..DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX].TextBox[i].label); |
||
1032 | end |
||
1033 | end |
||
1034 | |||
1035 | function DUF_SetCopyFrame() |
||
1036 | DUF_FrameOptions_CopyButton.index = this.value; |
||
1037 | DUF_FrameOptions_SafeCopyButton.index = this.value; |
||
1038 | end |
||
1039 | |||
1040 | function DUF_Show_ContextColors() |
||
1041 | DUF_MiscOptions:Hide(); |
||
1042 | DUF_ColorContextOptions:Show(); |
||
1043 | DUF_ElementOptions:Hide(); |
||
1044 | DUF_FrameOptions:Hide(); |
||
1045 | DUF_Options_SetOldIndices(); |
||
1046 | end |
||
1047 | |||
1048 | function DUF_Show_MiscOptions() |
||
1049 | DUF_MiscOptions:Show(); |
||
1050 | DUF_ColorContextOptions:Hide(); |
||
1051 | DUF_ElementOptions:Hide(); |
||
1052 | DUF_FrameOptions:Hide(); |
||
1053 | DUF_Options_SetOldIndices(); |
||
1054 | end |
||
1055 | |||
1056 | function DUF_Show_SpecialOptions() |
||
1057 | if (DUF_SPECIAL_OPTIONS) then |
||
1058 | getglobal(DUF_SPECIAL_OPTIONS):Hide(); |
||
1059 | end |
||
1060 | if (DUF_ELEMENT_INDEX == "StatusBar") then |
||
1061 | if (DUF_ELEMENT_SUBINDEX == 1 or DUF_ELEMENT_SUBINDEX == 4) then |
||
1062 | DUF_SPECIAL_OPTIONS = "DUF_HealthBarOptions"; |
||
1063 | DUF_Init_HealthBarOptions(); |
||
1064 | elseif (DUF_ELEMENT_SUBINDEX == 2 or DUF_ELEMENT_SUBINDEX == 5) then |
||
1065 | DUF_SPECIAL_OPTIONS = "DUF_ManaBarOptions"; |
||
1066 | DUF_Init_ManaBarOptions(); |
||
1067 | else |
||
1068 | DUF_SPECIAL_OPTIONS = "DUF_XPBarOptions"; |
||
1069 | DUF_Init_XPBarOptions(); |
||
1070 | end |
||
1071 | elseif (DUF_ELEMENT_INDEX == "StatusIcon" or DUF_ELEMENT_INDEX == "RankIcon" or DUF_ELEMENT_INDEX == "RaceIcon" or DUF_ELEMENT_INDEX == "PVPIcon" or DUF_ELEMENT_INDEX == "LootIcon" or DUF_ELEMENT_INDEX == "LeaderIcon" or DUF_ELEMENT_INDEX == "HappinessIcon") then |
||
1072 | DUF_SPECIAL_OPTIONS = "DUF_IconOptions"; |
||
1073 | DUF_Init_IconOptions(); |
||
1074 | elseif (DUF_ELEMENT_INDEX == "Portrait") then |
||
1075 | DUF_SPECIAL_OPTIONS = "DUF_PortraitOptions"; |
||
1076 | DUF_Init_PortraitOptions(); |
||
1077 | elseif (DUF_ELEMENT_INDEX == "ClassIcon") then |
||
1078 | DUF_SPECIAL_OPTIONS = "DUF_ClassIconOptions"; |
||
1079 | DUF_Init_ClassIconOptions(); |
||
1080 | elseif (DUF_ELEMENT_INDEX == "TextBox") then |
||
1081 | DUF_SPECIAL_OPTIONS = "DUF_TextBoxOptions"; |
||
1082 | DUF_Init_TextBoxOptions(); |
||
1083 | elseif (DUF_ELEMENT_INDEX == "ComboPoints") then |
||
1084 | DUF_SPECIAL_OPTIONS = "DUF_ComboPointsOptions"; |
||
1085 | DUF_Init_ComboPointsOptions(); |
||
1086 | elseif (DUF_ELEMENT_INDEX == "Buffs") then |
||
1087 | DUF_SPECIAL_OPTIONS = "DUF_BuffOptions"; |
||
1088 | DUF_Init_BuffOptions(); |
||
1089 | elseif (DUF_ELEMENT_INDEX == "Debuffs") then |
||
1090 | DUF_SPECIAL_OPTIONS = "DUF_DebuffOptions"; |
||
1091 | DUF_Init_DebuffOptions(); |
||
1092 | elseif (DUF_ELEMENT_INDEX == "EliteTexture") then |
||
1093 | DUF_SPECIAL_OPTIONS = "DUF_EliteTextureOptions"; |
||
1094 | DUF_Init_EliteTextureOptions(); |
||
1095 | elseif (not DUF_ELEMENT_INDEX) then |
||
1096 | DUF_SPECIAL_OPTIONS = "DUF_FrameOptions"; |
||
1097 | DUF_FrameOptions:Show(); |
||
1098 | DUF_Init_FrameOptions(); |
||
1099 | end |
||
1100 | if (DUF_OPTIONS_SELECTED == "DUF_ElementOptions_SpecialSelect") then |
||
1101 | getglobal(DUF_SPECIAL_OPTIONS):Show(); |
||
1102 | end |
||
1103 | end |
||
1104 | |||
1105 | function DUF_Slider_Update() |
||
1106 | if (not DUF_INITIALIZED) then return; end |
||
1107 | local setting = DUF_Options_GetSetting(this.index); |
||
1108 | if (this.scale) then |
||
1109 | setting = setting * this.scale; |
||
1110 | end |
||
1111 | local min, max = this:GetMinMaxValues(); |
||
1112 | if (setting and (setting < min or setting > max)) then |
||
1113 | return; |
||
1114 | end |
||
1115 | local value = this:GetValue(); |
||
1116 | getglobal(this:GetName().."_Display"):SetText(value); |
||
1117 | if (this.scale) then |
||
1118 | value = value / this.scale; |
||
1119 | end |
||
1120 | DUF_Update_Setting(value, this.index, this.subindex); |
||
1121 | DUF_Run_Functions(); |
||
1122 | end |
||
1123 | |||
1124 | function DUF_Slider_UpdateFromEditBox() |
||
1125 | if (DUF_NOSLIDEREDIT) then return; end |
||
1126 | local value = this:GetNumber(); |
||
1127 | if (not value) then value = 0; end |
||
1128 | local min, max = this:GetParent():GetMinMaxValues(); |
||
1129 | if (this:GetParent().minlocked and value < min) then value = min; end |
||
1130 | if (this:GetParent().maxlocked and value > max) then value = max; end |
||
1131 | this:SetText(value); |
||
1132 | if (value >= min and value <= max) then |
||
1133 | this:GetParent():SetValue(value); |
||
1134 | end |
||
1135 | this:ClearFocus(); |
||
1136 | if (this:GetParent().scale) then |
||
1137 | value = value / this:GetParent().scale; |
||
1138 | end |
||
1139 | DUF_Update_Setting(value, this:GetParent().index, this:GetParent().subindex); |
||
1140 | if (this:GetParent().initFunc) then |
||
1141 | DUF_Run_Functions(this:GetParent().initFunc); |
||
1142 | else |
||
1143 | DUF_Run_Functions(this:GetParent():GetParent().initFunc); |
||
1144 | end |
||
1145 | end |
||
1146 | |||
1147 | function DUF_Update_SavedSettings() |
||
1148 | DUF_SAVED_SETTINGS = {}; |
||
1149 | for setting in DUF_Settings do |
||
1150 | if ((not string.find(setting, "INITIALIZED")) and (not string.find(setting, " :: "))) then |
||
1151 | DUF_SAVED_SETTINGS[setting] = { text=setting, value=setting }; |
||
1152 | end |
||
1153 | end |
||
1154 | DUF_MiscOptions_CurrentProfile:SetText(DUF_TEXT.CurrentProfile..": "..DUF_INDEX); |
||
1155 | end |
||
1156 | |||
1157 | function DUF_Update_Setting(value, index, subindex) |
||
1158 | if (not index) then |
||
1159 | return; |
||
1160 | end |
||
1161 | if (not DUF_FRAME_INDEX) then |
||
1162 | if (subindex) then |
||
1163 | DUF_Settings[DUF_INDEX][index][subindex] = value; |
||
1164 | else |
||
1165 | DUF_Settings[DUF_INDEX][index] = value; |
||
1166 | end |
||
1167 | else |
||
1168 | if (DUF_ELEMENT_SUBINDEX) then |
||
1169 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][DUF_ELEMENT_INDEX][DUF_ELEMENT_SUBINDEX][index] = value; |
||
1170 | elseif (DUF_ELEMENT_INDEX) then |
||
1171 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][DUF_ELEMENT_INDEX][index] = value; |
||
1172 | else |
||
1173 | DUF_Settings[DUF_INDEX][DUF_FRAME_INDEX][index] = value; |
||
1174 | end |
||
1175 | end |
||
1176 | end |