diff core.lua @ 95:3546c7b55986

Move generation of the Help tab to the same file as the help text. Allow registration of arbitrary tab controls, not just text generation. Move some shared data out of the addon table into a 'gui' state table in preparation for more of the same. Clean some cruft out of the default itemfilter list.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Thu, 26 Jul 2012 03:34:56 +0000
parents db1d5d09e5f5
children 780b7e0eeeeb
line wrap: on
line diff
--- a/core.lua	Tue Jul 24 23:04:51 2012 +0000
+++ b/core.lua	Thu Jul 26 03:34:56 2012 +0000
@@ -139,7 +139,7 @@
 	['chatty_on_remote_changes'] = false,
 	['chatty_on_remote_changes_frame'] = 1,
 }
-local virgin = "First time loaded?  Hi!  Use the /ouroloot or /loot command"
+local virgin = "First time loaded?  Hi!  Use the /ouroloot command"
 	.." to show the main display.  You should probably browse the instructions"
 	.." if you've never used this before; %s to display the help window.  This"
 	.." welcome message will not intrude again."
@@ -765,6 +765,16 @@
 	-- get item filter table if needed
 	if opts.itemfilter == nil then
 		opts.itemfilter = self.default_itemfilter
+	else
+		-- remove old stuff that doesn't "drop" anymore
+		-- find some way of only doing this once
+		opts.itemfilter[29434] = nil -- Badge of Justice
+		opts.itemfilter[40752] = nil -- Emblem of Heroism
+		opts.itemfilter[40753] = nil -- Emblem of Valor
+		opts.itemfilter[45624] = nil -- Emblem of Conquest
+		opts.itemfilter[43228] = nil -- Stone Keeper's Shard
+		opts.itemfilter[47241] = nil -- Emblem of Triumph
+		opts.itemfilter[49426] = nil -- Emblem of Frost
 	end
 	self.default_itemfilter = nil
 	if opts.itemvault == nil then
@@ -891,8 +901,10 @@
 		if dirty then self:Print("Saved data has been massaged into shape.") end
 	end
 
+	self:FINISH_SPECIAL_TABS()
 	_init(self)
 	self.dprint('flow', "version strings:", version_large, self.revision, self.status_text)
+	self.gui_state_pointer = nil
 	self.load_assert = nil
 	self.OnInitialize = nil   -- free up ALL the things!
 end
@@ -1033,6 +1045,27 @@
 
 do
 	local prototype = {}
+	local registry
+
+	-- By default, no plugins.  First one in sets up code for any after.
+	addon.get_plugin = flib.nullfunc
+
+	-- Fires before the plugin's own OnEnable (inherited or otherwise).
+	function addon:OnModuleCreated (plugin)
+		if not registry then
+			registry = {}
+			addon.get_plugin = function(a,t) return registry[t] end
+			prototype.register_text_generator = function(p,t,...)
+				registry[t] = p
+				return addon:register_text_generator(t,...)
+			end
+			prototype.register_tab_control = function(p,t,...)
+				registry[t] = p
+				return addon:register_tab_control(t,...)
+			end
+		end
+	end
+
 	local function module_OnEnable (plugin)
 		if plugin.option_defaults then
 			local SVname = 'OuroLoot'..plugin:GetName()..'_opts'
@@ -1052,29 +1085,11 @@
 		end
 	end
 
-	-- By default, no plugins.  First plugin to use the special registration
-	-- sets up code for any subsequent plugins.
-	addon.is_plugin = flib.nullfunc
-	local function module_rtg (plugin, text_type, ...)
-		local registry = { [text_type]=plugin }
-		addon.is_plugin = function(a,t) return registry[t] end
-		prototype.register_text_generator = function(p,t,...)
-			registry[t] = p
-			return addon:register_text_generator(t,...)
-		end
-		return addon:register_text_generator(text_type,...)
-	end
-
 	prototype.OnEnable = module_OnEnable
 	prototype.default_OnEnable = module_OnEnable
-	prototype.register_text_generator = module_rtg
 
 	addon:SetDefaultModuleLibraries("AceConsole-3.0")
 	addon:SetDefaultModulePrototype(prototype)
-	-- Fires before the plugin's own OnEnable (inherited or otherwise).
-	--function addon:OnModuleCreated (plugin)
-	--	print("created plugin", plugin:GetName())
-	--end
 
 	local err = [[Module '%s' cannot register itself because it failed a required condition: '%s']]
 	function addon:ConstrainedNewModule (modname, minrev, mincomm, mindata)
@@ -1685,9 +1700,9 @@
 
 		elseif cmd == "fix" then
 			if arg == "?" then
-				self:Print[['/loot fix cache' updates loot that wasn't in the cache]]
-				self:Print[['/loot fix history' repairs inconsistent data on the History tab]]
-				self:Print[['/loot fix' changes no stored data, only allows the window to be displayed again (this is built into all fixes above)]]
+				self:Print[['/ouroloot fix cache' updates loot that wasn't in the cache]]
+				self:Print[['/ouroloot fix history' repairs inconsistent data on the History tab]]
+				self:Print[['/ouroloot fix' changes no stored data, only allows the window to be displayed again (this is built into all fixes above)]]
 				return
 			elseif arg == "cache" then
 				self:do_item_cache_fixup()
@@ -1766,7 +1781,7 @@
 	self:broadcast('revcheck',version_large)
 end
 
--- Note:  running '/loot off' will also avoid the popup reminder when
+-- Note:  running '/ouroloot off' will also avoid the popup reminder when
 -- joining a raid, but will not change the saved option setting.
 function addon:Deactivate()
 	self.enabled = false
@@ -3514,7 +3529,7 @@
 	OCR_funcs.bcast_req = function (sender)
 		if addon.debug.comm or ((not g_wafer_thin) and (not addon.rebroadcast))
 		then
-			addon:Print("%s has requested additional broadcasters! Choose %s to enable rebroadcasting, or %s to remain off and also ignore rebroadcast requests for as long as you're logged in.",
+			addon:Print("%s has requested additional broadcasters! Click %s to enable rebroadcasting, or %s to remain off and also ignore rebroadcast requests for as long as you're logged in.",
 				sender,
 				tostring(bcast_on),
 				tostring(waferthin))