Skip to content

Commit

Permalink
v0.5.55
Browse files Browse the repository at this point in the history
  • Loading branch information
d4kir92 committed Jun 21, 2024
1 parent 83bbba9 commit 38121e6
Show file tree
Hide file tree
Showing 20 changed files with 84 additions and 138 deletions.
2 changes: 1 addition & 1 deletion DarkMode.toc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
## Interface-Cata: 40400
## Interface: 100207, 110000

## Version: 0.5.54
## Version: 0.5.55
## Title: DarkMode by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_Cata.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 40400
## Version: 0.5.54
## Version: 0.5.55
## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_TBC.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 20504
## Version: 0.5.54
## Version: 0.5.55
## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_Vanilla.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 11502
## Version: 0.5.54
## Version: 0.5.55
## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_Wrath.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 30403
## Version: 0.5.54
## Version: 0.5.55
## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t
## Notes: Improve Any Ui or Frame
## Author: D4KiR
Expand Down
50 changes: 21 additions & 29 deletions core.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local _, DarkMode = ...
DMHIDDEN = CreateFrame("FRAME", "DMHIDDEN")
DMHIDDEN:Hide()
local DMMMBTN = nil
local debug = 0
function DarkMode:Debug(num, msg, ...)
if debug > 0 and debug == num then
Expand All @@ -13,14 +14,9 @@ local DMTexturesUF = {}
local DMTexturesNP = {}
local DMTexturesTT = {}
local DMTexturesFrames = {}
local DMTexturesFrame = {}
local DMTexturesActionButtons = {}
local DMTexturesBuffsAndDebuffs = {}
local DMTexturesChat = {}
local DMTexturesAddons = {}
local DMTexturesSpecial = {}
local DMTexturesGreeting = {}
function DarkMode:UpdateColor(texture, typ, show)
function DarkMode:UpdateColor(texture, typ, bShow)
if not DarkMode:IsValidTexture(texture) then return false end
if texture == nil then
print("[DarkMode] INVALID TEXTURE OBJECT")
Expand Down Expand Up @@ -412,7 +408,7 @@ end

function DarkMode:FindTextures(frame, typ)
if frame ~= nil then
local show = false
local bShow = false
local ignoreId1 = nil
local ignoreId2 = nil
local ignoreId3 = nil
Expand All @@ -431,12 +427,12 @@ function DarkMode:FindTextures(frame, typ)
if DarkMode:GetIgnoreFrames(frame:GetName()) then
return
elseif strfind(frame:GetName(), findName) then
show = true
bShow = true
end
end

if frame.SetVertexColor then
if show and frame.GetTexture then
if bShow and frame.GetTexture then
print(">", frame:GetName(), frame:GetTextureFilePath(), frame:GetTexture(), "Size:", frame:GetSize())
end

Expand All @@ -447,7 +443,7 @@ function DarkMode:FindTextures(frame, typ)
for i, v in pairs({frame:GetRegions()}) do
local hasName = v.GetName ~= nil
if (ignoreId1 == nil or ignoreId1 ~= i) and (ignoreId2 == nil or ignoreId2 ~= i) and (ignoreId3 == nil or ignoreId3 ~= i) and ((hasName and not DarkMode:GetIgnoreFrames(v:GetName())) or (not hasName and v.SetVertexColor)) then
if show and v.GetTexture then
if bShow and v.GetTexture then
print(">>", frame:GetName(), v:GetName(), v:GetTextureFilePath(), v:GetTexture(), "Size:", v:GetSize())
end

Expand All @@ -462,7 +458,7 @@ function DarkMode:FindTextures(frame, typ)
for i, v in pairs({frame:GetChildren()}) do
local hasName = v.GetName ~= nil
if (ignoreId1 == nil or ignoreId1 ~= i) and (ignoreId2 == nil or ignoreId2 ~= i) and (ignoreId3 == nil or ignoreId3 ~= i) and ((hasName and not DarkMode:GetIgnoreFrames(v:GetName())) or (not hasName and v.SetVertexColor)) then
if show and v.GetTexture then
if bShow and v.GetTexture then
print(">>>", frame:GetName(), v:GetName(), v:GetTextureFilePath(), v:GetTexture(), "Size:", v:GetSize())
end

Expand All @@ -478,10 +474,6 @@ end
function DarkMode:FindTexturesByName(name, typ)
DarkMode:Debug(10, "FindTexturesByName", name)
local frame = DarkMode:GetFrame(name)
if name and strfind(name, "Container", 1, true) and strfind(name, "TopSection", 1, true) then
show = true
end

