adam@0: local addonName, AskMrRobot = ... adam@0: adam@0: --if not addon.healthCheck then return end adam@0: local L = AskMrRobot.L adam@0: adam@0: local wow_ver = select(4, GetBuildInfo()) adam@0: local wow_500 = wow_ver >= 50000 adam@0: local UIPanelButtonTemplate = wow_500 and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2" adam@0: adam@0: local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer) adam@0: frame.name = addonName adam@0: frame:Hide() adam@0: adam@0: -- Credits to Ace3, Tekkub, cladhaire and Tuller for some of the widget stuff. adam@0: adam@0: local function newCheckbox(label, tooltipTitle, description, onClick) adam@0: local check = CreateFrame("CheckButton", "AmrCheck" .. label, frame, "InterfaceOptionsCheckButtonTemplate") adam@0: check:SetScript("OnClick", function(self) adam@0: PlaySound(self:GetChecked() and "igMainMenuOptionCheckBoxOn" or "igMainMenuOptionCheckBoxOff") adam@0: onClick(self, self:GetChecked() and true or false) adam@0: end) adam@0: check.label = _G[check:GetName() .. "Text"] adam@0: check.label:SetText(label) adam@0: check.tooltipText = tooltipTitle adam@0: check.tooltipRequirement = description adam@0: return check adam@0: end adam@0: adam@0: frame:SetScript("OnShow", function(frame) adam@0: local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") adam@0: title:SetPoint("TOPLEFT", 16, -16) adam@0: title:SetText(addonName) adam@0: adam@0: local subTitleWrapper = CreateFrame("Frame", nil, frame) adam@0: subTitleWrapper:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -8) adam@0: subTitleWrapper:SetPoint("RIGHT", -16, 0) adam@0: local subtitle = subTitleWrapper:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") adam@0: subtitle:SetPoint("TOPLEFT", subTitleWrapper) adam@0: subtitle:SetWidth(subTitleWrapper:GetRight() - subTitleWrapper:GetLeft()) adam@0: subtitle:SetJustifyH("LEFT") adam@0: subtitle:SetNonSpaceWrap(false) adam@0: subtitle:SetJustifyV("TOP") yellowfive@11: subtitle:SetText(L.AMR_CONFIG_EXIMPORT) adam@0: subTitleWrapper:SetHeight(subtitle:GetHeight()) adam@0: adam@0: local autoPopup = newCheckbox( yellowfive@11: L.AMR_CONFIG_CHECKBOX_MINIMAP_LABEL, yellowfive@11: L.AMR_CONFIG_CHECKBOX_MINIMAP_TOOLTIP_TITLE, yellowfive@11: L.AMR_CONFIG_CHECKBOX_MINIMAP_DESCRIPTION, adam@0: function(self, value) adam@0: if AmrOptions.hideMapIcon then adam@0: AmrOptions.hideMapIcon = false adam@0: else adam@0: AmrOptions.hideMapIcon = true adam@0: end adam@0: AskMrRobot.AmrUpdateMinimap(); adam@0: end adam@0: ) adam@0: autoPopup:SetChecked(not AmrOptions.hideMapIcon) adam@0: autoPopup:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -16) adam@0: adam@0: local autoReforge = newCheckbox( yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOREFORGE_LABEL, yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOREFORGE_TOOLTIP_TITLE, yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOREFORGE_DESCRIPTION, adam@0: function(self, value) adam@0: if AmrOptions.manualShowReforge then adam@0: AmrOptions.manualShowReforge = false adam@0: else adam@0: AmrOptions.manualShowReforge = true adam@0: end adam@0: end adam@0: ) adam@0: autoReforge:SetChecked(not AmrOptions.manualShowReforge) adam@0: autoReforge:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -52) adam@0: adam@0: local autoAh = newCheckbox( yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOAH_LABEL, yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOAH_TOOLTIP_TITLE, yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOAH_DESCRIPTION, adam@0: function(self, value) adam@0: if AmrOptions.manualShowShop then adam@0: AmrOptions.manualShowShop = false adam@0: else adam@0: AmrOptions.manualShowShop = true adam@0: end adam@0: end adam@0: ) adam@0: autoAh:SetChecked(not AmrOptions.manualShowShop) adam@0: autoAh:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -88) adam@0: adam@0: --[[ adam@0: AmrOptions.autoLog = AmrOptions.autoLog or {} adam@0: adam@0: local autoCombatLog = newCheckbox( yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOLOG_LABEL, yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOLOG_TOOLTIP_TITLE, yellowfive@11: L.AMR_CONFIG_CHECKBOX_AUTOLOG_DESCRIPTION, adam@0: function(self, value) adam@0: if AmrOptions.autoLog[1136] then adam@0: AmrOptions.autoLog[1136] = false adam@0: else adam@0: AmrOptions.autoLog[1136] = true adam@0: end adam@0: end adam@0: ) adam@0: autoCombatLog:SetChecked(AmrOptions.autoLog[1136]) adam@0: autoCombatLog:SetPoint("TOPLEFT", subTitleWrapper, "BOTTOMLEFT", -2, -124) adam@0: ]] adam@0: adam@0: frame:SetScript("OnShow", nil) adam@0: end) adam@0: InterfaceOptions_AddCategory(frame) adam@0: