adam@0
|
1 local addonName, AskMrRobot = ...
|
adam@0
|
2 local L = AskMrRobot.L
|
adam@0
|
3
|
adam@0
|
4 local wow_ver = select(4, GetBuildInfo())
|
adam@0
|
5 local wow_500 = wow_ver >= 50000
|
adam@0
|
6 local UIPanelButtonTemplate = wow_500 and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2"
|
adam@0
|
7
|
adam@0
|
8 local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
|
adam@0
|
9 frame.name = addonName
|
adam@0
|
10 frame:Hide()
|
adam@0
|
11
|
adam@0
|
12 -- Credits to Ace3, Tekkub, cladhaire and Tuller for some of the widget stuff.
|
adam@0
|
13
|
adam@0
|
14 local function newCheckbox(label, tooltipTitle, description, onClick)
|
adam@0
|
15 local check = CreateFrame("CheckButton", "AmrCheck" .. label, frame, "InterfaceOptionsCheckButtonTemplate")
|
adam@0
|
16 check:SetScript("OnClick", function(self)
|
adam@0
|
17 PlaySound(self:GetChecked() and "igMainMenuOptionCheckBoxOn" or "igMainMenuOptionCheckBoxOff")
|
adam@0
|
18 onClick(self, self:GetChecked() and true or false)
|
adam@0
|
19 end)
|
adam@0
|
20 check.label = _G[check:GetName() .. "Text"]
|
adam@0
|
21 check.label:SetText(label)
|
adam@0
|
22 check.tooltipText = tooltipTitle
|
adam@0
|
23 check.tooltipRequirement = description
|
adam@0
|
24 return check
|
adam@0
|
25 end
|
adam@0
|
26
|
adam@0
|
27 frame:SetScript("OnShow", function(frame)
|
adam@0
|
28 local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
|
adam@0
|
29 title:SetPoint("TOPLEFT", 16, -16)
|
adam@0
|
30 title:SetText(addonName)
|
adam@0
|
31
|
adam@0
|
32 local subTitleWrapper = CreateFrame("Frame", nil, frame)
|
adam@0
|
33 subTitleWrapper:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8)
|
adam@0
|
34 subTitleWrapper:SetPoint("RIGHT", -16, 0)
|
adam@0
|
35 local subtitle = subTitleWrapper:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
adam@0
|
36 subtitle:SetPoint("TOPLEFT", subTitleWrapper)
|
adam@0
|
37 subtitle:SetWidth(subTitleWrapper:GetRight() - subTitleWrapper:GetLeft())
|
adam@0
|
38 subtitle:SetJustifyH("LEFT")
|
adam@0
|
39 subtitle:SetNonSpaceWrap(false)
|
adam@0
|
40 subtitle:SetJustifyV("TOP")
|
yellowfive@11
|
41 subtitle:SetText(L.AMR_CONFIG_EXIMPORT)
|
adam@0
|
42 subTitleWrapper:SetHeight(subtitle:GetHeight())
|
adam@0
|
43
|
adam@17
|
44 -- hide minimap icon
|
adam@0
|
45 local autoPopup = newCheckbox(
|
yellowfive@11
|
46 L.AMR_CONFIG_CHECKBOX_MINIMAP_LABEL,
|
yellowfive@11
|
47 L.AMR_CONFIG_CHECKBOX_MINIMAP_TOOLTIP_TITLE,
|
yellowfive@11
|
48 L.AMR_CONFIG_CHECKBOX_MINIMAP_DESCRIPTION,
|
adam@0
|
49 function(self, value)
|
adam@17
|
50 if AmrDb.Options.hideMapIcon then
|
adam@17
|
51 AmrDb.Options.hideMapIcon = false
|
adam@0
|
52 else
|
adam@17
|
53 AmrDb.Options.hideMapIcon = true
|
adam@0
|
54 end
|
adam@0
|
55 AskMrRobot.AmrUpdateMinimap();
|
adam@0
|
56 end
|
adam@0
|
57 )
|
adam@17
|
58 autoPopup:SetChecked(not AmrDb.Options.hideMapIcon)
|
adam@0
|
59 autoPopup:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -16)
|
adam@0
|
60
|
adam@0
|
61
|
adam@17
|
62 -- auto-show at auction house
|
adam@0
|
63 local autoAh = newCheckbox(
|
yellowfive@11
|
64 L.AMR_CONFIG_CHECKBOX_AUTOAH_LABEL,
|
yellowfive@11
|
65 L.AMR_CONFIG_CHECKBOX_AUTOAH_TOOLTIP_TITLE,
|
yellowfive@11
|
66 L.AMR_CONFIG_CHECKBOX_AUTOAH_DESCRIPTION,
|
adam@0
|
67 function(self, value)
|
adam@17
|
68 if AmrDb.Options.manualShowShop then
|
adam@17
|
69 AmrDb.Options.manualShowShop = false
|
adam@0
|
70 else
|
adam@17
|
71 AmrDb.Options.manualShowShop = true
|
adam@0
|
72 end
|
adam@0
|
73 end
|
adam@0
|
74 )
|
adam@17
|
75 autoAh:SetChecked(not AmrDb.Options.manualShowShop)
|
adam@17
|
76 autoAh:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -58)
|
adam@0
|
77
|
adam@0
|
78 frame:SetScript("OnShow", nil)
|
adam@0
|
79 end)
|
adam@0
|
80 InterfaceOptions_AddCategory(frame)
|
adam@0
|
81
|