changeset 67:b6c30a5156f9

Rearranged options to go with their related features.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Wed, 28 Jul 2010 07:35:14 -0700
parents b7bc0488f13b
children 2d65db19d3ce
files Core.lua ItemAuditor.toc Modules/Crafting.lua Modules/DisplayInvested.lua Modules/Options.lua Modules/QuickAuctions.lua
diffstat 6 files changed, 178 insertions(+), 185 deletions(-) [+]
line wrap: on
line diff
--- a/Core.lua	Tue Jul 27 18:17:59 2010 -0700
+++ b/Core.lua	Wed Jul 28 07:35:14 2010 -0700
@@ -12,6 +12,37 @@
 local TEAL		= "|cFF00FF9A"
 local GOLD		= "|cFFFFD700"
 
+
+ItemAuditor.Options = {
+	handler = ItemAuditor,
+	name = "ItemAuditor @project-version@",
+	type = 'group',
+	args = {
+		options = {
+			type = "execute",
+			name = "options",
+			desc = "Show Blizzard's options GUI",
+			func = "ShowOptionsGUI",
+			guiHidden = true,
+		},
+		debug = {
+			type = "execute",
+			name = "debug",
+			desc = "Shows the debug frame",
+			func = function() ItemAuditor_DebugFrame:Show() end,
+			guiHidden = true,
+		},
+		suspend = {
+			type = "toggle",
+			name = "suspend",
+			desc = "Suspends ItemAuditor",
+			get = "IsEnabled",
+			set = "SetEnabled",
+			guiHidden = true,
+		},
+	},
+}
+
 function ItemAuditor:OnInitialize()
 	local DB_defaults = {
 		char = {
@@ -38,7 +69,10 @@
 	}
 	self.db = LibStub("AceDB-3.0"):New("ItemAuditorDB", DB_defaults, true)
 	
-	self:RegisterOptions()
+	self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ItemAuditor", "ItemAuditor")
+	
+	DevTools_Dump(ItemAuditor.Options);
+	LibStub("AceConfig-3.0"):RegisterOptionsTable("ItemAuditor", ItemAuditor.Options, {"ia"})
 	ItemAuditor:RegisterFrame(ItemAuditor_DebugFrame)
 	
 	--@debug@
@@ -50,6 +84,8 @@
 	--@end-debug@
 end
 
+
+
 local registeredEvents = {}
 local originalRegisterEvent = ItemAuditor.RegisterEvent 
 function ItemAuditor:RegisterEvent(event, callback, arg)
--- a/ItemAuditor.toc	Tue Jul 27 18:17:59 2010 -0700
+++ b/ItemAuditor.toc	Wed Jul 28 07:35:14 2010 -0700
@@ -13,11 +13,11 @@
 
 
 Core.lua
+Modules\Utils.lua
+Modules\Options.lua
 Modules\Frames.lua
-Modules\Utils.lua
 Modules\Events.lua
 Modules\Tooltip.lua
-Modules\Options.lua
 
 Modules\Debug.lua
 Modules\DisplayInvested.lua
--- a/Modules/Crafting.lua	Tue Jul 27 18:17:59 2010 -0700
+++ b/Modules/Crafting.lua	Wed Jul 28 07:35:14 2010 -0700
@@ -9,6 +9,34 @@
 
 local realData = {}
 
+
+-- TODO: Convert this to a text field.
+local craftingThresholds = {5000, 10000, 50000}
+local craftingThresholdsDisplay = {}
+
+for key, value in pairs(craftingThresholds) do
+	craftingThresholdsDisplay[key] = ItemAuditor:FormatMoney(value, '', true)
+	-- craftingThresholdsDisplay[key] = value
+end
+
+ItemAuditor.Options.args.crafting_options = {
+	name = "Crafting with Skillet",
+	desc = "/ia queue",
+	type = 'group',
+	disabled = function() return Skillet == nil end,
+	args = {
+		crafting_threshold = {
+			type = "select",
+			name = "Crafting Threshold",
+			desc = "Don't create items that will make less than this amount of profit",
+			values = craftingThresholdsDisplay,
+			get = function() return ItemAuditor.db.char.crafting_threshold end,
+			set = function(info, value) ItemAuditor.db.char.crafting_threshold = value end,
+			order = 11,
+		},
+	},
+}
+
 local function displayMoney(rowFrame, cellFrame, data, cols, row, realrow, column, fShow, table, ...)
 	if fShow == true then
 		local money = data[realrow][column]
@@ -330,3 +358,10 @@
 	end
 	return nil
 end
+ItemAuditor.Options.args.crafting = {
+	type = "execute",
+	name = "crafting",
+	desc = "This opens a window to configure a crafting queue.",
+	func = "DisplayCrafting",
+	guiHidden = false,
+}
--- a/Modules/DisplayInvested.lua	Tue Jul 27 18:17:59 2010 -0700
+++ b/Modules/DisplayInvested.lua	Wed Jul 28 07:35:14 2010 -0700
@@ -221,3 +221,10 @@
 end
 
 
+ItemAuditor.Options.args.invested = {
+	type = "execute",
+	name = "invested",
+	desc = "Shows what you have invested in",
+	func = "DisplayInvested",
+	guiHidden = false,
+}
\ No newline at end of file
--- a/Modules/Options.lua	Tue Jul 27 18:17:59 2010 -0700
+++ b/Modules/Options.lua	Wed Jul 28 07:35:14 2010 -0700
@@ -4,17 +4,6 @@
 local currentFaction = UnitFactionGroup("player")
 local AHFactions = { currentFaction, 'Neutral' }
 
--- TODO: Convert this to a text field.
-local craftingThresholds = {5000, 10000, 50000}
-local craftingThresholdsDisplay = {}
-
-local currentVersion = "@project-version@"
-
-for key, value in pairs(craftingThresholds) do
-	craftingThresholdsDisplay[key] = ItemAuditor:FormatMoney(value, '', true)
-	-- craftingThresholdsDisplay[key] = value
-end
-
 local windowIndex = nil
 function Options.GetChatWindowList()
 	local windows = {}
@@ -64,173 +53,6 @@
 	return DEFAULT_CHAT_FRAME
 end
 
-local optionsTable = {
-	handler = ItemAuditor,
-	name = "ItemAuditor "..currentVersion,
-	type = 'group',
-	args = {
-		prices = {
-			name = "Prices",
-			desc = "Control how your minimum price is calculated.",
-			type = 'group',
-			args = {
-				auction_house = {
-					type = "select",
-					name = "Auction House",
-					desc = "",
-					values = { currentFaction, 'Neutral' },
-					get = 'GetAH',
-					set = 'SetAH',
-				},
-			},
-		},
-		
-		
-		messages = {
-			name = "Messages",
-			desc = "Control which messages display in your chat window.",
-			type = 'group',
-			args = {
-				
-				item_cost = {
-					type = "toggle",
-					name = "Item Cost",
-					desc = "Shows a message every time an item's cost changes",
-					get = function() return ItemAuditor.db.profile.messages.cost_updates end,
-					set = function(info, value) ItemAuditor.db.profile.messages.cost_updates = value end,
-					order = 0,
-				},
-				queue_skip = {
-					type = "toggle",
-					name = "Queue Skip",
-					desc = "Displays a message when an item is excluded from the queue.",
-					get = function() return ItemAuditor.db.profile.messages.queue_skip end,
-					set = function(info, value) ItemAuditor.db.profile.messages.queue_skip = value end,
-					disabled = 'IsQADisabled',
-					order = 1,
-				},
-				output = {
-					type = "select",
-					name = "Output",
-					desc = "",
-					values = Options.GetChatWindowList,
-					get = Options.GetChatWindowIndex,
-					set = Options.SetChatWindow,
-				},
-			},
-		},
-		
-		qa_options = {
-			name = "QA Options",
-			desc = "Control how ItemAuditor integrates with QuickAuctions",
-			type = 'group',
-			disabled = function() return not ItemAuditor:IsQACompatible() end,
-			args = {
-				toggle_qa = {
-					type = "toggle",
-					name = "Enable Quick Auctions",
-					desc = "This will enable or disable Quick Auctions integration",
-					get = "IsQAEnabled",
-					set = "SetQAEnabled",
-					order = 0,
-				},
-				--[[
-				add_mail = {
-					type = "toggle",
-					name = "Add mail cost to QA Threshold",
-					get = "IsQAEnabled",
-					set = "SetQAEnabled",
-					order = 1,
-				},
-				]]
-				auction_threshold = {
-					type = "range",
-					name = "Auction Threshold",
-					desc = "Don't create items that will make less than this amount of profit",
-					min = 0.0,
-					max = 1.0,
-					isPercent = true,
-					get = function() return ItemAuditor.db.char.auction_threshold end,
-					set = function(info, value)
-						ItemAuditor.db.char.auction_threshold = value
-						ItemAuditor:RefreshQAGroups()
-					end,
-					disabled = 'IsQADisabled',
-					order = 1,
-				},
-				refresh_qa = {
-					type = "execute",
-					name = "Refresh QA Thresholds",
-					desc = "Resets all Quick Auctions thresholds",
-					func = "RefreshQAGroups",
-					disabled = 'IsQADisabled',
-					order = 9,
-				},
-			}
-		},
-		crafting_options = {
-			name = "Crafting with Skillet",
-			desc = "/ia queue",
-			type = 'group',
-			disabled = function() return Skillet == nil end,
-			args = {
-				crafting_threshold = {
-					type = "select",
-					name = "Crafting Threshold",
-					desc = "Don't create items that will make less than this amount of profit",
-					values = craftingThresholdsDisplay,
-					get = function() return ItemAuditor.db.char.crafting_threshold end,
-					set = function(info, value) ItemAuditor.db.char.crafting_threshold = value end,
-					order = 11,
-				},
-			},
-		},
-		options = {
-			type = "execute",
-			name = "options",
-			desc = "Show Blizzard's options GUI",
-			func = "ShowOptionsGUI",
-			guiHidden = true,
-		},
-		queue = {
-			type = "execute",
-			name = "queue",
-			desc = "Queue",
-			func = "Queue",
-			guiHidden = true,
-		},
-		debug = {
-			type = "execute",
-			name = "debug",
-			desc = "Shows the debug frame",
-			func = function() ItemAuditor_DebugFrame:Show() end,
-			guiHidden = true,
-		},
-		invested = {
-			type = "execute",
-			name = "invested",
-			desc = "Shows what you have invested in",
-			func = "DisplayInvested",
-			guiHidden = false,
-		},
-		crafting = {
-			type = "execute",
-			name = "crafting",
-			desc = "<description goes here>",
-			func = "DisplayCrafting",
-			guiHidden = false,
-		},
-		
-		suspend = {
-			type = "toggle",
-			name = "suspend",
-			desc = "Suspends ItemAuditor",
-			get = "IsEnabled",
-			set = "SetEnabled",
-			guiHidden = true,
-		},
-	},
-}
 
 function ItemAuditor:SetEnabled(info, enable)
 	self.db.profile.addon_enabled = enable
@@ -245,11 +67,6 @@
 	end
 end
 
-function ItemAuditor:RegisterOptions()
-	self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ItemAuditor", "ItemAuditor")
-	LibStub("AceConfig-3.0"):RegisterOptionsTable("ItemAuditor", optionsTable, {"ia"})
-end
-
 local function pairsByKeys (t, f)
 	local a = {}
 		for n in pairs(t) do table.insert(a, n) end
@@ -297,3 +114,52 @@
 end
 
 
+ItemAuditor.Options.args.messages = {
+	name = "Messages",
+	desc = "Control which messages display in your chat window.",
+	type = 'group',
+	args = {
+		
+		item_cost = {
+			type = "toggle",
+			name = "Item Cost",
+			desc = "Shows a message every time an item's cost changes",
+			get = function() return ItemAuditor.db.profile.messages.cost_updates end,
+			set = function(info, value) ItemAuditor.db.profile.messages.cost_updates = value end,
+			order = 0,
+		},
+		queue_skip = {
+			type = "toggle",
+			name = "Queue Skip",
+			desc = "Displays a message when an item is excluded from the queue.",
+			get = function() return ItemAuditor.db.profile.messages.queue_skip end,
+			set = function(info, value) ItemAuditor.db.profile.messages.queue_skip = value end,
+			disabled = 'IsQADisabled',
+			order = 1,
+		},
+		output = {
+			type = "select",
+			name = "Output",
+			desc = "",
+			values = Options.GetChatWindowList,
+			get = Options.GetChatWindowIndex,
+			set = Options.SetChatWindow,
+		},
+	},
+}
+
+ItemAuditor.Options.args.prices = {
+	name = "Prices",
+	desc = "Control how your minimum price is calculated.",
+	type = 'group',
+	args = {
+		auction_house = {
+			type = "select",
+			name = "Auction House",
+			desc = "",
+			values = { currentFaction, 'Neutral' },
+			get = 'GetAH',
+			set = 'SetAH',
+		},
+	},
+}
\ No newline at end of file
--- a/Modules/QuickAuctions.lua	Tue Jul 27 18:17:59 2010 -0700
+++ b/Modules/QuickAuctions.lua	Wed Jul 28 07:35:14 2010 -0700
@@ -291,3 +291,51 @@
 		Skillet.stitch:AddToQueue(skillIndex, toQueue)
 	end
 end
+
+ItemAuditor.Options.args.qa_options = {
+	name = "QA Options",
+	desc = "Control how ItemAuditor integrates with QuickAuctions",
+	type = 'group',
+	disabled = function() return not ItemAuditor:IsQACompatible() end,
+	args = {
+		toggle_qa = {
+			type = "toggle",
+			name = "Enable Quick Auctions",
+			desc = "This will enable or disable Quick Auctions integration",
+			get = "IsQAEnabled",
+			set = "SetQAEnabled",
+			order = 0,
+		},
+		auction_threshold = {
+			type = "range",
+			name = "Auction Threshold",
+			desc = "Don't create items that will make less than this amount of profit",
+			min = 0.0,
+			max = 1.0,
+			isPercent = true,
+			get = function() return ItemAuditor.db.char.auction_threshold end,
+			set = function(info, value)
+				ItemAuditor.db.char.auction_threshold = value
+				ItemAuditor:RefreshQAGroups()
+			end,
+			disabled = 'IsQADisabled',
+			order = 1,
+		},
+		refresh_qa = {
+			type = "execute",
+			name = "Refresh QA Thresholds",
+			desc = "Resets all Quick Auctions thresholds",
+			func = "RefreshQAGroups",
+			disabled = 'IsQADisabled',
+			order = 9,
+		},
+	}
+}
+
+ItemAuditor.Options.args.queue = {
+	type = "execute",
+	name = "queue",
+	desc = "Queue",
+	func = "Queue",
+	guiHidden = true,
+}
\ No newline at end of file