Mercurial > wow > reaction
comparison modules/ReAction_ConfigUI/ReAction_ConfigUI.lua @ 48:7b7d178dec52
Implemented bar-type selection, extended CreateBar functionality
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Sat, 12 Apr 2008 00:15:09 +0000 |
parents | e12b736c23c3 |
children | c3c64e2def50 |
comparison
equal
deleted
inserted
replaced
47:e12b736c23c3 | 48:7b7d178dec52 |
---|---|
46 | 46 |
47 end | 47 end |
48 end | 48 end |
49 | 49 |
50 function module:OnOptionsRefreshed(evt) | 50 function module:OnOptionsRefreshed(evt) |
51 -- TODO: refresh options frame (just OpenConfig again?) | 51 AceConfigReg:NotifyChange("ReAction") |
52 AceConfigReg:NotifyChange("ReAction-Layout") | |
52 end | 53 end |
53 | 54 |
54 function module:OnCreateBar(evt, bar) | 55 function module:OnCreateBar(evt, bar) |
55 local name = bar:GetName() | 56 local name = bar:GetName() |
56 -- AceConfig doesn't allow spaces, etc, in arg key names, and they must be | 57 -- AceConfig doesn't allow spaces, etc, in arg key names, and they must be |
154 ed:SetCallback("OnClose", | 155 ed:SetCallback("OnClose", |
155 function() | 156 function() |
156 ReAction:SetConfigMode(false) | 157 ReAction:SetConfigMode(false) |
157 end ) | 158 end ) |
158 self.editor = ed | 159 self.editor = ed |
159 AceConfigDialog:SetDefaultSize("ReAction-Layout", 600, 450) | 160 AceConfigDialog:SetDefaultSize("ReAction-Layout", 640, 420) |
160 end | 161 end |
161 | 162 |
162 AceConfigDialog:Open("ReAction-Layout", self.editor) | 163 AceConfigDialog:Open("ReAction-Layout", self.editor) |
163 ReAction:SetConfigMode(true) | 164 ReAction:SetConfigMode(true) |
164 end | 165 end |
171 end | 172 end |
172 end | 173 end |
173 | 174 |
174 function module:GetBarTypes() | 175 function module:GetBarTypes() |
175 local opts = self.optBarTypes or { } | 176 local opts = self.optBarTypes or { } |
176 self.optBarTypes = opts | 177 self.optBarTypes = { } |
177 | 178 for k,v in pairs(opts) do |
178 -- TODO: get these from module registration somehow | 179 opts[k] = nil |
179 opts[1] = "foo" | 180 end |
180 | 181 for k in pairs(ReAction.defaultBarConfig) do |
182 opts[k] = k | |
183 end | |
181 return opts | 184 return opts |
182 end | 185 end |
183 | 186 |
184 function module:CreateBar() | 187 function module:CreateBar() |
185 local name = self.tmpBarName | 188 if self.tmpBarType and self.tmpBarType ~= "" then |
186 local type = self.tmpBarType | 189 ReAction:CreateBar(self.tmpBarName, self.tmpBarType, self.tmpBarRows, self.tmpBarCols, self.tmpBarSize, self.tmpBarSpacing) |
187 | 190 self.tmpBarName = nil |
188 self.tmpBarName = nil | 191 end |
189 self.tmpBarType = nil | |
190 | |
191 -- TODO: get from module registration | |
192 -- TODO: use rows/cols info | |
193 ReAction:CreateBar(name) | |
194 end | 192 end |
195 | 193 |
196 function module:InitializeOptions() | 194 function module:InitializeOptions() |
197 -- general config options | 195 -- general config options |
198 local opts = { | 196 local opts = { |
303 desc = L["Opens ReAction global configuration settings panel"], | 301 desc = L["Opens ReAction global configuration settings panel"], |
304 func = function() | 302 func = function() |
305 self:OpenConfig() | 303 self:OpenConfig() |
306 -- you can't close a dialog in response to an options click, because the end of the | 304 -- you can't close a dialog in response to an options click, because the end of the |
307 -- handler for all the button events calls lib:Open() | 305 -- handler for all the button events calls lib:Open() |
308 -- So, schedule a close on the next appropriate event | 306 -- So, schedule a close on the next OnUpdate |
309 if self.db.profile.editorCloseOnLaunch then | 307 if self.db.profile.editorCloseOnLaunch then |
310 self.editor.selfClosePending = true | 308 self.editor.selfClosePending = true |
311 end | 309 end |
312 end, | 310 end, |
313 order = 2 | 311 order = 2 |
314 }, | 312 }, |
315 closThis = { | 313 closeThis = { |
316 type = "toggle", | 314 type = "toggle", |
317 name = L["Close on Launch"], | 315 name = L["Close on Launch"], |
318 desc = L["Close the Layout Editor when opening the ReAction global Interface Options"], | 316 desc = L["Close the Layout Editor when opening the ReAction global Interface Options"], |
319 get = function() return self.db.profile.editorCloseOnLaunch end, | 317 get = function() return self.db.profile.editorCloseOnLaunch end, |
320 set = function(info, val) self.db.profile.editorCloseOnLaunch = val end, | 318 set = function(info, val) self.db.profile.editorCloseOnLaunch = val end, |
339 order = 2, | 337 order = 2, |
340 }, | 338 }, |
341 type = { | 339 type = { |
342 type = "select", | 340 type = "select", |
343 name = L["Button Type"], | 341 name = L["Button Type"], |
344 get = function() return self.tmpBarType or "" end, | 342 get = function() return self.tmpBarType or ReAction.defaultBarConfigChoice or "" end, |
345 set = function(info, val) self.tmpBarType = val end, | 343 set = function(info, val) self.tmpBarType = val end, |
346 values = "GetBarTypes", | 344 values = "GetBarTypes", |
347 order = 3, | 345 order = 3, |
348 }, | 346 }, |
349 grid = { | 347 grid = { |