Mercurial > wow > devian
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 71:d636ff1b17ce | 72:da5ff1fc9fb6 |
|---|---|
| 318 t_info[k] = v | 318 t_info[k] = v |
| 319 end | 319 end |
| 320 end | 320 end |
| 321 -- new channel overrides | 321 -- new channel overrides |
| 322 if isNew then | 322 if isNew then |
| 323 if D.sigID[sig]then -- find a non-clashing signature | 323 if D.sigID[sig] then -- find a non-clashing signature |
| 324 local result, i = sig, 1 | 324 local result, i = sig, 1 |
| 325 while D.sigID[result] do | 325 while D.sigID[result] do |
| 326 result = sig .. i | 326 result = sig .. i |
| 327 i = i + 1 | 327 i = i + 1 |
| 328 end | 328 end |
| 329 t_info.signature = result | 329 t_info.signature = result |
| 330 end | 330 end |
| 331 t_id = self.max_channel + 1 | 331 t_id = self.max_channel + 1 |
| 332 t_info.index = t_id | 332 t_info.index = t_id |
| 333 | |
| 334 self.max_channel = t_id | |
| 333 --@debug@ | 335 --@debug@ |
| 334 --print('setchan(3a) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@ | 336 --print('setchan(3a) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@ |
| 335 else | 337 else |
| 336 --@debug@ | 338 --@debug@ |
| 337 --print('setchan(3b) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@ | 339 --print('setchan(3b) t_id, isNew, sig, t_info.signature=', t_id, isNew, sig, t_info.signature)--@end-debug@ |
| 450 result[i] = tostring(id) .. ' = ' .. (self.console[id].enabled and 'ON' or 'OFF') | 452 result[i] = tostring(id) .. ' = ' .. (self.console[id].enabled and 'ON' or 'OFF') |
| 451 end | 453 end |
| 452 self:Print('toggled: '..concat(result, ', ')) | 454 self:Print('toggled: '..concat(result, ', ')) |
| 453 end | 455 end |
| 454 end | 456 end |
| 457 | |
| 458 local frame_helper = CreateFrame('Frame', 'DevianFrameHelper', UIParent) | |
| 459 frame_helper.fill = frame_helper:CreateTexture(nil, 'BACKGROUND') | |
| 460 frame_helper.fill:SetTexture(1,0,0,1) | |
| 461 frame_helper.fill:SetAllPoints(frame_helper) | |
| 462 D.FrameHelper_Update = function(input, editbox) | |
| 463 local frame, func = D:GetArgs(input,2) | |
| 464 | |
| 465 if type(frame) == 'string' then | |
| 466 if not _G[frame] then | |
| 467 return | |
| 468 end | |
| 469 frame = _G[frame] | |
| 470 elseif type(frame) == 'table' and frame.IsVisible then | |
| 471 local x, y = frame:GetCenter() | |
| 472 if not (x or y) then | |
| 473 frame_helper:ClearAllPoints() | |
| 474 frame_helper:SetPoint('CENTER') | |
| 475 end | |
| 476 else | |
| 477 local frame = EnumerateFrames(); -- Get the first frame | |
| 478 while frame do | |
| 479 if ( frame:IsVisible() and MouseIsOver(frame) ) then | |
| 480 print(frame:GetName() or string.format("[Unnamed Frame: %s]", tostring(frame))); | |
| 481 end | |
| 482 frame = EnumerateFrames(frame); -- Get the next frame | |
| 483 end | |
| 484 end | |
| 485 | |
| 486 frame_helper:SetPoint('TOPLEFT', UIParent, 'BOTTOMLEFT', frameHandle:GetLeft(), frameHandle:GetTop()) | |
| 487 frame_helper:SetPoint('BOTTOMRIGHT', UIParent, 'BOTTOMLEFT', frameHandle:GetRight(), frameHandle:GetBottom()) | |
| 488 | |
| 489 end | |
| 490 | |
| 491 | |
| 492 local frame_guide_init = function(self) | |
| 493 self.testU = self.testU or self:CreateTexture('TestU', 'OVERLAY', 'VnTestLine') | |
| 494 self.testB = self.testB or self:CreateTexture('TestB', 'OVERLAY', 'VnTestLine') | |
| 495 self.testL = self.testL or self:CreateTexture('TestL', 'OVERLAY', 'VnTestLine') | |
| 496 self.testR = self.testR or self:CreateTexture('TestR', 'OVERLAY', 'VnTestLine') | |
| 497 end | |
| 498 local frame_guide = function(self, target) | |
| 499 if not target then return end | |
| 500 if target:IsDragging() then return end | |
| 501 local thickness = 1 | |
| 502 local midX, midY = target:GetCenter() | |
| 503 local width, height = target:GetWidth() * 1.5, target:GetHeight() * 1.5 | |
| 504 --print('frame', target:GetLeft(), target:GetTop(), target:GetRight(), target:GetBottom()) | |
| 505 self.testB:ClearAllPoints() | |
| 506 self.testB:SetPoint('TOP', UIParent, 'BOTTOMLEFT', midX, target:GetBottom()) | |
| 507 self.testB:SetSize(width,thickness) | |
| 508 | |
| 509 self.testU:ClearAllPoints() | |
| 510 self.testU:SetPoint('BOTTOM', UIParent, 'BOTTOMLEFT', midX, target:GetTop()) | |
| 511 self.testU:SetSize(width,thickness) | |
| 512 | |
| 513 self.testL:ClearAllPoints() | |
| 514 self.testL:SetPoint('RIGHT', UIParent, 'BOTTOMLEFT', target:GetLeft(), midY) | |
| 515 self.testL:SetSize(thickness,height) | |
| 516 | |
| 517 self.testR:ClearAllPoints() | |
| 518 self.testR:SetPoint('LEFT', UIParent, 'BOTTOMLEFT', target:GetRight(), midY) | |
| 519 self.testR:SetSize(thickness,height) | |
| 520 end |