if frame then
DarkMode:FindTextures(frame, typ)
end
Expand Down Expand Up @@ -801,7 +793,7 @@ function DarkMode:SearchUi(from)
border:SetPoint("CENTER", btn, "CENTER", 0, 0)
DarkMode:UpdateColor(border, "actionbuttons")
end
elseif D4:GetWoWBuild() ~= "RETAIL" and DarkMode:IsEnabled("MASKACTIONBUTTONS", true) and DarkMode:GV("COLORMODEAB", 1) ~= "Off" and DarkMode:GV("COLORMODEAB", 1) ~= "Default" then
elseif DarkMode:GetWoWBuild() ~= "RETAIL" and DarkMode:IsEnabled("MASKACTIONBUTTONS", true) and DarkMode:GV("COLORMODEAB", 1) ~= "Off" and DarkMode:GV("COLORMODEAB", 1) ~= "Default" then
local icon = _G[name .. x .. "Icon"]
if icon then
local br = 0.012
Expand Down Expand Up @@ -838,7 +830,7 @@ function DarkMode:SearchUi(from)
end
end

if name ~= "MainMenuBarBackpackButtonNormalTexture" or D4:GetWoWBuild() ~= "RETAIL" then
if name ~= "MainMenuBarBackpackButtonNormalTexture" or DarkMode:GetWoWBuild() ~= "RETAIL" then
DarkMode:FindTexturesByName(name, "ui")
end
end
Expand All @@ -864,7 +856,7 @@ function DarkMode:SearchUi(from)
end
end

if MICRO_BUTTONS and D4:GetWoWBuild() ~= "RETAIL" then
if MICRO_BUTTONS and DarkMode:GetWoWBuild() ~= "RETAIL" then
for i, name in pairs(MICRO_BUTTONS) do
if name then
local mbtn = _G[name]
Expand Down Expand Up @@ -947,10 +939,10 @@ function DarkMode:SearchUi(from)
DarkMode:UpdateColor(border, "ui")
end

if GameTimeFrame and D4:GetWoWBuild() ~= "RETAIL" and _G["GameTimeFrame" .. "DMBorder"] == nil then
if GameTimeFrame and DarkMode:GetWoWBuild() ~= "RETAIL" and _G["GameTimeFrame" .. "DMBorder"] == nil then
local border = GameTimeFrame:CreateTexture("GameTimeFrame" .. "DMBorder", "OVERLAY")
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\gt_border")
if D4:GetWoWBuild() == "WRATH" or D4:GetWoWBuild() == "CATA" then
if DarkMode:GetWoWBuild() == "WRATH" or DarkMode:GetWoWBuild() == "CATA" then
border:SetPoint("TOPLEFT", -1, 1)
if border.SetScale then
border:SetScale(0.82)
Expand Down Expand Up @@ -1186,15 +1178,15 @@ function DarkMode:InitQuestFrame()
end

function DarkMode:InitSlash()
D4:AddSlash("dm", DarkMode.ToggleSettings)
D4:AddSlash("dark", DarkMode.ToggleSettings)
D4:AddSlash("darkmode", DarkMode.ToggleSettings)
DarkMode:AddSlash("dm", DarkMode.ToggleSettings)
DarkMode:AddSlash("dark", DarkMode.ToggleSettings)
DarkMode:AddSlash("darkmode", DarkMode.ToggleSettings)
if C_UI then
D4:AddSlash("rl", C_UI.Reload)
D4:AddSlash("rel", C_UI.Reload)
DarkMode:AddSlash("rl", C_UI.Reload)
DarkMode:AddSlash("rel", C_UI.Reload)
else
D4:AddSlash("rl", ReloadUI)
D4:AddSlash("rel", ReloadUI)
DarkMode:AddSlash("rl", ReloadUI)
DarkMode:AddSlash("rel", ReloadUI)
end
end

Expand Down Expand Up @@ -1282,7 +1274,7 @@ function DarkMode:Event(event, ...)
end
end

if D4:GetWoWBuild() ~= "RETAIL" then
if DarkMode:GetWoWBuild() ~= "RETAIL" then
-- delay for other addons changing
C_Timer.After(
2,
Expand Down Expand Up @@ -1570,7 +1562,7 @@ function DarkMode:Event(event, ...)
)

