From 890cf44f599c2978355295ef5ac2d5edc88bf799 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 14:54:15 -0400 Subject: [PATCH 01/26] When wiping exclusions from the config panel, re-scan the tradeskill. --- Config.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Config.lua b/Config.lua index 55cb261..c06c953 100644 --- a/Config.lua +++ b/Config.lua @@ -86,7 +86,8 @@ local function fullOptions() func = function(info) local exclusion_list = addon.db.profile.exclusionlist - exclusion_list = twipe(exclusion_list) + exclusion_list = table.wipe(exclusion_list) + addon:Scan() end, }, resetallfilters = { @@ -94,7 +95,9 @@ local function fullOptions() type = "execute", name = L["Reset All Filters"], desc = L["RESET_DESC"], - func = function(info) addon.resetFilters() end, + func = function(info) + addon.resetFilters() + end, }, spacer1 = { order = 19, -- 1.7.9.5 From accd0c3cf3b1908e17b80aca4e06931d6dc6472b Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 15:40:20 -0400 Subject: [PATCH 02/26] In FormatRecipeText(): Made the showing of exclusions work again. --- Frame.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frame.lua b/Frame.lua index 2173088..5590a19 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2195,7 +2195,7 @@ do recipe_string = skill_sort and string.format("%s - %s", level_text, recipe_string) or string.format("%s - %s", recipe_string, level_text) - if addon.db.profile.exclusionlist[recipe_index] then + if addon.db.profile.exclusionlist[recipe_entry.spell_id] then recipe_string = string.format("** %s **", recipe_string) end return recipe_string -- 1.7.9.5 From 195c0f409b486891ec8658d92b5880c64feeda4a Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 17:36:42 -0400 Subject: [PATCH 03/26] In Player:MarkExclusions(): Changed self["Profession"] to self.current_prof so the function will actually work. --- Player.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Player.lua b/Player.lua index 075372a..38c559e 100644 --- a/Player.lua +++ b/Player.lua @@ -67,7 +67,7 @@ function Player:MarkExclusions() local exclusion_list = addon.db.profile.exclusionlist local ignored = not addon.db.profile.ignoreexclusionlist local recipe_list = private.recipe_list - local profession = self["Profession"] + local profession = self.current_prof local known_count = 0 local unknown_count = 0 -- 1.7.9.5 From 609b024bc2b95f480f9abf6bca7f89ba7f44a0c3 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 17:48:25 -0400 Subject: [PATCH 04/26] In MainPanel.scroll_frame:Update(): Only call MainPanel.progress_bar:Update() if not refreshing or scrolling. --- Frame.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frame.lua b/Frame.lua index 5590a19..db31555 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2325,6 +2325,7 @@ do end end -- Sort type. self.recipes_displayed = recipes_displayed + MainPanel.progress_bar:Update() end -- Reset the current buttons/lines @@ -2448,7 +2449,6 @@ do addon:Print("DEBUG: excluded_recipes_unknown: " .. Player.excluded_recipes_unknown) end end - MainPanel.progress_bar:Update() end local faction_strings -- 1.7.9.5 From e5b418341cb8d39c003fa74fb475929f7a5f70fc Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 17:49:37 -0400 Subject: [PATCH 05/26] Added support for tekDebug and converted all existing debug statements. --- ARL.lua | 12 ++++++++++-- AckisRecipeList.toc | 2 +- Frame.lua | 24 +++++++++++------------- Waypoint.lua | 8 +++----- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ARL.lua b/ARL.lua index 80cf60a..15e1d00 100644 --- a/ARL.lua +++ b/ARL.lua @@ -65,6 +65,8 @@ _G.ARL = addon local L = LibStub("AceLocale-3.0"):GetLocale(MODNAME) local BFAC = LibStub("LibBabble-Faction-3.0"):GetLookupTable() +local debugger = _G.tekDebug and _G.tekDebug:GetFrame(MODNAME) + ------------------------------------------------------------------------------ -- Constants. ------------------------------------------------------------------------------ @@ -143,8 +145,14 @@ if MissingLibraries() then return end -function addon:DEBUG(str, ...) - print(string.format(addon:Red("DEBUG: ") .. tostring(str), ...)) +function addon:Debug(...) + if debugger then + debugger:AddMessage(string.format(...)) + else + --@alpha@ + self:Printf(...) + --@end-alpha@ + end end do diff --git a/AckisRecipeList.toc b/AckisRecipeList.toc index 1d1ed5e..6f4ca36 100644 --- a/AckisRecipeList.toc +++ b/AckisRecipeList.toc @@ -43,7 +43,7 @@ ## X-Website: http://wow.curse.com/downloads/wow-addons/details/arl.aspx ## X-Feedback: http://www.wowace.com/addons/arl/forum/ -## OptionalDeps: Ace3, LibAboutPanel, LibBabble-Zone-3.0, LibBabble-Faction-3.0, LibBabble-Boss-3.0, LibSharedMedia-3.0, LibQTip-1.0, Skillet, ATSW, Manufac, Cauldron, TomTom, TipTac, Carbonite +## OptionalDeps: Ace3, LibAboutPanel, LibBabble-Zone-3.0, LibBabble-Faction-3.0, LibBabble-Boss-3.0, LibSharedMedia-3.0, LibQTip-1.0, Skillet, ATSW, Manufac, Cauldron, TomTom, TipTac, Carbonite, tekDebug ## DefaultState: Enabled ## X-WoWI-ID: 5061 diff --git a/Frame.lua b/Frame.lua index db31555..2da7446 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2185,9 +2185,7 @@ do elseif skill_level >= recipe_entry.optimal_level then level_text = string.format(addon:Orange(SKILL_LEVEL_FORMAT), recipe_level) else - --@alpha@ - addon:Printf("DEBUG: Skill level color fallback: %s.", recipe_string) - --@end-alpha@ + addon:Debug("Skill level color fallback: %s.", recipe_string) level_text = string.format(addon:MidGrey(SKILL_LEVEL_FORMAT), recipe_level) end local sort_type = addon.db.profile.sorting @@ -2437,16 +2435,16 @@ do StaticPopup_Show("ARL_SEARCHFILTERED") else addon:Print(L["NO_DISPLAY"]) - addon:Print("DEBUG: recipes_total check for 0") - addon:Print("DEBUG: recipes_total: " .. Player.recipes_total) - addon:Print("DEBUG: recipes_total check for equal to recipes_total") - addon:Print("DEBUG: recipes_known: " .. Player.recipes_known) - addon:Print("DEBUG: recipes_total: " .. Player.recipes_total) - addon:Print("DEBUG: recipes_total_filtered - recipes_known_filtered = 0") - addon:Print("DEBUG: recipes_total_filtered: " .. Player.recipes_total_filtered) - addon:Print("DEBUG: recipes_known_filtered: " .. Player.recipes_known_filtered) - addon:Print("DEBUG: excluded_recipes_unknown ~= 0") - addon:Print("DEBUG: excluded_recipes_unknown: " .. Player.excluded_recipes_unknown) + addon:Debug("recipes_total check for 0") + addon:Debug("recipes_total: " .. Player.recipes_total) + addon:Debug("recipes_total check for equal to recipes_total") + addon:Debug("recipes_known: " .. Player.recipes_known) + addon:Debug("recipes_total: " .. Player.recipes_total) + addon:Debug("recipes_total_filtered - recipes_known_filtered = 0") + addon:Debug("recipes_total_filtered: " .. Player.recipes_total_filtered) + addon:Debug("recipes_known_filtered: " .. Player.recipes_known_filtered) + addon:Debug("excluded_recipes_unknown ~= 0") + addon:Debug("excluded_recipes_unknown: " .. Player.excluded_recipes_unknown) end end end diff --git a/Waypoint.lua b/Waypoint.lua index f69713d..2ad68c0 100644 --- a/Waypoint.lua +++ b/Waypoint.lua @@ -500,21 +500,19 @@ function addon:SetupMap(single_recipe) zone = info.loc name = name .. " (" .. location .. ")" else - --@alpha@ - addon:Printf("DEBUG: No continent/zone map match for ID %d. Location: %s.", spell_id, location) - --@end-alpha@ + addon:Debug("No continent/zone map match for ID %d. Location: %s.", spell_id, location) end --@alpha@ if (x < -100) or (x > 100) or (y < -100) or (y > 100) then - addon:Printf("DEBUG: Invalid location coordinates for ID %d. Location: %s.", spell_id, location) + addon:Debug("Invalid location coordinates for ID %d. Location: %s.", spell_id, location) end --@end-alpha@ if zone and continent then --@alpha@ if x == 0 and y == 0 then - addon:Printf("DEBUG: Location is \"0, 0\" for ID %d. Location: %s.", spell_id, location) + addon:Debug("Location is \"0, 0\" for ID %d. Location: %s.", spell_id, location) end --@end-alpha@ local iconuid = TomTom:AddZWaypoint(continent, zone, x, y, name, false, minimap, worldmap) -- 1.7.9.5 From 6999c7fd1e4f2aebe871183020dff3f4ed8ce953 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 17:56:30 -0400 Subject: [PATCH 06/26] In MainPanel.scroll_frame:Update(): When sorting by Location or Acquisition, keep track of recipes so they are not counted more than once. --- Frame.lua | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/Frame.lua b/Frame.lua index 2da7446..c6a160e 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2199,9 +2199,12 @@ do return recipe_string end + -- Used for Location and Acquisition sort - since many recipes have multiple locations/acquire types it is + -- necessary to ensure each is counted only once. + local recipe_registry = {} + function MainPanel.scroll_frame:Update(expand_acquires, refresh) local insert_index = 1 - local recipe_list = private.recipe_list -- If not refreshing an existing list and not scrolling up/down, wipe and re-initialize the entries. @@ -2216,6 +2219,7 @@ do ReleaseTable(self.entries[i]) end twipe(self.entries) + twipe(recipe_registry) if sort_type == "Acquisition" then SortAcquireList() @@ -2228,9 +2232,13 @@ do for spell_id in pairs(private.acquire_list[acquire_type].recipes) do local recipe = private.recipe_list[spell_id] - if recipe.profession == Player.current_prof and recipe.is_visible and recipe.is_relevant then + if recipe.is_visible and recipe.is_relevant then count = count + 1 - recipes_displayed = recipes_displayed + 1 + + if not recipe_registry[recipe] then + recipe_registry[recipe] = true + recipes_displayed = recipes_displayed + 1 + end end end @@ -2266,9 +2274,13 @@ do for spell_id in pairs(private.location_list[loc_name].recipes) do local recipe = private.recipe_list[spell_id] - if recipe.profession == Player.current_prof and recipe.is_visible and recipe.is_relevant then + if recipe.is_visible and recipe.is_relevant then count = count + 1 - recipes_displayed = recipes_displayed + 1 + + if not recipe_registry[recipe] then + recipe_registry[recipe] = true + recipes_displayed = recipes_displayed + 1 + end end end @@ -2470,7 +2482,7 @@ do for spell_id in pairs(private.acquire_list[acquire_id].recipes) do local recipe_entry = private.recipe_list[spell_id] - if recipe_entry.profession == Player.current_prof and recipe_entry.is_visible and recipe_entry.is_relevant then + if recipe_entry.is_visible and recipe_entry.is_relevant then local t = AcquireTable() t.text = FormatRecipeText(recipe_entry) @@ -2490,7 +2502,7 @@ do for spell_id in pairs(private.location_list[location_id].recipes) do local recipe_entry = private.recipe_list[spell_id] - if recipe_entry.profession == Player.current_prof and recipe_entry.is_visible and recipe_entry.is_relevant then + if recipe_entry.is_visible and recipe_entry.is_relevant then local t = AcquireTable() t.text = FormatRecipeText(recipe_entry) -- 1.7.9.5 From 8bab579b4728e97fcb1f9637e3a58caecb0fa0df Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 18:00:26 -0400 Subject: [PATCH 07/26] In fullOptions(): When toggling "Display Exclusions", call addon:Scan() if the frame is visible. --- Config.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Config.lua b/Config.lua index c06c953..6d8b6ba 100644 --- a/Config.lua +++ b/Config.lua @@ -136,7 +136,13 @@ local function fullOptions() name = L["Display Exclusions"], desc = L["DISPLAY_EXCLUSION_DESC"], get = function() return addon.db.profile.ignoreexclusionlist end, - set = function() addon.db.profile.ignoreexclusionlist = not addon.db.profile.ignoreexclusionlist end, + set = function() + addon.db.profile.ignoreexclusionlist = not addon.db.profile.ignoreexclusionlist + + if addon.Frame:IsVisible() then + addon:Scan() + end + end, }, spacer2 = { order = 39, -- 1.7.9.5 From 12e946fd53b14a911303279fe262533fa4d2618a Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 18:01:33 -0400 Subject: [PATCH 08/26] In addon:AddRecipe(): Don't set a default value for recipe.is_known - if a scan shows that it's known, it will be marked as such. --- ARL.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/ARL.lua b/ARL.lua index 15e1d00..d311a31 100644 --- a/ARL.lua +++ b/ARL.lua @@ -890,7 +890,6 @@ function addon:AddRecipe(spell_id, skill_level, item_id, quality, profession, sp ["trivial_level"] = trivial_level or skill_level + 20, ["is_visible"] = true, -- Set to be displayed until the filtering occurs ["is_relevant"] = true, -- Set to be showing in the search results - ["is_known"] = false, -- Initially not known - will determine in addon:Scan() } if not recipe.name then -- 1.7.9.5 From 0d1c84c83970db156622e4f69e06138fcfb301cb Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 18:02:18 -0400 Subject: [PATCH 09/26] In CanDisplayRecipe(): Handle the visibility of excluded recipes here. --- ARL.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ARL.lua b/ARL.lua index d311a31..6d19136 100644 --- a/ARL.lua +++ b/ARL.lua @@ -1295,8 +1295,12 @@ do } ---Scans a specific recipe to determine if it is to be displayed or not. + -- For flag info see comments at start of file in comments local function CanDisplayRecipe(recipe) - -- For flag info see comments at start of file in comments + if addon.db.profile.exclusionlist[recipe.spell_id] and not addon.db.profile.ignoreexclusionlist then + addon:Debug("Recipe \"%s\" has been excluded.", recipe.name) + return false + end local filter_db = addon.db.profile.filters local general_filters = filter_db.general local recipe_flags = recipe["Flags"] -- 1.7.9.5 From 199b4466c6f155a67dcf724d511dc5880beb6736 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 18:04:20 -0400 Subject: [PATCH 10/26] In Player:MarkExclusions(): Ignore the recipe's visibility - it's handled in CanDisplayRecipe() now. --- Player.lua | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/Player.lua b/Player.lua index 38c559e..d6556c0 100644 --- a/Player.lua +++ b/Player.lua @@ -71,16 +71,10 @@ function Player:MarkExclusions() local known_count = 0 local unknown_count = 0 - for i in pairs(exclusion_list) do - local recipe = recipe_list[i] + for spell_id in pairs(exclusion_list) do + local recipe = recipe_list[spell_id] - -- We may have an item in the exclusion list that has not been scanned yet - -- check if the entry exists in DB first if recipe then - if ignored then - recipe.is_visible = false - end - local tmp_prof = GetSpellInfo(recipe.profession) if not recipe.is_known and tmp_prof == profession then -- 1.7.9.5 From fdf733abccc21e98911b8255ec9ffef449298330 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 18:05:13 -0400 Subject: [PATCH 11/26] In Player:MarkExclusions(): Just use recipe.profession - calling GetSpellInfo(recipe.profession) was retardedly broken. --- Player.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Player.lua b/Player.lua index d6556c0..651e1ec 100644 --- a/Player.lua +++ b/Player.lua @@ -75,11 +75,9 @@ function Player:MarkExclusions() local recipe = recipe_list[spell_id] if recipe then - local tmp_prof = GetSpellInfo(recipe.profession) - - if not recipe.is_known and tmp_prof == profession then + if recipe.is_known and recipe.profession == profession then known_count = known_count + 1 - elseif tmp_prof == profession then + elseif recipe_profession == profession then unknown_count = unknown_count + 1 end end -- 1.7.9.5 From 91a111686979292e648fd9b7963521b6a2ca665f Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 18:08:04 -0400 Subject: [PATCH 12/26] In MainPanel.progress_bar:Update(): Set pbCur regardless of filter status - the same value is used in both cases. --- Frame.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Frame.lua b/Frame.lua index c6a160e..3244f54 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2848,12 +2848,11 @@ function MainPanel.progress_bar:Update() local pbCur, pbMax local settings = addon.db.profile + pbCur = MainPanel.scroll_frame.recipes_displayed + if settings.includefiltered then - pbCur = MainPanel.scroll_frame.recipes_displayed pbMax = Player.recipes_total else - -- We're removing filtered recipes from the final count - pbCur = MainPanel.scroll_frame.recipes_displayed pbMax = Player.recipes_total_filtered end -- 1.7.9.5 From fa1569e8d4d1a3bcdcdb40452f5474e4b51d09c7 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 18:08:57 -0400 Subject: [PATCH 13/26] In MainPanel.progress_bar:Update(): Removed subtraction of Player.excluded_recipes_unknown from pbCur, since the method of updating the progress bar has changed and that value disregarded any filtering. Also changed the percentage to have two places after the decimal. --- Frame.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Frame.lua b/Frame.lua index 3244f54..1cd4c79 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2857,14 +2857,13 @@ function MainPanel.progress_bar:Update() end if not settings.includeexcluded and not settings.ignoreexclusionlist then - pbCur = pbCur - Player.excluded_recipes_unknown pbMax = pbMax - Player.excluded_recipes_known end self:SetMinMaxValues(0, pbMax) self:SetValue(pbCur) if (floor(pbCur / pbMax * 100) < 101) and pbCur >= 0 and pbMax >= 0 then - self.text:SetFormattedText("%d / %d - %1.1f%%", pbCur, pbMax, pbCur / pbMax * 100) + self.text:SetFormattedText("%d / %d - %1.2f%%", pbCur, pbMax, pbCur / pbMax * 100) else self.text:SetFormattedText("0 / 0 - %s", L["NOT_YET_SCANNED"]) end -- 1.7.9.5 From 9011b01f691efd908ea737c4fefe47cc436bfbb2 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 18:16:22 -0400 Subject: [PATCH 14/26] In fullOptions(): Don't scan unless the frame is visible. --- Config.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Config.lua b/Config.lua index 6d8b6ba..76de1a0 100644 --- a/Config.lua +++ b/Config.lua @@ -87,7 +87,10 @@ local function fullOptions() local exclusion_list = addon.db.profile.exclusionlist exclusion_list = table.wipe(exclusion_list) - addon:Scan() + + if addon.Frame:IsVisible() then + addon:Scan() + end end, }, resetallfilters = { -- 1.7.9.5 From 1009852548e693188ce23867608dae48bbc44130 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 21:35:40 -0400 Subject: [PATCH 15/26] Minor tweaks. --- Frame.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Frame.lua b/Frame.lua index 1cd4c79..d20b9a8 100644 --- a/Frame.lua +++ b/Frame.lua @@ -899,7 +899,7 @@ do ttAdd(0, -1, 0, L["CTRL_CLICK"], color_1) ttAdd(0, -1, 0, L["SHIFT_CLICK"], color_1) - if TomTom and (addon.db.profile.worldmap or addon.db.profile.minimap) then + if _G.TomTom and (addon.db.profile.worldmap or addon.db.profile.minimap) then ttAdd(0, -1, 0, L["CTRL_SHIFT_CLICK"], color_1) end acquire_tip:Show() @@ -2213,7 +2213,7 @@ do local sorted_locations = addon.sorted_locations local sorted_acquires = addon.sorted_acquires local sort_type = addon.db.profile.sorting - local recipes_displayed = 0 + local recipe_count = 0 for i = 1, #self.entries do ReleaseTable(self.entries[i]) @@ -2228,7 +2228,7 @@ do local acquire_type = sorted_acquires[index] local count = 0 - -- Check to see if any recipes for this location will be shown - otherwise, don't show the location in the list. + -- Check to see if any recipes for this acquire type will be shown - otherwise, don't show the type in the list. for spell_id in pairs(private.acquire_list[acquire_type].recipes) do local recipe = private.recipe_list[spell_id] @@ -2237,7 +2237,7 @@ do if not recipe_registry[recipe] then recipe_registry[recipe] = true - recipes_displayed = recipes_displayed + 1 + recipe_count = recipe_count + 1 end end end @@ -2279,7 +2279,7 @@ do if not recipe_registry[recipe] then recipe_registry[recipe] = true - recipes_displayed = recipes_displayed + 1 + recipe_count = recipe_count + 1 end end end @@ -2318,7 +2318,7 @@ do t.recipe_id = recipe_index t.is_header = true - recipes_displayed = recipes_displayed + 1 + recipe_count = recipe_count + 1 if expand_acquires then -- we have acquire information for this. push the title entry into the strings @@ -2834,14 +2834,14 @@ MainPanel.progress_bar.text:SetJustifyH("CENTER") -- Default values for the progressbar do - local pbMin = 0 - local pbMax = 100 - local pbCur = 50 + local min_value = 0 + local max_value = 100 + local value = 50 - MainPanel.progress_bar:SetMinMaxValues(pbMin, pbMax) - MainPanel.progress_bar:SetValue(pbCur) + MainPanel.progress_bar:SetMinMaxValues(min_value, max_value) + MainPanel.progress_bar:SetValue(value) - MainPanel.progress_bar.text:SetFormattedText("%d / %d - %1.1f%%", pbCur, pbMax, pbCur / pbMax * 100) + MainPanel.progress_bar.text:SetFormattedText("%d / %d - %1.1f%%", value, max_value, value / max_value * 100) end -- do function MainPanel.progress_bar:Update() -- 1.7.9.5 From df76fa36a7b81f01b0f8a7b63a2529e967a5f8c1 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 21:37:38 -0400 Subject: [PATCH 16/26] Merged MainPanel.progress_bar:Update() into MainPanel.scroll_frame:Update() --- Frame.lua | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/Frame.lua b/Frame.lua index d20b9a8..a2917dd 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2334,8 +2334,21 @@ do end end end -- Sort type. - self.recipes_displayed = recipes_displayed - MainPanel.progress_bar:Update() + local profile = addon.db.profile + local max_value = profile.includefiltered and Player.recipes_total or Player.recipes_total_filtered + local progress_bar = MainPanel.progress_bar + + if not profile.includeexcluded and not profile.ignoreexclusionlist then + max_value = max_value - Player.excluded_recipes_known + end + progress_bar:SetMinMaxValues(0, max_value) + progress_bar:SetValue(recipe_count) + + if (floor(recipe_count / max_value * 100) < 101) and recipe_count >= 0 and max_value >= 0 then + progress_bar.text:SetFormattedText("%d / %d - %1.2f%%", recipe_count, max_value, recipe_count / max_value * 100) + else + progress_bar.text:SetFormattedText("0 / 0 - %s", L["NOT_YET_SCANNED"]) + end end -- Reset the current buttons/lines @@ -2844,31 +2857,6 @@ do MainPanel.progress_bar.text:SetFormattedText("%d / %d - %1.1f%%", value, max_value, value / max_value * 100) end -- do -function MainPanel.progress_bar:Update() - local pbCur, pbMax - local settings = addon.db.profile - - pbCur = MainPanel.scroll_frame.recipes_displayed - - if settings.includefiltered then - pbMax = Player.recipes_total - else - pbMax = Player.recipes_total_filtered - end - - if not settings.includeexcluded and not settings.ignoreexclusionlist then - pbMax = pbMax - Player.excluded_recipes_known - end - self:SetMinMaxValues(0, pbMax) - self:SetValue(pbCur) - - if (floor(pbCur / pbMax * 100) < 101) and pbCur >= 0 and pbMax >= 0 then - self.text:SetFormattedText("%d / %d - %1.2f%%", pbCur, pbMax, pbCur / pbMax * 100) - else - self.text:SetFormattedText("0 / 0 - %s", L["NOT_YET_SCANNED"]) - end -end - ------------------------------------------------------------------------------- -- Create the close button, and set its scripts. ------------------------------------------------------------------------------- -- 1.7.9.5 From b76ba3b4bef86ce6cac579664ee52b2662f5f893 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 21:38:31 -0400 Subject: [PATCH 17/26] Moved some duplicate code from MainPanel.scroll_frame:Update() to MainPanel.scroll_frame:InsertEntry() --- Frame.lua | 54 ++++++++++++++++++++---------------------------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/Frame.lua b/Frame.lua index a2917dd..07de8ee 100644 --- a/Frame.lua +++ b/Frame.lua @@ -2203,6 +2203,23 @@ do -- necessary to ensure each is counted only once. local recipe_registry = {} + function MainPanel.scroll_frame:InsertEntry(entry, entry_index, expand_acquires) + local insert_index = entry_index + + -- If we have acquire information for this entry, push the data table into the list + -- and start processing the acquires. + if expand_acquires then + entry.is_expanded = true + tinsert(self.entries, insert_index, entry) + insert_index = self:ExpandEntry(insert_index) + else + entry.is_expanded = false + tinsert(self.entries, insert_index, entry) + insert_index = insert_index + 1 + end + return insert_index + end + function MainPanel.scroll_frame:Update(expand_acquires, refresh) local insert_index = 1 local recipe_list = private.recipe_list @@ -2242,7 +2259,6 @@ do end end - if count > 0 then local t = AcquireTable() @@ -2250,17 +2266,7 @@ do t.acquire_id = acquire_type t.is_header = true - if expand_acquires then - -- we have acquire information for this. push the title entry into the strings - -- and start processing the acquires - t.is_expanded = true - tinsert(self.entries, insert_index, t) - insert_index = self:ExpandEntry(insert_index) - else - t.is_expanded = false - tinsert(self.entries, insert_index, t) - insert_index = insert_index + 1 - end + insert_index = self:InsertEntry(t, insert_index, expand_acquires) end end elseif sort_type == "Location" then @@ -2291,17 +2297,7 @@ do t.location_id = loc_name t.is_header = true - if expand_acquires then - -- we have acquire information for this. push the title entry into the strings - -- and start processing the acquires - t.is_expanded = true - tinsert(self.entries, insert_index, t) - insert_index = self:ExpandEntry(insert_index) - else - t.is_expanded = false - tinsert(self.entries, insert_index, t) - insert_index = insert_index + 1 - end + insert_index = self:InsertEntry(t, insert_index, expand_acquires) end end else @@ -2320,17 +2316,7 @@ do recipe_count = recipe_count + 1 - if expand_acquires then - -- we have acquire information for this. push the title entry into the strings - -- and start processing the acquires - t.is_expanded = true - tinsert(self.entries, insert_index, t) - insert_index = self:ExpandEntry(insert_index) - else - t.is_expanded = false - tinsert(self.entries, insert_index, t) - insert_index = insert_index + 1 - end + insert_index = self:InsertEntry(t, insert_index, expand_acquires) end end end -- Sort type. -- 1.7.9.5 From 93b239561f63df1effe556a9fce0b177c364012e Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 22:19:18 -0400 Subject: [PATCH 18/26] More minor tweaks. --- Frame.lua | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/Frame.lua b/Frame.lua index 07de8ee..e566445 100644 --- a/Frame.lua +++ b/Frame.lua @@ -44,6 +44,13 @@ local tonumber = _G.tonumber local tostring = _G.tostring ------------------------------------------------------------------------------- +-- Localized Blizzard API. +------------------------------------------------------------------------------- +local GetItemQualityColor = _G.GetItemQualityColor + +-- GLOBALS: CreateFrame, GameTooltip + +------------------------------------------------------------------------------- -- AddOn namespace. ------------------------------------------------------------------------------- local LibStub = LibStub @@ -224,6 +231,8 @@ end ------------------------------------------------------------------------------- local SetTooltipScripts do + local HIGHLIGHT_FONT_COLOR = _G.HIGHLIGHT_FONT_COLOR + local function Show_Tooltip(frame, motion) GameTooltip_SetDefaultAnchor(GameTooltip, frame) GameTooltip:SetText(frame.tooltip_text, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b) @@ -556,8 +565,8 @@ do end -- Add TipTac Support - if TipTac and TipTac.AddModifiedTip and not spell_tip.tiptac then - TipTac:AddModifiedTip(spell_tip) + if _G.TipTac and _G.TipTac.AddModifiedTip and not spell_tip.tiptac then + _G.TipTac:AddModifiedTip(spell_tip) spell_tip.tiptac = true end @@ -640,9 +649,9 @@ do acquire_tip:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", x / uiscale, y / uiscale) end - if TipTac and TipTac.AddModifiedTip then + if _G.TipTac and _G.TipTac.AddModifiedTip then -- Pass true as second parameter because hooking OnHide causes C stack overflows -Torhal - TipTac:AddModifiedTip(acquire_tip, true) + _G.TipTac:AddModifiedTip(acquire_tip, true) end local _, _, _, quality_color = GetItemQualityColor(recipe_entry.quality) @@ -2115,7 +2124,7 @@ MainPanel.scroll_frame:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 20, -97) MainPanel.scroll_frame:SetScript("OnVerticalScroll", function(self, arg1) self.scrolling = true - FauxScrollFrame_OnVerticalScroll(self, arg1, 16, self.Update) + _G.FauxScrollFrame_OnVerticalScroll(self, arg1, 16, self.Update) self.scrolling = nil end) @@ -2359,7 +2368,7 @@ do display_lines = num_entries / 2 end - FauxScrollFrame_Update(self, num_entries, display_lines, 16) + _G.FauxScrollFrame_Update(self, num_entries, display_lines, 16) addon:ClosePopups() if num_entries > 0 then @@ -2368,7 +2377,7 @@ do -- Populate the buttons with new values local button_index = 1 - local string_index = button_index + FauxScrollFrame_GetOffset(self) + local string_index = button_index + _G.FauxScrollFrame_GetOffset(self) local stayInLoop = true while stayInLoop do @@ -2958,7 +2967,7 @@ local function SelectName(cell, arg, button) click_info.name = arg -- Wipe tradeskill information for the selected toon. -Torhal - if IsAltKeyDown() and button == "LeftButton" then + if _G.IsAltKeyDown() and button == "LeftButton" then local tskl_list = addon.db.global.tradeskill tskl_list[click_info.realm][click_info.name] = nil @@ -3295,14 +3304,14 @@ function addon:InitializeFrame() local traverseIndex = 0 -- First, check if this is a "modified" click, and react appropriately - if clicked_line.recipe_id and IsModifierKeyDown() then - if IsControlKeyDown() and IsShiftKeyDown() then + if clicked_line.recipe_id and _G.IsModifierKeyDown() then + if _G.IsControlKeyDown() and _G.IsShiftKeyDown() then addon:SetupMap(clicked_line.recipe_id) - elseif IsShiftKeyDown() then + elseif _G.IsShiftKeyDown() then local itemID = private.recipe_list[clicked_line.recipe_id].item_id if itemID then - local _, itemLink = GetItemInfo(itemID) + local _, itemLink = _G.GetItemInfo(itemID) if itemLink then ChatFrameEditBox:Insert(itemLink) @@ -3312,9 +3321,9 @@ function addon:InitializeFrame() else addon:Print(L["NoItemLink"]) end - elseif IsControlKeyDown() then + elseif _G.IsControlKeyDown() then ChatFrameEditBox:Insert(private.recipe_list[clicked_line.recipe_id].spell_link) - elseif IsAltKeyDown() then + elseif _G.IsAltKeyDown() then local exclusion_list = addon.db.profile.exclusionlist local recipe_id = clicked_line.recipe_id @@ -3779,8 +3788,8 @@ function addon:InitializeFrame() clicktip = QTip:Acquire("ARL_Clickable", 1, "CENTER") twipe(click_info) - if TipTac and TipTac.AddModifiedTip then - TipTac:AddModifiedTip(clicktip, true) + if _G.TipTac and _G.TipTac.AddModifiedTip then + _G.TipTac:AddModifiedTip(clicktip, true) end GenerateClickableTT(this) end -- 1.7.9.5 From 9262a118f3b58a67d07bfbcbc1e11e4b776fd8e3 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 22:20:10 -0400 Subject: [PATCH 19/26] Moved a few hundred lines of code out of addon:InitializeFrame() and into the main file body. --- Frame.lua | 498 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 250 insertions(+), 248 deletions(-) diff --git a/Frame.lua b/Frame.lua index e566445..1acf5e9 100644 --- a/Frame.lua +++ b/Frame.lua @@ -678,7 +678,6 @@ do local easy_level = recipe_entry.easy_level local trivial_level = recipe_entry.trivial_level - if recipe_level > skill_level then color_2 = addon:hexcolor("RED") elseif skill_level >= trivial_level then @@ -1209,6 +1208,255 @@ function MainPanel.mode_button:ChangeTexture(texture) end ------------------------------------------------------------------------------- +-- Create the sort-type DropDown. +------------------------------------------------------------------------------- +local ARL_DD_Sort = CreateFrame("Frame", "ARL_DD_Sort", MainPanel, "UIDropDownMenuTemplate") +ARL_DD_Sort:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 55, -39) +ARL_DD_Sort:SetHitRectInsets(16, 16, 0, 0) + +local function SetSortName() + local sort_type = addon.db.profile.sorting + + if sort_type == "Name" then + ARL_DD_SortText:SetText(L["Sort"] .. ": " .. _G.NAME) + elseif sort_type == "SkillAsc" then + ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Skill (Asc)"]) + elseif sort_type == "SkillDesc" then + ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Skill (Desc)"]) + elseif sort_type == "Acquisition" then + ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Acquisition"]) + elseif sort_type == "Location" then + ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Location"]) + end +end + +local function ARL_DD_Sort_OnClick(button, value) + CloseDropDownMenus() + addon.db.profile.sorting = value + SetSortName() + ReDisplay() +end + +local function ARL_DD_Sort_Initialize() + local info = UIDropDownMenu_CreateInfo() + + local k = "Name" + info.text = k + info.arg1 = info.text + info.func = ARL_DD_Sort_OnClick + info.checked = (addon.db.profile.sorting == k) + UIDropDownMenu_AddButton(info) + + k = "SkillAsc" + info.text = k + info.arg1 = info.text + info.func = ARL_DD_Sort_OnClick + info.checked = (addon.db.profile.sorting == k) + UIDropDownMenu_AddButton(info) + + k = "SkillDesc" + info.text = k + info.arg1 = info.text + info.func = ARL_DD_Sort_OnClick + info.checked = (addon.db.profile.sorting == k) + UIDropDownMenu_AddButton(info) + + k = "Acquisition" + info.text = k + info.arg1 = info.text + info.func = ARL_DD_Sort_OnClick + info.checked = (addon.db.profile.sorting == k) + UIDropDownMenu_AddButton(info) + + k = "Location" + info.text = k + info.arg1 = info.text + info.func = ARL_DD_Sort_OnClick + info.checked = (addon.db.profile.sorting == k) + UIDropDownMenu_AddButton(info) + + SetSortName() +end + +UIDropDownMenu_SetWidth(ARL_DD_Sort, 105) + +------------------------------------------------------------------------------- +-- Create the expand button and set its scripts. +------------------------------------------------------------------------------- +local ARL_ExpandButton = GenericCreateButton("ARL_ExpandButton", MainPanel, 21, 40, "GameFontNormalSmall", "GameFontHighlightSmall", L["EXPANDALL"], "CENTER", + L["EXPANDALL_DESC"], 1) +ARL_ExpandButton:SetPoint("TOPRIGHT", ARL_DD_Sort, "BOTTOMLEFT", -2, 0) + +ARL_ExpandButton:SetScript("OnClick", + function(self, mouse_button, down) + local expand_acquires = (self:GetText() == L["EXPANDALL"]) + + if expand_acquires then + self:SetText(L["CONTRACTALL"]) + SetTooltipScripts(self, L["CONTRACTALL_DESC"]) + else + self:SetText(L["EXPANDALL"]) + SetTooltipScripts(self, L["EXPANDALL_DESC"]) + end + MainPanel.scroll_frame:Update(expand_acquires, false) + end) +ARL_ExpandButton:SetText(L["EXPANDALL"]) +SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) + +------------------------------------------------------------------------------- +-- The search button, clear button, and search entry box. +------------------------------------------------------------------------------- +local SearchRecipes +do + local acquire_names = private.acquire_names + + local search_params = { + ["item_id"] = true, + ["name"] = true, + ["locations"] = true, + ["specialty"] = true, + ["skill_level"] = true, + ["quality"] = true, + } + -- Scans through the recipe database and toggles the flag on if the item is in the search criteria + function SearchRecipes(pattern) + if not pattern then + return + end + pattern = pattern:lower() + + local recipe_list = private.recipe_list + + for index in pairs(recipe_list) do + local entry = recipe_list[index] + entry.is_relevant = false + + for acquire_type in pairs(acquire_names) do + if pattern == string.lower(acquire_names[acquire_type]) and entry.acquire_data[acquire_type] then + entry.is_relevant = true + break + end + end + + for field in pairs(search_params) do + local str = entry[field] and tostring(entry[field]):lower() or nil + + if str and str:find(pattern) then + entry.is_relevant = true + break + end + end + end + end +end -- do + +local ARL_SearchButton = GenericCreateButton("ARL_SearchButton", MainPanel, 25, 74, "GameFontDisableSmall", "GameFontHighlightSmall", _G.SEARCH, "CENTER", + L["SEARCH_DESC"], 1) +ARL_SearchButton:SetPoint("TOPLEFT", ARL_DD_Sort, "BOTTOMRIGHT", 1, 4) + +ARL_SearchButton:Disable() +ARL_SearchButton:SetScript("OnClick", + function(this) + local searchtext = ARL_SearchText:GetText() + searchtext = searchtext:trim() + + if searchtext ~= "" then + ARL_LastSearchedText = searchtext + + SearchRecipes(searchtext) + MainPanel.scroll_frame:Update(false, false) + + ARL_ExpandButton:SetText(L["EXPANDALL"]) + SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) + + ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") + ARL_SearchButton:Disable() + end + end) + +local ARL_ClearButton = GenericCreateButton("ARL_ClearButton", MainPanel, 28, 28, "GameFontNormalSmall", "GameFontHighlightSmall", "", "CENTER", L["CLEAR_DESC"], 3) +ARL_ClearButton:SetPoint("RIGHT", ARL_SearchButton, "LEFT", 4, -1) + +ARL_ClearButton:SetScript("OnClick", + function() + local recipe_list = private.recipe_list + + -- Reset the search flags + for index in pairs(recipe_list) do + recipe_list[index].is_relevant = true + end + ARL_SearchText:SetText(L["SEARCH_BOX_DESC"]) + + -- Make sure our expand all button is set to expandall + ARL_ExpandButton:SetText(L["EXPANDALL"]) + SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) + + -- Make sure to clear the focus of the searchbox + ARL_SearchText:ClearFocus() + + -- Disable the search button since we're not searching for anything now + ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") + ARL_SearchButton:Disable() + + -- Make sure to clear text for last search + ARL_LastSearchedText = nil + + MainPanel.scroll_frame:Update(false, false) + end) + +ARL_SearchText = CreateFrame("EditBox", "ARL_SearchText", MainPanel, "InputBoxTemplate") +ARL_SearchText:SetText(L["SEARCH_BOX_DESC"]) +ARL_SearchText:SetScript("OnEnterPressed", + function(this) + local searchtext = ARL_SearchText:GetText() + searchtext = searchtext:trim() + + if searchtext ~= nil and searchtext ~= L["SEARCH_BOX_DESC"] then + ARL_LastSearchedText = searchtext + + SearchRecipes(searchtext) + MainPanel.scroll_frame:Update(false, false) + + ARL_ExpandButton:SetText(L["EXPANDALL"]) + SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) + + ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") + ARL_SearchButton:Disable() + end + end) +ARL_SearchText:SetScript("OnEditFocusGained", + function(this) + if this:GetText() == L["SEARCH_BOX_DESC"] then + this:SetText("") + end + end) +ARL_SearchText:SetScript("OnEditFocusLost", + function(this) + if this:GetText() == "" then + this:SetText(L["SEARCH_BOX_DESC"]) + end + end) +ARL_SearchText:SetScript("OnTextChanged", + function(this) + local text = this:GetText() + + if text ~= "" and text ~= L["SEARCH_BOX_DESC"] and text ~= ARL_LastSearchedText then + ARL_SearchButton:SetNormalFontObject("GameFontNormalSmall") + ARL_SearchButton:Enable() + else + ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") + ARL_SearchButton:Disable() + end + end) +ARL_SearchText:EnableMouse(true) +ARL_SearchText:SetAutoFocus(false) +ARL_SearchText:SetFontObject(ChatFontNormal) +ARL_SearchText:SetWidth(130) +ARL_SearchText:SetHeight(12) +ARL_SearchText:SetPoint("RIGHT", ARL_ClearButton, "LEFT", 3, -1) +ARL_SearchText:Show() + +------------------------------------------------------------------------------- -- Create the X-close button, and set its scripts. ------------------------------------------------------------------------------- MainPanel.xclose_button = CreateFrame("Button", nil, MainPanel, "UIPanelCloseButton") @@ -2863,70 +3111,6 @@ MainPanel.close_button:SetScript("OnClick", MainPanel:Hide() end) -local function SetSortName() - local sort_type = addon.db.profile.sorting - - if sort_type == "Name" then - ARL_DD_SortText:SetText(L["Sort"] .. ": " .. _G.NAME) - elseif sort_type == "SkillAsc" then - ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Skill (Asc)"]) - elseif sort_type == "SkillDesc" then - ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Skill (Desc)"]) - elseif sort_type == "Acquisition" then - ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Acquisition"]) - elseif sort_type == "Location" then - ARL_DD_SortText:SetText(L["Sort"] .. ": " .. L["Location"]) - end -end - -local function ARL_DD_Sort_OnClick(button, value) - CloseDropDownMenus() - addon.db.profile.sorting = value - SetSortName() - ReDisplay() -end - -local function ARL_DD_Sort_Initialize() - local info = UIDropDownMenu_CreateInfo() - - local k = "Name" - info.text = k - info.arg1 = info.text - info.func = ARL_DD_Sort_OnClick - info.checked = (addon.db.profile.sorting == k) - UIDropDownMenu_AddButton(info) - - k = "SkillAsc" - info.text = k - info.arg1 = info.text - info.func = ARL_DD_Sort_OnClick - info.checked = (addon.db.profile.sorting == k) - UIDropDownMenu_AddButton(info) - - k = "SkillDesc" - info.text = k - info.arg1 = info.text - info.func = ARL_DD_Sort_OnClick - info.checked = (addon.db.profile.sorting == k) - UIDropDownMenu_AddButton(info) - - k = "Acquisition" - info.text = k - info.arg1 = info.text - info.func = ARL_DD_Sort_OnClick - info.checked = (addon.db.profile.sorting == k) - UIDropDownMenu_AddButton(info) - - k = "Location" - info.text = k - info.arg1 = info.text - info.func = ARL_DD_Sort_OnClick - info.checked = (addon.db.profile.sorting == k) - UIDropDownMenu_AddButton(info) - - SetSortName() -end - ------------------------------------------------------------------------------- -- Data used in GenerateClickableTT() and its support functions. ------------------------------------------------------------------------------- @@ -3104,190 +3288,8 @@ function addon:InitializeFrame() local Frostborn_Taunka_FactionText = isAlliance and BFAC["The Frostborn"] or BFAC["The Taunka"] local Explorer_Hand_FactionText = isAlliance and BFAC["Explorers' League"] or BFAC["The Hand of Vengeance"] - ------------------------------------------------------------------------------- - -- Create the sort-type DropDown. - ------------------------------------------------------------------------------- - local ARL_DD_Sort = CreateFrame("Frame", "ARL_DD_Sort", MainPanel, "UIDropDownMenuTemplate") - ARL_DD_Sort:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 55, -39) - ARL_DD_Sort:SetHitRectInsets(16, 16, 0, 0) + -- Has to be done here because db doesn't exist yet if executed in the main file body. SetSortName() - UIDropDownMenu_SetWidth(ARL_DD_Sort, 105) - - ------------------------------------------------------------------------------- - -- Create the expand button and set its scripts. - ------------------------------------------------------------------------------- - local ARL_ExpandButton = GenericCreateButton("ARL_ExpandButton", MainPanel, 21, 40, "GameFontNormalSmall", "GameFontHighlightSmall", L["EXPANDALL"], "CENTER", - L["EXPANDALL_DESC"], 1) - ARL_ExpandButton:SetPoint("TOPRIGHT", ARL_DD_Sort, "BOTTOMLEFT", -2, 0) - - ARL_ExpandButton:SetScript("OnClick", - function(self, mouse_button, down) - local expand_acquires = (self:GetText() == L["EXPANDALL"]) - - if expand_acquires then - self:SetText(L["CONTRACTALL"]) - SetTooltipScripts(self, L["CONTRACTALL_DESC"]) - else - self:SetText(L["EXPANDALL"]) - SetTooltipScripts(self, L["EXPANDALL_DESC"]) - end - MainPanel.scroll_frame:Update(expand_acquires, false) - end) - ARL_ExpandButton:SetText(L["EXPANDALL"]) - SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) - - ------------------------------------------------------------------------------- - -- The search button, clear button, and search entry box. - ------------------------------------------------------------------------------- - local SearchRecipes - do - local acquire_names = private.acquire_names - - local search_params = { - ["item_id"] = true, - ["name"] = true, - ["locations"] = true, - ["specialty"] = true, - ["skill_level"] = true, - ["quality"] = true, - } - -- Scans through the recipe database and toggles the flag on if the item is in the search criteria - function SearchRecipes(pattern) - if not pattern then - return - end - pattern = pattern:lower() - - local recipe_list = private.recipe_list - - for index in pairs(recipe_list) do - local entry = recipe_list[index] - entry.is_relevant = false - - for acquire_type in pairs(acquire_names) do - if pattern == string.lower(acquire_names[acquire_type]) and entry.acquire_data[acquire_type] then - entry.is_relevant = true - break - end - end - - for field in pairs(search_params) do - local str = entry[field] and tostring(entry[field]):lower() or nil - - if str and str:find(pattern) then - entry.is_relevant = true - break - end - end - end - end - end -- do - - local ARL_SearchButton = GenericCreateButton("ARL_SearchButton", MainPanel, 25, 74, "GameFontDisableSmall", "GameFontHighlightSmall", _G.SEARCH, "CENTER", - L["SEARCH_DESC"], 1) - ARL_SearchButton:SetPoint("TOPLEFT", ARL_DD_Sort, "BOTTOMRIGHT", 1, 4) - - ARL_SearchButton:Disable() - ARL_SearchButton:SetScript("OnClick", - function(this) - local searchtext = ARL_SearchText:GetText() - searchtext = searchtext:trim() - - if searchtext ~= "" then - ARL_LastSearchedText = searchtext - - SearchRecipes(searchtext) - MainPanel.scroll_frame:Update(false, false) - - ARL_ExpandButton:SetText(L["EXPANDALL"]) - SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) - - ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") - ARL_SearchButton:Disable() - end - end) - - local ARL_ClearButton = GenericCreateButton("ARL_ClearButton", MainPanel, 28, 28, "GameFontNormalSmall", "GameFontHighlightSmall", "", "CENTER", L["CLEAR_DESC"], 3) - ARL_ClearButton:SetPoint("RIGHT", ARL_SearchButton, "LEFT", 4, -1) - - ARL_ClearButton:SetScript("OnClick", - function() - local recipe_list = private.recipe_list - - -- Reset the search flags - for index in pairs(recipe_list) do - recipe_list[index].is_relevant = true - end - ARL_SearchText:SetText(L["SEARCH_BOX_DESC"]) - - -- Make sure our expand all button is set to expandall - ARL_ExpandButton:SetText(L["EXPANDALL"]) - SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) - - -- Make sure to clear the focus of the searchbox - ARL_SearchText:ClearFocus() - - -- Disable the search button since we're not searching for anything now - ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") - ARL_SearchButton:Disable() - - -- Make sure to clear text for last search - ARL_LastSearchedText = nil - - MainPanel.scroll_frame:Update(false, false) - end) - - ARL_SearchText = CreateFrame("EditBox", "ARL_SearchText", MainPanel, "InputBoxTemplate") - ARL_SearchText:SetText(L["SEARCH_BOX_DESC"]) - ARL_SearchText:SetScript("OnEnterPressed", - function(this) - local searchtext = ARL_SearchText:GetText() - searchtext = searchtext:trim() - - if searchtext ~= nil and searchtext ~= L["SEARCH_BOX_DESC"] then - ARL_LastSearchedText = searchtext - - SearchRecipes(searchtext) - MainPanel.scroll_frame:Update(false, false) - - ARL_ExpandButton:SetText(L["EXPANDALL"]) - SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) - - ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") - ARL_SearchButton:Disable() - end - end) - ARL_SearchText:SetScript("OnEditFocusGained", - function(this) - if this:GetText() == L["SEARCH_BOX_DESC"] then - this:SetText("") - end - end) - ARL_SearchText:SetScript("OnEditFocusLost", - function(this) - if this:GetText() == "" then - this:SetText(L["SEARCH_BOX_DESC"]) - end - end) - ARL_SearchText:SetScript("OnTextChanged", - function(this) - local text = this:GetText() - - if text ~= "" and text ~= L["SEARCH_BOX_DESC"] and text ~= ARL_LastSearchedText then - ARL_SearchButton:SetNormalFontObject("GameFontNormalSmall") - ARL_SearchButton:Enable() - else - ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") - ARL_SearchButton:Disable() - end - end) - ARL_SearchText:EnableMouse(true) - ARL_SearchText:SetAutoFocus(false) - ARL_SearchText:SetFontObject(ChatFontNormal) - ARL_SearchText:SetWidth(130) - ARL_SearchText:SetHeight(12) - ARL_SearchText:SetPoint("RIGHT", ARL_ClearButton, "LEFT", 3, -1) - ARL_SearchText:Show() ------------------------------------------------------------------------------- -- Set the scripts for MainPanel.scroll_frame's buttons. -- 1.7.9.5 From a5dc93e14aba4e70e67ad0849c596c6b31a1ae69 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 22:44:55 -0400 Subject: [PATCH 20/26] in MainPanel:SetProfession(): Added assignment of previous profession if the current one is different. --- Frame.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Frame.lua b/Frame.lua index 1acf5e9..585b28b 100644 --- a/Frame.lua +++ b/Frame.lua @@ -1036,6 +1036,8 @@ do local MINING_SPELL = GetSpellInfo(32606) function MainPanel:SetProfession() + local prev_profession = self.profession + if Player.current_prof == MINING_SPELL then self.profession = 11 -- Smelting else @@ -1046,6 +1048,10 @@ do end end end + + if self.profession ~= prev_profession then + self.prev_profession = prev_profession + end self.mode_button:ChangeTexture(SORTED_PROFESSIONS[self.profession].texture) end end -- 1.7.9.5 From 790be76343b96e78c93f204631427e5c65335a83 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 22:45:57 -0400 Subject: [PATCH 21/26] In addon:DisplayFrame(): If MainPanel.profession is different from MainPanel.prev_profession, clear the search box. Closes ticket 962. --- Frame.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Frame.lua b/Frame.lua index 585b28b..c22a759 100644 --- a/Frame.lua +++ b/Frame.lua @@ -3957,7 +3957,12 @@ function addon:DisplayFrame() -- Set the search text to the last searched text or the global default string for the search box -- We should think about either preserving the search everytime arl is open or we clear it completely - pompachomp - ARL_SearchText:SetText(ARL_LastSearchedText or L["SEARCH_BOX_DESC"]) + local editbox = MainPanel.search_editbox + + if MainPanel.profession ~= MainPanel.prev_profession then + editbox.prev_search = nil + end + editbox:SetText(editbox.prev_search or L["SEARCH_BOX_DESC"]) end -------------------------------------------------------------------------------- -- 1.7.9.5 From 858a68d76a23161f70e574f41b944dbff65d513f Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Mon, 22 Mar 2010 22:49:06 -0400 Subject: [PATCH 22/26] Changed ARL_SearchText to MainPanel.search_editbox and ARL_LastSearchedText to MainPanel.search_editbox.prev_search --- Frame.lua | 85 ++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/Frame.lua b/Frame.lua index c22a759..ce595d4 100644 --- a/Frame.lua +++ b/Frame.lua @@ -187,8 +187,6 @@ StaticPopupDialogs["ARL_SEARCHFILTERED"] = { ------------------------------------------------------------------------------- local FilterValueMap -- Assigned in addon:InitializeFrame() -local ARL_SearchText, ARL_LastSearchedText - ------------------------------------------------------------------------------- -- Upvalues ------------------------------------------------------------------------------- @@ -1214,7 +1212,7 @@ function MainPanel.mode_button:ChangeTexture(texture) end ------------------------------------------------------------------------------- --- Create the sort-type DropDown. +-- Create the DropDown for sorting types. ------------------------------------------------------------------------------- local ARL_DD_Sort = CreateFrame("Frame", "ARL_DD_Sort", MainPanel, "UIDropDownMenuTemplate") ARL_DD_Sort:SetPoint("TOPLEFT", MainPanel, "TOPLEFT", 55, -39) @@ -1363,11 +1361,11 @@ ARL_SearchButton:SetPoint("TOPLEFT", ARL_DD_Sort, "BOTTOMRIGHT", 1, 4) ARL_SearchButton:Disable() ARL_SearchButton:SetScript("OnClick", function(this) - local searchtext = ARL_SearchText:GetText() + local searchtext = MainPanel.search_editbox:GetText() searchtext = searchtext:trim() if searchtext ~= "" then - ARL_LastSearchedText = searchtext + MainPanel.search_editbox.prev_search = searchtext SearchRecipes(searchtext) MainPanel.scroll_frame:Update(false, false) @@ -1391,62 +1389,66 @@ ARL_ClearButton:SetScript("OnClick", for index in pairs(recipe_list) do recipe_list[index].is_relevant = true end - ARL_SearchText:SetText(L["SEARCH_BOX_DESC"]) + MainPanel.search_editbox:SetText(L["SEARCH_BOX_DESC"]) -- Make sure our expand all button is set to expandall ARL_ExpandButton:SetText(L["EXPANDALL"]) SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) -- Make sure to clear the focus of the searchbox - ARL_SearchText:ClearFocus() + MainPanel.search_editbox:ClearFocus() -- Disable the search button since we're not searching for anything now ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") ARL_SearchButton:Disable() -- Make sure to clear text for last search - ARL_LastSearchedText = nil + MainPanel.search_editbox.prev_search = nil MainPanel.scroll_frame:Update(false, false) end) -ARL_SearchText = CreateFrame("EditBox", "ARL_SearchText", MainPanel, "InputBoxTemplate") -ARL_SearchText:SetText(L["SEARCH_BOX_DESC"]) -ARL_SearchText:SetScript("OnEnterPressed", - function(this) - local searchtext = ARL_SearchText:GetText() - searchtext = searchtext:trim() +MainPanel.search_editbox = CreateFrame("EditBox", nil, MainPanel, "InputBoxTemplate") +MainPanel.search_editbox:SetText(L["SEARCH_BOX_DESC"]) - if searchtext ~= nil and searchtext ~= L["SEARCH_BOX_DESC"] then - ARL_LastSearchedText = searchtext +local function EditBox_OnEnterPressed(self) + local searchtext = self:GetText() + searchtext = searchtext:trim() - SearchRecipes(searchtext) - MainPanel.scroll_frame:Update(false, false) + if searchtext and searchtext ~= L["SEARCH_BOX_DESC"] then + self.prev_search = searchtext - ARL_ExpandButton:SetText(L["EXPANDALL"]) - SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) + SearchRecipes(searchtext) + MainPanel.scroll_frame:Update(false, false) - ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") - ARL_SearchButton:Disable() - end - end) -ARL_SearchText:SetScript("OnEditFocusGained", - function(this) - if this:GetText() == L["SEARCH_BOX_DESC"] then - this:SetText("") + ARL_ExpandButton:SetText(L["EXPANDALL"]) + SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) + + ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") + ARL_SearchButton:Disable() + end +end +MainPanel.search_editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed) + +MainPanel.search_editbox:SetScript("OnEditFocusGained", + function(self) + if self:GetText() == L["SEARCH_BOX_DESC"] then + self:SetText("") end end) -ARL_SearchText:SetScript("OnEditFocusLost", + +MainPanel.search_editbox:SetScript("OnEditFocusLost", function(this) if this:GetText() == "" then this:SetText(L["SEARCH_BOX_DESC"]) end end) -ARL_SearchText:SetScript("OnTextChanged", - function(this) - local text = this:GetText() - if text ~= "" and text ~= L["SEARCH_BOX_DESC"] and text ~= ARL_LastSearchedText then +MainPanel.search_editbox:SetScript("OnTextChanged", + function(self) + local text = self:GetText() + + if text ~= "" and text ~= L["SEARCH_BOX_DESC"] and text ~= self.prev_search then ARL_SearchButton:SetNormalFontObject("GameFontNormalSmall") ARL_SearchButton:Enable() else @@ -1454,13 +1456,14 @@ ARL_SearchText:SetScript("OnTextChanged", ARL_SearchButton:Disable() end end) -ARL_SearchText:EnableMouse(true) -ARL_SearchText:SetAutoFocus(false) -ARL_SearchText:SetFontObject(ChatFontNormal) -ARL_SearchText:SetWidth(130) -ARL_SearchText:SetHeight(12) -ARL_SearchText:SetPoint("RIGHT", ARL_ClearButton, "LEFT", 3, -1) -ARL_SearchText:Show() + +MainPanel.search_editbox:EnableMouse(true) +MainPanel.search_editbox:SetAutoFocus(false) +MainPanel.search_editbox:SetFontObject(ChatFontNormal) +MainPanel.search_editbox:SetWidth(130) +MainPanel.search_editbox:SetHeight(12) +MainPanel.search_editbox:SetPoint("RIGHT", ARL_ClearButton, "LEFT", 3, -1) +MainPanel.search_editbox:Show() ------------------------------------------------------------------------------- -- Create the X-close button, and set its scripts. @@ -2705,7 +2708,7 @@ do if showpopup then StaticPopup_Show("ARL_ALLEXCLUDED") end - elseif ARL_SearchText:GetText() ~= "" then + elseif MainPanel.search_editbox:GetText() ~= "" then StaticPopup_Show("ARL_SEARCHFILTERED") else addon:Print(L["NO_DISPLAY"]) -- 1.7.9.5 From d408cd22c96ee67e136b4de27c6bb4d11d612e76 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Tue, 23 Mar 2010 00:55:11 -0400 Subject: [PATCH 23/26] In addon:AddRecipeAcquire(): Try to retrieve a location for CUSTOM acquire types before using _G.MISCELLANEOUS. --- ARL.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ARL.lua b/ARL.lua index 6d19136..34a39e1 100644 --- a/ARL.lua +++ b/ARL.lua @@ -1075,7 +1075,7 @@ do location = GetCategoryInfo(155) elseif acquire_type == A.CUSTOM then acquire[acquire_id] = true - location = _G.MISCELLANEOUS + location = private.custom_list[acquire_id].location or _G.MISCELLANEOUS else -- Unhandled acquire_type acquire[acquire_id] = true -- 1.7.9.5 From 1bb8aca9a80d10eb58dd3fb556337c06c661958b Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Tue, 23 Mar 2010 01:16:43 -0400 Subject: [PATCH 24/26] Actually fix ticket 962 - for real this time. --- Frame.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Frame.lua b/Frame.lua index ce595d4..2d156ff 100644 --- a/Frame.lua +++ b/Frame.lua @@ -1048,7 +1048,7 @@ do end if self.profession ~= prev_profession then - self.prev_profession = prev_profession + self.prev_profession = self.profession end self.mode_button:ChangeTexture(SORTED_PROFESSIONS[self.profession].texture) end @@ -3954,18 +3954,16 @@ function addon:DisplayFrame() ARL_DD_Sort.initialize = ARL_DD_Sort_Initialize -- Initialize dropdown - MainPanel:UpdateTitle() - MainPanel.scroll_frame:Update(false, false) - MainPanel:Show() - - -- Set the search text to the last searched text or the global default string for the search box - -- We should think about either preserving the search everytime arl is open or we clear it completely - pompachomp local editbox = MainPanel.search_editbox if MainPanel.profession ~= MainPanel.prev_profession then editbox.prev_search = nil end editbox:SetText(editbox.prev_search or L["SEARCH_BOX_DESC"]) + + MainPanel:UpdateTitle() + MainPanel.scroll_frame:Update(false, false) + MainPanel:Show() end -------------------------------------------------------------------------------- -- 1.7.9.5 From 6ded3a303e44b8bb4e6076b878e5c7cf47f6836c Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Tue, 23 Mar 2010 01:18:34 -0400 Subject: [PATCH 25/26] More small tweaks. --- Frame.lua | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Frame.lua b/Frame.lua index 2d156ff..166944c 100644 --- a/Frame.lua +++ b/Frame.lua @@ -48,7 +48,7 @@ local tostring = _G.tostring ------------------------------------------------------------------------------- local GetItemQualityColor = _G.GetItemQualityColor --- GLOBALS: CreateFrame, GameTooltip +-- GLOBALS: CreateFrame, GameTooltip, UIParent ------------------------------------------------------------------------------- -- AddOn namespace. @@ -1061,14 +1061,14 @@ function MainPanel:SetPosition() self:ClearAllPoints() if opts.anchorTo == "" then -- no values yet, clamp to whatever frame is appropriate - if ATSWFrame then - self:SetPoint("CENTER", ATSWFrame, "CENTER", 490, 0) - elseif CauldronFrame then - self:SetPoint("CENTER", CauldronFrame, "CENTER", 490, 0) - elseif Skillet then - self:SetPoint("CENTER", SkilletFrame, "CENTER", 468, 0) + if _G.ATSWFrame then + self:SetPoint("CENTER", _G.ATSWFrame, "CENTER", 490, 0) + elseif _G.CauldronFrame then + self:SetPoint("CENTER", _G.CauldronFrame, "CENTER", 490, 0) + elseif _G.Skillet then + self:SetPoint("CENTER", _G.SkilletFrame, "CENTER", 468, 0) else - self:SetPoint("TOPLEFT", TradeSkillFrame, "TOPRIGHT", 10, 0) + self:SetPoint("TOPLEFT", _G.TradeSkillFrame, "TOPRIGHT", 10, 0) end else if self.is_expanded then @@ -3194,7 +3194,7 @@ function GenerateClickableTT(anchor) local tskl_list = addon.db.global.tradeskill local tip = clicktip local y, x - local prealm = GetRealmName() + local prealm = _G.GetRealmName() local target_realm = prealm if click_info.change_realm then @@ -3208,11 +3208,11 @@ function GenerateClickableTT(anchor) local header = nil for realm in pairs(tskl_list) do - if target_realm and (realm ~= target_realm) then + if target_realm and realm ~= target_realm then other_realms = true end - if not target_realm and (realm ~= prealm) then + if not target_realm and realm ~= prealm then if not header then tip:AddHeader(L["Other Realms"]) tip:AddSeparator() @@ -3228,7 +3228,7 @@ function GenerateClickableTT(anchor) tip:AddSeparator() for name in pairs(tskl_list[click_info.realm]) do - if name ~= UnitName("player") then + if name ~= _G.UnitName("player") then y, x = tip:AddLine() tip:SetCell(y, x, name) tip:SetCellScript(y, x, "OnMouseUp", SelectName, name) -- 1.7.9.5 From 013b5dedd6dff33b61b2405be713b5fd9d6e739d Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Tue, 23 Mar 2010 01:19:58 -0400 Subject: [PATCH 26/26] Modified the search editbox to have a 10-line history (accessible by up/down keys) and to search as you type. --- Frame.lua | 68 +++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/Frame.lua b/Frame.lua index 166944c..552557e 100644 --- a/Frame.lua +++ b/Frame.lua @@ -1410,25 +1410,27 @@ ARL_ClearButton:SetScript("OnClick", MainPanel.search_editbox = CreateFrame("EditBox", nil, MainPanel, "InputBoxTemplate") MainPanel.search_editbox:SetText(L["SEARCH_BOX_DESC"]) +MainPanel.search_editbox:SetHistoryLines(10) -local function EditBox_OnEnterPressed(self) - local searchtext = self:GetText() - searchtext = searchtext:trim() +MainPanel.search_editbox:SetScript("OnEnterPressed", + function(self) + local searchtext = self:GetText() + searchtext = searchtext:trim() - if searchtext and searchtext ~= L["SEARCH_BOX_DESC"] then - self.prev_search = searchtext + if searchtext and searchtext ~= L["SEARCH_BOX_DESC"] then + self.prev_search = searchtext - SearchRecipes(searchtext) - MainPanel.scroll_frame:Update(false, false) + self:AddHistoryLine(searchtext) + SearchRecipes(searchtext) + MainPanel.scroll_frame:Update(false, false) - ARL_ExpandButton:SetText(L["EXPANDALL"]) - SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) + ARL_ExpandButton:SetText(L["EXPANDALL"]) + SetTooltipScripts(ARL_ExpandButton, L["EXPANDALL_DESC"]) - ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") - ARL_SearchButton:Disable() - end -end -MainPanel.search_editbox:SetScript("OnEnterPressed", EditBox_OnEnterPressed) + ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") + ARL_SearchButton:Disable() + end + end) MainPanel.search_editbox:SetScript("OnEditFocusGained", function(self) @@ -1438,17 +1440,47 @@ MainPanel.search_editbox:SetScript("OnEditFocusGained", end) MainPanel.search_editbox:SetScript("OnEditFocusLost", - function(this) - if this:GetText() == "" then - this:SetText(L["SEARCH_BOX_DESC"]) + function(self) + local text = self:GetText() + + if text == "" then + self:SetText(L["SEARCH_BOX_DESC"]) + return + self:AddHistoryLine(text) end end) + +MainPanel.search_editbox:SetScript("OnTextSet", + function(self) + local text = self:GetText() + + if text ~= "" and text ~= L["SEARCH_BOX_DESC"] and text ~= self.prev_search then + ARL_SearchButton:SetNormalFontObject("GameFontNormalSmall") + ARL_SearchButton:Enable() + else + local recipe_list = private.recipe_list + + for spell_id in pairs(recipe_list) do + local recipe = recipe_list[spell_id] + + recipe.is_relevant = true + end + ARL_SearchButton:SetNormalFontObject("GameFontDisableSmall") + ARL_SearchButton:Disable() + end + end) + MainPanel.search_editbox:SetScript("OnTextChanged", - function(self) + function(self, is_typed) + if not is_typed then + return + end local text = self:GetText() if text ~= "" and text ~= L["SEARCH_BOX_DESC"] and text ~= self.prev_search then + SearchRecipes(text) + MainPanel.scroll_frame:Update(false, false) ARL_SearchButton:SetNormalFontObject("GameFontNormalSmall") ARL_SearchButton:Enable() else -- 1.7.9.5