vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 if not SimpleCombatLog then return end
2  
3 local L = SimpleCombatLog.loc.gui
4  
5 SimpleCombatLog.menuFunc = {}
6  
7 local dewdrop = AceLibrary("Dewdrop-2.0")
8  
9 function SimpleCombatLog:SetValue(id, field, value)
10 if value == false then value = nil end
11 if not self.settings[id] then
12 self.settings[id] = {}
13 self.settingDB[id] = self.settings[id]
14 else
15 if self.settings[id].theme then
16 self.settings[id] = SimpleCombatLog.CopyTable({}, self.settings[id])
17 self.settings[id].theme = nil
18 self.settingDB[id] = self.settings[id]
19 end
20 end
21 self.settings[id][field] = value
22 end
23  
24 function SimpleCombatLog:ClearSettings(id, noRefresh)
25 if not self.settings[id] then return end
26  
27 local colors = self.settings[id].colors
28 local formats = self.settings[id].formats
29  
30 self.settings[id] = nil
31  
32 if colors or formats then
33 self.settings[id] = {
34 colors = colors,
35 formats = formats,
36 }
37 end
38  
39 self.settingDB[id] = self.settings[id]
40  
41 if not noRefresh then
42 self:RefreshSettings()
43 end
44  
45 end
46  
47 function SimpleCombatLog:ShowSettingMenu(id)
48  
49 local tabFrame
50 if type(id) == 'number' then
51 tabFrame = getglobal("ChatFrame" .. id .. "Tab")
52 else
53 tabFrame = getglobal(id)
54 end
55  
56 if not tabFrame then return end
57  
58 if not dewdrop:IsRegistered(tabFrame) then
59 dewdrop:Register(tabFrame,
60 'children', function(level, value) self:MenuSettings(id, level, value) end,
61 'dontHook', true
62 )
63 end
64  
65  
66 dewdrop:Open(tabFrame)
67 end
68  
69 function SimpleCombatLog:MenuSettings(id, level, value)
70  
71 if level == 1 then
72 dewdrop:AddLine(
73 'text', string.format( L.menuTitle, id),
74 'isTitle', true,
75 'notCheckable', true
76 )
77 end
78  
79 for i, func in pairs(self.menuFunc) do
80 func(self, id, level, value)
81 end
82  
83 if level == 1 then
84 dewdrop:AddLine(
85 'text', L.suppress,
86 'tooltipTitle', L.suppress,
87 'tooltipText', L.tooltip_suppress,
88 'func', function()
89 self:SetValue(id, 'suppress', not self:GetValue(id, 'suppress') )
90 self:RefreshSettings()
91 end,
92 'checked', self:GetValue(id, 'suppress')
93 )
94 dewdrop:AddLine(
95 'text', L.colorSkill,
96 'tooltipTitle', L.colorSkill,
97 'tooltipText', L.tooltip_colorSkill,
98 'func', function()
99 self:SetValue(id, 'colorspell', not self:GetValue(id, 'colorspell') )
100 self:RefreshSettings()
101 end,
102 'checked', self:GetValue(id, 'colorspell')
103 )
104 dewdrop:AddLine(
105 'text', L.colorEvent,
106 'tooltipTitle', L.colorEvent,
107 'tooltipText', L.tooltip_colorEvent,
108 'func', function()
109 self:SetValue(id, 'colorEvent', not self:GetValue(id, 'colorEvent') )
110 self:RefreshSettings()
111 end,
112 'checked', self:GetValue(id, 'colorEvent')
113 )
114 dewdrop:AddLine(
115 'text', L.greaterResize,
116 'tooltipTitle', L.greaterResize,
117 'tooltipText', L.tooltip_greaterResize,
118 'func', function()
119 self:SetValue(id, 'resize', not self:GetValue(id, 'resize') )
120 self:RefreshSettings()
121 end,
122 'checked', self:GetValue(id, 'resize')
123 )
124 dewdrop:AddLine()
125  
126 dewdrop:AddLine(
127 'text', L.clearSettings,
128 'tooltipTitle', L.clearSettings,
129 'tooltipText', L.tooltip_clearSettings,
130 'notCheckable', true,
131 'func', function() self:ClearSettings(id) end
132 )
133  
134  
135 end
136  
137 if self.ThemeMenuSettings then
138 self:ThemeMenuSettings(id, level, value)
139 end
140  
141 end
142  
143