/trunk/RDX/Designs
local function _EmitCreateCode(objname, desc) |
--desc.nIcons = GetNumShapeshiftForms(); |
desc.nIcons = 8; |
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 |
--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 hidebs = "nil"; if desc.hidebs then hidebs = "true"; end |
local showkey = "nil"; if desc.showkey then showkey = "true"; end |
local showtooltip = "nil"; if desc.showtooltip then showtooltip = "true"; end |
]]; |
if desc.test then |
createCode = createCode .. [[ |
btn = RDXUI.ActionButtonTest:new(h, abid, ]] .. ebsflag .. [[, "]] .. ebs .. [[", ]] .. ebsos .. [[, ]] .. hidebs .. [[, statesString, nbuttons, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[); |
local btn = RDXUI.ActionButtonTest:new(h, abid, ]] .. desc.size .. [[, ]] .. usebs .. [[, "]] .. ebs .. [[", ]] .. usebkd .. [[, ]] .. Serialize(bkd) .. [[, ]] .. os .. [[, ]] .. hidebs .. [[, statesString, nbuttons, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[); |
]]; |
else |
createCode = createCode .. [[ |
local btn = RDXUI.StanceButton:new(h, abid, ]] .. ebsflag .. [[, "]] .. ebs .. [[", ]] .. ebsos .. [[, ]] .. hidebs .. [[, statesString, ]] .. desc.nIcons .. [[, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[); |
local btn = RDXUI.StanceButton:new(h, abid, ]] .. desc.size .. [[, ]] .. usebs .. [[, "]] .. ebs .. [[", ]] .. usebkd .. [[, ]] .. Serialize(bkd) .. [[, ]] .. os .. [[, ]] .. hidebs .. [[, statesString, ]] .. desc.nIcons .. [[, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[); |
]]; |
end |
createCode = createCode .. [[ |
createCode = createCode .. VFLUI.GenerateSetFontCode("btn.txtHotkey", desc.fontkey, nil, true); |
createCode = createCode .. [[ |
if btn.Init then btn:Init(); end |
btn:SetWidth(]] .. desc.size .. [[); btn:SetHeight(]] .. desc.size .. [[); |
--btn:Show(); |
frame.]] .. objname .. [[[i] = btn; |
abid = abid + 1; |
createCode = createCode .. RDXUI.LayoutCodeMultiRows(objname, desc); |
createCode = createCode .. [[ |
if dabid then |
RDX.printW("Stance Button already used, See feature ]] .. desc.name ..[["); |
--RDX.printW("Stance Button already used, See feature ]] .. desc.name ..[["); |
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 |
local flg = true; |
flg = flg and RDXUI.UFFrameCheck_Proto("Frame_", desc, state, errs); |
flg = flg and RDXUI.UFAnchorCheck(desc.anchor, state, errs); |
if desc and desc.size then ed_size.editBox:SetText(desc.size); end |
ui:InsertFrame(ed_size); |
-------------- ButtonSkin or Frame |
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); |
local ed_bs = VFLUI.LabeledEdit:new(ui, 50); ed_bs:Show(); |
ed_bs:SetText(VFLI.i18n("Button Skin, Icon size")); |
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); |
-------------- COOLDOWN |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Cooldown"))); |
local ercd = VFLUI.EmbedRight(ui, VFLI.i18n("Cooldown :")); |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("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 = "stancebar"; version = 1; |
name = ed_name.editBox:GetText(); |
iconspx = VFL.clamp(ed_iconspx.editBox:GetNumber(), -20, 200); |
iconspy = VFL.clamp(ed_iconspy.editBox:GetNumber(), -20, 200); |
size = VFL.clamp(ed_size.editBox:GetNumber(), 20, 100); |
-- Skin |
externalButtonSkin = ebs; |
-- display |
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(); |
-- Cooldown |
cd = cd:GetSelectedCooldown(); |
cdTimerType = nil; |
anchor = { lp = "TOPLEFT", af = "Base", rp = "TOPLEFT", dx = 0, dy = 0}; |
size = 36; rows = 1; orientation = "RIGHT"; iconspx = 5; iconspy = 0; |
externalButtonSkin = "bs_default"; |
bkd = VFL.copy(VFLUI.defaultBackdrop); |
ButtonSkinOffset = 0; |
fontkey = fontk; |
cd = VFL.copy(VFLUI.defaultCooldown); |
local function _EmitCreateCode2(objname, desc, winpath) |
desc.nIcons = 3; desc.rows = 1; |
if not desc.size then desc.size = 36; end |
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 |
--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 showkey = "nil"; if desc.showkey then showkey = "true"; end |
local test = "nil"; if desc.test then test = "true"; end |
-- Create buttons |
for i=1, ]] .. desc.nIcons .. [[ do |
btn = RDXUI.VehicleButton:new(h, abid, ]] .. ebsflag .. [[, "]] .. ebs .. [[", ]] .. ebsos .. [[, nil, nil, ]] .. desc.nIcons .. [[, ]] .. test .. [[); |
btn = RDXUI.VehicleButton:new(h, abid, ]] .. desc.size .. [[, ]] .. usebs .. [[, "]] .. ebs .. [[", ]] .. usebkd .. [[, ]] .. Serialize(bkd) .. [[, ]] .. os .. [[, nil, nil, ]] .. desc.nIcons .. [[, ]] .. test .. [[); |
if btn then |
btn:SetWidth(]] .. desc.size .. [[); btn:SetHeight(]] .. desc.size .. [[); |
btn:Show(); |
]]; |
createCode = createCode .. VFLUI.GenerateSetFontCode("btn.txtHotkey", desc.fontkey, nil, true); |
createCode = createCode .. RDXUI.LayoutCodeMultiRows(objname, desc); |
createCode = createCode .. [[ |
if dabid then |
RDX.printE("Vehicle Buttons already used, See window ]] .. winpath ..[["); |
--RDX.printE("Vehicle Buttons already used, See window ]] .. winpath ..[["); |
end |
]]; |
return createCode; |
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 |
local flg = true; |
flg = flg and RDXUI.UFFrameCheck_Proto("Frame_", desc, state, errs); |
flg = flg and RDXUI.UFAnchorCheck(desc.anchor, state, errs); |
if desc and desc.size then ed_size.editBox:SetText(desc.size); end |
ui:InsertFrame(ed_size); |
-------------- ButtonSkin or Frame |
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); |
local ed_bs = VFLUI.LabeledEdit:new(ui, 50); ed_bs:Show(); |
ed_bs:SetText(VFLI.i18n("Button Skin, Icon size")); |
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); |
-------------- Display |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("Display"))); |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("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 = "vehiclebar"; version = 1; |
name = ed_name.editBox:GetText(); |
iconspx = VFL.clamp(ed_iconspx.editBox:GetNumber(), -20, 200); |
iconspy = VFL.clamp(ed_iconspy.editBox:GetNumber(), -20, 200); |
size = VFL.clamp(ed_size.editBox:GetNumber(), 20, 100); |
-- Skin |
externalButtonSkin = ebs; |
-- display |
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(); |
-- Display |
fontkey = fontkey:GetSelectedFont(); |
showkey = chk_showkey:GetChecked(); |
anchor = { lp = "TOPLEFT", af = "Base", rp = "TOPLEFT", dx = 0, dy = 0}; |
size = 36; rows = 1; orientation = "RIGHT"; iconspx = 5; iconspy = 0; |
externalButtonSkin = "bs_default"; |
cd = VFL.copy(VFLUI.defaultCooldown); |
ButtonSkinOffset = 0; |
fontkey = fontk; |
}; |
-- Create function |
local function _EmitCreateCode(objname, desc) |
local ebsflag, ebs, ebsos = "false", "bs_default", 0; |
--if desc.externalButtonSkin then |
ebsflag = "true"; |
ebs = desc.externalButtonSkin; |
if not ebs then ebs = "bs_default"; end |
if desc.ButtonSkinOffset then ebsos = desc.ButtonSkinOffset; end |
--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 hidebs = "nil"; if desc.hidebs then hidebs = "true"; end |
local showkey = "nil"; if desc.showkey then showkey = "true"; end |
local showtooltip = "nil"; if desc.showtooltip then showtooltip = "true"; end |
-- Create buttons |
for i=1, ]] .. desc.nIcons .. [[ do |
local btn = RDXUI.ActionButton:new(h, abid, ]] .. ebsflag .. [[, "]] .. ebs .. [[", ]] .. ebsos .. [[, ]] .. hidebs .. [[, "]] .. headerstate .. [[", ]] .. desc.nIcons .. [[, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[, ]] .. anyup .. [[, ]] .. selfcast .. [[); |
local btn = RDXUI.ActionButton:new(h, abid, ]] .. desc.size .. [[, ]] .. usebs .. [[, "]] .. ebs .. [[", ]] .. usebkd .. [[, ]] .. Serialize(bkd) .. [[, ]] .. os .. [[, ]] .. hidebs .. [[, "]] .. headerstate .. [[", ]] .. desc.nIcons .. [[, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[, ]] .. anyup .. [[, ]] .. selfcast .. [[); |
]]; |
createCode = createCode .. VFLUI.GenerateSetFontCode("btn.txtCount", desc.fontcount, nil, true); |
createCode = createCode .. VFLUI.GenerateSetFontCode("btn.txtMacro", desc.fontmacro, nil, true); |
else |
dabid = abid; |
end |
btn:SetWidth(]] .. desc.size .. [[); btn:SetHeight(]] .. desc.size .. [[); |
btn:Show(); |
frame.]] .. objname .. [[[i] = btn; |
abid = abid + 1; |
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 desc.headerstateType == "Custom" then |
local test = __RDXconvertStatesTable(desc.headerstateCustom); |
if #test == 0 then VFL.AddError(errs, VFLI.i18n("Custom definition invalid")); return nil; 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); |
local ed_bs = VFLUI.LabeledEdit:new(ui, 50); ed_bs:Show(); |
ed_bs:SetText(VFLI.i18n("Button Skin, Icon size")); |
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); |
local chk_hidebs = VFLUI.Checkbox:new(ui); chk_hidebs:Show(); |
chk_hidebs:SetText(VFLI.i18n("Hide empty button")); |
if desc and desc.hidebs then chk_hidebs:SetChecked(true); else chk_hidebs:SetChecked(); end |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("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 = "actionbar"; version = 1; |
name = ed_name.editBox:GetText(); |
iconspx = VFL.clamp(ed_iconspx.editBox:GetNumber(), -20, 200); |
iconspy = VFL.clamp(ed_iconspy.editBox:GetNumber(), -20, 200); |
size = VFL.clamp(ed_size.editBox:GetNumber(), 20, 100); |
-- Skin |
externalButtonSkin = ebs; |
-- display |
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(); |
hidebs = chk_hidebs:GetChecked(); |
-- Cooldown |
cd = cd:GetSelectedCooldown(); |
anchor = { lp = "TOPLEFT", af = "Base", rp = "TOPLEFT", dx = 0, dy = 0}; |
nIcons = 12; size = 36; rows = 1; orientation = "RIGHT"; iconspx = 5; iconspy = 0; |
externalButtonSkin = "bs_default"; |
bkd = VFL.copy(VFLUI.defaultBackdrop); |
ButtonSkinOffset = 0; |
fontkey = fontk; |
fontmacro = fontm; |
x:SetScript("OnAttributeChanged", nil); |
x:SetScript("OnDragStart", nil); x:SetScript("OnReceiveDrag", nil); |
--VFLUI._CleanupButton(x); |
VFLUI._CleanupLayoutFrame(x); |
--VFLUI._CleanupLayoutFrame(x); |
x:SetBackdrop(nil); |
x:Hide(); x:SetParent(VFLParent); x:ClearAllPoints(); |
end, |
function(_, key) |
local f = nil; |
return f; |
end, |
function(_, f) -- on acquired |
f:ClearAllPoints(); |
f:EnableMouse(true); |
f:Show(); |
--f:ClearAllPoints(); |
--f:EnableMouse(true); |
--f:SetBackdrop(nil); |
--f:Show(); |
end, |
"key"); |
x:SetScript("OnAttributeChanged", nil); |
x:SetScript("OnDragStart", nil); x:SetScript("OnReceiveDrag", nil); |
--VFLUI._CleanupButton(x); |
VFLUI._CleanupLayoutFrame(x); |
--VFLUI._CleanupLayoutFrame(x); |
x:SetBackdrop(nil); |
x:Hide(); x:SetParent(VFLParent); x:ClearAllPoints(); |
end, |
function(_, key) |
local f = CreateFrame("CheckButton", "VFLButton" .. GetTmpId(), nil, "SecureActionButtonTemplate"); |
else |
local infoType = GetCursorInfo(); |
if infoType then |
self._texFlash:SetAlpha(1); |
--self._texGloss:Show(); |
if self.usebs then |
self._texFlash:SetAlpha(1); |
--self._texGloss:Show(); |
end |
else |
--self._texGloss:Hide(); |
self._texFlash:SetAlpha(0); |
if self.usebs then |
--self._texGloss:Hide(); |
self._texFlash:SetAlpha(0); |
end |
end |
end |
end |
local function ABHideGameTooltip(self) |
GameTooltip:Hide(); |
--self._texGloss:Hide(); |
self._texFlash:SetAlpha(0); |
if self.usebs then |
--self._texGloss:Hide(); |
self._texFlash:SetAlpha(0); |
end |
self.IsShowingTooltip = nil; |
end |
RDXUI.ActionButton = {}; |
function RDXUI.ActionButton:new(parent, id, ebsflag, ebs, ebsos, ebhide, statesString, nbuttons, cd, showkey, showtooltip, anyup, selfcast) |
function RDXUI.ActionButton:new(parent, id, size, usebs, ebs, usebkd, bkd, os, ebhide, statesString, nbuttons, cd, showkey, showtooltip, anyup, selfcast) |
local self = nil; |
if ebsflag then |
if usebs then |
self = VFLUI.SkinButton:new(parent, "SecureActionButtonBar", id); |
if not self then self = VFLUI.SkinButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 200; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonSkin(ebs, true, true, true, true, true, true, false, true, true, true); |
elseif usebkd then |
self = VFLUI.BckButton:new(parent, "SecureActionButtonBar", id); |
if not self then self = VFLUI.BckButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 200; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonBkd(bkd); |
end |
VFLUI.StdSetParent(self, parent); |
self:SetFrameLevel(parent:GetFrameLevel()); |
--VFLUI.StdSetParent(self, parent); |
--self:SetFrameLevel(parent:GetFrameLevel()); |
-- store the id 1 to 120 of the frame for keybinding. |
-- This is not the action. A button id can have many action when using state. |
self.id = id; |
self.btype = ""; |
self.usebs = usebs; |
self.usebkd = usebkd; |
self.ebhide = ebhide; |
self.showtooltip = showtooltip; |
-- icon texture |
self.icon = VFLUI.CreateTexture(self); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", ebsos, -ebsos); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -ebsos, ebsos); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", os, -os); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -os, os); |
self.icon:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
self.icon:SetDrawLayer("ARTWORK", 2); |
self.icon:Show(); |
end |
local function UpdateState() |
self._texFlash:SetVertexColor(1, 1, 1, 0); |
if self.usebs then |
self._texFlash:SetVertexColor(1, 1, 1, 0); |
--elseif usebkd then |
--self:SetBackdropBorderColor(1, 1, 1, 0); |
end |
if self.error then |
self.icon:SetTexture("Interface\\InventoryItems\\WoWUnknownItem01.blp"); |
else |
-- use when bar page changed, and the action is changed |
local function UpdateNewAction() |
self.action = self:GetAttribute("action"); |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 1, 1, 1); |
end |
if not self.action then return; end |
if HasAction(self.action) then |
WoWEvents:Unbind("actionButton" .. self.id); |
VFLT.AdaptiveUnschedule("ScheduleactionButton" .. id); |
VFLT.AdaptiveSchedule("ScheduleactionButton" .. id, 0.1, function() |
if self.ga then |
self._texBorder:SetVertexColor(1, 0.5, 0, 0.8); |
self._texGloss:SetVertexColor(1, 0.5, 0, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 0.5, 0, 0.8); |
self._texGloss:SetVertexColor(1, 0.5, 0, 0.8); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 0.5, 0, 0.8); |
end |
-- current action yellow color |
elseif self.ca then |
self._texBorder:SetVertexColor(1, 1, 0, 0.8); |
self._texGloss:SetVertexColor(1, 1, 0, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 0, 0.8); |
self._texGloss:SetVertexColor(1, 1, 0, 0.8); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 1, 0, 0.8); |
end |
-- out of range red color |
elseif IsActionInRange(self.action) == 0 then |
self._texBorder:SetVertexColor(1, 0, 0, 0.8); |
self._texGloss:SetVertexColor(1, 0, 0, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 0, 0, 0.8); |
self._texGloss:SetVertexColor(1, 0, 0, 0.8); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 0, 0, 0.8); |
end |
-- out of mana blue color |
elseif self.ua then |
self._texBorder:SetVertexColor(0, 0, 1, 0.8); |
self._texGloss:SetVertexColor(0, 0, 1, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(0, 0, 1, 0.8); |
self._texGloss:SetVertexColor(0, 0, 1, 0.8); |
elseif self.usebkd then |
self:SetBackdropBorderColor(0, 0, 1, 0.8); |
end |
-- equipement item green color |
elseif self.ea then |
self._texBorder:SetVertexColor(0, 1, 0, 0.35); |
self._texGloss:SetVertexColor(0, 1, 0, 0.35); |
if self.usebs then |
self._texBorder:SetVertexColor(0, 1, 0, 0.35); |
self._texGloss:SetVertexColor(0, 1, 0, 0.35); |
elseif self.usebkd then |
self:SetBackdropBorderColor(0, 1, 0, 0.35); |
end |
-- default color |
else |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 1, 1, 1); |
end |
end |
end); |
else |
end |
-- Button Skin Hide |
if self.ebhide and (not HasAction(self.action)) then |
self:bsHide(); |
--if usebs then |
self:bsHide(); |
--end |
else |
self:bsShow(); |
--if usebs then |
self:bsShow(); |
--end |
end |
if self.IsShowingTooltip then ABShowGameTooltip(self); end |
end |
s.ua = nil; |
s.ea = nil; |
s.flash = nil; |
s.usebs = nil; |
s.usebkd = nil; |
s.ebhide = nil; |
s.btype = nil; |
s.action = nil; |
------------------------------------------- |
RDXUI.MultiCastButton = {}; |
function RDXUI.MultiCastButton:new(parent, id, ebsflag, ebs, ebsos, ebhide, statesString, nbuttons, cd, showkey, showtooltip, anyup) |
function RDXUI.MultiCastButton:new(parent, id, size, usebs, ebs, usebkd, bkd, os, ebhide, statesString, nbuttons, cd, showkey, showtooltip, anyup) |
local self = nil; |
if ebsflag then |
if usebs then |
self = VFLUI.SkinButton:new(parent, "SecureActionButtonBar", id); |
if not self then self = VFLUI.SkinButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 200; end |
self:SetButtonSkin(ebs, true, true, true, true, true, true, false, true, true, true); |
elseif usebkd then |
self = VFLUI.BckButton:new(parent, "SecureActionButtonBar", id); |
if not self then self = VFLUI.BckButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 200; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonBkd(bkd); |
end |
VFLUI.StdSetParent(self, parent); |
self:SetFrameLevel(parent:GetFrameLevel()); |
--VFLUI.StdSetParent(self, parent); |
--self:SetFrameLevel(parent:GetFrameLevel()); |
-- store the id 1 to 120 of the frame for keybinding. |
-- This is not the action. A button id can have many action when using state. |
self.id = id; |
self.btype = ""; |
self.usebs = usebs; |
self.usebkd = usebkd; |
self.ebhide = ebhide; |
self.showtooltip = showtooltip; |
-- icon texture |
self.icon = VFLUI.CreateTexture(self); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", ebsos, -ebsos); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -ebsos, ebsos); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", os, -os); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -os, os); |
self.icon:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
self.icon:SetDrawLayer("ARTWORK", 2); |
self.icon:Show(); |
end |
local function UpdateState() |
self._texFlash:SetVertexColor(1, 1, 1, 0); |
if self.usebs then |
self._texFlash:SetVertexColor(1, 1, 1, 0); |
--elseif usebkd then |
--self:SetBackdropBorderColor(1, 1, 1, 0); |
end |
if self.error then |
self.icon:SetTexture("Interface\\InventoryItems\\WoWUnknownItem01.blp"); |
else |
-- use when bar page changed, and the action is changed |
local function UpdateNewAction() |
self.action = self:GetAttribute("action"); |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 1, 1, 1); |
end |
if not self.action then return; end |
if HasAction(self.action) then |
WoWEvents:Unbind("multicastButton" .. self.id); |
VFLT.AdaptiveSchedule("SchedulemulticastButton" .. id, 0.1, function() |
-- current action yellow color |
if self.ca then |
self._texBorder:SetVertexColor(1, 1, 0, 0.8); |
self._texGloss:SetVertexColor(1, 1, 0, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 0, 0.8); |
self._texGloss:SetVertexColor(1, 1, 0, 0.8); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 1, 0, 0.8); |
end |
-- out of range red color |
elseif IsActionInRange(self.action) == 0 then |
self._texBorder:SetVertexColor(1, 0, 0, 0.8); |
self._texGloss:SetVertexColor(1, 0, 0, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 0, 0, 0.8); |
self._texGloss:SetVertexColor(1, 0, 0, 0.8); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 0, 0, 0.8); |
end |
-- out of mana blue color |
elseif self.ua then |
self._texBorder:SetVertexColor(0, 0, 1, 0.8); |
self._texGloss:SetVertexColor(0, 0, 1, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(0, 0, 1, 0.8); |
self._texGloss:SetVertexColor(0, 0, 1, 0.8); |
elseif self.usebkd then |
self:SetBackdropBorderColor(0, 0, 1, 0.8); |
end |
-- equipement item green color |
elseif self.ea then |
self._texBorder:SetVertexColor(0, 1, 0, 0.35); |
self._texGloss:SetVertexColor(0, 1, 0, 0.35); |
if self.usebs then |
self._texBorder:SetVertexColor(0, 1, 0, 0.35); |
self._texGloss:SetVertexColor(0, 1, 0, 0.35); |
elseif self.usebkd then |
self:SetBackdropBorderColor(0, 1, 0, 0.35); |
end |
-- default color |
else |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 1, 1, 1); |
end |
end |
end); |
else |
s.ua = nil; |
s.ea = nil; |
s.flash = nil; |
s.usebs = nil; |
s.usebkd = nil; |
s.ebhide = nil; |
s.btype = nil; |
s.action = nil; |
if (not x) then return; end |
x:SetScript("OnDragStart", nil); x:SetScript("OnReceiveDrag", nil); |
--VFLUI._CleanupButton(x); |
VFLUI._CleanupLayoutFrame(x); |
--VFLUI._CleanupLayoutFrame(x); |
x:SetBackdrop(nil); |
x:Hide(); x:SetParent(VFLParent); x:ClearAllPoints(); |
end, |
function(_, key) |
local f = nil; |
end |
return f; |
end, |
VFL.Noop, "key"); |
function(_, f) -- on acquired |
f:ClearAllPoints(); |
f:EnableMouse(true); |
f:SetBackdrop(nil); |
f:Show(); |
end, |
"key"); |
function ABPShowGameTooltip(self) |
if ( not self.tooltipName ) then |
RDXUI.PetActionButton = {}; |
function RDXUI.PetActionButton:new(parent, id, ebsflag, ebs, ebsos, ebhide, statesString, nbuttons, cd, showkey, showtooltip, anyup) |
function RDXUI.PetActionButton:new(parent, id, size, usebs, ebs, usebkd, bkd, os, ebhide, statesString, nbuttons, cd, showkey, showtooltip, anyup) |
local self = nil; |
if ebsflag then |
if usebs then |
self = VFLUI.SkinButton:new(parent, "SecureActionButtonPet", id); |
if not self then self = VFLUI.SkinButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 400; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonSkin(ebs, true, true, true, true, true, true, false, true, true, true); |
elseif usebkd then |
self = VFLUI.BckButton:new(parent, "SecureActionButtonPet", id); |
if not self then self = VFLUI.BckButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 400; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonBkd(bkd); |
end |
VFLUI.StdSetParent(self, parent); |
self:SetFrameLevel(parent:GetFrameLevel()); |
-- This is not the action. A button id can have many action when using state. |
self.id = id; |
self.btype = "Pet"; |
self.usebs = usebs; |
self.usebkd = usebkd; |
self.ebhide = ebhide; |
-- icon texture |
self.icon = VFLUI.CreateTexture(self); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", ebsos, -ebsos); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -ebsos, ebsos); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", os, -os); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -os, os); |
self.icon:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
self.icon:SetDrawLayer("ARTWORK", 2); |
self.icon:Show(); |
local name, subtext, texture, token, active, autocastallowed, autocastenabled = nil, nil, nil, nil, nil, nil, nil; |
local function UpdateState() |
self._texFlash:SetVertexColor(0, 0, 0, 0); |
if self.usebs then |
self._texFlash:SetVertexColor(0, 0, 0, 0); |
--elseif usebkd then |
-- self:SetBackdropBorderColor(0, 0, 0, 0); |
end |
self.icon:SetTexture(texture); |
if active then |
self.ca = true; |
VFLT.AdaptiveSchedule("ScheduleactionButtonPet" .. self.id, 0.3, function() |
-- current action yellow color |
if self.ca then |
self._texBorder:SetVertexColor(1, 1, 0, 0.8); |
self._texGloss:SetVertexColor(1, 1, 0, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 0, 0.8); |
self._texGloss:SetVertexColor(1, 1, 0, 0.8); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 1, 0, 0.8); |
end |
-- out of range red color |
--elseif IsActionInRange(action) == 0 then |
-- self._texBorder:SetVertexColor(1, 0, 0, 0.8); |
-- self._texGloss:SetVertexColor(1, 0, 0, 0.8); |
-- out of mana blue color |
elseif self.ua then |
self._texBorder:SetVertexColor(0, 0, 1, 0.8); |
self._texGloss:SetVertexColor(0, 0, 1, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(0, 0, 1, 0.8); |
self._texGloss:SetVertexColor(0, 0, 1, 0.8); |
elseif self.usebkd then |
self:SetBackdropBorderColor(0, 0, 1, 0.8); |
end |
-- local spell |
elseif self.ea and autocastenabled then |
self._texBorder:SetVertexColor(0, 1, 0, 0.35); |
self._texGloss:SetVertexColor(0, 1, 0, 0.35); |
if self.usebs then |
self._texBorder:SetVertexColor(0, 1, 0, 0.35); |
self._texGloss:SetVertexColor(0, 1, 0, 0.35); |
elseif self.usebkd then |
self:SetBackdropBorderColor(0, 1, 0, 0.35); |
end |
-- default color |
else |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
elseif self.usebkd then |
self:SetBackdropBorderColor(1, 1, 1, 1); |
end |
end |
end); |
else |
s.ua = nil; |
s.ea = nil; |
s.flash = nil; |
s.usebs = nil; |
s.usebkd = nil; |
s.ebhide = nil; |
s.btype = nil; |
end, self.Destroy); |
VFLUI.CreateFramePool("SecureActionButtonStance", function(pool, x) |
if (not x) then return; end |
--VFLUI._CleanupButton(x); |
VFLUI._CleanupLayoutFrame(x); |
--VFLUI._CleanupLayoutFrame(x); |
x:SetBackdrop(nil); |
x:Hide(); x:SetParent(VFLParent); x:ClearAllPoints(); |
end, function(_, key) |
local f = nil; |
if key > 0 and key < 11 then |
RDXUI.StanceButton = {}; |
function RDXUI.StanceButton:new(parent, id, ebsflag, ebs, ebsos, ebhide, statesString, nbuttons, cd, showkey, showtooltip) |
function RDXUI.StanceButton:new(parent, id, size, usebs, ebs, usebkd, bkd, os, ebhide, statesString, nbuttons, cd, showkey, showtooltip) |
local self = nil; |
if ebsflag then |
if usebs then |
self = VFLUI.SkinButton:new(parent, "SecureActionButtonStance", id); |
if not self then self = VFLUI.SkinButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 300; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonSkin(ebs, true, true, true, true, true, true, false, true, true, true); |
elseif usebkd then |
self = VFLUI.BckButton:new(parent, "SecureActionButtonStance", id); |
if not self then self = VFLUI.BckButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 200; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonBkd(bkd); |
end |
VFLUI.StdSetParent(self, parent); |
self:SetFrameLevel(parent:GetFrameLevel()); |
--VFLUI.StdSetParent(self, parent); |
--self:SetFrameLevel(parent:GetFrameLevel()); |
self.id = id; |
self.btype = "Stance"; |
self.usebs = usebs; |
self.usebkd = usebkd; |
self.ebhide = ebhide; |
-- icon texture |
self.icon = VFLUI.CreateTexture(self); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", ebsos, -ebsos); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -ebsos, ebsos); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", os, -os); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -os, os); |
self.icon:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
self.icon:SetDrawLayer("ARTWORK", 2); |
self.icon:Show(); |
local texture, name, isActive, isCastable = "", nil, nil, nil; |
local function UpdateState() |
texture, name, isActive, isCastable = GetShapeshiftFormInfo(self.id); |
self._texFlash:SetVertexColor(0, 0, 0, 0); |
if self.usebs then |
self._texFlash:SetVertexColor(0, 0, 0, 0); |
elseif usebkd then |
self:SetBackdropBorderColor(0, 0, 0, 0); |
end |
self.icon:SetTexture(texture); |
if isActive then |
self._texBorder:SetVertexColor(1, 1, 0, 0.8); |
self._texGloss:SetVertexColor(1, 1, 0, 0.8); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 0, 0.8); |
self._texGloss:SetVertexColor(1, 1, 0, 0.8); |
elseif usebkd then |
self:SetBackdropBorderColor(1, 1, 0, 0.8); |
end |
else |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
if self.usebs then |
self._texBorder:SetVertexColor(1, 1, 1, 1); |
self._texGloss:SetVertexColor(1, 1, 1, 1); |
elseif usebkd then |
self:SetBackdropBorderColor(1, 1, 1, 1); |
end |
end |
if isCastable then |
self.icon:SetAlpha(1); |
s.frtxt:Destroy(); s.frtxt = nil; |
s.cd:Destroy(); s.cd = nil; |
s.id = nil; |
s.usebs = nil; |
s.usebkd = nil; |
s.ebhide = nil; |
s.btype = nil; |
end, self.Destroy); |
RDXUI.ActionButtonTest = {}; |
function RDXUI.ActionButtonTest:new(parent, id, ebsflag, ebs, ebsos, ebhide, statesString, nbuttons, cd, showkey, showtooltip, anyup) |
function RDXUI.ActionButtonTest:new(parent, id, size, usebs, ebs, usebkd, bkd, os, ebhide, statesString, nbuttons, cd, showkey, showtooltip, anyup) |
local self = nil; |
if ebsflag then |
if usebs then |
self = VFLUI.SkinButton:new(parent, "SecureActionButtonBarTmp"); id = 400; |
if not self then self = VFLUI.SkinButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 400; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonSkin(ebs, true, true, false, true, true, true, false, true, true, true); |
elseif usebkd then |
self = VFLUI.BckButton:new(parent, "SecureActionButtonBar", id); |
if not self then self = VFLUI.BckButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 400; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonBkd(bkd); |
end |
VFLUI.StdSetParent(self, parent); |
self:SetFrameLevel(parent:GetFrameLevel()); |
--VFLUI.StdSetParent(self, parent); |
--self:SetFrameLevel(parent:GetFrameLevel()); |
-- store the id 1 to 10 of the frame for keybinding. |
self.usebs = usebs; |
self.usebkd = usebkd; |
self.ebhide = ebhide; |
-- icon texture |
self.icon = VFLUI.CreateTexture(self); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", ebsos, -ebsos); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -ebsos, ebsos); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", os, -os); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -os, os); |
self.icon:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
self.icon:SetDrawLayer("ARTWORK", 2); |
self.icon:Show(); |
s.frtxt:Destroy(); s.frtxt = nil; |
VFLUI.ReleaseRegion(s.icon); s.icon = nil; |
s.cd:Destroy(); s.cd = nil; |
s.usebs = nil; |
s.usebkd = nil; |
s.ebhide = nil; |
end, self.Destroy); |
return self; |
if (not x) then return; end |
--x:SetScript("OnDragStart", nil); x:SetScript("OnReceiveDrag", nil); |
--VFLUI._CleanupButton(x); |
VFLUI._CleanupLayoutFrame(x); |
--VFLUI._CleanupLayoutFrame(x); |
x:SetBackdrop(nil); |
x:Hide(); x:SetParent(VFLParent); x:ClearAllPoints(); |
end, |
function(_, key) |
local f = nil; |
RDXUI.VehicleButton = {}; |
function RDXUI.VehicleButton:new(parent, id, ebsflag, ebs, ebsos, ebhide, statesString, nbuttons, testmode) |
function RDXUI.VehicleButton:new(parent, id, size, usebs, ebs, usebkd, bkd, os, ebhide, statesString, nbuttons, testmode) |
local self = nil; |
if ebsflag then |
if usebs then |
self = VFLUI.SkinButton:new(parent, "ButtonVehicle", id); |
if not self then self = VFLUI.SkinButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 400; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonSkin(ebs, true, true, false, true, true, true, false, false, true, true); |
elseif usebkd then |
self = VFLUI.BckButton:new(parent, "ButtonVehicle", id); |
if not self then self = VFLUI.BckButton:new(parent, "SecureActionButtonBarTmp"); self.error = true; id = 200; end |
self:SetWidth(size); self:SetHeight(size); |
self:SetButtonBkd(bkd); |
end |
VFLUI.StdSetParent(self, parent); |
self:SetFrameLevel(parent:GetFrameLevel()); |
--VFLUI.StdSetParent(self, parent); |
--self:SetFrameLevel(parent:GetFrameLevel()); |
self.id = id; |
self.btype = "Vehicle"; |
self.usebs = usebs; |
self.usebkd = usebkd; |
-- icon texture |
self.icon = VFLUI.CreateTexture(self); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", ebsos, -ebsos); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -ebsos, ebsos); |
self.icon:SetPoint("TOPLEFT", self, "TOPLEFT", os, -os); |
self.icon:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -os, os); |
self.icon:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
self.icon:SetDrawLayer("ARTWORK", 2); |
self.icon:Show(); |
s.frtxt:Destroy(); s.frtxt = nil; |
s.id = nil; |
s.btype = nil; |
s.usebs = nil; |
s.usebkd = nil; |
s.ebhide = nil; |
end, self.Destroy); |
return self; |
-- Create function |
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 |
--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 hidebs = "nil"; if desc.hidebs then hidebs = "true"; end |
local showkey = "nil"; if desc.showkey then showkey = "true"; end |
local showtooltip = "nil"; if desc.showtooltip then showtooltip = "true"; end |
frame.]] .. objname .. [[ = {}; |
local dabid = nil; |
-- Create Main button cast |
local btn = VFLUI.SkinButton:new(btnOwner, "SecureUnitButton"); |
btn:SetWidth(]] .. desc.size .. [[); btn:SetHeight(]] .. desc.size .. [[); |
btn:SetButtonSkin("]] .. ebs .. [[", true, true, false, true, true, true, false, true, true, true); |
local btn; |
if ]] .. usebs .. [[ then |
btn = VFLUI.SkinButton:new(btnOwner, "SecureUnitButton"); |
btn:SetWidth(]] .. desc.size .. [[); btn:SetHeight(]] .. desc.size .. [[); |
btn:SetButtonSkin("]] .. ebs .. [[", true, true, false, true, true, true, false, true, true, true); |
elseif ]] .. usebkd .. [[ then |
btn = VFLUI.BckButton:new(btnOwner, "SecureUnitButton"); |
btn:SetWidth(]] .. desc.size .. [[); btn:SetHeight(]] .. desc.size .. [[); |
self:SetButtonBkd(]] .. Serialize(bkd) .. [[); |
end |
btn:Show(); |
btn:RegisterForClicks("AnyDown"); |
btn:SetAttribute("unit", "player"); |
btn:SetAttribute("spell", ]] .. spell .. [[); |
btn.icon = VFLUI.CreateTexture(btn); |
btn.icon:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. ebsos .. [[, -]] .. ebsos .. [[); |
btn.icon:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. ebsos .. [[, ]] .. ebsos .. [[); |
btn.icon:SetPoint("TOPLEFT", btn, "TOPLEFT", ]] .. os .. [[, -]] .. os .. [[); |
btn.icon:SetPoint("BOTTOMRIGHT", btn, "BOTTOMRIGHT", -]] .. os .. [[, ]] .. os .. [[); |
btn.icon:SetTexCoord(0.08, 1-0.08, 0.08, 1-0.08); |
btn.icon:SetDrawLayer("ARTWORK", 2); |
btn.icon:SetTexture("]] .. icontex .. [["); |
frame.]] .. objname .. [[[1] = btn; |
for i=2, ]] .. desc.nIcons .. [[ do |
local btn = RDXUI.MultiCastButton:new(btnOwner, abid, ]] .. ebsflag .. [[, "]] .. ebs .. [[", ]] .. ebsos .. [[, ]] .. hidebs .. [[, "", ]] .. desc.nIcons .. [[, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[, ]] .. anyup .. [[); |
local btn = RDXUI.MultiCastButton:new(btnOwner, abid, ]] .. desc.size .. [[, ]] .. usebs .. [[, "]] .. ebs .. [[", ]] .. usebkd .. [[, ]] .. Serialize(bkd) .. [[, ]] .. os .. [[, ]] .. hidebs .. [[, "", ]] .. desc.nIcons .. [[, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[, ]] .. anyup .. [[); |
]]; |
createCode = createCode .. VFLUI.GenerateSetFontCode("btn.txtCount", desc.fontcount, nil, true); |
createCode = createCode .. VFLUI.GenerateSetFontCode("btn.txtMacro", desc.fontmacro, nil, true); |
else |
dabid = abid; |
end |
btn:SetWidth(]] .. desc.size .. [[); btn:SetHeight(]] .. desc.size .. [[); |
btn:Show(); |
frame.]] .. objname .. [[[i] = btn; |
abid = abid + 1; |
createCode = createCode .. RDXUI.LayoutCodeMultiRows(objname, desc); |
createCode = createCode .. [[ |
if dabid then |
RDX.printE("Multi Cast Button ".. dabid .." already used"); |
--RDX.printE("Multi Cast Button ".. dabid .." already used"); |
end |
]]; |
return createCode; |
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.cd then desc.cd = VFL.copy(VFLUI.defaultCooldown); end |
desc.nIcons = 5; |
local flg = true; |
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); |
local ed_bs = VFLUI.LabeledEdit:new(ui, 50); ed_bs:Show(); |
ed_bs:SetText(VFLI.i18n("Button Skin, Icon size")); |
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); |
local chk_hidebs = VFLUI.Checkbox:new(ui); chk_hidebs:Show(); |
chk_hidebs:SetText(VFLI.i18n("Hide empty button")); |
if desc and desc.hidebs then chk_hidebs:SetChecked(true); else chk_hidebs:SetChecked(); end |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("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 = "multicastbar"; version = 1; |
name = ed_name.editBox:GetText(); |
iconspx = VFL.clamp(ed_iconspx.editBox:GetNumber(), -20, 200); |
iconspy = VFL.clamp(ed_iconspy.editBox:GetNumber(), -20, 200); |
size = VFL.clamp(ed_size.editBox:GetNumber(), 20, 100); |
-- Skin |
externalButtonSkin = ebs; |
-- display |
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(); |
hidebs = chk_hidebs:GetChecked(); |
-- Cooldown |
cd = cd:GetSelectedCooldown(); |
anchor = { lp = "TOPLEFT", af = "Base", rp = "TOPLEFT", dx = 0, dy = 0}; |
nIcons = 12; size = 36; rows = 1; orientation = "RIGHT"; iconspx = 5; iconspy = 0; |
externalButtonSkin = "bs_default"; |
bkd = VFL.copy(VFLUI.defaultBackdrop); |
ButtonSkinOffset = 0; |
fontkey = fontk; |
fontmacro = fontm; |
-- Create function |
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 |
--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 hidebs = "nil"; if desc.hidebs then hidebs = "true"; end |
local showkey = "nil"; if desc.showkey then showkey = "true"; end |
local showtooltip = "nil"; if desc.showtooltip then showtooltip = "true"; end |
]]; |
if desc.test then |
createCode = createCode .. [[ |
btn = RDXUI.ActionButtonTest:new(h, abid, ]] .. ebsflag .. [[, "]] .. ebs .. [[", ]] .. ebsos .. [[, ]] .. hidebs .. [[, statesString, nbuttons, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[, ]] .. anyup .. [[); |
btn = RDXUI.ActionButtonTest:new(h, abid, ]] .. desc.size .. [[, ]] .. usebs .. [[, "]] .. ebs .. [[", ]] .. usebkd .. [[, ]] .. Serialize(bkd) .. [[, ]] .. os .. [[, ]] .. hidebs .. [[, statesString, nbuttons, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[, ]] .. anyup .. [[); |
]]; |
else |
createCode = createCode .. [[ |
btn = RDXUI.PetActionButton:new(h, abid, ]] .. ebsflag .. [[, "]] .. ebs .. [[", ]] .. ebsos .. [[, ]] .. hidebs .. [[, statesString, nbuttons, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[, ]] .. anyup .. [[); |
btn = RDXUI.PetActionButton:new(h, abid, ]] .. desc.size .. [[, ]] .. usebs .. [[, "]] .. ebs .. [[", ]] .. usebkd .. [[, ]] .. Serialize(bkd) .. [[, ]] .. os .. [[, ]] .. hidebs .. [[, statesString, nbuttons, ]] .. Serialize(desc.cd) .. [[, ]] .. showkey .. [[, ]] .. showtooltip .. [[, ]] .. anyup .. [[); |
]]; |
end |
createCode = createCode .. [[ |
if btn then |
btn:SetWidth(]] .. desc.size .. [[); btn:SetHeight(]] .. desc.size .. [[); |
btn:Show(); |
]]; |
createCode = createCode .. VFLUI.GenerateSetFontCode("btn.txtHotkey", desc.fontkey, nil, true); |
frame.]] .. objname .. [[header = h; |
if dabid then |
RDX.printW("Pet Button ".. abid .." already used, See feature ]] .. desc.name ..[["); |
--RDX.printW("Pet Button ".. abid .." already used, See feature ]] .. desc.name ..[["); |
else |
]]; |
createCode = createCode .. RDXUI.LayoutCodeMultiRows(objname, desc); |
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.cd then desc.cd = VFL.copy(VFLUI.defaultCooldown); end |
local flg = true; |
flg = flg and RDXUI.UFFrameCheck_Proto("Frame_", desc, state, errs); |
if desc and desc.size then ed_size.editBox:SetText(desc.size); end |
ui:InsertFrame(ed_size); |
-------------- ButtonSkin or Frame |
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); |
local ed_bs = VFLUI.LabeledEdit:new(ui, 50); ed_bs:Show(); |
ed_bs:SetText(VFLI.i18n("Button Skin, Icon size")); |
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); |
local chk_hidebs = VFLUI.Checkbox:new(ui); chk_hidebs:Show(); |
chk_hidebs:SetText(VFLI.i18n("Hide empty button")); |
if desc and desc.hidebs then chk_hidebs:SetChecked(true); else chk_hidebs:SetChecked(); end |
ui:InsertFrame(VFLUI.Separator:new(ui, VFLI.i18n("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 = "actionbarpet"; version = 1; |
name = ed_name.editBox:GetText(); |
iconspx = VFL.clamp(ed_iconspx.editBox:GetNumber(), -20, 200); |
iconspy = VFL.clamp(ed_iconspy.editBox:GetNumber(), -20, 200); |
size = VFL.clamp(ed_size.editBox:GetNumber(), 20, 100); |
-- Skin |
externalButtonSkin = ebs; |
-- display |
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(); |
hidebs = chk_hidebs:GetChecked(); |
-- Cooldown |
cd = cd:GetSelectedCooldown(); |
anchor = { lp = "TOPLEFT", af = "Base", rp = "TOPLEFT", dx = 0, dy = 0}; |
nIcons = 10; size = 36; rows = 1; orientation = "RIGHT"; iconspx = 5; iconspy = 0; |
externalButtonSkin = "bs_default"; |
bkd = VFL.copy(VFLUI.defaultBackdrop); |
ButtonSkinOffset = 0; |
fontkey = fontk; |
cd = VFL.copy(VFLUI.defaultCooldown); |
--------------- 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; |
}); |
--------------- 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"; |
name = "Variable: Fractional mana (fm)"; |
title = "Vars Frac Power"; |
category = VFLI.i18n("Variables"); |
test = true; |
multiple = true; |
IsPossible = function(state) |
if not state:Slot("DesignFrame") then return nil; end |
return true; |
end; |
ApplyFeature = function(desc, state) |
state:Attach(state:Slot("EmitPaintPreamble"), true, function(code) code:AppendCode([[ |
state:Attach(state:Slot("EmitPaintPreamble"), true, function(code) |
if desc.test then |
code:AppendCode([[ |
local ]] .. desc.name .. [[, ]] .. desc.name .. [[_i = 0.5, 0.5; |
]]); |
else |
code:AppendCode([[ |
local ]] .. desc.name .. [[, ]] .. desc.name .. [[_i = unit:FracPower(]] .. desc.powertype .. [[); |
]]); |
]]); |
end |
end); |
local mux = state:GetContainingWindowState():GetSlotValue("Multiplexer"); |
local mask = mux:GetPaintMask("POWER"); |
name = "Variable: Number power"; |
title = "Vars Number Power"; |
category = VFLI.i18n("Variables"); |
test = true; |
multiple = true; |
IsPossible = function(state) |
if not state:Slot("DesignFrame") then return nil; end |
return true; |
end; |
ApplyFeature = function(desc, state) |
state:Attach(state:Slot("EmitPaintPreamble"), true, function(code) code:AppendCode([[ |
state:Attach(state:Slot("EmitPaintPreamble"), true, function(code) |
if desc.test then |
code:AppendCode([[ |
local ]] .. desc.name .. [[, ]] .. desc.name .. [[_i = 3, 3; |
]]); |
else |
code:AppendCode([[ |
local ]] .. desc.name .. [[, ]] .. desc.name .. [[_i = unit:Power(]] .. desc.powertype .. [[) or 0; |
]]); |
]]); |
end |
end); |
local mux = state:GetContainingWindowState():GetSlotValue("Multiplexer"); |
local mask = mux:GetPaintMask("POWER"); |