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 dewdrop = AceLibrary("Dewdrop-2.0")
4  
5 local L = SimpleCombatLog.loc.theme
6  
7 function SimpleCombatLog:SaveTheme(id, themeName)
8 if not self.settings[id] -- No settings.
9 or self.settings[id].theme then -- It is already a theme, noneed to save.
10 return
11 end
12  
13 local theme = self.settings[id]
14 theme.theme = themeName
15  
16 self.themes[themeName] = theme
17 self.themeDB[themeName] = theme
18  
19 self.settingDB[id] = themeName
20  
21 end
22  
23 function SimpleCombatLog:DeleteTheme(id, themeName)
24 if not self.themes[themeName] then return end
25  
26 for id, setting in pairs(self.settingDB) do
27 if setting == themeName then
28 self:Print(string.format(L["Delete Theme Failed"], themeName, id) )
29 return false
30 end
31 end
32  
33 self.themes[themeName] = nil
34 self.themeDB[themeName] = nil
35  
36 end
37  
38 local function ThemeMenuSettings(self, id, level, value)
39 if level == 1 then
40  
41 dewdrop:AddLine()
42  
43 dewdrop:AddLine(
44 'text', L["Load Theme"],
45 'tooltipTitle', L["Load Theme"],
46 'tooltipText', L.tooltip_LoadTheme,
47 'hasArrow', true,
48 'notCheckable', true,
49 'value', 'LoadTheme'
50 )
51  
52  
53 if self.settings[id] and not self:GetValue(id, 'theme') then
54 dewdrop:AddLine(
55 'text', L["Save Theme"],
56 'tooltipTitle', L["Save Theme"],
57 'tooltipText', L.tooltip_SaveTheme,
58 'hasArrow', true,
59 'notCheckable', true,
60 'value', 'SaveTheme'
61 )
62 end
63  
64 dewdrop:AddLine(
65 'text', L["Delete Theme"],
66 'tooltipTitle', L["Delete Theme"],
67 'tooltipText', L.tooltip_DeleteTheme,
68 'hasArrow', true,
69 'notCheckable', true,
70 'value', 'DeleteTheme'
71 )
72 elseif level == 2 then
73 if value == 'LoadTheme' then
74 for themeName in pairs(self.themes) do
75 local themeName = themeName
76 local themeTable = themeTable
77 local title
78 if self.themeDB[themeName] then
79 title = self:Colorize(themeName, self.defaultColors.dirty)
80 else
81 title = themeName
82 end
83  
84 dewdrop:AddLine(
85 'text', title,
86 'func', function() self:SetTheme(id, themeName) end,
87 'checked', (self:GetValue(id, 'theme') == themeName )
88 )
89 end
90  
91 elseif value == 'SaveTheme' then
92 for themeName, themeTable in pairs(self.themes) do
93 local themeName = themeName
94 local themeTable = themeTable
95 dewdrop:AddLine(
96 'text', themeName,
97 'func', function() self:SaveTheme(id, themeName) end
98 )
99 end
100 dewdrop:AddLine(
101 'text', L["Save As"],
102 'hasArrow', true,
103 'hasEditBox', true,
104 'editBoxFunc', function(text) self:SaveTheme(id, text) end
105 )
106  
107 elseif value == 'DeleteTheme' then
108 for themeName, themeTable in pairs(self.themes) do
109 local themeName = themeName
110 local themeTable = themeTable
111 dewdrop:AddLine(
112 'text', themeName,
113 'func', function() self:DeleteTheme(id, themeName) end
114 )
115 end
116 end
117  
118 end
119 end
120  
121 SimpleCombatLog.ThemeMenuSettings = ThemeMenuSettings