forked from isalcedo/VanillaGuide
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Frame_SettingsFrame.lua
530 lines (502 loc) · 19.9 KB
/
Frame_SettingsFrame.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
--[[--------------------------------------------------
----- VanillaGuide -----
------------------
Frame_SettingsFrame.lua
Authors: mrmr
Version: 1.04.3
------------------------------------------------------
Description:
Settings Frame Object
1.00
-- Initial Ace2 release
1.99a
-- Ally addition starter version
1.03
-- No Changes. Just adjusting "version".
1.99x for a beta release was a weird choise.
1.04.1
-- Settings Frame object
1.04.2
-- One more setting for MetaMapNotes
(like the one for MetaMapBWP)
1.04.3
-- no changes in here for this revision
------------------------------------------------------
Connection:
--]]--------------------------------------------------
--local VGuide = VGuide
Dv(" VGuide Frame_SettingsFrame.lua Start")
objSettingsFrame = {}
objSettingsFrame.__index = objSettingsFrame
function objSettingsFrame:new(fParent, tTexture, oSettings)
fParent = fParent or nil
local obj = {}
setmetatable(obj, self)
local tCharInfo = oSettings:GetSettingsCharInfo()
local tUI = oSettings:GetSettingsUI()
--local tMetaMapBWP = oSettings:GetSettingsMetaMapBWP()
local tMetaMap = oSettings:GetSettingsMetaMap()
local bMinimapToggle = tUI.MinimapToggle
local nMinimapPos = tUI.MinimapPos
local nStepScroll = tUI.StepScroll
local nOpacity = tUI.Opacity
local nScale = tUI.Scale
local sLayer = tUI.Layer
local Layers = {
["DIALOG"] = 5,
["HIGH"] = 4,
["MEDIUM"] = 3,
["LOW"] = 2,
["BACKGROUND"] = 1,
[5] = "DIALOG",
[4] = "HIGH",
[3] = "MEDIUM",
[2] = "LOW",
[1] = "BACKGROUND",
}
local function Render_SF(fParent, sName)
local frame = CreateFrame("Frame", sName)
frame:SetScale(1)
frame:SetFrameStrata("TOOLTIP")
frame:SetWidth(220)
frame:SetHeight(315)
-- detach Setting frame from Main Frame, avoiding "scale" bug
--frame:SetPoint("TOPRIGHT", fParent, "TOPLEFT", -10, 0)
frame:SetPoint("CENTER", nil, "CENTER", 0, 0)
frame:SetBackdrop(tTexture.BACKDROP)
frame:SetBackdropColor(.01, .01, .01, .91)
frame:SetMovable(true)
frame:EnableMouse(true)
frame:SetClampedToScreen(true)
frame:RegisterForDrag("LeftButton")
frame.showthis = false
return frame
end
local function Render_SFCloseButton(fParent, tTexture, sName)
local btn = CreateFrame("Button", sName, fParent)
btn:SetWidth(16)
btn:SetHeight(16)
btn:SetNormalTexture(tTexture.B_CLOSE.NORMAL)
btn:SetPushedTexture(tTexture.B_CLOSE.PUSHED)
btn:SetHighlightTexture(tTexture.B_CLOSE.HIGHLIGHT)
btn:SetPoint("TOPRIGHT", fParent, "TOPRIGHT", -5, -5)
return btn
end
local function Render_SFMetamapNotesSupportCheckBox(fParent, sName, tMetaMap)
local chkbtn = CreateFrame("CheckButton", sName, fParent, "UICheckButtonTemplate")
chkbtn:SetWidth(20)
chkbtn:SetHeight(20)
chkbtn.tooltip = "Enable the creation of MetaMap Notes on the WorldMap.";
getglobal(chkbtn:GetName() .. 'Text'):SetText(" MetaMapNotes Support")
if tMetaMap.NotesPresence then
chkbtn:Enable()
else
chkbtn:Disable()
end
if chkbtn:IsEnabled() then
if tMetaMap.NotesEnable then
chkbtn:SetChecked(true)
else
chkbtn:SetChecked(false)
end
else
chkbtn:SetChecked(false)
end
return chkbtn
end
local function Render_SFMetamapBWPSupportCheckBox(fParent, sName, tMetaMap)
local chkbtn = CreateFrame("CheckButton", sName, fParent, "UICheckButtonTemplate")
chkbtn:SetWidth(20)
chkbtn:SetHeight(20)
chkbtn.tooltip = "Enable the appearance of MetaMapBWP arrow. Just an Arrow pointing where you need to go.";
getglobal(chkbtn:GetName() .. 'Text'):SetText(" MetaMapBWP Support")
if tMetaMap.BWPPresence then
chkbtn:Enable()
else
chkbtn:Disable()
end
if chkbtn:IsEnabled() then
if tMetaMap.BWPEnable then
chkbtn:SetChecked(true)
else
chkbtn:SetChecked(false)
end
else
chkbtn:SetChecked(false)
end
return chkbtn
end
local function Render_SFMinimapCheckBox(fParent, sName)
local checkbutton = CreateFrame("CheckButton", sName, fParent, "UICheckButtonTemplate")
checkbutton:SetWidth(20)
checkbutton:SetHeight(20)
checkbutton:SetPoint("TOPLEFT", fParent, "TOPLEFT", 10, -10)
getglobal(checkbutton:GetName() .. 'Text'):SetText("Minimap Button")
if bMinimapToggle then
checkbutton:SetChecked(true)
else
checkbutton:SetChecked(false)
end
return checkbutton
end
local function Render_SFColorSwatch(fParent, sText, tUI)
local tCol = nil
if sText == "VG_MainFrame" then
tCol = tUI.MainFrameColor
elseif sText == "VG_MainFrame_StepFrame" then
tCol = tUI.StepFrameColor
elseif sText == "VG_MainFrame_ScrollFrame" then
tCol = tUI.ScrollFrameColor
elseif sText == "VG_MainFrame_StepFrameLabel" then
tCol = tUI.StepFrameTextColor
elseif sText == "VG_MainFrame_ScrollFrameLabels" then
tCol = tUI.ScrollFrameTextColor
end
local sSwatchName = "VG_ColorSwatch" .. "_" .. sText
local btn = CreateFrame("Button", sSwatchName, fParent)--, "OptionsCheckButtonTemplate")
local background = btn:CreateTexture(nil, "BACKGROUND")
background:SetWidth(16)
background:SetHeight(16)
background:SetPoint("CENTER", 0, 0)
background:SetTexture(.3, .3, .3, 1)
local artwork = btn:CreateTexture(nil, "ARTWORK")
artwork:SetWidth(13)
artwork:SetHeight(13)
artwork:SetPoint("CENTER", 0, 0)
artwork:SetTexture(tCol.nR, tCol.nG, tCol.nB, tCol.nA)
btn.background = background
btn.artwork = artwork
btn:SetWidth(16)
btn:SetHeight(16)
btn:SetNormalTexture(artwork)
btn:SetScript( "OnClick", function()
local frame = getglobal(sText)
local tCol = nil
local opacitySlider = nil
if sText == "VG_MainFrame" then
tCol = tUI.MainFrameColor
opacitySlider = true
elseif sText == "VG_MainFrame_StepFrame" then
tCol = tUI.StepFrameColor
opacitySlider = true
elseif sText == "VG_MainFrame_ScrollFrame" then
tCol = tUI.ScrollFrameColor
opacitySlider = true
elseif sText == "VG_MainFrame_StepFrameLabel" then
tCol = tUI.StepFrameTextColor
opacitySlider = false
elseif sText == "VG_MainFrame_ScrollFrameLabels" then
tCol = tUI.ScrollFrameTextColor
opacitySlider = false
end
local r1, g1, b1, a1 = tCol.nR, tCol.nG, tCol.nB, tCol.nA
if ColorPickerFrame:IsShown() then
ColorPickerFrame:Hide()
else
ColorPickerFrame.func = function(pV)
local nr, ng, nb, na
if pV then
-- The user bailed, we extract the old color from the table created by ShowColorPicker.
nr, ng, nb, na = pV.r, pV.g, pV.b, pV.a
ColorPickerFrame.previousValues = {}
else
-- Something changed
nr, ng, nb = ColorPickerFrame:GetColorRGB();
na = 1 - OpacitySliderFrame:GetValue()
end
r1, g1, b1, a1 = nr, ng, nb, na
btn.artwork:SetVertexColor(r1, g1, b1, a1)
--btn.background:SetVertexColor(r1, g1, b1, a1)
if sText == "VG_MainFrame" then
frame:SetBackdropColor(r1, g1, b1, a1)
--VGuide.db.char.UIoptions.MainFrameColor = {
tUI.MainFrameColor = {
nR = r1, nG = g1, nB = b1, nA = a1,
}
oSettings:SetSettingsUI(tUI)
elseif sText == "VG_MainFrame_StepFrame" then
frame:SetBackdropColor(r1, g1, b1, a1)
--VGuide.db.char.UIoptions.StepFrameColor = {
tUI.StepFrameColor = {
nR = r1, nG = g1, nB = b1, nA = a1,
}
oSettings:SetSettingsUI(tUI)
elseif sText == "VG_MainFrame_ScrollFrame" then
frame:SetBackdropColor(r1, g1, b1, a1)
--VGuide.db.char.UIoptions.ScrollFrameColor = {
tUI.ScrollFrameColor = {
nR = r1, nG = g1, nB = b1, nA = a1,
}
oSettings:SetSettingsUI(tUI)
elseif sText == "VG_MainFrame_StepFrameLabel" then
a1 = .99
frame:SetTextColor(r1, g1, b1, a1)
--VGuide.db.char.UIoptions.StepFrameTextColor = {
tUI.ScrollFrameColor = {
nR = r1, nG = g1, nB = b1, nA = a1,
}
oSettings:SetSettingsUI(tUI)
elseif sText == "VG_MainFrame_ScrollFrameLabels" then
local frame = getglobal("VG_MainFrame_ScrollFrameChild")
local shEH = frame.Entries
a1 = .71
for _,v in pairs(shEH) do
v:SetTextColor(r1, g1, b1, a1)
end
--VGuide.db.char.UIoptions.ScrollFrameTextColor = {
tUI.ScrollFrameColor = {
nR = r1, nG = g1, nB = b1, nA = a1,
}
oSettings:SetSettingsUI(tUI)
end
end
ColorPickerFrame.cancelFunc = ColorPickerFrame.func
ColorPickerFrame.opacityFunc = ColorPickerFrame.func
ColorPickerFrame.hasOpacity = opacitySlider
ColorPickerFrame.opacity = 1 - a1
ColorPickerFrame.previousValues = { r = r1, g = g1, b = b1, a = a1}
Dv(" -- r1: "..r1)
Dv(" -- g1: "..g1)
Dv(" -- b1: "..b1)
Dv(" -- a1: " .. a1)
ColorPickerFrame:SetColorRGB(r1, g1, b1, a1);
ColorPickerFrame:Hide(); -- Need to run the OnShow handler.
ColorPickerFrame:Show();
end
end)
return btn
end
local function Render_SFColorSwatchLabel(fParent, sText)
local fs = fParent:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
fs:SetPoint("LEFT", fParent, "RIGHT", 10, 0)
fs:SetText(sText)
return fs
end
local function Render_Button(fParent, sName, nWidth, nHeight, tTexture)
local btn = CreateFrame("Button", sName, fParent)
btn:SetWidth(nWidth)
btn:SetHeight(nHeight)
btn:SetNormalTexture(tTexture.NORMAL)
btn:SetPushedTexture(tTexture.PUSHED)
btn:SetHighlightTexture(tTexture.HIGHLIGHT)
btn:RegisterForClicks("LeftButtonUp")
return btn
end
local function Render_SFSlider(fParent, sName, sText, sLow, sHigh, nMin, nMax, nValue, sAppend)
local sldr = CreateFrame("Slider", sName, fParent, "OptionsSliderTemplate")
sldr:SetOrientation("HORIZONTAL");
sldr:SetWidth(195)
sldr:SetHeight(14)
sldr:SetPoint("TOP", fParent, "TOP", 0, -200)
getglobal(sldr:GetName() .. 'Text'):SetText(sText); --Sets the "title" text (top-centre of slider).
getglobal(sldr:GetName() .. 'Low'):SetText(sLow); --Sets the left-side slider text (default is "Low").
getglobal(sldr:GetName() .. 'High'):SetText(sHigh); --Sets the right-side slider text (default is "High").
sldr:SetValueStep(1)
sldr:SetMinMaxValues(nMin, nMax)
sldr:SetValue(nValue)
local fs = sldr:CreateFontString(nil, "ARTWORK", "GameFontNormalSmall")
fs:SetTextColor(.59, .59, .59, 1)
fs:SetJustifyH("CENTER")
fs:SetJustifyV("BOTTOM")
fs:SetPoint("CENTER", sldr, "BOTTOM", 0, -2)
if sAppend then
fs:SetText(tostring(nValue) .. sAppend)
else
fs:SetText(tostring(nValue))
end
sldr.fs = fs
return sldr
end
obj.tWidgets = {}
-------------------------------
--- Rendering
-------------------------------
do
-- Settings Frame
obj.tWidgets.frame_SettingFrame = Render_SF(fParent, "VG_SettingsFrame")
obj.tWidgets.button_CloseButton = Render_Button(obj.tWidgets.frame_SettingFrame, nil, 16, 16, tTexture.B_CLOSE)
obj.tWidgets.button_CloseButton:SetPoint("TOPRIGHT", obj.tWidgets.frame_SettingFrame, "TOPRIGHT", -5, -5)
obj.tWidgets.checkbutton_MetaMapNotesSupport = Render_SFMetamapNotesSupportCheckBox(obj.tWidgets.frame_SettingFrame, "VG_SettingsFrame_MetaMapNotesCheckButton", tMetaMap)
obj.tWidgets.checkbutton_MetaMapNotesSupport:SetPoint("TOPLEFT", obj.tWidgets.frame_SettingFrame, "TOPLEFT", 8, -5)
obj.tWidgets.checkbutton_MetaMapBWPSupport = Render_SFMetamapBWPSupportCheckBox(obj.tWidgets.frame_SettingFrame, "VG_SettingsFrame_MetaMapBWPCheckButton", tMetaMap)
obj.tWidgets.checkbutton_MetaMapBWPSupport:SetPoint("TOPLEFT", obj.tWidgets.frame_SettingFrame, "TOPLEFT", 8, -20)
--tWidgets.checkbutton_Minimap = Render_SFMinimapCheckBox(tWidgets.frame_SettingFrame, "VG_SettingsFrame_MinimapCheckButton")
--tWidgets.slider_Minimap = Render_SFSlider(tWidgets.frame_SettingFrame, "VG_SettingFrame_MinimapSlider", "Minimap Button Placement", "-180", "+180", -180, 180, math.floor(nMinimapPos), nil)
--tWidgets.slider_Minimap:SetPoint("TOP", tWidgets.frame_SettingFrame, "TOP", 0, -40)
obj.tWidgets.colorpicker_StepFrameTextColor = Render_SFColorSwatch(obj.tWidgets.frame_SettingFrame, "VG_MainFrame_StepFrameLabel", tUI)
obj.tWidgets.colorpicker_StepFrameTextColor:SetPoint("TOPLEFT", obj.tWidgets.frame_SettingFrame, "TOPLEFT", 10, -45)
obj.tWidgets.fs_ColorPickerStepFrameTextColor = Render_SFColorSwatchLabel(obj.tWidgets.colorpicker_StepFrameTextColor, "StepFrame TextColor")
obj.tWidgets.colorpicker_ScrollFrameTextColor = Render_SFColorSwatch(obj.tWidgets.frame_SettingFrame, "VG_MainFrame_ScrollFrameLabels", tUI)
obj.tWidgets.colorpicker_ScrollFrameTextColor:SetPoint("TOPLEFT", obj.tWidgets.frame_SettingFrame, "TOPLEFT", 10, -63)
obj.tWidgets.fs_ColorPickerScrollFrameTextColor = Render_SFColorSwatchLabel(obj.tWidgets.colorpicker_ScrollFrameTextColor, "ScrollFrame TextColor")
obj.tWidgets.colorpicker_MainFrame = Render_SFColorSwatch(obj.tWidgets.frame_SettingFrame, "VG_MainFrame", tUI)
obj.tWidgets.colorpicker_MainFrame:SetPoint("TOPLEFT", obj.tWidgets.frame_SettingFrame, "TOPLEFT", 10, -93)
obj.tWidgets.fs_ColorPickerMainFrame = Render_SFColorSwatchLabel(obj.tWidgets.colorpicker_MainFrame, "MainFrame Background")
obj.tWidgets.colorpicker_StepFrame = Render_SFColorSwatch(obj.tWidgets.frame_SettingFrame, "VG_MainFrame_StepFrame", tUI)
obj.tWidgets.colorpicker_StepFrame:SetPoint("TOPLEFT", obj.tWidgets.frame_SettingFrame, "TOPLEFT", 10, -110)
obj.tWidgets.fs_ColorPickerStepFrame = Render_SFColorSwatchLabel(obj.tWidgets.colorpicker_StepFrame , "StepFrame Tint")
obj.tWidgets.colorpicker_ScrollFrame = Render_SFColorSwatch(obj.tWidgets.frame_SettingFrame, "VG_MainFrame_ScrollFrame", tUI)
obj.tWidgets.colorpicker_ScrollFrame:SetPoint("TOPLEFT", obj.tWidgets.frame_SettingFrame, "TOPLEFT", 10, -127)
obj.tWidgets.fs_ColorPickerScrollFrame = Render_SFColorSwatchLabel(obj.tWidgets.colorpicker_ScrollFrame, "ScrollFrame Tint")
obj.tWidgets.slider_StepScroll = Render_SFSlider(obj.tWidgets.frame_SettingFrame, "VG_SettingsFrame_StepScrollSlider", "Value", "15%", "55%", 15, 55, math.floor(nStepScroll*100), "%")
obj.tWidgets.slider_StepScroll:SetPoint("TOP", obj.tWidgets.frame_SettingFrame, "TOP", 0, -160)
obj.tWidgets.slider_Opacity = Render_SFSlider(obj.tWidgets.frame_SettingFrame, "VG_SettingsFrame_OpacitySlider", "Opacity", "15%", "100%", 15, 100, math.floor(nOpacity*100), "%")
obj.tWidgets.slider_Opacity:SetPoint("TOP", obj.tWidgets.frame_SettingFrame, "TOP", 0, -200)
obj.tWidgets.slider_Scale = Render_SFSlider(obj.tWidgets.frame_SettingFrame, "VG_SettingsFrame_ScaleSlider", "Scale", "25%", "175%", 25, 175, math.floor(nScale*100), "%")
obj.tWidgets.slider_Scale:SetPoint("TOP", obj.tWidgets.frame_SettingFrame, "TOP", 0, -240)
obj.tWidgets.slider_Layer = Render_SFSlider(obj.tWidgets.frame_SettingFrame, "VG_SettingsFrame_LayerSlider", "Layer", "BG", "DIALOG", 1, 5, Layers[sLayer], sLayer)
obj.tWidgets.slider_Layer:SetPoint("TOP", obj.tWidgets.frame_SettingFrame, "TOP", 0, -280)
obj.tWidgets.slider_Layer.fs:SetText(sLayer)
end
-------------------------------
--- UI Events Handling
-------------------------------
obj.tWidgets.frame_SettingFrame:SetScript("OnMouseDown", function()
if arg1 == "LeftButton" and not this.isMoving then
this:StartMoving();
this.isMoving = true;
end
end)
obj.tWidgets.frame_SettingFrame:SetScript("OnMouseUp", function()
if arg1 == "LeftButton" and this.isMoving then
this:StopMovingOrSizing();
this.isMoving = false;
end
end)
obj.tWidgets.frame_SettingFrame:SetScript("OnHide", function()
if this.isMoving then
this:StopMovingOrSizing();
this.isMoving = false;
end
end)
obj.tWidgets.button_CloseButton:SetScript("OnClick", function()
local frame = this:GetParent()
frame:Hide()
frame.showthis = false
end)
obj.tWidgets.checkbutton_MetaMapNotesSupport:SetScript("OnClick", function()
if arg1 == "LeftButton" then
local bVal = this:GetChecked()
local tMetaMap = oSettings:GetSettingsMetaMap()
if not bVal then
tMetaMap.NotesEnable = false
else
tMetaMap.NotesEnable = true
end
oSettings:SetSettingsMetaMap(tMetaMap)
end
end)
obj.tWidgets.checkbutton_MetaMapBWPSupport:SetScript("OnClick", function()
if arg1 == "LeftButton" then
local bVal = this:GetChecked()
local tMetaMap = oSettings:GetSettingsMetaMap()
if not bVal then
tMetaMap.BWPEnable = false
else
tMetaMap.BWPEnable = true
end
oSettings:SetSettingsMetaMap(tMetaMap)
end
end)
--[[obj.tWidgets.checkbutton_Minimap:SetScript("OnClick", function()
if arg1 == "LeftButton" then
local button = getglobal("VG_MinimapButton")
local bVal = this:GetChecked()
if bVal == 1 then
button:Show()
button.closethis = false
--VGuide.db.profile.UIoptions.MinimapToggle = true
tUInew.UI.MinimapToggle = true
else
button:Hide()
button.closethis = true
--VGuide.db.profile.UIoptions.MinimapToggle = false
tUInew.UI.MinimapToggle = false
end
end
end)
]]
--[[obj.tWidgets.slider_Minimap:SetScript("OnValueChanged", function()
local nVal = this:GetValue()
local button = getglobal("VG_bMinimap")
UI.PositionMinimapButton(button, nVal)
--VGuide.db.profile.UIoptions.MinimapPos = nVal
tUInew.UI.MinimapPos = nVal
this.fs:SetText(nVal)
end)
]]
obj.tWidgets.slider_StepScroll:SetScript("OnValueChanged", function()
local nVal = arg1
local fMain = getglobal("VG_MainFrame")
local fStep = getglobal("VG_MainFrame_StepFrame")
local fScroll = getglobal("VG_MainFrame_ScrollFrame")
local fChild = getglobal("VG_MainFrame_ScrollFrameChild")
local bStepFrame = tUI.StepFrameVisible
local bScrollFrame = tUI.ScrollFrameVisible
if bStepFrame and bScrollFrame then
local nfMHeight = fMain:GetHeight()
local nPer = nfMHeight * (1 - nVal/100)
local nGap = nPer - (nfMHeight/2)
fStep:SetPoint("TOPLEFT", fMain, "TOPLEFT", 5, -23)
fStep:SetPoint("BOTTOMRIGHT", fMain, "RIGHT", -5, nGap)
fScroll:SetPoint("TOPLEFT", fStep, "BOTTOMLEFT", 0, -2)
--UI.SetSliderMinMax(fChild.nFSTotalHeight)
end
--VGuide.db.profile.UIoptions.StepScroll = nVal/100
--VGuide.db.char.UIoptions.StepScroll = nVal/100
tUI.StepScroll = nVal/100
oSettings:SetSettingsUI(tUI)
this.fs:SetText(nVal.."%")
end)
obj.tWidgets.slider_Opacity:SetScript("OnValueChanged", function()
local nVal = arg1
local frame = getglobal("VG_MainFrame")
frame:SetAlpha(nVal/100)
--VGuide.db.profile.UIoptions.Opacity = nVal/100
--VGuide.db.char.UIoptions.Opacity = nVal/100
tUI.Opacity = nVal/100
oSettings:SetSettingsUI(tUI)
this.fs:SetText(nVal.."%")
end)
obj.tWidgets.slider_Scale:SetScript("OnValueChanged", function()
local nVal = arg1
local frame = getglobal("VG_MainFrame")
frame:SetScale(nVal/100)
--VGuide.db.profile.UIoptions.Scale = nVal/100
--VGuide.db.char.UIoptions.Scale = nVal/100
tUI.Scale = nVal/100
oSettings:SetSettingsUI(tUI)
this.fs:SetText(nVal.."%")
end)
obj.tWidgets.slider_Layer:SetScript("OnValueChanged", function()
local nVal = arg1
local frame = getglobal("VG_MainFrame")
--VGuide.db.profile.UIoptions.Layer = Layers[nVal]
--VGuide.db.char.UIoptions.Layer = Layers[nVal]
tUI.Layer = Layers[nVal]
oSettings:SetSettingsUI(tUI)
--frame:SetFrameStrata(VGuide.db.char.UIoptions.Layer)
--this.fs:SetText(VGuide.db.char.UIoptions.Layer)
frame:SetFrameStrata(tUI.Layer)
this.fs:SetText(tUI.Layer)
end)
-------------------------------
--- Initialization
-------------------------------
obj.tWidgets.frame_SettingFrame:Hide()
--obj.tWidgets.frame_SettingFrame:Show()
obj.ShowFrame = function(self)
local f = obj.tWidgets.frame_SettingsFrame
if not f:IsVisible() then
f:Show()
end
end
obj.HideFrame = function(self)
local f = obj.tWidgets.frame_SettingsFrame
if f:IsVisible() then
f:Hide()
end
end
return obj
end
Dv(" VGuide Frame_SettingsFrame.lua End")