/trunk/RDX/Designs/Lists
--------------- Code emitter helpers |
local function _EmitCreateCode(objname, desc) |
local ebs, ebsos = "bs_default", 0; |
if desc.externalButtonSkin then |
ebs = desc.externalButtonSkin; |
if desc.ButtonSkinOffset then ebsos = desc.ButtonSkinOffset; end |
local usebs = "false"; if desc.usebs then usebs = "true"; end |
local ebs = desc.externalButtonSkin or "bs_default"; |
local usebkd = "false"; if desc.usebkd then usebkd = "true"; end |
local bkd = desc.bkd or VFLUI.defaultBackdrop; |
local os = 0; |
if desc.usebs then |
os = desc.ButtonSkinOffset or 0; |
elseif desc.usebkd then |
if desc.bkd and desc.bkd.insets and desc.bkd.insets.left then os = desc.bkd.insets.left or 0; end |
end |
local createCode = [[ |
frame.]] .. objname .. [[ = {}; |
local btn, btnOwner = nil, ]] .. RDXUI.ResolveFrameReference(desc.owner) .. [[; |
for i=1, ]] .. desc.nIcons .. [[ do |
btn = VFLUI.SkinButton:new(); |
btn:SetButtonSkin("]] .. ebs ..[[", true, true, false, true, true, true, false, true, true, true); |
if ]] .. usebs .. [[ then |
btn = VFLUI.SkinButton:new(); |
btn:SetButtonSkin("]] .. ebs ..[[", true, true, false, true, true, true, false, true, true, true); |
elseif ]] .. usebkd .. [[ then |
btn = VFLUI.AcquireFrame("Frame"); |
VFLUI.SetBackdrop(btn, ]] .. Serialize(bkd) .. [[); |
else |
btn = VFLUI.AcquireFrame("Frame"); |
end |
btn:SetParent(btnOwner); btn:SetFrameLevel(btnOwner:GetFrameLevel()); |
btn:SetWidth(]] .. desc.size .. [[); btn:SetHeight(]] .. desc.size .. [[); |
btn:SetScript("OnEnter", __AuraIconOnEnter); |
btn:SetScript("OnLeave", __AuraIconOnLeave); |
]]; |
if desc.externalButtonSkin then createCode = createCode .. [[ |
btn:RegisterForClicks("RightButtonUp"); |
btn:SetScript("OnClick", __AuraIconOnClick); |
--btn:RegisterForClicks("RightButtonUp"); |
--btn:SetScript("OnClick", __AuraIconOnClick); |
]]; |
end |
createCode = createCode .. [[ |
btn.tex = VFLUI.CreateTexture(btn); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. ebsos .. [[, -]] .. ebsos .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. ebsos .. [[, ]] .. ebsos .. [[); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. os .. [[, -]] .. os .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. os .. [[, ]] .. os .. [[); |
btn.tex:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
btn.tex:SetDrawLayer("ARTWORK", 2); |
btn.tex:Show(); |
if not desc.cd then desc.cd = VFL.copy(VFLUI.defaultCooldown); end |
if not desc.iconspx then desc.iconspx = 0; end |
if not desc.iconspy then desc.iconspy = 0; end |
if not desc.usebkd then desc.usebs = true; end |
local flg = true; |
flg = flg and RDXUI.UFFrameCheck_Proto("Icons_", desc, state, errs); |
flg = flg and RDXUI.UFAnchorCheck(desc.anchor, state, errs); |
end; |
ApplyFeature = function(desc, state) |
local objname = "Icons_" .. desc.name; |
local ebs, ebsos = "bs_default", 0; |
if desc.externalButtonSkin then |
ebs = desc.externalButtonSkin; |
if desc.ButtonSkinOffset then ebsos = desc.ButtonSkinOffset; end |
local usebs = "false"; if desc.usebs then usebs = "true"; end |
local ebs = desc.externalButtonSkin or "bs_default"; |
local usebkd = "false"; if desc.usebkd then usebkd = "true"; end |
local bkd = desc.bkd or VFLUI.defaultBackdrop; |
local os = 0; |
if desc.usebs then |
os = desc.ButtonSkinOffset or 0; |
elseif desc.usebkd then |
if desc.bkd and desc.bkd.insets and desc.bkd.insets.left then os = desc.bkd.insets.left or 0; end |
end |
local loadCode = "LoadBuffFromUnit"; |
-- Event hinting. |
local mux, mask = state:GetContainingWindowState():GetSlotValue("Multiplexer"), 0; |
btn.meta = _meta; |
btn.tex:SetTexture(_tex); |
if _dispelt and DebuffTypeColor[_dispelt] then |
btn._texBorder:SetVertexColor(VFL.explodeColor(DebuffTypeColor[_dispelt])); |
if ]] .. usebs .. [[ then |
btn._texBorder:SetVertexColor(VFL.explodeColor(DebuffTypeColor[_dispelt])); |
elseif ]] .. usebkd .. [[ then |
btn:SetBackdropBorderColor(VFL.explodeRGBA(DebuffTypeColor[_dispelt])); |
end |
else |
btn._texBorder:SetVertexColor(1, 1, 1, 1); |
if ]] .. usebs .. [[ then |
btn._texBorder:SetVertexColor(1, 1, 1, 1); |
elseif ]] .. usebkd .. [[ then |
btn:SetBackdropBorderColor(1, 1, 1, 1); |
end |
end |
-- Cooldown |
if _dur and _dur > 0 and btn.cd then |
btn.cd:SetCooldown(GetTime() + _tl - _dur , _dur); |
if desc and desc.size then ed_size.editBox:SetText(desc.size); end |
ui:InsertFrame(ed_size); |
-------------- ButtonSkin |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Button Skin"))); |
-------------- Display |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Display"))); |
local er = VFLUI.EmbedRight(ui, VFLI.i18n("Button Skin")); |
local dd_buttonSkin = VFLUI.Dropdown:new(er, VFLUI.GetButtonSkinList); |
local chk_bs = VFLUI.CheckEmbedRight(ui, VFLI.i18n("Use Button Skin")); |
local dd_buttonSkin = VFLUI.Dropdown:new(chk_bs, VFLUI.GetButtonSkinList); |
dd_buttonSkin:SetWidth(150); dd_buttonSkin:Show(); |
if desc and desc.externalButtonSkin then |
dd_buttonSkin:SetSelection(desc.externalButtonSkin); |
dd_buttonSkin:SetSelection(desc.externalButtonSkin); |
if desc and desc.usebs then |
chk_bs:SetChecked(true); |
else |
dd_buttonSkin:SetSelection("bs_default"); |
chk_bs:SetChecked(); |
end |
er:EmbedChild(dd_buttonSkin); er:Show(); |
ui:InsertFrame(er); |
chk_bs:EmbedChild(dd_buttonSkin); chk_bs:Show(); |
ui:InsertFrame(chk_bs); |
local ed_bs = VFLUI.LabeledEdit:new(ui, 50); ed_bs:Show(); |
ed_bs:SetText(VFLI.i18n("Button Skin Size Offset :")); |
if desc and desc.ButtonSkinOffset then ed_bs.editBox:SetText(desc.ButtonSkinOffset); end |
ui:InsertFrame(ed_bs); |
local chk_bkd = VFLUI.CheckEmbedRight(ui, VFLI.i18n("Use Backdrop")); |
local dd_backdrop = VFLUI.MakeBackdropSelectButton(chk_bkd, desc.bkd); |
dd_backdrop:Show(); |
if desc and desc.usebkd then |
chk_bkd:SetChecked(true); |
else |
chk_bkd:SetChecked(); |
end |
chk_bkd:EmbedChild(dd_backdrop); chk_bkd:Show(); |
ui:InsertFrame(chk_bkd); |
-------------- CooldownDisplay |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Cooldown"))); |
local ercd = VFLUI.EmbedRight(ui, VFLI.i18n("Cooldown :")); |
function ui:GetDescriptor() |
local filterName, filterNameList, filternl, ext, unitfi, maxdurfil, mindurfil = nil, nil, {}, nil, "", "", ""; |
if chk_bs:GetChecked() then chk_bkd:SetChecked(); end |
if chk_nameauras:GetChecked() then |
unitfi = string.lower(ed_unitfilter.editBox:GetText()); |
end |
iconspy = VFL.clamp(ed_iconspy.editBox:GetNumber(), -200, 200); |
size = VFL.clamp(ed_size.editBox:GetNumber(), 1, 100); |
-- display |
usebs = chk_bs:GetChecked(); |
externalButtonSkin = dd_buttonSkin:GetSelection(); |
ButtonSkinOffset = VFL.clamp(ed_bs.editBox:GetNumber(), 0, 50); |
bkd = nil; |
usebkd = chk_bkd:GetChecked(); |
bkd = dd_backdrop:GetSelectedBackdrop(); |
-- cooldown |
cd = cd:GetSelectedCooldown(); |
cdTimerType = nil; |
anchor = { lp = "TOPLEFT", af = "Base", rp = "TOPLEFT", dx = 0, dy = 0}; |
nIcons = 4; size = 20; rows = 1; orientation = "RIGHT"; iconspx = 5; iconspy = 0; |
cd = VFL.copy(VFLUI.defaultCooldown); |
bkd = VFL.copy(VFLUI.defaultBackdrop); |
externalButtonSkin = "bs_default"; |
ButtonSkinOffset = 0; |
bkd = VFL.copy(VFLUI.defaultBackdrop); |
}; |
end; |
}); |
----------------------------------- |
-- Updaters for old stuff. |
----------------------------------- |
RDX.RegisterFeature({ |
name = "Buff Icons"; version = 31337; invisible = true; |
IsPossible = VFL.Nil; |
VersionMismatch = function(desc) |
local font = VFL.copy(Fonts.Default); font.size = 8; |
desc.feature = "aura_icons"; desc.version = 1; desc.auraType = "BUFFS"; |
desc.owner = "Base"; |
desc.color = nil; desc.font = font; desc.text = "STACK"; |
end; |
}); |
RDX.RegisterFeature({ |
name = "Debuff Icons"; version = 31337; invisible = true; |
IsPossible = VFL.Nil; |
VersionMismatch = function(desc) |
local font = VFL.copy(Fonts.Default); font.size = 8; |
desc.feature = "aura_icons"; desc.version = 1; desc.auraType = "DEBUFFS"; |
desc.owner = "Base"; |
desc.color = nil; desc.font = font; desc.text = "STACK"; |
end; |
}); |
ExposeFeature = function(desc, state, errs) |
if not desc then VFL.AddError(errs, VFLI.i18n("Missing descriptor.")); return nil; end |
if desc.owner == "Base" then desc.owner = "decor"; end |
if not desc.usebkd then desc.usebs = true; end |
if (not desc.number) or (not state:Slot("NumberVar_" .. desc.number)) then |
VFL.AddError(errs, VFLI.i18n("Invalid number object pointer.")); return nil; |
end |
end; |
ApplyFeature = function(desc, state) |
local objname = "Icons_" .. desc.name; |
local ebsflag, ebs, ebsos = "false", "bs_default", 0; |
if desc.externalButtonSkin then |
ebsflag = "true"; |
ebs = desc.externalButtonSkin; |
if desc.ButtonSkinOffset then ebsos = desc.ButtonSkinOffset; end |
local usebs = "false"; if desc.usebs then usebs = "true"; end |
local ebs = desc.externalButtonSkin or "bs_default"; |
local usebkd = "false"; if desc.usebkd then usebkd = "true"; end |
local bkd = desc.bkd or VFLUI.defaultBackdrop; |
local os = 0; |
if desc.usebs then |
os = desc.ButtonSkinOffset or 0; |
elseif desc.usebkd then |
if desc.bkd and desc.bkd.insets and desc.bkd.insets.left then os = desc.bkd.insets.left or 0; end |
end |
if not desc.w then desc.w = 20; end |
if not desc.h then desc.h = 20; end |
frame.]] .. objname .. [[ = {}; |
btn, btnOwner = nil, ]] .. RDXUI.ResolveFrameReference(desc.owner) .. [[; |
for i=1,]] .. desc.nIcons .. [[ do |
if ]] .. ebsflag .. [[ then |
if ]] .. usebs .. [[ then |
btn = VFLUI.SkinButton:new(); |
btn:SetButtonSkin("]] .. ebs ..[[", true, true, false, true, true, true, false, true, true, true); |
elseif ]] .. usebkd .. [[ then |
btn = VFLUI.AcquireFrame("Frame"); |
VFLUI.SetBackdrop(btn, ]] .. Serialize(bkd) .. [[); |
else |
btn = VFLUI.AcquireFrame("Frame"); |
end |
btn:SetParent(btnOwner); btn:SetFrameLevel(btnOwner:GetFrameLevel()); |
btn:SetWidth(]] .. desc.w .. [[); btn:SetHeight(]] .. desc.h .. [[); |
btn.tex = VFLUI.CreateTexture(btn); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. ebsos .. [[, -]] .. ebsos .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. ebsos .. [[, ]] .. ebsos .. [[); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. os .. [[, -]] .. os .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. os .. [[, ]] .. os .. [[); |
btn.tex:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
btn.tex:SetDrawLayer("ARTWORK", 2); |
btn.tex:Show(); |
ed_height:SetText(VFLI.i18n("Height")); |
if desc and desc.h then ed_height.editBox:SetText(desc.h); else ed_height.editBox:SetText("20"); end |
ui:InsertFrame(ed_height); |
-------------- ButtonSkin |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Button Skin"))); |
-------------- Display |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Display"))); |
local chk_bs = VFLUI.CheckEmbedRight(ui, VFLI.i18n("Use Button Skin")); |
local dd_buttonSkin = VFLUI.Dropdown:new(chk_bs, VFLUI.GetButtonSkinList); |
dd_buttonSkin:SetWidth(150); dd_buttonSkin:Show(); |
if desc and desc.externalButtonSkin then |
dd_buttonSkin:SetSelection(desc.externalButtonSkin); |
if desc and desc.usebs then |
chk_bs:SetChecked(true); |
dd_buttonSkin:SetSelection(desc.externalButtonSkin); |
else |
chk_bs:SetChecked(); |
dd_buttonSkin:SetSelection("bs_default"); |
end |
chk_bs:EmbedChild(dd_buttonSkin); chk_bs:Show(); |
ui:InsertFrame(chk_bs); |
if desc and desc.ButtonSkinOffset then ed_bs.editBox:SetText(desc.ButtonSkinOffset); end |
ui:InsertFrame(ed_bs); |
local chk_bkd = VFLUI.CheckEmbedRight(ui, VFLI.i18n("Use Backdrop")); |
local dd_backdrop = VFLUI.MakeBackdropSelectButton(chk_bkd, desc.bkd); |
dd_backdrop:Show(); |
if desc and desc.usebkd then |
chk_bkd:SetChecked(true); |
else |
chk_bkd:SetChecked(); |
end |
chk_bkd:EmbedChild(dd_backdrop); chk_bkd:Show(); |
ui:InsertFrame(chk_bkd); |
-------------- Data source |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Datasource"))); |
local number = RDXUI.MakeSlotSelectorDropdown(ui, VFLI.i18n("Number"), state, "NumberVar_"); |
if desc and desc.number then number:SetSelection(desc.number); end |
if desc and desc.color5 then color5:SetColor(VFL.explodeRGBA(desc.color5)); end |
function ui:GetDescriptor() |
local ebs = nil; |
if chk_bs:GetChecked() then ebs = dd_buttonSkin:GetSelection(); end |
if chk_bs:GetChecked() then chk_bkd:SetChecked(); end |
return { |
feature = "custom_icons"; version = 1; |
name = ed_name.editBox:GetText(); |
w = VFL.clamp(ed_width.editBox:GetNumber(), 1, 100); |
h = VFL.clamp(ed_height.editBox:GetNumber(), 1, 100); |
-- display |
externalButtonSkin = ebs; |
usebs = chk_bs:GetChecked(); |
externalButtonSkin = dd_buttonSkin:GetSelection(); |
ButtonSkinOffset = VFL.clamp(ed_bs.editBox:GetNumber(), 0, 50); |
usebkd = chk_bkd:GetChecked(); |
bkd = dd_backdrop:GetSelectedBackdrop(); |
number = number.editBox:GetText(); |
drawLayer = drawLayer:GetSelection(); |
texture = tsel:GetSelectedTexture(); |
orientation = "RIGHT"; iconspx = 5; iconspy = 0; |
externalButtonSkin = "bs_default"; |
ButtonSkinOffset = 0; |
bkd = VFL.copy(VFLUI.defaultBackdrop); |
drawLayer = "ARTWORK"; |
texture = VFL.copy(VFLUI.defaultTexture); |
color1 = {r=1,g=1,b=1,a=1}; |
end; |
ExposeFeature = function(desc, state, errs) |
if not desc then VFL.AddError(errs, VFLI.i18n("Missing descriptor.")); return nil; end |
if not desc.usebkd then desc.usebs = true; end |
local flg = true; |
flg = flg and RDXUI.UFFrameCheck_Proto("Icons_", desc, state, errs); |
flg = flg and RDXUI.UFAnchorCheck(desc.anchor, state, errs); |
end; |
ApplyFeature = function(desc, state) |
local objname = "Icons_" .. desc.name; |
local ebsflag, ebs, ebsos = "false", "bs_default", 0; |
if desc.externalButtonSkin then |
ebsflag = "true"; |
ebs = desc.externalButtonSkin; |
if desc.ButtonSkinOffset then ebsos = desc.ButtonSkinOffset; end |
local usebs = "false"; if desc.usebs then usebs = "true"; end |
local ebs = desc.externalButtonSkin or "bs_default"; |
local usebkd = "false"; if desc.usebkd then usebkd = "true"; end |
local bkd = desc.bkd or VFLUI.defaultBackdrop; |
local os = 0; |
if desc.usebs then |
os = desc.ButtonSkinOffset or 0; |
elseif desc.usebkd then |
if desc.bkd and desc.bkd.insets and desc.bkd.insets.left then os = desc.bkd.insets.left or 0; end |
end |
local showweapons = "false"; |
if desc.showweapons then showweapons = "true"; end |
if not desc.xoffset then desc.xoffset = "0"; end |
for _,child in self:ActiveChildren() do |
if not child.btn then |
local btn; |
if ]] .. ebsflag .. [[ then |
if ]] .. usebs .. [[ then |
btn = VFLUI.SkinButton:new(); |
btn:SetButtonSkin("]] .. ebs ..[[", true, true, false, true, true, true, false, true, true, true); |
elseif ]] .. usebkd .. [[ then |
btn = VFLUI.AcquireFrame("Frame"); |
VFLUI.SetBackdrop(btn, ]] .. Serialize(bkd) .. [[); |
else |
btn = VFLUI.AcquireFrame("Frame"); |
end |
btn:SetAllPoints(child); |
btn.tex = VFLUI.CreateTexture(btn); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. ebsos .. [[, -]] .. ebsos .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. ebsos .. [[, ]] .. ebsos .. [[); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. os .. [[, -]] .. os .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. os .. [[, ]] .. os .. [[); |
btn.tex:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
btn.tex:SetDrawLayer("ARTWORK", 2); |
btn.tex:Show(); |
if tempEnchant1 then |
if not tempEnchant1.btn then |
local btn; |
if ]] .. ebsflag .. [[ then |
if ]] .. usebs .. [[ then |
btn = VFLUI.SkinButton:new(); |
btn:SetButtonSkin("]] .. ebs ..[[", true, true, false, true, true, true, false, true, true, true); |
elseif ]] .. usebkd .. [[ then |
btn = VFLUI.AcquireFrame("Frame"); |
VFLUI.SetBackdrop(btn, ]] .. Serialize(bkd) .. [[); |
else |
btn = VFLUI.AcquireFrame("Frame"); |
end |
btn:SetAllPoints(tempEnchant1); |
btn.tex = VFLUI.CreateTexture(btn); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. ebsos .. [[, -]] .. ebsos .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. ebsos .. [[, ]] .. ebsos .. [[); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. os .. [[, -]] .. os .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. os .. [[, ]] .. os .. [[); |
btn.tex:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
btn.tex:Show(); |
if tempEnchant2 then |
if not tempEnchant2.btn then |
local btn; |
if ]] .. ebsflag .. [[ then |
if ]] .. usebs .. [[ then |
btn = VFLUI.SkinButton:new(); |
btn:SetButtonSkin("]] .. ebs ..[[", true, true, false, true, true, true, false, true, true, true); |
elseif ]] .. usebkd .. [[ then |
btn = VFLUI.AcquireFrame("Frame"); |
VFLUI.SetBackdrop(btn, ]] .. Serialize(bkd) .. [[); |
else |
btn = VFLUI.AcquireFrame("Frame"); |
end |
btn:SetAllPoints(tempEnchant2); |
btn.tex = VFLUI.CreateTexture(btn); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. ebsos .. [[, -]] .. ebsos .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. ebsos .. [[, ]] .. ebsos .. [[); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. os .. [[, -]] .. os .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. os .. [[, ]] .. os .. [[); |
btn.tex:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
btn.tex:Show(); |
if tempEnchant3 then |
if not tempEnchant3.btn then |
local btn; |
if ]] .. ebsflag .. [[ then |
if ]] .. usebs .. [[ then |
btn = VFLUI.SkinButton:new(); |
btn:SetButtonSkin("]] .. ebs ..[[", true, true, false, true, true, true, false, true, true, true); |
elseif ]] .. usebkd .. [[ then |
btn = VFLUI.AcquireFrame("Frame"); |
VFLUI.SetBackdrop(btn, ]] .. Serialize(bkd) .. [[); |
else |
btn = VFLUI.AcquireFrame("Frame"); |
end |
btn:SetAllPoints(tempEnchant3); |
btn.tex = VFLUI.CreateTexture(btn); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. ebsos .. [[, -]] .. ebsos .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. ebsos .. [[, ]] .. ebsos .. [[); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. os .. [[, -]] .. os .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. os .. [[, ]] .. os .. [[); |
btn.tex:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
btn.tex:Show(); |
if desc and desc.yoffset then ed_yoffset.editBox:SetText(desc.yoffset); else ed_yoffset.editBox:SetText("0"); end |
ui:InsertFrame(ed_yoffset); |
-------------- ButtonSkin |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Button Skin"))); |
-------------- Display |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Display"))); |
local chk_bs = VFLUI.CheckEmbedRight(ui, VFLI.i18n("Use Button Skin")); |
local dd_buttonSkin = VFLUI.Dropdown:new(chk_bs, VFLUI.GetButtonSkinList); |
dd_buttonSkin:SetWidth(150); dd_buttonSkin:Show(); |
if desc and desc.externalButtonSkin then |
dd_buttonSkin:SetSelection(desc.externalButtonSkin); |
if desc and desc.usebs then |
chk_bs:SetChecked(true); |
dd_buttonSkin:SetSelection(desc.externalButtonSkin); |
else |
chk_bs:SetChecked(); |
dd_buttonSkin:SetSelection("bs_default"); |
end |
chk_bs:EmbedChild(dd_buttonSkin); chk_bs:Show(); |
ui:InsertFrame(chk_bs); |
if desc and desc.ButtonSkinOffset then ed_bs.editBox:SetText(desc.ButtonSkinOffset); end |
ui:InsertFrame(ed_bs); |
local chk_bkd = VFLUI.CheckEmbedRight(ui, VFLI.i18n("Use Backdrop")); |
local dd_backdrop = VFLUI.MakeBackdropSelectButton(chk_bkd, desc.bkd); |
dd_backdrop:Show(); |
if desc and desc.usebkd then |
chk_bkd:SetChecked(true); |
else |
chk_bkd:SetChecked(); |
end |
chk_bkd:EmbedChild(dd_backdrop); chk_bkd:Show(); |
ui:InsertFrame(chk_bkd); |
-------------- CooldownDisplay |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Cooldown"))); |
local ercd = VFLUI.EmbedRight(ui, VFLI.i18n("Cooldown :")); |
ui:InsertFrame(er); |
function ui:GetDescriptor() |
local ebs = nil; |
if chk_bs:GetChecked() then ebs = dd_buttonSkin:GetSelection(); end |
if chk_bs:GetChecked() then chk_bkd:SetChecked(); end |
return { |
feature = "sec_aura_icons"; version = 1; |
name = ed_name.editBox:GetText(); |
xoffset = VFL.clamp(ed_xoffset.editBox:GetNumber(), -10, 10); |
yoffset = VFL.clamp(ed_yoffset.editBox:GetNumber(), -10, 10); |
-- display |
externalButtonSkin = ebs; |
usebs = chk_bs:GetChecked(); |
externalButtonSkin = dd_buttonSkin:GetSelection(); |
ButtonSkinOffset = VFL.clamp(ed_bs.editBox:GetNumber(), 0, 50); |
bkd = nil; |
usebkd = chk_bkd:GetChecked(); |
bkd = dd_backdrop:GetSelectedBackdrop(); |
-- cooldown |
cd = cd:GetSelectedCooldown(); |
fontst = fontsel2:GetSelectedFont(); |
template = "RDXAB30x30Template"; orientation = "LEFT"; wrapafter = 10; maxwraps = 2; xoffset = 0; yoffset = 0; point = "TOPLEFT"; |
externalButtonSkin = "bs_default"; |
ButtonSkinOffset = 0; |
bkd = VFL.copy(VFLUI.defaultBackdrop); |
cd = VFL.copy(VFLUI.defaultCooldown); |
fontst = font; |
sortmethod = "INDEX"; |
--------------- Code emitter helpers |
local function _EmitCreateCode(objname, desc) |
local ebsflag, ebs, ebsos = "false", "bs_default", 0; |
if desc.externalButtonSkin then |
ebsflag = "true"; |
ebs = desc.externalButtonSkin; |
if desc.ButtonSkinOffset then ebsos = desc.ButtonSkinOffset; end |
local usebs = "false"; if desc.usebs then usebs = "true"; end |
local ebs = desc.externalButtonSkin or "bs_default"; |
local usebkd = "false"; if desc.usebkd then usebkd = "true"; end |
local bkd = desc.bkd or VFLUI.defaultBackdrop; |
local os = 0; |
if desc.usebs then |
os = desc.ButtonSkinOffset or 0; |
elseif desc.usebkd then |
if desc.bkd and desc.bkd.insets and desc.bkd.insets.left then os = desc.bkd.insets.left or 0; end |
end |
local createCode = [[ |
frame.]] .. objname .. [[ = {}; |
local btn, btnOwner = nil, ]] .. RDXUI.ResolveFrameReference(desc.owner) .. [[; |
for i=1, ]] .. desc.nIcons .. [[ do |
if ]] .. ebsflag .. [[ then |
if ]] .. usebs .. [[ then |
btn = VFLUI.SkinButton:new(); |
btn:SetButtonSkin("]] .. ebs ..[[", true, true, false, true, true, true, false, true, true, true); |
elseif ]] .. usebkd .. [[ then |
btn = VFLUI.AcquireFrame("Frame"); |
VFLUI.SetBackdrop(btn, ]] .. Serialize(bkd) .. [[); |
else |
btn = VFLUI.AcquireFrame("Frame"); |
end |
end |
createCode = createCode .. [[ |
btn.tex = VFLUI.CreateTexture(btn); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. ebsos .. [[, -]] .. ebsos .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. ebsos .. [[, ]] .. ebsos .. [[); |
btn.tex:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. os .. [[, -]] .. os .. [[); |
btn.tex:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. os .. [[, ]] .. os .. [[); |
btn.tex:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
btn.tex:SetDrawLayer("ARTWORK", 2); |
btn.tex:Show(); |
if not desc then VFL.AddError(errs, VFLI.i18n("Missing descriptor.")); return nil; end |
if desc.owner == "Base" then desc.owner = "decor"; end |
if not desc.cd then desc.cd = VFL.copy(VFLUI.defaultCooldown); end |
if not desc.usebkd then desc.usebs = true; end |
local flg = true; |
flg = flg and RDXUI.UFFrameCheck_Proto("Icons_", desc, state, errs); |
flg = flg and RDXUI.UFAnchorCheck(desc.anchor, state, errs); |
end; |
ApplyFeature = function(desc, state) |
local objname = "Icons_" .. desc.name; |
local ebsflag, ebs, ebsos = "false", "bs_default", 0; |
if desc.externalButtonSkin then |
ebsflag = "true"; |
ebs = desc.externalButtonSkin; |
if desc.ButtonSkinOffset then ebsos = desc.ButtonSkinOffset; end |
local usebs = "false"; if desc.usebs then usebs = "true"; end |
local ebs = desc.externalButtonSkin or "bs_default"; |
local usebkd = "false"; if desc.usebkd then usebkd = "true"; end |
local bkd = desc.bkd or VFLUI.defaultBackdrop; |
local os = 0; |
if desc.usebs then |
os = desc.ButtonSkinOffset or 0; |
elseif desc.usebkd then |
if desc.bkd and desc.bkd.insets and desc.bkd.insets.left then os = desc.bkd.insets.left or 0; end |
end |
-- Event hinting. |
local mux, mask = state:GetContainingWindowState():GetSlotValue("Multiplexer"), 0; |
mask = mux:GetPaintMask("COOLDOWN"); |
if (_j > ]] .. desc.nIcons .. [[) then break; end |
tbl_icons = sort_icons[_j]; |
if not tbl_icons then break; end |
__SetCooldownIcon(_icons[_j], tbl_icons._meta, tbl_icons._tex, tbl_icons._dur, tbl_icons._tl, tbl_icons._i, ]] .. ebs .. [[); |
__SetCooldownIcon(_icons[_j], tbl_icons._meta, tbl_icons._tex, tbl_icons._dur, tbl_icons._tl, tbl_icons._i); |
_j = _j + 1; |
end |
if desc and desc.size then ed_size.editBox:SetText(desc.size); end |
ui:InsertFrame(ed_size); |
-------------- ButtonSkin |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Button Skin"))); |
-------------- Display |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Display"))); |
local chk_bs = VFLUI.CheckEmbedRight(ui, VFLI.i18n("Use Button Skin")); |
local dd_buttonSkin = VFLUI.Dropdown:new(chk_bs, VFLUI.GetButtonSkinList); |
dd_buttonSkin:SetWidth(150); dd_buttonSkin:Show(); |
if desc and desc.externalButtonSkin then |
dd_buttonSkin:SetSelection(desc.externalButtonSkin); |
if desc and desc.usebs then |
chk_bs:SetChecked(true); |
dd_buttonSkin:SetSelection(desc.externalButtonSkin); |
else |
chk_bs:SetChecked(); |
dd_buttonSkin:SetSelection("bs_default"); |
end |
chk_bs:EmbedChild(dd_buttonSkin); chk_bs:Show(); |
ui:InsertFrame(chk_bs); |
if desc and desc.ButtonSkinOffset then ed_bs.editBox:SetText(desc.ButtonSkinOffset); end |
ui:InsertFrame(ed_bs); |
local chk_bkd = VFLUI.CheckEmbedRight(ui, VFLI.i18n("Use Backdrop")); |
local dd_backdrop = VFLUI.MakeBackdropSelectButton(chk_bkd, desc.bkd); |
dd_backdrop:Show(); |
if desc and desc.usebkd then |
chk_bkd:SetChecked(true); |
else |
chk_bkd:SetChecked(); |
end |
chk_bkd:EmbedChild(dd_backdrop); chk_bkd:Show(); |
ui:InsertFrame(chk_bkd); |
-------------- CooldownDisplay |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Cooldown"))); |
local ercd = VFLUI.EmbedRight(ui, VFLI.i18n("Cooldown :")); |
function ui:GetDescriptor() |
local filterName, filterNameList, filternl, ext, unitfi, maxdurfil, mindurfil = nil, nil, {}, nil, "", "", ""; |
local ebs = nil; |
if chk_bs:GetChecked() then ebs = dd_buttonSkin:GetSelection(); end |
if chk_bs:GetChecked() then chk_bkd:SetChecked(); end |
if chk_timefilter:GetChecked() then |
maxdurfil = ed_maxduration.editBox:GetText(); |
mindurfil = ed_minduration.editBox:GetText(); |
iconspy = VFL.clamp(ed_iconspy.editBox:GetNumber(), -200, 200); |
size = VFL.clamp(ed_size.editBox:GetNumber(), 1, 100); |
-- display |
externalButtonSkin = ebs; |
usebs = chk_bs:GetChecked(); |
externalButtonSkin = dd_buttonSkin:GetSelection(); |
ButtonSkinOffset = VFL.clamp(ed_bs.editBox:GetNumber(), 0, 50); |
bkd = nil; |
--bkd = bkd:GetSelectedBackdrop(); |
usebkd = chk_bkd:GetChecked(); |
bkd = dd_backdrop:GetSelectedBackdrop(); |
-- cooldown |
cd = cd:GetSelectedCooldown(); |
-- other |
cd = VFL.copy(VFLUI.defaultCooldown); |
externalButtonSkin = "bs_default"; |
ButtonSkinOffset = 0; |
bkd = VFL.copy(VFLUI.defaultBackdrop); |
}; |
end; |
}); |