--[[ SPECIALS ]]
if D4:GetWoWBuild() ~= "RETAIL" and FriendsFramePortrait then
if DarkMode:GetWoWBuild() ~= "RETAIL" and FriendsFramePortrait then
hooksecurefunc(
FriendsFramePortrait,
"Show",
Expand Down
10 changes: 5 additions & 5 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ function DarkMode:SetCustomColor(name, r, g, b, a)
end

function DarkMode:GetBrighterColor(r, g, b, a, texture)
local name = D4:GetName(texture)
if name and DarkMode:IsBrighterFrame(name) then return D4:MClamp(r + 0.4, 0, 1), D4:MClamp(g + 0.4, 0, 1), D4:MClamp(b + 0.4, 0, 1), a end
local name = DarkMode:GetName(texture)
if name and DarkMode:IsBrighterFrame(name) then return DarkMode:MClamp(r + 0.4, 0, 1), DarkMode:MClamp(g + 0.4, 0, 1), DarkMode:MClamp(b + 0.4, 0, 1), a end

return r, g, b, a
end
Expand Down Expand Up @@ -134,7 +134,7 @@ local DMUi = {
["Castbar"] = {"CastingBarFrame.Border", "PlayerCastingBarFrame.Background", "PlayerCastingBarFrame.Border", "PlayerCastingBarFrame.TextBorder"}
}

if D4:GetWoWBuild() == "RETAIL" then
if DarkMode:GetWoWBuild() == "RETAIL" then
local retail = {"TargetFrameSpellBar.Background", "TargetFrameSpellBar.Border", "TargetFrameSpellBar.TextBorder", "FocusFrameSpellBar.Background", "FocusFrameSpellBar.Border", "FocusFrameSpellBar.TextBorder"}
for i, v in pairs(retail) do
table.insert(DMUi["Castbar"], v)
Expand Down Expand Up @@ -226,7 +226,7 @@ DMTextureBlock["Interface\\TargetingFrame\\UI-StatusBar"] = true
DMTextureBlock["Interface\\MailFrame\\Mail-Icon"] = true
DMTextureBlock["Interface\\ContainerFrame\\UI-Bag-1Slot"] = true
DMTextureBlock["Interface\\SpellBook\\SpellBook-SkillLineTab-Glow"] = true
if D4:GetWoWBuild() == "RETAIL" then
if DarkMode:GetWoWBuild() == "RETAIL" then
DMTextureBlock[130724] = true -- Spellbook Tab Highlight Icon
DMTextureBlock[136377] = true -- MacroFrame Portrai
end
Expand Down Expand Up @@ -262,7 +262,7 @@ function DarkMode:GetTextureBlockTable()
end

local DMIgnoreFrames = {}
if D4:GetWoWBuild() ~= "RETAIL" then
if DarkMode:GetWoWBuild() ~= "RETAIL" then
DMIgnoreFrames["FriendsFrameIcon"] = true
DMIgnoreFrames["FriendsFramePortrait"] = true
DMIgnoreFrames["FriendsFramePortraitFrame"] = true
Expand Down
14 changes: 5 additions & 9 deletions libs/D4Lib/D4DB.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
local _, _ = ...
D4 = D4 or {}
D4.LibVersion = D4.LibVersion or 0
local D4LibVersion = 1.0
if D4.LibVersion >= D4LibVersion then return end
local _, D4 = ...
function D4:GV(db, key, value)
if db == nil then
D4:msg("[D4:GV] db is nil", "db", tostring(db), "key", tostring(key), "value", tostring(value))
D4:MSG("[D4:GV] db is nil", "db", tostring(db), "key", tostring(key), "value", tostring(value))

return value
end

if type(db) ~= "table" then
D4:msg("[D4:GV] db is not table", "db", tostring(db), "key", tostring(key), "value", tostring(value))
D4:MSG("[D4:GV] db is not table", "db", tostring(db), "key", tostring(key), "value", tostring(value))

return value
end
Expand All @@ -23,13 +19,13 @@ end

function D4:SV(db, key, value)
if db == nil then
D4:msg("[D4:SV] db is nil", "db", tostring(db), "key", tostring(key), "value", tostring(value))
D4:MSG("[D4:SV] db is nil", "db", tostring(db), "key", tostring(key), "value", tostring(value))

return false
end

if key == nil then
D4:msg("[D4:SV] key is nil", "db", tostring(db), "key", tostring(key), "value", tostring(value))
D4:MSG("[D4:SV] key is nil", "db", tostring(db), "key", tostring(key), "value", tostring(value))

return false
end
Expand Down
10 changes: 3 additions & 7 deletions libs/D4Lib/D4Frames.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
local _, _ = ...
D4 = D4 or {}
D4.LibVersion = D4.LibVersion or 0
local D4LibVersion = 1.0
if D4.LibVersion >= D4LibVersion then return end
local _, D4 = ...
--[[ INPUTS ]]
function D4:AddCategory(tab)
tab.sw = tab.sw or 25
Expand Down Expand Up @@ -106,7 +102,7 @@ function D4:CreateSlider(tab)
if struct then
slider.Text:SetText(string.format(struct, tab.value))
else
print("[D4] missing format string:", tab.key)
D4:MSG("[D4] missing format string:", tab.key)
end

slider:SetMinMaxValues(tab.vmin, tab.vmax)
Expand All @@ -129,7 +125,7 @@ function D4:CreateSlider(tab)
if struct2 then
slider.Text:SetText(string.format(struct2, val))
else
print("[D4] Missing format string:", tab.key)
D4:MSG("[D4] Missing format string:", tab.key)
end
end
)
Expand Down
6 changes: 1 addition & 5 deletions libs/D4Lib/D4Grid.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
local _, _ = ...
D4 = D4 or {}
D4.LibVersion = D4.LibVersion or 0
local D4LibVersion = 1.0
if D4.LibVersion >= D4LibVersion then return end
local _, D4 = ...
function D4:Grid(n, snap)
n = n or 0
snap = snap or 10
Expand Down
22 changes: 9 additions & 13 deletions libs/D4Lib/D4Lib.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
local _, _ = ...
D4 = D4 or {}
D4.LibVersion = D4.LibVersion or 0
local D4LibVersion = 1.0
if D4.LibVersion >= D4LibVersion then return end
local _, D4 = ...
--[[ Basics ]]
local buildNr = select(4, GetBuildInfo())
local buildName = "CLASSIC"
Expand All @@ -26,7 +22,7 @@ end

