Quantcast

* ARLFrame.lua *

torhal [05-29-09 - 20:19]
* ARLFrame.lua *
In addon:DisplayFrame(): Removed rDB parameter - recipeDB is now assigned from addon:GetRecipeTable(). Removed sortedRI parameter - sortedRecipeIndex is now assigned by addon:SortMissingRecipes().
* AckisRecipeList.lua *
In addon:AckisRecipeList_Command(): Removed call to addon:SortMissingRecipes() and un-needed parameters to addon:DisplayFrame().
In addon:SortMissingRecipes(): Moved SortedRecipeIndex out of here and into the enclosing do block - it's now wiped instead of re-created before being populated.
Filename
ARLFrame.lua
AckisRecipeList.lua
diff --git a/ARLFrame.lua b/ARLFrame.lua
index 9b65e23..bee0593 100644
--- a/ARLFrame.lua
+++ b/ARLFrame.lua
@@ -4786,8 +4786,6 @@ end
 -- and initialize it, then show it.
 -------------------------------------------------------------------------------
 function addon:DisplayFrame(
-	rDB,		-- RecipeList
-	sortedRI,	-- sortedindex
 	cPlayer,	-- playerdata
 	asTable,	-- AllSpecialtiesTable
 	trList,		-- TrainerList
@@ -4812,9 +4810,6 @@ function addon:DisplayFrame(
 	-------------------------------------------------------------------------------
 	myFaction = cPlayer.playerFaction

-	sortedRecipeIndex = sortedRI
-
-	recipeDB = rDB
 	allSpecTable = asTable
 	playerData = cPlayer
 	currentProfession = playerData.playerProfession
@@ -4831,17 +4826,13 @@ function addon:DisplayFrame(

 	-- get our current profession's index
 	for k, v in pairs(SortedProfessions) do
-
 		if (v.name == currentProfession) then
-
 			currentProfIndex = k
 			break
-
 		end
-
 	end

-	if (not addon.Frame) then
+	if (not self.Frame) then
 		InitializeFrame()
 	end
 	-- Set our addon frame position
@@ -4851,19 +4842,23 @@ function addon:DisplayFrame(
 	ARL_DD_Sort.initialize = ARL_DD_Sort_Initialize

 	-- reset the scale
-	addon.Frame:SetScale(addon.db.profile.frameopts.uiscale)
+	self.Frame:SetScale(addon.db.profile.frameopts.uiscale)
 	arlSpellTooltip:SetScale(addon.db.profile.frameopts.tooltipscale)

 	-- We'll be in "ExpandAll" mode to start with. Make sure the button knows that:
 	ARL_ExpandButton:SetText(L["EXPANDALL"])
-	addon:TooltipDisplay(ARL_ExpandButton, L["EXPANDALL_DESC"])
+	self:TooltipDisplay(ARL_ExpandButton, L["EXPANDALL_DESC"])

 	-- Reset our addon title text
-	addon.resetTitle()
+	self.resetTitle()

 	-- Set the texture on our switcher button correctly
 	SetSwitcherTexture(SortedProfessions[currentProfIndex].texture)

+	-- Acquire the list, then sort it
+	recipeDB = self:GetRecipeTable()
+	sortedRecipeIndex = self:SortMissingRecipes(recipeDB)
+
 	-- Take our sorted list, and fill up DisplayStrings
 	initDisplayStrings()

@@ -4872,7 +4867,7 @@ function addon:DisplayFrame(

 	-- And update our scrollframe
 	RecipeList_Update()
-	addon.Frame:Show()
+	self.Frame:Show()

 	-- Make sure to reset search gui elements
 	ARL_LastSearchedText = ""
diff --git a/AckisRecipeList.lua b/AckisRecipeList.lua
index 29ade10..1713f4b 100644
--- a/AckisRecipeList.lua
+++ b/AckisRecipeList.lua
@@ -1962,11 +1962,9 @@ do
 		if (textdump == true) then
 			self:DisplayTextDump(RecipeList, playerData.playerProfession)
 		else
-			-- Sort the recipe list now
-			local sortedindex = self:SortMissingRecipes(RecipeList)
-			self:DisplayFrame(RecipeList, sortedindex, playerData, AllSpecialtiesTable,
-								TrainerList, VendorList, QuestList, ReputationList,
-								SeasonalList, MobList, CustomList)
+			self:DisplayFrame(playerData, AllSpecialtiesTable,
+					  TrainerList, VendorList, QuestList, ReputationList,
+					  SeasonalList, MobList, CustomList)
 		end
 	end

@@ -2054,6 +2052,9 @@ do
 	-- Sorting functions
 	local sortFuncs = nil

+	-- Create a new array for the sorted index
+	local SortedRecipeIndex = {}
+
 	-- Description: Sorts the recipe Database depending on the settings defined in the database.
 	function addon:SortMissingRecipes(RecipeDB)
 		if (not sortFuncs) then
@@ -2107,8 +2108,7 @@ do
 				end
 			end
 		end
-		-- Create a new array for the sorted index
-		local SortedRecipeIndex = {}
+		twipe(SortedRecipeIndex)

 		-- Get all the indexes of the RecipeListing
 		for n, v in pairs(RecipeDB) do