Skip to content

Commit

Permalink
Add tooltip width selector
Browse files Browse the repository at this point in the history
  • Loading branch information
solocommand committed Jul 27, 2024
1 parent 6af21eb commit 60c77ab
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 16 deletions.
46 changes: 46 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"Lua.diagnostics.globals": [
"TooltipBackdropTemplateMixin",
"Settings",
"NORMAL_FONT_COLOR_CODE",
"HIGHLIGHT_FONT_COLOR_CODE",
"DISABLED_FONT_COLOR_CODE",
"FONT_COLOR_CODE_CLOSE",
"ToggleFriendsFrame",
"ToggleGuildFrame",
"ToggleDropDownMenu",
"UnitPopup_ShowMenu",
"CHAT_FLAG_AFK",
"CHAT_FLAG_DND",
"TravelPassDropDown",
"ChatFrame_SendBNetTell",
"BNET_CLIENT_APP",
"BNET_CLIENT_WOW",
"FRIENDS_TEXTURE_AFK",
"FRIENDS_TEXTURE_DND",
"ChatFrame_SendTell",
"CanGroupWithAccount",
"REMOTE_CHAT",
"BNet_GetClientEmbeddedAtlas",
"FRIENDS_LIST_PLAYING",
"SELECTED_CHAT_FRAME",
"DEFAULT_CHAT_FRAME",
"NORMAL_FONT_COLOR",
"ACCEPT",
"CANCEL",
"InterfaceOptions_AddCategory",
"SlashCmdList",
"hash_SlashCmdList",
"CLOSE",
"SetDesaturation",
"ColorPickerFrame",
"OpacitySliderFrame",
"OKAY",
"NOT_BOUND",
"AddonCompartmentFrame",
"InterfaceOptionsFramePanelContainer"
],
"Lua.diagnostics.disable": [
"deprecated"
]
}
8 changes: 7 additions & 1 deletion Socialite.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
local addonName, addon = ...
local
---@class string
addonName,
---@class ns
addon = ...
local L = addon.L
local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local ldbi = LibStub:GetLibrary('LibDBIcon-1.0')
Expand Down Expand Up @@ -34,6 +38,7 @@ do
minimap={hide=true},
showInAddonCompartment=true,
DisableUsageText=false,
TooltipWidth=0,
} end
local sv = SocialiteSettings
if type(sv.minimap) ~= "table" then sv.minimap = {hide=true} end
Expand Down Expand Up @@ -62,6 +67,7 @@ do
if type(sv.ShowGroupMembers) ~= "boolean" then sv.ShowGroupMembers = true end
if type(sv.ShowStatus) ~= "string" then sv.ShowStatus = "icon" end
if type(sv.TooltipInteraction) ~= "string" then sv.TooltipInteraction = "always" end
if type(sv.TooltipWidth) ~= "number" then sv.TooltipWidth = 0 end

addon.db = sv

Expand Down
26 changes: 20 additions & 6 deletions config.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
local addonName, addon = ...
local
---@class string
addonName,
---@class ns
addon = ...
local L = addon.L
local ldbi = LibStub('LibDBIcon-1.0', true)

Expand All @@ -7,7 +11,7 @@ local function buildCheckbox(key, order)
type = 'toggle',
name = L[key],
order = order or 0,
desc = L[key.."Description"],
desc = L[key .. "Description"],
}
end

Expand All @@ -22,12 +26,14 @@ local function buildDropdown(label, opts, order)
end

