Skip to content

Commit

Permalink
2.0.9
Browse files Browse the repository at this point in the history
Add the toption to have the display use multiple columns
  • Loading branch information
Noshei committed Aug 28, 2024
1 parent a800df9 commit da11f54
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 16 deletions.
Binary file added .previews/GT_Multi_Column.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"utf8": "disable"
},
"Lua.workspace.library": [
"~\\.vscode\\extensions\\ketho.wow-api-0.17.4\\Annotations"
"~\\.vscode\\extensions\\ketho.wow-api-0.17.5\\Annotations"
]
}
67 changes: 55 additions & 12 deletions Config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ GT.defaults = {
hideOthers = false,
displayAlias = false,
rarityBorder = true,
multiColumn = false,
numRows = 1,
},
Notifications = {
Count = {
Expand Down Expand Up @@ -326,6 +328,7 @@ local generalOptions = {
for iterator = 1, cellsToRemove, 1 do
table.remove(GT.Display.ColumnSize, #GT.Display.ColumnSize)
end
GT:SetDisplayFrameWidth()
else
GT:PrepareDataForDisplay("TSM Price Source Option Changed")
end
Expand Down Expand Up @@ -361,6 +364,7 @@ local generalOptions = {
end
end
table.remove(GT.Display.ColumnSize, columnToRemove)
GT:SetDisplayFrameWidth()
else
GT:PrepareDataForDisplay("Display Per Item Price Enabled")
end
Expand Down Expand Up @@ -403,9 +407,47 @@ local generalOptions = {
},
header3 = {
type = "header",
name = "Icon",
name = "Columns",
order = 300
},
multiColumn = {
type = "toggle",
name = "Multiple Columns",
desc = "Enables the display to use multiple columns.",
width = 1.70,
get = function() return GT.db.profile.General.multiColumn end,
set = function(_, key)
GT.db.profile.General.multiColumn = key
end,
order = 301
},
numRows = {
type = "range",
name = "Max Rows Per Column",
desc = "Set the maximum number of rows to be displayed per column.",
min = 1,
max = 30,
step = 1,
width = 1.70,
get = function() return GT.db.profile.General.numRows or 1 end,
set = function(_, key)
GT.db.profile.General.numRows = key
GT:AllignRows()
end,
disabled = function()
if not GT.db.profile.General.multiColumn then
return true
else
return false
end
end,
order = 302
},
header4 = {
type = "header",
name = "Icon",
order = 400
},
iconWidth = {
type = "range",
name = "Icon Width",
Expand All @@ -418,9 +460,10 @@ local generalOptions = {
GT.db.profile.General.iconWidth = key
for itemID, itemFrame in pairs(GT.Display.Frames) do
itemFrame.icon:SetWidth(GT.db.profile.General.iconWidth)
GT:SetDisplayFrameWidth()
end
end,
order = 301
order = 401
},
iconHeight = {
type = "range",
Expand All @@ -444,7 +487,7 @@ local generalOptions = {
end
end
end,
order = 302
order = 402
},
rarityBorder = {
type = "toggle",
Expand Down Expand Up @@ -472,12 +515,12 @@ local generalOptions = {
end
end
end,
order = 303
order = 403
},
header4 = {
header5 = {
type = "header",
name = "Text",
order = 400
order = 500
},
textColor = {
type = "color",
Expand All @@ -497,7 +540,7 @@ local generalOptions = {
end
end
end,
order = 401
order = 501
},
textSize = {
type = "range",
Expand Down Expand Up @@ -529,7 +572,7 @@ local generalOptions = {
end
GT:AllignColumns()
end,
order = 402
order = 502
},
textFont = {
type = "select",
Expand All @@ -555,7 +598,7 @@ local generalOptions = {
end
GT:AllignColumns()
end,
order = 403
order = 503
},
totalColor = {
type = "color",
Expand All @@ -575,7 +618,7 @@ local generalOptions = {
end
end
end,
order = 404
order = 504
},
totalSize = {
type = "range",
Expand Down Expand Up @@ -607,7 +650,7 @@ local generalOptions = {
end
GT:AllignColumns()
end,
order = 405
order = 505
},
totalFont = {
type = "select",
Expand All @@ -633,7 +676,7 @@ local generalOptions = {
end
GT:AllignColumns()
end,
order = 406
order = 506
},
},
},
Expand Down
24 changes: 22 additions & 2 deletions GatheringTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ function GT:RemoveSender(senderIndex)
GT:AddRemoveDisplayCell("remove", itemFrame, senderIndex)
itemFrame.displayedCharacters = itemFrame.displayedCharacters - 1

if itemFrame.displayedCharacters == 1 then
if itemFrame.displayedCharacters == 1 and itemID > 1 and itemID < 9999999999 then
GT.Pools.fontStringPool:Release(itemFrame.text[2])
GT:AddRemoveDisplayCell("remove", itemFrame, 2)
itemFrame.totalItemCount = nil
Expand Down Expand Up @@ -347,6 +347,7 @@ end

local function CreateTextDisplay(frame, id, text, type, height, anchor)
local string = GT.Pools.fontStringPool:Acquire()
string:SetParent(frame)
if id < 9999999998 then
string:SetFont(media:Fetch("font", GT.db.profile.General.textFont), GT.db.profile.General.textSize, "OUTLINE")
string:SetVertexColor(GT.db.profile.General.textColor[1], GT.db.profile.General.textColor[2], GT.db.profile.General.textColor[3])
Expand Down Expand Up @@ -388,7 +389,11 @@ function GT:AllignRows()
if i == 1 then
GT.Display.Frames[id]:SetPoint("TOPLEFT", GT.baseFrame.backdrop, "TOPLEFT")
else
GT.Display.Frames[id]:SetPoint("TOPLEFT", GT.Display.Frames[GT.Display.Order[i - 1]], "BOTTOMLEFT")
if GT.db.profile.General.multiColumn and ((i - 1) % GT.db.profile.General.numRows == 0) then
GT.Display.Frames[id]:SetPoint("TOPLEFT", GT.Display.Frames[GT.Display.Order[i - GT.db.profile.General.numRows]], "TOPRIGHT")
else
GT.Display.Frames[id]:SetPoint("TOPLEFT", GT.Display.Frames[GT.Display.Order[i - 1]], "BOTTOMLEFT")
end
end
end
end
Expand All @@ -399,6 +404,17 @@ function GT:AllignColumns()
string:SetWidth(GT.Display.ColumnSize[index])
end
end
GT:SetDisplayFrameWidth()
end

function GT:SetDisplayFrameWidth()
local textWidth = GT:SumTable(GT.Display.ColumnSize)
local offsets = (#GT.Display.ColumnSize * 8) + 3
local iconWidth = GT.db.profile.General.iconWidth
local width = iconWidth + textWidth + offsets
for i, id in ipairs(GT.Display.Order) do
GT.Display.Frames[id]:SetWidth(width)
end
end

function GT:InitiateFrameProcess(id, iconId, iconQuality, iconRarity, displayText, totalItemCount, pricePerItem, priceTotalItem)
Expand Down Expand Up @@ -527,6 +543,7 @@ function GT:CreateDisplayFrame(id, iconId, iconQuality, iconRarity, displayText,
GT.Display.Frames[id] = frame

frame.icon = GT.Pools.texturePool:Acquire()
frame.icon:SetParent(frame)
frame.icon:SetDrawLayer("BACKGROUND", 0)
frame.icon:SetTexture(iconId)
frame.icon:SetPoint("LEFT", frame, "LEFT")
Expand All @@ -536,6 +553,7 @@ function GT:CreateDisplayFrame(id, iconId, iconQuality, iconRarity, displayText,

if iconQuality then
frame.iconQuality = GT.Pools.texturePool:Acquire()
frame.iconQuality:SetParent(frame)
frame.iconQuality:SetDrawLayer("BACKGROUND", 2)
if iconQuality == 1 then
frame.iconQuality:SetAtlas("professions-icon-quality-tier1-inv", true)
Expand Down Expand Up @@ -591,6 +609,7 @@ function GT:CreateDisplayFrame(id, iconId, iconQuality, iconRarity, displayText,
frame.priceTotalItem = #frame.text
end


GT.Display.Order = GT.Display.Order or {}
table.insert(GT.Display.Order, id)
table.sort(GT.Display.Order)
Expand All @@ -608,6 +627,7 @@ function GT:CreateRarityBorder(frame, iconRarity)
end

frame.iconRarity = GT.Pools.texturePool:Acquire()
frame.iconRarity:SetParent(frame)
frame.iconRarity:SetDrawLayer("BACKGROUND", 1)
local rarity = iconRarity or 1
if rarity <= 1 then
Expand Down
2 changes: 1 addition & 1 deletion GatheringTracker.toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Title: Gathering Tracker
## Notes: Addon for tracking gathered items, supports solo players and groups
## Author: Noshei
## Version: 2.0.8
## Version: 2.0.9
## OptionalDeps: TradeSkillMaster
## SavedVariables: GatheringTrackerDB
## AddonCompartmentFunc: GatheringTracker_OnAddonCompartmentClick
Expand Down

0 comments on commit da11f54

Please sign in to comment.