Mercurial > wow > buffalo2
changeset 122:ea2c616a3b4f
Standardize anchor variables
- anchorGroup sets general position, defers to anchorPoint
- anchorPoint and anchorFrom are used in SetPoint, deferring to anchorGroup and its inverse
Artifact Power:
- scan and update triggers trimmed down
BuffFrame:
- extra values can be right clicked to hide for particular auras
LFG:
- Desolate Host link placed above Sisters when searching for best cheevos
TalkingHead
- Re-enable TalkingHeadFrame click behaviour
author | Nenue |
---|---|
date | Mon, 21 Aug 2017 22:15:46 -0400 |
parents | 1f68c46bc4de |
children | b3c0258b419d |
files | Modules/ArtifactPower.lua Modules/ArtifactPower.xml Modules/BuffFrame.lua Modules/GuildInfo.lua Modules/TalkingHead.lua Modules/TalkingHead.xml Templates.lua Veneer.lua |
diffstat | 8 files changed, 323 insertions(+), 164 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/ArtifactPower.lua Mon Jul 17 11:51:31 2017 -0400 +++ b/Modules/ArtifactPower.lua Mon Aug 21 22:15:46 2017 -0400 @@ -15,32 +15,23 @@ worldQuestItems = {}, ItemButtons = {}, anchorGroup = 'TOP', - anchorPoint = 'TOP', + anchorPoint = 'TOPLEFT', anchorPriority = 3, anchorFrom = 'BOTTOMLEFT', moduleName = 'Artifactor', HideCombat = true } + +VeneerArtifactButtonMixin = {} +local Artifact = VeneerArtifactButtonMixin + local defaultSettings = { firstUse = true, autoHide = true, } local Module = VeneerArtifactPowerMixin -local BAGS_TO_SCAN = {BACKPACK_CONTAINER } +local BAGS_TO_SCAN = {BACKPACK_CONTAINER} local TOOLTIP_NAME = 'VeneerAPScanner' -local POINT_COSTS = { - 100, 300, 325, 350, 375, - 400, 425, 450, 525, 625, - 750, 875, 1000, 6840, 8830, - 11280, 14400, 18620, 24000, 30600, - 39520, 50880, 64800, 82500, 105280, - 138650, 182780, 240870, 325520, 417560, - 546000, 718200, 946660, 1245840, 1635200, - 191500, 2010000, 2110000, 2215000, 2325000, - 2440000, 2560000, 2690000, 2825000, 2965000, - 3115000, 3270000, 3435000, 3605000, 3785000, - 3975000, 4175000, 4385000, 4605000 -} local FISHING_MAX_TRAITS = 24 local WEAPON_MAX_TRAITS = 92 local FRAME_PADDING = 4 @@ -53,13 +44,13 @@ function Module:OnLoad() self:RegisterEvent('BAG_UPDATE') -- use to obtain bag IDs to scan self:RegisterEvent('BAG_UPDATE_DELAYED') -- use to trigger actual scan activity - self:RegisterEvent('BANKFRAME_OPENED') -- determine when bank info is available - self:RegisterEvent('BANKFRAME_CLOSED') -- " " " - self:RegisterEvent('ARTIFACT_UPDATE') -- when artifact data has changed - self:RegisterEvent('ARTIFACT_XP_UPDATE') -- when artifact xp has changed (but not necessarily data) - self:RegisterEvent('PLAYER_REGEN_ENABLED') - self:RegisterEvent('PLAYER_REGEN_DISABLED') - self:RegisterEvent('PLAYER_ENTERING_WORLD') + self:RegisterEvent('BANKFRAME_OPENED') -- bank info available + self:RegisterEvent('BANKFRAME_CLOSED') -- + self:RegisterEvent('ARTIFACT_UPDATE') -- visible data change + self:RegisterEvent('ARTIFACT_XP_UPDATE') -- xp for equipped artifact + self:RegisterEvent('PLAYER_REGEN_ENABLED') -- combat + self:RegisterEvent('PLAYER_REGEN_DISABLED') -- + self:RegisterEvent('PLAYER_ENTERING_WORLD') -- zone/instance transfer self:RegisterEvent('ITEM_LOCK_CHANGED') -- use to clear bag slot cache data Veneer:AddHandler(self) SLASH_VENEER_AP1 = "/vap" @@ -80,7 +71,16 @@ end self:Print('Cache data reset.') self:Update() + elseif arg:match('item') then + print('name', arg:match("^item (%S.+)")) + print('num', arg:match("Hitem:(%d+)")) + local linkOrID = arg:match("item:(%d+)") or arg:match("^item (%S+)") + if linkOrID then + local name, etc = GetItemInfo(linkOrID) + end + else + self:Show() end end @@ -90,7 +90,10 @@ end local ShortNumberString = function (value) - if value >= 1000000 then + if value >= 1000000000 then + + return tostring(floor(value/10000000)/100) .. 'B' + elseif value >= 1000000 then return tostring(floor(value/100000)/10) .. 'M' elseif value >= 100000 then return tostring(floor(value/1000)) .. 'k' @@ -354,6 +357,7 @@ self:ScanAllBags() elseif event == 'BAG_UPDATE_DELAYED' then if not self.firstHit then + -- prevent double call from login self.firstHit = true else self:ScanAllBags() @@ -367,13 +371,13 @@ local newItem = ... if newItem then local itemID, _, name, texture, currentXP, pointsSpent = C_ArtifactUI:GetArtifactInfo() - self:SetArtifact(itemID, name, texture, currentXP, pointsSpent) - self:ScanAllBags(self.bankAccess) + self:UpdateArtifact(itemID, name, texture, currentXP, pointsSpent) + --self:ScanAllBags(self.bankAccess) end elseif event == 'ARTIFACT_XP_UPDATE' then local itemID, _, name, texture, currentXP, pointsSpent = C_ArtifactUI:GetEquippedArtifactInfo() - self:SetArtifact(itemID, name, texture, currentXP, pointsSpent) - self:ScanAllBags(self.bankAccess) + self:UpdateArtifact(itemID, name, texture, currentXP, pointsSpent) + --self:ScanAllBags(self.bankAccess) elseif event == 'PLAYER_REGEN_ENABLED' then if self.queuedScan then @@ -417,7 +421,26 @@ print('|cFFFF4400Update()|r') return end - print('|cFF00FFFFUpdate()|r') + print('|cFFFFFF00pdate()|r') + + local numButtons = 0 + local contentsHeight = 16 + local contentsWidth = 400 + if self.profile.knowledgeMultiplier then + local artifactsWidth = self:UpdateArtifactButtons() + + if artifactsWidth ~= 0 then + contentsHeight = contentsHeight + 64 + end + + contentsWidth = max(contentsWidth, min(artifactsWidth, 400)) + + local itemsWidth, itemsHeight = self:UpdateItemButtons() + contentsHeight = contentsHeight + itemsHeight + contentsWidth = max(contentsWidth, itemsWidth) + end + + local bankText, bagText if not self.profile.knowledgeMultiplier then @@ -443,22 +466,8 @@ self.SummaryHeader:SetText(bankText) - - local numButtons = 0 - local contentsHeight = 16 + self.SummaryHeader:GetHeight() - local contentsWidth = 400 - if self.profile.knowledgeMultiplier then - local artifactsWidth = self:UpdateArtifactButtons() - - if artifactsWidth ~= 0 then - contentsHeight = contentsHeight + 64 - end - - contentsWidth = max(contentsWidth, min(artifactsWidth, 400)) - - local itemsWidth, itemsHeight = self:UpdateItemButtons() - contentsHeight = contentsHeight + itemsHeight - contentsWidth = max(contentsWidth, itemsWidth) + if not self.lastButton then + contentsHeight = contentsHeight + self.SummaryHeader:GetHeight() end @@ -534,6 +543,7 @@ -- Artifact icons, in no particular order self.equippedID = C_ArtifactUI.GetEquippedArtifactInfo() + self.lastButton = nil self.canAddAP = nil self.canAddFishingAP = nil local hasArtifacts @@ -547,13 +557,13 @@ numButtons = numButtons + 1 button = self.Artifact[numButtons] button.relativeFrame = self - lastFrame = button:SetButton(self.equippedID, equipped, numButtons, true, nil) - hasArtifacts = true - + if self.equippedID ~= button.itemID then + button:SetItem(self.equippedID, equipped, numButtons, true, nil) + hasArtifacts = true + end + lastFrame = button buttonsWidth = EQUIPPED_SIZE + (FRAME_PADDING * 2) end - - for itemID, artifact in pairs(self.profile.artifacts) do if (itemID == UNDERLIGHT_ANGLER_ID) then -- only add if we have fishing AP items and it's not being shown in the equipped slot @@ -577,13 +587,18 @@ numButtons = numButtons + 1 button = self.Artifact[numButtons] button.relativeFrame = lastFrame - lastFrame = button:SetButton(itemID, artifact, numButtons, (self.equippedID == itemID), nil) + if button.itemID ~= itemID then + button:SetItem(itemID, artifact, numButtons, (self.equippedID == itemID), nil) + end + lastFrame = button buttonsWidth = buttonsWidth + lastFrame:GetWidth() + FRAME_PADDING end end end end + self.lastButton = lastFrame + if fishingData and (self.fishingAP and self.fishingAP > 0) then numButtons = numButtons + 1 @@ -591,7 +606,8 @@ local button = self.Artifact[numButtons] button.relativeFrame = lastFrame button.isFishing = true - button:SetButton(fishingID, fishingData, numButtons, self.equippedID == fishingID) + button:SetItem(fishingID, fishingData, numButtons, self.equippedID == fishingID) + self.lastButton = button end self.hasArtifacts = hasArtifacts @@ -600,6 +616,14 @@ self.Artifact[i]:Hide() end + self.SummaryHeader:ClearAllPoints() + if self.lastButton then + self.SummaryHeader:SetPoint('TOPLEFT', self.lastButton, 'TOPRIGHT', 4, -2) + else + self.SummaryHeader:SetPoint('BOTTOMLEFT', self, 'BOTTOMLEFT', 4, 4) + end + + return buttonsWidth end @@ -757,24 +781,14 @@ return self.cache.items[itemID], self.cache.fishing[itemID] end -function Module:SetArtifact(itemID, name, texture, currentXP, pointsSpent) - print('|cFF00FF00SetArtifact()|r') +function Module:UpdateArtifact(itemID, name, texture, currentXP, pointsSpent) + print('|cFF00FF00UpdateArtifact()|r') if not self.profile then return end local artifacts = self.profile.artifacts - local multi = C_ArtifactUI.GetArtifactKnowledgeMultiplier() - if multi and (self.profile.knowledgeMultiplier ~= multi) then - table.wipe(self.cache.items) - table.wipe(self.cache.fishing) - end - - self.profile.knowledgeMultiplier = multi or self.profile.knowledgeMultiplier - print('multiplier:', multi) - if itemID then - self.currentEquipped = itemID artifacts[itemID] = artifacts[itemID] or {} @@ -786,12 +800,17 @@ artifact.currentXP = currentXP artifact.level = pointsSpent artifact.tier = C_ArtifactUI.GetArtifactTier() or ((pointsSpent >= 36) and 2 or 1) + artifact.itemID = itemID print('tier', artifact.tier) local cost = C_ArtifactUI.GetCostForPointAtRank(pointsSpent, artifact.tier) artifact.currentCost = cost - + for index, frame in pairs(self.Artifact) do + if frame.itemID == itemID then + frame:SetItem(itemID, artifact, index, (itemID == self.equippedID), (itemID == UNDERLIGHT_ANGLER_ID)) + end + end end end @@ -924,13 +943,11 @@ self:TryToShow() end -VeneerArtifactButtonMixin = {} -local Artifact = VeneerArtifactButtonMixin -function Artifact:SetButton(itemID, artifact, index, equipped, fishing) - print(itemID, index) +function Artifact:SetItem(itemID, artifact, index, equipped, fishing) + print('|cFF00FFFFSetItem()|r', itemID, index) print(artifact.name, artifact.texture, artifact.currentXP) - self:SetID(itemID) + if not artifact.currentCost then artifact.currentCost = artifact.cost end @@ -1004,27 +1021,106 @@ self:SetPoint('TOPLEFT', self.relativeFrame, 'TOPLEFT', 4, -4) end + self.itemID = itemID self.isEquipped = equipped self:Update() self:Show() + return self end +function Artifact:UpdateXPBar() + local r3, g3, b3 = 1, .5, 0 -- main xp bar + -- current: amount shown in blizz ui + -- actual: amount contributing the next level, will be same until current point cap is reached + -- potential: total of ap on hand + print(self.currentXP, self.actualXP, self.potentialXP) + + local maxHeight = self:GetHeight() - 8 + local currentHeight = self.CurrentProgress:GetHeight() or 1 + local offHeight = self.AdjustedProgress:GetHeight() or 1 + + + local currentProgress = (self.currentXP < self.currentCost) and (self.currentXP / self.currentCost) or 1 + local projectedProgress = (self.totalXP < self.totalCost) and (self.totalXP / self.totalCost) or 1 + if self.actualLevel ~= self.level then + r3, g3, b3 = 0, 1, 1 + end + + print('|cFFFF4400', currentProgress) + if self.level <= WEAPON_MAX_TRAITS then + self.CurrentProgress.animateFrom = currentHeight or 1 + self.CurrentProgress.animateTo = currentProgress * maxHeight + self.CurrentProgress:Show() + self.ProgressLine:Show() + else + self.CurrentProgress:Hide() + self.ProgressLine:Hide() + end + + if self.totalXP ~= self.currentXP then + print('|cFF00FFFF', projectedProgress) + if (projectedProgress > currentProgress) then + self.AdjustedProgress:SetPoint('BOTTOM', self.CurrentProgress, 'TOP') + projectedProgress = projectedProgress - currentProgress + print('show projected above', currentProgress, projectedProgress) + else + self.CurrentProgress:Hide() + self.ProgressLine:Hide() + self.AdjustedProgress:SetPoint('BOTTOM', self, 'BOTTOM', 0 , 4) + print('show projected at bottom', currentProgress, projectedProgress) + end + + self.AdjustedProgress.animateFrom = self.AdjustedProgress:GetHeight() or 1 + self.AdjustedProgress.animateTo = projectedProgress * self:GetHeight() + self.AdjustedLine:Show() + self.AdjustedProgress:Show() + else + self.CurrentProgress:SetPoint('BOTTOM', self, 'BOTTOM', 0, 4) + self.AdjustedProgress:Hide() + self.AdjustedLine:Hide() + end + --print(self.CurrentProgress:GetPoint(3)) + --print(self.CurrentProgress:GetSize()) + + self.CurrentProgress:SetColorTexture(r3,g3,b3,1) + +end + +function Artifact:OnLoad() + print('|cFFFF4400OnLoad()|r', self:GetName(), self:GetID()) + self:RegisterEvent('ARTIFACT_UPDATE') + self:RegisterEvent('PLAYER_LOGIN') +end + +function Artifact:OnEvent(event) + local itemID, _, _, nextCost = C_ArtifactUI.GetEquippedArtifactInfo() + print(self:GetID(), '|cFFFF4400OnEvent()|r', event, itemID, '=', self.itemID, (itemID == self.itemID)) + if itemID == self.itemID then + self:Update() + end +end + function Artifact:Update() - local r1, g1, b1 = 1, 1, 1 - local r2, g2, b2 = 1, 1, 0 + if not self.itemID then + return + end + + print(self:GetName(), '|ff00FFFFUpdate()|r') + local r1, g1, b1 = 1, 1, 1 -- top text + local r2, g2, b2 = 1, 1, 0 -- bottom text local levelText = self.level local xpText = ShortNumberString(self.currentXP) local costText = ShortNumberString(self.currentCost) local remainingText = ShortNumberString(self.currentCost - self.currentXP) - -- current: amount shown in blizz ui - -- actual: amount contributing the next level, will be same until current point cap is reached - -- potential: total of ap on hand - print(self.currentXP, self.actualXP, self.potentialXP) + + local maxHeight = self:GetHeight() - 4 + local currentHeight = self.CurrentProgress:GetHeight() or 1 + local offHeight = self.AdjustedProgress:GetHeight() or 1 + if self.actualLevel ~= self.level then levelText = self.actualLevel r1, g1, b1 = 0, 1, 0 - --r2, g2, b2 = 0, 1, 0 xpText = ShortNumberString(self.actualXP) costText = ShortNumberString(self.actualCost) remainingText = ShortNumberString(self.actualCost-self.actualXP) @@ -1034,8 +1130,6 @@ costText = ShortNumberString(self.potentialCost) remainingText = ShortNumberString(self.potentialCost-self.potentialXP) --]] - elseif self.totalLevel ~= self.actualLevel then - r1, g1, b1 = 0, 1, 1 end self.Level:SetText(levelText) @@ -1054,41 +1148,7 @@ self:SetNormalTexture(nil, 'ADD') end - local currentProgress = (self.currentXP < self.currentCost) and (self.currentXP / self.currentCost) or 1 - print('|cFFFF4400', currentProgress) - if self.level <= 92 then - self.CurrentProgress.animateFrom = self.CurrentProgress:GetHeight() or 1 - self.CurrentProgress.animateTo = currentProgress * self:GetHeight() - self.CurrentProgress:Show() - self.ProgressLine:Show() - else - self.CurrentProgress:Hide() - self.ProgressLine:Hide() - end - - if self.totalXP ~= self.currentXP then - local projectedProgress = (self.totalXP / self.totalCost) - print('|cFF00FFFF', projectedProgress) - if (projectedProgress > currentProgress) then - self.AdjustedProgress:SetPoint('BOTTOM', self.CurrentProgress, 'TOP') - projectedProgress = projectedProgress - currentProgress - else - self.CurrentProgress:Hide() - self.ProgressLine:Hide() - self.AdjustedProgress:SetPoint('BOTTOM', self, 'BOTTOM') - end - print('show actual', currentProgress, projectedProgress) - self.AdjustedProgress.animateFrom = self.AdjustedProgress:GetHeight() or 1 - self.AdjustedProgress.animateTo = projectedProgress * self:GetHeight() - self.AdjustedLine:Show() - self.AdjustedProgress:Show() - else - self.CurrentProgress:SetPoint('BOTTOM', self, 'BOTTOM') - self.AdjustedProgress:Hide() - self.AdjustedLine:Hide() - end - print(self.CurrentProgress:GetPoint(3)) - print(self.CurrentProgress:GetSize()) + self:UpdateXPBar() if self.actualLevel ~= self.currentLevel then self:SetNormalTexture([[Interface\Buttons\UI-Quickslot-Depress]], 'ADD') @@ -1171,4 +1231,4 @@ end end -end \ No newline at end of file +end
--- a/Modules/ArtifactPower.xml Mon Jul 17 11:51:31 2017 -0400 +++ b/Modules/ArtifactPower.xml Mon Aug 21 22:15:46 2017 -0400 @@ -25,6 +25,8 @@ <Button name="VeneerArtifactButton" parentArray="Artifact" mixin="VeneerArtifactButtonMixin" virtual="true"> <Scripts> + <OnLoad method="OnLoad" /> + <OnEvent method="OnEvent" /> <OnEnter method="OnEnter" /> <OnLeave method="OnLeave" /> <OnClick method="OnClick" /> @@ -103,7 +105,7 @@ </Layers> </Button> <Frame name="VeneerArtifactPowerTimer" parent="UIParent" /> - <Frame name="VeneerArtifactPower" hidden="true" mixin="VeneerArtifactPowerMixin" parent="UIParent" inherits="VeneerHandlerTemplate" enableMouse="true"> + <Frame name="VeneerArtifactPower" hidden="true" mixin="VeneerArtifactPowerMixin" parent="UIParent" inherits="VeneerHandlerTemplate" enableMouse="false"> <Size x="300" y="36" /> <Scripts> <OnEnter method="OnEnter" /> @@ -114,24 +116,21 @@ <Layer level="BACKGROUND"> <Texture parentKey="Background"> - <Color a="0.5" r="0" g="0" b="0" /> + <Color a="0" r="0" g="0" b="0" /> </Texture> </Layer> <Layer level="OVERLAY"> <FontString name="$parentSummaryHeader" parentKey="SummaryHeader" inherits="VeneerNumberFont" text="" justifyH="LEFT"> - <Anchors> - <Anchor point="BOTTOMLEFT" x="4" y="4" /> - </Anchors> <Color r="0" g="1" b="1" /> </FontString> </Layer> </Layers> <Frames> - <Button name="$parentArtifactButton1" inherits="VeneerArtifactButton" /> - <Button name="$parentArtifactButton2" inherits="VeneerArtifactButton" /> - <Button name="$parentArtifactButton3" inherits="VeneerArtifactButton" /> - <Button name="$parentArtifactButton4" inherits="VeneerArtifactButton" /> - <Button name="$parentArtifactButton5" inherits="VeneerArtifactButton" /> + <Button name="$parentArtifactButton1" inherits="VeneerArtifactButton" id="1" /> + <Button name="$parentArtifactButton2" inherits="VeneerArtifactButton" id="2" /> + <Button name="$parentArtifactButton3" inherits="VeneerArtifactButton" id="3" /> + <Button name="$parentArtifactButton4" inherits="VeneerArtifactButton" id="4" /> + <Button name="$parentArtifactButton5" inherits="VeneerArtifactButton" id="5" /> <Button name="$parentRefresh" text="Refresh" parentKey="Refresh"> <Size x="72" y="32" />
--- a/Modules/BuffFrame.lua Mon Jul 17 11:51:31 2017 -0400 +++ b/Modules/BuffFrame.lua Mon Aug 21 22:15:46 2017 -0400 @@ -393,6 +393,8 @@ button.index = i button:RegisterForClicks('AnyUp') button:SetScript('OnClick', Audit_OnClick) + button:SetScript('OnEvent', Audit_OnEvent) + button:RegisterEvent('POWER_REGEN_ENABLED') button:SetPoint('TOPLEFT', 0, (i-1) * 16 * -1) facade.Audit[i] = button end
--- a/Modules/GuildInfo.lua Mon Jul 17 11:51:31 2017 -0400 +++ b/Modules/GuildInfo.lua Mon Aug 21 22:15:46 2017 -0400 @@ -79,8 +79,8 @@ 11780, -- avatar 11779, -- maiden 11776, -- mistress + 11778, -- host, 11777, -- sisters - 11778, -- host, 11775, -- harjatan, 11774, -- di, 11773, -- goroth
--- a/Modules/TalkingHead.lua Mon Jul 17 11:51:31 2017 -0400 +++ b/Modules/TalkingHead.lua Mon Aug 21 22:15:46 2017 -0400 @@ -4,14 +4,16 @@ -- %file-revision% -- +local FRAME_PADDING = 2 + local print = DEVIAN_WORKSPACE and function(...) print('VnTalkingHead', ...) end or nop local thf = TalkingHeadFrame local m = { - anchorPoint = 'BOTTOMLEFT', + anchorPoint = 'TOPLEFT', anchorFrom = 'TOPLEFT', - anchorX = -4, - anchorY = 96, + anchorX = 0, + anchorY = 0, anchorFrame = 'ChatFrame1', } @@ -32,15 +34,49 @@ self:SetSize(thf:GetSize()) - hooksecurefunc(thf, 'SetPoint', function(...) - print('SetPoint', ...) - print(debugstack()) - end) + --hooksecurefunc(thf, 'SetPoint', function(...) + -- print('SetPoint', ...) + -- print(debugstack()) + --end) + + + self.Name:SetAllPoints(thf.NameFrame.Name) + self.Text:SetAllPoints(thf.TextFrame.Text) + self.Portrait:SetAllPoints(thf.PortraitFrame.Portrait) + + self:ApplySettings() self:SetShown(true) self:ClearAnchor() end +function m:ApplySettings() + + thf.NameFrame.Name:ClearAllPoints() + thf.TextFrame.Text:ClearAllPoints() + thf.PortraitFrame.Portrait:ClearAllPoints() + + print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown()) + thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.5) + + thf.NameFrame.Name:SetPoint('TOPLEFT', thf.PortraitFrame.Portrait, 'TOPRIGHT', FRAME_PADDING, 0) + thf.NameFrame.Name:SetPoint('RIGHT', thf, 'RIGHT', -FRAME_PADDING, 0) + thf.PortraitFrame.Portrait:SetPoint('TOPLEFT', thf, 'TOPLEFT', FRAME_PADDING, -FRAME_PADDING) + + + thf.TextFrame.Text:SetPoint('TOPLEFT', thf.NameFrame.Name, 'BOTTOMLEFT', 0, -FRAME_PADDING) + thf.TextFrame.Text:SetPoint('BOTTOMRIGHT', thf, 'BOTTOMRIGHT', -FRAME_PADDING, FRAME_PADDING) + + thf.BackgroundFrame.TextBackground:SetColorTexture(0,0,0,.75) + + thf.MainFrame.CloseButton:SetPoint('TOPRIGHT', thf, 'TOPRIGHT', 0, 0) + + --thf:EnableMouse(false) + thf:ClearAllPoints() + thf:SetAllPoints(self) + +end + function m:ClearAnchor() UIPARENT_MANAGED_FRAME_POSITIONS["TalkingHeadFrame"] = nil @@ -62,7 +98,7 @@ function m:Reanchor() self:ClearAllPoints() - self:SetPoint('BOTTOMLEFT', _G[self.anchorFrame], 'TOPLEFT', -4, 24) + self:SetPoint(self.anchorPoint, _G[self.anchorFrame], self.anchorFrom, self.anchorX, self.anchorY) self:SetPoint('RIGHT', _G[self.anchorFrame], 'RIGHT', 2, 0) -- independent module, end @@ -76,9 +112,5 @@ function m:Update() - print('|cFF00AAFF'..self:GetName()..'|r:OnShow()', thf:IsShown(), self:IsShown()) - thf:ClearAllPoints() - thf:SetAllPoints(self) - Veneer:InternalReanchor(self) end
--- a/Modules/TalkingHead.xml Mon Jul 17 11:51:31 2017 -0400 +++ b/Modules/TalkingHead.xml Mon Aug 21 22:15:46 2017 -0400 @@ -3,6 +3,20 @@ <Script file="TalkingHead.lua" /> <Frame name="VeneerTalkingHead" mixin="VeneerTalkingHeadMixin" inherits="VeneerHandlerTemplate"> <Size x="570" y="155"/> + + <Layers> + <Layer level="OVERLAY"> + <Texture parentArray="ConfigLayer" parentKey="Name"> + <Color a="0.5" r="1" g="1" b="0" /> + </Texture> + <Texture parentArray="ConfigLayer" parentKey="Text" > + <Color a="0.5" r="0" g="1" b="1" /> + </Texture> + <Texture parentArray="ConfigLayer" parentKey="Portrait"> + <Color a="0.5" r="1" g="0" b="1" /> + </Texture> + </Layer> + </Layers> </Frame> </Ui> \ No newline at end of file
--- a/Templates.lua Mon Jul 17 11:51:31 2017 -0400 +++ b/Templates.lua Mon Aug 21 22:15:46 2017 -0400 @@ -40,14 +40,29 @@ self:Update() end +local AnchorButton_OnClick = function(self) + + local module = self:GetParent().handler + module.anchorPoint = self.anchorPoint + module:Print('Anchor set to '.. self.anchorPoint) + self:GetParent():Update() +end + +local RelativeButton_OnClick = function(self) +end + +local RelativeButton_OnDragStart = function(self) end +local RelativeButton_OnDragStop = function(self) end + + function ConfigLayer:Update() if not self.anchorButtons then self.anchorButtons = {} for _, anchorPoint in ipairs(ANCHOR_BUTTON_TYPES) do local button = CreateFrame('Button', nil, self, 'VeneerAnchorButtonTemplate') button.anchorPoint = anchorPoint - button:SetScript('OnMouseDown', function() end) - button:SetScript('OnMouseUp', function() end) + button:RegisterForClicks('AnyUp') + button:SetScript('OnClick', AnchorButton_OnClick) button:SetPoint(anchorPoint) button:SetSize(16,16) @@ -63,14 +78,45 @@ end end + if self.handler.anchorFrom and self.handler.anchorFrame then + local rb = self.relativeButton + if not rb then + rb = CreateFrame('Button', nil, self, 'VeneerAnchorButtonTemplate') + self.relativeButton = rb + rb:RegisterForClicks('AnyUp') + rb:RegisterForDrag('AnyDown') + rb:SetScript('OnClick', RelativeButton_OnClick) + rb:SetScript('OnDragStart', RelativeButton_OnDragStart) + rb:SetScript('OnDragStop', RelativeButton_OnDragStop) + end + + print('|cFF00FF88Config|r',self.handler.anchorFrom, self.handler.anchorFrame) + rb:SetPoint(self.handler.anchorFrom, _G[self.handler.anchorFrame], self.handler.anchorFrom, 0, 0) + print(rb:GetPoint(1)) + rb:GetNormalTexture():SetColorTexture(1,1,1,1) + rb:SetSize(16,16) + end + + self:RegisterForDrag('LeftButton') end + + function ConfigLayer:OnDragStart() - + self.originalX, self.originalY = self:GetCenter() + self.handler:SetMovable(true) + self.handler:StartMoving() end function ConfigLayer:OnDragStop() + local newX, newY = self:GetCenter() + local dX = newX - self.originalX + local dY = newY - self.originalY + print('registering new X/Y:', dX, dY) + + + self.handler:StopMovingOrSizing() end function ConfigLayer:OnUpdate() @@ -101,13 +147,13 @@ -- Replace if module requires anything besides fixing frame anchors function Handler:OnShow() self:Reanchor() - Veneer:StaticReanchor(self) + _G.Veneer:StaticReanchor(self) end function Handler:OnHide() - Veneer:DynamicReanchor() + _G.Veneer:DynamicReanchor() end function Handler:Reanchor (anchorAll) - Veneer:DynamicReanchor() + _G.Veneer:DynamicReanchor() end -- Replace if module needs to do more than reconcile SavedVariables pointers
--- a/Veneer.lua Mon Jul 17 11:51:31 2017 -0400 +++ b/Veneer.lua Mon Aug 21 22:15:46 2017 -0400 @@ -4,7 +4,7 @@ -- 3. Setup() where (not self.initialized) -- 4. Update() -- 5. Reanchor() -local ADDON, Veneer = ... +local ADDON, addon = ... local VENEER_VERSION = 703 local LE_FREE_FRAMES_GROUP = 1 local type, strrep, ipairs, tinsert, tostring, select = type, string.rep, ipairs, tinsert, tostring, select @@ -12,18 +12,22 @@ local print = DEVIAN_WORKSPACE and function(...) _G.print('Veneer', ...) end or nop local eprint = DEVIAN_WORKSPACE and function(...) _G.print('VeneerEvent', ...) end or nop local wipe = table.wipe +VeneerCore = {} +local Veneer = VeneerCore SLASH_VENEER1 = "/veneer" SLASH_VENEER2 = "/vn" SlashCmdList.VENEER = function(cmd) - if Veneer.ConfigMode then - Veneer.ConfigMode = false + _G.Veneer:print(_G.Veneer.ConfigMode) + if _G.Veneer.ConfigMode == true then + _G.Veneer.ConfigMode = false else - Veneer.ConfigMode = true + _G.Veneer.ConfigMode = true end - Veneer:UpdateConfigLayers() + _G.Veneer:UpdateConfigLayers() end + Veneer.modules = {} Veneer.Frames = {} Veneer.ConfigLayers = {} @@ -176,8 +180,8 @@ function Veneer:Setup () print('|cFFFF0088Setup()|r') - local resetConfig = (not VeneerData) if (not VeneerData) then + print('|cFF00FFFFresetting defaults|r') VeneerData = defaults VeneerData.version = VENEER_VERSION end @@ -185,6 +189,7 @@ self:ExecuteOnClusters(nil, VeneerModule_Setup) self.ConfigMode = VeneerData.ConfigMode + print('|cFF00FF88configMode =', self.ConfigMode) self:UpdateConfigLayers() self:Reanchor() self:Update() @@ -192,11 +197,10 @@ function Veneer:UpdateConfigLayers() if VeneerData then - VeneerData.ConfigMode = self.ConfigMode end - self:print('Config mode '..(self.ConfigMode and '|cFF00FF00ON|r' or '|cFFFF0000OFF|r')..'.') + self:print('Config mode '..(self.ConfigMode and '|cFF00FF00ON|r' or '|cFFFF0000OFF|r')..'. ', tostring(self.ConfigMode)) self:ExecuteOnClusters(nil, function(frame) if frame.UpdateConfigLayers then frame:UpdateConfigLayers(self.ConfigMode) @@ -246,10 +250,12 @@ if not handler.anchorFrame then - local primaryAnchor = handler.anchorPoint or 'CENTER' + local clusterAnchor = handler.anchorGroup or handler.anchorPoint or 'CENTER' local clusterPriority = handler.anchorPriority - self.FrameClusters[primaryAnchor] = self.FrameClusters[primaryAnchor] or {} - local clusterTable = self.FrameClusters[primaryAnchor] + print('panel group =', clusterAnchor) + + self.FrameClusters[clusterAnchor] = self.FrameClusters[clusterAnchor] or {} + local clusterTable = self.FrameClusters[clusterAnchor] local clusterIndex if clusterPriority then @@ -275,7 +281,7 @@ tinsert(clusterTable, clusterIndex, handler) - print(' cluster', (clusterDepth or 1) .. '.' .. primaryAnchor, clusterTable, 'priority', clusterPriority, 'position', clusterIndex) + print(' cluster', clusterAnchor, clusterTable, 'priority', clusterPriority, 'position', clusterIndex) handler.anchorCluster = clusterTable handler.anchorIndex = clusterIndex @@ -337,8 +343,9 @@ parent = parent or self local print = eprint print('|cFF88FF00DynamicReanchor()') - for anchorPoint, cluster in pairs(parent.FrameClusters) do - if anchorPoint ~= LE_FREE_FRAMES_GROUP then + for clusterPoint, cluster in pairs(parent.FrameClusters) do + print(clusterPoint) + if clusterPoint ~= LE_FREE_FRAMES_GROUP then local lastFrame for index, frame in ipairs(cluster) do print(' |cFF00FF00'..index, frame:GetName(), frame:IsShown(), (lastFrame and ('|cFFFFFF00'..lastFrame:GetName()..'|r') or '|cFF00FFFFUIParent')) @@ -349,15 +356,16 @@ frame:SetPoint(frame.anchorPoint, frame.anchorFrame, frame.anchorFrom, frame.anchorX, frame.anchorY) print('anchored to', frame.anchorFrame,frame:GetTop(), frame:GetRight()) else - anchorPoint = frame.anchorPoint or anchorPoint + local anchorPoint = frame.anchorPoint or clusterPoint + local anchorFrom = frame.anchorFrom or ANCHOR_OFFSET_POINT[clusterPoint] frame:ClearAllPoints() if lastFrame then - frame:SetPoint(anchorPoint, lastFrame, ANCHOR_OFFSET_POINT[anchorPoint], 0, 0) + frame:SetPoint(anchorPoint, lastFrame, anchorFrom, 0, 0) - print('moved after', lastFrame,frame:GetTop(), frame:GetRight()) + print(' fixing to', lastFrame, anchorPoint, anchorFrom, frame:GetTop(), frame:GetRight()) else - frame:SetPoint(anchorPoint, UIParent, anchorPoint, frame.anchorX, frame.anchorY) - print('stub', anchorPoint, frame.anchorX, frame.anchorY) + frame:SetPoint(anchorPoint, UIParent, clusterPoint, frame.anchorX, frame.anchorY) + print('NEW', clusterPoint, anchorPoint, anchorFrom, frame.anchorX, frame.anchorY) end lastFrame = frame end @@ -507,5 +515,3 @@ end return veneer end - -VeneerCore = Veneer \ No newline at end of file