File choir.lua changed (mode: 100644) (index 1adb44c..29eea44) |
... |
... |
local function createRoleWidget(unitButton) |
151 |
151 |
roleWidget.artwork = artwork |
roleWidget.artwork = artwork |
152 |
152 |
|
|
153 |
153 |
roleWidget:RegisterEvent('LFG_ROLE_UPDATE') |
roleWidget:RegisterEvent('LFG_ROLE_UPDATE') |
|
154 |
|
roleWidget:RegisterEvent('PARTY_MEMBERS_CHANGED') |
154 |
155 |
roleWidget:RegisterEvent('PLAYER_ENTERING_BATTLEGROUND') |
roleWidget:RegisterEvent('PLAYER_ENTERING_BATTLEGROUND') |
155 |
156 |
roleWidget:RegisterEvent('PLAYER_ENTERING_WORLD') |
roleWidget:RegisterEvent('PLAYER_ENTERING_WORLD') |
156 |
157 |
roleWidget:RegisterEvent('PLAYER_ROLES_ASSIGNED') |
roleWidget:RegisterEvent('PLAYER_ROLES_ASSIGNED') |
157 |
158 |
roleWidget:RegisterEvent('PLAYER_TALENT_UPDATE') |
roleWidget:RegisterEvent('PLAYER_TALENT_UPDATE') |
|
159 |
|
roleWidget:RegisterEvent('RAID_ROSTER_UPDATE') |
158 |
160 |
roleWidget:RegisterEvent('ZONE_CHANGED_NEW_AREA') |
roleWidget:RegisterEvent('ZONE_CHANGED_NEW_AREA') |
159 |
161 |
|
|
160 |
162 |
roleWidget:SetScript('OnEvent', roleWidgetEventProcessor) |
roleWidget:SetScript('OnEvent', roleWidgetEventProcessor) |
|
... |
... |
local function arrangeEveryRaidGroupFrame(raidFrame) |
863 |
865 |
assert (raidFrame ~= nil) |
assert (raidFrame ~= nil) |
864 |
866 |
|
|
865 |
867 |
local activeRaidGroupQuantity = 0 |
local activeRaidGroupQuantity = 0 |
866 |
|
local marginLeft = 12 * 6 |
|
867 |
868 |
local maxRowQuantity = 4 |
local maxRowQuantity = 4 |
868 |
869 |
local padding = 0 |
local padding = 0 |
869 |
870 |
local row = 0 |
local row = 0 |
|
871 |
|
local column = 0 |
870 |
872 |
|
|
871 |
873 |
local i = 0 |
local i = 0 |
872 |
874 |
local t = {raidFrame:GetChildren()} |
local t = {raidFrame:GetChildren()} |
873 |
|
local x = 0 |
|
874 |
|
local y = 0 |
|
|
875 |
|
local x |
|
876 |
|
local y |
875 |
877 |
while (i < #t) do |
while (i < #t) do |
876 |
878 |
i = i + 1 |
i = i + 1 |
877 |
879 |
local raidGroupFrame = t[i] |
local raidGroupFrame = t[i] |
878 |
880 |
if raidGroupFrame and raidGroupFrame:IsShown() then |
if raidGroupFrame and raidGroupFrame:IsShown() then |
|
881 |
|
x = column * (raidGroupFrame:GetWidth() + padding) |
|
882 |
|
y = row * (raidGroupFrame:GetHeight() + padding) |
879 |
883 |
raidGroupFrame:SetPoint('BOTTOMLEFT', raidFrame, 'BOTTOMLEFT', x, y) |
raidGroupFrame:SetPoint('BOTTOMLEFT', raidFrame, 'BOTTOMLEFT', x, y) |
880 |
|
x = math.floor(activeRaidGroupQuantity / maxRowQuantity) * (marginLeft + raidGroupFrame:GetWidth() + padding) |
|
881 |
|
y = y + raidGroupFrame:GetHeight() + padding |
|
882 |
884 |
row = row + 1 |
row = row + 1 |
883 |
|
if row > maxRowQuantity then |
|
|
885 |
|
if row >= maxRowQuantity then |
884 |
886 |
row = 0 |
row = 0 |
885 |
|
y = 0 |
|
|
887 |
|
column = column + 1 |
886 |
888 |
end |
end |
887 |
889 |
activeRaidGroupQuantity = activeRaidGroupQuantity + 1 |
activeRaidGroupQuantity = activeRaidGroupQuantity + 1 |
888 |
890 |
end |
end |
|
... |
... |
local function createRaidGroupFrame(raidFrame, groupNumber, unitSetOverride) |
1008 |
1010 |
local n = groupFrame:GetName() .. 'RaidUnitButton' .. tostring(i) |
local n = groupFrame:GetName() .. 'RaidUnitButton' .. tostring(i) |
1009 |
1011 |
local b = createUnitButton(groupFrame, n, unitDesignation, |
local b = createUnitButton(groupFrame, n, unitDesignation, |
1010 |
1012 |
'PLAYER HELPFUL', 'HARMFUL', buttonWidth, buttonHeight) |
'PLAYER HELPFUL', 'HARMFUL', buttonWidth, buttonHeight) |
|
1013 |
|
buttonWidth = math.max(buttonWidth, b:GetWidth()) |
|
1014 |
|
buttonHeight = math.max(buttonHeight, b:GetHeight()) |
1011 |
1015 |
b:SetPoint('BOTTOMLEFT', labelWidth + (i - 1) * (padding + b:GetWidth()), 0) |
b:SetPoint('BOTTOMLEFT', labelWidth + (i - 1) * (padding + b:GetWidth()), 0) |
1012 |
1016 |
end |
end |
|
1017 |
|
groupFrame:SetSize(labelWidth + maxPartySize * (buttonWidth + padding), |
|
1018 |
|
buttonHeight + padding) |
1013 |
1019 |
|
|
1014 |
1020 |
groupFrame:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
groupFrame:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
1015 |
1021 |
groupFrame:RegisterEvent('PARTY_MEMBERS_CHANGED') |
groupFrame:RegisterEvent('PARTY_MEMBERS_CHANGED') |
|
... |
... |
local function createRaidGroupFrame(raidFrame, groupNumber, unitSetOverride) |
1024 |
1030 |
end |
end |
1025 |
1031 |
|
|
1026 |
1032 |
local function raidFrameEventProcessor(raidFrame) |
local function raidFrameEventProcessor(raidFrame) |
|
1033 |
|
assert (raidFrame ~= nil) |
|
1034 |
|
|
|
1035 |
|
arrangeEveryRaidGroupFrame(raidFrame) |
|
1036 |
|
end |
|
1037 |
|
|
|
1038 |
|
local function raidFrameDisable(raidFrame) |
|
1039 |
|
assert (raidFrame ~= nil) |
|
1040 |
|
|
|
1041 |
|
raidFrame:UnregisterAllEvents() |
|
1042 |
|
raidFrame:SetScript('OnEvent', nil) |
|
1043 |
|
raidFrame:Hide() |
|
1044 |
|
end |
|
1045 |
|
|
|
1046 |
|
local function raidFrameEnable(raidFrame) |
|
1047 |
|
assert (raidFrame ~= nil) |
|
1048 |
|
|
|
1049 |
|
local x = ChoirConfRaidX or 0 |
|
1050 |
|
x = math.min(math.max(0, x), UIParent:GetWidth()) |
|
1051 |
|
|
|
1052 |
|
local y = ChoirConfRaidY or 0 |
|
1053 |
|
y = math.min(math.max(0, y), UIParent:GetHeight()) |
|
1054 |
|
|
|
1055 |
|
raidFrame:SetPoint('BOTTOMLEFT', x, y) |
|
1056 |
|
|
|
1057 |
|
raidFrame:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
|
1058 |
|
raidFrame:RegisterEvent('PARTY_MEMBERS_CHANGED') |
|
1059 |
|
raidFrame:RegisterEvent('RAID_ROSTER_UPDATE') |
|
1060 |
|
raidFrame:SetScript('OnEvent', raidFrameEventProcessor) |
|
1061 |
|
raidFrame:Show() |
|
1062 |
|
|
|
1063 |
|
arrangeEveryRaidGroupFrame(raidFrame) |
|
1064 |
|
end |
|
1065 |
|
|
|
1066 |
|
local function raidFrameToggle(raidFrame) |
|
1067 |
|
assert (raidFrame ~= nil) |
|
1068 |
|
|
1027 |
1069 |
if ChoirConfRaidFlag then |
if ChoirConfRaidFlag then |
1028 |
|
raidFrame:Show() |
|
1029 |
|
arrangeEveryRaidGroupFrame(raidFrame) |
|
|
1070 |
|
raidFrameEnable(raidFrame) |
1030 |
1071 |
else |
else |
1031 |
|
raidFrame:Hide() |
|
|
1072 |
|
raidFrameDisable(raidFrame) |
1032 |
1073 |
end |
end |
1033 |
1074 |
end |
end |
1034 |
1075 |
|
|
|
... |
... |
local function createRaidFrame(rootFrame, spoilerHolder) |
1036 |
1077 |
assert (rootFrame ~= nil) |
assert (rootFrame ~= nil) |
1037 |
1078 |
assert (spoilerHolder ~= nil) |
assert (spoilerHolder ~= nil) |
1038 |
1079 |
|
|
1039 |
|
local maxPartySize = 5 |
|
|
1080 |
|
--[[local maxPartySize = 5]]-- |
1040 |
1081 |
local maxSubgroupQuantity = 8 |
local maxSubgroupQuantity = 8 |
1041 |
1082 |
|
|
1042 |
|
local buttonWidth = 72 |
|
1043 |
|
local buttonHeight = 12 * 6 |
|
1044 |
|
local padding = 2 |
|
|
1083 |
|
local groupWidth = 0 |
|
1084 |
|
local groupHeight = 0 |
1045 |
1085 |
|
|
1046 |
|
local labelWidth = 60 |
|
1047 |
1086 |
local raidFrame = CreateFrame('FRAME', 'ChoirRaidFrame', rootFrame) |
local raidFrame = CreateFrame('FRAME', 'ChoirRaidFrame', rootFrame) |
1048 |
|
raidFrame:SetSize(labelWidth + (padding + buttonWidth) * maxPartySize, |
|
1049 |
|
(padding + buttonHeight) * (maxSubgroupQuantity / 2)) |
|
1050 |
1087 |
|
|
1051 |
1088 |
local j = 0 |
local j = 0 |
1052 |
1089 |
while (j < maxSubgroupQuantity) do |
while (j < maxSubgroupQuantity) do |
1053 |
1090 |
j = j + 1 |
j = j + 1 |
1054 |
|
createRaidGroupFrame(raidFrame, j) |
|
|
1091 |
|
local g = createRaidGroupFrame(raidFrame, j) |
|
1092 |
|
groupWidth = math.max(groupWidth, g:GetWidth()) |
|
1093 |
|
groupHeight = math.max(groupHeight, g:GetHeight()) |
1055 |
1094 |
end |
end |
1056 |
1095 |
|
|
1057 |
1096 |
--[[ NOTE Appearance of the party frame is conditional, only shown outside of raid. |
--[[ NOTE Appearance of the party frame is conditional, only shown outside of raid. |
|
... |
... |
local function createRaidFrame(rootFrame, spoilerHolder) |
1060 |
1099 |
local playerPartyFrame = createRaidGroupFrame(raidFrame, maxSubgroupQuantity + 1, partyUnitSet) |
local playerPartyFrame = createRaidGroupFrame(raidFrame, maxSubgroupQuantity + 1, partyUnitSet) |
1061 |
1100 |
playerPartyFrame:SetScript('OnEvent', partyFrameEventProcessor) |
playerPartyFrame:SetScript('OnEvent', partyFrameEventProcessor) |
1062 |
1101 |
partyFrameEventProcessor(playerPartyFrame) |
partyFrameEventProcessor(playerPartyFrame) |
|
1102 |
|
groupWidth = math.max(groupWidth, playerPartyFrame:GetWidth()) |
|
1103 |
|
groupHeight = math.max(groupHeight, playerPartyFrame:GetHeight()) |
|
1104 |
|
|
|
1105 |
|
local maxColumnQuantity = 2 |
|
1106 |
|
local maxRowQuantity = 4 |
|
1107 |
|
assert (maxColumnQuantity * maxRowQuantity == maxSubgroupQuantity) |
|
1108 |
|
raidFrame:SetSize(groupWidth * maxColumnQuantity, |
|
1109 |
|
groupHeight * maxRowQuantity) |
1063 |
1110 |
|
|
1064 |
1111 |
raidFrame:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
raidFrame:RegisterEvent('PARTY_CONVERTED_TO_RAID') |
1065 |
1112 |
raidFrame:RegisterEvent('PARTY_MEMBERS_CHANGED') |
raidFrame:RegisterEvent('PARTY_MEMBERS_CHANGED') |
1066 |
1113 |
raidFrame:RegisterEvent('RAID_ROSTER_UPDATE') |
raidFrame:RegisterEvent('RAID_ROSTER_UPDATE') |
1067 |
1114 |
raidFrame:SetScript('OnEvent', raidFrameEventProcessor) |
raidFrame:SetScript('OnEvent', raidFrameEventProcessor) |
1068 |
|
arrangeEveryRaidGroupFrame(raidFrame) |
|
|
1115 |
|
raidFrame:SetScript('OnShow', function(self) |
|
1116 |
|
--[[ NOTE Ensure that raid frame will always be hidden |
|
1117 |
|
-- given appropriate add-on configuration setting. ]]-- |
|
1118 |
|
if not ChoirConfRaidFlag then |
|
1119 |
|
self:Hide() |
|
1120 |
|
end |
|
1121 |
|
end) |
|
1122 |
|
raidFrameToggle(raidFrame) |
1069 |
1123 |
|
|
1070 |
1124 |
--[[ WARNING For some bizzare reason, possibly related to concurrency, |
--[[ WARNING For some bizzare reason, possibly related to concurrency, |
1071 |
1125 |
-- the raid toggling initialization __must__ be called here, |
-- the raid toggling initialization __must__ be called here, |
|
... |
... |
local function applyConfRaidFrameFactory(raidFrame, confRaidCheckButton, confRai |
1522 |
1576 |
ChoirConfRaidY = y |
ChoirConfRaidY = y |
1523 |
1577 |
|
|
1524 |
1578 |
raidFrame:SetPoint('BOTTOMLEFT', x, y) |
raidFrame:SetPoint('BOTTOMLEFT', x, y) |
1525 |
|
if flag then |
|
1526 |
|
raidFrame:Show() |
|
1527 |
|
else |
|
1528 |
|
raidFrame:Hide() |
|
1529 |
|
end |
|
1530 |
|
arrangeEveryRaidGroupFrame(raidFrame) |
|
|
1579 |
|
raidFrameToggle(raidFrame) |
1531 |
1580 |
end |
end |
1532 |
1581 |
end |
end |
1533 |
1582 |
|
|
|
... |
... |
local function initConfRaidFrame(confFrame, raidFrame) |
1611 |
1660 |
ChoirConfRaidFlag = true |
ChoirConfRaidFlag = true |
1612 |
1661 |
ChoirConfRaidX = 256 |
ChoirConfRaidX = 256 |
1613 |
1662 |
ChoirConfRaidY = 768 - 48 * 8 / 2 |
ChoirConfRaidY = 768 - 48 * 8 / 2 |
|
1663 |
|
|
1614 |
1664 |
--[[ NOTE Refresh callback is executed implicitly here. ]]-- |
--[[ NOTE Refresh callback is executed implicitly here. ]]-- |
1615 |
1665 |
end |
end |
1616 |
1666 |
confFrame.default = default |
confFrame.default = default |