/
-- @return number |
function VFL.Error:Count() return self.count; end |
--- HasErrors |
--- HasError |
-- @return boolean |
function VFL.Error:HasErrors() return (self.count > 0); end |
function VFL.Error:HasError() return (self.count > 0); end |
--- Clean this error Message |
function VFL.Error:Clear() |
--- HasError in a error object declare as param |
-- @param errs The error object VFL.error |
function VFL.HasError(errs) |
if errs then return errs:HasErrors(); else return nil; end |
if errs then return errs:HasError(); else return nil; end |
end |
--- A global error object to save memory. |
_backdrop = "none"; |
}; |
VFLUI.nilBackdrop = { |
_border = "none"; |
bgFile = nil; |
_backdrop = "none"; |
edgeFile = nil; |
}; |
local curBackdrop, clipboard = {}, nil; |
local onOK, onCancel, bdp_owner = VFL.Noop, VFL.Noop, nil; |
local UpdateBackdropPicker; |
frame._VFL = true; |
frame._sourcePool = pool; |
frame.Destroy = GenericDestroy; |
if not frame._hookedHideShow then |
frame._hookedHideShow = true; |
hooksecurefunc(frame, "Hide", TimerHide); |
hooksecurefunc(frame, "Show", TimerShow); |
end |
--if not frame._hookedHideShow then |
-- frame._hookedHideShow = true; |
-- hooksecurefunc(frame, "Hide", TimerHide); |
-- hooksecurefunc(frame, "Show", TimerShow); |
--end |
--frame.AnimationGroup = frame:CreateAnimationGroup(); |
return frame; |
end |
----------------------------------------------------- |
-- DEFAULT FRAMING |
----------------------------------------------------- |
function VFLUI.Framing.Default(self, titleHeight) |
function VFLUI.Framing.Default(self, titleHeight, bkd) |
-------------------------- WINDOW DECOR |
self:SetBackdrop(VFLUI.BlizzardDialogBackdrop); |
self:SetBackdrop(bkd or VFLUI.BlackDialogBackdrop); |
local titleBar = self:GetTitleBar(); |
titleBar:SetPoint("TOPLEFT", self, "TOPLEFT", 5, -5); |
local ca = self:GetClientArea(); |
ca:SetWidth(tw - 10); ca:SetHeight(self:GetHeight() - titleHeight - 7); |
end |
self:SetBackdrop(bkd or VFLUI.BlackDialogBackdrop); |
end |
function self:_FrameDestroy() |
end |
--- COMPAT: A lot of code uses this. |
function VFLUI.Window.SetDefaultFraming(self, titleHeight) |
self:SetFraming(VFLUI.Framing.Default, titleHeight); |
function VFLUI.Window.SetDefaultFraming(self, titleHeight, bkd) |
self:SetFraming(VFLUI.Framing.Default, titleHeight, bkd); |
end |
----------------------------------------------------- |
local ca = self:GetClientArea(); |
ca:SetWidth(tw - 2); ca:SetHeight(self:GetHeight() - 15); |
end |
--self:SetBackdrop(plainBackdrop); |
end |
function self:_FrameDestroy() |
local ca = self:GetClientArea(); |
ca:SetWidth(tw); ca:SetHeight(self:GetHeight() - 22); |
end |
--decor:SetBackdrop(VFLUI.DefaultDialogBackdrop); |
end |
function self:_FrameDestroy() |
local clientArea = self:GetClientArea(); |
clientArea:ClearAllPoints(); |
clientArea:SetPoint("TOPLEFT", decor, "TOPLEFT", 10, -10); |
clientArea:SetPoint("BOTTOMRIGHT", decor, "BOTTOMRIGHT", -10, 10); |
clientArea:SetPoint("BOTTOMRIGHT", decor, "BOTTOMRIGHT", -10, 10); |
function self:Accomodate(dx, dy) |
self:SetWidth(dx+60); self:SetHeight(dy + 60); |
end |
local ca = self:GetClientArea(); |
ca:SetWidth(tw-30); ca:SetHeight(self:GetHeight() - 30); |
end |
--decor:SetBackdrop(VFLUI.DefaultDialogBackdrop); |
end |
function self:_FrameDestroy() |
if not btype then btype = "Button"; end |
local obj = VFLUI.AcquireFrame(btype, id); |
if not obj then return nil; end |
obj:SetParent(parent); |
if parent then |
obj:SetParent(parent); |
--obj:SetAllPoints(parent); |
obj:SetFrameStrata(parent:GetFrameStrata()); |
obj:SetFrameLevel(parent:GetFrameLevel() + 1); |
end |
obj:Show(); |
local framesup = VFLUI.AcquireFrame("Frame"); |
framesup:SetParent(obj); |
return obj; |
end |
VFLUI.BckButton = {}; |
function VFLUI.BckButton:new(parent, btype, id) |
if not btype then btype = "Button"; end |
local obj = VFLUI.AcquireFrame(btype, id); |
if not obj then return nil; end |
if parent then |
obj:SetParent(parent); |
obj:SetFrameStrata(parent:GetFrameStrata()); |
obj:SetFrameLevel(parent:GetFrameLevel() + 1); |
end |
obj:Show(); |
--local frbkd = VFLUI.AcquireFrame("Frame"); |
--frbkd:SetParent(obj); |
--frbkd:SetAllPoints(obj); |
--frbkd:Show(); |
--obj.frbkd = frbkd; |
-- set button skin function |
obj.SetButtonBkd = function(self, bkd) |
VFLUI.SetBackdrop(self, bkd); |
end; |
obj.bsHide = function(self) |
--self.frbkd:Hide(); |
end |
obj.bsShow = function(self) |
--self.frbkd:Show(); |
end |
obj.Destroy = VFL.hook(function(s) |
s.SetButtonBck = nil; s.bsHide = nil; s.bsShow = nil; |
--s.frbkd:Destroy(); s.frbkd = nil; |
end, obj.Destroy); |
return obj; |
end |
-- Create window |
local dlg = VFLUI.Window:new(parent or VFLFULLSCREEN_DIALOG); |
VFLUI.Window.SetDefaultFraming(dlg, 22); |
dlg:SetBackdrop(VFLUI.BlackDialogBackdrop); |
dlg:SetTitleColor(0,0,.6); |
dlg:SetPoint("CENTER", VFLParent, "CENTER", 0, 50); |
dlg:SetText(title); |
btn2:SetScript("OnClick", OK); |
end |
dlg:SetHeight(40 + th + eh + bh); dlg:Show(); |
dlg:SetHeight(40 + th + eh + bh); dlg:SetBackdrop(VFLUI.BlackDialogBackdrop); dlg:Show(); |
dlg.Destroy = VFL.hook(function(s) |
GetEditText = nil; |
if dlg then return; end |
dlg = VFLUI.Window:new(parent); |
dlg:SetHeight(400); dlg:SetWidth(500); |
VFLUI.Window.SetDefaultFraming(dlg, 24); |
dlg:SetTitleColor(0,.6,0); |
dlg:SetText("Repository Objects Browser"); |
dlg:SetPoint("CENTER", VFLParent, "CENTER"); |
dlg:SetHeight(400); dlg:SetWidth(500); |
if RDXPM.Ismanaged("ObjectBrowser") then RDXPM.RestoreLayout(dlg, "ObjectBrowser"); end |
VFLUI.Window.StdMove(dlg, dlg:GetTitleBar()); |
-- Escapement |
local esch = function() |
dlg:Hide(.2, true); |
VFLT.ZMSchedule(.25, function() |
RDXPM.StoreLayout(dlg, "ObjectBrowser"); |
--dlg:Hide(.2, true); |
--VFLT.ZMSchedule(.25, function() |
-- RDXPM.StoreLayout(dlg, "ObjectBrowser"); |
dlg:Destroy(); dlg = nil; |
if selCallback then selCallback(nil); end |
end); |
--end); |
end; |
VFL.AddEscapeHandler(esch); |
end |
-- Show the post install options window. |
if(VFL.tsize(toggles) > 0) then |
ShowInstallerDialog(VFLI.i18n("RDX6 Installer"), VFLI.i18n("The following post-installation options are available:"), InstallPhase3); |
ShowInstallerDialog(VFLI.i18n("RDX Installer"), VFLI.i18n("The following post-installation options are available:"), InstallPhase3); |
else |
InstallDone(); |
end |
-- Step 5: Show the first install options screen and wait for user feedback before proceeding. |
if(VFL.tsize(toggles) > 0) then |
ShowInstallerDialog(VFLI.i18n("RDX6 Installer"), VFLI.i18n("RDX has detected packages to install. The following user options are available. Select Decline to decline all, or Cancel to close."), InstallPhase2, InstallFreeAll, InstallDone); |
ShowInstallerDialog(VFLI.i18n("RDX Installer"), VFLI.i18n("RDX has detected packages to install. The following user options are available. Select Decline to decline all, or Cancel to close."), InstallPhase2, InstallFreeAll, InstallDone); |
else |
InstallPhase2(); |
end |
end |
end |
-- If no oobes were loaded, peace out. |
if(not loadedOOBEs) then return; end |
if(not loadedOOBEs) then |
RDX.InstallerDone(); |
return; |
end |
VFLT.ZMSchedule(2, DeferredInstaller); |
end |
ent.menuList = lockListMenu; |
end); |
--RDXPM.DuiMenu:RegisterMenuFunction(function(ent) |
-- ent.text = "*******************"; |
-- ent.notCheckable = true; |
-- ent.func = VFL.Noop; |
--end); |
--RDXPM.DuiMenu:RegisterMenuFunction(function(ent) |
-- ent.text = VFLI.i18n("Wizards"); |
-- ent.hasArrow = true; |
-- ent.notCheckable = true; |
-- ent.menuList = { |
-- { text = " " .. VFLI.i18n("Windows Wizard"), notCheckable = true, func = function() RDX.NewWindowWizard(); end; }, |
-- |
-- }; |
--end); |
RDXPM.DuiMenu:RegisterMenuFunction(function(ent) |
ent.text = "*******************"; |
ent.notCheckable = true; |
local dlg = nil; |
function RDXDK.LayoutPropsDialog(frameprops) |
if dlg then return; end |
local dd, dgp = frameprops, (RDXDK.FindDockGroupParent(frameprops) or frameprops); |
local x = nil; |
end |
end |
function RDXDK.IsBlizzardManageOpen() |
if dlg then return true; else return nil; end |
end |
local function disableblizz() |
if opt then |
if opt.ab then RDXDK.DisableActionBar(); end |
# Windows Wizard |
Wizards\Wizard.lua |
Wizards\WindowWizard.lua |
Wizards\LearnWizard.lua |
# Raid Logger |
Raid\RaidLogger\Omni.lua |
-- Initialization code. |
-- |
--local initd = nil; |
local installer = nil; |
--- Is RDX initialized? |
-- @return TRUE iff all RDX initialization procedures are complete. |
--function RDX.IsInitialized() |
-- return initd; |
--end |
function RDX.InstallerDone() |
installer = true; |
end |
-- Preload: Called when RDX is finished loading, before saved variables and before modules. |
local function Preload() |
RDX:Debug(3, "DISPATCH INIT_DEFERRED"); |
RDXEvents:Dispatch("INIT_DEFERRED"); |
RDXEvents:DeleteKey("INIT_DEFERRED"); |
if not RDXG.hideLW and installer then |
RDX.NewLearnWizard(RDXG.learnNum); |
end |
-- Now init smooth features. |
--RDX.smooth = 0.2; |
end); |
end |
--- Open this wizard, displaying the first page. |
function RDXUI.Wizard:Open(parent) |
if self.window then return nil; end |
function RDXUI.Wizard:Open(parent, num) |
self.history = {}; self.desc._ok = nil; |
if not self.window then |
local win = VFLUI.Window:new(parent); |
VFLUI.Window.SetDefaultFraming(win, 20); |
win:SetBackdrop(VFLUI.BlackDialogBackdrop); |
win:SetTitleColor(0,0,.6); win:SetText(self.title); |
win:SetPoint("CENTER", VFLParent, "CENTER"); |
win:SetMovable(true); VFLUI.Window.StdMove(win, win:GetTitleBar()); |
win:SetClampedToScreen(true); |
win:Show(); |
self.window = win; |
local win = VFLUI.Window:new(parent); |
VFLUI.Window.SetDefaultFraming(win, 20); |
win:SetBackdrop(VFLUI.BlackDialogBackdrop); |
win:SetTitleColor(0,0,.6); win:SetText(self.title); |
win:SetPoint("TOPLEFT", VFLParent, "TOPLEFT", 100, -200); |
--win:SetMovable(true); |
VFLUI.Window.StdMove(win, win:GetTitleBar()); |
--win:SetClampedToScreen(true); |
win:Show(); |
self.window = win; |
local btn1 = VFLUI.Button:new(win); |
btn1:SetHeight(25); btn1:SetWidth(60); |
btn1:SetPoint("BOTTOMRIGHT", win:GetClientArea(), "BOTTOMRIGHT"); |
btn1:SetText(VFLI.i18n("Next >")); btn1:Show(); btn1:Disable(); |
self.nextBtn = btn1; |
local btn = VFLUI.Button:new(win); |
btn:SetHeight(25); btn:SetWidth(60); |
btn:SetPoint("BOTTOMRIGHT", win:GetClientArea(), "BOTTOMRIGHT"); |
btn:SetText(VFLI.i18n("Next >")); btn:Show(); btn:Disable(); |
self.nextBtn = btn; |
btn = VFLUI.Button:new(win); |
btn:SetHeight(25); btn:SetWidth(60); |
btn:SetPoint("RIGHT", self.nextBtn, "LEFT"); |
btn:SetText(VFLI.i18n("< Prev")); btn:Show(); btn:Disable(); |
btn:SetScript("OnClick", function() |
if self.history then |
local cp = table.remove(self.history); |
if cp then |
cp = table.remove(self.history); |
local btn2 = VFLUI.Button:new(win); |
btn2:SetHeight(25); btn2:SetWidth(60); |
btn2:SetPoint("RIGHT", self.nextBtn, "LEFT"); |
btn2:SetText(VFLI.i18n("< Prev")); btn2:Show(); btn2:Disable(); |
btn2:SetScript("OnClick", function() |
if self.history then |
local cp = table.remove(self.history); |
if cp then |
self:SetPage(cp); |
cp = table.remove(self.history); |
if cp then |
self:SetPage(cp); |
end |
end |
end |
end); |
self.prevBtn = btn2; |
local btn3 = VFLUI.CancelButton:new(win); |
btn3:SetHeight(25); btn3:SetWidth(60); |
btn3:SetPoint("RIGHT", self.prevBtn, "LEFT"); |
btn3:SetText(VFLI.i18n("Cancel")); btn3:Show(); btn3:Enable(); |
btn3:SetScript("OnClick", function() self:Close(nil); end); |
self.cancelBtn = btn3; |
local btn4 = VFLUI.OKButton:new(win); |
btn4:SetHeight(25); btn4:SetWidth(60); |
btn4:SetPoint("RIGHT", self.cancelBtn, "LEFT"); |
btn4:SetText(VFLI.i18n("OK")); btn4:Show(); btn4:Disable(); |
self.OKBtn = btn4; |
win.Destroy = VFL.hook(function(s) |
self:ClearPage(); |
self.nextBtn:Destroy(); self.nextBtn = nil; |
self.prevBtn:Destroy(); self.prevBtn = nil; |
self.cancelBtn:Destroy(); self.cancelBtn = nil; |
self.OKBtn:Destroy(); self.OKBtn = nil; |
self.window = nil; self.pageNum = nil; |
end, win.Destroy); |
end |
self.window:Show(); |
if num then |
i = 1; |
while(true) do |
if i == num then break; end |
table.insert(self.history, i); |
i=i+1; |
end |
end); |
self.prevBtn = btn; |
btn = VFLUI.CancelButton:new(win); |
btn:SetHeight(25); btn:SetWidth(60); |
btn:SetPoint("RIGHT", self.prevBtn, "LEFT"); |
btn:SetText(VFLI.i18n("Cancel")); btn:Show(); btn:Enable(); |
btn:SetScript("OnClick", function() self:Close(nil); end); |
self.cancelBtn = btn; |
btn = VFLUI.OKButton:new(win); |
btn:SetHeight(25); btn:SetWidth(60); |
btn:SetPoint("RIGHT", self.cancelBtn, "LEFT"); |
btn:SetText(VFLI.i18n("OK")); btn:Show(); btn:Disable(); |
self.OKBtn = btn; |
win.Destroy = VFL.hook(function(s) |
self:ClearPage(); |
self.nextBtn:Destroy(); self.nextBtn = nil; |
self.prevBtn:Destroy(); self.prevBtn = nil; |
self.cancelBtn:Destroy(); self.cancelBtn = nil; |
self.OKBtn:Destroy(); self.OKBtn = nil; |
self.window = nil; self.pageNum = nil; |
end, win.Destroy); |
end |
self:SetPage(1); |
self:SetPage(num or 1); |
return true; |
end |
--- Close the wizard. |
function RDXUI.Wizard:Close(result) |
self.window:Destroy(); self.window = nil; |
--self.window:Destroy(); self.window = nil; |
self.window:Hide(); |
if result then |
self:OnOK(); |
self.desc._ok = true; |
local child = pgdef.OpenPage(self.window, self, self.desc[num]); |
if not child then |
-- If we're still on the same page, quash the page. |
if self.pageNum == num then self.pageNum = nil; end |
return; |
-- if self.pageNum == num then self.pageNum = nil; end |
-- return; |
end |
-- Add to history. |
--- Clear and save whatever page is currently being displayed |
function RDXUI.Wizard:ClearPage() |
if(self.child) then |
if (self.child) then |
self.child:Destroy(); |
self.child.GetDescriptor = nil; |
self.child = nil; |
end |
-- LearnWizard.lua |
-- OpenRDX |
-- |
local ww = RDXUI.Wizard:new(); |
--------------------------------------------- |
-- Pg 1: Welcome |
--------------------------------------------- |
ww:RegisterPage(1, { |
OpenPage = function(parent, wizard, desc) |
local page = RDXUI.GenerateStdWizardPage(parent, "Welcome to RDX 8"); |
local lbl = VFLUI.MakeLabel(nil, page, "This is the first time you are using RDX, this quick tutorial will help you to learn how to use RDX.\n\nYou can close this tutorial at any time.\nGo to the menu Settings to reopen this tutorial."); |
lbl:SetWidth(250); lbl:SetHeight(90); |
lbl:SetPoint("TOPLEFT", page, "TOPLEFT", 0, -20); |
local chk_hideLW = VFLUI.Checkbox:new(page); chk_hideLW:Show(); |
chk_hideLW:SetHeight(20); chk_hideLW:SetWidth(200); |
chk_hideLW:SetPoint("TOPLEFT", lbl, "BOTTOMLEFT", 0, -20); |
chk_hideLW:SetText("Not show this guide at startup."); |
if RDXG and RDXG.hideLW then chk_hideLW:SetChecked(true); else chk_hideLW:SetChecked(); end |
function page:GetDescriptor() |
if RDXG then RDXG.hideLW = chk_hideLW:GetChecked(); end |
return {}; |
end |
page.Destroy = VFL.hook(function(s) |
chk_hideLW:Destroy(); |
end, page.Destroy); |
wizard:OnNext(function(wiz) wiz:SetPage(2); end); |
--wizard:Final(); |
return page; |
end; |
Verify = function(desc, wizard, errs) |
return true; |
end; |
}); |
ww:RegisterPage(2, { |
OpenPage = function(parent, wizard, desc) |
local page = RDXUI.GenerateStdWizardPage(parent, "RDX Main Menu"); |
local lbl = VFLUI.MakeLabel(nil, page, "You should see a small RDX icon in the center of the screen.\nYou can move it with the key shift.\n\n\nThe main menu is located on the top of your screen.\nSolo, Multi, UI, Repo, Settings\n\n\nMove your mouse on the main menu."); |
lbl:SetWidth(250); lbl:SetHeight(150); |
lbl:SetPoint("TOPLEFT", page, "TOPLEFT", 0, -20); |
function page:GetDescriptor() |
return {}; |
end |
wizard:OnNext(function(wiz) wiz:SetPage(3); end); |
return page; |
end; |
Verify = function(desc, wizard, errs) |
return true; |
end; |
}); |
ww:RegisterPage(3, { |
OpenPage = function(parent, wizard, desc) |
local page = RDXUI.GenerateStdWizardPage(parent, "Customize the Main Menu"); |
local lbl = VFLUI.MakeLabel(nil, page, "Click on the menu Settings and select RDX Settings."); |
lbl:SetWidth(250); lbl:SetHeight(90); |
lbl:SetPoint("TOPLEFT", page, "TOPLEFT", 0, -20); |
function page:GetDescriptor() |
return {}; |
end |
wizard:OnNext(function(wiz) wiz:SetPage(4); end); |
return page; |
end; |
Verify = function(desc, wizard, errs) |
--if not RDXPM.IsRDXManageOpen() then errs:AddError("Panel RDX Settings is not open."); end |
return not errs:HasError(); |
end; |
}); |
ww:RegisterPage(4, { |
OpenPage = function(parent, wizard, desc) |
local page = RDXUI.GenerateStdWizardPage(parent, "Customize the Main Menu"); |
local lbl = VFLUI.MakeLabel(nil, page, "You can disable the animation of the main menu, check the box Always show main panel\n\nYou can change the icon texture here. Click on the disk to save when finish."); |
lbl:SetWidth(250); lbl:SetHeight(90); |
lbl:SetPoint("TOPLEFT", page, "TOPLEFT", 0, -20); |
function page:GetDescriptor() |
return {}; |
end |
wizard:OnNext(function(wiz) wiz:SetPage(5); end); |
return page; |
end; |
Verify = function(desc, wizard, errs) |
--if RDXPM.IsRDXManageOpen() then errs:AddError("Panel RDX Settings is still open."); end |
return not errs:HasError(); |
end; |
}); |
ww:RegisterPage(5, { |
OpenPage = function(parent, wizard, desc) |
local page = RDXUI.GenerateStdWizardPage(parent, "Hide Blizzard UI elements"); |
local lbl = VFLUI.MakeLabel(nil, page, "Click on the menu UI and select Blizzard Frame Manager."); |
lbl:SetWidth(250); lbl:SetHeight(90); |
lbl:SetPoint("TOPLEFT", page, "TOPLEFT", 0, -20); |
RDXG.learnNum = 5; |
function page:GetDescriptor() |
return {}; |
end |
wizard:OnNext(function(wiz) wiz:SetPage(6); end); |
return page; |
end; |
Verify = function(desc, wizard, errs) |
--if not RDXDK.IsBlizzardManageOpen() then errs:AddError("Panel Blizzard UI Element is not open."); end |
return not errs:HasError(); |
end; |
}); |
ww:RegisterPage(6, { |
OpenPage = function(parent, wizard, desc) |
local page = RDXUI.GenerateStdWizardPage(parent, "Hide Blizzard UI elements"); |
local lbl = VFLUI.MakeLabel(nil, page, "Check all elements and click on the button save.\n\nYour UI will be reload and should be empty except the chatframe blizzard."); |
lbl:SetWidth(250); lbl:SetHeight(90); |
lbl:SetPoint("TOPLEFT", page, "TOPLEFT", 0, -20); |
RDXG.learnNum = 6; |
function page:GetDescriptor() |
return {}; |
end |
wizard:OnNext(function(wiz) wiz:SetPage(7); end); |
return page; |
end; |
Verify = function(desc, wizard, errs) |
--if RDXDK.IsBlizzardManageOpen() then errs:AddError("Panel Blizzard UI Element is still open."); end |
return not errs:HasError(); |
end; |
}); |
ww:RegisterPage(7, { |
OpenPage = function(parent, wizard, desc) |
local page = RDXUI.GenerateStdWizardPage(parent, "Open windows on your UI"); |
local lbl = VFLUI.MakeLabel(nil, page, "Check all elements and click on the button disk to save your modifications.\n\nYour UI should be empty except the chatframe blizzard."); |
lbl:SetWidth(250); lbl:SetHeight(90); |
lbl:SetPoint("TOPLEFT", page, "TOPLEFT", 0, -20); |
RDXG.learnNum = 7; |
function page:GetDescriptor() |
return {}; |
end |
wizard:OnNext(function(wiz) wiz:SetPage(8); end); |
return page; |
end; |
Verify = function(desc, wizard, errs) |
--if RDXDK.IsBlizzardManageOpen() then errs:AddError("Panel Blizzard UI Element is still open."); end |
return not errs:HasError(); |
end; |
}); |
-------------------- |
-- Page 20 (done) |
-------------------- |
ww:RegisterPage(20, { |
OpenPage = function(parent, wizard, desc) |
local page = RDXUI.GenerateStdWizardPage(parent, "Done!"); |
local lbl = VFLUI.MakeLabel(nil, page, "You have now entered all information necessary to create your window.\n\nIf you click OK, your window will be created and moved to the center of the screen.\n\nIf you choose Cancel, this process will be aborted and no changes will be made."); |
lbl:SetPoint("TOPLEFT", page, "TOPLEFT", 0, -20); |
lbl:SetWidth(250); lbl:SetHeight(110); lbl:SetJustifyV("TOP"); |
page:SetHeight(130); |
wizard:Final(); |
return page; |
end; |
Verify = function(desc, wizard, errs) |
return true; |
end |
}); |
function ww:OnOK() |
--VFL.print("OnOK"); |
end |
ww.title = "Learn RDX Wizard"; |
RDX.learnWizard = ww; |
function RDX.NewLearnWizard(num) |
RDX.learnWizard:SetDescriptor({}); |
RDX.learnWizard:Open(VFLDIALOG, num); |
end |
-- LICENSE. UNLICENSED COPYING IS PROHIBITED. |
-- |
-- Implementation of the Window Wizard. |
local ww = RDXUI.Wizard:new(); |
local ww = RDXUI.Wizard:new(); |
--------------------------------------------- |
-- WIZARD PAGES |
lbl:SetPoint("TOPLEFT", page, "TOPLEFT", 0, -20); |
-- Design chooser box |
local ofDesign = RDXDB.ObjectFinder:new(page, function(p,f,md) return (md and type(md) == "table" and md.ty=="UnitFrameType"); end); |
local ofDesign = RDXDB.ObjectFinder:new(page, function(p,f,md) return (md and type(md) == "table" and md.ty=="Design"); end); |
ofDesign:SetPoint("BOTTOM", page, "BOTTOM"); |
ofDesign:SetWidth(300); ofDesign:Show(); |
ofDesign:SetLabel("Frame type:"); |
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"); |
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); |
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; |
--------------- 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; |
}); |
end); |
RDXPM.MainMenu:RegisterMenuFunction(function(ent) |
ent.text = VFLI.i18n("Learn Wizard"); |
ent.func = function() RDX.NewLearnWizard(); end; |
ent.notCheckable = true; |
end); |
RDXPM.MainMenu:RegisterMenuFunction(function(ent) |
ent.text = VFLI.i18n("Debugging"); |
ent.hasArrow = true; |
ent.notCheckable = true; |
if opt and opt.asmp then chk_asmp:SetChecked(true); else chk_asmp:SetChecked(); end |
ui:InsertFrame(chk_asmp); |
local chk_hmp = VFLUI.Checkbox:new(ui); chk_hmp:Show(); |
chk_hmp:SetText(VFLI.i18n("Always Hide Main Panel")); |
if opt and opt.hmp then chk_hmp:SetChecked(true); else chk_hmp:SetChecked(); end |
ui:InsertFrame(chk_hmp); |
--local chk_hmp = VFLUI.Checkbox:new(ui); chk_hmp:Show(); |
--chk_hmp:SetText(VFLI.i18n("Always Hide Main Panel")); |
--if opt and opt.hmp then chk_hmp:SetChecked(true); else chk_hmp:SetChecked(); end |
--ui:InsertFrame(chk_hmp); |
local chk_upp = VFLUI.Checkbox:new(ui); chk_upp:Show(); |
local function Save() |
opt.asmp = chk_asmp:GetChecked(); |
opt.hmp = chk_hmp:GetChecked(); |
--opt.hmp = chk_hmp:GetChecked(); |
opt.upp = chk_upp:GetChecked(); |
--opt.dgr = chk_dgr:GetChecked(); |
local mainPane = RDXPM.GetMainPane(); |
else |
RDXPM.RDXManage(VFLDIALOG); |
end |
end |
function RDXPM.IsRDXManageOpen() |
if dlg then return true; else return nil; end |
end |
dlg = VFLUI.Window:new(parent); |
VFLUI.Window.SetDefaultFraming(dlg, 24); |
dlg:SetBackdrop(VFLUI.BlackDialogBackdrop); |
--dlg:SetBackdrop(VFLUI.BlackDialogBackdrop); |
dlg:SetTitleColor(0,.6,0); |
dlg:SetText(VFLI.i18n("Feature Editor: ") .. path); |
dlg:SetWidth(700); dlg:SetHeight(500); |