Skip to content

Commit

Permalink
[PATCH] Added a keybinding to click the cork frame, and added an opti…
Browse files Browse the repository at this point in the history
…on to limit the tooltip lines
  • Loading branch information
James Whitehead authored and tekkub committed Aug 28, 2008
1 parent ae5f06d commit bed8a72
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
5 changes: 5 additions & 0 deletions Bindings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Bindings>
<Binding name="CLICK CorkFrame:LeftButton" header="CORK">
-- Click the CorkFrame
</Binding>
</Bindings>
22 changes: 18 additions & 4 deletions Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ frame:SetScript("OnShow", function()
Cork.Update()
end)


local castonpets, groupthresh, groupthreshtext
if Cork.hasgroupspell then
castonpets = tekcheck.new(frame, nil, "Cast on group pets", "TOP", showanchor, "TOP")
Expand All @@ -46,16 +45,25 @@ frame:SetScript("OnShow", function()
for name,dataobj in pairs(Cork.corks) do dataobj:Scan() end
end)

groupthresh, groupthreshtext = LibStub("tekKonfig-Slider").new(frame, "Group Threshold: ".. Cork.dbpc.multithreshold, 1, 5, "TOPLEFT", castonpets, "BOTTOMLEFT", GAP*2, -GAP)
groupthresh.tiptext = "Minimum number of needy players in a group required to cast multi-target spells."
groupthresh, groupthreshtext = LibStub("tekKonfig-Slider").new(frame, "Group Threshold: ".. Cork.dbpc.multithreshold, 1, 6, "TOPLEFT", castonpets, "BOTTOMLEFT", GAP*2, -GAP)
groupthresh.tiptext = "Minimum number of needy players in a group required to cast multi-target spells. Setting this to six will disable the automatic use of group spells."
groupthresh:SetValueStep(1)
groupthresh:SetScript("OnValueChanged", function(self, newvalue)
Cork.dbpc.multithreshold = newvalue
groupthreshtext:SetText("Group Threshold: ".. newvalue)
end)
end

local group = LibStub("tekKonfig-Group").new(frame, "Modules", "TOP", showunit, "BOTTOM", 0, -27)
local tooltiplimit, tooltiplimittext = LibStub("tekKonfig-Slider").new(frame, "Tooltip Limit: " .. Cork.dbpc.tooltiplimit, 0, 40, "TOPLEFT", showunit, "BOTTOMLEFT", GAP*2, -GAP)
tooltiplimit.tiptext = "The number of units to show in the Cork tooltip."
tooltiplimit:SetValueStep(1)
tooltiplimit:SetValue(Cork.dbpc.tooltiplimit)
tooltiplimit:SetScript("OnValueChanged", function(self, newvalue)
Cork.dbpc.tooltiplimit = newvalue
tooltiplimittext:SetText("Tooltip Limit: " .. newvalue)
end)

local group = LibStub("tekKonfig-Group").new(frame, "Modules", "TOP", tooltiplimit, "BOTTOM", 0, -27)
group:SetPoint("LEFT", EDGEGAP, 0)
group:SetPoint("BOTTOMRIGHT", -EDGEGAP, EDGEGAP)

Expand Down Expand Up @@ -140,3 +148,9 @@ InterfaceOptions_AddCategory(frame)
local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local dataobj = ldb:GetDataObjectByName("CorkLauncher") or ldb:NewDataObject("CorkLauncher", {type = "launcher", icon = "Interface\\Icons\\INV_Drink_11", tocname = "Cork"})
dataobj.OnClick = function() InterfaceOptionsFrame_OpenToFrame(frame) end

----------------------------
-- Key Binding --
----------------------------
setglobal("BINDING_HEADER_CORK", "Cork")
setglobal("BINDING_NAME_CLICK CorkFrame:LeftButton", "Click the Cork frame")
6 changes: 4 additions & 2 deletions Cork.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

local ldb, ae = LibStub:GetLibrary("LibDataBroker-1.1"), LibStub("AceEvent-3.0")

Cork = {petmappings = {player = "pet"}, defaultspc = {castonpets = false, multithreshold = 2}, corks = {}, petunits = {pet = true}, keyblist = {CorkIt = true, type = true, Scan = true, Init = true, configframe = true}}
Cork = {petmappings = {player = "pet"}, defaultspc = {castonpets = false, multithreshold = 2, tooltiplimit = 10}, corks = {}, petunits = {pet = true}, keyblist = {CorkIt = true, type = true, Scan = true, Init = true, configframe = true}}
local corks = Cork.corks
local defaults = {point = "TOP", x = 0, y = -100, showanchor = true, showunit = false}
local tooltip, anchor
Expand Down Expand Up @@ -134,10 +134,12 @@ function Cork.Update(event, name, attr, value, dataobj)
tooltip:SetOwner(anchor, "ANCHOR_NONE")
tooltip:SetPoint(GetTipAnchor(anchor))

local count = 0
for name,dataobj in pairs(corks) do
for i,v in ldb:pairs(dataobj) do
if not Cork.keyblist[i] then
if not Cork.keyblist[i] and count < Cork.dbpc.tooltiplimit then
if Cork.db.showunit then tooltip:AddDoubleLine(v, i) else tooltip:AddLine(v) end
count = count + 1
end
end
end
Expand Down

0 comments on commit bed8a72

Please sign in to comment.