forked from Stanzilla/AdvancedInterfaceOptions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtempfix.lua
More file actions
72 lines (64 loc) · 2.31 KB
/
tempfix.lua
File metadata and controls
72 lines (64 loc) · 2.31 KB
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
-- Temporary hack for Okay button overwriting our settings
-- Blocks the Okay button from being clicked on while our addon panels are active and
-- diverts clicks to the cancel button
local addonName, addon = ...
local E = addon:Eve()
-- Block mouse interaction with our interface panels in combat
local LockdownFrame = CreateFrame('Frame', nil, InterfaceOptionsFramePanelContainer)
LockdownFrame:Hide()
LockdownFrame:SetAllPoints()
LockdownFrame:EnableMouse(true)
LockdownFrame:SetFrameStrata('FULLSCREEN_DIALOG')
local LockdownBg = LockdownFrame:CreateTexture()
LockdownBg:SetAllPoints()
LockdownBg:SetColorTexture(0,0,0,0.6)
local LockdownText = LockdownFrame:CreateFontString(nil, 'ARTWORK', 'GameFontNormalHugeOutline2')
LockdownText:SetTextColor(1, 0, 0)
LockdownText:SetPoint('CENTER')
LockdownText:SetText("CAN'T MODIFY CVARS IN COMBAT")
local OkayGo = CreateFrame('Button', nil, InterfaceOptionsFrameOkay)
OkayGo:Hide()
OkayGo:SetAllPoints()
OkayGo:SetScript('OnEnter', function() InterfaceOptionsFrameOkay:LockHighlight() end)
OkayGo:SetScript('OnLeave', function() InterfaceOptionsFrameOkay:UnlockHighlight() end)
OkayGo:SetScript('OnMouseDown', function()
InterfaceOptionsFrameOkay:SetButtonState('PUSHED', false)
end)
OkayGo:SetScript('OnMouseUp', function(self)
InterfaceOptionsFrameOkay:SetButtonState('NORMAL', false)
if MouseIsOver(self) and not InCombatLockdown() then
--InterfaceOptionsFrame:Hide()
HideUIPanel(InterfaceOptionsFrame)
--InterfaceOptionsFrameCancel:Click() -- taints regardless of whether you're in combat
end
end)
for k,f in pairs(INTERFACEOPTIONS_ADDONCATEGORIES) do
if f.name == addonName or f.parent == addonName then
f:HookScript('OnShow', function()
OkayGo:Show()
if InCombatLockdown() then
LockdownFrame:Show()
OkayGo:EnableMouse(false)
else
OkayGo:EnableMouse(true)
end
end)
f:HookScript('OnHide', function()
OkayGo:Hide()
LockdownFrame:Hide()
end)
end
end
function E:PLAYER_REGEN_DISABLED()
if OkayGo:IsShown() then
-- InterfaceOptionsFrameCancel:Click() -- this seems to taint even though it shouldn't
OkayGo:EnableMouse(false)
LockdownFrame:Show()
end
end
function E:PLAYER_REGEN_ENABLED()
OkayGo:EnableMouse(true)
if LockdownFrame:IsShown() then
LockdownFrame:Hide()
end
end