WoWInterface SVN OpenRDX

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/RDX/Wizards
    from Rev 608 to Rev 676
    Reverse comparison

Rev 608 → Rev 676

Wizard.lua
25,72 → 25,87
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;
119,8 → 134,8
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.
159,7 → 174,7
 
--- 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;
272,3 → 287,5
end
 
 
 
 
LearnWizard.lua New file
0,0 → 1,211
-- 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
 
WindowWizard.lua
6,7 → 6,7
-- LICENSE. UNLICENSED COPYING IS PROHIBITED.
--
-- Implementation of the Window Wizard.
local ww = RDXUI.Wizard:new();
local ww = RDXUI.Wizard:new();
 
---------------------------------------------
-- WIZARD PAGES
421,7 → 421,7
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:");