Mercurial > wow > askmrrobot
comparison ui/SettingsTab.lua @ 51:6f1bb8fcf64d v18
AskMrRobot.toc
- Added line for new SettingsTab file
AskMrRobotUi.lua
- Added code for new Settings menu
amr-constants.lua
- Added instance IDs for all WoD 6.0 5-mans and Raids.
- Removed legacy SoO IDs.
config.lua
- Removed "Interface/Addons" options area,
migrated all settings to main addon window.
localization/localization.en.lua
- Added new strings for new Settings tab and new Raid auto-logging
ui/CombatLogTab.lua
- Removed legacy SoO code
- Added auto-logging settings for Highmaul and Blackrock Foundry.
ui/SettingsTab.lua
- new main window tab for Minimap and Auction House settings options
| author | TuhMuffinMan <TuhMuffinMan> |
|---|---|
| date | Fri, 28 Nov 2014 13:09:52 -0600 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 50:af0dc99cbedb | 51:6f1bb8fcf64d |
|---|---|
| 1 local _, AskMrRobot = ... | |
| 2 local L = AskMrRobot.L; | |
| 3 | |
| 4 -- initialize the CombatLogTab class | |
| 5 AskMrRobot.SettingsTab = AskMrRobot.inheritsFrom(AskMrRobot.Frame) | |
| 6 | |
| 7 -- helper to create text for this tab | |
| 8 local function CreateText(tab, font, relativeTo, xOffset, yOffset, text) | |
| 9 local t = tab:CreateFontString(nil, "ARTWORK", font) | |
| 10 t:SetPoint("TOPLEFT", relativeTo, "BOTTOMLEFT", xOffset, yOffset) | |
| 11 t:SetPoint("RIGHT", tab, "RIGHT", -5, 0) | |
| 12 t:SetWidth(t:GetWidth()) | |
| 13 t:SetJustifyH("LEFT") | |
| 14 t:SetText(text) | |
| 15 | |
| 16 return t | |
| 17 end | |
| 18 | |
| 19 local function newCheckbox(tab, label, tooltipTitle, description, onClick) | |
| 20 local check = CreateFrame("CheckButton", "AmrCheck" .. label, tab, "InterfaceOptionsCheckButtonTemplate") | |
| 21 check:SetScript("OnClick", function(self) | |
| 22 PlaySound(self:GetChecked() and "igMainMenuOptionCheckBoxOn" or "igMainMenuOptionCheckBoxOff") | |
| 23 onClick(self, self:GetChecked() and true or false) | |
| 24 end) | |
| 25 check.label = _G[check:GetName() .. "Text"] | |
| 26 check.label:SetText(label) | |
| 27 check.tooltipText = tooltipTitle | |
| 28 check.tooltipRequirement = description | |
| 29 return check | |
| 30 end | |
| 31 | |
| 32 function AskMrRobot.SettingsTab:new(parent) | |
| 33 | |
| 34 local tab = AskMrRobot.Frame:new(nil, parent) | |
| 35 setmetatable(tab, { __index = AskMrRobot.SettingsTab }) | |
| 36 tab:SetPoint("TOPLEFT") | |
| 37 tab:SetPoint("BOTTOMRIGHT") | |
| 38 tab:Hide() | |
| 39 | |
| 40 -- tab header | |
| 41 local text = tab:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") | |
| 42 text:SetPoint("TOPLEFT", 0, -5) | |
| 43 text:SetText(L.AMR_SETTINGSTAB_SETTINGS) | |
| 44 | |
| 45 --scrollframe | |
| 46 tab.scrollframe = AskMrRobot.ScrollFrame:new(nil, tab) | |
| 47 tab.scrollframe:SetPoint("TOPLEFT", tab, "TOPLEFT", 0, -30) | |
| 48 tab.scrollframe:SetPoint("BOTTOMRIGHT", tab, "BOTTOMRIGHT", -30, 10) | |
| 49 | |
| 50 local content = tab.scrollframe.content | |
| 51 content:SetHeight(730) | |
| 52 | |
| 53 local autoPopup = newCheckbox(content, | |
| 54 L.AMR_CONFIG_CHECKBOX_MINIMAP_LABEL, | |
| 55 L.AMR_CONFIG_CHECKBOX_MINIMAP_TOOLTIP_TITLE, | |
| 56 L.AMR_CONFIG_CHECKBOX_MINIMAP_DESCRIPTION, | |
| 57 function(self, value) | |
| 58 if AmrDb.Options.hideMapIcon then | |
| 59 AmrDb.Options.hideMapIcon = false | |
| 60 else | |
| 61 AmrDb.Options.hideMapIcon = true | |
| 62 end | |
| 63 AskMrRobot.AmrUpdateMinimap(); | |
| 64 end | |
| 65 ) | |
| 66 autoPopup:SetChecked(not AmrDb.Options.hideMapIcon) | |
| 67 autoPopup:SetPoint("TOPLEFT", content, "TOPLEFT", 0, 0) | |
| 68 | |
| 69 local autoAh = newCheckbox(content, | |
| 70 L.AMR_CONFIG_CHECKBOX_AUTOAH_LABEL, | |
| 71 L.AMR_CONFIG_CHECKBOX_AUTOAH_TOOLTIP_TITLE, | |
| 72 L.AMR_CONFIG_CHECKBOX_AUTOAH_DESCRIPTION, | |
| 73 function(self, value) | |
| 74 if AmrDb.Options.manualShowShop then | |
| 75 AmrDb.Options.manualShowShop = false | |
| 76 else | |
| 77 AmrDb.Options.manualShowShop = true | |
| 78 end | |
| 79 end | |
| 80 ) | |
| 81 autoAh:SetChecked(not AmrDb.Options.manualShowShop) | |
| 82 autoAh:SetPoint("TOPLEFT", autoPopup, "BOTTOMLEFT", 0, -10) | |
| 83 | |
| 84 return tab | |
| 85 end |
