diff --git a/.pkgmeta b/.pkgmeta
index 37b3557..c45bb87 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -33,6 +33,12 @@ externals:
Libs/AceDBOptions-3.0:
url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceDBOptions-3.0
tag: latest
+ Libs/AceComm-3.0:
+ url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceComm-3.0
+ tag: latest
+ Libs/AceSerializer-3.0:
+ url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceSerializer-3.0
+ tag: latest
Libs/LibSharedMedia-3.0:
url: svn://svn.wowace.com/wow/libsharedmedia-3-0/mainline/trunk
tag: latest
diff --git a/Display.lua b/Display.lua
index d1b3ea6..7b384c2 100644
--- a/Display.lua
+++ b/Display.lua
@@ -242,6 +242,14 @@ function mod:RebuildOpts()
order = 2
},
+ send = {
+ name = "Send Display",
+ desc = "Send this display to someone",
+ type = "input",
+ set = function(info, name)
+ self:SendDisplay(k, name)
+ end
+ },
delete = {
name = "Delete",
type = "execute",
@@ -402,6 +410,7 @@ end
function mod:OnInitialize()
self.db = LCD4WoW.db:RegisterNamespace(self:GetName(), defaults)
self.environment = {_G=_G}
+ LCD4WoW:RegisterComm("LCD4WoWDisplayTransfer", self.OnCommReceived)
end
function mod:OnEnable()
@@ -438,8 +447,59 @@ function mod:StopDisplays()
table.wipe(displays)
end
+function mod.OnCommReceived(prefix, message, distribution, sender)
+ local self = mod
+ local flag, data = LCD4WoW:Deserialize(message)
+ if not flag then LCD4WoW:Print(data, type(message), message); return end
+ if type(data) ~= "table" then LCD4WoW:Print("Display data is not a table -- " .. type(data)); return end
+ for k, v in pairs(data) do
+ if k:match("^display_") then
+ if v.driver == "qtip" then
+ local display = LibDriverQTip:New(self, self.environment, k, data, LCD4WoW.db.profile.errorLevel)
+ display:Show()
+ tinsert(displays, display)
+ elseif v.driver == "character" then
+ local display = LibDriverCharacter:New(self, self.environment, k, data, LCD4WoW.db.profile.errorLevel)
+ display:Show()
+ tinsert(displays, display)
+ end
+ else
+ LCD4WoW:Print(k)
+ end
+ end
+end
+
+function mod:SendDisplay(display, name)
+ local tbl = {[display] = self.db.profile.config[display]}
+ local widgets = self.db.profile.config[display].widgets
+ local layouts = self.db.profile.config[display].layouts
+ for i, w in ipairs(widgets) do
+ tbl[w] = self.db.profile.config[w]
+ end
+ for i, layout in ipairs(layouts) do
+ tbl[layout] = self.db.profile.config[layout]
+ if not tbl[layout] then break end
+ for layer = 1, tbl[display].layers do
+ for row = 1, tbl[display].rows do
+ for col = 1, tbl[display].cols do
+ if tbl[layout] and tbl[layout][layer] and
+ tbl[layout][layer][row] and
+ tbl[layout][layer][row][col] then
+ local widget = tbl[layout][layer][row][col]
+ tbl[widget] = self.db.profile.config[widget]
+ end
+ end
+ end
+ end
+ end
+ local data = LCD4WoW:Serialize(tbl)
+ LCD4WoW:SendCommMessage("LCD4WoWDisplayTransfer", data, "WHISPER", name)
+end
+
function mod:MODIFIER_STATE_CHANGED(ev, modifier, up, ...)
for i, display in ipairs(displays) do
- display:KeyEvent(modifier, up)
+ if display.KeyEvent then
+ display:KeyEvent(modifier, up)
+ end
end
end
\ No newline at end of file
diff --git a/LCD4WoW.lua b/LCD4WoW.lua
index 2510ced..5baee3f 100644
--- a/LCD4WoW.lua
+++ b/LCD4WoW.lua
@@ -1,4 +1,4 @@
-LCD4WoW = StarTip or LibStub("AceAddon-3.0"):NewAddon("LCD4WoW: @project-version@", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0")
+LCD4WoW = StarTip or LibStub("AceAddon-3.0"):NewAddon("LCD4WoW: @project-version@", "AceConsole-3.0", "AceHook-3.0", "AceEvent-3.0", "AceComm-3.0", "AceSerializer-3.0")
LCD4WoW.version = GetAddOnMetadata("LCD4WoW", "X-LCD4WoW-Version") or ""
if StarTip then return end
local LibDBIcon = LibStub("LibDBIcon-1.0")
diff --git a/embeds.xml b/embeds.xml
index 67ef9ed..e56271e 100644
--- a/embeds.xml
+++ b/embeds.xml
@@ -13,6 +13,8 @@
<Include file = "Libs\AceLocale-3.0\AceLocale-3.0.xml"/>
<Include file = "Libs\AceConfig-3.0\AceConfig-3.0.xml"/>
<Include file = "Libs\AceTimer-3.0\AceTimer-3.0.xml"/>
+<Include file = "Libs\AceComm-3.0\AceComm-3.0.xml"/>
+<Include file = "Libs\AceSerializer-3.0\AceSerializer-3.0.xml"/>
<Include file = "Libs\LibSharedMedia-3.0\lib.xml"/>
<Include file = "Libs\LibMobHealth-4.0\lib.xml"/>