added sort btn & configs. to enable or disable
This commit is contained in:
@@ -9,11 +9,12 @@
|
|||||||
<Script file="components\itemFrame.lua"/>
|
<Script file="components\itemFrame.lua"/>
|
||||||
<Script file="components\moneyFrame.lua"/>
|
<Script file="components\moneyFrame.lua"/>
|
||||||
<Script file="components\optionsToggle.lua"/>
|
<Script file="components\optionsToggle.lua"/>
|
||||||
|
<Script file="components\sortBtn.lua"/>
|
||||||
<Script file="components\playerSelector.lua"/>
|
<Script file="components\playerSelector.lua"/>
|
||||||
<Script file="components\savedSettings.lua"/>
|
<Script file="components\savedSettings.lua"/>
|
||||||
<Script file="components\searchFrame.lua"/>
|
<Script file="components\searchFrame.lua"/>
|
||||||
<Script file="components\searchToggle.lua"/>
|
<Script file="components\searchToggle.lua"/>
|
||||||
<Script file="components\settings.lua"/>
|
<Script file="components\settings.lua"/>
|
||||||
<Script file="components\titleFrame.lua"/>
|
<Script file="components\titleFrame.lua"/>
|
||||||
<Script file="components\savedFrameSettings.lua"/>
|
<Script file="components\savedFrameSettings.lua"/>
|
||||||
</Ui>
|
</Ui>
|
||||||
+81
-54
@@ -21,12 +21,12 @@ function Frame:New(frameID)
|
|||||||
f:SetMovable(true)
|
f:SetMovable(true)
|
||||||
f:EnableMouse(true)
|
f:EnableMouse(true)
|
||||||
|
|
||||||
f:SetBackdrop{
|
f:SetBackdrop {
|
||||||
bgFile = [[Interface\ChatFrame\ChatFrameBackground]],
|
bgFile = [[Interface\ChatFrame\ChatFrameBackground]],
|
||||||
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
|
edgeFile = [[Interface\Tooltips\UI-Tooltip-Border]],
|
||||||
edgeSize = 16,
|
edgeSize = 16,
|
||||||
tile = true, tileSize = 16,
|
tile = true, tileSize = 16,
|
||||||
insets = {left = 4, right = 4, top = 4, bottom = 4}
|
insets = { left = 4, right = 4, top = 4, bottom = 4 }
|
||||||
}
|
}
|
||||||
|
|
||||||
f:SetScript('OnShow', f.OnShow)
|
f:SetScript('OnShow', f.OnShow)
|
||||||
@@ -40,7 +40,6 @@ function Frame:New(frameID)
|
|||||||
return f
|
return f
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Messages
|
Frame Messages
|
||||||
--]]
|
--]]
|
||||||
@@ -68,6 +67,7 @@ function Frame:UpdateEvents()
|
|||||||
self:RegisterMessage('MONEY_FRAME_ENABLE_UPDATE')
|
self:RegisterMessage('MONEY_FRAME_ENABLE_UPDATE')
|
||||||
self:RegisterMessage('DATABROKER_FRAME_ENABLE_UPDATE')
|
self:RegisterMessage('DATABROKER_FRAME_ENABLE_UPDATE')
|
||||||
self:RegisterMessage('SEARCH_TOGGLE_ENABLE_UPDATE')
|
self:RegisterMessage('SEARCH_TOGGLE_ENABLE_UPDATE')
|
||||||
|
self:RegisterMessage('SORT_BTN_ENABLE_UPDATE')
|
||||||
self:RegisterMessage('OPTIONS_TOGGLE_ENABLE_UPDATE')
|
self:RegisterMessage('OPTIONS_TOGGLE_ENABLE_UPDATE')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -175,12 +175,17 @@ function Frame:SEARCH_TOGGLE_ENABLE_UPDATE(msg, frameID, enable)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Frame:OPTIONS_TOGGLE_ENABLE_UPDATE(msg, frameID, enable)
|
function Frame:SORT_BTN_ENABLE_UPDATE(msg, frameID, enable)
|
||||||
if self:GetFrameID() == frameID then
|
if self:GetFrameID() == frameID then
|
||||||
self:Layout()
|
self:Layout()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Frame:OPTIONS_TOGGLE_ENABLE_UPDATE(msg, frameID, enable)
|
||||||
|
if self:GetFrameID() == frameID then
|
||||||
|
self:Layout()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Events
|
Frame Events
|
||||||
@@ -218,7 +223,6 @@ function Frame:IsBankFrame()
|
|||||||
return self:GetFrameID() == 'bank'
|
return self:GetFrameID() == 'bank'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Update Methods
|
Update Methods
|
||||||
--]]
|
--]]
|
||||||
@@ -243,7 +247,6 @@ function Frame:UpdateLook()
|
|||||||
self:Layout()
|
self:Layout()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Scale
|
Frame Scale
|
||||||
--]]
|
--]]
|
||||||
@@ -258,7 +261,7 @@ function Frame:UpdateScale()
|
|||||||
local ratio = newScale / oldScale
|
local ratio = newScale / oldScale
|
||||||
|
|
||||||
self:SetScale(newScale)
|
self:SetScale(newScale)
|
||||||
self:GetSettings():SetPosition(point, x/ratio, y/ratio)
|
self:GetSettings():SetPosition(point, x / ratio, y / ratio)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -271,7 +274,6 @@ function Frame:Rescale()
|
|||||||
self:SetScale(self:GetFrameScale())
|
self:SetScale(self:GetFrameScale())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Opacity
|
Frame Opacity
|
||||||
--]]
|
--]]
|
||||||
@@ -284,7 +286,6 @@ function Frame:GetFrameOpacity()
|
|||||||
return self:GetSettings():GetOpacity()
|
return self:GetSettings():GetOpacity()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Position
|
Frame Position
|
||||||
--]]
|
--]]
|
||||||
@@ -305,24 +306,25 @@ function Frame:GetRelativePosition()
|
|||||||
local s = self:GetScale()
|
local s = self:GetScale()
|
||||||
if not (x and y) then return end
|
if not (x and y) then return end
|
||||||
|
|
||||||
w = w/s h = h/s
|
w = w / s
|
||||||
|
h = h / s
|
||||||
|
|
||||||
local dx, dy
|
local dx, dy
|
||||||
local hHalf = (x > w/2) and 'RIGHT' or 'LEFT'
|
local hHalf = (x > w / 2) and 'RIGHT' or 'LEFT'
|
||||||
if hHalf == 'RIGHT' then
|
if hHalf == 'RIGHT' then
|
||||||
dx = self:GetRight() - w
|
dx = self:GetRight() - w
|
||||||
else
|
else
|
||||||
dx = self:GetLeft()
|
dx = self:GetLeft()
|
||||||
end
|
end
|
||||||
|
|
||||||
local vHalf = (y > h/2) and 'TOP' or 'BOTTOM'
|
local vHalf = (y > h / 2) and 'TOP' or 'BOTTOM'
|
||||||
if vHalf == 'TOP' then
|
if vHalf == 'TOP' then
|
||||||
dy = self:GetTop() - h
|
dy = self:GetTop() - h
|
||||||
else
|
else
|
||||||
dy = self:GetBottom()
|
dy = self:GetBottom()
|
||||||
end
|
end
|
||||||
|
|
||||||
return vHalf..hHalf, dx, dy
|
return vHalf .. hHalf, dx, dy
|
||||||
end
|
end
|
||||||
|
|
||||||
function Frame:UpdatePosition()
|
function Frame:UpdatePosition()
|
||||||
@@ -334,7 +336,6 @@ function Frame:GetFramePosition()
|
|||||||
return self:GetSettings():GetPosition()
|
return self:GetSettings():GetPosition()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Color
|
Frame Color
|
||||||
--]]
|
--]]
|
||||||
@@ -357,7 +358,6 @@ function Frame:GetFrameBackdropBorderColor()
|
|||||||
return self:GetSettings():GetBorderColor()
|
return self:GetSettings():GetBorderColor()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Visibility
|
Frame Visibility
|
||||||
--]]
|
--]]
|
||||||
@@ -378,7 +378,6 @@ function Frame:HideFrame()
|
|||||||
self:GetSettings():Hide()
|
self:GetSettings():Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Layer/Strata
|
Frame Layer/Strata
|
||||||
--]]
|
--]]
|
||||||
@@ -412,7 +411,6 @@ function Frame:GetFrameLayer()
|
|||||||
return self:GetSettings():GetLayer()
|
return self:GetSettings():GetLayer()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Layout Methods
|
Layout Methods
|
||||||
--]]
|
--]]
|
||||||
@@ -438,6 +436,10 @@ function Frame:Layout()
|
|||||||
width = width + w + 24 --append spacing between close button and this
|
width = width + w + 24 --append spacing between close button and this
|
||||||
height = height + 20
|
height = height + 20
|
||||||
|
|
||||||
|
local w, h = self:PlaceSortBtn()
|
||||||
|
width = width + w + 24 --append spacing between close button and this
|
||||||
|
height = height + 20
|
||||||
|
|
||||||
local w, h = self:PlaceTitleFrame()
|
local w, h = self:PlaceTitleFrame()
|
||||||
width = width + w
|
width = width + w
|
||||||
|
|
||||||
@@ -468,8 +470,7 @@ function Frame:Layout()
|
|||||||
self:SavePosition()
|
self:SavePosition()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Menu Button Placement ]] --
|
||||||
--[[ Menu Button Placement ]]--
|
|
||||||
|
|
||||||
function Frame:PlaceMenuButtons()
|
function Frame:PlaceMenuButtons()
|
||||||
local menuButtons = self.menuButtons or {}
|
local menuButtons = self.menuButtons or {}
|
||||||
@@ -501,7 +502,7 @@ function Frame:PlaceMenuButtons()
|
|||||||
if i == 1 then
|
if i == 1 then
|
||||||
button:SetPoint('TOPLEFT', self, 'TOPLEFT', 8, -8)
|
button:SetPoint('TOPLEFT', self, 'TOPLEFT', 8, -8)
|
||||||
else
|
else
|
||||||
button:SetPoint('TOPLEFT', menuButtons[i-1], 'TOPRIGHT', 4, 0)
|
button:SetPoint('TOPLEFT', menuButtons[i - 1], 'TOPRIGHT', 4, 0)
|
||||||
end
|
end
|
||||||
button:Show()
|
button:Show()
|
||||||
end
|
end
|
||||||
@@ -520,13 +521,12 @@ function Frame:GetMenuButtons()
|
|||||||
return self.menuButtons
|
return self.menuButtons
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Components
|
Frame Components
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
|
||||||
--[[ close button ]]--
|
--[[ close button ]] --
|
||||||
|
|
||||||
local function CloseButton_OnClick(self)
|
local function CloseButton_OnClick(self)
|
||||||
self:GetParent():GetSettings():Hide(true) --force hide the frame
|
self:GetParent():GetSettings():Hide(true) --force hide the frame
|
||||||
@@ -552,8 +552,7 @@ function Frame:PlaceCloseButton()
|
|||||||
return 20, 20 --make the same size as the other menu buttons
|
return 20, 20 --make the same size as the other menu buttons
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ search frame ]] --
|
||||||
--[[ search frame ]]--
|
|
||||||
|
|
||||||
function Frame:CreateSearchFrame()
|
function Frame:CreateSearchFrame()
|
||||||
local f = Bagnon.SearchFrame:New(self:GetFrameID(), self)
|
local f = Bagnon.SearchFrame:New(self:GetFrameID(), self)
|
||||||
@@ -576,7 +575,9 @@ function Frame:PlaceSearchFrame()
|
|||||||
frame:SetPoint('TOPLEFT', self, 'TOPLEFT', 8, -8)
|
frame:SetPoint('TOPLEFT', self, 'TOPLEFT', 8, -8)
|
||||||
end
|
end
|
||||||
|
|
||||||
if self:HasOptionsToggle() then
|
if self:HasSortBtn() then
|
||||||
|
frame:SetPoint('RIGHT', self:GetSortBtn(), 'LEFT', -2, 0)
|
||||||
|
elseif self:HasOptionsToggle() then
|
||||||
frame:SetPoint('RIGHT', self:GetOptionsToggle(), 'LEFT', -2, 0)
|
frame:SetPoint('RIGHT', self:GetOptionsToggle(), 'LEFT', -2, 0)
|
||||||
else
|
else
|
||||||
frame:SetPoint('RIGHT', self:GetCloseButton(), 'LEFT', -2, 0)
|
frame:SetPoint('RIGHT', self:GetCloseButton(), 'LEFT', -2, 0)
|
||||||
@@ -587,11 +588,10 @@ function Frame:PlaceSearchFrame()
|
|||||||
return frame:GetWidth(), frame:GetHeight()
|
return frame:GetWidth(), frame:GetHeight()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ search toggle ]] --
|
||||||
--[[ search toggle ]]--
|
|
||||||
|
|
||||||
function Frame:CreateSearchToggle()
|
function Frame:CreateSearchToggle()
|
||||||
local toggle = Bagnon.SearchToggle:New(self:GetFrameID(), self)
|
local toggle = Bagnon.SearchToggle:New(self:GetFrameID(), self)
|
||||||
self.searchToggle = toggle
|
self.searchToggle = toggle
|
||||||
return toggle
|
return toggle
|
||||||
end
|
end
|
||||||
@@ -604,11 +604,10 @@ function Frame:HasSearchToggle()
|
|||||||
return self:GetSettings():HasSearchToggle()
|
return self:GetSettings():HasSearchToggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ bag frame ]] --
|
||||||
--[[ bag frame ]]--
|
|
||||||
|
|
||||||
function Frame:CreateBagFrame()
|
function Frame:CreateBagFrame()
|
||||||
local f = Bagnon.BagFrame:New(self:GetFrameID(), self)
|
local f = Bagnon.BagFrame:New(self:GetFrameID(), self)
|
||||||
self.bagFrame = f
|
self.bagFrame = f
|
||||||
return f
|
return f
|
||||||
end
|
end
|
||||||
@@ -655,8 +654,7 @@ function Frame:PlaceBagFrame()
|
|||||||
return 0, 0
|
return 0, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ bag toggle ]] --
|
||||||
--[[ bag toggle ]]--
|
|
||||||
|
|
||||||
function Frame:CreateBagToggle()
|
function Frame:CreateBagToggle()
|
||||||
local toggle = Bagnon.BagToggle:New(self:GetFrameID(), self)
|
local toggle = Bagnon.BagToggle:New(self:GetFrameID(), self)
|
||||||
@@ -673,8 +671,7 @@ function Frame:HasBagToggle()
|
|||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ title frame ]] --
|
||||||
--[[ title frame ]]--
|
|
||||||
|
|
||||||
function Frame:CreateTitleFrame()
|
function Frame:CreateTitleFrame()
|
||||||
local f = Bagnon.TitleFrame:New(self:GetFrameID(), self)
|
local f = Bagnon.TitleFrame:New(self:GetFrameID(), self)
|
||||||
@@ -702,18 +699,20 @@ function Frame:PlaceTitleFrame()
|
|||||||
h = 20
|
h = 20
|
||||||
end
|
end
|
||||||
|
|
||||||
if self:HasOptionsToggle() then
|
if self:HasSortBtn() then
|
||||||
frame:SetPoint('RIGHT', self:GetOptionsToggle(), 'LEFT', -4, 0)
|
frame:SetPoint('RIGHT', self:GetSortBtn(), 'LEFT', -2, 0)
|
||||||
|
elseif self:HasOptionsToggle() then
|
||||||
|
frame:SetPoint('RIGHT', self:GetOptionsToggle(), 'LEFT', -2, 0)
|
||||||
else
|
else
|
||||||
frame:SetPoint('RIGHT', self:GetCloseButton(), 'LEFT', -4, 0)
|
frame:SetPoint('RIGHT', self:GetCloseButton(), 'LEFT', -2, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
frame:SetHeight(20)
|
frame:SetHeight(20)
|
||||||
|
|
||||||
return w, h
|
return w, h
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ item frame ]] --
|
||||||
--[[ item frame ]]--
|
|
||||||
|
|
||||||
function Frame:CreateItemFrame()
|
function Frame:CreateItemFrame()
|
||||||
local f = Bagnon.ItemFrame:New(self:GetFrameID(), self)
|
local f = Bagnon.ItemFrame:New(self:GetFrameID(), self)
|
||||||
@@ -744,8 +743,7 @@ function Frame:PlaceItemFrame()
|
|||||||
return frame:GetWidth() - 2, frame:GetHeight()
|
return frame:GetWidth() - 2, frame:GetHeight()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ player selector ]] --
|
||||||
--[[ player selector ]]--
|
|
||||||
|
|
||||||
function Frame:GetPlayerSelector()
|
function Frame:GetPlayerSelector()
|
||||||
return self.playerSelector
|
return self.playerSelector
|
||||||
@@ -761,8 +759,7 @@ function Frame:HasPlayerSelector()
|
|||||||
return BagnonDB and true or false
|
return BagnonDB and true or false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ money frame ]] --
|
||||||
--[[ money frame ]]--
|
|
||||||
|
|
||||||
function Frame:GetMoneyFrame()
|
function Frame:GetMoneyFrame()
|
||||||
return self.moneyFrame
|
return self.moneyFrame
|
||||||
@@ -794,9 +791,7 @@ function Frame:PlaceMoneyFrame()
|
|||||||
return 0, 0
|
return 0, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ libdatabroker display ]] --
|
||||||
|
|
||||||
--[[ libdatabroker display ]]--
|
|
||||||
|
|
||||||
function Frame:GetBrokerDisplay()
|
function Frame:GetBrokerDisplay()
|
||||||
return self.brokerDisplay
|
return self.brokerDisplay
|
||||||
@@ -835,8 +830,41 @@ function Frame:PlaceBrokerDisplayFrame()
|
|||||||
return 0, 0
|
return 0, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ sort bags ]] --
|
||||||
|
|
||||||
--[[ options toggle ]]--
|
function Frame:GetSortBtn()
|
||||||
|
return self.sortBtn
|
||||||
|
end
|
||||||
|
|
||||||
|
function Frame:CreateSortBtn()
|
||||||
|
local f = Bagnon.SortBtn:New(self:GetFrameID(), self)
|
||||||
|
self.sortBtn = f
|
||||||
|
return f
|
||||||
|
end
|
||||||
|
|
||||||
|
function Frame:PlaceSortBtn()
|
||||||
|
if self:HasSortBtn() then
|
||||||
|
local toggle = self:GetSortBtn() or self:CreateSortBtn()
|
||||||
|
toggle:ClearAllPoints()
|
||||||
|
toggle:SetPoint('TOPRIGHT', self, 'TOPRIGHT', -58, -8)
|
||||||
|
toggle:Show()
|
||||||
|
|
||||||
|
return toggle:GetWidth(), toggle:GetHeight()
|
||||||
|
end
|
||||||
|
|
||||||
|
local toggle = self:GetSortBtn()
|
||||||
|
if toggle then
|
||||||
|
toggle:Hide()
|
||||||
|
end
|
||||||
|
return 0, 0
|
||||||
|
end
|
||||||
|
|
||||||
|
function Frame:HasSortBtn()
|
||||||
|
local name, title, notes, enabled = GetAddOnInfo('Bagnon_Config')
|
||||||
|
return enabled and self:GetSettings():HasSortBtn()
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[ options toggle ]] --
|
||||||
|
|
||||||
function Frame:GetOptionsToggle()
|
function Frame:GetOptionsToggle()
|
||||||
return self.optionsToggle
|
return self.optionsToggle
|
||||||
@@ -870,7 +898,6 @@ function Frame:HasOptionsToggle()
|
|||||||
return enabled and self:GetSettings():HasOptionsToggle()
|
return enabled and self:GetSettings():HasOptionsToggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Settings Access
|
Frame Settings Access
|
||||||
--]]
|
--]]
|
||||||
@@ -881,4 +908,4 @@ end
|
|||||||
|
|
||||||
function Frame:GetSettings()
|
function Frame:GetSettings()
|
||||||
return Bagnon.FrameSettings:Get(self:GetFrameID())
|
return Bagnon.FrameSettings:Get(self:GetFrameID())
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,26 +10,25 @@ Bagnon.FrameSettings = FrameSettings
|
|||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Constructorish
|
Constructorish
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
FrameSettings.mt = {
|
FrameSettings.mt = {
|
||||||
__index = FrameSettings
|
__index = FrameSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
FrameSettings.objects = setmetatable({}, {__index = function(tbl, id)
|
FrameSettings.objects = setmetatable({}, { __index = function(tbl, id)
|
||||||
local obj = setmetatable({frameID = id, shown = 0}, FrameSettings.mt)
|
local obj = setmetatable({ frameID = id, shown = 0 }, FrameSettings.mt)
|
||||||
tbl[id] = obj
|
tbl[id] = obj
|
||||||
return obj
|
return obj
|
||||||
end})
|
end })
|
||||||
|
|
||||||
function FrameSettings:Get(id)
|
function FrameSettings:Get(id)
|
||||||
return self.objects[id]
|
return self.objects[id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Accessor Methods
|
Accessor Methods
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
function FrameSettings:GetID()
|
function FrameSettings:GetID()
|
||||||
@@ -42,22 +41,20 @@ function FrameSettings:GetDB()
|
|||||||
return db
|
return db
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Message Passing
|
Message Passing
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function FrameSettings:SendMessage(msg, ...)
|
function FrameSettings:SendMessage(msg, ...)
|
||||||
Bagnon.Callbacks:SendMessage(msg, self:GetID(), ...)
|
Bagnon.Callbacks:SendMessage(msg, self:GetID(), ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Update Methods
|
Update Methods
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
--[[ Frame Visibility ]]--
|
--[[ Frame Visibility ]] --
|
||||||
|
|
||||||
--the logic here is a little wacky, since we deal with auto open/close events
|
--the logic here is a little wacky, since we deal with auto open/close events
|
||||||
--if a frame was manually opened, then it should only be closable manually
|
--if a frame was manually opened, then it should only be closable manually
|
||||||
@@ -94,14 +91,13 @@ function FrameSettings:IsShown()
|
|||||||
return (self.shown or 0) > 0
|
return (self.shown or 0) > 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Frame Position ]] --
|
||||||
--[[ Frame Position ]]--
|
|
||||||
|
|
||||||
--position
|
--position
|
||||||
function FrameSettings:SetPosition(point, x, y)
|
function FrameSettings:SetPosition(point, x, y)
|
||||||
local oPoint, oX, oY = self:GetPosition()
|
local oPoint, oX, oY = self:GetPosition()
|
||||||
|
|
||||||
if not(point == oPoint and x == oX and y == oY) then
|
if not (point == oPoint and x == oX and y == oY) then
|
||||||
self:GetDB():SetPosition(point, x, y)
|
self:GetDB():SetPosition(point, x, y)
|
||||||
self:SendMessage('FRAME_POSITION_UPDATE', self:GetPosition())
|
self:SendMessage('FRAME_POSITION_UPDATE', self:GetPosition())
|
||||||
end
|
end
|
||||||
@@ -116,8 +112,7 @@ function FrameSettings:IsMovable()
|
|||||||
return not Bagnon.Settings:AreFramePositionsLocked()
|
return not Bagnon.Settings:AreFramePositionsLocked()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Frame Layout ]] --
|
||||||
--[[ Frame Layout ]]--
|
|
||||||
|
|
||||||
--scale
|
--scale
|
||||||
function FrameSettings:SetScale(scale)
|
function FrameSettings:SetScale(scale)
|
||||||
@@ -147,7 +142,7 @@ end
|
|||||||
function FrameSettings:SetColor(r, g, b, a)
|
function FrameSettings:SetColor(r, g, b, a)
|
||||||
local pR, pG, pB, pA = self:GetColor()
|
local pR, pG, pB, pA = self:GetColor()
|
||||||
|
|
||||||
if not(pR == r and pG == g and pB == b and pA == a) then
|
if not (pR == r and pG == g and pB == b and pA == a) then
|
||||||
self:GetDB():SetColor(r, g, b, a)
|
self:GetDB():SetColor(r, g, b, a)
|
||||||
self:SendMessage('FRAME_COLOR_UPDATE', self:GetColor())
|
self:SendMessage('FRAME_COLOR_UPDATE', self:GetColor())
|
||||||
end
|
end
|
||||||
@@ -161,7 +156,7 @@ end
|
|||||||
function FrameSettings:SetBorderColor(r, g, b, a)
|
function FrameSettings:SetBorderColor(r, g, b, a)
|
||||||
local pR, pG, pB, pA = self:GetBorderColor()
|
local pR, pG, pB, pA = self:GetBorderColor()
|
||||||
|
|
||||||
if not(pR == r and pG == g and pB == b and pA == a) then
|
if not (pR == r and pG == g and pB == b and pA == a) then
|
||||||
self:GetDB():SetBorderColor(r, g, b, a)
|
self:GetDB():SetBorderColor(r, g, b, a)
|
||||||
self:SendMessage('FRAME_BORDER_COLOR_UPDATE', self:GetBorderColor())
|
self:SendMessage('FRAME_BORDER_COLOR_UPDATE', self:GetBorderColor())
|
||||||
end
|
end
|
||||||
@@ -186,13 +181,12 @@ end
|
|||||||
--returns a list of all possible frame layers
|
--returns a list of all possible frame layers
|
||||||
function FrameSettings:GetAvailableLayers()
|
function FrameSettings:GetAvailableLayers()
|
||||||
if not FrameSettings.availableFrameLayers then
|
if not FrameSettings.availableFrameLayers then
|
||||||
FrameSettings.availableFrameLayers = {'LOW', 'MEDIUMLOW', 'MEDIUM', 'MEDIUMHIGH', 'HIGH', 'TOPLEVEL'}
|
FrameSettings.availableFrameLayers = { 'LOW', 'MEDIUMLOW', 'MEDIUM', 'MEDIUMHIGH', 'HIGH', 'TOPLEVEL' }
|
||||||
end
|
end
|
||||||
return FrameSettings.availableFrameLayers
|
return FrameSettings.availableFrameLayers
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Frame Components ]] --
|
||||||
--[[ Frame Components ]]--
|
|
||||||
|
|
||||||
--returns true if the frame has a bag frame, and false otherwise
|
--returns true if the frame has a bag frame, and false otherwise
|
||||||
function FrameSettings:SetHasBagFrame(enable)
|
function FrameSettings:SetHasBagFrame(enable)
|
||||||
@@ -250,6 +244,20 @@ function FrameSettings:HasSearchToggle()
|
|||||||
return self:GetDB():HasSearchToggle()
|
return self:GetDB():HasSearchToggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--sort btn
|
||||||
|
function FrameSettings:SetHasSortBtn(enable)
|
||||||
|
local enable = enable and true or false
|
||||||
|
|
||||||
|
if self:HasSortBtn() ~= enable then
|
||||||
|
self:GetDB():SetHasSortBtn(enable)
|
||||||
|
self:SendMessage('SORT_BTN_ENABLE_UPDATE', self:HasSortBtn())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function FrameSettings:HasSortBtn()
|
||||||
|
return self:GetDB():HasSortBtn()
|
||||||
|
end
|
||||||
|
|
||||||
--options toggle
|
--options toggle
|
||||||
function FrameSettings:SetHasOptionsToggle(enable)
|
function FrameSettings:SetHasOptionsToggle(enable)
|
||||||
local enable = enable and true or false
|
local enable = enable and true or false
|
||||||
@@ -264,8 +272,7 @@ function FrameSettings:HasOptionsToggle()
|
|||||||
return self:GetDB():HasOptionsToggle()
|
return self:GetDB():HasOptionsToggle()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Broker Display Object ]] --
|
||||||
--[[ Broker Display Object ]]--
|
|
||||||
|
|
||||||
function FrameSettings:SetBrokerDisplayObject(objectName)
|
function FrameSettings:SetBrokerDisplayObject(objectName)
|
||||||
if self:GetBrokerDisplayObject() ~= objectName then
|
if self:GetBrokerDisplayObject() ~= objectName then
|
||||||
@@ -278,8 +285,7 @@ function FrameSettings:GetBrokerDisplayObject()
|
|||||||
return self:GetDB():GetBrokerDisplayObject()
|
return self:GetDB():GetBrokerDisplayObject()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Bag Frame Visibility ]] --
|
||||||
--[[ Bag Frame Visibility ]]--
|
|
||||||
|
|
||||||
function FrameSettings:ShowBagFrame()
|
function FrameSettings:ShowBagFrame()
|
||||||
if not self:IsBagFrameShown() then
|
if not self:IsBagFrameShown() then
|
||||||
@@ -307,8 +313,7 @@ function FrameSettings:IsBagFrameShown()
|
|||||||
return self.showBagFrame
|
return self.showBagFrame
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Item Frame Layout ]] --
|
||||||
--[[ Item Frame Layout ]]--
|
|
||||||
|
|
||||||
--spacing
|
--spacing
|
||||||
function FrameSettings:SetItemFrameSpacing(spacing)
|
function FrameSettings:SetItemFrameSpacing(spacing)
|
||||||
@@ -348,8 +353,7 @@ function FrameSettings:IsBagBreakEnabled()
|
|||||||
return self:GetDB():IsBagBreakEnabled()
|
return self:GetDB():IsBagBreakEnabled()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Bag Slot Availability ]] --
|
||||||
--[[ Bag Slot Availability ]]--
|
|
||||||
|
|
||||||
--returns true if the slot is available to this frame, and false otherwise
|
--returns true if the slot is available to this frame, and false otherwise
|
||||||
function FrameSettings:HasBagSlot(slot)
|
function FrameSettings:HasBagSlot(slot)
|
||||||
@@ -366,8 +370,7 @@ function FrameSettings:GetBagSlots()
|
|||||||
return ipairs(self:GetDB():GetBags())
|
return ipairs(self:GetDB():GetBags())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Bag Slot Visibility ]] --
|
||||||
--[[ Bag Slot Visibility ]]--
|
|
||||||
|
|
||||||
function FrameSettings:ShowBagSlot(slotToShow)
|
function FrameSettings:ShowBagSlot(slotToShow)
|
||||||
if not self:IsBagSlotShown(slotToShow) then
|
if not self:IsBagSlotShown(slotToShow) then
|
||||||
@@ -404,8 +407,7 @@ function FrameSettings:IsBagSlotHidden(slot)
|
|||||||
return not self:GetDB():IsBagShown(slot)
|
return not self:GetDB():IsBagShown(slot)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Bag Slot Iterators ]] --
|
||||||
--[[ Bag Slot Iterators ]]--
|
|
||||||
|
|
||||||
--returns an iterator for all bag slots that are available to this frame and marked as visible
|
--returns an iterator for all bag slots that are available to this frame and marked as visible
|
||||||
local function reverseVisibleSlotIterator(obj, i)
|
local function reverseVisibleSlotIterator(obj, i)
|
||||||
@@ -440,7 +442,6 @@ function FrameSettings:GetVisibleBagSlots()
|
|||||||
return visibleSlotIterator, self, 0
|
return visibleSlotIterator, self, 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function FrameSettings:SetReverseSlotOrder(enable)
|
function FrameSettings:SetReverseSlotOrder(enable)
|
||||||
local enable = enable and true or false
|
local enable = enable and true or false
|
||||||
if self:IsSlotOrderReversed() ~= enable then
|
if self:IsSlotOrderReversed() ~= enable then
|
||||||
@@ -453,8 +454,7 @@ function FrameSettings:IsSlotOrderReversed()
|
|||||||
return self:GetDB():IsSlotOrderReversed()
|
return self:GetDB():IsSlotOrderReversed()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Text Filtering ]] --
|
||||||
--[[ Text Filtering ]]--
|
|
||||||
|
|
||||||
function FrameSettings:EnableTextSearch()
|
function FrameSettings:EnableTextSearch()
|
||||||
if not self:IsTextSearchEnabled() then
|
if not self:IsTextSearchEnabled() then
|
||||||
@@ -482,8 +482,7 @@ function FrameSettings:IsTextSearchEnabled()
|
|||||||
return self.enableTextSearch
|
return self.enableTextSearch
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Bag Filtering ]] --
|
||||||
--[[ Bag Filtering ]]--
|
|
||||||
|
|
||||||
function FrameSettings:SetBagSearch(bagSlotID)
|
function FrameSettings:SetBagSearch(bagSlotID)
|
||||||
if self:GetBagSearch() ~= bagSlotID then
|
if self:GetBagSearch() ~= bagSlotID then
|
||||||
@@ -496,8 +495,7 @@ function FrameSettings:GetBagSearch()
|
|||||||
return self.bagSearch or false
|
return self.bagSearch or false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Player Filtering ]] --
|
||||||
--[[ Player Filtering ]]--
|
|
||||||
|
|
||||||
function FrameSettings:SetPlayerFilter(player)
|
function FrameSettings:SetPlayerFilter(player)
|
||||||
local currentFilter = self:GetPlayerFilter()
|
local currentFilter = self:GetPlayerFilter()
|
||||||
@@ -509,4 +507,4 @@ end
|
|||||||
|
|
||||||
function FrameSettings:GetPlayerFilter()
|
function FrameSettings:GetPlayerFilter()
|
||||||
return self.playerFilter or UnitName('player')
|
return self.playerFilter or UnitName('player')
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ Bagnon.SavedFrameSettings = SavedFrameSettings
|
|||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Local Functions of Justice
|
Local Functions of Justice
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
local function removeDefaults(tbl, defaults)
|
local function removeDefaults(tbl, defaults)
|
||||||
for k, v in pairs(defaults) do
|
for k, v in pairs(defaults) do
|
||||||
@@ -37,29 +37,27 @@ local function copyDefaults(tbl, defaults)
|
|||||||
return tbl
|
return tbl
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Constructorish
|
Constructorish
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
SavedFrameSettings.mt = {
|
SavedFrameSettings.mt = {
|
||||||
__index = SavedFrameSettings
|
__index = SavedFrameSettings
|
||||||
}
|
}
|
||||||
|
|
||||||
SavedFrameSettings.objects = setmetatable({}, {__index = function(tbl, id)
|
SavedFrameSettings.objects = setmetatable({}, { __index = function(tbl, id)
|
||||||
local obj = setmetatable({frameID = id}, SavedFrameSettings.mt)
|
local obj = setmetatable({ frameID = id }, SavedFrameSettings.mt)
|
||||||
tbl[id] = obj
|
tbl[id] = obj
|
||||||
return obj
|
return obj
|
||||||
end})
|
end })
|
||||||
|
|
||||||
function SavedFrameSettings:Get(id)
|
function SavedFrameSettings:Get(id)
|
||||||
return self.objects[id]
|
return self.objects[id]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Events
|
Events
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
--create an event handler
|
--create an event handler
|
||||||
do
|
do
|
||||||
@@ -79,10 +77,9 @@ function SavedFrameSettings:PLAYER_LOGOUT()
|
|||||||
self:ClearDefaults()
|
self:ClearDefaults()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Accessor Methods
|
Accessor Methods
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
--get settings for all frames
|
--get settings for all frames
|
||||||
--only one instance of this for everything (hence the lack of self use)
|
--only one instance of this for everything (hence the lack of self use)
|
||||||
@@ -124,15 +121,14 @@ function SavedFrameSettings:GetFrameID()
|
|||||||
return self.frameID
|
return self.frameID
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Upgrade Methods
|
Upgrade Methods
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function SavedFrameSettings:UpgradeDB()
|
function SavedFrameSettings:UpgradeDB()
|
||||||
local major, minor, bugfix = self:GetDBVersion():match('(%w+)%.(%w+)%.(%w+)')
|
local major, minor, bugfix = self:GetDBVersion():match('(%w+)%.(%w+)%.(%w+)')
|
||||||
local db = self:GetGlobalDB()
|
local db = self:GetGlobalDB()
|
||||||
|
|
||||||
--hidden bags upgrade
|
--hidden bags upgrade
|
||||||
for frameID, settings in pairs(db.frames) do
|
for frameID, settings in pairs(db.frames) do
|
||||||
local hiddenBags = settings.hiddenBags
|
local hiddenBags = settings.hiddenBags
|
||||||
@@ -166,19 +162,18 @@ function SavedFrameSettings:ClearDefaults()
|
|||||||
|
|
||||||
for frameID, settings in pairs(db.frames) do
|
for frameID, settings in pairs(db.frames) do
|
||||||
removeDefaults(settings, self:GetDefaultSettings(frameID))
|
removeDefaults(settings, self:GetDefaultSettings(frameID))
|
||||||
|
|
||||||
if next(settings) == nil then
|
if next(settings) == nil then
|
||||||
db[frameID] = nil
|
db[frameID] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Update Methods
|
Update Methods
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
--[[ Frame Color ]]--
|
--[[ Frame Color ]] --
|
||||||
|
|
||||||
--background
|
--background
|
||||||
function SavedFrameSettings:SetColor(r, g, b, a)
|
function SavedFrameSettings:SetColor(r, g, b, a)
|
||||||
@@ -208,8 +203,7 @@ function SavedFrameSettings:GetBorderColor()
|
|||||||
return r, g, b, a
|
return r, g, b, a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Frame Position ]] --
|
||||||
--[[ Frame Position ]]--
|
|
||||||
|
|
||||||
function SavedFrameSettings:SetPosition(point, x, y)
|
function SavedFrameSettings:SetPosition(point, x, y)
|
||||||
local db = self:GetDB()
|
local db = self:GetDB()
|
||||||
@@ -223,8 +217,7 @@ function SavedFrameSettings:GetPosition()
|
|||||||
return db.point, db.x, db.y
|
return db.point, db.x, db.y
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Frame Scale ]] --
|
||||||
--[[ Frame Scale ]]--
|
|
||||||
|
|
||||||
function SavedFrameSettings:SetScale(scale)
|
function SavedFrameSettings:SetScale(scale)
|
||||||
self:GetDB().scale = scale
|
self:GetDB().scale = scale
|
||||||
@@ -234,8 +227,7 @@ function SavedFrameSettings:GetScale()
|
|||||||
return self:GetDB().scale
|
return self:GetDB().scale
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Frame Opacity ]] --
|
||||||
--[[ Frame Opacity ]]--
|
|
||||||
|
|
||||||
function SavedFrameSettings:SetOpacity(opacity)
|
function SavedFrameSettings:SetOpacity(opacity)
|
||||||
self:GetDB().opacity = opacity
|
self:GetDB().opacity = opacity
|
||||||
@@ -245,8 +237,7 @@ function SavedFrameSettings:GetOpacity()
|
|||||||
return self:GetDB().opacity
|
return self:GetDB().opacity
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Frame Layer]] --
|
||||||
--[[ Frame Layer]]--
|
|
||||||
|
|
||||||
function SavedFrameSettings:SetLayer(layer)
|
function SavedFrameSettings:SetLayer(layer)
|
||||||
self:GetDB().frameLayer = layer
|
self:GetDB().frameLayer = layer
|
||||||
@@ -256,8 +247,7 @@ function SavedFrameSettings:GetLayer()
|
|||||||
return self:GetDB().frameLayer
|
return self:GetDB().frameLayer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Frame Components ]] --
|
||||||
--[[ Frame Components ]]--
|
|
||||||
|
|
||||||
function SavedFrameSettings:SetHasBagFrame(enable)
|
function SavedFrameSettings:SetHasBagFrame(enable)
|
||||||
self:GetDB().hasBagFrame = enable or false
|
self:GetDB().hasBagFrame = enable or false
|
||||||
@@ -291,6 +281,14 @@ function SavedFrameSettings:HasSearchToggle()
|
|||||||
return self:GetDB().hasSearchToggle
|
return self:GetDB().hasSearchToggle
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SavedFrameSettings:SetHasSortBtn(enable)
|
||||||
|
self:GetDB().hasSortBtn = enable or false
|
||||||
|
end
|
||||||
|
|
||||||
|
function SavedFrameSettings:HasSortBtn()
|
||||||
|
return self:GetDB().hasSortBtn
|
||||||
|
end
|
||||||
|
|
||||||
function SavedFrameSettings:SetHasOptionsToggle(enable)
|
function SavedFrameSettings:SetHasOptionsToggle(enable)
|
||||||
self:GetDB().hasOptionsToggle = enable or false
|
self:GetDB().hasOptionsToggle = enable or false
|
||||||
end
|
end
|
||||||
@@ -299,8 +297,7 @@ function SavedFrameSettings:HasOptionsToggle()
|
|||||||
return self:GetDB().hasOptionsToggle
|
return self:GetDB().hasOptionsToggle
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Frame Bags ]] --
|
||||||
--[[ Frame Bags ]]--
|
|
||||||
|
|
||||||
--show a bag
|
--show a bag
|
||||||
function SavedFrameSettings:ShowBag(bag)
|
function SavedFrameSettings:ShowBag(bag)
|
||||||
@@ -326,8 +323,7 @@ function SavedFrameSettings:GetHiddenBags()
|
|||||||
return self:GetDB().hiddenBags
|
return self:GetDB().hiddenBags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Item Frame Layout ]] --
|
||||||
--[[ Item Frame Layout ]]--
|
|
||||||
|
|
||||||
--columns
|
--columns
|
||||||
function SavedFrameSettings:SetItemFrameColumns(columns)
|
function SavedFrameSettings:SetItemFrameColumns(columns)
|
||||||
@@ -356,8 +352,7 @@ function SavedFrameSettings:IsBagBreakEnabled()
|
|||||||
return self:GetDB().bagBreak
|
return self:GetDB().bagBreak
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Item Frame Slot ORdering ]] --
|
||||||
--[[ Item Frame Slot ORdering ]]--
|
|
||||||
|
|
||||||
function SavedFrameSettings:SetReverseSlotOrder(enable)
|
function SavedFrameSettings:SetReverseSlotOrder(enable)
|
||||||
self:GetDB().reverseSlotOrder = enable
|
self:GetDB().reverseSlotOrder = enable
|
||||||
@@ -367,8 +362,7 @@ function SavedFrameSettings:IsSlotOrderReversed()
|
|||||||
return self:GetDB().reverseSlotOrder
|
return self:GetDB().reverseSlotOrder
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Databroker Display Object ]] --
|
||||||
--[[ Databroker Display Object ]]--
|
|
||||||
|
|
||||||
function SavedFrameSettings:SetBrokerDisplayObject(objectName)
|
function SavedFrameSettings:SetBrokerDisplayObject(objectName)
|
||||||
self:GetDB().dataBrokerObject = objectName
|
self:GetDB().dataBrokerObject = objectName
|
||||||
@@ -378,10 +372,9 @@ function SavedFrameSettings:GetBrokerDisplayObject()
|
|||||||
return self:GetDB().dataBrokerObject
|
return self:GetDB().dataBrokerObject
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[---------------------------------------------------------------------------
|
--[[---------------------------------------------------------------------------
|
||||||
Frame Defaults
|
Frame Defaults
|
||||||
--]]---------------------------------------------------------------------------
|
--]] ---------------------------------------------------------------------------
|
||||||
|
|
||||||
--generic
|
--generic
|
||||||
function SavedFrameSettings:GetDefaultSettings(frameID)
|
function SavedFrameSettings:GetDefaultSettings(frameID)
|
||||||
@@ -402,9 +395,9 @@ end
|
|||||||
function SavedFrameSettings:GetDefaultInventorySettings()
|
function SavedFrameSettings:GetDefaultInventorySettings()
|
||||||
local defaults = SavedFrameSettings.invDefaults or {
|
local defaults = SavedFrameSettings.invDefaults or {
|
||||||
--bag settings
|
--bag settings
|
||||||
availableBags = {BACKPACK_CONTAINER, 1, 2, 3, 4, KEYRING_CONTAINER},
|
availableBags = { BACKPACK_CONTAINER, 1, 2, 3, 4, KEYRING_CONTAINER },
|
||||||
|
|
||||||
hiddenBags = {
|
hiddenBags = {
|
||||||
[BACKPACK_CONTAINER] = false,
|
[BACKPACK_CONTAINER] = false,
|
||||||
[1] = false,
|
[1] = false,
|
||||||
[2] = false,
|
[2] = false,
|
||||||
@@ -414,8 +407,8 @@ function SavedFrameSettings:GetDefaultInventorySettings()
|
|||||||
},
|
},
|
||||||
|
|
||||||
--frame
|
--frame
|
||||||
frameColor = {0, 0, 0, 0.5},
|
frameColor = { 0, 0, 0, 0.5 },
|
||||||
frameBorderColor = {1, 1, 1, 1},
|
frameBorderColor = { 1, 1, 1, 1 },
|
||||||
scale = 1,
|
scale = 1,
|
||||||
opacity = 1,
|
opacity = 1,
|
||||||
point = 'BOTTOMRIGHT',
|
point = 'BOTTOMRIGHT',
|
||||||
@@ -433,12 +426,13 @@ function SavedFrameSettings:GetDefaultInventorySettings()
|
|||||||
hasBagFrame = true,
|
hasBagFrame = true,
|
||||||
hasDBOFrame = true,
|
hasDBOFrame = true,
|
||||||
hasSearchToggle = true,
|
hasSearchToggle = true,
|
||||||
|
hasSortBtn = true,
|
||||||
hasOptionsToggle = true,
|
hasOptionsToggle = true,
|
||||||
hasKeyringToggle = true,
|
hasKeyringToggle = true,
|
||||||
|
|
||||||
--dbo display object
|
--dbo display object
|
||||||
dataBrokerObject = 'BagnonLauncher',
|
dataBrokerObject = 'BagnonLauncher',
|
||||||
|
|
||||||
--slot ordering
|
--slot ordering
|
||||||
reverseSlotOrder = false,
|
reverseSlotOrder = false,
|
||||||
}
|
}
|
||||||
@@ -451,7 +445,7 @@ end
|
|||||||
function SavedFrameSettings:GetDefaultBankSettings()
|
function SavedFrameSettings:GetDefaultBankSettings()
|
||||||
local defaults = SavedFrameSettings.bankDefaults or {
|
local defaults = SavedFrameSettings.bankDefaults or {
|
||||||
--bag settings
|
--bag settings
|
||||||
availableBags = {BANK_CONTAINER, 5, 6, 7, 8, 9, 10, 11},
|
availableBags = { BANK_CONTAINER, 5, 6, 7, 8, 9, 10, 11 },
|
||||||
hiddenBags = {
|
hiddenBags = {
|
||||||
[BANK_CONTAINER] = false,
|
[BANK_CONTAINER] = false,
|
||||||
[5] = false,
|
[5] = false,
|
||||||
@@ -464,8 +458,8 @@ function SavedFrameSettings:GetDefaultBankSettings()
|
|||||||
},
|
},
|
||||||
|
|
||||||
--frame
|
--frame
|
||||||
frameColor = {0, 0, 0, 0.5},
|
frameColor = { 0, 0, 0, 0.5 },
|
||||||
frameBorderColor = {1, 1, 0, 1},
|
frameBorderColor = { 1, 1, 0, 1 },
|
||||||
scale = 1,
|
scale = 1,
|
||||||
opacity = 1,
|
opacity = 1,
|
||||||
point = 'BOTTOMLEFT',
|
point = 'BOTTOMLEFT',
|
||||||
@@ -483,12 +477,13 @@ function SavedFrameSettings:GetDefaultBankSettings()
|
|||||||
hasBagFrame = true,
|
hasBagFrame = true,
|
||||||
hasDBOFrame = true,
|
hasDBOFrame = true,
|
||||||
hasSearchToggle = true,
|
hasSearchToggle = true,
|
||||||
|
hasSortBtn = false,
|
||||||
hasOptionsToggle = true,
|
hasOptionsToggle = true,
|
||||||
hasKeyringToggle = false,
|
hasKeyringToggle = false,
|
||||||
|
|
||||||
--dbo display object
|
--dbo display object
|
||||||
dataBrokerObject = 'BagnonLauncher',
|
dataBrokerObject = 'BagnonLauncher',
|
||||||
|
|
||||||
--slot ordering
|
--slot ordering
|
||||||
reverseSlotOrder = false,
|
reverseSlotOrder = false,
|
||||||
}
|
}
|
||||||
@@ -500,14 +495,14 @@ end
|
|||||||
function SavedFrameSettings:GetDefaultKeyRingSettings()
|
function SavedFrameSettings:GetDefaultKeyRingSettings()
|
||||||
local defaults = SavedFrameSettings.keyDefaults or {
|
local defaults = SavedFrameSettings.keyDefaults or {
|
||||||
--bag settings
|
--bag settings
|
||||||
availableBags = {KEYRING_CONTAINER},
|
availableBags = { KEYRING_CONTAINER },
|
||||||
hiddenBags = {
|
hiddenBags = {
|
||||||
[KEYRING_CONTAINER] = false
|
[KEYRING_CONTAINER] = false
|
||||||
},
|
},
|
||||||
|
|
||||||
--frame,
|
--frame,
|
||||||
frameColor = {0, 0, 0, 0.5},
|
frameColor = { 0, 0, 0, 0.5 },
|
||||||
frameBorderColor = {0, 1, 1, 1},
|
frameBorderColor = { 0, 1, 1, 1 },
|
||||||
scale = 1,
|
scale = 1,
|
||||||
opacity = 1,
|
opacity = 1,
|
||||||
point = 'BOTTOMRIGHT',
|
point = 'BOTTOMRIGHT',
|
||||||
@@ -525,12 +520,13 @@ function SavedFrameSettings:GetDefaultKeyRingSettings()
|
|||||||
hasBagFrame = false,
|
hasBagFrame = false,
|
||||||
hasDBOFrame = false,
|
hasDBOFrame = false,
|
||||||
hasSearchToggle = false,
|
hasSearchToggle = false,
|
||||||
|
hasSortBtn = false,
|
||||||
hasOptionsToggle = true,
|
hasOptionsToggle = true,
|
||||||
hasKeyringToggle = false,
|
hasKeyringToggle = false,
|
||||||
|
|
||||||
--dbo display object
|
--dbo display object
|
||||||
dataBrokerObject = 'BagnonLauncher',
|
dataBrokerObject = 'BagnonLauncher',
|
||||||
|
|
||||||
--slot ordering
|
--slot ordering
|
||||||
reverseSlotOrder = false,
|
reverseSlotOrder = false,
|
||||||
}
|
}
|
||||||
@@ -540,4 +536,4 @@ end
|
|||||||
|
|
||||||
function SavedFrameSettings:GetDefaultGuildBankSettings()
|
function SavedFrameSettings:GetDefaultGuildBankSettings()
|
||||||
return self:GetDefaultInventorySettings()
|
return self:GetDefaultInventorySettings()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,269 @@
|
|||||||
|
--[[
|
||||||
|
sortBtn.lua
|
||||||
|
imagine a button that sorts your inventory in Bagnon, crazy am I right?!1
|
||||||
|
--]]
|
||||||
|
|
||||||
|
local Bagnon = LibStub('AceAddon-3.0'):GetAddon('Bagnon')
|
||||||
|
local L = LibStub('AceLocale-3.0'):GetLocale('Bagnon')
|
||||||
|
local SortBtn = Bagnon.Classy:New('Button')
|
||||||
|
Bagnon.SortBtn = SortBtn
|
||||||
|
|
||||||
|
local SIZE = 20
|
||||||
|
local NORMAL_TEXTURE_SIZE = 64 * (SIZE / 36)
|
||||||
|
|
||||||
|
-- Bag Sorter code from Sushi Regular
|
||||||
|
local moves = {};
|
||||||
|
local frame = CreateFrame("Frame");
|
||||||
|
local t = 0;
|
||||||
|
local current = nil;
|
||||||
|
|
||||||
|
local function GetIDFromLink(link)
|
||||||
|
return link and tonumber(string.match(link, "item:(%d+)"));
|
||||||
|
end
|
||||||
|
|
||||||
|
local function DoMoves()
|
||||||
|
while (current ~= nil or #moves > 0) do
|
||||||
|
if current ~= nil then
|
||||||
|
if CursorHasItem() then
|
||||||
|
local _, id = GetCursorInfo();
|
||||||
|
if (current ~= nil and current.id == id) then
|
||||||
|
if (current.sourcebag ~= nil) then
|
||||||
|
PickupContainerItem(current.targetbag, current.targetslot);
|
||||||
|
local link = select(7, GetContainerItemInfo(current.targetbag, current.targetslot));
|
||||||
|
if (current.id ~= GetIDFromLink(link)) then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
moves = {};
|
||||||
|
current = nil;
|
||||||
|
frame:Hide();
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if (current.sourcebag ~= nil) then
|
||||||
|
local link = select(7, GetContainerItemInfo(current.targetbag, current.targetslot));
|
||||||
|
if (current.id ~= GetIDFromLink(link)) then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
current = nil;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if (#moves > 0) then
|
||||||
|
current = table.remove(moves, 1);
|
||||||
|
if (current.sourcebag ~= nil) then
|
||||||
|
PickupContainerItem(current.sourcebag, current.sourceslot);
|
||||||
|
if CursorHasItem() == false then
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
PickupContainerItem(current.targetbag, current.targetslot);
|
||||||
|
local link = select(7, GetContainerItemInfo(current.targetbag, current.targetslot));
|
||||||
|
if (current.id == GetIDFromLink(link)) then
|
||||||
|
current = nil;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
frame:Hide();
|
||||||
|
end
|
||||||
|
|
||||||
|
local function CompareItems(lItem, rItem)
|
||||||
|
if (rItem.id == nil) then
|
||||||
|
return true;
|
||||||
|
elseif (lItem.id == nil) then
|
||||||
|
return false;
|
||||||
|
elseif (lItem.class ~= rItem.class) then
|
||||||
|
return (lItem.class < rItem.class);
|
||||||
|
elseif (lItem.subclass ~= rItem.subclass) then
|
||||||
|
return (lItem.subclass < rItem.subclass);
|
||||||
|
elseif (lItem.quality ~= rItem.quality) then
|
||||||
|
return (lItem.quality > rItem.quality);
|
||||||
|
elseif (lItem.name ~= rItem.name) then
|
||||||
|
return (lItem.name < rItem.name);
|
||||||
|
elseif ((lItem.count) ~= (rItem.count)) then
|
||||||
|
return ((lItem.count) >= (rItem.count));
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function BeginSort()
|
||||||
|
current = nil;
|
||||||
|
moves = {};
|
||||||
|
ClearCursor();
|
||||||
|
end
|
||||||
|
|
||||||
|
local function SortBag(bag)
|
||||||
|
for i = 1, #bag, 1 do
|
||||||
|
local lowest = i;
|
||||||
|
for j = #bag, i + 1, -1 do
|
||||||
|
if (CompareItems(bag[lowest], bag[j]) == false) then
|
||||||
|
lowest = j;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (i ~= lowest) then
|
||||||
|
-- store move
|
||||||
|
move = {};
|
||||||
|
move.id = bag[lowest].id;
|
||||||
|
move.name = bag[lowest].name;
|
||||||
|
move.sourcebag = bag[lowest].bag;
|
||||||
|
move.sourcetab = bag[lowest].tab;
|
||||||
|
move.sourceslot = bag[lowest].slot;
|
||||||
|
move.targetbag = bag[i].bag;
|
||||||
|
move.targettab = bag[i].tab;
|
||||||
|
move.targetslot = bag[i].slot;
|
||||||
|
table.insert(moves, move);
|
||||||
|
|
||||||
|
-- swap items
|
||||||
|
local tmp = bag[i];
|
||||||
|
bag[i] = bag[lowest];
|
||||||
|
bag[lowest] = tmp;
|
||||||
|
|
||||||
|
-- swap slots
|
||||||
|
tmp = bag[i].slot;
|
||||||
|
bag[i].slot = bag[lowest].slot;
|
||||||
|
bag[lowest].slot = tmp;
|
||||||
|
tmp = bag[i].bag;
|
||||||
|
bag[i].bag = bag[lowest].bag;
|
||||||
|
bag[lowest].bag = tmp;
|
||||||
|
tmp = bag[i].tab;
|
||||||
|
bag[i].tab = bag[lowest].tab;
|
||||||
|
bag[lowest].tab = tmp;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function CreateBagFromID(bagID)
|
||||||
|
local items = GetContainerNumSlots(bagID);
|
||||||
|
local bag = {};
|
||||||
|
|
||||||
|
for i = 1, items, 1 do
|
||||||
|
local item = {};
|
||||||
|
local _, count, _, _, _, _, link = GetContainerItemInfo(bagID, i);
|
||||||
|
item.bag = bagID;
|
||||||
|
item.slot = i;
|
||||||
|
item.name = "<EMPTY>";
|
||||||
|
item.id = GetIDFromLink(link);
|
||||||
|
if (item.id ~= nil) then
|
||||||
|
item.count = count;
|
||||||
|
item.name, _, item.quality, _, _, item.class, item.subclass, _, item.type, _, item.price = GetItemInfo(item.id);
|
||||||
|
end
|
||||||
|
table.insert(bag, item);
|
||||||
|
end
|
||||||
|
return bag;
|
||||||
|
end
|
||||||
|
|
||||||
|
frame:SetScript("OnUpdate", function()
|
||||||
|
t = t + arg1;
|
||||||
|
if t > 0.03 then
|
||||||
|
t = 0
|
||||||
|
DoMoves();
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
frame:Hide();
|
||||||
|
--
|
||||||
|
|
||||||
|
--[[ Constructor ]] --
|
||||||
|
function SortBtn:New(frameID, parent)
|
||||||
|
local b = self:Bind(CreateFrame('Button', nil, parent))
|
||||||
|
b:SetWidth(SIZE)
|
||||||
|
b:SetHeight(SIZE)
|
||||||
|
b:RegisterForClicks('anyUp')
|
||||||
|
|
||||||
|
local nt = b:CreateTexture()
|
||||||
|
nt:SetTexture([[Interface\Buttons\UI-Quickslot2]])
|
||||||
|
nt:SetWidth(NORMAL_TEXTURE_SIZE)
|
||||||
|
nt:SetHeight(NORMAL_TEXTURE_SIZE)
|
||||||
|
nt:SetPoint('CENTER', 0, -1)
|
||||||
|
b:SetNormalTexture(nt)
|
||||||
|
|
||||||
|
local pt = b:CreateTexture()
|
||||||
|
pt:SetTexture([[Interface\Buttons\UI-Quickslot-Depress]])
|
||||||
|
pt:SetAllPoints(b)
|
||||||
|
b:SetPushedTexture(pt)
|
||||||
|
|
||||||
|
local ht = b:CreateTexture()
|
||||||
|
ht:SetTexture([[Interface\Buttons\ButtonHilight-Square]])
|
||||||
|
ht:SetAllPoints(b)
|
||||||
|
b:SetHighlightTexture(ht)
|
||||||
|
|
||||||
|
local icon = b:CreateTexture()
|
||||||
|
icon:SetAllPoints(b)
|
||||||
|
icon:SetTexture([[Interface\Icons\ability_racial_bagoftricks]])
|
||||||
|
|
||||||
|
b:SetScript('OnClick', b.OnClick)
|
||||||
|
b:SetScript('OnEnter', b.OnEnter)
|
||||||
|
b:SetScript('OnLeave', b.OnLeave)
|
||||||
|
b:SetFrameID(frameID)
|
||||||
|
|
||||||
|
return b
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[ Frame Events ]] --
|
||||||
|
function SortBtn:OnClick()
|
||||||
|
local bags = {};
|
||||||
|
for i = 0, NUM_BAG_FRAMES, 1 do
|
||||||
|
local bag = CreateBagFromID(i);
|
||||||
|
local type = select(2, GetContainerNumFreeSlots(i));
|
||||||
|
if type == nil then
|
||||||
|
type = "ALL"
|
||||||
|
else
|
||||||
|
type = tostring(type);
|
||||||
|
end
|
||||||
|
if bags[type] == nil then
|
||||||
|
bags[type] = bag;
|
||||||
|
else
|
||||||
|
for j = 1, #bag, 1 do
|
||||||
|
table.insert(bags[type], bag[j]);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
BeginSort();
|
||||||
|
for k, v in pairs(bags) do
|
||||||
|
if v ~= nil then
|
||||||
|
SortBag(v);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
frame:Show();
|
||||||
|
end
|
||||||
|
|
||||||
|
function SortBtn:OnEnter()
|
||||||
|
if self:GetRight() > (GetScreenWidth() / 2) then
|
||||||
|
GameTooltip:SetOwner(self, 'ANCHOR_LEFT')
|
||||||
|
else
|
||||||
|
GameTooltip:SetOwner(self, 'ANCHOR_RIGHT')
|
||||||
|
end
|
||||||
|
self:UpdateTooltip()
|
||||||
|
end
|
||||||
|
|
||||||
|
function SortBtn:OnLeave()
|
||||||
|
if GameTooltip:IsOwned(self) then
|
||||||
|
GameTooltip:Hide()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[ Update Methods ]] --
|
||||||
|
|
||||||
|
function SortBtn:UpdateTooltip()
|
||||||
|
if GameTooltip:IsOwned(self) then
|
||||||
|
GameTooltip:SetText(L.TipShowSortBtn)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--[[ Properties ]] --
|
||||||
|
|
||||||
|
function SortBtn:SetFrameID(frameID)
|
||||||
|
if self:GetFrameID() ~= frameID then
|
||||||
|
self.frameID = frameID
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function SortBtn:GetFrameID()
|
||||||
|
return self.frameID
|
||||||
|
end
|
||||||
@@ -44,6 +44,7 @@ L.TipShowBags = 'Click to show the bag frame.'
|
|||||||
L.TipShowMenu = 'Right-Click to configure this frame.'
|
L.TipShowMenu = 'Right-Click to configure this frame.'
|
||||||
L.TipShowSearch = 'Click to show the search frame.'
|
L.TipShowSearch = 'Click to show the search frame.'
|
||||||
L.TipShowSearch = 'Click to search.'
|
L.TipShowSearch = 'Click to search.'
|
||||||
|
L.TipShowSortBtn = 'Click to sort your inventory.'
|
||||||
L.TipShowFrameConfig = 'Click to configure this frame.'
|
L.TipShowFrameConfig = 'Click to configure this frame.'
|
||||||
L.TipDoubleClickSearch = 'Alt-Drag to move.\nRight-Click to configure.\nDouble-Click to search.'
|
L.TipDoubleClickSearch = 'Alt-Drag to move.\nRight-Click to configure.\nDouble-Click to search.'
|
||||||
L.Total = 'Total'
|
L.Total = 'Total'
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ L.KeyRing = 'Keyring'
|
|||||||
L.GuildBank = 'Guild Bank'
|
L.GuildBank = 'Guild Bank'
|
||||||
L.LockFramePositions = 'Lock frame positions'
|
L.LockFramePositions = 'Lock frame positions'
|
||||||
L.ShowEmptyItemSlotBackground = 'Display a background for empty item slots'
|
L.ShowEmptyItemSlotBackground = 'Display a background for empty item slots'
|
||||||
L.HighlightItemsByQuality = 'Highlight items by quality'
|
L.HighlightItemsByQuality = 'Highlight items by quality'
|
||||||
L.HighlightQuestItems = 'Highlight quest items'
|
L.HighlightQuestItems = 'Highlight quest items'
|
||||||
L.ReverseSlotOrdering = 'Reverse bag slot ordering'
|
L.ReverseSlotOrdering = 'Reverse bag slot ordering'
|
||||||
L.ColorItemSlotsByBagType = 'Color empty item slots by bag type'
|
L.ColorItemSlotsByBagType = 'Color empty item slots by bag type'
|
||||||
@@ -27,6 +27,7 @@ L.EnableBagFrame = 'Enable bag frame'
|
|||||||
L.EnableMoneyFrame = 'Enable money frame'
|
L.EnableMoneyFrame = 'Enable money frame'
|
||||||
L.EnableDBOFrame = 'Enable databroker frame'
|
L.EnableDBOFrame = 'Enable databroker frame'
|
||||||
L.EnableSearchToggle = 'Enable search toggle'
|
L.EnableSearchToggle = 'Enable search toggle'
|
||||||
|
L.EnableSortBtn = "Enable sort button"
|
||||||
L.EnableOptionsToggle = 'Enable options toggle'
|
L.EnableOptionsToggle = 'Enable options toggle'
|
||||||
L.EnableFrame_inventory = 'Enable inventory frame'
|
L.EnableFrame_inventory = 'Enable inventory frame'
|
||||||
L.EnableFrame_bank = 'Enable bank frame'
|
L.EnableFrame_bank = 'Enable bank frame'
|
||||||
@@ -54,4 +55,4 @@ L.ItemHighlightOpacity = 'Item highlight brightness'
|
|||||||
L.ItemSlotColor_ammo = 'Ammo bag slot color'
|
L.ItemSlotColor_ammo = 'Ammo bag slot color'
|
||||||
L.ItemSlotColor_trade = 'Trade bag slot color'
|
L.ItemSlotColor_trade = 'Trade bag slot color'
|
||||||
L.ItemSlotColor_shard = 'Soul bag slot color'
|
L.ItemSlotColor_shard = 'Soul bag slot color'
|
||||||
L.ItemSlotColor_keyring = 'Keyring slot color'
|
L.ItemSlotColor_keyring = 'Keyring slot color'
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ function FrameOptions:ShowFrame(frameID)
|
|||||||
InterfaceOptionsFrame_OpenToCategory(self)
|
InterfaceOptionsFrame_OpenToCategory(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Messages
|
Messages
|
||||||
--]]
|
--]]
|
||||||
@@ -53,6 +52,7 @@ function FrameOptions:UpdateMessages()
|
|||||||
self:RegisterMessage('DATABROKER_FRAME_ENABLE_UPDATE')
|
self:RegisterMessage('DATABROKER_FRAME_ENABLE_UPDATE')
|
||||||
self:RegisterMessage('SEARCH_TOGGLE_ENABLE_UPDATE')
|
self:RegisterMessage('SEARCH_TOGGLE_ENABLE_UPDATE')
|
||||||
self:RegisterMessage('SLOT_ORDER_UPDATE')
|
self:RegisterMessage('SLOT_ORDER_UPDATE')
|
||||||
|
self:RegisterMessage('SORT_BTN_ENABLE_UPDATE')
|
||||||
self:RegisterMessage('OPTIONS_TOGGLE_ENABLE_UPDATE')
|
self:RegisterMessage('OPTIONS_TOGGLE_ENABLE_UPDATE')
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -134,13 +134,18 @@ function FrameOptions:ITEM_FRAME_BAG_BREAK_UPDATE(msg, frameID, enable)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function FrameOptions:SORT_BTN_ENABLE_UPDATE(msg, frameID, enable)
|
||||||
|
if self:GetFrameID() == frameID then
|
||||||
|
self:GetSortBtnCheckBox():UpdateChecked()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function FrameOptions:OPTIONS_TOGGLE_ENABLE_UPDATE(msg, frameID, enable)
|
function FrameOptions:OPTIONS_TOGGLE_ENABLE_UPDATE(msg, frameID, enable)
|
||||||
if self:GetFrameID() == frameID then
|
if self:GetFrameID() == frameID then
|
||||||
self:GetToggleOptionsCheckbox():UpdateChecked()
|
self:GetToggleOptionsCheckbox():UpdateChecked()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Frame Events
|
Frame Events
|
||||||
--]]
|
--]]
|
||||||
@@ -154,20 +159,19 @@ function FrameOptions:OnHide()
|
|||||||
self:UpdateMessages()
|
self:UpdateMessages()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Components
|
Components
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
function FrameOptions:AddWidgets()
|
function FrameOptions:AddWidgets()
|
||||||
--[[ Dropdowns ]]--
|
--[[ Dropdowns ]] --
|
||||||
|
|
||||||
--add frame selector
|
--add frame selector
|
||||||
local frameSelector = self:CreateFrameSelector()
|
local frameSelector = self:CreateFrameSelector()
|
||||||
frameSelector:SetPoint('TOPLEFT', self, 'TOPLEFT', -4, -64)
|
frameSelector:SetPoint('TOPLEFT', self, 'TOPLEFT', -4, -64)
|
||||||
|
|
||||||
|
|
||||||
--[[ Checkboxes ]]--
|
--[[ Checkboxes ]] --
|
||||||
|
|
||||||
local toggleBagFrame = self:CreateToggleBagFrameCheckbox()
|
local toggleBagFrame = self:CreateToggleBagFrameCheckbox()
|
||||||
toggleBagFrame:SetPoint('TOPLEFT', frameSelector, 'BOTTOMLEFT', 16, -4)
|
toggleBagFrame:SetPoint('TOPLEFT', frameSelector, 'BOTTOMLEFT', 16, -4)
|
||||||
@@ -180,18 +184,21 @@ function FrameOptions:AddWidgets()
|
|||||||
|
|
||||||
local toggleSearchFrame = self:CreateToggleSearchFrameCheckbox()
|
local toggleSearchFrame = self:CreateToggleSearchFrameCheckbox()
|
||||||
toggleSearchFrame:SetPoint('TOPLEFT', toggleDBOFrame, 'BOTTOMLEFT', 0, -CHECK_BUTTON_SPACING)
|
toggleSearchFrame:SetPoint('TOPLEFT', toggleDBOFrame, 'BOTTOMLEFT', 0, -CHECK_BUTTON_SPACING)
|
||||||
|
|
||||||
|
local sortBtnFrame = self:CreateBtnSortCheckbox()
|
||||||
|
sortBtnFrame:SetPoint('TOPLEFT', toggleSearchFrame, 'BOTTOMLEFT', 0, -CHECK_BUTTON_SPACING)
|
||||||
|
|
||||||
local toggleOptionsFrame = self:CreateToggleOptionsCheckbox()
|
local toggleOptionsFrame = self:CreateToggleOptionsCheckbox()
|
||||||
toggleOptionsFrame:SetPoint('TOPLEFT', toggleSearchFrame, 'BOTTOMLEFT', 0, -CHECK_BUTTON_SPACING)
|
toggleOptionsFrame:SetPoint('TOPLEFT', sortBtnFrame, 'BOTTOMLEFT', 0, -CHECK_BUTTON_SPACING)
|
||||||
|
|
||||||
local reverseSlotOrdering = self:CreateReverseSlotOrderCheckbox()
|
local reverseSlotOrdering = self:CreateReverseSlotOrderCheckbox()
|
||||||
reverseSlotOrdering:SetPoint('TOPLEFT', toggleOptionsFrame, 'BOTTOMLEFT', 0, -CHECK_BUTTON_SPACING)
|
reverseSlotOrdering:SetPoint('TOPLEFT', toggleOptionsFrame, 'BOTTOMLEFT', 0, -CHECK_BUTTON_SPACING)
|
||||||
|
|
||||||
local bagBreak = self:CreateBagBreakCheckbox()
|
local bagBreak = self:CreateBagBreakCheckbox()
|
||||||
bagBreak:SetPoint('TOPLEFT', reverseSlotOrdering, 'BOTTOMLEFT', 0, -CHECK_BUTTON_SPACING)
|
bagBreak:SetPoint('TOPLEFT', reverseSlotOrdering, 'BOTTOMLEFT', 0, -CHECK_BUTTON_SPACING)
|
||||||
|
|
||||||
|
|
||||||
--[[ Color Selectors ]]--
|
--[[ Color Selectors ]] --
|
||||||
|
|
||||||
--add color selector
|
--add color selector
|
||||||
local frameColor = self:CreateColorSelector()
|
local frameColor = self:CreateColorSelector()
|
||||||
@@ -202,7 +209,7 @@ function FrameOptions:AddWidgets()
|
|||||||
frameBorderColor:SetPoint('TOPLEFT', frameColor, 'BOTTOMLEFT', 0, -8)
|
frameBorderColor:SetPoint('TOPLEFT', frameColor, 'BOTTOMLEFT', 0, -8)
|
||||||
|
|
||||||
|
|
||||||
--[[ Sliders ]]--
|
--[[ Sliders ]] --
|
||||||
|
|
||||||
--add opacity slider
|
--add opacity slider
|
||||||
local opacity = self:CreateOpacitySlider()
|
local opacity = self:CreateOpacitySlider()
|
||||||
@@ -249,17 +256,17 @@ function FrameOptions:UpdateWidgets()
|
|||||||
self:GetToggleMoneyFrameCheckbox():UpdateChecked()
|
self:GetToggleMoneyFrameCheckbox():UpdateChecked()
|
||||||
self:GetToggleDBOFrameCheckbox():UpdateChecked()
|
self:GetToggleDBOFrameCheckbox():UpdateChecked()
|
||||||
self:GetToggleSearchFrameCheckbox():UpdateChecked()
|
self:GetToggleSearchFrameCheckbox():UpdateChecked()
|
||||||
|
self:GetSortBtnCheckBox():UpdateChecked()
|
||||||
self:GetToggleOptionsCheckbox():UpdateChecked()
|
self:GetToggleOptionsCheckbox():UpdateChecked()
|
||||||
|
|
||||||
self:GetReverseSlotOrderCheckbox():UpdateChecked()
|
self:GetReverseSlotOrderCheckbox():UpdateChecked()
|
||||||
self:GetReverseSlotOrderCheckbox():SetDisabled(self:GetFrameID() == 'guildbank')
|
self:GetReverseSlotOrderCheckbox():SetDisabled(self:GetFrameID() == 'guildbank')
|
||||||
|
|
||||||
self:GetBagBreakCheckbox():UpdateChecked()
|
self:GetBagBreakCheckbox():UpdateChecked()
|
||||||
self:GetBagBreakCheckbox():SetDisabled(self:GetFrameID() == 'keys' or self:GetFrameID() == 'guildbank')
|
self:GetBagBreakCheckbox():SetDisabled(self:GetFrameID() == 'keys' or self:GetFrameID() == 'guildbank')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Dropdowns ]] --
|
||||||
--[[ Dropdowns ]]--
|
|
||||||
|
|
||||||
--frame selector
|
--frame selector
|
||||||
function FrameOptions:CreateFrameSelector()
|
function FrameOptions:CreateFrameSelector()
|
||||||
@@ -270,7 +277,7 @@ function FrameOptions:CreateFrameSelector()
|
|||||||
self:AddItem(L.Inventory, 'inventory')
|
self:AddItem(L.Inventory, 'inventory')
|
||||||
self:AddItem(L.Bank, 'bank')
|
self:AddItem(L.Bank, 'bank')
|
||||||
self:AddItem(L.KeyRing, 'keys')
|
self:AddItem(L.KeyRing, 'keys')
|
||||||
|
|
||||||
if IsAddOnLoaded('Bagnon_GuildBank') then
|
if IsAddOnLoaded('Bagnon_GuildBank') then
|
||||||
self:AddItem(L.GuildBank, 'guildbank')
|
self:AddItem(L.GuildBank, 'guildbank')
|
||||||
end
|
end
|
||||||
@@ -292,8 +299,7 @@ function FrameOptions:GetFrameSelector()
|
|||||||
return self.frameSelector
|
return self.frameSelector
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Color Pickers ]] --
|
||||||
--[[ Color Pickers ]]--
|
|
||||||
|
|
||||||
--frame color
|
--frame color
|
||||||
function FrameOptions:CreateColorSelector()
|
function FrameOptions:CreateColorSelector()
|
||||||
@@ -335,8 +341,7 @@ function FrameOptions:GetBorderColorSelector()
|
|||||||
return self.borderColorSelector
|
return self.borderColorSelector
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Sliders ]] --
|
||||||
--[[ Sliders ]]--
|
|
||||||
|
|
||||||
--columns
|
--columns
|
||||||
function FrameOptions:CreateColumnsSlider()
|
function FrameOptions:CreateColumnsSlider()
|
||||||
@@ -458,9 +463,7 @@ function FrameOptions:GetLayerSlider()
|
|||||||
return self.layerSlider
|
return self.layerSlider
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Check Boxes ]] --
|
||||||
|
|
||||||
--[[ Check Boxes ]]--
|
|
||||||
|
|
||||||
--bag frame
|
--bag frame
|
||||||
function FrameOptions:CreateToggleBagFrameCheckbox()
|
function FrameOptions:CreateToggleBagFrameCheckbox()
|
||||||
@@ -482,7 +485,6 @@ function FrameOptions:GetToggleBagFrameCheckbox()
|
|||||||
return self.toggleBagFrameCheckbox
|
return self.toggleBagFrameCheckbox
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--money frame
|
--money frame
|
||||||
function FrameOptions:CreateToggleMoneyFrameCheckbox()
|
function FrameOptions:CreateToggleMoneyFrameCheckbox()
|
||||||
local button = Bagnon.OptionsCheckButton:New(L.EnableMoneyFrame, self)
|
local button = Bagnon.OptionsCheckButton:New(L.EnableMoneyFrame, self)
|
||||||
@@ -503,7 +505,6 @@ function FrameOptions:GetToggleMoneyFrameCheckbox()
|
|||||||
return self.toggleMoneyFrameCheckbox
|
return self.toggleMoneyFrameCheckbox
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--databroker frame
|
--databroker frame
|
||||||
function FrameOptions:CreateToggleDBOFrameCheckbox()
|
function FrameOptions:CreateToggleDBOFrameCheckbox()
|
||||||
local button = Bagnon.OptionsCheckButton:New(L.EnableDBOFrame, self)
|
local button = Bagnon.OptionsCheckButton:New(L.EnableDBOFrame, self)
|
||||||
@@ -524,7 +525,6 @@ function FrameOptions:GetToggleDBOFrameCheckbox()
|
|||||||
return self.toggleDBOFrameCheckbox
|
return self.toggleDBOFrameCheckbox
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--search frame toggle
|
--search frame toggle
|
||||||
function FrameOptions:CreateToggleSearchFrameCheckbox()
|
function FrameOptions:CreateToggleSearchFrameCheckbox()
|
||||||
local button = Bagnon.OptionsCheckButton:New(L.EnableSearchToggle, self)
|
local button = Bagnon.OptionsCheckButton:New(L.EnableSearchToggle, self)
|
||||||
@@ -545,6 +545,25 @@ function FrameOptions:GetToggleSearchFrameCheckbox()
|
|||||||
return self.toggleSearchFrameCheckbox
|
return self.toggleSearchFrameCheckbox
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--sortBtn toggle
|
||||||
|
function FrameOptions:CreateBtnSortCheckbox()
|
||||||
|
local button = Bagnon.OptionsCheckButton:New(L.EnableSortBtn, self)
|
||||||
|
|
||||||
|
button.OnEnableSetting = function(self, enable)
|
||||||
|
self:GetParent():GetSettings():SetHasSortBtn(enable)
|
||||||
|
end
|
||||||
|
|
||||||
|
button.IsSettingEnabled = function(self, enable)
|
||||||
|
return self:GetParent():GetSettings():HasSortBtn()
|
||||||
|
end
|
||||||
|
|
||||||
|
self.btnSortCheckbox = button
|
||||||
|
return button
|
||||||
|
end
|
||||||
|
|
||||||
|
function FrameOptions:GetSortBtnCheckBox()
|
||||||
|
return self.btnSortCheckbox
|
||||||
|
end
|
||||||
|
|
||||||
--options frame toggle
|
--options frame toggle
|
||||||
function FrameOptions:CreateToggleOptionsCheckbox()
|
function FrameOptions:CreateToggleOptionsCheckbox()
|
||||||
@@ -566,7 +585,6 @@ function FrameOptions:GetToggleOptionsCheckbox()
|
|||||||
return self.toggleOptionsCheckbox
|
return self.toggleOptionsCheckbox
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--reverse slot ordering
|
--reverse slot ordering
|
||||||
function FrameOptions:CreateReverseSlotOrderCheckbox()
|
function FrameOptions:CreateReverseSlotOrderCheckbox()
|
||||||
local button = Bagnon.OptionsCheckButton:New(L.ReverseSlotOrdering, self)
|
local button = Bagnon.OptionsCheckButton:New(L.ReverseSlotOrdering, self)
|
||||||
@@ -607,7 +625,6 @@ function FrameOptions:GetBagBreakCheckbox()
|
|||||||
return self.bagBreakCheckbox
|
return self.bagBreakCheckbox
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Update Methods
|
Update Methods
|
||||||
--]]
|
--]]
|
||||||
@@ -627,7 +644,6 @@ function FrameOptions:GetSettings()
|
|||||||
return Bagnon.FrameSettings:Get(self:GetFrameID())
|
return Bagnon.FrameSettings:Get(self:GetFrameID())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[ Load the thing ]] --
|
||||||
|
|
||||||
--[[ Load the thing ]]--
|
FrameOptions:Load()
|
||||||
|
|
||||||
FrameOptions:Load()
|
|
||||||
|
|||||||
Reference in New Issue
Block a user