Mercurial > wow > askmrrobot
diff Options.lua @ 61:cf2b6b9a8337 v23
6.2 update, shopping list bug fixes, ui scale option
author | yellowfive |
---|---|
date | Tue, 23 Jun 2015 00:27:21 -0700 |
parents | 01b63b8ed811 |
children | b8e9664d3229 |
line wrap: on
line diff
--- a/Options.lua Sun Jun 07 15:20:25 2015 -0700 +++ b/Options.lua Tue Jun 23 00:27:21 2015 -0700 @@ -5,6 +5,28 @@ local _chkMinimap local _chkAutoGear local _chkAh +local _txtScale + +local function onTextboxEnter(widget) + local setting = widget:GetUserData("setting") + local val = widget:GetText() + + val = tonumber(val) + if not val then + widget:SetText(Amr.db.profile.options[setting]) + else + if setting == "uiScale" then + if val < 0.5 then + val = 0.5 + elseif val > 1.5 then + val = 1.5 + end + end + + Amr.db.profile.options[setting] = val + Amr:RefreshConfig() + end +end local function onCheckClick(widget) local setting = widget:GetUserData("setting") @@ -42,6 +64,34 @@ return chk, desc end +local function createSmallTextbox(container, setting, text, description) + + local txt = AceGUI:Create("AmrUiTextarea") + txt:SetUserData("setting", setting) + txt:SetMultiLine(false) + txt:SetWidth(35) + txt:SetHeight(24) + txt:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) + txt:SetCallback("OnEnterPressed", onTextboxEnter) + container:AddChild(txt) + + local lbl = AceGUI:Create("AmrUiLabel") + lbl:SetWidth(600) + lbl:SetText(text) + lbl:SetFont(Amr.CreateFont("Regular", 14, Amr.Colors.Text)) + lbl:SetPoint("LEFT", txt.frame, "RIGHT", 6, 0) + container:AddChild(lbl) + + local desc = AceGUI:Create("AmrUiLabel") + desc:SetWidth(800) + desc:SetText(description) + desc:SetFont(Amr.CreateFont("Italic", 12, Amr.Colors.TextTan)) + desc:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 0, -4) + container:AddChild(desc) + + return txt, desc +end + -- renders the main UI for the Combat Log tab function Amr:RenderTabOptions(container) @@ -55,7 +105,7 @@ local desc, desc2 _chkMinimap, desc = createCheck(container, "minimap", L.OptionsHideMinimapName, L.OptionsHideMinimapDesc) - _chkMinimap:SetPoint("TOPLEFT", header.frame, "BOTTOMLEFT", 0, -20) + _chkMinimap:SetPoint("TOPLEFT", header.frame, "BOTTOMLEFT", 10, -20) _chkAutoGear, desc2 = createCheck(container, "autoGear", L.OptionsAutoGearName, L.OptionsAutoGearDesc) _chkAutoGear:SetPoint("TOPLEFT", desc.frame, "BOTTOMLEFT", -24, -20) @@ -63,6 +113,9 @@ _chkAh, desc = createCheck(container, "shopAh", L.OptionsShopAhName, L.OptionsShopAhDesc) _chkAh:SetPoint("TOPLEFT", desc2.frame, "BOTTOMLEFT", -24, -20) + _txtScale, desc2 = createSmallTextbox(container, "uiScale", L.OptionsUiScaleName, L.OptionsUiScaleDesc) + _txtScale:SetPoint("TOPLEFT", desc.frame, "BOTTOMLEFT", -43, -20) + -- initialize state of controls Amr:RefreshOptionsUi() end @@ -84,4 +137,9 @@ if _chkAh then _chkAh:SetChecked(self.db.profile.options.shopAh) end + + if _txtScale then + _txtScale:SetText(self.db.profile.options.uiScale) + _txtScale:ClearFocus() + end end \ No newline at end of file