public
Description: WoW Addon - Better minimap blips
Homepage: http://www.tekkub.net/
Clone URL: git://github.com/tekkub/blipstick.git
Click here to lend your support to: blipstick and make a donation at www.pledgie.com !
tekkub (author)
Sat Jan 03 20:41:10 -0800 2009
commit  a243b96f8f06aa0f02280fb6291e4a775fb2973c
tree    694778fb4a07f281eb7c4c07d24ba43e061163ff
parent  baa063849aa1f0f74c03b73717bdc8f098953b4c parent  9d097187bdab687e0c000aa3fea5072d763a0e1e
blipstick / Blipstick.lua
100644 101 lines (74 sloc) 3.013 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
----------------------
-- Locals --
----------------------
 
local DEFAULTPATH = "Interface\\Minimap\\ObjectIcons"
 
local path = "Interface\\AddOns\\Blipstick\\"
local textures = {"Default", "SmallExclaim", "LittleExclaim", "Nandini", "Nandini-black", "AlternateBlips", "HunterZSmall", "Charmed"}
 
 
------------------------------
-- Initialization --
------------------------------
 
local frame = CreateFrame("Frame", nil, InterfaceOptionsFramePanelContainer)
frame:RegisterEvent("ADDON_LOADED")
frame:SetScript("OnEvent", function (self, event, addon)
if addon ~= "Blipstick" then return end
 
BlipStickDB = BlipStickDB or {texture = path.."SmallExclaim"}
self.db = BlipStickDB
Minimap:SetBlipTexture(self.db.texture)
 
self:UnregisterEvent("ADDON_LOADED")
self:SetScript("OnEvent", nil)
end)
 
 
----------------------------
-- Config Panel --
----------------------------
 
frame.name = "Blipstick"
frame:Hide()
frame:SetScript("OnShow", function(frame)
local GAP, EDGEGAP = 8, 16
local ROWHEIGHT = (408-73-EDGEGAP) / #textures - GAP
 
local title, subtitle = LibStub("tekKonfig-Heading").new(frame, "Blipstick", "These settings let you select a different set of minimap blips to use.")
 
local anchor, rows = subtitle, {}
local function OnClick(self)
frame.db.texture = self.texture
Minimap:SetBlipTexture(self.texture)
for _,row in pairs(rows) do row:SetChecked(row == self) end
end
for _,name in ipairs(textures) do
local texture = name == "Default" and DEFAULTPATH or path..name
 
local row = CreateFrame("CheckButton", nil, frame)
row:SetHeight(ROWHEIGHT)
row:SetPoint("TOP", anchor, "BOTTOM", 0, -GAP)
row:SetPoint("LEFT", frame, "LEFT", EDGEGAP, 0)
row:SetPoint("RIGHT", frame, "RIGHT", -EDGEGAP, 0)
 
row:SetChecked(texture == frame.db.texture)
row.texture = texture
row:SetScript("OnClick", OnClick)
 
local highlight = row:CreateTexture()
highlight:SetTexture("Interface\\HelpFrame\\HelpFrameButton-Highlight")
highlight:SetTexCoord(0, 1, 0, 0.578125)
highlight:SetAllPoints()
row:SetHighlightTexture(highlight)
row:SetCheckedTexture(highlight)
 
local preview = row:CreateTexture()
preview:SetWidth(ROWHEIGHT*4) -- Maintain proper aspect
preview:SetPoint("TOPLEFT", row)
preview:SetPoint("BOTTOM", row)
preview:SetTexture(texture)
 
local text = row:CreateFontString(nil, nil, "GameFontHighlight")
text:SetPoint("LEFT", preview, "RIGHT", GAP, 0)
text:SetPoint("RIGHT", row)
text:SetText(name)
 
table.insert(rows, row)
anchor = row
end
 
frame:SetScript("OnShow", nil)
end)
 
InterfaceOptions_AddCategory(frame)
 
 
LibStub("tekKonfig-AboutPanel").new("Blipstick", "Blipstick")
 
 
----------------------------------------
-- Quicklaunch registration --
----------------------------------------
 
LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("Blipstick", {
type = "launcher",
icon = "Interface\\AddOns\\Blipstick\\icon",
OnClick = function() InterfaceOptionsFrame_OpenToCategory(frame) end,
})