local function build()
---@type AceConfig.OptionsTable
local t = {
name = "Socialite",
type = 'group',
get = function(info) return addon.db[info[#info]] end,
set = function(info, value) return addon:setDB(info[#info], value) end,
args = {
---@diagnostic disable-next-line: missing-fields
showMinimapIcon = {
type = 'toggle',
name = L['Show minimap button'],
Expand All @@ -38,9 +44,10 @@ local function build()
local config = addon.db.minimap
config.hide = not value
addon:setDB("minimap", config)
ldbi:Refresh(addonName)
ldbi:Refresh(addonName, config)
end,
},
---@diagnostic disable-next-line: missing-fields
showInAddonCompartment = {
type = 'toggle',
name = L.showInAddonCompartment,
Expand All @@ -53,7 +60,7 @@ local function build()
else
ldbi:RemoveButtonFromCompartment(addonName)
end
end
end,
},
DisableUsageText = buildCheckbox("DisableUsageText", 2),
battleNetFriends = {
Expand Down Expand Up @@ -90,7 +97,6 @@ local function build()
name = L["Tooltip Settings"],
order = 30,
args = {
-- @todo review these, they don't seem to work!
ShowStatus = buildDropdown(L.MENU_STATUS, {
icon = L.MENU_STATUS_ICON,
text = L.MENU_STATUS_TEXT,
Expand All @@ -102,6 +108,14 @@ local function build()
never = L.MENU_INTERACTION_NEVER,
}, 32),
ShowGroupMembers = buildCheckbox("ShowGroupMembers", 33),
---@diagnostic disable-next-line: missing-fields
TooltipWidth = {
name = L["Tooltip Width"],
type = "range",
min = 0,
max = 1,
step = 0.1,
},
},
},
guild = {
Expand All @@ -114,13 +128,13 @@ local function build()
ShowGuildNote = buildCheckbox("ShowGuildNote", 43),
ShowGuildONote = buildCheckbox("ShowGuildONote", 44),
ShowSplitRemoteChat = buildCheckbox("ShowSplitRemoteChat", 45),
---@diagnostic disable-next-line: missing-fields
GuildSorting = {
type = 'header',
name = L["Guild Sorting"],
order = 46,
},
GuildSort = buildCheckbox("GuildSort", 47),
-- @todo
GuildSortKey = buildDropdown(L.MENU_GUILD_SORT, {
name = L.MENU_GUILD_SORT_NAME,
rank = L.MENU_GUILD_SORT_RANK,
Expand Down
6 changes: 5 additions & 1 deletion functions.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
local addonName, addon = ...
local
---@class string
addonName,
---@class ns
addon = ...
local L = addon.L
local tooltip = addon.tooltip

Expand Down
7 changes: 6 additions & 1 deletion i18n/enUS.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
-- @todo pull from localization
local addonName, addon = ...
local
---@class string
addonName,
---@class ns
addon = ...

local L = {}

Expand All @@ -19,6 +23,7 @@ L["ShowRealIDNotesDescription"] = "Show your friends' note"
L["showInAddonCompartment"] = "Show in compartment"
L["showInAddonCompartmentDescription"] = "Toggles the display of Socialite within the addon compartment."
L["Data text"] = "Data text"
L["Tooltip Width"] = "Extra Tooltip Width"

L["Character Friends"] = "Character Friends"
L["ShowFriends"] = "Show friends"
Expand Down
6 changes: 5 additions & 1 deletion i18n/esES.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
local
---@class string
addonName,
---@class ns
addon = ...

local addonName, addon = ...
local locale = GetLocale()

if locale == "esES" then
Expand Down
20 changes: 14 additions & 6 deletions tooltip.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
local addonName, addonTable = ...
local
---@class string
addonName,
---@class ns
addon = ...

local tooltip = {}
addonTable.tooltip = tooltip
addon.tooltip = tooltip

local CreateFrame = _G.CreateFrame
local UIParent = _G.UIParent
local GameTooltip = _G.GameTooltip
local NORMAL_FONT_COLOR, HIGHLIGHT_FONT_COLOR = _G.NORMAL_FONT_COLOR, _G.HIGHLIGHT_FONT_COLOR

local NORMAL_FONT_COLOR, HIGHLIGHT_FONT_COLOR
for i, item in ipairs(C_UIColor.GetColors()) do
if (item.baseTag == "NORMAL_FONT_COLOR") then NORMAL_FONT_COLOR = item.color end
if (item.baseTag == "HIGHLIGHT_FONT_COLOR") then HIGHLIGHT_FONT_COLOR = item.color end
end
local H_PADDING = 6
local V_PADDING = 3
local H_MARGIN = 10
Expand Down Expand Up @@ -79,13 +86,13 @@ do
tframe.scroller = slider
end

if IsAddOnLoaded("ElvUI") or IsAddOnLoaded("Tukui") then
if tframe.StripTextures then
tframe:StripTextures()
end
if tframe.CreateBackdrop then
tframe:CreateBackdrop("Transparent")
end
if C_AddOns.IsAddOnLoaded("ElvUI") or C_AddOns.IsAddOnLoaded("Tukui") then
end

local acquireCell, releaseCell, acquireColumn, releaseColumn, acquireLine, releaseLine
Expand Down Expand Up @@ -311,12 +318,13 @@ end

-- local
function SetTooltipSize(width, height)
tframe.width = width
tframe.width = width + (addon.db.TooltipWidth or 0)
tframe.scrollchild:SetWidth(width)
tframe.height = height
tframe.scrollchild:SetHeight(height)

tframe:SetScript("OnUpdate", tooltip_OnUpdate)
-- DevTools_Dump(tframe)
end

local _AddLine
Expand Down

0 comments on commit 60c77ab

Please sign in to comment.