public
Description: WoW Addon - Generic reminder framework
Homepage: http://www.tekkub.net/
Clone URL: git://github.com/tekkub/cork.git
Click here to lend your support to: cork and make a donation at www.pledgie.com !
Simplify mousewheel binding
tekkub (author)
Mon Sep 15 00:40:12 -0700 2008
commit  7cecf3e3753e6515086c201af9034d957e244269
tree    2288cc646bc398c2c5a1a8e51fa129c75125863b
parent  6fd4c085ccaacb6f8bb6765f8a873babd8e46849
...
35
36
37
 
 
 
 
 
 
 
 
 
38
39
40
...
58
59
60
61
 
62
63
64
...
68
69
70
71
 
72
73
74
...
121
122
123
 
124
125
126
...
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
...
67
68
69
 
70
71
72
73
...
77
78
79
 
80
81
82
83
...
130
131
132
133
134
135
136
0
@@ -35,6 +35,15 @@ frame:SetScript("OnShow", function()
0
   end)
0
 
0
 
0
+ local bindwheel = tekcheck.new(frame, nil, "Bind mousewheel", "TOPLEFT", showunit, "BOTTOMLEFT", 0, -GAP)
0
+ bindwheel.tiptext = "Bind to mousewheel when out of combat and needs are present."
0
+ bindwheel:SetScript("OnClick", function(self)
0
+ checksound(self)
0
+ Cork.db.bindwheel = not Cork.db.bindwheel
0
+ Cork.UpdateMouseBinding()
0
+ end)
0
+
0
+
0
   local tooltiplimit, tooltiplimittext, ttlcontainer = LibStub("tekKonfig-Slider").new(frame, "Tooltip Limit: " .. Cork.dbpc.tooltiplimit, 0, 40, "TOP", showanchor, "TOP")
0
   ttlcontainer:SetPoint("LEFT", frame, "CENTER", GAP*5/2, 0)
0
   tooltiplimit.tiptext = "The number of units to show in the Cork tooltip."
0
@@ -58,7 +67,7 @@ frame:SetScript("OnShow", function()
0
     end)
0
 
0
 --~     castonpets = tekcheck.new(frame, nil, "Cast on group pets", "TOPLEFT", groupthreshcont, "BOTTOMLEFT", -GAP*2, 0)
0
- castonpets = tekcheck.new(frame, nil, "Cast on group pets", "TOPLEFT", showunit, "BOTTOMLEFT", 0, -GAP)
0
+ castonpets = tekcheck.new(frame, nil, "Cast on group pets", "TOPLEFT", bindwheel, "BOTTOMLEFT", 0, -GAP)
0
     castonpets.tiptext = "Pets need buffs too! When disabled you can still cast on a pet by targetting it directly."
