diff --git a/PSBT.lua b/PSBT.lua
index 2ae4f74..53f9269 100644
--- a/PSBT.lua
+++ b/PSBT.lua
@@ -45,16 +45,9 @@ end
function PSBT:Initialize( control )
self.control = control
-
- self._areas[ PSBT_AREAS.INCOMING ] = PSBT_ScrollArea:New( self.control, PSBT_AREAS.INCOMING, BOTTOM )
- self._areas[ PSBT_AREAS.OUTGOING ] = PSBT_ScrollArea:New( self.control, PSBT_AREAS.OUTGOING, TOP )
- self._areas[ PSBT_AREAS.STATIC ] = PSBT_ScrollArea:New( self.control, PSBT_AREAS.STATIC, BOTTOM )
- self._areas[ PSBT_AREAS.NOTIFICATION ] = PSBT_ScrollArea:New( self.control, PSBT_AREAS.NOTIFICATION, TOP )
-
self.control:RegisterForEvent( EVENT_ADD_ON_LOADED, function( _, addon ) self:OnLoaded( addon ) end )
end
-
function PSBT:FormatFont( fontObject )
local path, size, decoration = fontObject:GetFontInfo()
local fmt = '%s|%d'
@@ -73,6 +66,12 @@ function PSBT:OnLoaded( addon )
print( 'Loading PSBT' )
CBM:FireCallbacks( PSBT_EVENTS.LOADED, self )
+ self._areas[ PSBT_AREAS.INCOMING ] = PSBT_ScrollArea:New( self.control, PSBT_AREAS.INCOMING, BOTTOM, self:GetSetting( PSBT_AREAS.INCOMING ) )
+ self._areas[ PSBT_AREAS.OUTGOING ] = PSBT_ScrollArea:New( self.control, PSBT_AREAS.OUTGOING, TOP, self:GetSetting( PSBT_AREAS.OUTGOING ) )
+ self._areas[ PSBT_AREAS.STATIC ] = PSBT_ScrollArea:New( self.control, PSBT_AREAS.STATIC, BOTTOM, self:GetSetting( PSBT_AREAS.STATIC ) )
+ self._areas[ PSBT_AREAS.NOTIFICATION ] = PSBT_ScrollArea:New( self.control, PSBT_AREAS.NOTIFICATION, TOP, self:GetSetting( PSBT_AREAS.NOTIFICATION ) )
+
+ CBM:RegisterCallback( PSBT_EVENTS.CONFIG, function( ... ) self:SetConfigurationMode( ... ) end )
self.control:SetHandler( 'OnUpdate', function( _, frameTime ) self:OnUpdate( frameTime ) end )
end
@@ -96,6 +95,14 @@ function PSBT:ResetLabel( label )
label:Finalize()
end
+function PSBT:SetConfigurationMode( mode )
+ if ( not mode ) then
+ for k,v in pairs( self._areas ) do
+ self:SetSetting( k, { v:GetAnchorOffsets() } )
+ end
+ end
+end
+
function PSBT:RegisterModule( identity, class )
if ( self._modules[ identity ] ) then
return
diff --git a/PSBT.xml b/PSBT.xml
index 5c88351..c8e9629 100644
--- a/PSBT.xml
+++ b/PSBT.xml
@@ -24,7 +24,10 @@
<Dimensions x="500" y="60" />
<Anchor point="CENTER" relativeTo="$(parent)" relativePoint="CENTER" offsetX="0" offsetY="450" />
<Controls>
- <!--<Texture name="$(parent)BG" inherits="ZO_ThinListBgStrip" />-->
+ <Texture name="$(parent)_BG" inherits="ZO_ThinListBgStrip" />
+ <Label name="$(parent)_Name" inherits="ZO_WindowTitle" horizontalAlignment="CENTER" verticalAlignment="CENTER" wrapMode="ELLIPSIS" text="Notifications" >
+ <AnchorFill/>
+ </Label>
</Controls>
</Control>
@@ -32,7 +35,10 @@
<Dimensions x="500" y="60" />
<Anchor point="CENTER" relativeTo="$(parent)" relativePoint="CENTER" offsetX="0" offsetY="-300" />
<Controls>
- <!--<Texture name="$(parent)BG" inherits="ZO_ThinListBgStrip" />-->
+ <Texture name="$(parent)_BG" inherits="ZO_ThinListBgStrip" />
+ <Label name="$(parent)_Name" inherits="ZO_WindowTitle" horizontalAlignment="CENTER" verticalAlignment="CENTER" wrapMode="ELLIPSIS" text="Static" >
+ <AnchorFill/>
+ </Label>
</Controls>
</Control>
@@ -40,7 +46,10 @@
<Dimensions x="300" y="450" />
<Anchor point="RIGHT" relativeTo="$(parent)" relativePoint="CENTER" offsetX="-300" offsetY="150" />
<Controls>
- <!--<Texture name="$(parent)BG" inherits="ZO_ThinListBgStrip" />-->
+ <Texture name="$(parent)_BG" inherits="ZO_ThinListBgStrip" />
+ <Label name="$(parent)_Name" inherits="ZO_WindowTitle" horizontalAlignment="CENTER" verticalAlignment="CENTER" wrapMode="ELLIPSIS" text="Incoming" >
+ <AnchorFill/>
+ </Label>
</Controls>
</Control>
@@ -48,7 +57,10 @@
<Dimensions x="300" y="450" />
<Anchor point="LEFT" relativeTo="$(parent)" relativePoint="CENTER" offsetX="300" offsetY="150" />
<Controls>
- <!--<Texture name="$(parent)BG" inherits="ZO_ThinListBgStrip" />-->
+ <Texture name="$(parent)_BG" inherits="ZO_ThinListBgStrip" />
+ <Label name="$(parent)_Name" inherits="ZO_WindowTitle" horizontalAlignment="CENTER" verticalAlignment="CENTER" wrapMode="ELLIPSIS" text="Outgoing" >
+ <AnchorFill/>
+ </Label>
</Controls>
</Control>
</Controls>
diff --git a/PSBT_Constants.lua b/PSBT_Constants.lua
index ed9c00e..d63bbd2 100644
--- a/PSBT_Constants.lua
+++ b/PSBT_Constants.lua
@@ -24,5 +24,6 @@ PSBT_SETTINGS =
PSBT_EVENTS =
{
- LOADED = 'PSBT_LOADED'
+ LOADED = 'PSBT_LOADED',
+ CONFIG = 'PSBT_CONFIG'
}
\ No newline at end of file
diff --git a/PSBT_Experience.lua b/PSBT_Experience.lua
index 7210033..241cde6 100644
--- a/PSBT_Experience.lua
+++ b/PSBT_Experience.lua
@@ -39,7 +39,6 @@ function PSBT_Experience:OnXPUpdated( tag, exp, maxExp, reason )
end
-
CBM:RegisterCallback( PSBT_EVENTS.LOADED,
function( psbt )
psbt:RegisterModule( PSBT_MODULES.XP, PSBT_Experience:New( psbt ) )
diff --git a/PSBT_Options.lua b/PSBT_Options.lua
index 9416666..10115bc 100644
--- a/PSBT_Options.lua
+++ b/PSBT_Options.lua
@@ -20,6 +20,13 @@ end
function PSBT_Options:InitialzeControlPanel()
self.config_panel = LAM:CreateControlPanel( '_psbt', 'PSBT' )
+ self.config_mode = false
+
+ LAM:AddButton( self.config_panel, '_psbt_editlayout_btn', 'Edit Layout', '',
+ function()
+ CBM:FireCallbacks( PSBT_EVENTS.CONFIG, not self.config_mode )
+ self.config_mode = not self.config_mode
+ end )
end
CBM:RegisterCallback( PSBT_EVENTS.LOADED,
diff --git a/PSBT_ScrollArea.lua b/PSBT_ScrollArea.lua
index f6f120e..e32b8d5 100644
--- a/PSBT_ScrollArea.lua
+++ b/PSBT_ScrollArea.lua
@@ -2,6 +2,7 @@ local LibAnim = LibStub( 'LibAnimation-1.0' )
if ( not LibAnim ) then return end
PSBT_ScrollArea = ZO_Object:Subclass()
+local CBM = CALLBACK_MANAGER
local tinsert = table.insert
local tremove = table.remove
local NUM_STICKY = 4
@@ -9,14 +10,19 @@ local NUM_STICKY = 4
local PSBT_Fifo = PSBT_Fifo
local CENTER = CENTER
+local PSBT_EVENTS = PSBT_EVENTS
+
function PSBT_ScrollArea:New( ... )
local result = ZO_Object.New( self )
result:Initialize( ... )
return result
end
-function PSBT_ScrollArea:Initialize( super, areaName, anchor )
+function PSBT_ScrollArea:Initialize( super, areaName, anchor, position )
+ self.name = areaName
self.control = super:GetNamedChild( areaName )
+ self.background = self.control:GetNamedChild( '_BG' )
+ self.label = self.control:GetNamedChild( '_Name' )
self._anchor = anchor
self._animHeight = nil
self._newSticky = false
@@ -30,8 +36,35 @@ function PSBT_ScrollArea:Initialize( super, areaName, anchor )
else
self._animHeight = -1 * self.control:GetHeight()
end
-
+ self:Position( unpack( position ) )
+ self:SetConfigurationMode( false )
self.control:SetHandler( 'OnUpdate', function( event, ... ) self:OnUpdate( ... ) end )
+
+ CBM:RegisterCallback( PSBT_EVENTS.CONFIG, function( ... ) self:SetConfigurationMode( ... ) end )
+end
+
+function PSBT_ScrollArea:SetConfigurationMode( enable )
+ self.control:SetMovable( enable )
+ self.control:SetMouseEnabled( enable )
+ self.label:SetHidden( not enable )
+ if ( enable ) then
+ local enter = LibAnim:New( self.background )
+ enter:AlphaTo( 1.0, 500 )
+ enter:Play()
+ else
+ local exit = LibAnim:New( self.background )
+ exit:AlphaTo( 0.0, 500 )
+ exit:Play()
+ end
+end
+
+function PSBT_ScrollArea:Position( point, relPoint, x, y )
+ self.control:SetAnchor( point, self.control:GetParent(), relPoint, x, y )
+end
+
+function PSBT_ScrollArea:GetAnchorOffsets()
+ local _, point, _, relPoint, offsX, offsY = self.control:GetAnchor( 0 )
+ return point, relPoint, offsX, offsY
end
function PSBT_ScrollArea:Push( entry, sticky )
diff --git a/PSBT_Settings.lua b/PSBT_Settings.lua
index 7b00180..d1cb247 100644
--- a/PSBT_Settings.lua
+++ b/PSBT_Settings.lua
@@ -4,18 +4,26 @@ local CBM = CALLBACK_MANAGER
local PSBT_MODULES = PSBT_MODULES
local PSBT_EVENTS = PSBT_EVENTS
+local PSBT_AREAS = PSBT_AREAS
local ZO_SavedVars = ZO_SavedVars
+local RIGHT = RIGHT
+local LEFT = LEFT
+local CENTER = CENTER
+
local defaults =
{
-
+ [ PSBT_AREAS.INCOMING ] = { RIGHT, CENTER, -300, 150 },
+ [ PSBT_AREAS.OUTGOING ] = { LEFT, CENTER, 300, 150 },
+ [ PSBT_AREAS.STATIC ] = { CENTER, CENTER, 0, -300 },
+ [ PSBT_AREAS.NOTIFICATION ] = { CENTER, CENTER, 0, 450 }
}
function PSBT_Settings:Initialize( ... )
PSBT_Module.Initialize( self, ... )
- self.db = ZO_SavedVars:New( 'PSBT_DB', 1.0, nil, defaults )
+ self.db = ZO_SavedVars:New( 'PSBT_DB', 1.5, nil, defaults )
self.profile = self.db:GetInterfaceForCharacter( GetDisplayName(), GetUnitName( 'player' ) )
end