WoWInterface SVN Ara_Broker_Guild_Friends

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 22 to Rev 23
    Reverse comparison

Rev 22 → Rev 23

trunk/Ara_Broker_Guild_Friends.lua
1,6 → 1,5
-- TODO: scroll large guild members
local BUTTON_HEIGHT, ICON_SIZE, GAP, TEXT_OFFSET, MAX_ENTRIES =
15, 13, 10, 5, 46
15, 13, 10, 5
 
local f = CreateFrame( "Frame", "AraBrokerGuildFriends", UIParent )
local t = CreateFrame"Frame"
192,7 → 191,7
end
 
local function Scroll(self, delta)
if slider then slider:SetValue( sliderValue - delta * (IsModifierKeyDown() and 10 or 3) ) end
slider:SetValue( sliderValue - delta * (IsModifierKeyDown() and 10 or 3) )
end
 
local buttons = setmetatable( { }, { __index = function( table, key )
215,7 → 214,6
motd:SetPoint( "TOPLEFT", f, "TOPLEFT", GAP, -GAP )
else
button:SetHeight( BUTTON_HEIGHT )
-- button:SetPoint( "TOPLEFT", table[key-1], "BOTTOMLEFT" )
button.icon = button:CreateTexture()
button.icon:SetWidth( ICON_SIZE ) button.icon:SetHeight( ICON_SIZE )
button.icon:SetPoint( "LEFT", button, "LEFT" )
231,7 → 229,6
 
local function SetButtonData( index, name, class, level, zone, notes, rank, inGroup, isGrouped )
local button = buttons[index]
-- if index > nbEntries then button:Hide() else button:Show() end
button.fontName:SetText( name or "" )
if class then
if index > 1 then
264,42 → 261,35
return button, button.fontName:GetStringWidth()
end
 
local function UpdateScrollButtons(nbEntries)
local btn = buttons[1]
for i=2, #buttons do buttons[i]:Hide() end
for i=2, nbEntries do
button = buttons[sliderValue+i]
button:SetPoint("TOPLEFT", btn, "TOPLEFT", 0, BUTTON_HEIGHT*(1-i))
button:Show()
end
end
 
ShowTablet = function( self, _isGuild )
f:Show()
isGuild = _isGuild
 
MAX_ENTRIES = floor( WorldFrame:GetHeight() / ( BUTTON_HEIGHT * f:GetEffectiveScale() ) ) - (config.hideHints and 6 or 12)
slider:SetHeight(BUTTON_HEIGHT*MAX_ENTRIES)
 
local entries = isGuild and guildEntries or friendEntries
local hasEntries = #entries > 0
hasSlider = #entries > MAX_ENTRIES
 
if not hasEntries then
entries[1] = new( nil, isGuild and ERR_GUILD_PLAYER_NOT_IN_GUILD or "No friends online.", "" )
elseif hasSlider then
if not slider then
slider = CreateFrame("Slider", nil, f)
slider:SetWidth(16)
slider:SetHeight(BUTTON_HEIGHT*MAX_ENTRIES-1) -- 21 entries
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal")
slider:SetBackdrop( {
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
edgeSize = 8, tile = true, tileSize = 8,
insets = {left = 3, right = 3, top = 6, bottom = 6}
} )
slider:SetValueStep(1)
slider:SetScript( "OnLeave", Menu_OnLeave )
slider:SetValue(1)
slider:SetScript( "OnValueChanged", function(self, value)
if hasSlider then sliderValue = value end
if block then ShowTablet(block, isGuild) end
end )
end
end
if hasSlider then
slider:SetMinMaxValues( 0, #entries - MAX_ENTRIES )
slider:SetValue(sliderValue)
slider:Show()
elseif slider then
slider:Hide()
end
else slider:Hide() end
 
nbEntries = math.min( MAX_ENTRIES, #entries )
local nameC, levelC, zoneC, notesC, rankC = 0, 0, 0, 0, 0
341,13 → 331,7
buttons[1]:SetPoint( "TOPLEFT", f, "TOPLEFT", GAP, -GAP )
end
 
local btn = buttons[1]
for i=2, #buttons do buttons[i]:Hide() end
for i=2, nbEntries do
button = buttons[sliderValue+i]
button:SetPoint("TOPLEFT", btn, "TOPLEFT", 0, BUTTON_HEIGHT*(1-i))
button:Show()
end
UpdateScrollButtons(nbEntries)
 
for i=1, #entries do
button = buttons[i]
360,7 → 344,7
end
colspace[2], colspace[3], colspace[4], colspace[5], colspace[6] = nameC, levelC, zoneC, notesC, rankC
 
if slider then slider:SetPoint("TOPRIGHT", buttons[2], "TOPRIGHT", 19 + TEXT_OFFSET, BUTTON_HEIGHT*.5) end
if hasSlider then slider:SetPoint("TOPRIGHT", buttons[2], "TOPRIGHT", 19 + TEXT_OFFSET, BUTTON_HEIGHT*.5) end
f:SetWidth( maxWidth + GAP*2 + (hasSlider and 16 + TEXT_OFFSET*2 or 0) )
f:SetHeight( BUTTON_HEIGHT * nbEntries + extraHeight + GAP*2 )
 
469,7 → 453,7
end
 
function f:ADDON_LOADED( event, addon )
if addon ~= "Ara_Broker_Guild_Friends" then return else self:UnregisterEvent(event) end
if addon ~= "Ara_Broker_Guild_Friends" then return else f:UnregisterEvent(event) end
AraBrokerGuildFriendsDB = AraBrokerGuildFriendsDB or defaultConfig
config = AraBrokerGuildFriendsDB
for k, v in next, defaultConfig do if config[k]==nil then config[k]=v end end
498,6 → 482,24
f:RegisterEvent"FRIENDLIST_UPDATE"
f:RegisterEvent"CHAT_MSG_SYSTEM"
 
slider = CreateFrame("Slider", nil, f)
slider:SetWidth(16)
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal")
slider:SetBackdrop( {
bgFile = "Interface\\Buttons\\UI-SliderBar-Background",
edgeFile = "Interface\\Buttons\\UI-SliderBar-Border",
edgeSize = 8, tile = true, tileSize = 8,
insets = {left = 3, right = 3, top = 6, bottom = 6}
} )
slider:SetValueStep(1)
slider:SetScript( "OnLeave", Menu_OnLeave )
slider:SetScript( "OnValueChanged", function(self, value)
if hasSlider then
sliderValue = value
if block then UpdateScrollButtons(MAX_ENTRIES) end
end
end )
 
ShowFriends()
if IsInGuild(buttons[0]) then GuildRoster() else t.guildTimer = 0 end
f:GuildOnEnter()
trunk/Ara_Broker_Guild_Friends.toc
1,6 → 1,6
## Interface: 30200
## Title: |cFFFFB366Ara|r - Broker - Guild & Friends
## Version: r20
## Version: r21
## Author: Ara
## Notes: A Data Broker plugin that provides guildmates & friends informations and interactions.
## SavedVariables: AraBrokerGuildFriendsDB