Mercurial > wow > ouroloot
comparison options.lua @ 101:f7162a1cadc7
Unify remote/local change notifications, and allow option toggles for each. When passing entry tables to the registered callbacks, make proxies for them first (the goal is to prevent accidents, not fraud).
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Wed, 01 Aug 2012 06:51:52 +0000 |
parents | a57133ee3c9b |
children | fe04f5c4114a |
comparison
equal
deleted
inserted
replaced
100:a57133ee3c9b | 101:f7162a1cadc7 |
---|---|
248 container:AddChild(spacer(10)) | 248 container:AddChild(spacer(10)) |
249 do | 249 do |
250 local chatgroup = AceGUI:Create("InlineGroup") | 250 local chatgroup = AceGUI:Create("InlineGroup") |
251 chatgroup:SetLayout("List") | 251 chatgroup:SetLayout("List") |
252 chatgroup:SetRelativeWidth(0.75) | 252 chatgroup:SetRelativeWidth(0.75) |
253 chatgroup:SetTitle("Remote Changes Chat") | 253 chatgroup:SetTitle("Notify on Changes Chat") |
254 local toggle, editbox | 254 local toggle, editbox |
255 toggle = mktoggle('chatty_on_remote_changes', "Be chatty on remote changes", 1, | 255 toggle = mktoggle('chatty_on_remote_changes', "Be chatty on remote changes", 1, |
256 [[Print something to chat when other users change recorded loot.]], | 256 [[Print something to chat when other users change recorded loot.]], |
257 function (_w,_,value) | 257 function (_w,_,value) |
258 opts.chatty_on_remote_changes = value | 258 opts.chatty_on_remote_changes = value |
259 editbox:SetDisabled(not opts.chatty_on_remote_changes) | 259 editbox:SetDisabled((not opts.chatty_on_remote_changes) and |
260 (not opts.chatty_on_local_changes)) | |
260 end) | 261 end) |
261 toggle:SetFullWidth(true) | 262 toggle:SetFullWidth(true) |
262 chatgroup:AddChild(toggle) | 263 chatgroup:AddChild(toggle) |
264 toggle = mktoggle('chatty_on_local_changes', "Be chatty on your own changes", 1, | |
265 [[Print something to chat when you change recorded loot (as a reminder).]], | |
266 function (_w,_,value) | |
267 opts.chatty_on_local_changes = value | |
268 editbox:SetDisabled((not opts.chatty_on_remote_changes) and | |
269 (not opts.chatty_on_local_changes)) | |
270 end) | |
271 toggle:SetFullWidth(true) | |
272 chatgroup:AddChild(toggle) | |
273 | |
263 w = AceGUI:Create("Label") | 274 w = AceGUI:Create("Label") |
264 w:SetFullWidth(true) | 275 w:SetFullWidth(true) |
265 w:SetText("This controls the output of the |cff00ffff'Be chatty on remote changes'|r option. If this field is a number, it designates which chat frame to use. Otherwise it is the Lua variable name of a frame with AddMessage capability.") | 276 w:SetText("This controls the output of the |cff00ffff'Be chatty on <X> changes'|r options. If this field is a number, it designates which chat frame to use. Otherwise it is the Lua variable name of a frame with AddMessage capability.") |
266 chatgroup:AddChild(w) | 277 chatgroup:AddChild(w) |
267 editbox = mkbutton("EditBox", nil, opts.chatty_on_remote_changes_frame, | 278 editbox = mkbutton("EditBox", nil, opts.chatty_on_changes_frame, |
268 [[1 = default chat frame, 2 = combat log, etc]]) | 279 [[1 = default chat frame, 2 = combat log, etc]]) |
269 editbox:SetFullWidth(true) | 280 editbox:SetFullWidth(true) |
270 editbox:SetLabel("Output Chatframe") | 281 editbox:SetLabel("Output Chatframe") |
271 editbox:SetCallback("OnTextChanged", adv_careful_OnTextChanged) | 282 editbox:SetCallback("OnTextChanged", adv_careful_OnTextChanged) |
272 editbox:SetCallback("OnEnterPressed", function(_w,event,value) | 283 editbox:SetCallback("OnEnterPressed", function(_w,event,value) |
273 local prev = opts.chatty_on_remote_changes_frame | 284 local prev = opts.chatty_on_changes_frame |
274 value = value:trim() | 285 value = value:trim() |
275 value = tonumber(value) or value | 286 value = tonumber(value) or value |
276 if addon:_set_remote_change_chatframe (value) then | 287 if addon:_set_chatty_change_chatframe (value) then |
277 opts.chatty_on_remote_changes_frame = value | 288 opts.chatty_on_changes_frame = value |
278 _w:SetText(tostring(value)) | 289 _w:SetText(tostring(value)) |
279 _w.editbox:ClearFocus() | 290 _w.editbox:ClearFocus() |
280 else | 291 else |
281 _w:SetText(tostring(prev)) | 292 _w:SetText(tostring(prev)) |
282 end | 293 end |
283 end) | 294 end) |
284 editbox:SetDisabled(not opts.chatty_on_remote_changes) | 295 editbox:SetDisabled((not opts.chatty_on_remote_changes) and |
296 (not opts.chatty_on_local_changes)) | |
285 chatgroup:AddChild(editbox) | 297 chatgroup:AddChild(editbox) |
286 w = mkbutton("Chat Frame Numbers", | 298 w = mkbutton("Chat Frame Numbers", |
287 [[Print each chat window number in its own frame, for easy reference in the editing field.]]) | 299 [[Print each chat window number in its own frame, for easy reference in the editing field.]]) |
288 w:SetFullWidth(true) | 300 w:SetFullWidth(true) |
289 w:SetCallback("OnClick", function() | 301 w:SetCallback("OnClick", function() |