D4.oldWow = D4.oldWow or false
if C_Timer == nil then
print("[D4] ADD C_Timer")
D4:MSG("[D4] ADD C_Timer")
C_Timer = {}
local f = CreateFrame("Frame")
f.tab = {}
Expand All @@ -51,7 +47,7 @@ if C_Timer == nil then
end

if GetClassColor == nil then
print("[D4] ADD GetClassColor")
D4:MSG("[D4] ADD GetClassColor")
GetClassColor = function(classFilename)
local color = RAID_CLASS_COLORS[classFilename]
if color then return color.r, color.g, color.b, color.colorStr end
Expand Down Expand Up @@ -85,7 +81,7 @@ local ICON_TAG_LIST_EN = {
function D4:GetCVar(name)
if C_CVar and C_CVar.GetCVar then return C_CVar.GetCVar(name) end
if GetCVar then return GetCVar(name) end
print("[D4][GetCVar] FAILED")
D4:MSG("[D4][GetCVar] FAILED")

return nil
end
Expand All @@ -94,7 +90,7 @@ function D4:GetItemInfo(itemID)
if itemID == nil then return nil end
if C_Item and C_Item.GetItemInfo then return C_Item.GetItemInfo(itemID) end
if GetItemInfo then return GetItemInfo(itemID) end
print("[D4][GetItemInfo] FAILED")
D4:MSG("[D4][GetItemInfo] FAILED")

return nil
end
Expand All @@ -103,31 +99,31 @@ function D4:GetSpellInfo(spellID)
if spellID == nil then return nil end
if C_Spell and C_Spell.GetSpellInfo then return C_Spell.GetSpellInfo(spellID) end
if GetSpellInfo then return GetSpellInfo(spellID) end
print("[D4][GetSpellInfo] FAILED")
D4:MSG("[D4][GetSpellInfo] FAILED")

return nil
end

function D4:GetMouseFocus()
if GetMouseFoci then return GetMouseFoci() end
if GetMouseFocus then return GetMouseFocus() end
print("[D4][GetMouseFocus] FAILED")
D4:MSG("[D4][GetMouseFocus] FAILED")

return nil
end

function D4:LoadAddOn(name)
if C_AddOns and C_AddOns.LoadAddOn then return C_AddOns.LoadAddOn(name) end
if LoadAddOn then return LoadAddOn(name) end
print("[D4][LoadAddOn] FAILED")
D4:MSG("[D4][LoadAddOn] FAILED")

return nil
end

function D4:IsAddOnLoaded(name)
if C_AddOns and C_AddOns.IsAddOnLoaded then return C_AddOns.IsAddOnLoaded(name) end
if IsAddOnLoaded then return IsAddOnLoaded(name) end
print("[D4][IsAddOnLoaded] FAILED")
D4:MSG("[D4][IsAddOnLoaded] FAILED")

return nil
end
Expand Down
6 changes: 1 addition & 5 deletions libs/D4Lib/D4Math.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
local _, _ = ...
D4 = D4 or {}
D4.LibVersion = D4.LibVersion or 0
local D4LibVersion = 1.0
if D4.LibVersion >= D4LibVersion then return end
local _, D4 = ...
function D4:MClamp(val, vmin, vmax)
if val < vmin then
return vmin
Expand Down
Loading

0 comments on commit 38121e6

Please sign in to comment.