First work on LibWindow-1.1 usage, plumbing for new bar resizing/button positioning
This commit is contained in:
@@ -13,3 +13,4 @@ externals:
|
|||||||
libs/AceConfig-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConfig-3.0
|
libs/AceConfig-3.0: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceConfig-3.0
|
||||||
libs/LibKeyBound-1.0: svn://svn.wowace.com/wow/libkeybound-1-0/mainline/trunk/LibKeyBound-1.0
|
libs/LibKeyBound-1.0: svn://svn.wowace.com/wow/libkeybound-1-0/mainline/trunk/LibKeyBound-1.0
|
||||||
libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0
|
libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0
|
||||||
|
libs/LibWindow-1.1: svn://svn.wowace.com/wow/libwindow-1-1/mainline/trunk/LibWindow-1.1
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ local table_concat, table_insert = table.concat, table.insert
|
|||||||
===================================================================================]]--
|
===================================================================================]]--
|
||||||
|
|
||||||
local defaults = {
|
local defaults = {
|
||||||
scale = 1,
|
|
||||||
alpha = 1,
|
alpha = 1,
|
||||||
fadeout = false,
|
fadeout = false,
|
||||||
fadeoutalpha = 0.1,
|
fadeoutalpha = 0.1,
|
||||||
@@ -20,10 +19,14 @@ local defaults = {
|
|||||||
possess = true,
|
possess = true,
|
||||||
stance = {},
|
stance = {},
|
||||||
},
|
},
|
||||||
|
position = {
|
||||||
|
scale = 1,
|
||||||
|
},
|
||||||
clickthrough = false,
|
clickthrough = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
local Sticky = LibStub("LibSimpleSticky-1.0")
|
local Sticky = LibStub("LibSimpleSticky-1.0")
|
||||||
|
local LibWin = LibStub("LibWindow-1.1")
|
||||||
local snapBars = { WorldFrame, UIParent }
|
local snapBars = { WorldFrame, UIParent }
|
||||||
|
|
||||||
local barOnEnter, barOnLeave, barOnDragStart, barOnDragStop, barOnClick, barOnUpdateFunc, barOnAttributeChanged
|
local barOnEnter, barOnLeave, barOnDragStart, barOnDragStop, barOnClick, barOnUpdateFunc, barOnAttributeChanged
|
||||||
@@ -170,7 +173,11 @@ function Bar:ApplyConfig(config)
|
|||||||
if config then
|
if config then
|
||||||
self.config = config
|
self.config = config
|
||||||
end
|
end
|
||||||
|
LibWin.RegisterConfig(self, self.config.position)
|
||||||
|
|
||||||
|
self:UpgradeConfig()
|
||||||
if self.disabled then return end
|
if self.disabled then return end
|
||||||
|
|
||||||
if Bartender4.Locked then
|
if Bartender4.Locked then
|
||||||
self:Lock()
|
self:Lock()
|
||||||
else
|
else
|
||||||
@@ -183,6 +190,29 @@ function Bar:ApplyConfig(config)
|
|||||||
self:InitVisibilityDriver()
|
self:InitVisibilityDriver()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Bar:UpgradeConfig()
|
||||||
|
local version = self.config.version or 1
|
||||||
|
if version < 2 then
|
||||||
|
-- LibWindow migration, move scale into position
|
||||||
|
if self.config.scale then
|
||||||
|
self.config.position.scale = self.config.scale
|
||||||
|
self.config.scale = nil
|
||||||
|
end
|
||||||
|
-- LibWindow migration, update position data
|
||||||
|
do
|
||||||
|
local pos = self.config.position
|
||||||
|
self:SetScale(pos.scale)
|
||||||
|
local x, y, s = pos.x, pos.y, self:GetEffectiveScale()
|
||||||
|
local point, relPoint = pos.point, pos.relPoint
|
||||||
|
x, y = x/s, y/s
|
||||||
|
self:ClearSetPoint(point, UIParent, relPoint, x, y)
|
||||||
|
LibWin.SavePosition(self)
|
||||||
|
pos.relPoint = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.config.version = Bartender4.CONFIG_VERSION
|
||||||
|
end
|
||||||
|
|
||||||
function Bar:Unlock()
|
function Bar:Unlock()
|
||||||
if self.disabled or self.unlocked then return end
|
if self.disabled or self.unlocked then return end
|
||||||
self.unlocked = true
|
self.unlocked = true
|
||||||
@@ -206,22 +236,11 @@ function Bar:StopDragging()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Bar:LoadPosition()
|
function Bar:LoadPosition()
|
||||||
if not self.config.position then return end
|
LibWin.RestorePosition(self)
|
||||||
local pos = self.config.position
|
|
||||||
local x, y, s = pos.x, pos.y, self:GetEffectiveScale()
|
|
||||||
local point, relPoint = pos.point, pos.relPoint
|
|
||||||
x, y = x/s, y/s
|
|
||||||
self:ClearSetPoint(point, UIParent, relPoint, x, y)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Bar:SavePosition()
|
function Bar:SavePosition()
|
||||||
if not self.config.position then self.config.position = {} end
|
LibWin.SavePosition(self)
|
||||||
local pos = self.config.position
|
|
||||||
local point, parent, relPoint, x, y = self:GetPoint()
|
|
||||||
local s = self:GetEffectiveScale()
|
|
||||||
x, y = x*s, y*s
|
|
||||||
pos.x, pos.y = x, y
|
|
||||||
pos.point, pos.relPoint = point, relPoint
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Bar:SetSize(width, height)
|
function Bar:SetSize(width, height)
|
||||||
@@ -243,15 +262,13 @@ function Bar:SetConfigAlpha(alpha)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Bar:GetConfigScale()
|
function Bar:GetConfigScale()
|
||||||
return self.config.scale
|
return self.config.position.scale
|
||||||
end
|
end
|
||||||
|
|
||||||
function Bar:SetConfigScale(scale)
|
function Bar:SetConfigScale(scale)
|
||||||
if scale then
|
if scale then
|
||||||
self.config.scale = scale
|
LibWin.SetScale(self, scale)
|
||||||
end
|
end
|
||||||
self:SetScale(self.config.scale)
|
|
||||||
self:LoadPosition()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Bar:GetClickThrough()
|
function Bar:GetClickThrough()
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ local defaults = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bartender4.CONFIG_VERSION = 2
|
||||||
|
|
||||||
function Bartender4:OnInitialize()
|
function Bartender4:OnInitialize()
|
||||||
self.db = LibStub("AceDB-3.0"):New("Bartender4DB", defaults)
|
self.db = LibStub("AceDB-3.0"):New("Bartender4DB", defaults)
|
||||||
self.db.RegisterCallback(self, "OnProfileChanged", "UpdateModuleConfigs")
|
self.db.RegisterCallback(self, "OnProfileChanged", "UpdateModuleConfigs")
|
||||||
|
|||||||
+2
-1
@@ -5,7 +5,7 @@
|
|||||||
## Author: Nevcairiel
|
## Author: Nevcairiel
|
||||||
## X-Email: h.leppkes AT gmail DOT com
|
## X-Email: h.leppkes AT gmail DOT com
|
||||||
## SavedVariables: Bartender4DB
|
## SavedVariables: Bartender4DB
|
||||||
## OptionalDeps: Ace3, ButtonFacade, LibKeyBound-1.0, LibDBIcon-1.0
|
## OptionalDeps: Ace3, ButtonFacade, LibKeyBound-1.0, LibDBIcon-1.0, LibWindow-1.1
|
||||||
## X-Category: Action Bars
|
## X-Category: Action Bars
|
||||||
## Version: 4.2.6
|
## Version: 4.2.6
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@ libs\AceConfig-3.0\AceConfig-3.0.xml
|
|||||||
|
|
||||||
libs\LibKeyBound-1.0\lib.xml
|
libs\LibKeyBound-1.0\lib.xml
|
||||||
libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
|
libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
|
||||||
|
libs\LibWindow-1.1\LibWindow-1.1.lua
|
||||||
#@end-no-lib-strip@
|
#@end-no-lib-strip@
|
||||||
|
|
||||||
libs\SimpleSticky.lua
|
libs\SimpleSticky.lua
|
||||||
|
|||||||
+3
-1
@@ -17,7 +17,9 @@ local defaults = { profile = Bartender4:Merge({
|
|||||||
possess = false,
|
possess = false,
|
||||||
},
|
},
|
||||||
padding = -3,
|
padding = -3,
|
||||||
scale = 0.8,
|
position = {
|
||||||
|
scale = 0.8,
|
||||||
|
},
|
||||||
}, Bartender4.ButtonBar.defaults) }
|
}, Bartender4.ButtonBar.defaults) }
|
||||||
|
|
||||||
function MicroMenuMod:OnInitialize()
|
function MicroMenuMod:OnInitialize()
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ local PetBar = setmetatable({}, {__index = ButtonBar})
|
|||||||
|
|
||||||
local defaults = { profile = Bartender4:Merge({
|
local defaults = { profile = Bartender4:Merge({
|
||||||
enabled = true,
|
enabled = true,
|
||||||
scale = 1.0,
|
|
||||||
hidehotkey = true,
|
hidehotkey = true,
|
||||||
visibility = {
|
visibility = {
|
||||||
nopet = true,
|
nopet = true,
|
||||||
|
|||||||
+3
-1
@@ -17,7 +17,9 @@ local KeyBound = LibStub("LibKeyBound-1.0")
|
|||||||
|
|
||||||
local defaults = { profile = Bartender4:Merge({
|
local defaults = { profile = Bartender4:Merge({
|
||||||
enabled = true,
|
enabled = true,
|
||||||
scale = 1.5,
|
position = {
|
||||||
|
scale = 1.5,
|
||||||
|
},
|
||||||
hidehotkey = true,
|
hidehotkey = true,
|
||||||
}, Bartender4.ButtonBar.defaults) }
|
}, Bartender4.ButtonBar.defaults) }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user