From ef16b4aabef19c0d54d4bcb2b6a354a1eebc54af Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Fri, 27 Nov 2009 01:58:03 -0600 Subject: [PATCH] Copying weights works --- WeightsWatcher.xml | 28 ++++++++++++++++++++++++++-- config.lua | 13 +++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/WeightsWatcher.xml b/WeightsWatcher.xml index a01044a..a8db2fd 100644 --- a/WeightsWatcher.xml +++ b/WeightsWatcher.xml @@ -263,6 +263,19 @@ + + @@ -479,7 +496,14 @@ if ww_vars.weightsList[class][name] then local error = StaticPopup_Show("WW_WEIGHT_EXISTS", classNames[class], name) else - setWeight(class, name, {}) + setWeight(class, name, self:GetParent().statList) + for _, classFrame in ipairs(ww_classFrameTable) do + if classFrame.class == class then + local children = {classFrame:GetChildren()} + configSelectWeight(children[classFrame:GetNumChildren()]) + break + end + end self:GetParent():Hide() end diff --git a/config.lua b/config.lua index 8e7aa4c..08e4ae2 100644 --- a/config.lua +++ b/config.lua @@ -120,6 +120,10 @@ function configSelectWeight(weightFrame) function() configSaveWeight(weightFrame) end) + ww_config.rightPanel.copyButton:SetScript("OnClick", + function() + configNewWeight(weightFrame.category.class, "Copy of " .. weightFrame.name, ww_config.rightPanel.statList) + end) ww_config.rightPanel.deleteButton:SetScript("OnClick", function() configDeleteWeight(weightFrame) @@ -198,7 +202,9 @@ function deleteWeight(weight) ww_config.leftPanel.scrollFrame:GetScript("OnShow")(ww_config.leftPanel.scrollFrame) end -function configNewWeight(class, weight) +function configNewWeight(class, weight, statList) + -- Need to call show first to re-initialize the dropdown + ww_newWeight:Show() if class then UIDropDownMenu_SetSelectedValue(ww_newWeight.dropdown, class, false) end @@ -206,7 +212,10 @@ function configNewWeight(class, weight) if weight then ww_newWeight.editBox:SetText(weight) end - ww_newWeight:Show() + if not statList then + statList = {} + end + ww_newWeight.statList = statList end function setWeight(class, weight, statList) -- 1.7.9.5