comparison Modules/Options.lua @ 55:234896be4087

Adding an option to direct ItemAuditor output to a different chat frame
author Asa Ayers <Asa.Ayers@Gmail.com>
date Thu, 22 Jul 2010 23:17:57 -0700
parents 003de902ae64
children 8afc1ac9bf58
comparison
equal deleted inserted replaced
54:52f691a2a3a4 55:234896be4087
8 local craftingThresholdsDisplay = {} 8 local craftingThresholdsDisplay = {}
9 9
10 for key, value in pairs(craftingThresholds) do 10 for key, value in pairs(craftingThresholds) do
11 craftingThresholdsDisplay[key] = addon:FormatMoney(value, '', true) 11 craftingThresholdsDisplay[key] = addon:FormatMoney(value, '', true)
12 -- craftingThresholdsDisplay[key] = value 12 -- craftingThresholdsDisplay[key] = value
13 end
14
15 local windowIndex = nil
16 function addon:GetChatWindowList()
17 local windows = {}
18 for i=1, NUM_CHAT_WINDOWS do
19 local name, _, _, _, _, _, shown, locked, docked = GetChatWindowInfo(i)
20 if (name ~= "") and (docked or shown) then
21 windows[i] = name
22 end
23 end
24 return windows
25 end
26
27 function addon:GetChatWindowIndex()
28 local cf = self.db.char.output_chat_frame
29 if not windowIndex then
30 for i=1, NUM_CHAT_WINDOWS do
31 local name, _, _, _, _, _, shown, locked, docked = GetChatWindowInfo(i)
32 if name ~= "" and cf ~= nil and cf == name then
33 self:SetChatWindow(nil, i)
34 end
35 end
36 end
37 return windowIndex
38 end
39
40
41 local selectedWindow = nil
42
43 function addon:SetChatWindow(info, index)
44 windowIndex = index
45 local name = GetChatWindowInfo(windowIndex)
46
47 self.db.char.output_chat_frame = name
48 selectedWindow = nil
49 end
50
51 function addon:GetSelectedChatWindow()
52 if not selectedWindow then
53 selectedWindow = _G["ChatFrame"..self:GetChatWindowIndex()]
54 end
55 if (selectedWindow) then
56 return selectedWindow
57 end
58 return DEFAULT_CHAT_FRAME
13 end 59 end
14 60
15 local options = { 61 local options = {
16 handler = addon, 62 handler = addon,
17 name = "ItemAuditor", 63 name = "ItemAuditor",
54 desc = "Displays a message when an item is excluded from the queue.", 100 desc = "Displays a message when an item is excluded from the queue.",
55 get = function() return ItemAuditor.db.profile.messages.queue_skip end, 101 get = function() return ItemAuditor.db.profile.messages.queue_skip end,
56 set = function(info, value) ItemAuditor.db.profile.messages.queue_skip = value end, 102 set = function(info, value) ItemAuditor.db.profile.messages.queue_skip = value end,
57 disabled = 'IsQADisabled', 103 disabled = 'IsQADisabled',
58 order = 1, 104 order = 1,
105 },
106 output = {
107 type = "select",
108 name = "Output",
109 desc = "",
110 values = 'GetChatWindowList',
111 get = 'GetChatWindowIndex',
112 set = 'SetChatWindow',
59 }, 113 },
60 }, 114 },
61 }, 115 },
62 116
63 qa_options = { 117 qa_options = {