From b268c6ab3b7cb8fd784de6a256785b75a633689b Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Tue, 13 Oct 2009 04:39:08 -0500 Subject: [PATCH] Editing and saving weights works --- WeightsWatcher.xml | 42 +++++++++++++++++++++++++++++++++++++++++- config.lua | 30 ++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/WeightsWatcher.xml b/WeightsWatcher.xml index 663b8a5..e977d27 100644 --- a/WeightsWatcher.xml +++ b/WeightsWatcher.xml @@ -62,6 +62,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + self:SetTextInsets(5, 5, 0, 0) + + + + @@ -208,6 +239,15 @@ + + @@ -227,7 +267,7 @@ - scrollBarUpdate(self, ww_config.rightPanel.scrollContainer, ww_statFrameTable, 20, -30, 26) + scrollBarUpdate(self, ww_config.rightPanel.scrollContainer, ww_statFrameTable, 20, -30, 25) FauxScrollFrame_OnVerticalScroll(self, offset, 20, self:GetScript("OnShow")) diff --git a/config.lua b/config.lua index fbab2c0..0b29fe8 100644 --- a/config.lua +++ b/config.lua @@ -50,12 +50,42 @@ function scrollBarUpdate(scrollFrame, scrolledFrame, buttonTable, buttonHeight, end end +--opens a new config pane to edit stat weights function configSelectWeight(weightFrame) ww_config.rightPanel.statList = ww_vars.weightsList[weightFrame.category.class][weightFrame.name] + + for _, frame in pairs(ww_statFrameTable) do + if frame.statName then + value = ww_config.rightPanel.statList[frame.statName] + if not value then + value = "" + end + frame.statValue:SetText(value) + end + end + ww_config.rightPanel.header:SetText(weightFrame.name) + ww_config.rightPanel.saveButton:SetScript("OnClick", + function() + configSaveWeight(weightFrame) + end) ww_config.rightPanel:Show() end +function configSaveWeight(weight) + for _, frame in pairs(ww_statFrameTable) do + if frame.statName then + value = frame.statValue:GetText() + if value == "" then + value = nil + else + value = tonumber(value) + end + ww_vars.weightsList[weight.category.class][weight.name][frame.statName] = value + end + end +end + --loads the various class buttons onto the config frame function loadClassButtons() local classes, revClassLookup = {}, {} -- 1.7.9.5