0
     castonpets:SetScript("OnClick", function(self)
0
       checksound(self)
0
@@ -68,7 +77,7 @@ frame:SetScript("OnShow", function()
0
   end
0
 
0
 
0
- local group = LibStub("tekKonfig-Group").new(frame, "Modules", "TOP", castonpets or showunit, "BOTTOM", 0, -27)
0
+ local group = LibStub("tekKonfig-Group").new(frame, "Modules", "TOP", castonpets or bindwheel, "BOTTOM", 0, -27)
0
   group:SetPoint("LEFT", EDGEGAP, 0)
0
   group:SetPoint("BOTTOMRIGHT", -EDGEGAP, EDGEGAP)
0
 
0
@@ -121,6 +130,7 @@ frame:SetScript("OnShow", function()
0
   local function Update(self)
0
     showanchor:SetChecked(Cork.db.showanchor)
0
     showunit:SetChecked(Cork.db.showunit)
0
+ bindwheel:SetChecked(Cork.db.bindwheel)
0
     if castonpets then castonpets:SetChecked(Cork.dbpc.castonpets) end
0
     if groupthresh then groupthresh:SetValue(Cork.dbpc.multithreshold) end
0
     for i,row in pairs(rows) do
...
3
4
5
6
 
7
8
9
...
3
4
5
 
6
7
8
9
0
@@ -3,7 +3,7 @@ local ldb, ae = LibStub:GetLibrary("LibDataBroker-1.1"), LibStub("AceEvent-3.0")
0
 
0
 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}}
0
 local corks = Cork.corks
0
-local defaults = {point = "TOP", x = 0, y = -100, showanchor = true, showunit = false}
0
+local defaults = {point = "TOP", x = 0, y = -100, showanchor = true, showunit = false, bindwheel = false}
0
 local tooltip, anchor
0
 
0
 for i=1,4 do Cork.petmappings["party"..i], Cork.petunits["partypet"..i] = "partypet"..i, true end
...
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
 
 
 
...
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
0
@@ -1,49 +1,26 @@
0
 
0
 -- Dynamic mousewheel binding module, originally created by Adirelle <gperreal@free.fr>
0
 
0
-local CORKNAME = "Mousewheel Bindings"
0
-
0
-local dataobj = LibStub('LibDataBroker-1.1'):NewDataObject("Cork "..CORKNAME, {type='cork'})
0
-local frame
0
-local keys = { 'MOUSEWHEELUP', 'MOUSEWHEELDOWN' }
0
-
0
-------------------------------------------------------------------------------
0
--- Binding update
0
-------------------------------------------------------------------------------
0
-
0
 local function ClearBindings()
0
   if InCombatLockdown() then return end
0
- ClearOverrideBindings(frame)
0
+ ClearOverrideBindings(CorkFrame)
0
 end
0
 
0
-local function UpdateBindings()
0
+function Cork:UpdateMouseBinding(event, unit)
0
   if InCombatLockdown() then return end
0
- if Cork.dbpc[CORKNAME.."-enabled"] and Corkboard:IsVisible() and not IsStealthed() and not IsFlying() and not IsMounted() then
0
- for i,key in ipairs(keys) do
0
- SetOverrideBindingClick(frame, true, key, 'CorkFrame')
0
- end
0
+ if Cork.db.bindwheel and (event ~= "PLAYER_REGEN_DISABLED") and Corkboard:IsVisible() then
0
+ SetOverrideBindingClick(CorkFrame, true, 'MOUSEWHEELUP', 'CorkFrame')
0
+ SetOverrideBindingClick(CorkFrame, true, 'MOUSEWHEELDOWN', 'CorkFrame')
0
   else
0
- ClearBindings()
0
+ ClearOverrideBindings(CorkFrame)
0
   end
0
 end
0
 
0
-------------------------------------------------------------------------------
0
--- Addon setup
0
-------------------------------------------------------------------------------
0
 
0
-function dataobj:Init()
0
- Cork.defaultspc[CORKNAME..'-enabled'] = true
0
-
0
- frame = CreateFrame('Frame', 'CorkWheelFrame', Corkboard)
0
- frame:SetAllPoints(Corkboard)
0
- frame:SetScript('OnShow', UpdateBindings)
0
- frame:SetScript('OnHide', ClearBindings)
0
- frame:Show()
0
-
0
- local AE = LibStub('AceEvent-3.0')
0
- AE.RegisterEvent(self, 'PLAYER_AURAS_CHANGED', UpdateBindings)
0
- AE.RegisterEvent(self, 'PLAYER_REGEN_ENABLED', UpdateBindings)
0
- AE.RegisterEvent(self, 'PLAYER_REGEN_DISABLED', ClearBindings)
0
-end
0
+local frame = CreateFrame('Frame', nil, Corkboard)
0
+frame:SetScript('OnShow', Cork.UpdateMouseBinding)
0
+frame:SetScript('OnHide', ClearBindings)
0
 
0
-dataobj.Scan = UpdateBindings
0
+frame:SetScript("OnEvent", Cork.UpdateMouseBinding)
0
+frame:RegisterEvent('PLAYER_REGEN_ENABLED')
0
+frame:RegisterEvent('PLAYER_REGEN_DISABLED')

Comments

    No one has commented yet.