Skip to content

Commit

Permalink
Event Context and Bug Fix (#660)
Browse files Browse the repository at this point in the history
* Fixed a few bugs.
  • Loading branch information
Cidan authored Sep 1, 2024
1 parent d8a05ed commit 9c186ca
Show file tree
Hide file tree
Showing 37 changed files with 178 additions and 166 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
/libs/**
/includes/**
/includes/**
# Bugfix for Cursor editor.
cpp-ghost-text-preview-widget-anysphere://*
cpp-ghost-text-preview-widget-anysphere://**
14 changes: 11 additions & 3 deletions annotations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,10 @@ AccountBankPanel = {}
AccountBankPanel.PurchasePrompt = {}
AccountBankPanel.PurchasePrompt.TabCostFrame = {}
---@type Button
AccountBankPanel.PurchasePrompt.TabCostFrame.PurchaseButton = {}
AccountBankPanel.PurchasePrompt.TabCostFrame.PurchaseButton = {
BattlepayItemTexture = {},
isSkinned = true,
}

ACCOUNT_BANK_PANEL_TITLE = ""

Expand Down Expand Up @@ -469,13 +472,18 @@ function AceItemList:SetList(values) end
function ContainerFrame_UpdateCooldown(id, button) end

---@type Frame
GameMenuFrame = {}
GameMenuFrame = {
scrollable = true,
}

---@type CheckButton
KeyRingButton = {}

---@type Button
CharacterReagentBag0Slot = {}
CharacterReagentBag0Slot = {
BattlepayItemTexture = {},
isSkinned = true,
}

---@class MainMenuBagButton: Button
---@field SlotHighlightTexture Texture
Expand Down
31 changes: 16 additions & 15 deletions config/bags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ local context = addon:GetModule('Context')
---@param kind BagKind
---@return AceConfig.OptionsTable
function config:GetCustomCategoryOptions(kind)
_ = kind
return {
type = "group",
name = L:G("Custom Categories"),
Expand Down Expand Up @@ -77,7 +78,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetCategoryFilter(kind, value, not DB:GetCategoryFilter(kind, value))
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
values = {
["RecentItems"] = L:G("Recent Items"),
Expand Down Expand Up @@ -105,7 +106,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetSectionSortType(kind, DB:GetBagView(kind), value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
values = {
[const.SECTION_SORT_TYPE.ALPHABETICALLY] = L:G("Alphabetically"),
Expand All @@ -126,7 +127,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetItemSortType(kind, DB:GetBagView(kind), value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
values = {
[const.ITEM_SORT_TYPE.QUALITY_THEN_ALPHABETICALLY] = L:G("Quality, then Alphabetically"),
Expand Down Expand Up @@ -183,7 +184,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetMergeItems(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
mergeUnstackable = {
Expand All @@ -197,7 +198,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetMergeUnstackable(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
unmergeAtShop = {
Expand All @@ -211,7 +212,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetUnmergeAtShop(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
dontMergePartial = {
Expand All @@ -225,7 +226,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetDontMergePartial(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
dontMergeTransmog = {
Expand All @@ -239,7 +240,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetDontMergeTransmog(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
}
Expand All @@ -261,7 +262,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetItemLevelEnabled(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
color = {
Expand All @@ -275,7 +276,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetItemLevelColorEnabled(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
}
Expand All @@ -298,7 +299,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetShowFullSectionNames(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
showAllFreeSpace = {
Expand All @@ -313,7 +314,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetShowAllFreeSpace(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
showExtraGlowyButtons = {
Expand All @@ -328,7 +329,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetExtraGlowyButtons(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
itemsPerRow = {
Expand All @@ -346,7 +347,7 @@ function config:GetBagOptions(kind)
DB:SetBagViewSizeItems(kind, DB:GetBagView(kind), value)
bucket:Later("setItemsPerRow", 0.2, function()
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end)
end,
},
Expand Down Expand Up @@ -381,7 +382,7 @@ function config:GetBagOptions(kind)
DB:SetBagViewSizeColumn(kind, DB:GetBagView(kind), value)
bucket:Later("setSectionsPerRow", 0.2, function()
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end)
end,
},
Expand Down
30 changes: 15 additions & 15 deletions config/classic/bags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function config:GetCustomCategoryOptions(kind)
set = function(_, value)
categories:SetCategoryState(kind, value, not categories:IsCategoryEnabled(kind, value))
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
values = {}
}
Expand Down Expand Up @@ -103,7 +103,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetCategoryFilter(kind, value, not DB:GetCategoryFilter(kind, value))
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
values = {
["RecentItems"] = L:G("Recent Items"),
Expand All @@ -128,7 +128,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetSectionSortType(kind, DB:GetBagView(kind), value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
values = {
[const.SECTION_SORT_TYPE.ALPHABETICALLY] = L:G("Alphabetically"),
Expand All @@ -149,7 +149,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetItemSortType(kind, DB:GetBagView(kind), value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
values = {
[const.ITEM_SORT_TYPE.QUALITY_THEN_ALPHABETICALLY] = L:G("Quality, then Alphabetically"),
Expand All @@ -174,7 +174,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetMergeItems(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
mergeUnstackable = {
Expand All @@ -188,7 +188,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetMergeUnstackable(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
unmergeAtShop = {
Expand All @@ -202,7 +202,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetUnmergeAtShop(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
dontMergePartial = {
Expand All @@ -216,7 +216,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetDontMergePartial(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
}
Expand All @@ -238,7 +238,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetItemLevelEnabled(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
color = {
Expand All @@ -252,7 +252,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetItemLevelColorEnabled(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
}
Expand All @@ -275,7 +275,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetShowFullSectionNames(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
showAllFreeSpace = {
Expand All @@ -290,7 +290,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetShowAllFreeSpace(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
showExtraGlowyButtons = {
Expand All @@ -305,7 +305,7 @@ function config:GetBagOptions(kind)
set = function(_, value)
DB:SetExtraGlowyButtons(kind, value)
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end,
},
itemsPerRow = {
Expand All @@ -323,7 +323,7 @@ function config:GetBagOptions(kind)
DB:SetBagViewSizeItems(kind, DB:GetBagView(kind), value)
bucket:Later("setItemsPerRow", 0.2, function()
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end)
end,
},
Expand Down Expand Up @@ -358,7 +358,7 @@ function config:GetBagOptions(kind)
DB:SetBagViewSizeColumn(kind, DB:GetBagView(kind), value)
bucket:Later("setSectionsPerRow", 0.2, function()
local ctx = context:New('on_click')
events:SendMessage('bags/FullRefreshAll', ctx)
events:SendMessage(ctx, 'bags/FullRefreshAll')
end)
end,
},
Expand Down
8 changes: 4 additions & 4 deletions config/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function config:GetGeneralOptions()
end,
set = function(_, value)
DB:SetInBagSearch(value)
events:SendMessage('search/SetInFrame', value)
events:SendMessage(context:New('OnClick_InBagSearch'), 'search/SetInFrame', value)
end,
},
enableEnterToMakeCategory = {
Expand Down Expand Up @@ -139,7 +139,7 @@ function config:GetGeneralOptions()
set = function(_, value)
DB:SetUpgradeIconProvider(value)
local ctx = context:New('on_click')
events:SendMessage('bag/RedrawIcons', ctx)
events:SendMessage(ctx, 'bag/RedrawIcons')
end,
},
newItemTime = {
Expand Down Expand Up @@ -224,7 +224,7 @@ end
function config:Open()
LibStub("AceConfigDialog-3.0"):Open(addonName)
local ctx = context:New('on_click')
events:SendMessage('config/Opened', ctx)
events:SendMessage(ctx, 'config/Opened')
end

function config:OnEnable()
Expand Down Expand Up @@ -255,7 +255,7 @@ function config:OnEnable()
LibStub('AceConsole-3.0'):RegisterChatCommand("bbdb", function()
DB:SetDebugMode(not DB:GetDebugMode())
local ctx = context:New('on_click')
events:SendMessage('config/DebugMode', ctx, DB:GetDebugMode())
events:SendMessage(ctx, 'config/DebugMode', DB:GetDebugMode())
end)
end

Expand Down
Loading

0 comments on commit 9c186ca

Please sign in to comment.