Version 0.8.0-beta

- handle replacement via slash command
- emote and ooc detection
- de-/activate single mappings
- move buttons and mappings are disabled when already at top/bottom or deactivated
- minimap button is darkened when addon is disabled
- help tab with examples

- right-click on minimap button quickly de-/activates replacements

- fixed mapping to raid warning, instance and battleground chats
- localized raid target markers
- capital % substitutions
- incorrect consolidation
- Umlaut and accent replacements
This commit is contained in:
2020-06-09 02:28:31 +02:00
parent 5b72ad3b78
commit 44dd7ac8eb
26 changed files with 1389 additions and 406 deletions

View File

@@ -2,8 +2,8 @@
local _G = _G
local Grichelde = _G.Grichelde
local type, print, pairs, tSize, select, unpack, find, format, rep, toString
= Grichelde.functions.type, Grichelde.functions.print, Grichelde.functions.pairs, Grichelde.functions.tSize, Grichelde.functions.select, Grichelde.functions.unpack, Grichelde.functions.find, Grichelde.functions.format, Grichelde.functions.rep, Grichelde.functions.toString
local type, print, pairs, tSize, select, unpack, find, color, cGray, cDarkgray, cPrefix, format, rep, toString
= Grichelde.functions.type, Grichelde.functions.print, Grichelde.functions.pairs, Grichelde.functions.tSize, Grichelde.functions.select, Grichelde.functions.unpack, Grichelde.functions.find, Grichelde.functions.color, Grichelde.functions.cGray, Grichelde.functions.cDarkgray, Grichelde.functions.cPrefix, Grichelde.functions.format, Grichelde.functions.rep, Grichelde.functions.toString
-- show strings differently to distinguish them from numbers
local function plainValue(val)
@@ -60,7 +60,7 @@ local function tPrint(val, indent, known, printFunc)
end
end
-- split at first word of a text line
--- Splits at first word of a text line
function Grichelde:SplitOnFirstMatch(text, delimPattern, start)
if text == nil then return nil end
local pattern = "^(.-)" .. (delimPattern or " " ) .."(.*)"
@@ -71,7 +71,7 @@ function Grichelde:SplitOnFirstMatch(text, delimPattern, start)
return left or text, right
end
-- split at last word of a text line
--- Splits at last word of a text line
function Grichelde:SplitOnLastMatch(text, delimPattern, start)
local pattern = "(.*)" .. (delimPattern or " ") .. "(.-)$"
local pos = start or 1
@@ -81,10 +81,10 @@ function Grichelde:SplitOnLastMatch(text, delimPattern, start)
return left, right or text
end
-- split at last word of a text line
--- Splits at last word of a text line
function Grichelde:TestMatch(text, pattern)
local _, _, left, right = find(text, pattern, 1)
self:DebugPrint("TestMatch : left: %s, right: %s", left, right)
local pos1, pos2, left, right = find(text, pattern, 1)
self:DebugPrint("TestMatch : pos1: %d, pos2: %d, left: %s, right: %s", pos1, pos2, left, right)
end
function Grichelde:Format(message, ...)
@@ -117,18 +117,22 @@ function Grichelde:Print(...)
end
function Grichelde:PrefixedPrint(...)
print(self.COLOR_CODES.PREFIX .. self.L.AddonName .. self.COLOR_CODES.CLOSE .. ":", self:Format(...))
print(cPrefix(self.L.AddonName) .. ":", self:Format(...))
end
function Grichelde:ErrorPrint(...)
print(cPrefix(self.L.AddonName) .. ": " .. color(self.COLOR_CODES.RED, self:Format(...)))
end
function Grichelde:DebugPrint(obj, ...)
self:LogPrint(Grichelde.LOG_LEVEL.DEBUG, function(...)
print(self.COLOR_CODES.GRAY .. self.L.AddonName .. self.COLOR_CODES.CLOSE .. ":", self:Format(...))
print(cGray(self.L.AddonName) .. ":", self:Format(...))
end, obj, ...)
end
function Grichelde:TracePrint(obj, ...)
self:LogPrint(Grichelde.LOG_LEVEL.TRACE, function(...)
print(self.COLOR_CODES.DARKGRAY .. self.L.AddonName .. self.COLOR_CODES.CLOSE .. ":", self:Format(...))
print(cDarkgray(self.L.AddonName) .. ":", self:Format(...))
end, obj, ...)
end
@@ -166,29 +170,29 @@ end
--- Print UI options to chat frame
function Grichelde:PrintOptions()
self:PrefixedPrint(self.COLOR_CODES.PREFIX .. self.L.Debug_Options .. self.COLOR_CODES.CLOSE)
self:PrefixedPrint(cPrefix(self.L.Debug_Options))
self:LogPrint(-1, function(...)
print(self.COLOR_CODES.PREFIX .. self.L.AddonName .. self.COLOR_CODES.CLOSE .. ":", self:Format(...))
print(cPrefix(self.L.AddonName) .. ":", self:Format(...))
end, self.options.args.replacements.args)
end
--- Print DB
--- Print current DB profile
function Grichelde:PrintProfile()
self:PrefixedPrint(self.COLOR_CODES.PREFIX .. self.L.Debug_Profile .. self.COLOR_CODES.CLOSE)
self:PrefixedPrint(cPrefix(self.L.Debug_Profile))
self:LogPrint(-1, function(...)
print(self.COLOR_CODES.PREFIX .. self.L.AddonName .. self.COLOR_CODES.CLOSE .. ":", self:Format(...))
print(cPrefix(self.L.AddonName) .. ":", self:Format(...))
end, self.db.profile)
end
--- Print DB replacements to chat frame
function Grichelde:PrintMappings()
self:PrefixedPrint(self.COLOR_CODES.PREFIX .. self.L.Debug_Mappings .. self.COLOR_CODES.CLOSE)
self:PrefixedPrint(cPrefix(self.L.Debug_Mappings))
self:LogPrint(-1, function(...)
print(self.COLOR_CODES.PREFIX .. self.L.AddonName .. self.COLOR_CODES.CLOSE .. ":", self:Format(...))
print(cPrefix(self.L.AddonName) .. ":", self:Format(...))
end, self.db.profile.replacements)
end
--- Open UI windows with replacements in it
--- Open window with DB replacements in it
function Grichelde:ToogleMappings()
local AceGUI = LibStub("AceGUI-3.0")
@@ -230,7 +234,7 @@ function Grichelde:ToogleMappings()
tPrint(replacements, 0, {}, function(s) text = text .. s .. "|n" end)
configBox:SetText(text)
configBox:SetFullWidth(true)
configBox:SetFullHeight(true)
--configBox:SetFullHeight(true)
configBox:DisableButton(true)
--configBox:SetDisabled(true)
configBox:SetNumLines(50);