vanilla-wow-addons – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | --[[ |
2 | |||
3 | TipBuddy: --------- |
||
4 | copyright 2005 by Chester |
||
5 | |||
6 | ]] |
||
7 | |||
8 | -------------------------------------------------------------------------------------------------------------------------------------- |
||
9 | -- OPTIONS FRAME |
||
10 | -------------------------------------------------------------------------------------------------------------------------------------- |
||
11 | function TipBuddy_ToggleOptionsFrame() |
||
12 | if ( TipBuddy_OptionsFrame:IsVisible() ) then |
||
13 | HideUIPanel(TipBuddy_OptionsFrame); |
||
14 | PlaySound("gsTitleOptionExit"); |
||
15 | -- Check if the options frame was opened by myAddOns |
||
16 | --[[ if (MYADDONS_ACTIVE_OPTIONSFRAME == this) then |
||
17 | ShowUIPanel(myAddOnsFrame); |
||
18 | else |
||
19 | ShowUIPanel(GameMenuFrame); |
||
20 | end]] |
||
21 | else |
||
22 | TipBuddy_OptionsFrame_UpdateCheckboxes(); |
||
23 | TipBuddy_OptionsFrame_UpdateSliders(); |
||
24 | TipBuddy_OptionsFrame_UpdateColorButtons(); |
||
25 | TipBuddy_OptionsFrame_UpdateColorButtons_Text(); |
||
26 | TipBuddy_OptionsFrame_UpdateEditBoxes(); |
||
27 | |||
28 | TipBuddy_Background_ColorPick_OnLoad(); |
||
29 | |||
30 | HideUIPanel(GameMenuFrame); |
||
31 | ShowUIPanel(TipBuddy_OptionsFrame); |
||
32 | PlaySound("igMainMenuQuit"); |
||
33 | end |
||
34 | end |
||
35 | |||
36 | function TipBuddy_OptionsFrame_OnLoad() |
||
37 | TipBuddy_OptionsFrameHeaderText:SetText("TipBuddy Options"); |
||
38 | TipBuddy_UpdateTabs_Initialize(); |
||
39 | PanelTemplates_SetNumTabs(TipBuddy_OptionsFrame_PlayersFrame, 3); |
||
40 | PanelTemplates_SetNumTabs(TipBuddy_OptionsFrame_NPCsFrame, 3); |
||
41 | PanelTemplates_SetNumTabs(TipBuddy_OptionsFrame_PetsFrame, 2); |
||
42 | TipBuddy_HideOptionPanels(); |
||
43 | TipBuddy_OptionsFrame_PlayersFrame:Show(); |
||
44 | end |
||
45 | |||
46 | function LoadTipBuddyButtonTextures(name) |
||
47 | this:RegisterForClicks("LeftButtonUp", "RightButtonUp"); |
||
48 | this:RegisterEvent("UPDATE_BINDINGS"); |
||
49 | local prefix = "Interface\\AddOns\\TipBuddy\\gfx\\UI-MicroButton-"; |
||
50 | this:SetNormalTexture(prefix..name.."-Up"); |
||
51 | this:SetPushedTexture(prefix..name.."-Down"); |
||
52 | this:SetDisabledTexture(prefix..name.."-Disabled"); |
||
53 | this:SetHighlightTexture("Interface\\Buttons\\UI-MicroButton-Hilight"); |
||
54 | end |
||
55 | |||
56 | function TipBuddy_HideOptionPanels() |
||
57 | TipBuddy_OptionsFrame_PlayersFrame:Hide(); |
||
58 | TipBuddy_OptionsFrame_NPCsFrame:Hide(); |
||
59 | TipBuddy_OptionsFrame_PetsFrame:Hide(); |
||
60 | TipBuddy_OptionsFrame_CORPSEFrame:Hide(); |
||
61 | TipBuddy_OptionsFrame_General_Options:Hide(); |
||
62 | TipBuddy_OptionsFrame_Anchoring_Options:Hide(); |
||
63 | TipBuddy_OptionsFrame_Compact_Options:Hide(); |
||
64 | end |
||
65 | --------------------------------------------------------------- |
||
66 | -- UPDATING DUE TO CHECKBOXES |
||
67 | --------------------------------------------------------------- |
||
68 | function TipBuddy_OptionsFrame_UpdateGreyed() |
||
69 | --[[ |
||
70 | if ( TB_Op_Check1:GetChecked() ) then |
||
71 | TipBuddy_ToggleCheckboxFrame( TB_Op_Check1 ); |
||
72 | end |
||
73 | if ( TB_Op_Check9:GetChecked() ) then |
||
74 | TipBuddy_ToggleCheckboxFrame( TB_Op_Check9 ); |
||
75 | end |
||
76 | if ( TB_Op_Check17:GetChecked() ) then |
||
77 | TipBuddy_ToggleCheckboxFrame( TB_Op_Check17 ); |
||
78 | end |
||
79 | if ( TB_Op_Check25:GetChecked() ) then |
||
80 | TipBuddy_ToggleCheckboxFrame( TB_Op_Check25 ); |
||
81 | end |
||
82 | if ( TB_Op_Check33:GetChecked() ) then |
||
83 | TipBuddy_ToggleCheckboxFrame( TB_Op_Check33 ); |
||
84 | end |
||
85 | if ( TB_Op_Check41:GetChecked() ) then |
||
86 | TipBuddy_ToggleCheckboxFrame( TB_Op_Check41 ); |
||
87 | end |
||
88 | if ( TB_Op_Check49:GetChecked() ) then |
||
89 | TipBuddy_ToggleCheckboxFrame( TB_Op_Check49 ); |
||
90 | end]] |
||
91 | if ( TB_Op_Check57:GetChecked() ) then |
||
92 | TB_Op_Check61:Disable(); |
||
93 | getglobal("TB_Op_Check61Text"):SetTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b); |
||
94 | else |
||
95 | TB_Op_Check61:Enable(); |
||
96 | getglobal("TB_Op_Check61Text"):SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b); |
||
97 | end |
||
98 | end |
||
99 | |||
100 | function TipBuddy_OptionsFrame_UpdateCheckboxes() |
||
101 | for index, value in TB_Op_Checks do |
||
102 | local button = getglobal( value.frame ); |
||
103 | local string = getglobal( value.frame.."Text"); |
||
104 | |||
105 | if (not button) then |
||
106 | return; |
||
107 | end |
||
108 | |||
109 | local tipTable = TipBuddy_SavedVars[value.type]; |
||
110 | ----TB_AddMessage(value.type); |
||
111 | button:SetChecked( tipTable[value.var] ); |
||
112 | |||
113 | string:SetText( TEXT(value.text) ); |
||
114 | button.tooltipText = value.tooltipText; |
||
115 | button.tooltipRequirement = value.tooltipRequirement; |
||
116 | button.gxRestart = value.gxRestart; |
||
117 | button.restartClient = value.restartClient; |
||
118 | |||
119 | if ( button.disabled ) then |
||
120 | button:Disable(); |
||
121 | string:SetTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b); |
||
122 | else |
||
123 | button:Enable(); |
||
124 | string:SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b); |
||
125 | end |
||
126 | end |
||
127 | end |
||
128 | |||
129 | function TipBuddy_OptionsFrame_UpdateSliders() |
||
130 | for index, value in TipBuddy_OptionsFrame_Sliders do |
||
131 | local slider = getglobal("TipBuddy_OptionsFrame_Slider"..index); |
||
132 | local string = getglobal("TipBuddy_OptionsFrame_Slider"..index.."Text"); |
||
133 | local high = getglobal("TipBuddy_OptionsFrame_Slider"..index.."High"); |
||
134 | local low = getglobal("TipBuddy_OptionsFrame_Slider"..index.."Low"); |
||
135 | |||
136 | TipBuddy_OptionsFrame_SliderCalcEnabled( slider ); |
||
137 | |||
138 | if (index == 1) then |
||
139 | low:SetText( "Small" ); |
||
140 | high:SetText( "Large" ); |
||
141 | else |
||
142 | low:SetText( value.minValue ); |
||
143 | high:SetText( value.maxValue ); |
||
144 | end |
||
145 | |||
146 | local tipTable = TipBuddy_SavedVars["general"]; |
||
147 | |||
148 | slider:SetMinMaxValues(value.minValue, value.maxValue); |
||
149 | slider:SetValueStep(value.valueStep); |
||
150 | |||
151 | slider:SetValue( tipTable[value.var] ); |
||
152 | |||
153 | string:SetText(TEXT(value.text)); |
||
154 | slider.tooltipText = value.tooltipText; |
||
155 | slider.tooltipRequirement = value.tooltipRequirement; |
||
156 | slider.gxRestart = value.gxRestart; |
||
157 | slider.restartClient = value.restartClient; |
||
158 | end |
||
159 | end |
||
160 | |||
161 | function TipBuddy_OptionsFrame_SliderCalcEnabled( slider ) |
||
162 | local thumb = getglobal(slider:GetName().."Thumb"); |
||
163 | local string = getglobal(slider:GetName().."Text"); |
||
164 | local updatetext = getglobal(slider:GetName().."TextUpdate"); |
||
165 | local high = getglobal(slider:GetName().."High"); |
||
166 | local low = getglobal(slider:GetName().."Low"); |
||
167 | if ( slider.disabled ) then |
||
168 | slider:EnableMouse(0); |
||
169 | thumb:Hide(); |
||
170 | string:SetVertexColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b); |
||
171 | updatetext:SetVertexColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b); |
||
172 | low:SetVertexColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b); |
||
173 | high:SetVertexColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b); |
||
174 | else |
||
175 | slider:EnableMouse(1); |
||
176 | thumb:Show(); |
||
177 | string:SetVertexColor(NORMAL_FONT_COLOR.r , NORMAL_FONT_COLOR.g , NORMAL_FONT_COLOR.b); |
||
178 | updatetext:SetVertexColor(NORMAL_FONT_COLOR.r , NORMAL_FONT_COLOR.g , NORMAL_FONT_COLOR.b); |
||
179 | low:SetVertexColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); |
||
180 | high:SetVertexColor(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b); |
||
181 | end |
||
182 | end |
||
183 | |||
184 | function TipBuddy_OptionsFrame_UpdateEditBoxes() |
||
185 | for index, value in TB_EditBoxes do |
||
186 | local editbox = getglobal( value.frame ); |
||
187 | --local string = getglobal( value.frame.."Text"); |
||
188 | |||
189 | if (not editbox) then |
||
190 | return; |
||
191 | end |
||
192 | |||
193 | local tipTable = TipBuddy_SavedVars[value.type]; |
||
194 | ----TB_AddMessage(value.type); |
||
195 | if (not tipTable[value.var]) then |
||
196 | DEFAULT_CHAT_FRAME:AddMessage("|cff3366ffSETTING BLANK VAR with: "..TEXT(value.type)); |
||
197 | tipTable[value.var] = ""; |
||
198 | end |
||
199 | editbox:SetText( tipTable[value.var] ); |
||
200 | end |
||
201 | end |
||
202 | |||
203 | function TipBuddy_OptionsFrame_UpdateDropDowns() |
||
204 | OptionsFrame_EnableDropDown(UIOptionsFrameClickCameraDropDown); |
||
205 | end |
||
206 | |||
207 | --------------------------------------------------------------- |
||
208 | -- TOGGLING ALL CHECKBOXES WHEN DISABLE ALL |
||
209 | --------------------------------------------------------------- |
||
210 | function TipBuddy_ToggleCheckboxFrame( checkBox ) |
||
211 | local button = getglobal( checkBox:GetName() ); |
||
212 | local boxId = button:GetID(); |
||
213 | |||
214 | -- --TB_AddMessage(button:GetID()); |
||
215 | |||
216 | if ( button:GetChecked() ) then |
||
217 | for i=1, 7, 1 do |
||
218 | local boxName = getglobal( "TB_Op_Check"..(boxId + i) ); |
||
219 | if (boxName == 0) then |
||
220 | return; |
||
221 | end |
||
222 | TipBuddy_DisableCheckBox(boxName); |
||
223 | end |
||
224 | else |
||
225 | for i=1, 7, 1 do |
||
226 | local boxName = getglobal( "TB_Op_Check"..(boxId + i) ); |
||
227 | if (boxName == 0) then |
||
228 | return; |
||
229 | end |
||
230 | TipBuddy_EnableCheckBox(boxName); |
||
231 | end |
||
232 | end |
||
233 | end |
||
234 | |||
235 | function TipBuddy_DisableCheckBox(checkBox) |
||
236 | -- checkBox:SetChecked(0); |
||
237 | checkBox:Disable(); |
||
238 | getglobal(checkBox:GetName().."Text"):SetTextColor(GRAY_FONT_COLOR.r, GRAY_FONT_COLOR.g, GRAY_FONT_COLOR.b); |
||
239 | end |
||
240 | |||
241 | function TipBuddy_EnableCheckBox(checkBox, checked) |
||
242 | -- if ( checkBox:GetChecked() ) then |
||
243 | -- return; |
||
244 | -- end |
||
245 | -- checkBox:SetChecked(checked); |
||
246 | checkBox:Enable(); |
||
247 | getglobal(checkBox:GetName().."Text"):SetTextColor(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b); |
||
248 | end |
||
249 | |||
250 | function TipBuddy_UpdateTabs_Initialize() |
||
251 | -- local frame = getglobal( this:GetName() ); |
||
252 | -- PanelTemplates_SetTab( TipBuddy_OptionsFrame_PlayersFrame, 1 ); |
||
253 | TipBuddy_OptionsFrame_PCFriend_Options:Show(); |
||
254 | TipBuddy_OptionsFrame_PCEnemy_Options:Hide(); |
||
255 | TipBuddy_OptionsFrame_PCParty_Options:Hide(); |
||
256 | |||
257 | TipBuddy_OptionsFrame_NPCFriend_Options:Show(); |
||
258 | TipBuddy_OptionsFrame_NPCNeutral_Options:Hide(); |
||
259 | TipBuddy_OptionsFrame_NPCEnemy_Options:Hide(); |
||
260 | |||
261 | TipBuddy_OptionsFrame_PETFriend_Options:Show(); |
||
262 | TipBuddy_OptionsFrame_PETEnemy_Options:Hide(); |
||
263 | |||
264 | TipBuddy_OptionsFrame_CORPSE_Options:Show(); |
||
265 | end |
||
266 | |||
267 | |||
268 | function TipBuddy_PlayersFrameTab_OnClick(index) |
||
269 | if ( not index ) then |
||
270 | index = this:GetID(); |
||
271 | end |
||
272 | -- local frame = getglobal( this:GetName() ); |
||
273 | PanelTemplates_SetTab( TipBuddy_OptionsFrame_PlayersFrame, index ); |
||
274 | TipBuddy_OptionsFrame_PCFriend_Options:Hide(); |
||
275 | TipBuddy_OptionsFrame_PCEnemy_Options:Hide(); |
||
276 | TipBuddy_OptionsFrame_PCParty_Options:Hide(); |
||
277 | PlaySound("igCharacterInfoTab"); |
||
278 | if ( index == 1 ) then |
||
279 | -- Friendly |
||
280 | TipBuddy_OptionsFrame_PCFriend_Options:Show(); |
||
281 | elseif ( index == 2 ) then |
||
282 | -- Enemy |
||
283 | TipBuddy_OptionsFrame_PCParty_Options:Show(); |
||
284 | elseif ( index == 3 ) then |
||
285 | -- InParty |
||
286 | TipBuddy_OptionsFrame_PCEnemy_Options:Show(); |
||
287 | end |
||
288 | end |
||
289 | |||
290 | function TipBuddy_NPCsFrameTab_OnClick(index) |
||
291 | if ( not index ) then |
||
292 | index = this:GetID(); |
||
293 | end |
||
294 | -- local frame = getglobal( this:GetName() ); |
||
295 | PanelTemplates_SetTab( TipBuddy_OptionsFrame_NPCsFrame, index ); |
||
296 | TipBuddy_OptionsFrame_NPCFriend_Options:Hide(); |
||
297 | TipBuddy_OptionsFrame_NPCNeutral_Options:Hide(); |
||
298 | TipBuddy_OptionsFrame_NPCEnemy_Options:Hide(); |
||
299 | PlaySound("igCharacterInfoTab"); |
||
300 | if ( index == 1 ) then |
||
301 | -- Friendly |
||
302 | TipBuddy_OptionsFrame_NPCFriend_Options:Show(); |
||
303 | elseif ( index == 2 ) then |
||
304 | -- Neutral |
||
305 | TipBuddy_OptionsFrame_NPCNeutral_Options:Show(); |
||
306 | elseif ( index == 3 ) then |
||
307 | -- Enemy |
||
308 | TipBuddy_OptionsFrame_NPCEnemy_Options:Show(); |
||
309 | end |
||
310 | end |
||
311 | |||
312 | function TipBuddy_PetsFrameTab_OnClick(index) |
||
313 | if ( not index ) then |
||
314 | index = this:GetID(); |
||
315 | end |
||
316 | -- local frame = getglobal( this:GetName() ); |
||
317 | PanelTemplates_SetTab( TipBuddy_OptionsFrame_PetsFrame, index ); |
||
318 | TipBuddy_OptionsFrame_PETFriend_Options:Hide(); |
||
319 | TipBuddy_OptionsFrame_PETEnemy_Options:Hide(); |
||
320 | PlaySound("igCharacterInfoTab"); |
||
321 | if ( index == 1 ) then |
||
322 | -- Friendly |
||
323 | TipBuddy_OptionsFrame_PETFriend_Options:Show(); |
||
324 | elseif ( index == 2 ) then |
||
325 | -- InParty |
||
326 | TipBuddy_OptionsFrame_PETEnemy_Options:Show(); |
||
327 | end |
||
328 | end |
||
329 | |||
330 | function TipBuddy_OptionsFrameTab_OnClick(index) |
||
331 | if ( not index ) then |
||
332 | index = this:GetID(); |
||
333 | end |
||
334 | -- local frame = getglobal( this:GetName() ); |
||
335 | --PanelTemplates_SetTab( TipBuddy_OptionsFrame_PlayersFrame, index ); |
||
336 | TipBuddy_OptionsFrame_General_Options:Hide(); |
||
337 | TipBuddy_OptionsFrame_Compact_Options:Hide(); |
||
338 | PlaySound("igCharacterInfoTab"); |
||
339 | if ( index == 1 ) then |
||
340 | TipBuddy_OptionsFrame_General_Options:Show(); |
||
341 | TipBuddy_OptionsFrame_GeneralOptionsTitleText:SetTextColor(1.0, 1.0, 1.0); |
||
342 | TipBuddy_OptionsFrame_CompactOptionsTitleText:SetTextColor(0.3, 0.3, 0.1); |
||
343 | elseif ( index == 2 ) then |
||
344 | TipBuddy_OptionsFrame_Compact_Options:Show(); |
||
345 | TipBuddy_OptionsFrame_CompactOptionsTitleText:SetTextColor(1.0, 1.0, 1.0); |
||
346 | TipBuddy_OptionsFrame_GeneralOptionsTitleText:SetTextColor(0.3, 0.3, 0.1); |
||
347 | end |
||
348 | end |
||
349 | |||
350 | -------------------------------------------------------------------------------------------------------------------------------------- |
||
351 | -- FRAME BACKGROUND COLOR PICKER |
||
352 | -------------------------------------------------------------------------------------------------------------------------------------- |
||
353 | function TipBuddy_Background_ColorPick_OnLoad() |
||
354 | cInfo = {}; |
||
355 | end |
||
356 | |||
357 | function TipBuddy_Background_ColorPick( button ) |
||
358 | |||
359 | local name = getglobal( button:GetName() ); |
||
360 | local id = name:GetID(); |
||
361 | cInfo.type = TipBuddy_ColorPicker_Buttons[id].type; |
||
362 | cInfo.var = TipBuddy_ColorPicker_Buttons[id].var; |
||
363 | |||
364 | local targettype = TipBuddy_SavedVars[cInfo.type][cInfo.var]; |
||
365 | if (not targettype) then |
||
366 | TipBuddy_SavedVars[cInfo.type][cInfo.var] = { ["r"] = 0.8, ["g"] = 0.8, ["b"] = 0.9, ["a"] = 1, }; |
||
367 | targettype = TipBuddy_SavedVars[value.type][value.var]; |
||
368 | end |
||
369 | --TB_AddMessage("frame: "..button:GetName()); |
||
370 | --TB_AddMessage("type: "..TEXT(cInfo.type)); |
||
371 | TBColorPickerFrame.func = TipBuddy_Background_SetColor; |
||
372 | TBColorPickerFrame.hasOpacity = 1; |
||
373 | TBColorPickerFrame.opacityFunc = TipBuddy_Background_SetOpacity; |
||
374 | TBColorPickerFrame.cancelFunc = TipBuddy_Background_Cancel; |
||
375 | |||
376 | TBColorPickerFrame:SetColorRGB( targettype.r, targettype.g, targettype.b); |
||
377 | TBColorPickerFrame.opacity = (1- targettype.a); |
||
378 | TBColorPickerFrame.previousValues = {r=targettype.r, g=targettype.g, b=targettype.b, opacity=targettype.a}; |
||
379 | |||
380 | ShowUIPanel(TBColorPickerFrame); |
||
381 | --TB_AddMessage("just passed ShowUIPanel"); |
||
382 | end |
||
383 | |||
384 | function TipBuddy_Text_ColorPick( button ) |
||
385 | |||
386 | local name = getglobal( button:GetName() ); |
||
387 | local id = name:GetID(); |
||
388 | cInfo.type = TipBuddy_ColorPicker_Buttons_Text[id].type; |
||
389 | cInfo.var = TipBuddy_ColorPicker_Buttons_Text[id].var; |
||
390 | |||
391 | local targettype = TipBuddy_SavedVars[cInfo.type][cInfo.var]; |
||
392 | |||
393 | ----TB_AddMessage("frame: "..cInfo.name); |
||
394 | ----TB_AddMessage("type: "..type); |
||
395 | TBColorPickerFrame_Text.func = TipBuddy_Background_SetColor_Text; |
||
396 | --TBColorPickerFrame_Text.hasOpacity = 1; |
||
397 | --TBColorPickerFrame_Text.opacityFunc = TipBuddy_Background_SetOpacity; |
||
398 | TBColorPickerFrame_Text.cancelFunc = TipBuddy_Background_Cancel; |
||
399 | |||
400 | TBColorPickerFrame_Text:SetColorRGB( targettype.r, targettype.g, targettype.b); |
||
401 | --TBColorPickerFrame_Text.opacity = (1- targettype.bgcolor.a); |
||
402 | TBColorPickerFrame_Text.previousValues = {r=targettype.r, g=targettype.g, b=targettype.b, opacity=targettype.a}; |
||
403 | |||
404 | ShowUIPanel(TBColorPickerFrame_Text); |
||
405 | --TB_AddMessage("just passed ShowUIPanel"); |
||
406 | end |
||
407 | |||
408 | function TipBuddy_OptionsFrame_UpdateColorButtons() |
||
409 | for index, value in TipBuddy_ColorPicker_Buttons do |
||
410 | --TB_AddMessage(getn(TipBuddy_ColorPicker_Buttons)); |
||
411 | --TB_AddMessage(index); |
||
412 | local button = getglobal( value.frame ); |
||
413 | local swatch = getglobal( value.frame.."NormalTexture"); |
||
414 | local string = getglobal( value.frame.."Text"); |
||
415 | -- local type = getglobal( value.type ); |
||
416 | --TB_AddMessage("Color: ["..value.type.."]["..value.var.."]"); |
||
417 | |||
418 | if (not button) then |
||
419 | return; |
||
420 | end |
||
421 | |||
422 | local targettype = TipBuddy_SavedVars[value.type][value.var]; |
||
423 | |||
424 | if (not targettype) then |
||
425 | TipBuddy_SavedVars[value.type][value.var] = { ["r"] = 0.8, ["g"] = 0.8, ["b"] = 0.9, ["a"] = 1, }; |
||
426 | targettype = TipBuddy_SavedVars[value.type][value.var]; |
||
427 | end |
||
428 | |||
429 | string:SetText(TEXT(value.text)); |
||
430 | if (value.text) then |
||
431 | ----TB_AddMessage("frame:"..TEXT(value.frame).."colorbutton text: "..value.text); |
||
432 | end |
||
433 | button.tooltipText = value.tooltipText; |
||
434 | button.tooltipRequirement = value.tooltipRequirement; |
||
435 | swatch:SetVertexColor( targettype.r, targettype.g, targettype.b ); |
||
436 | if (index < 10 or index == 21) then |
||
437 | if (button:IsVisible()) then |
||
438 | button:GetParent():SetBackdropColor( targettype.r, targettype.g, targettype.b, TB_NoNegative(targettype.a-0.2) ); |
||
439 | else |
||
440 | button:GetParent():SetBackdropColor( 0.2, 0.2, 0.2, 1 ); |
||
441 | end |
||
442 | elseif (index > 10 and index < 20 or index == 22) then |
||
443 | if (button:IsVisible()) then |
||
444 | button:GetParent():SetBackdropBorderColor( targettype.r, targettype.g, targettype.b, TB_NoNegative(targettype.a-0.2) ); |
||
445 | else |
||
446 | button:GetParent():SetBackdropBorderColor( 0.8, 0.8, 0.9, 1 ); |
||
447 | end |
||
448 | end |
||
449 | |||
450 | end |
||
451 | end |
||
452 | |||
453 | function TipBuddy_OptionsFrame_UpdateColorButtons_Text() |
||
454 | for index, value in TipBuddy_ColorPicker_Buttons_Text do |
||
455 | local button = getglobal( value.frame ); |
||
456 | local swatch = getglobal( value.frame.."NormalTexture"); |
||
457 | local string = getglobal( value.frame.."Text"); |
||
458 | -- local type = getglobal( value.type ); |
||
459 | ----TB_AddMessage("Color: ["..value.type.."]["..value.var.."]"); |
||
460 | |||
461 | if (not button) then |
||
462 | return; |
||
463 | end |
||
464 | |||
465 | local targettype = TipBuddy_SavedVars[value.type][value.var]; |
||
466 | |||
467 | string:SetText(TEXT(value.text)); |
||
468 | button.tooltipText = value.tooltipText; |
||
469 | button.tooltipRequirement = value.tooltipRequirement; |
||
470 | swatch:SetVertexColor( targettype.r, targettype.g, targettype.b ); |
||
471 | string:SetTextColor(targettype.r, targettype.g, targettype.b); |
||
472 | end |
||
473 | end |
||
474 | |||
475 | |||
476 | function TipBuddy_Background_SetColor() |
||
477 | local targettype = TipBuddy_SavedVars[cInfo.type][cInfo.var]; |
||
478 | |||
479 | local r,g,b = TBColorPickerFrame:GetColorRGB(); |
||
480 | -- TipBuddy_Main_Frame:SetBackdropColor(r, g, b); |
||
481 | |||
482 | if (not targettype) then |
||
483 | TipBuddy_SavedVars[cInfo.type][cInfo.var] = {}; |
||
484 | targettype = TipBuddy_SavedVars[cInfo.type][cInfo.var]; |
||
485 | end |
||
486 | targettype.r = r; |
||
487 | targettype.g = g; |
||
488 | targettype.b = b; |
||
489 | end |
||
490 | |||
491 | function TipBuddy_Background_SetColor_Text() |
||
492 | local targettype = TipBuddy_SavedVars[cInfo.type][cInfo.var]; |
||
493 | |||
494 | local r,g,b = TBColorPickerFrame_Text:GetColorRGB(); |
||
495 | -- TipBuddy_Main_Frame:SetBackdropColor(r, g, b); |
||
496 | |||
497 | targettype.r = r; |
||
498 | targettype.g = g; |
||
499 | targettype.b = b; |
||
500 | end |
||
501 | |||
502 | function TipBuddy_Background_SetOpacity() |
||
503 | local targettype = TipBuddy_SavedVars[cInfo.type][cInfo.var]; |
||
504 | |||
505 | local alpha = 1.0 - TBOpacitySliderFrame:GetValue(); |
||
506 | if (not targettype) then |
||
507 | targettype = {}; |
||
508 | end |
||
509 | targettype.a = (1- TBOpacitySliderFrame:GetValue()); |
||
510 | end |
||
511 | |||
512 | function TipBuddy_Background_Cancel(previousValues) |
||
513 | local targettype = TipBuddy_SavedVars[cInfo.type][cInfo.var]; |
||
514 | |||
515 | if (not targettype) then |
||
516 | targettype = {}; |
||
517 | end |
||
518 | if (previousValues.r and previousValues.g and previousValues.b) then |
||
519 | targettype.r = previousValues.r; |
||
520 | targettype.g = previousValues.g; |
||
521 | targettype.b = previousValues.b; |
||
522 | end |
||
523 | if (previousValues.opacity) then |
||
524 | local alpha = 1.0 - previousValues.opacity; |
||
525 | targettype.a = previousValues.opacity; |
||
526 | end |
||
527 | end |
||
528 | |||
529 | |||
530 | TipBuddy_CursorPos = { |
||
531 | [1] = "Top", |
||
532 | [2] = "Right", |
||
533 | [3] = "Left", |
||
534 | [4] = "Bottom", |
||
535 | }; |
||
536 | |||
537 | function TipBuddy_CursorPosDropDown_OnLoad() |
||
538 | UIDropDownMenu_Initialize(this, TipBuddy_CursorPosDropDown_Initialize); |
||
539 | UIDropDownMenu_SetSelectedValue(this, TipBuddy_SavedVars["general"].cursorpos); |
||
540 | UIDropDownMenu_SetWidth(120, TipBuddy_CursorPosDropDown); |
||
541 | end |
||
542 | |||
543 | function TipBuddy_CursorPosDropDown_OnClick() |
||
544 | UIDropDownMenu_SetSelectedValue(TipBuddy_CursorPosDropDown, this.value); |
||
545 | TipBuddy.xpoint, TipBuddy.xpos, TipBuddy.ypos = TipBuddy_GetFrameCursorOffset(); |
||
546 | TipBuddy.anchor, TipBuddy.fanchor, TipBuddy.offset = TipBuddy_GetFrameAnchorPos(); |
||
547 | if (TipBuddy_SavedVars["general"].anchored == 1) then |
||
548 | TipBuddy_Parent_Frame:SetPoint(TipBuddy.anchor, "TipBuddy_Header_Frame", TipBuddy.fanchor, 0, 0); |
||
549 | end |
||
550 | TipBuddy_SetFrame_Anchor( TipBuddy_Main_Frame ); |
||
551 | GameTooltip_SetDefaultAnchor(GameTooltip, UIParent); |
||
552 | end |
||
553 | |||
554 | function TipBuddy_CursorPosDropDown_Initialize() |
||
555 | local selectedValue = UIDropDownMenu_GetSelectedValue(TipBuddy_CursorPosDropDown); |
||
556 | local info; |
||
557 | |||
558 | info = {}; |
||
559 | info.text = TipBuddy_CursorPos[1]; |
||
560 | info.func = TipBuddy_CursorPosDropDown_OnClick; |
||
561 | info.value = "Top"; |
||
562 | if ( info.value == selectedValue ) then |
||
563 | info.checked = 1; |
||
564 | end |
||
565 | info.tooltipTitle = "Postion the tooltip ABOVE your cursor"; |
||
566 | UIDropDownMenu_AddButton(info); |
||
567 | |||
568 | info = {}; |
||
569 | info.text = TipBuddy_CursorPos[2]; |
||
570 | info.func = TipBuddy_CursorPosDropDown_OnClick; |
||
571 | info.value = "Right"; |
||
572 | if ( info.value == selectedValue ) then |
||
573 | info.checked = 1; |
||
574 | end |
||
575 | info.tooltipTitle = "Position the tooltip to the RIGHT of your cursor"; |
||
576 | UIDropDownMenu_AddButton(info); |
||
577 | |||
578 | info = {}; |
||
579 | info.text = TipBuddy_CursorPos[3]; |
||
580 | info.func = TipBuddy_CursorPosDropDown_OnClick; |
||
581 | info.value = "Left"; |
||
582 | if ( info.value == selectedValue ) then |
||
583 | info.checked = 1; |
||
584 | end |
||
585 | info.tooltipTitle = "Position the tooltip to the LEFT of your cursor"; |
||
586 | UIDropDownMenu_AddButton(info); |
||
587 | |||
588 | info = {}; |
||
589 | info.text = TipBuddy_CursorPos[4]; |
||
590 | info.func = TipBuddy_CursorPosDropDown_OnClick; |
||
591 | info.value = "Bottom"; |
||
592 | if ( info.value == selectedValue ) then |
||
593 | info.checked = 1; |
||
594 | end |
||
595 | info.tooltipTitle = "Position the tooltip BELOW your cursor"; |
||
596 | UIDropDownMenu_AddButton(info); |
||
597 | end |
||
598 | |||
599 | --non-unit tips |
||
600 | TipBuddy_NonUnitTipPos = { |
||
601 | [1] = "Cursor", |
||
602 | [2] = "TipBuddyAnchor", |
||
603 | [3] = "Smart Anchor", |
||
604 | }; |
||
605 | |||
606 | function TipBuddy_NonUnitTipPosDropDown_OnLoad() |
||
607 | UIDropDownMenu_Initialize(this, TipBuddy_NonUnitTipPosDropDown_Initialize); |
||
608 | UIDropDownMenu_SetSelectedValue(this, TipBuddy_SavedVars["general"].nonunit_anchor); |
||
609 | UIDropDownMenu_SetWidth(120, TipBuddy_NonUnitTipPosDropDown); |
||
610 | end |
||
611 | |||
612 | function TipBuddy_NonUnitTipPosDropDown_OnClick() |
||
613 | UIDropDownMenu_SetSelectedValue(TipBuddy_NonUnitTipPosDropDown, this.value); |
||
614 | TipBuddy.xpoint, TipBuddy.xpos, TipBuddy.ypos = TipBuddy_GetFrameCursorOffset(); |
||
615 | TipBuddy.anchor, TipBuddy.fanchor, TipBuddy.offset = TipBuddy_GetFrameAnchorPos(); |
||
616 | GameTooltip_SetDefaultAnchor(GameTooltip, UIParent); |
||
617 | --if (UIDropDownMenu_GetSelectedValue(TipBuddy_NonUnitTipPosDropDown)) then |
||
618 | TipBuddy_SavedVars["general"].nonunit_anchor = this.value; |
||
619 | --end |
||
620 | --/script DEFAULT_CHAT_FRAME:AddMessage(UIDropDownMenu_GetSelectedValue(TipBuddy_NonUnitTipPosDropDown)); |
||
621 | --/script DEFAULT_CHAT_FRAME:AddMessage(TipBuddy_SavedVars["general"].nonunit_anchor); |
||
622 | end |
||
623 | |||
624 | function TipBuddy_NonUnitTipPosDropDown_Initialize() |
||
625 | local selectedValue = UIDropDownMenu_GetSelectedValue(TipBuddy_NonUnitTipPosDropDown); |
||
626 | local info; |
||
627 | |||
628 | info = {}; |
||
629 | info.text = TipBuddy_NonUnitTipPos[1]; |
||
630 | info.func = TipBuddy_NonUnitTipPosDropDown_OnClick; |
||
631 | info.value = 0; |
||
632 | if ( info.value == selectedValue ) then |
||
633 | info.checked = 1; |
||
634 | end |
||
635 | info.tooltipTitle = "Non-Unit tooltips will\nfollow the cursor"; |
||
636 | UIDropDownMenu_AddButton(info); |
||
637 | |||
638 | info = {}; |
||
639 | info.text = TipBuddy_NonUnitTipPos[2]; |
||
640 | info.func = TipBuddy_NonUnitTipPosDropDown_OnClick; |
||
641 | info.value = 1; |
||
642 | if ( info.value == selectedValue ) then |
||
643 | info.checked = 1; |
||
644 | end |
||
645 | info.tooltipTitle = "Non-Unit tooltips will\nattach themselves to\nthe TipBuddyAnchor"; |
||
646 | UIDropDownMenu_AddButton(info); |
||
647 | |||
648 | info = {}; |
||
649 | info.text = TipBuddy_NonUnitTipPos[3]; |
||
650 | info.func = TipBuddy_NonUnitTipPosDropDown_OnClick; |
||
651 | info.value = 2; |
||
652 | if ( info.value == selectedValue ) then |
||
653 | info.checked = 1; |
||
654 | end |
||
655 | info.tooltipTitle = "Non-Unit tooltips will attempt to\nattach themselves to the button\nor object you have your mouse\nover in a smart position"; |
||
656 | UIDropDownMenu_AddButton(info); |
||
657 | |||
658 | end |
||
659 | |||
660 | --Tooltip Style (Compact, Default, Advanced) |
||
661 | TipBuddy_TipStyle = { |
||
662 | [1] = "Default Mode", |
||
663 | [2] = "Compact Mode", |
||
664 | [3] = "Advanced Mode", |
||
665 | }; |
||
666 | |||
667 | function TipBuddy_TipStyleDropDown_OnLoad( type ) |
||
668 | this.type = type; |
||
669 | if (not TipBuddy_SavedVars[this.type].off) then |
||
670 | TipBuddy_SavedVars[this.type].off = 0; |
||
671 | end |
||
672 | --TB_AddMessage( this.type.." : "..TipBuddy_SavedVars[this.type].off ); |
||
673 | ----TB_AddMessage( this.type ); |
||
674 | UIDropDownMenu_Initialize(this, TipBuddy_TipStyleDropDown_Initialize, nil, this.type ); |
||
675 | UIDropDownMenu_SetSelectedValue(this, TipBuddy_SavedVars[this.type].off); |
||
676 | UIDropDownMenu_SetWidth(120, TipBuddy_TipStyleDropDown); |
||
677 | TipBuddy_TipStyleDropDown_SetFrameVisibility(this, TipBuddy_SavedVars[this.type].off); |
||
678 | --/script DEFAULT_CHAT_FRAME:AddMessage(UIDropDownMenu_GetSelectedValue(TB_NPCNeutral_TipStyleDropDown)); |
||
679 | end |
||
680 | |||
681 | function TipBuddy_TipStyleDropDown_OnClick() |
||
682 | --TB_AddMessage( this.owner:GetName() ); |
||
683 | UIDropDownMenu_SetSelectedValue(this.owner, this.value); |
||
684 | TipBuddy_SavedVars[this.owner.type].off = UIDropDownMenu_GetSelectedValue(this.owner); |
||
685 | TipBuddy_TipStyleDropDown_SetFrameVisibility(this.owner, this.value) |
||
686 | end |
||
687 | |||
688 | function TB_TipStyle_OptionsToggleFrames( value, type, colornum ) |
||
689 | if (value == 0) then |
||
690 | getglobal("TipBuddy_OptionsFrame_"..type.."_Options_Checks"):Show(); |
||
691 | getglobal("TipBuddy_OptionsFrame_"..type.."_Options_EB"):Hide(); |
||
692 | getglobal("TB_"..type.."_BDBColorDropDown"):Show(); |
||
693 | TipBuddy_BDBColorDropDown_SetFrameVisibility(getglobal("TB_"..type.."_BDBColorDropDown"), UIDropDownMenu_GetSelectedValue(getglobal("TB_"..type.."_BDBColorDropDown"))); |
||
694 | elseif (value == 1) then |
||
695 | getglobal("TipBuddy_OptionsFrame_"..type.."_Options_Checks"):Show(); |
||
696 | getglobal("TipBuddy_OptionsFrame_"..type.."_Options_EB"):Hide(); |
||
697 | getglobal("TB_"..type.."_BDBColorDropDown"):Hide(); |
||
698 | getglobal("TipBuddy_OptionsFrame_ColorPicker"..colornum):Hide(); |
||
699 | getglobal("TipBuddy_OptionsFrame_"..type.."_Options"):SetBackdropBorderColor(0, 0, 0, 1); |
||
700 | else |
||
701 | getglobal("TipBuddy_OptionsFrame_"..type.."_Options_Checks"):Hide(); |
||
702 | getglobal("TipBuddy_OptionsFrame_"..type.."_Options_EB"):Show(); |
||
703 | getglobal("TB_"..type.."_BDBColorDropDown"):Show(); |
||
704 | TipBuddy_BDBColorDropDown_SetFrameVisibility(getglobal("TB_"..type.."_BDBColorDropDown"), UIDropDownMenu_GetSelectedValue(getglobal("TB_"..type.."_BDBColorDropDown"))); |
||
705 | end |
||
706 | end |
||
707 | |||
708 | |||
709 | function TipBuddy_TipStyleDropDown_SetFrameVisibility(frame, value) |
||
710 | if (frame.type == "pc_friend") then |
||
711 | TB_TipStyle_OptionsToggleFrames( value, "PCFriend", 11 ); |
||
712 | elseif (frame.type == "pc_party") then |
||
713 | TB_TipStyle_OptionsToggleFrames( value, "PCParty", 12 ); |
||
714 | elseif (frame.type == "pc_enemy") then |
||
715 | TB_TipStyle_OptionsToggleFrames( value, "PCEnemy", 13 ); |
||
716 | elseif (frame.type == "npc_friend") then |
||
717 | TB_TipStyle_OptionsToggleFrames( value, "NPCFriend", 14 ); |
||
718 | elseif (frame.type == "npc_neutral") then |
||
719 | TB_TipStyle_OptionsToggleFrames( value, "NPCNeutral", 15 ); |
||
720 | elseif (frame.type == "npc_enemy") then |
||
721 | TB_TipStyle_OptionsToggleFrames( value, "NPCEnemy", 16 ); |
||
722 | elseif (frame.type == "pet_friend") then |
||
723 | TB_TipStyle_OptionsToggleFrames( value, "PETFriend", 17 ); |
||
724 | elseif (frame.type == "pet_enemy") then |
||
725 | TB_TipStyle_OptionsToggleFrames( value, "PETEnemy", 18 ); |
||
726 | elseif (frame.type == "corpse") then |
||
727 | TB_TipStyle_OptionsToggleFrames( value, "CORPSE", 20 ); |
||
728 | else |
||
729 | end |
||
730 | end |
||
731 | |||
732 | function TipBuddy_TipStyleDropDown_Initialize() |
||
733 | local selectedValue = UIDropDownMenu_GetSelectedValue(this); |
||
734 | local info; |
||
735 | |||
736 | info = {}; |
||
737 | info.text = TipBuddy_TipStyle[1]; |
||
738 | info.func = TipBuddy_TipStyleDropDown_OnClick; |
||
739 | info.value = 0; |
||
740 | info.owner = this:GetParent(); |
||
741 | if ( info.value == selectedValue ) then |
||
742 | info.checked = 1; |
||
743 | end |
||
744 | info.tooltipTitle = "Default mode is similar\nto Blizzard's default tooltips,\nbut much more customizable"; |
||
745 | UIDropDownMenu_AddButton(info); |
||
746 | |||
747 | info = {}; |
||
748 | info.text = TipBuddy_TipStyle[2]; |
||
749 | info.func = TipBuddy_TipStyleDropDown_OnClick; |
||
750 | info.value = 1; |
||
751 | info.owner = this:GetParent(); |
||
752 | if ( info.value == selectedValue ) then |
||
753 | info.checked = 1; |
||
754 | end |
||
755 | info.tooltipTitle = "Compact Mode has a \ncleaner, smaller style."; |
||
756 | UIDropDownMenu_AddButton(info); |
||
757 | |||
758 | info = {}; |
||
759 | info.text = TipBuddy_TipStyle[3]; |
||
760 | info.func = TipBuddy_TipStyleDropDown_OnClick; |
||
761 | info.value = 2; |
||
762 | info.owner = this:GetParent(); |
||
763 | if ( info.value == selectedValue ) then |
||
764 | info.checked = 1; |
||
765 | end |
||
766 | info.tooltipTitle = "For Advanced Users only."; |
||
767 | UIDropDownMenu_AddButton(info); |
||
768 | |||
769 | end |
||
770 | |||
771 | --Tooltip Backdrop Colors |
||
772 | TipBuddy_BDColor = { |
||
773 | [1] = "Custom", |
||
774 | [2] = "Difficulty", |
||
775 | [3] = "Reaction", |
||
776 | }; |
||
777 | |||
778 | function TipBuddy_BDColorDropDown_OnLoad( type ) |
||
779 | this.type = type; |
||
780 | if (not TipBuddy_SavedVars[type].c_bdp) then |
||
781 | TipBuddy_SavedVars[type].c_bdp = 0; |
||
782 | end |
||
783 | --TB_AddMessage( this.type.." : "..TipBuddy_SavedVars[this.type].c_bdp ); |
||
784 | ----TB_AddMessage( this.type ); |
||
785 | UIDropDownMenu_Initialize(this, TipBuddy_BDColorDropDown_Initialize, nil, this.type ); |
||
786 | UIDropDownMenu_SetSelectedValue(this, TipBuddy_SavedVars[this.type].c_bdp); |
||
787 | UIDropDownMenu_SetWidth(110, TipBuddy_BDColorDropDown); |
||
788 | TipBuddy_BDColorDropDown_SetFrameVisibility(this, TipBuddy_SavedVars[this.type].c_bdp) |
||
789 | end |
||
790 | |||
791 | function TipBuddy_BDColorDropDown_OnClick() |
||
792 | --TB_AddMessage( this.owner:GetName().." : "..this.owner.type.." : "..this.value ); |
||
793 | UIDropDownMenu_SetSelectedValue(this.owner, this.value); |
||
794 | TipBuddy_SavedVars[this.owner.type].c_bdp = this.value; |
||
795 | TipBuddy_BDColorDropDown_SetFrameVisibility(this.owner, this.value) |
||
796 | end |
||
797 | |||
798 | function TipBuddy_BDColorDropDown_SetFrameVisibility(frame, value) |
||
799 | local button; |
||
800 | if (value == 0) then |
||
801 | if (frame.type == "pc_friend") then |
||
802 | button = TipBuddy_OptionsFrame_ColorPicker1; |
||
803 | elseif (frame.type == "pc_party") then |
||
804 | button = TipBuddy_OptionsFrame_ColorPicker2; |
||
805 | elseif (frame.type == "pc_enemy") then |
||
806 | button = TipBuddy_OptionsFrame_ColorPicker3; |
||
807 | elseif (frame.type == "npc_friend") then |
||
808 | button = TipBuddy_OptionsFrame_ColorPicker4; |
||
809 | elseif (frame.type == "npc_neutral") then |
||
810 | button = TipBuddy_OptionsFrame_ColorPicker5; |
||
811 | elseif (frame.type == "npc_enemy") then |
||
812 | button = TipBuddy_OptionsFrame_ColorPicker6; |
||
813 | elseif (frame.type == "pet_friend") then |
||
814 | button = TipBuddy_OptionsFrame_ColorPicker7; |
||
815 | elseif (frame.type == "pet_enemy") then |
||
816 | button = TipBuddy_OptionsFrame_ColorPicker8; |
||
817 | elseif (frame.type == "corpse") then |
||
818 | button = TipBuddy_OptionsFrame_ColorPicker10; |
||
819 | else |
||
820 | return; |
||
821 | end |
||
822 | button:Show(); |
||
823 | local targettype = TipBuddy_SavedVars[frame.type]["bgcolor"]; |
||
824 | if (not targettype) then |
||
825 | TipBuddy_SavedVars[value.type]["bgcolor"] = { ["r"] = 0.8, ["g"] = 0.8, ["b"] = 0.9, ["a"] = 1, }; |
||
826 | targettype = TipBuddy_SavedVars[frame.type]["bgcolor"]; |
||
827 | end |
||
828 | button:GetParent():SetBackdropColor(targettype.r, targettype.g, targettype.b, TB_NoNegative(targettype.a-0.2)); |
||
829 | --button:GetParent():SetBackdropBorderColor(targettype.r, targettype.g, targettype.b, TB_NoNegative(targettype.a-0.2)); |
||
830 | else |
||
831 | if (frame.type == "pc_friend") then |
||
832 | button = TipBuddy_OptionsFrame_ColorPicker1; |
||
833 | elseif (frame.type == "pc_party") then |
||
834 | button = TipBuddy_OptionsFrame_ColorPicker2; |
||
835 | elseif (frame.type == "pc_enemy") then |
||
836 | button = TipBuddy_OptionsFrame_ColorPicker3; |
||
837 | elseif (frame.type == "npc_friend") then |
||
838 | button = TipBuddy_OptionsFrame_ColorPicker4; |
||
839 | elseif (frame.type == "npc_neutral") then |
||
840 | button = TipBuddy_OptionsFrame_ColorPicker5; |
||
841 | elseif (frame.type == "npc_enemy") then |
||
842 | button = TipBuddy_OptionsFrame_ColorPicker6; |
||
843 | elseif (frame.type == "pet_friend") then |
||
844 | button = TipBuddy_OptionsFrame_ColorPicker7; |
||
845 | elseif (frame.type == "pet_enemy") then |
||
846 | button = TipBuddy_OptionsFrame_ColorPicker8; |
||
847 | elseif (frame.type == "corpse") then |
||
848 | button = TipBuddy_OptionsFrame_ColorPicker10; |
||
849 | else |
||
850 | return; |
||
851 | end |
||
852 | button:Hide(); |
||
853 | button:GetParent():SetBackdropColor(0.2, 0.2, 0.2, 1); |
||
854 | --button:GetParent():SetBackdropBorderColor(0.8, 0.8, 0.9, 1); |
||
855 | end |
||
856 | end |
||
857 | |||
858 | function TipBuddy_BDColorDropDown_Initialize() |
||
859 | local selectedValue = UIDropDownMenu_GetSelectedValue(this); |
||
860 | local info; |
||
861 | |||
862 | info = {}; |
||
863 | info.text = TipBuddy_BDColor[1]; |
||
864 | info.func = TipBuddy_BDColorDropDown_OnClick; |
||
865 | info.value = 0; |
||
866 | info.owner = this:GetParent(); |
||
867 | if ( info.value == selectedValue ) then |
||
868 | info.checked = 1; |
||
869 | end |
||
870 | info.tooltipTitle = "Choose your custom color by\nclicking the box to the right."; |
||
871 | UIDropDownMenu_AddButton(info); |
||
872 | |||
873 | info = {}; |
||
874 | info.text = TipBuddy_BDColor[2]; |
||
875 | info.func = TipBuddy_BDColorDropDown_OnClick; |
||
876 | info.value = 1; |
||
877 | info.owner = this:GetParent(); |
||
878 | if ( info.value == selectedValue ) then |
||
879 | info.checked = 1; |
||
880 | end |
||
881 | info.tooltipTitle = "Color will be determined\nby the unit's difficulty\n(red, yellow, grey, etc)."; |
||
882 | UIDropDownMenu_AddButton(info); |
||
883 | |||
884 | info = {}; |
||
885 | info.text = TipBuddy_BDColor[3]; |
||
886 | info.func = TipBuddy_BDColorDropDown_OnClick; |
||
887 | info.value = 2; |
||
888 | info.owner = this:GetParent(); |
||
889 | if ( info.value == selectedValue ) then |
||
890 | info.checked = 1; |
||
891 | end |
||
892 | info.tooltipTitle = "Color is determined by th\n unit's reaction towards you."; |
||
893 | UIDropDownMenu_AddButton(info); |
||
894 | |||
895 | end |
||
896 | |||
897 | --Tooltip Backdrop BORDER Colors |
||
898 | TipBuddy_BDBColor = { |
||
899 | [1] = "Custom", |
||
900 | [2] = "Difficulty", |
||
901 | [3] = "Reaction", |
||
902 | }; |
||
903 | |||
904 | function TipBuddy_BDBColorDropDown_OnLoad( type ) |
||
905 | this.type = type; |
||
906 | if (not TipBuddy_SavedVars[this.type].c_bdb) then |
||
907 | TipBuddy_SavedVars[this.type].c_bdb = 0; |
||
908 | end |
||
909 | --TB_AddMessage( this.type.." : "..TipBuddy_SavedVars[this.type].c_bdb ); |
||
910 | ----TB_AddMessage( this.type ); |
||
911 | UIDropDownMenu_Initialize(this, TipBuddy_BDBColorDropDown_Initialize, nil, this.type ); |
||
912 | UIDropDownMenu_SetSelectedValue(this, TipBuddy_SavedVars[this.type].c_bdb); |
||
913 | UIDropDownMenu_SetWidth(110, TipBuddy_BDBColorDropDown); |
||
914 | TipBuddy_BDBColorDropDown_SetFrameVisibility(this, TipBuddy_SavedVars[this.type].c_bdb) |
||
915 | end |
||
916 | |||
917 | function TipBuddy_BDBColorDropDown_OnClick() |
||
918 | --TB_AddMessage( this.owner:GetName() ); |
||
919 | UIDropDownMenu_SetSelectedValue(this.owner, this.value); |
||
920 | TipBuddy_SavedVars[this.owner.type].c_bdb = this.value; |
||
921 | TipBuddy_BDBColorDropDown_SetFrameVisibility(this.owner, this.value) |
||
922 | end |
||
923 | |||
924 | function TipBuddy_BDBColorDropDown_SetFrameVisibility(frame, value) |
||
925 | local button; |
||
926 | if (value == 0) then |
||
927 | if (frame.type == "pc_friend") then |
||
928 | button = TipBuddy_OptionsFrame_ColorPicker11; |
||
929 | elseif (frame.type == "pc_party") then |
||
930 | button = TipBuddy_OptionsFrame_ColorPicker12; |
||
931 | elseif (frame.type == "pc_enemy") then |
||
932 | button = TipBuddy_OptionsFrame_ColorPicker13; |
||
933 | elseif (frame.type == "npc_friend") then |
||
934 | button = TipBuddy_OptionsFrame_ColorPicker14; |
||
935 | elseif (frame.type == "npc_neutral") then |
||
936 | button = TipBuddy_OptionsFrame_ColorPicker15; |
||
937 | elseif (frame.type == "npc_enemy") then |
||
938 | button = TipBuddy_OptionsFrame_ColorPicker16; |
||
939 | elseif (frame.type == "pet_friend") then |
||
940 | button = TipBuddy_OptionsFrame_ColorPicker17; |
||
941 | elseif (frame.type == "pet_enemy") then |
||
942 | button = TipBuddy_OptionsFrame_ColorPicker18; |
||
943 | elseif (frame.type == "corpse") then |
||
944 | button = TipBuddy_OptionsFrame_ColorPicker20; |
||
945 | else |
||
946 | end |
||
947 | button:Show(); |
||
948 | local targettype = TipBuddy_SavedVars[frame.type]["bgbcolor"]; |
||
949 | if (not targettype) then |
||
950 | TipBuddy_SavedVars[value.type]["bgbcolor"] = { ["r"] = 0.8, ["g"] = 0.8, ["b"] = 0.9, ["a"] = 1, }; |
||
951 | targettype = TipBuddy_SavedVars[frame.type]["bgbcolor"]; |
||
952 | end |
||
953 | button:GetParent():SetBackdropBorderColor(targettype.r, targettype.g, targettype.b, TB_NoNegative(targettype.a-0.2)); |
||
954 | else |
||
955 | if (frame.type == "pc_friend") then |
||
956 | button = TipBuddy_OptionsFrame_ColorPicker11; |
||
957 | elseif (frame.type == "pc_party") then |
||
958 | button = TipBuddy_OptionsFrame_ColorPicker12; |
||
959 | elseif (frame.type == "pc_enemy") then |
||
960 | button = TipBuddy_OptionsFrame_ColorPicker13; |
||
961 | elseif (frame.type == "npc_friend") then |
||
962 | button = TipBuddy_OptionsFrame_ColorPicker14; |
||
963 | elseif (frame.type == "npc_neutral") then |
||
964 | button = TipBuddy_OptionsFrame_ColorPicker15; |
||
965 | elseif (frame.type == "npc_enemy") then |
||
966 | button = TipBuddy_OptionsFrame_ColorPicker16; |
||
967 | elseif (frame.type == "pet_friend") then |
||
968 | button = TipBuddy_OptionsFrame_ColorPicker17; |
||
969 | elseif (frame.type == "pet_enemy") then |
||
970 | button = TipBuddy_OptionsFrame_ColorPicker18; |
||
971 | elseif (frame.type == "corpse") then |
||
972 | button = TipBuddy_OptionsFrame_ColorPicker20; |
||
973 | else |
||
974 | end |
||
975 | button:Hide(); |
||
976 | button:GetParent():SetBackdropBorderColor(0.8, 0.8, 0.9, 1); |
||
977 | end |
||
978 | end |
||
979 | |||
980 | function TipBuddy_BDBColorDropDown_Initialize() |
||
981 | local selectedValue = UIDropDownMenu_GetSelectedValue(this); |
||
982 | local info; |
||
983 | |||
984 | info = {}; |
||
985 | info.text = TipBuddy_BDBColor[1]; |
||
986 | info.func = TipBuddy_BDBColorDropDown_OnClick; |
||
987 | info.value = 0; |
||
988 | info.owner = this:GetParent(); |
||
989 | if ( info.value == selectedValue ) then |
||
990 | info.checked = 1; |
||
991 | end |
||
992 | info.tooltipTitle = "Choose your custom color by\nclicking the box to the right."; |
||
993 | UIDropDownMenu_AddButton(info); |
||
994 | |||
995 | info = {}; |
||
996 | info.text = TipBuddy_BDBColor[2]; |
||
997 | info.func = TipBuddy_BDBColorDropDown_OnClick; |
||
998 | info.value = 1; |
||
999 | info.owner = this:GetParent(); |
||
1000 | if ( info.value == selectedValue ) then |
||
1001 | info.checked = 1; |
||
1002 | end |
||
1003 | info.tooltipTitle = "Color will be determined\nby the unit's difficulty\n(red, yellow, grey, etc)."; |
||
1004 | UIDropDownMenu_AddButton(info); |
||
1005 | |||
1006 | info = {}; |
||
1007 | info.text = TipBuddy_BDBColor[3]; |
||
1008 | info.func = TipBuddy_BDBColorDropDown_OnClick; |
||
1009 | info.value = 2; |
||
1010 | info.owner = this:GetParent(); |
||
1011 | if ( info.value == selectedValue ) then |
||
1012 | info.checked = 1; |
||
1013 | end |
||
1014 | info.tooltipTitle = "Color is determined by th\n unit's reaction towards you."; |
||
1015 | UIDropDownMenu_AddButton(info); |
||
1016 | |||
1017 | end |
||
1018 | |||
1019 | --------------------------------------------------------------- |
||
1020 | -- SAVING FRAME POSITION AFTER DRAGGED |
||
1021 | --------------------------------------------------------------- |
||
1022 | -- this function is called when the frame should be dragged around |
||
1023 | function TipBuddy_OnMouseDown(arg1) |
||
1024 | if (arg1 == "LeftButton") then |
||
1025 | TipBuddy_Header_Frame:StartMoving(); |
||
1026 | end |
||
1027 | end |
||
1028 | |||
1029 | -- this function is called when the frame is stopped being dragged around |
||
1030 | function TipBuddy_OnMouseUp(arg1) |
||
1031 | if (arg1 == "LeftButton") then |
||
1032 | TipBuddy_Header_Frame:StopMovingOrSizing(); |
||
1033 | |||
1034 | ValidateFramePosition(this, -10); |
||
1035 | |||
1036 | -- save the position |
||
1037 | TipBuddy_SavedVars["general"].framepos_L = TipBuddy_Header_Frame:GetLeft(); |
||
1038 | TipBuddy_SavedVars["general"].framepos_T = TipBuddy_Header_Frame:GetTop(); |
||
1039 | |||
1040 | |||
1041 | end |
||
1042 | |||
1043 | -- If Rightclick bring up the options menu |
||
1044 | if ( arg1 == "RightButton" ) then |
||
1045 | ToggleDropDownMenu(1, TipBuddy_SavedVars["general"].anchor_pos, TipBuddy_Header_FrameDropDown, this:GetName(), 0, 0); |
||
1046 | UIDropDownMenu_SetSelectedValue(this, TipBuddy_SavedVars["general"].anchor_pos); |
||
1047 | return; |
||
1048 | end |
||
1049 | -- Close all dropdowns |
||
1050 | CloseDropDownMenus(); |
||
1051 | end |
||
1052 | |||
1053 | function TipBuddy_ResetAnchorPos() |
||
1054 | TipBuddy_Header_Frame:Hide(); |
||
1055 | TipBuddy_Header_Frame:Show(); |
||
1056 | TipBuddy_Header_Frame:SetPoint("TOPLEFT", "UIParent", "BOTTOMLEFT", 202, 400); |
||
1057 | |||
1058 | TipBuddy_SavedVars["general"].framepos_L = TipBuddy_Header_Frame:GetLeft(); |
||
1059 | TipBuddy_SavedVars["general"].framepos_T = TipBuddy_Header_Frame:GetTop(); |
||
1060 | end |
||
1061 | |||
1062 | TipBuddy_AnchorPos = { |
||
1063 | [1] = "Top Right", |
||
1064 | [2] = "Top Left", |
||
1065 | [3] = "Bottom Right", |
||
1066 | [4] = "Bottom Left", |
||
1067 | [5] = "Top Center", |
||
1068 | [6] = "Bottom Center", |
||
1069 | }; |
||
1070 | |||
1071 | function TipBuddy_Anchor_OnClick(button) |
||
1072 | -- If Rightclick bring up the options menu |
||
1073 | if ( button == "RightButton" ) then |
||
1074 | ToggleDropDownMenu(0, TipBuddy_SavedVars["general"].anchor_pos, TipBuddy_Header_FrameDropDown, this:GetName(), 0, 0); |
||
1075 | return; |
||
1076 | end |
||
1077 | -- Close all dropdowns |
||
1078 | CloseDropDownMenus(); |
||
1079 | end |
||
1080 | |||
1081 | |||
1082 | function TipBuddy_AnchorDropDown_OnLoad() |
||
1083 | UIDropDownMenu_Initialize(this, TipBuddy_AnchorDropDown_Initialize, "MENU"); |
||
1084 | -- TipBuddy_SavedVars["general"]["anchor_pos"] = TipBuddy_AnchorPos[1]; |
||
1085 | -- UIDropDownMenu_SetSelectedValue(this, nil, TipBuddy_SavedVars["general"]["anchor_pos"]); |
||
1086 | UIDropDownMenu_SetButtonWidth(50); |
||
1087 | UIDropDownMenu_SetWidth(80); |
||
1088 | end |
||
1089 | |||
1090 | -- /script --TB_AddMessage( TipBuddy_SavedVars["general"]["anchor_pos"] ); |
||
1091 | |||
1092 | function TipBuddy_AnchorDropDown_OnClick() |
||
1093 | UIDropDownMenu_SetSelectedValue(TipBuddy_Header_FrameDropDown, this.value); |
||
1094 | -- --TB_AddMessage( UIDropDownMenu_GetSelectedValue(TipBuddy_Header_FrameDropDown) ); |
||
1095 | TipBuddy_SavedVars["general"].anchor_pos = UIDropDownMenu_GetSelectedValue(TipBuddy_Header_FrameDropDown); |
||
1096 | TipBuddy.xpoint, TipBuddy.xpos, TipBuddy.ypos = TipBuddy_GetFrameCursorOffset(); |
||
1097 | TipBuddy.anchor, TipBuddy.fanchor, TipBuddy.offset = TipBuddy_GetFrameAnchorPos(); |
||
1098 | TipBuddy_SetFrame_Anchor( TipBuddy_Main_Frame ); |
||
1099 | GameTooltip_SetDefaultAnchor(GameTooltip, UIParent); |
||
1100 | end |
||
1101 | |||
1102 | function TipBuddy_AnchorDropDown_Initialize() |
||
1103 | local selectedValue = UIDropDownMenu_GetSelectedValue(TipBuddy_Header_FrameDropDown); |
||
1104 | local info; |
||
1105 | |||
1106 | info = {}; |
||
1107 | info.text = TipBuddy_AnchorPos[1]; |
||
1108 | info.func = TipBuddy_AnchorDropDown_OnClick; |
||
1109 | info.value = TipBuddy_AnchorPos[1]; |
||
1110 | if ( info.value == selectedValue ) then |
||
1111 | info.checked = 1; |
||
1112 | end |
||
1113 | info.tooltipTitle = "Anchor tooltip to the TOP RIGHT\nof the TipBuddyAnchor"; |
||
1114 | UIDropDownMenu_AddButton(info); |
||
1115 | |||
1116 | info = {}; |
||
1117 | info.text = TipBuddy_AnchorPos[2]; |
||
1118 | info.func = TipBuddy_AnchorDropDown_OnClick; |
||
1119 | info.value = TipBuddy_AnchorPos[2]; |
||
1120 | if ( info.value == selectedValue ) then |
||
1121 | info.checked = 1; |
||
1122 | end |
||
1123 | info.tooltipTitle = "Anchor tooltip to the TOP LEFT\nof the TipBuddyAnchor"; |
||
1124 | UIDropDownMenu_AddButton(info); |
||
1125 | |||
1126 | info = {}; |
||
1127 | info.text = TipBuddy_AnchorPos[3]; |
||
1128 | info.func = TipBuddy_AnchorDropDown_OnClick; |
||
1129 | info.value = TipBuddy_AnchorPos[3]; |
||
1130 | if ( info.value == selectedValue ) then |
||
1131 | info.checked = 1; |
||
1132 | end |
||
1133 | info.tooltipTitle = "Anchor tooltip to the BOTTOM RIGHT\nof the TipBuddyAnchor"; |
||
1134 | UIDropDownMenu_AddButton(info); |
||
1135 | |||
1136 | info = {}; |
||
1137 | info.text = TipBuddy_AnchorPos[4]; |
||
1138 | info.func = TipBuddy_AnchorDropDown_OnClick; |
||
1139 | info.value = TipBuddy_AnchorPos[4]; |
||
1140 | if ( info.value == selectedValue ) then |
||
1141 | info.checked = 1; |
||
1142 | end |
||
1143 | info.tooltipTitle = "Anchor tooltip to the BOTTOM LEFT\nof the TipBuddyAnchor"; |
||
1144 | UIDropDownMenu_AddButton(info); |
||
1145 | |||
1146 | info = {}; |
||
1147 | info.text = TipBuddy_AnchorPos[5]; |
||
1148 | info.func = TipBuddy_AnchorDropDown_OnClick; |
||
1149 | info.value = TipBuddy_AnchorPos[5]; |
||
1150 | if ( info.value == selectedValue ) then |
||
1151 | info.checked = 1; |
||
1152 | end |
||
1153 | info.tooltipTitle = "Anchor tooltip to the BOTTOM CENTER\nof the TipBuddyAnchor"; |
||
1154 | UIDropDownMenu_AddButton(info); |
||
1155 | |||
1156 | info = {}; |
||
1157 | info.text = TipBuddy_AnchorPos[6]; |
||
1158 | info.func = TipBuddy_AnchorDropDown_OnClick; |
||
1159 | info.value = TipBuddy_AnchorPos[6]; |
||
1160 | if ( info.value == selectedValue ) then |
||
1161 | info.checked = 1; |
||
1162 | end |
||
1163 | info.tooltipTitle = "Anchor tooltip to the TOP CENTER\nof the TipBuddyAnchor"; |
||
1164 | UIDropDownMenu_AddButton(info); |
||
1165 | end |
||
1166 | |||
1167 | function TipBuddy_SetAnchorFrameVis() |
||
1168 | if (TipBuddy_SavedVars["general"].anchored == 1) then |
||
1169 | if (not TipBuddy_SavedVars["general"].anchor_vis_first or TipBuddy_SavedVars["general"].anchor_vis == 1) then |
||
1170 | TipBuddy_SavedVars["general"].anchor_vis_first = 1; |
||
1171 | TipBuddy_Header_Frame:Show(); |
||
1172 | else |
||
1173 | TipBuddy_Header_Frame:Show(); |
||
1174 | TipBuddy_Header_Frame:Hide(); |
||
1175 | end |
||
1176 | else |
||
1177 | if (TipBuddy_Header_Frame:IsVisible()) then |
||
1178 | TipBuddy_Header_Frame:Show(); |
||
1179 | else |
||
1180 | TipBuddy_Header_Frame:Show(); |
||
1181 | TipBuddy_Header_Frame:Hide(); |
||
1182 | end |
||
1183 | end |
||
1184 | end |
||
1185 | |||
1186 | --------------------------------------------------------------- |
||
1187 | -- SAVING DATA AFTER 'OK' |
||
1188 | --------------------------------------------------------------- |
||
1189 | function TipBuddy_OptionsFrame_OnSave() |
||
1190 | -- Checkboxes |
||
1191 | for index, value in TB_Op_Checks do |
||
1192 | local button = getglobal( value.frame ); |
||
1193 | local but = value.frame; --debug |
||
1194 | local tipTable = TipBuddy_SavedVars[value.type]; |
||
1195 | --tipTable.vartype = getglobal( value.var ); |
||
1196 | |||
1197 | if ( button:GetChecked() ) then |
||
1198 | ----TB_AddMessage( "button: "..but.." is checked."); |
||
1199 | tipTable[value.var] = 1; |
||
1200 | ----TB_AddMessage( "Setting button: "..but.." checked ("..tipTable[value.var]..")."); |
||
1201 | else |
||
1202 | tipTable[value.var] = 0; |
||
1203 | end |
||
1204 | end |
||
1205 | |||
1206 | -- Sliders |
||
1207 | for index, value in TipBuddy_OptionsFrame_Sliders do |
||
1208 | local tipTable = TipBuddy_SavedVars["general"]; |
||
1209 | |||
1210 | local slider = getglobal("TipBuddy_OptionsFrame_Slider"..index); |
||
1211 | --if (index == 6) then |
||
1212 | -- tipTable[value.var] = (UIParent:GetScale() * slider:GetValue()); |
||
1213 | --else |
||
1214 | tipTable[value.var] = slider:GetValue(); |
||
1215 | --end |
||
1216 | end |
||
1217 | |||
1218 | -- EditBoxes |
||
1219 | for index, value in TB_EditBoxes do |
||
1220 | local editbox = getglobal( value.frame ); |
||
1221 | local tipTable = TipBuddy_SavedVars[value.type]; |
||
1222 | --tipTable.vartype = getglobal( value.var ); |
||
1223 | |||
1224 | tipTable[value.var] = editbox:GetText(); |
||
1225 | end |
||
1226 | |||
1227 | TipBuddy_SetAnchorFrameVis(); |
||
1228 | |||
1229 | if (UIDropDownMenu_GetSelectedValue(TipBuddy_CursorPosDropDown)) then |
||
1230 | TipBuddy_SavedVars["general"].cursorpos = UIDropDownMenu_GetSelectedValue(TipBuddy_CursorPosDropDown); |
||
1231 | else |
||
1232 | --TB_AddMessage("|cff3366ffTipBuddy_CursorPosDropDown is nil"); |
||
1233 | end |
||
1234 | if (UIDropDownMenu_GetSelectedValue(TipBuddy_NonUnitTipPosDropDown)) then |
||
1235 | TipBuddy_SavedVars["general"].nonunit_anchor = UIDropDownMenu_GetSelectedValue(TipBuddy_NonUnitTipPosDropDown); |
||
1236 | else |
||
1237 | --TB_AddMessage("|cff3366ffTipBuddy_NonUnitTipPosDropDown is nil"); |
||
1238 | end |
||
1239 | if (UIDropDownMenu_GetSelectedValue(TB_PCFriend_TipStyleDropDown)) then |
||
1240 | TipBuddy_SavedVars["pc_friend"].off = UIDropDownMenu_GetSelectedValue(TB_PCFriend_TipStyleDropDown); |
||
1241 | end |
||
1242 | if (UIDropDownMenu_GetSelectedValue(TB_PCParty_TipStyleDropDown)) then |
||
1243 | TipBuddy_SavedVars["pc_party"].off = UIDropDownMenu_GetSelectedValue(TB_PCParty_TipStyleDropDown); |
||
1244 | end |
||
1245 | if (UIDropDownMenu_GetSelectedValue(TB_PCEnemy_TipStyleDropDown)) then |
||
1246 | TipBuddy_SavedVars["pc_enemy"].off = UIDropDownMenu_GetSelectedValue(TB_PCEnemy_TipStyleDropDown); |
||
1247 | end |
||
1248 | if (UIDropDownMenu_GetSelectedValue(TB_NPCFriend_TipStyleDropDown)) then |
||
1249 | TipBuddy_SavedVars["npc_friend"].off = UIDropDownMenu_GetSelectedValue(TB_NPCFriend_TipStyleDropDown); |
||
1250 | end |
||
1251 | if (UIDropDownMenu_GetSelectedValue(TB_NPCNeutral_TipStyleDropDown)) then |
||
1252 | TipBuddy_SavedVars["npc_neutral"].off = UIDropDownMenu_GetSelectedValue(TB_NPCNeutral_TipStyleDropDown); |
||
1253 | end |
||
1254 | if (UIDropDownMenu_GetSelectedValue(TB_NPCEnemy_TipStyleDropDown)) then |
||
1255 | TipBuddy_SavedVars["npc_enemy"].off = UIDropDownMenu_GetSelectedValue(TB_NPCEnemy_TipStyleDropDown); |
||
1256 | end |
||
1257 | if (UIDropDownMenu_GetSelectedValue(TB_PETFriend_TipStyleDropDown)) then |
||
1258 | TipBuddy_SavedVars["pet_friend"].off = UIDropDownMenu_GetSelectedValue(TB_PETFriend_TipStyleDropDown); |
||
1259 | end |
||
1260 | if (UIDropDownMenu_GetSelectedValue(TB_PETEnemy_TipStyleDropDown)) then |
||
1261 | TipBuddy_SavedVars["pet_enemy"].off = UIDropDownMenu_GetSelectedValue(TB_PETEnemy_TipStyleDropDown); |
||
1262 | end |
||
1263 | if (UIDropDownMenu_GetSelectedValue(TB_CORPSE_TipStyleDropDown)) then |
||
1264 | TipBuddy_SavedVars["corpse"].off = UIDropDownMenu_GetSelectedValue(TB_CORPSE_TipStyleDropDown); |
||
1265 | end |
||
1266 | |||
1267 | TipBuddy_Variable_Initialize(); |
||
1268 | TipBuddy.xpoint, TipBuddy.xpos, TipBuddy.ypos = TipBuddy_GetFrameCursorOffset(); |
||
1269 | TipBuddy.anchor, TipBuddy.fanchor, TipBuddy.offset = TipBuddy_GetFrameAnchorPos(); |
||
1270 | TipBuddy.uiScale = TipBuddy_GetUIScale(); |
||
1271 | |||
1272 | local x, y = TipBuddy_PositionFrameToCursor(); |
||
1273 | x = (x / TipBuddy.uiScale); |
||
1274 | y = (y / TipBuddy.uiScale); |
||
1275 | |||
1276 | if (TipBuddy_SavedVars["general"].anchored == 1) then |
||
1277 | TipBuddy_Parent_Frame:SetPoint(TipBuddy.anchor, "TipBuddy_Header_Frame", TipBuddy.fanchor, 0, 0); |
||
1278 | else |
||
1279 | TipBuddy_Parent_Frame:SetPoint(TipBuddy.xpoint, "UIParent", "BOTTOMLEFT", x, y); |
||
1280 | end |
||
1281 | --/script TipBuddy_BuffFrameB1:SetPoint("BOTTOMLEFT", "TipBuddy_Main_Frame", "TOPLEFT", 0, 0); TipBuddy_BuffFrameB1:Show(); |
||
1282 | --TipBuddy_BuffFrame |
||
1283 | |||
1284 | TipBuddy_SetFrame_Anchor( TipBuddy_Main_Frame ); |
||
1285 | GameTooltip_SetDefaultAnchor(GameTooltip, UIParent); |
||
1286 | end |
||
1287 | |||
1288 | ------------------------- |
||
1289 | ---- SAVE FRAME POSITION |
||
1290 | ------------------------- |
||
1291 | -- this function is called when the frame should be dragged around |
||
1292 | function TB_Options_OnMouseDown(arg1) |
||
1293 | if (arg1 == "LeftButton") then |
||
1294 | TipBuddy_OptionsFrame:StartMoving(); |
||
1295 | end |
||
1296 | end |
||
1297 | |||
1298 | -- this function is called when the frame is stopped being dragged around |
||
1299 | function TB_Options_OnMouseUp(arg1) |
||
1300 | |||
1301 | if (arg1 == "LeftButton") then |
||
1302 | TipBuddy_OptionsFrame:StopMovingOrSizing(); |
||
1303 | |||
1304 | ValidateFramePosition(TipBuddy_OptionsFrame, 256); |
||
1305 | |||
1306 | -- save the position |
||
1307 | TipBuddy_SavedVars["general"].opPos_L = TipBuddy_OptionsFrame:GetLeft(); |
||
1308 | TipBuddy_SavedVars["general"].opPos_T = TipBuddy_OptionsFrame:GetTop(); |
||
1309 | --/script TipBuddy_OptionsFrame:SetPoint("CENTER", "UIParent", "CENTER", 0, 0); |
||
1310 | end |
||
1311 | end |
||
1312 | |||
1313 | |||
1314 | function TipBuddy_ClickResetVarsButton() |
||
1315 | StaticPopupDialogs["TIPBUDDY_RESETVARS"] = { |
||
1316 | text = TEXT(TB_RESETVARS_DIALOG), |
||
1317 | button1 = TEXT(ACCEPT), |
||
1318 | button2 = TEXT(DECLINE), |
||
1319 | OnAccept = function() |
||
1320 | TipBuddy_ResetAllVariables(); |
||
1321 | end, |
||
1322 | OnCancel = function() |
||
1323 | this:Hide(); |
||
1324 | end, |
||
1325 | timeout = 60, |
||
1326 | whileDead = 1 |
||
1327 | }; |
||
1328 | StaticPopup_Show("TIPBUDDY_RESETVARS"); |
||
1329 | end |
||
1330 | |||
1331 | function TipBuddy_ResetAllVariables() |
||
1332 | TipBuddy_SavedVars.version = 0; |
||
1333 | TipBuddy_SavedVars = { }; |
||
1334 | TipBuddy_Variable_Initialize(); |
||
1335 | TipBuddy_OptionsFrame_UpdateCheckboxes(); |
||
1336 | TipBuddy_OptionsFrame_UpdateSliders(); |
||
1337 | --TipBuddy_OptionsFrame_UpdateGreyed(); |
||
1338 | TipBuddy_OptionsFrame_UpdateColorButtons(); |
||
1339 | TipBuddy_OptionsFrame_UpdateColorButtons_Text(); |
||
1340 | |||
1341 | TipBuddy_Background_ColorPick_OnLoad(); |
||
1342 | end |