diff --git a/.luacheckrc b/.luacheckrc index 02433fd..9657068 100755 --- a/.luacheckrc +++ b/.luacheckrc @@ -1,6 +1,6 @@ std = "none" max_line_length = false -max_comment_line_length = 80 +max_comment_line_length = 120 self = false exclude_files = { @@ -9,7 +9,7 @@ exclude_files = { } ignore = { - "111/LS.*", -- Setting an undefined global variable starting with SLASH_ + "111/LS.*", -- Setting an undefined global variable starting with LS "111/SLASH_.*", -- Setting an undefined global variable starting with SLASH_ "112/LS.*", -- Mutating an undefined global variable starting with LS "113/LS.*", -- Accessing an undefined global variable starting with LS @@ -29,42 +29,30 @@ globals = { } read_globals = { - -- AddOns - "LibStub", - - -- FrameXML "BattlePetTooltip", "BattlePetToolTip_ShowLink", - "CHAT_FRAME_MIN_WIDTH", - "CHAT_FRAME_NORMAL_MIN_HEIGHT", "ChatFrame1", - "ChatFrame1EditBox", "ChatFrame2", "ChatFrameChannelButton", "ChatFrameMenuButton", "Clamp", "ColorMixin", + "CreateFont", + "CreateFrame", "CreateObjectPool", "DEFAULT_TAB_SELECTED_COLOR_TABLE", "GameTooltip", "GeneralDockManager", + "GetAddOnMetadata", + "GetLocale", "HideUIPanel", + "InCombatLockdown", + "LibStub", "LinkUtil", "Mixin", "NORMAL_FONT_COLOR", "NUM_CHAT_WINDOWS", "Settings", "SettingsPanel", - "SlashCmdList", "UIParent", - - -- Namespace - - -- API - "CreateFont", - "CreateFrame", - "GetAddOnMetadata", - "GetCVar", - "GetLocale", - "InCombatLockdown", } diff --git a/.luacheckrc_build.ps1 b/.luacheckrc_build.ps1 new file mode 100644 index 0000000..e256aca --- /dev/null +++ b/.luacheckrc_build.ps1 @@ -0,0 +1,28 @@ +$luacheckrc = ".\.luacheckrc" + +$out = "" +foreach ($line in Get-Content $luacheckrc) { + if ($line -match "read_globals") { break } + + $out += $line + "`n" +} + +Set-Content $luacheckrc -Value $out.TrimEnd() + +$out = @() +luacheck . | ForEach-Object { + if ($_ -match "accessing undefined variable '(.+?)'") { + if ($out -notcontains $matches[1]) { + $out += $matches[1] + } + } +} + +Add-Content $luacheckrc "" +Add-Content $luacheckrc ("read_globals = {") + +foreach ($arg in $out | Sort-Object) { + Add-Content $luacheckrc ("`t`"" + $arg + "`",") +} + +Add-Content $luacheckrc ("}") diff --git a/CHANGELOG.md b/CHANGELOG.md index 99f46e9..daf2a4d 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # CHANGELOG +## Version 100002.01 + +- Added 10.0.2 support. +- Increased the max fade out delay to 120s. +- Changed the initial anchor of the edit box. It now can be positioned inside the chat frame. +- Fixed an issue where profession links would open a profession window on mouse over. Thanks + truckcarr11@GitHub. +- Updated French translation. Translated by Braincell1980@Curse. +- Updated German translation. Translated by OHerendirO@Curse. +- Updated Korean translation. Translated by netaras@Curse. +- Updated Traditional Chinese translation. Translated by RainbowUI@Curse. + ## Version 100000.05 - Added options to change the edit box's position and offset. diff --git a/ls_Glass/core/changelog.lua b/ls_Glass/core/changelog.lua index 0869363..287a263 100644 --- a/ls_Glass/core/changelog.lua +++ b/ls_Glass/core/changelog.lua @@ -6,14 +6,13 @@ local _G = getfenv(0) -- Mine E.CHANGELOG = [[ -- Added options to change the edit box's position and offset. -- Improved compatibility with other addons that re-format chat messages. IME, the most compatible - one is BasicChatMods by funkehdude, it has features my addon currently lacks, like button hiding. - That said, you definitely should disable overlapping features in other addons. -- Replaced "Jump to Present" and "Unread Messages" with icons because those text strings were - obnoxiously long in some locales. -- Fixed an issue where the chat frame would sometimes stop updating after scrolling down with the - mouse wheel. -- Added Spanish translation. Translated by cacahuete_uchi@Curse. -- Updated Korean translation. Translated by netaras@Curse and unrealcrom96@Curse. +- Added 10.0.2 support. +- Increased the max fade out delay to 120s. +- Changed the initial anchor of the edit box. It now can be positioned inside the chat frame. +- Fixed an issue where profession links would open a profession window on mouse over. Thanks + truckcarr11@GitHub. +- Updated French translation. Translated by Braincell1980@Curse. +- Updated German translation. Translated by OHerendirO@Curse. +- Updated Korean translation. Translated by netaras@Curse. +- Updated Traditional Chinese translation. Translated by RainbowUI@Curse. ]] diff --git a/ls_Glass/core/components/editbox.lua b/ls_Glass/core/components/editbox.lua index d1796de..96bb76f 100644 --- a/ls_Glass/core/components/editbox.lua +++ b/ls_Glass/core/components/editbox.lua @@ -32,11 +32,11 @@ function E:HandleEditBox(frame) frame:ClearAllPoints() if C.db.profile.dock.edit.position == "top" then - frame:SetPoint("BOTTOMLEFT", frame.chatFrame, "TOPLEFT", 0, C.db.profile.dock.edit.offset) - frame:SetPoint("BOTTOMRIGHT", frame.chatFrame, "TOPRIGHT", 0, C.db.profile.dock.edit.offset) + frame:SetPoint("TOPLEFT", frame.chatFrame, "TOPLEFT", 0, C.db.profile.dock.edit.offset) + frame:SetPoint("TOPRIGHT", frame.chatFrame, "TOPRIGHT", 0, C.db.profile.dock.edit.offset) else - frame:SetPoint("TOPLEFT", frame.chatFrame, "BOTTOMLEFT", 0, -C.db.profile.dock.edit.offset) - frame:SetPoint("TOPRIGHT", frame.chatFrame, "BOTTOMRIGHT", 0, -C.db.profile.dock.edit.offset) + frame:SetPoint("BOTTOMLEFT", frame.chatFrame, "BOTTOMLEFT", 0, -C.db.profile.dock.edit.offset) + frame:SetPoint("BOTTOMRIGHT", frame.chatFrame, "BOTTOMRIGHT", 0, -C.db.profile.dock.edit.offset) end frame:SetFontObject("LSGlassEditBoxFont") @@ -51,11 +51,11 @@ function E:UpdateEditBoxes() editBox:ClearAllPoints() if C.db.profile.dock.edit.position == "top" then - editBox:SetPoint("BOTTOMLEFT", editBox.chatFrame, "TOPLEFT", 0, C.db.profile.dock.edit.offset) - editBox:SetPoint("BOTTOMRIGHT", editBox.chatFrame, "TOPRIGHT", 0, C.db.profile.dock.edit.offset) + editBox:SetPoint("TOPLEFT", editBox.chatFrame, "TOPLEFT", 0, C.db.profile.dock.edit.offset) + editBox:SetPoint("TOPRIGHT", editBox.chatFrame, "TOPRIGHT", 0, C.db.profile.dock.edit.offset) else - editBox:SetPoint("TOPLEFT", editBox.chatFrame, "BOTTOMLEFT", 0, -C.db.profile.dock.edit.offset) - editBox:SetPoint("TOPRIGHT", editBox.chatFrame, "BOTTOMRIGHT", 0, -C.db.profile.dock.edit.offset) + editBox:SetPoint("BOTTOMLEFT", editBox.chatFrame, "BOTTOMLEFT", 0, -C.db.profile.dock.edit.offset) + editBox:SetPoint("BOTTOMRIGHT", editBox.chatFrame, "BOTTOMRIGHT", 0, -C.db.profile.dock.edit.offset) end end end diff --git a/ls_Glass/core/defaults.lua b/ls_Glass/core/defaults.lua index 1abe661..ad7cff8 100644 --- a/ls_Glass/core/defaults.lua +++ b/ls_Glass/core/defaults.lua @@ -40,7 +40,7 @@ D.profile = { alpha = 0.8, edit = { position = "bottom", -- "top" - offset = 2, + offset = 32, }, font = { size = 12, diff --git a/ls_Glass/core/modernize.lua b/ls_Glass/core/modernize.lua index 7585198..3d71b55 100644 --- a/ls_Glass/core/modernize.lua +++ b/ls_Glass/core/modernize.lua @@ -24,5 +24,15 @@ function E:Modernize(data, name, key) data.version = 10000003 end + + if data.version < 10000201 then + if data.dock then + if data.dock.edit then + data.dock.edit.offset = nil + end + end + + data.version = 10000201 + end end end diff --git a/ls_Glass/embeds/CallbackHandler-1.0/CallbackHandler-1.0.lua b/ls_Glass/embeds/CallbackHandler-1.0/CallbackHandler-1.0.lua index 39e265d..21569f4 100644 --- a/ls_Glass/embeds/CallbackHandler-1.0/CallbackHandler-1.0.lua +++ b/ls_Glass/embeds/CallbackHandler-1.0/CallbackHandler-1.0.lua @@ -1,5 +1,5 @@ ---[[ $Id: CallbackHandler-1.0.lua 22 2018-07-21 14:17:22Z nevcairiel $ ]] -local MAJOR, MINOR = "CallbackHandler-1.0", 7 +--[[ $Id: CallbackHandler-1.0.lua 26 2022-12-12 15:09:39Z nevcairiel $ ]] +local MAJOR, MINOR = "CallbackHandler-1.0", 8 local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) if not CallbackHandler then return end -- No upgrade needed @@ -7,26 +7,16 @@ if not CallbackHandler then return end -- No upgrade needed local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} -- Lua APIs -local tconcat = table.concat -local assert, error, loadstring = assert, error, loadstring -local setmetatable, rawset, rawget = setmetatable, rawset, rawget +local securecallfunction, error = securecallfunction, error +local setmetatable, rawget = setmetatable, rawget local next, select, pairs, type, tostring = next, select, pairs, type, tostring --- Global vars/functions that we don't upvalue since they might get hooked, or upgraded --- List them here for Mikk's FindGlobals script --- GLOBALS: geterrorhandler - -local xpcall = xpcall - -local function errorhandler(err) - return geterrorhandler()(err) -end local function Dispatch(handlers, ...) local index, method = next(handlers) if not method then return end repeat - xpcall(method, errorhandler, ...) + securecallfunction(method, ...) index, method = next(handlers, index) until not method end @@ -39,7 +29,7 @@ end -- UnregisterName - name of the callback unregistration API, default "UnregisterCallback" -- UnregisterAllName - name of the API to unregister all callbacks, default "UnregisterAllCallbacks". false == don't publish this API. -function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAllName) +function CallbackHandler.New(_self, target, RegisterName, UnregisterName, UnregisterAllName) RegisterName = RegisterName or "RegisterCallback" UnregisterName = UnregisterName or "UnregisterCallback" @@ -67,13 +57,13 @@ function CallbackHandler:New(target, RegisterName, UnregisterName, UnregisterAll if registry.insertQueue and oldrecurse==0 then -- Something in one of our callbacks wanted to register more callbacks; they got queued - for eventname,callbacks in pairs(registry.insertQueue) do - local first = not rawget(events, eventname) or not next(events[eventname]) -- test for empty before. not test for one member after. that one member may have been overwritten. - for self,func in pairs(callbacks) do - events[eventname][self] = func + for event,callbacks in pairs(registry.insertQueue) do + local first = not rawget(events, event) or not next(events[event]) -- test for empty before. not test for one member after. that one member may have been overwritten. + for object,func in pairs(callbacks) do + events[event][object] = func -- fire OnUsed callback? if first and registry.OnUsed then - registry.OnUsed(registry, target, eventname) + registry.OnUsed(registry, target, event) first = nil end end diff --git a/ls_Glass/init.lua b/ls_Glass/init.lua index 265f7ac..8d65be6 100644 --- a/ls_Glass/init.lua +++ b/ls_Glass/init.lua @@ -236,7 +236,7 @@ function E:OnInitialize() disabled = function() return C.db.profile.chat.fade.persistent end, - min = 0, max = 20, step = 1, + min = 0, max = 120, step = 1, }, out_duration = { order = 12, @@ -301,7 +301,7 @@ function E:OnInitialize() order = 3, type = "range", name = L["OFFSET"], - min = 2, max = 32, step = 1, + min = 0, max = 64, step = 1, get = function() return C.db.profile.dock.edit.offset end, @@ -560,7 +560,7 @@ function E:OnEnable() if linkType == "battlepet" then GameTooltip:SetOwner(chatFrame, "ANCHOR_CURSOR_RIGHT", 4, 2) BattlePetToolTip_ShowLink(text) - else + elseif linkType ~= "trade" then GameTooltip:SetOwner(chatFrame, "ANCHOR_CURSOR_RIGHT", 4, 2) local isOK = pcall(GameTooltip.SetHyperlink, GameTooltip, link) diff --git a/ls_Glass/locales/deDE.lua b/ls_Glass/locales/deDE.lua index c86e4f7..3be4f1f 100644 --- a/ls_Glass/locales/deDE.lua +++ b/ls_Glass/locales/deDE.lua @@ -1,4 +1,4 @@ --- Contributors: terijaki@GitHub, Solence1@Curse +-- Contributors: OHerendirO@Curse, terijaki@GitHub, Solence1@Cursem local _, ns = ... local L = ns.L @@ -9,11 +9,13 @@ local _G = getfenv(0) if GetLocale() ~= "deDE" then return end L["BACKGROUND_ALPHA"] = "Hintergrundtransparenz" +L["BOTTOM"] = "Unterseite" L["CHANGELOG"] = "Änderungsprotokoll" L["CHANGELOG_FULL"] = "vollständiges Änderungsprotokoll" L["CONFIG_WARNING"] = "Ich empfehle dringend, die Benutzeroberfläche nach dem Einrichten des Addons oder dem Öffnen dieses Fensters mithilfe von |cffffd200/reload|r neu zu laden, um Fehler die während des Kampfes auftreten können zu vermeiden." L["DOCK_AND_EDITBOX"] = "Registerkarten und Eingabefeld" L["DOWNLOADS"] = "Downloads" +L["EDITBOX_POSITION"] = "Position des Eingabefelds" L["FADE_IN_DURATION"] = "Einblendezeit" L["FADE_OUT_DELAY"] = "Ausblendeverzögerung" L["FADE_OUT_DURATION"] = "Ausblendezeit" @@ -22,6 +24,7 @@ L["FONT"] = "Schriftart" L["FONT_EDITBOX"] = "Schriftart des Eingabefeld" L["MESSAGES"] = "Nachrichten" L["MOUSEOVER_TOOLTIPS"] = "Mauszeiger-Tooltip" +L["OFFSET"] = "Versatz" L["OPEN_CONFIG"] = "Konfigurationen öffnen" L["OUTLINE"] = "Umriss" L["PERSISTENT"] = "Dauerhaft anzeigen" @@ -29,5 +32,6 @@ L["SHADOW"] = "Schatten" L["SIZE"] = "Größe" L["SLIDE_IN_DURATION"] = "Einschubzeit" L["SUPPORT"] = "Support" +L["TOP"] = "Oberseite" L["X_PADDING"] = "Horizontaler Abstand" L["Y_PADDING"] = "Vertikaler Abstand" diff --git a/ls_Glass/locales/frFR.lua b/ls_Glass/locales/frFR.lua index ecfa484..a800f95 100644 --- a/ls_Glass/locales/frFR.lua +++ b/ls_Glass/locales/frFR.lua @@ -9,19 +9,22 @@ local _G = getfenv(0) if GetLocale() ~= "frFR" then return end L["BACKGROUND_ALPHA"] = "Opacité du fond" +L["BOTTOM"] = "Bas" L["CHANGELOG"] = "Liste des changements " L["CHANGELOG_FULL"] = "Tout" L["CONFIG_WARNING"] = "Je recommande fortement de |cffffd200/reload|r l'interface utilisateur une fois que vous avez terminé de configurer l'addon ou même d'ouvrir ce panneau pour éviter toute erreur pendant un combat." -L["DOCK_AND_EDITBOX"] = "Onglets et Zone d'édition" +L["DOCK_AND_EDITBOX"] = "Onglets et boîte de saisie" L["DOWNLOADS"] = "Téléchargements" -L["FADE_IN_DURATION"] = "Durée du Fondu entrant" -L["FADE_OUT_DELAY"] = "Délais du Fondu sortant" -L["FADE_OUT_DURATION"] = "Durée du Fondu sortant" +L["EDITBOX_POSITION"] = "Position de la boîte de saisie" +L["FADE_IN_DURATION"] = "Durée du fondu entrant" +L["FADE_OUT_DELAY"] = "Délais du fondu sortant" +L["FADE_OUT_DURATION"] = "Durée du fondu sortant" L["FADING"] = "Fondu" L["FONT"] = "Police" -L["FONT_EDITBOX"] = "Police de la Zone d'édition" +L["FONT_EDITBOX"] = "Police de la boîte de saisie" L["MESSAGES"] = "Messages" L["MOUSEOVER_TOOLTIPS"] = "Infobulle au survol de la souris" +L["OFFSET"] = "Décalage" L["OPEN_CONFIG"] = "Ouvrir la configuration" L["OUTLINE"] = "Contour" L["PERSISTENT"] = "Persistant" @@ -29,5 +32,6 @@ L["SHADOW"] = "Ombre" L["SIZE"] = "Taille" L["SLIDE_IN_DURATION"] = "Durée d'apparition" L["SUPPORT"] = "Assistance" -L["X_PADDING"] = "Marge Horizontale" -L["Y_PADDING"] = "Marge Verticale" +L["TOP"] = "Haut" +L["X_PADDING"] = "Marge horizontale" +L["Y_PADDING"] = "Marge verticale" diff --git a/ls_Glass/locales/koKR.lua b/ls_Glass/locales/koKR.lua index c978b57..736042d 100644 --- a/ls_Glass/locales/koKR.lua +++ b/ls_Glass/locales/koKR.lua @@ -9,11 +9,13 @@ local _G = getfenv(0) if GetLocale() ~= "koKR" then return end L["BACKGROUND_ALPHA"] = "배경 불투명도" +L["BOTTOM"] = "아래" L["CHANGELOG"] = "변경사항" L["CHANGELOG_FULL"] = "전체" L["CONFIG_WARNING"] = "전투 중 오류를 피하기 위해 애드온 설정을 완료하거나 이 패널을 연 후 UI를 |cffffd200/reload|r하는 것이 좋습니다." L["DOCK_AND_EDITBOX"] = "탭 및 입력줄" L["DOWNLOADS"] = "내려받기" +L["EDITBOX_POSITION"] = "입력줄 위치" L["FADE_IN_DURATION"] = "서서히 나타남 지속 시간" L["FADE_OUT_DELAY"] = "서서히 사라짐 지연" L["FADE_OUT_DURATION"] = "서서히 사라짐 지속 시간" @@ -22,6 +24,7 @@ L["FONT"] = "글꼴" L["FONT_EDITBOX"] = "입력줄 글꼴" L["MESSAGES"] = "메시지" L["MOUSEOVER_TOOLTIPS"] = "마우스오버 툴팁" +L["OFFSET"] = "위치" L["OPEN_CONFIG"] = "구성 열기" L["OUTLINE"] = "외곽선" L["PERSISTENT"] = "나타남 지속" @@ -29,5 +32,6 @@ L["SHADOW"] = "그림자" L["SIZE"] = "크기" L["SLIDE_IN_DURATION"] = "안으로 슬라이드 지속 시간" L["SUPPORT"] = "지원" +L["TOP"] = "위" L["X_PADDING"] = "들여쓰기" L["Y_PADDING"] = "줄간격" diff --git a/ls_Glass/locales/zhTW.lua b/ls_Glass/locales/zhTW.lua index 87f9527..9b78a69 100644 --- a/ls_Glass/locales/zhTW.lua +++ b/ls_Glass/locales/zhTW.lua @@ -9,11 +9,13 @@ local _G = getfenv(0) if GetLocale() ~= "zhTW" then return end L["BACKGROUND_ALPHA"] = "背景透明度" +L["BOTTOM"] = "下方" L["CHANGELOG"] = "更新資訊" L["CHANGELOG_FULL"] = "完整內容" L["CONFIG_WARNING"] = "強烈建議在設定完成後,甚至只是打開這個設定視窗都要 |cffffd200重新載入介面 /reload|r,以避免在戰鬥中發生任何錯誤。" L["DOCK_AND_EDITBOX"] = "標籤頁和文字輸入框" L["DOWNLOADS"] = "下載" +L["EDITBOX_POSITION"] = "文字輸入框位置" L["FADE_IN_DURATION"] = "淡入持續時間" L["FADE_OUT_DELAY"] = "淡出延遲時間" L["FADE_OUT_DURATION"] = "淡出持續時間" @@ -22,6 +24,7 @@ L["FONT"] = "字體" L["FONT_EDITBOX"] = "文字輸入框字體" L["MESSAGES"] = "訊息" L["MOUSEOVER_TOOLTIPS"] = "滑鼠指向顯示資訊" +L["OFFSET"] = "位置偏移" L["OPEN_CONFIG"] = "開啟設定" L["OUTLINE"] = "外框" L["PERSISTENT"] = "不要淡出" @@ -29,5 +32,6 @@ L["SHADOW"] = "陰影" L["SIZE"] = "大小" L["SLIDE_IN_DURATION"] = "滑入持續時間" L["SUPPORT"] = "支援" +L["TOP"] = "上方" L["X_PADDING"] = "水平內邊界" L["Y_PADDING"] = "垂直內邊界" diff --git a/ls_Glass/ls_Glass.toc b/ls_Glass/ls_Glass.toc index ed5efe7..d80183f 100644 --- a/ls_Glass/ls_Glass.toc +++ b/ls_Glass/ls_Glass.toc @@ -1,6 +1,6 @@ -## Interface: 100000 +## Interface: 100002 ## Author: lightspark -## Version: 100000.05 +## Version: 100002.01 ## Title: LS: |cffe0bc5bGlass|r ## Notes: Smooth as glass.