Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------### xToolBar ###------------
- xToolBar = {};
- xToolBar.Version = "1.5.0.0""\\btn_xToolBar.btn") then
- for x=1, 4 do
- Crypto.Base64DecodeFromString(xToolBar.Buttons[x], xToolBarButtons_Path.."\\btn_xToolBar"..((x>1) and x or "")..".btn");
- end
- end
- --Animations--
- xMODESTRAIGHT = 1;
- xMODEUP = 2;
- xMODEDOWN = 3;
- xMODESTRAIGHTUP = 4;
- xMODESTRAIGHTDOWN = 5;
- xMODESHAKEME = 6;
- xMODEFISHEYE_UP = 7;
- xMODEFISHEYE_DOWN = 8;
- xMODEFISHEYE_MIDDLE = 9;
- xMODESHAKEME_UD = 10;
- xMODESHAKEME_LR = 11;
- xMODESTRAIGHTALL = 12;
- --ORCONSTANTS--
- x_ORIENTATION_HOR = 1;
- x_ORIENTATION_VER = 2;
- x_SIDE_LEFT = 1;
- x_SIDE_RIGHT = 2;
- --xToolBar_Globals--
- xToolBar.nMaxSize = 1.5;
- xToolBar.nShakes = 50;
- xToolBar.nSide = 1;--1=left, 2=right
- --xToolBar functions--
- xToolBar.AddItem = function(sObject, tContainer)
- xToolBar.CheckValue(tContainer, "table", "xToolBar table");
- for each, image in pairs(tContainer.tItems) do
- if image.id == sObject then
- Application.ExitScript();
- end
- end
- Application.SetRedraw(false);
- local nK = Page.GetObjectType(sObject);
- local tD = xToolBar.Objects[nK+1];
- local n = #tContainer.tItems;
- local step = tContainer.nSize+tContainer.nSpace;
- tD.SetSize(sObject, tContainer.nSize, tContainer.nSize);
- if n == 0 then
- tD.SetPos(sObject, tContainer.nLeft-(tContainer.nSize/2), tContainer.nTop-(tContainer.nSize/2));
- else
- if tContainer.nOr == 1 then
- local mintotal = tContainer.nLeft - ((((n+1) * tContainer.nSize) + (n * tContainer.nSpace))/2);
- for each, image in pairs(tContainer.tItems) do
- local tDe = xToolBar.Objects[image.kind+1];
- image.left = mintotal+(step*(each-1));
- image.right = image.left + tContainer.nSize;
- image.lm_x = image.left + (tContainer.nSize/2);
- tDe.SetPos(image.id, image.left , tContainer.nTop-(tContainer.nSize/2));
- end
- tD.SetPos(sObject, (mintotal+(step*n)), tContainer.nTop-(tContainer.nSize/2));
- else
- local mintotal = tContainer.nTop - ((((n+1) * tContainer.nSize) + (n * tContainer.nSpace))/2);
- for each, image in pairs(tContainer.tItems) do
- local tDe = xToolBar.Objects[image.kind+1];
- image.top = mintotal+(step*(each-1));
- image.bottom = image.top + tContainer.nSize;
- image.lm_y = image.top + (tContainer.nSize/2);
- tDe.SetPos(image.id, tContainer.nLeft-(tContainer.nSize/2), image.top);
- end
- tD.SetPos(sObject, tContainer.nLeft-(tContainer.nSize/2), (mintotal+(step*n)));
- end
- end
- local tPos = tD.GetPos(sObject);
- local tool = "";
- if tContainer.bTool and nK ~= 40 then
- local tProps = tD.GetProperties(sObject);
- tool = tProps.TooltipText
- tProps.TooltipText = "";
- tD.SetProperties(sObject, tProps);
- end
- if nK==3 and tContainer.nTrans~=-1 then
- Image.SetOpacity(sObject, tContainer.nTrans);
- end
- table.insert(tContainer.tItems, #tContainer.tItems+1, {id=sObject, tooltip=tool, kind=nK, left=tPos.X, top=tPos.Y, right=tPos.X+tContainer.nSize, lm_x=tPos.X+(tContainer.nSize/2), bottom=tPos.Y+tContainer.nSize, lm_y=tPos.Y+(tContainer.nSize/2)})
- Application.SetRedraw(true);
- return true;
- end
- xToolBar.Animate = function (e_X, e_Y, toolbar)
- if toolbar then
- local xbtn = "";
- if toolbar.nOr == 1 then
- xbtn = (toolbar.nMode==3 or toolbar.nMode==5 or toolbar.nMode==8) and "btn_xToolBar2" or "btn_xToolBar";
- else
- xbtn = (xToolBar.nSide==1) and "btn_xToolBar3" or "btn_xToolBar4";
- end
- if e_Y >= (toolbar.tItems[1].top-(toolbar.nSize/2)) and e_Y <= (toolbar.tItems[table.maxn(toolbar.tItems)].bottom+(toolbar.nSize/2)) and e_X > (toolbar.tItems[1].left-(toolbar.nSize/2)) and e_X < (toolbar.tItems[table.maxn(toolbar.tItems)].right+(toolbar.nSize/2)) then
- if toolbar.nMode <= 11 then
- for x, item in pairs(toolbar.tItems) do
- if e_X >= item.left-(toolbar.nSpace/2) and e_X <= item.right+(toolbar.nSpace/2) and e_Y >= item.top-(toolbar.nSpace/2) and e_Y <= item.bottom+(toolbar.nSpace/2) then
- if toolbar.nOr == 1 then
- local dif = item.lm_x-e_X;
- local factor = (toolbar.nMode==1 or toolbar.nMode==6 or toolbar.nMode==10 or toolbar.nMode==11) and 0 or (toolbar.nMode==2 or toolbar.nMode==4) and ((toolbar.nSize/2)-math.abs(dif))*.5 or -(((toolbar.nSize/2)-math.abs(dif))*.5);--Vertical % to increase
- local tDe = xToolBar.Objects[item.kind+1];
- if item.kind==3 and toolbar.nTrans~=-1 then
- tDe.SetOpacity(item.id, 100-(math.abs(dif)*2));
- end
- if toolbar.nMode >= 7 and toolbar.nMode <= 9 then --fisheye_up, down, middle
- local newDiff = xToolBar.nMaxSize-(math.abs(dif)*2*.01);
- newDiff = (newDiff<1) and 1 or newDiff;
- local newSize = toolbar.nSize*newDiff;
- local newPos = (newSize-toolbar.nSize)/2;
- tDe.SetPos(item.id, item.left-newPos, (toolbar.nMode==7) and item.top-(newPos*2) or (toolbar.nMode==8) and item.top or item.top-newPos)
- tDe.SetSize(item.id, newSize, newSize);
- if toolbar.bTool then
- if item.tooltip== "" then
- Button.SetVisible(xbtn, false)
- else
- Button.SetText(xbtn, item.tooltip);
- Button.SetPos(xbtn, item.lm_x-46.5, (toolbar.nMode==7) and item.top-((newSize/2)+32) or (toolbar.nMode==8) and item.top+(newSize+2) or item.top-((newSize/2)+16));
- if not Button.IsVisible(xbtn) then Button.SetVisible(xbtn, true) end
- end
- end
- for each, other in pairs(toolbar.tItems) do
- if other.id ~= item.id then
- local tDf = xToolBar.Objects[other.kind+1];
- tDf.SetPos(other.id, (other.left<item.left) and other.left-newPos or other.left+newPos, other.top)
- tDf.SetSize(other.id, toolbar.nSize, toolbar.nSize);
- end
- end
- else
- if toolbar.bTool then
- if item.tooltip== "" then
- Button.SetVisible(xbtn, false)
- else
- local res = (toolbar.nMode==3 or toolbar.nMode==5) and -(toolbar.nSize+2) or 32
- Button.SetText(xbtn, item.tooltip);
- Button.SetPos(xbtn, item.lm_x-46.5, item.top-factor-res);
- if not Button.IsVisible(xbtn) then Button.SetVisible(xbtn, true) end
- end
- end
- if toolbar.nMode==6 or toolbar.nMode==10 or toolbar.nMode==11 then--shakes
- Math.RandomSeed(999)
- for x=1, xToolBar.nShakes do
- local rangeX = Math.Random(-4,4);
- local rangeY = Math.Random(-4,4);
- tDe.SetPos(item.id, (toolbar.nMode==6 or toolbar.nMode==11) and item.left+rangeX or item.left, (toolbar.nMode==6 or toolbar.nMode==10) and item.top+rangeY or item.top)
- end
- tDe.SetPos(item.id, item.left, item.top)
- else
- tDe.SetPos(item.id, (toolbar.nMode<=3) and item.left+dif or item.left, item.top-factor);
- end
- end
- break;
- else
- local dif = item.lm_y-e_Y;
- local factor = (toolbar.nMode==1 or toolbar.nMode==6 or toolbar.nMode==10 or toolbar.nMode==11) and 0 or (toolbar.nMode==2 or toolbar.nMode==4) and ((toolbar.nSize/2)-math.abs(dif))*.5 or -(((toolbar.nSize/2)-math.abs(dif))*.5);
- local tDe = xToolBar.Objects[item.kind+1];
- if item.kind==3 and toolbar.nTrans~=-1 then
- tDe.SetOpacity(item.id, 100-(math.abs(dif)*2));
- end
- if toolbar.nMode >= 7 and toolbar.nMode <= 9 then --fisheye_up, down, middle
- local newDiff = xToolBar.nMaxSize-(math.abs(dif)*2*.01);
- newDiff = (newDiff<1) and 1 or newDiff;
- local newSize = toolbar.nSize*newDiff;
- local newPos = (newSize-toolbar.nSize)/2;
- tDe.SetPos(item.id, item.left-newPos, (toolbar.nMode==7) and item.top-(newPos*2) or (toolbar.nMode==8) and item.top or item.top-newPos)
- tDe.SetSize(item.id, newSize, newSize);
- if toolbar.bTool then
- if item.tooltip== "" then
- Button.SetVisible(xbtn, false)
- else
- Button.SetText(xbtn, item.tooltip);
- Button.SetPos(xbtn,(xToolBar.nSide==1) and item.left-((newSize/2)+80) or item.left+newSize+2, item.lm_y-15);
- if not Button.IsVisible(xbtn) then Button.SetVisible(xbtn, true) end
- end
- end
- for each, other in pairs(toolbar.tItems) do
- if other.id ~= item.id then
- local tDf = xToolBar.Objects[other.kind+1];
- if toolbar.nMode==9 then
- tDf.SetPos(other.id, item.left, (other.top<item.top) and other.top-newPos or other.top+newPos)
- elseif toolbar.nMode == 7 then
- tDf.SetPos(other.id, item.left, (other.top<item.top) and other.top-(newPos*2) or other.top)
- else
- tDf.SetPos(other.id, item.left, (other.top<item.top) and other.top or other.top+(newPos*2))
- end
- tDf.SetSize(other.id, toolbar.nSize, toolbar.nSize);
- end
- end
- else
- if toolbar.bTool then
- if item.tooltip== "" then
- Button.SetVisible(xbtn, false)
- else
- local res = (toolbar.nMode==3 or toolbar.nMode==5) and -(toolbar.nSize+2) or 95
- Button.SetText(xbtn, item.tooltip);
- Button.SetPos(xbtn,(xToolBar.nSide==1) and item.left-factor-res or item.right-factor+2, item.lm_y-15);
- if not Button.IsVisible(xbtn) then Button.SetVisible(xbtn, true) end
- end
- end
- if toolbar.nMode==6 or toolbar.nMode==10 or toolbar.nMode==11 then--shakes
- Math.RandomSeed(999)
- for x=1, xToolBar.nShakes do
- local rangeX = Math.Random(-4,4);
- local rangeY = Math.Random(-4,4);
- tDe.SetPos(item.id, (toolbar.nMode==6 or toolbar.nMode==11) and item.left+rangeX or item.left, (toolbar.nMode==6 or toolbar.nMode==10) and item.top+rangeY or item.top)
- end
- tDe.SetPos(item.id, item.left, item.top)
- else
- tDe.SetPos(item.id, item.left-factor, (toolbar.nMode<=3) and item.top+dif or item.top);
- end
- end
- break;
- end
- end
- end
- elseif toolbar.nMode == 12 then--xMODEAUTOMOVE
- if toolbar.nOr == 1 then
- local dif = toolbar.nLeft-e_X;
- for each, item in pairs(toolbar.tItems) do
- local tDf = xToolBar.Objects[item.kind+1];
- tDf.SetPos(item.id, item.left+(dif/#toolbar.tItems), item.top)
- if toolbar.bTool and e_X > item.left+(dif/#toolbar.tItems) and e_X < item.left+(dif/#toolbar.tItems)+toolbar.nSize then
- if item.tooltip== "" then
- Button.SetVisible(xbtn, false)
- else
- Button.SetText(xbtn, item.tooltip);
- Button.SetPos(xbtn, (item.left+(dif/#toolbar.tItems)+(toolbar.nSize/2))-46.5, item.top-32);
- if not Button.IsVisible(xbtn) then Button.SetVisible(xbtn, true) end
- end
- end
- end
- else
- local dif = toolbar.nTop-e_Y;
- for each, item in pairs(toolbar.tItems) do
- local tDf = xToolBar.Objects[item.kind+1];
- tDf.SetPos(item.id, item.left, item.top+(dif/#toolbar.tItems))
- if toolbar.bTool and e_Y > (item.top+(dif/#toolbar.tItems)) and e_Y < (item.top+(dif/#toolbar.tItems)+toolbar.nSize) then
- if item.tooltip== "" then
- Button.SetVisible(xbtn, false)
- else
- Button.SetText(xbtn, item.tooltip);
- Button.SetPos(xbtn,(xToolBar.nSide==1) and item.left-101 or item.right+2, (item.top+(dif/#toolbar.tItems)+(toolbar.nSize/2))-15);
- if not Button.IsVisible(xbtn) then Button.SetVisible(xbtn, true) end
- end
- end
- end
- end
- end
- Application.ExitScript();
- else
- for x, item in pairs(toolbar.tItems) do
- local tDe = xToolBar.Objects[item.kind+1];
- if item.kind==3 and toolbar.nTrans~=-1 then
- tDe.SetOpacity(item.id, toolbar.nTrans)
- end
- tDe.SetPos(item.id, item.left, item.top);
- tDe.SetSize(item.id, toolbar.nSize, toolbar.nSize);
- if toolbar.bTool then
- Button.SetVisible(xbtn, false);
- end
- end
- end
- end
- end
- xToolBar.CheckValue = function(...)
- if arg[2] == "button" then
- if Page.GetObjectType(arg[1]) == -1 then
- local xToolBarButtons_Path=_TempFolder;
- for x=1, 4 do
- if Page.GetObjectType(arg[1]..((x==1) and "" or x)) == -1 then
- local tProps = {Visible=false, FontSize=8, LeftMargin=0, ColorDown=16777215, HighlightSound=1,HighlightSoundFile="", ResizeTop=false, Width=((x<=2) and 93 or 101), Alignment=1,ClickSoundFile="", ResizeLeft=false,FontUnderline=false,ResizeRight=false,XOffset=0, ColorNormal=16777215, Cursor=1, YOffset=0,ButtonFile=xToolBarButtons_Path.."\\"..arg[1]..((x==1) and "" or x)..".btn",FontItalic=false,FontStrikeout=false,ToggleState=0, FontAntiAlias=true, Enabled=true, ResizeBottom=false, ClickSound=1, FontScript=0, Text="", FontName="Arial", TooltipText="", Y=0, X=0, Style=0, RightMargin=0, Height=((x<=2) and 30 or 22), ColorHighlight=16777215, FontWeight=700, ColorDisabled=16777215}
- Page.CreateObject(OBJECT_BUTTON, arg[1]..((x==1) and "" or x), tProps);
- end
- end
- end
- else
- if type(arg[1]) ~= arg[2] then
- Dialog.Message("Error @ "..arg[3], "Submited argument is a "..type(arg[1]).." value instead of "..arg[2].." value\r\nExecution cancelled");
- Application.ExitScript();
- end
- end
- end
- xToolBar.CreateToolbar = function(sToolbarName, nCenterLeft, nTopPos, nSizePerIcon, nSpacePerItem, nAnimation, bShowTooltip, nTransp, nOrientation)
- xToolBar.CheckValue("btn_xToolBar", "button");
- xToolBar.CheckValue(sToolbarName, "string", "xToolBar Name");
- xToolBar.CheckValue(nCenterLeft, "number", "X Center");
- xToolBar.CheckValue(nTopPos, "number", "Y Center");
- xToolBar.CheckValue(nSizePerIcon, "number", "Size/Icon");
- xToolBar.CheckValue(nSpacePerItem, "number", "Space");
- xToolBar.CheckValue(nAnimation, "number", "Animation");
- xToolBar.CheckValue(bShowTooltip, "boolean", "Show tooltip");
- xToolBar.CheckValue(nTransp, "number", "Opacity");
- xToolBar.CheckValue(nOrientation, "number", "Orientation");
- if not xToolBar.Toolbars[sToolbarName] then
- local nT = (nTransp==100) and -1 or nTransp;
- xToolBar.Toolbars[sToolbarName] = {nSize=nSizePerIcon, nTop=nTopPos, nLeft=nCenterLeft, nSpace=nSpacePerItem, tItems={}, nMode=nAnimation, bTool=bShowTooltip, nTrans=nT, nOr=nOrientation};
- return xToolBar.Toolbars[sToolbarName];
- else
- return xToolBar.Toolbars[sToolbarName];
- end
- end
- xToolBar.GetAnimation = function(toolbar)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- return toolbar.nMode;
- end
- xToolBar.GetIconsSize = function(toolbar)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- return toolbar.nSize;
- end
- xToolBar.GetnMaxSize = function()
- return (xToolBar.nMaxSize-1)*100;
- end
- xToolBar.GetnShakes = function()
- return xToolBar.nShakes;
- end
- xToolBar.GetOpacity = function(toolbar)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- return toolbar.nTrans;
- end
- xToolBar.GetPos = function(toolbar)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- return {X = toolbar.nLeft, Y = toolbar.nTop};
- end
- xToolBar.HideTooltip = function(toolbar)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- toolbar.bTool = false;
- end
- xToolBar.Reorder = function (toolbar)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- local n = #toolbar.tItems;
- local step = toolbar.nSize+toolbar.nSpace;
- if toolbar.nOr == 1 then
- local mintotal = toolbar.nLeft - (((n * toolbar.nSize) + ((n-1) * toolbar.nSpace))/2);
- for each, image in pairs(toolbar.tItems) do
- local tDe = xToolBar.Objects[image.kind+1];
- image.left = mintotal+(step*(each-1));
- image.right = image.left + toolbar.nSize;
- image.lm_x = image.left + (toolbar.nSize/2);
- image.top = toolbar.nTop-(toolbar.nSize/2);
- image.bottom = image.top + toolbar.nSize;
- image.lm_y = image.top + (toolbar.nSize/2);
- tDe.SetPos(image.id, image.left , toolbar.nTop-(toolbar.nSize/2));
- end
- else
- local mintotal = toolbar.nTop - (((n * toolbar.nSize) + ((n-1) * toolbar.nSpace))/2);
- for each, image in pairs(toolbar.tItems) do
- local tDe = xToolBar.Objects[image.kind+1];
- image.top = mintotal+(step*(each-1));
- image.bottom = image.top + toolbar.nSize;
- image.lm_y = image.top + (toolbar.nSize/2);
- image.left = toolbar.nLeft-(toolbar.nSize/2);
- image.right = image.left+toolbar.nSize;
- image.lm_x = image.left + (toolbar.nSize/2);
- tDe.SetPos(image.id, toolbar.nLeft-(toolbar.nSize/2), image.top);
- end
- end
- end
- xToolBar.SetAnimation = function(toolbar, n)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- xToolBar.CheckValue(n,"number", "Animation");
- toolbar.nMode=n;
- end
- xToolBar.SetIconsSize = function(toolbar, n)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- xToolBar.CheckValue(n,"number", "IconsSize");
- toolbar.nSize = n;
- xToolBar.Reorder(toolbar);
- end
- xToolBar.SetnMaxSize = function(n)--Fish Eye animations
- xToolBar.CheckValue(n, "number", "nMaxSize");
- xToolBar.nMaxSize = 1+(n*.01)
- end
- xToolBar.SetnShakes = function(n)--Shake animations
- xToolBar.CheckValue(n,"number", "nShakes");
- xToolBar.nShakes = n;
- end
- xToolBar.SetnSpace = function(toolbar, n)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- xToolBar.CheckValue(n, "number", "nSpace");
- xToolBar.nSpace = n;
- xToolBar.Reorder(toolbar);
- end
- xToolBar.SetOpacity = function(toolbar, n)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- xToolBar.CheckValue(n, "number", "Opacity");
- toolbar.nTrans = (n==100) and -1 or n;
- end
- xToolBar.SetPos = function(toolbar, x, y)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- xToolBar.CheckValue(x,"number", "X Pos");
- xToolBar.CheckValue(y,"number", "Y Pos");
- toolbar.nLeft = x;
- toolbar.nTop = y;
- xToolBar.Reorder(toolbar);
- end
- xToolBar.SetTooltipSide= function(n)--Vertical oriented toolbars
- xToolBar.CheckValue(n,"number", "Tooltip side");
- xToolBar.nSide = n;
- end
- xToolBar.ShowTooltip = function(toolbar)
- xToolBar.CheckValue(toolbar,"table", "xToolBar table");
- toolbar.bTool = true;
- end
- xToolBar.SwitchOrientation = function(toolbar)
- toolbar.nOr = xToolBar.xChange(toolbar.nOr)
- xToolBar.Reorder(toolbar);
- end
- xToolBar.xChange = function(...)
- xToolBar.CheckValue(arg[1],"number", "xChange arg[1]");
- if #arg == 1 then
- return (arg[1]==1) and 2 or 1;
- else
- xToolBar.CheckValue(arg[2],"number", "xChange arg[2]");
- return arg[2], arg[1];
- end
- end
- --------------### xToolBar New Functions ###------------
- xToolBar.slideUpShow = function(sObj)--Hides an object
- local cp = Application.GetCurrentPage();
- cp = (cp == "") and Application.GetCurrentDialog() or cp;
- local u = cp.."_"..sObj;
- if not xToolBar.Animating[u] then
- xToolBar.Animating[u] = {Kind = Page.GetObjectType(sObj), Visible = true};
- elseif not xToolBar.Animating[u].Visible then
- Dialog.Message("Error", "Object already hidden");
- Application.ExitScript();
- elseif xToolBar.Animating[u].Animating then
- --Dialog.Message("Error", "Object is been animated");
- Application.ExitScript();
- end
- local tObj = xToolBar.Objects[xToolBar.Animating[u].Kind+1];
- if tObj and xToolBar.Animating[u].Kind ~= 1 then
- if tObj.IsVisible(sObj) then
- local t = tObj.GetSize(sObj);
- xToolBar.Animating[u].Width = t.Width;
- xToolBar.Animating[u].Height = t.Height;
- if t then
- xToolBar.Animating[u].Animating = true;
- local step = -((t.Height/50)*(t.Height/100));
- for x=t.Height, 0, step do
- tObj.SetSize(sObj, t.Width, x);
- end
- tObj.SetVisible(sObj, false);
- xToolBar.Animating[u].Visible = false;
- xToolBar.Animating[u].Animating = false;
- end
- else
- Dialog.Message("Error", "Object is not visible");
- xToolBar.Animating[u].Visible = false;
- Application.ExitScript();
- end
- else
- Dialog.Message("Error", "Unsupported object");
- Application.ExitScript();
- end
- end
- xToolBar.slideDownShow = function(sObj)--Shows an object
- local cp = Application.GetCurrentPage();
- cp = (cp == "") and Application.GetCurrentDialog() or cp;
- local u = cp.."_"..sObj;
- if not xToolBar.Animating[u] then
- Dialog.Message("Error", "Object can't be showed");
- Application.ExitScript();
- elseif xToolBar.Animating[u].Visible then
- Dialog.Message("Error", "Object is visible");
- Application.ExitScript();
- elseif xToolBar.Animating[u].Animating then
- --Dialog.Message("Error", "Object is been animated");
- Application.ExitScript();
- end
- local tObj = xToolBar.Objects[xToolBar.Animating[u].Kind+1];
- if tObj and xToolBar.Animating[u].Kind ~= 1 then
- tObj.SetVisible(sObj, true);
- xToolBar.Animating[u].Visible = true;
- xToolBar.Animating[u].Animating = true;
- local step = ((xToolBar.Animating[u].Height/50)*(xToolBar.Animating[u].Height/100));
- for x=0, xToolBar.Animating[u].Height, step do
- tObj.SetSize(sObj, xToolBar.Animating[u].Width, x);
- end
- xToolBar.Animating[u].Animating = false;
- else
- Dialog.Message("Error", "Unsupported object");
- Application.ExitScript();
- end
- end
- xToolBar.slideUDToggleShow = function(sObj)--Switch between hide and show
- local cp = Application.GetCurrentPage();
- cp = (cp == "") and Application.GetCurrentDialog() or cp;
- local u = cp.."_"..sObj;
- if not xToolBar.Animating[u] then
- xToolBar.Animating[u] = {Kind = Page.GetObjectType(sObj), Visible = true};
- elseif xToolBar.Animating[u].Animating then
- --Dialog.Message("Error", "Object is been animated");
- Application.ExitScript();
- end
- local tObj = xToolBar.Objects[xToolBar.Animating[u].Kind+1];
- if tObj and xToolBar.Animating[u].Kind ~= 1 then
- xToolBar.Animating[u].Animating = true;
- if xToolBar.Animating[u].Visible then
- if tObj.IsVisible(sObj) then
- local t = tObj.GetSize(sObj);
- xToolBar.Animating[u].Width = t.Width;
- xToolBar.Animating[u].Height = t.Height;
- if t then
- local step = -((t.Height/50)*(t.Height/100));
- for x=t.Height, 0, step do
- tObj.SetSize(sObj, t.Width, x);
- end
- tObj.SetVisible(sObj, false);
- xToolBar.Animating[u].Visible = false;
- end
- else
- Dialog.Message("Error", "Object is not visible");
- xToolBar.Animating[u].Visible = false;
- Application.ExitScript();
- end
- else
- if not tObj.IsVisible(sObj) then
- tObj.SetVisible(sObj, true);
- xToolBar.Animating[u].Visible = true;
- if xToolBar.Animating[u].Height then
- local step = ((xToolBar.Animating[u].Height/50)*(xToolBar.Animating[u].Height/100));
- for x=0, xToolBar.Animating[u].Height, step do
- tObj.SetSize(sObj, xToolBar.Animating[u].Width, x);
- end
- else
- Dialog.Message("Error", "Object can't be animated");
- xToolBar.Animating[u].Visible = false;
- Application.ExitScript();
- end
- else
- Dialog.Message("Error", "Object is already visible");
- xToolBar.Animating[u].Visible = true;
- Application.ExitScript();
- end
- end
- xToolBar.Animating[u].Animating = false;
- else
- Dialog.Message("Error", "Unsupported object");
- Application.ExitScript();
- end
- end
- xToolBar.slideLeft = function(sObj, np, ...)--Moves an object
- local orientation = (arg[1] ~= nil) and -1 or 1
- local cp = Application.GetCurrentPage();
- cp = (cp == "") and Application.GetCurrentDialog() or cp;
- local u = cp.."_"..sObj;
- if not xToolBar.Animating[u] then
- xToolBar.Animating[u] = {Kind = Page.GetObjectType(sObj), Visible = true};
- elseif xToolBar.Animating[u].Animating then
- --Dialog.Message("Error", "Object is been animated");
- Application.ExitScript();
- end
- local tObj = xToolBar.Objects[xToolBar.Animating[u].Kind+1];
- if tObj then
- if tObj.IsVisible(sObj) then
- local t = tObj.GetPos(sObj);
- if t then
- xToolBar.Animating[u].Animating = true;
- local ntx = 0;
- for x=.05, np do
- ntx = t.X-(x*orientation);
- tObj.SetPos(sObj, ntx, t.Y);
- end
- xToolBar.Animating[u].Animating = false;
- end
- else
- xToolBar.Animating[u].Visible = false;
- Dialog.Message("Error", "Can't animate a hidden object");
- Application.ExitScript();
- end
- else
- Dialog.Message("Error", "Unsupported object");
- Application.ExitScript();
- end
- end
- xToolBar.slideRight = function(sObj, np)--Moves an object
- xToolBar.slideLeft(sObj, np, -1);--lol
- end
- xToolBar.slideLR = function(sObj, np, start, ...)--Moves and backs an object
- local orientation = (arg[1] ~= nil) and true or false;
- start = tonumber(start);
- start = (start~=nil) and (start==-1) and -1 or 1 or 1;
- local cp = Application.GetCurrentPage();
- cp = (cp == "") and Application.GetCurrentDialog() or cp;
- local u = cp.."_"..sObj;
- if not xToolBar.Animating[u] then
- xToolBar.Animating[u] = {Kind = Page.GetObjectType(sObj), Visible = true};
- elseif xToolBar.Animating[u].Animating then
- --Dialog.Message("Error", "Object is been animated");
- Application.ExitScript();
- end
- local tObj = xToolBar.Objects[xToolBar.Animating[u].Kind+1];
- if tObj then
- if tObj.IsVisible(sObj) then
- local t = tObj.GetPos(sObj);
- if t then
- local Xor = (orientation == false) and t.X or t.Y;
- xToolBar.Animating[u].Animating = true;
- local ntx, ntx2 = 0, 0;
- for x=.05, np do
- ntx = Xor +(x*start);
- tObj.SetPos(sObj, (orientation == false) and ntx or t.X, (orientation == false) and t.Y or ntx);
- end
- for x=.05, np do
- ntx2 = ntx-(x*start);
- tObj.SetPos(sObj, (orientation == false) and ntx2 or t.X, (orientation == false) and t.Y or ntx2);
- end
- xToolBar.Animating[u].Animating = false;
- end
- else
- xToolBar.Animating[u].Visible = false;
- Dialog.Message("Error", "Can't animate a hidden object");
- Application.ExitScript();
- end
- else
- Dialog.Message("Error", "Unsupported object");
- Application.ExitScript();
- end
- end
- xToolBar.slideLRToggle = function(sObj, np, start, ...)
- local orientation = (arg[1] ~= nil) and true or false;
- start = tonumber(start);
- start = (start~=nil) and (start==-1) and -1 or 1 or 1;
- local cp, tObj = Application.GetCurrentPage();
- cp = (cp == "") and Application.GetCurrentDialog() or cp;
- local u = cp.."_"..sObj;
- if not xToolBar.Animating[u] then
- xToolBar.Animating[u] = {Kind = Page.GetObjectType(sObj), Visible = true, Switch = false};
- elseif xToolBar.Animating[u].Animating then
- --Dialog.Message("Error", "Object is been animated");
- Application.ExitScript();
- end
- tObj = xToolBar.Objects[xToolBar.Animating[u].Kind+1];
- if not tObj then
- Dialog.Message("Error", "Unsupported object");
- Application.ExitScript();
- else
- if not tObj.IsVisible(sObj) then
- xToolBar.Animating[u].Visible = false;
- Dialog.Message("Error", "Can't animate a hidden object");
- Application.ExitScript();
- end
- end
- local t = tObj.GetPos(sObj);
- if t then
- local Xor = (orientation == false) and t.X or t.Y;
- xToolBar.Animating[u].Animating = true;
- if not xToolBar.Animating[u].Switch then
- local ntx = 0;
- for x=.05, np do
- ntx = Xor+(x*start);
- tObj.SetPos(sObj, (orientation == false) and ntx or t.X, (orientation == false) and t.Y or ntx);
- end
- xToolBar.Animating[u].Switch = true;
- else
- local ntx = 0;
- for x=.05, np do
- ntx = Xor-(x*start);
- tObj.SetPos(sObj, (orientation == false) and ntx or t.X, (orientation == false) and t.Y or ntx);
- end
- xToolBar.Animating[u].Switch = false;
- end
- xToolBar.Animating[u].Animating = false;
- end
- end
- xToolBar.slideUp = function(sObj, np, ...)
- local orientation = (arg[1] ~= nil) and -1 or 1
- local cp = Application.GetCurrentPage();
- cp = (cp == "") and Application.GetCurrentDialog() or cp;
- local u = cp.."_"..sObj;
- if not xToolBar.Animating[u] then
- xToolBar.Animating[u] = {Kind = Page.GetObjectType(sObj), Visible = true};
- elseif xToolBar.Animating[u].Animating then
- --Dialog.Message("Error", "Object is been animated");
- Application.ExitScript();
- end
- local tObj = xToolBar.Objects[xToolBar.Animating[u].Kind+1];
- if tObj then
- if not tObj.IsVisible(sObj) then
- xToolBar.Animating[u].Visible = false;
- Dialog.Message("Error", "Can't animate a hidden object");
- Application.ExitScript();
- end
- local t = tObj.GetPos(sObj);
- if t then
- xToolBar.Animating[u].Animating = true;
- local ntx = 0;
- for x=.05, np do
- ntx = t.Y-(x*orientation);
- tObj.SetPos(sObj, t.X, ntx);
- end
- xToolBar.Animating[u].Animating = false;
- end
- else
- Dialog.Message("Error", "Unsupported object");
- Application.ExitScript();
- end
- end
- xToolBar.slideDown = function(sObj, np)
- xToolBar.slideUp(sObj, np,-1);--lol
- end
- xToolBar.slideUDToggle = function(sObj, np, start)
- xToolBar.slideLRToggle(sObj, np, start, true);--lol
- end
- xToolBar.slideUD = function(sObj, np, start)
- xToolBar.slideLR(sObj, np, start, true);--lol
- end
- ------------### by WeBuLtRa ###-----------
- --[[Example calls for new functions:
- xToolBar.slideUp("Image1", 50);
- xToolBar.slideDown("Image1", 50);
- xToolBar.slideLeft("Image1", 50);
- xToolBar.slideRight("Image1", 50);
- xToolBar.slideLR("Image1", 100);
- xToolBar.slideLR("Image1", 100, -1);
- xToolBar.slideUD("Image1", 100);
- xToolBar.slideUD("Image1", 100, -1);
- xToolBar.slideLRToggle("Image1", 100);
- xToolBar.slideLRToggle("Image1", 100, -1);
- xToolBar.slideUDToggle("Image1", 100);
- xToolBar.slideUDToggle("Image1", 100, -1);
- xToolBar.slideUpShow("Image1");
- xToolBar.slideDownShow("Image1");
- xToolBar.slideUDToggleShow("Image1");
- ]]--
Add Comment
Please, Sign In to add comment