Mercurial > wow > devian
diff UI.lua @ 72:da5ff1fc9fb6
- Fixed an issue with creating more than one output channel per UI session.
- Cleanup of globals for slightly better performance when printing to a lot of channels at once
author | Nenue |
---|---|
date | Sat, 09 Apr 2016 05:51:19 -0400 |
parents | d73b883b415b |
children | 80ad43c94033 |
line wrap: on
line diff
--- a/UI.lua Mon Mar 28 02:09:53 2016 -0400 +++ b/UI.lua Sat Apr 09 05:51:19 2016 -0400 @@ -320,7 +320,7 @@ end -- new channel overrides if isNew then - if D.sigID[sig]then -- find a non-clashing signature + if D.sigID[sig] then -- find a non-clashing signature local result, i = sig, 1 while D.sigID[result] do result = sig .. i @@ -330,6 +330,8 @@ end t_id = self.max_channel + 1 t_info.index = t_id + + self.max_channel = t_id --@debug@ --print('setchan(3a) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@ else @@ -452,3 +454,67 @@ self:Print('toggled: '..concat(result, ', ')) end end + +local frame_helper = CreateFrame('Frame', 'DevianFrameHelper', UIParent) +frame_helper.fill = frame_helper:CreateTexture(nil, 'BACKGROUND') +frame_helper.fill:SetTexture(1,0,0,1) +frame_helper.fill:SetAllPoints(frame_helper) +D.FrameHelper_Update = function(input, editbox) + local frame, func = D:GetArgs(input,2) + + if type(frame) == 'string' then + if not _G[frame] then + return + end + frame = _G[frame] + elseif type(frame) == 'table' and frame.IsVisible then + local x, y = frame:GetCenter() + if not (x or y) then + frame_helper:ClearAllPoints() + frame_helper:SetPoint('CENTER') + end + else + local frame = EnumerateFrames(); -- Get the first frame + while frame do + if ( frame:IsVisible() and MouseIsOver(frame) ) then + print(frame:GetName() or string.format("[Unnamed Frame: %s]", tostring(frame))); + end + frame = EnumerateFrames(frame); -- Get the next frame + end + end + + frame_helper:SetPoint('TOPLEFT', UIParent, 'BOTTOMLEFT', frameHandle:GetLeft(), frameHandle:GetTop()) + frame_helper:SetPoint('BOTTOMRIGHT', UIParent, 'BOTTOMLEFT', frameHandle:GetRight(), frameHandle:GetBottom()) + +end + + +local frame_guide_init = function(self) + self.testU = self.testU or self:CreateTexture('TestU', 'OVERLAY', 'VnTestLine') + self.testB = self.testB or self:CreateTexture('TestB', 'OVERLAY', 'VnTestLine') + self.testL = self.testL or self:CreateTexture('TestL', 'OVERLAY', 'VnTestLine') + self.testR = self.testR or self:CreateTexture('TestR', 'OVERLAY', 'VnTestLine') +end +local frame_guide = function(self, target) + if not target then return end + if target:IsDragging() then return end + local thickness = 1 + local midX, midY = target:GetCenter() + local width, height = target:GetWidth() * 1.5, target:GetHeight() * 1.5 + --print('frame', target:GetLeft(), target:GetTop(), target:GetRight(), target:GetBottom()) + self.testB:ClearAllPoints() + self.testB:SetPoint('TOP', UIParent, 'BOTTOMLEFT', midX, target:GetBottom()) + self.testB:SetSize(width,thickness) + + self.testU:ClearAllPoints() + self.testU:SetPoint('BOTTOM', UIParent, 'BOTTOMLEFT', midX, target:GetTop()) + self.testU:SetSize(width,thickness) + + self.testL:ClearAllPoints() + self.testL:SetPoint('RIGHT', UIParent, 'BOTTOMLEFT', target:GetLeft(), midY) + self.testL:SetSize(thickness,height) + + self.testR:ClearAllPoints() + self.testR:SetPoint('LEFT', UIParent, 'BOTTOMLEFT', target:GetRight(), midY) + self.testR:SetSize(thickness,height) +end \ No newline at end of file