-
-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathoptions.lua
More file actions
151 lines (129 loc) · 4.82 KB
/
Copy pathoptions.lua
File metadata and controls
151 lines (129 loc) · 4.82 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
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
local _, MySlot = ...
local L = MySlot.L
local RegEvent = MySlot.regevent
local f = CreateFrame("Frame", nil, UIParent)
f.name = L["Myslot"]
local category = Settings.RegisterCanvasLayoutCategory(f, L["Myslot"])
MySlot.settingcategory = category
Settings.RegisterAddOnCategory(category)
RegEvent("ADDON_LOADED", function()
do
local t = f:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
t:SetText(L["Myslot"])
t:SetPoint("TOPLEFT", f, 15, -15)
end
do
local t = f:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
t:SetText(L["Feedback"] .. " farmer1992@gmail.com")
t:SetPoint("TOPLEFT", f, 15, -50)
end
do
local b = CreateFrame("Button", nil, f, "GameMenuButtonTemplate")
b:SetWidth(240)
b:SetHeight(25)
b:SetPoint("TOPLEFT", 15, -80)
b:SetText(L["Open Myslot"])
b:SetScript("OnClick", function()
MySlot.MainFrame:Show()
end)
end
MyslotSettings = MyslotSettings or {}
do
MyslotSettings.minimap = MyslotSettings.minimap or { hide = false }
local config = MyslotSettings.minimap
local b = CreateFrame("CheckButton", nil, f, "UICheckButtonTemplate")
b:SetPoint("TOPLEFT", f, 15, -110)
b.text = b:CreateFontString(nil, "OVERLAY", "GameFontNormal")
b.text:SetPoint("LEFT", b, "RIGHT", 0, 1)
b.text:SetText(L["Minimap Icon"])
b:SetChecked(not config.hide)
b:SetScript("OnClick", function()
config.hide = not b:GetChecked()
local icon = LibStub("LibDBIcon-1.0")
if b:GetChecked() then
icon:Show("Myslot")
else
icon:Hide("Myslot")
end
end)
end
local doffset = -160
do
local t = f:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
t:SetText(RED_FONT_COLOR:WrapTextInColorCode(L["DANGEROUS"]))
t:SetPoint("TOPLEFT", f, 15, doffset)
end
-- Running vertical cursor so hidden rows (e.g. Cooldown Manager on Classic)
-- don't leave a gap; each row advances the offset by 30px.
local rowy = doffset - 20
local function AddClearButton(text, what)
local b = CreateFrame("Button", nil, f, "GameMenuButtonTemplate")
b:SetWidth(240)
b:SetHeight(25)
b:SetPoint("TOPLEFT", 15, rowy)
b:SetText(text)
b:SetScript("OnClick", function()
StaticPopup_Show("MYSLOT_CONFIRM_CLEAR", what, nil, what)
end)
rowy = rowy - 30
end
AddClearButton(L["Remove everything in ActionBar"], "ACTION")
AddClearButton(L["Remove all Key Bindings"], "BINDING")
AddClearButton(L["Remove all Macros"], "MACRO")
-- Cooldown Manager is retail-only; only offer it where supported.
if MySlot:IsCooldownManagerSupported() then
AddClearButton(L["Remove all Cooldown Manager"], "COOLDOWNMANAGER")
end
-- Click Cast Bindings are retail-only; only offer it where supported.
if MySlot:IsClickBindingSupported() then
AddClearButton(L["Remove all Click Cast Bindings"], "CLICKBINDING")
end
do
local b = CreateFrame("CheckButton", nil, f, "UICheckButtonTemplate")
b:SetPoint("TOPLEFT", f, 15, rowy)
b.text = b:CreateFontString(nil, "OVERLAY", "GameFontNormal")
b.text:SetPoint("LEFT", b, "RIGHT", 0, 1)
b.text:SetText(L["Allow"] .. " " .. "|cffff0000" .. L["CLEAR"] .. "|r" .. " " .. L[" before Import"])
b:SetChecked(MyslotSettings.allowclearonimport)
b:SetScript("OnClick", function()
MyslotSettings.allowclearonimport = b:GetChecked()
end)
end
end)
StaticPopupDialogs["MYSLOT_CONFIRM_CLEAR"] = {
text = L["Please type %s to confirm"],
button1 = ACCEPT,
button2 = CANCEL,
hasEditBox = true,
timeout = 0,
whileDead = 1,
hideOnEscape = 1,
multiple = 0,
OnAccept = function(self, data)
local editBox = self.GetEditBox and self:GetEditBox() or self.editBox
local tx = editBox:GetText()
if tx == data then
MySlot:Clear(data, {
[1] = true,
[2] = true,
[3] = true,
[4] = true,
[5] = true,
[6] = true,
[7] = true,
[8] = true,
[9] = true,
[10] = true,
[11] = true,
[12] = true,
[13] = true,
[14] = true,
[15] = true,
["ACCOUNT"] = true,
["CHARACTOR"] = true,
})
else
MySlot:Print(L["Please type %s to confirm"]:format(data))
end
end,
}