diff --git a/basalt-minified.lua b/basalt-minified.lua index 2b4d42b..1b42a78 100644 --- a/basalt-minified.lua +++ b/basalt-minified.lua @@ -1 +1 @@ -local a={basaltBG=colors.lightGray,basaltFG=colors.black,FrameBG=colors.gray,FrameFG=colors.black,ButtonBG=colors.gray,ButtonFG=colors.black,CheckboxBG=colors.gray,CheckboxFG=colors.black,InputBG=colors.gray,InputFG=colors.black,textfieldBG=colors.gray,textfieldFG=colors.black,listBG=colors.gray,listFG=colors.black,dropdownBG=colors.gray,dropdownFG=colors.black,radioBG=colors.gray,radioFG=colors.black,selectionBG=colors.black,selectionFG=colors.lightGray}local b={debugger=true,version=1}local c;local d={}local e={}local f=term.current()local g=string.sub;local function h(i,j,k)i=string.sub(i,1,j)local l=j-string.len(i)if k=="right"then i=string.rep(" ",l)..i elseif k=="center"then i=string.rep(" ",math.floor(l/2))..i..string.rep(" ",math.floor(l/2))i=i..(string.len(i)=1 and O<=u then if N+i:len()>0 and N<=j then local P=v[O]local Q;local R=N+#i-1;if N<1 then local S=1-N+1;local T=j-N+1;i=g(i,S,T)elseif R>j then local T=j-N+1;i=g(i,1,T)end;if N>1 then local T=N-1;Q=g(P,1,T)..i else Q=i end;if R=1 and O<=u then if N+V:len()>0 and N<=j then local P=w[O]local Q;local R=N+#V-1;if N<1 then V=g(V,1-N+1,j-N+1)elseif R>j then V=g(V,1,j-N+1)end;if N>1 then Q=g(P,1,N-1)..V else Q=V end;if R=1 and O<=u then if N+V:len()>0 and N<=j then local P=x[O]local Q;local R=N+#V-1;if N<1 then local S=1-N+1;local T=j-N+1;V=g(V,S,T)elseif R>j then local T=j-N+1;V=g(V,1,T)end;if N>1 then local T=N-1;Q=g(P,1,T)..V else Q=V end;if RN and aM<=O and aM+self.height>O and as then if self.parent~=nil then self.parent:setFocusedObject(self)end;au:sendEvent(a7,self,a7,aK,N,O)return true end;return false end,keyHandler=function(self,a7,aN)if self:isFocused()then au:sendEvent(a7,self,a7,aN)return true end;return false end,backgroundKeyHandler=function(self,a7,aN)au:sendEvent("background_"..a7,self,a7,aN)end,valueChangedHandler=function(self)au:sendEvent("value_changed",self)end,eventHandler=function(self,a7,aO,aP,aQ,aR)au:sendEvent("custom_event_handler",self,a7,aO,aP,aQ,aR)end,getFocusHandler=function(self)au:sendEvent("get_focus",self)end,loseFocusHandler=function(self)au:sendEvent("lose_focus",self)end}av.__index=av;return av end;local function aS(am)local aT=al(am)local an="Button"aT:setValue("Button")aT:setZIndex(5)aT.width=8;aT.bgColor=a.ButtonBG;aT.fgColor=a.ButtonFG;local aU="center"local aV="center"local av={getType=function(self)return an end,setHorizontalAlign=function(self,aW)aU=aW end,setVerticalAlign=function(self,aW)aV=aW end,setText=function(self,i)aT:setValue(i)return self end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()local aZ=m(self.height,aV)self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(aX,aY,self.width,self.height,self.fgColor)self.parent:drawTextBox(aX,aY,self.width,self.height," ")for E=1,self.height do if E==aZ then self.parent:setText(aX,aY+E-1,h(self:getValue(),self.width,aU))end end end end end}return setmetatable(av,aT)end;local function a_(am)local aT=al(am)local an="Program"aT:setZIndex(5)local av;local function b0(N,O,j,u)local b1,b2=1,1;local Y,Z=colors.black,colors.white;local b3=false;local b4=false;local v={}local w={}local x={}local b5={}local B;local C={}for q=0,15 do local b6=2^q;b5[b6]={f.getPaletteColour(b6)}end;local function D()B=(" "):rep(j)for E=0,15 do local F=2^E;local G=r[F]C[F]=G:rep(j)end end;local function H()D()local I=B;local J=C[colors.white]local K=C[colors.black]for E=1,u do v[E]=g(v[E]==nil and I or v[E]..I:sub(1,j-v[E]:len()),1,j)x[E]=g(x[E]==nil and J or x[E]..J:sub(1,j-x[E]:len()),1,j)w[E]=g(w[E]==nil and K or w[E]..K:sub(1,j-w[E]:len()),1,j)end end;H()local function b7()if b1>=1 and b2>=1 and b1<=j and b2<=u then else end end;local function b8(b9,ba,bb)local bc=b1;local R=bc+#b9-1;if b2>=1 and b2<=u then if bc<=j and R>=1 then if bc==1 and R==j then v[b2]=b9;x[b2]=ba;w[b2]=bb else local bd,be,bf;if bc<1 then local bg=1-bc+1;local bh=j-bc+1;bd=g(b9,bg,bh)be=g(ba,bg,bh)bf=g(bb,bg,bh)elseif R>j then local bh=j-bc+1;bd=g(b9,1,bh)be=g(ba,1,bh)bf=g(bb,1,bh)else bd=b9;be=ba;bf=bb end;local bi=v[b2]local bj=x[b2]local bk=w[b2]local bl,bm,bn;if bc>1 then local bo=bc-1;bl=g(bi,1,bo)..bd;bm=g(bj,1,bo)..be;bn=g(bk,1,bo)..bf else bl=bd;bm=be;bn=bf end;if R=1 and O<=u then v[bM]=v[O]w[bM]=w[O]x[bM]=x[O]else v[bM]=bJ;x[bM]=bK;w[bM]=bL end end end;if b4 then b7()end end,isColor=function()return f.isColor()end,isColour=function()return f.isColor()end,write=function(i)i=tostring(i)if b4 then b8(i,r[Z]:rep(i:len()),r[Y]:rep(i:len()))end end,clearLine=function()if b4 then M(1,b2,(" "):rep(j))U(1,b2,r[Y]:rep(j))W(1,b2,r[Z]:rep(j))end;if b4 then b7()end end,clear=function()for E=1,u do M(1,E,(" "):rep(j))U(1,E,r[Y]:rep(j))W(1,E,r[Z]:rep(j))end;if b4 then b7()end end,blit=function(i,bN,bO)if type(i)~="string"then error("bad argument #1 (expected string, got "..type(i)..")",2)end;if type(bN)~="string"then error("bad argument #2 (expected string, got "..type(bN)..")",2)end;if type(bO)~="string"then error("bad argument #3 (expected string, got "..type(bO)..")",2)end;if#bN~=#i or#bO~=#i then error("Arguments must be the same length",2)end;if b4 then b8(i,bN,bO)end end}return bE end;aT.width=30;aT.height=12;local bP=b0(1,1,aT.width,aT.height)local bQ;local bR=false;local bS={}av={getType=function(self)return an end,show=function(self)aT.show(self)bP.setBackgroundColor(self.bgColor)bP.setTextColor(self.fgColor)bP.basalt_setVisible(true)return self end,hide=function(self)aT.hide(self)bP.basalt_setVisible(false)return self end,setPosition=function(self,N,O,aB)aT.setPosition(self,N,O,aB)bP.basalt_reposition(self:getAnchorPosition())return self end,getBasaltWindow=function()return bP end,getBasaltProcess=function()return bQ end,setSize=function(self,j,u)aT.setSize(self,j,u)bP.basalt_resize(self.width,self.height)return self end,getStatus=function(self)if bQ~=nil then return bQ:getStatus()end;return"inactive"end,execute=function(self,af,...)bQ=ad:new(af,bP,...)bP.setBackgroundColor(colors.black)bP.setTextColor(colors.white)bP.clear()bP.setCursorPos(1,1)bQ:resume()bR=false;return self end,stop=function(self)if bQ~=nil then if not bQ:isDead()then bQ:resume("terminate")if bQ:isDead()then if self.parent~=nil then self.parent:setCursor(false)end end end end;return self end,pause=function(self,bT)bR=bT or not bR;if bQ~=nil then if not bQ:isDead()then if not bR then self:injectEvents(bS)bS={}end end end;return self end,isPaused=function(self)return bR end,injectEvent=function(self,a7,aO,aP,aQ,aR,bU)if bQ~=nil then if not bQ:isDead()then if bR==false or bU then bQ:resume(a7,aO,aP,aQ,aR)else table.insert(bS,{event=a7,args={aO,aP,aQ,aR}})end end end;return self end,getQueuedEvents=function(self)return bS end,updateQueuedEvents=function(self,a5)bS=a5 or bS;return self end,injectEvents=function(self,a5)if bQ~=nil then if not bQ:isDead()then for aa,ab in pairs(a5)do bQ:resume(ab.event,table.unpack(ab.args))end end end;return self end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then if bQ==nil then return false end;if not bQ:isDead()then if not bR then local bV,bW=self:getAbsolutePosition(self:getAnchorPosition(nil,nil,true))bQ:resume(a7,aK,N-bV+1,O-bW+1)end end;return true end end,keyHandler=function(self,a7,aN)aT.keyHandler(self,a7,aN)if self:isFocused()then if bQ==nil then return false end;if not bQ:isDead()then if not bR then if self.draw then bQ:resume(a7,aN)end end end end end,getFocusHandler=function(self)aT.getFocusHandler(self)if bQ~=nil then if not bQ:isDead()then if not bR then if self.parent~=nil then local bX,bY=bP.getCursorPos()local aX,aY=self:getAnchorPosition()if self.parent~=nil then if aX+bX-1>=1 and aX+bX-1<=aX+self.width-1 and bY+aY-1>=1 and bY+aY-1<=aY+self.height-1 then self.parent:setCursor(bP.getCursorBlink(),aX+bX-1,bY+aY-1,bP.getTextColor())end end end end end end end,loseFocusHandler=function(self)aT.loseFocusHandler(self)if bQ~=nil then if not bQ:isDead()then if self.parent~=nil then self.parent:setCursor(false)end end end end,eventHandler=function(self,a7,aO,aP,aQ,aR)if bQ==nil then return end;if not bQ:isDead()then if not bR then if a7~="mouse_click"and a7~="mouse_up"and a7~="mouse_scroll"and a7~="mouse_drag"and a7~="key_up"and a7~="key"and a7~="char"and a7~="terminate"then bQ:resume(a7,aO,aP,aQ,aR)end;if self:isFocused()then local aX,aY=self:getAnchorPosition()local bX,bY=bP.getCursorPos()if self.parent~=nil then if aX+bX-1>=1 and aX+bX-1<=aX+self.width-1 and bY+aY-1>=1 and bY+aY-1<=aY+self.height-1 then self.parent:setCursor(bP.getCursorBlink(),aX+bX-1,bY+aY-1,bP.getTextColor())end end;if a7=="terminate"and self:isFocused()then self:stop()end end else if a7~="mouse_click"and a7~="mouse_up"and a7~="mouse_scroll"and a7~="mouse_drag"and a7~="key_up"and a7~="key"and a7~="char"and a7~="terminate"then table.insert(bS,{event=a7,args={aO,aP,aQ,aR}})end end end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()bP.basalt_reposition(aX,aY)self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)bP.basalt_update()end end end}return setmetatable(av,aT)end;local function bZ(am)local aT=al(am)local an="Label"aT:setZIndex(3)local b_=true;aT:setValue("")local av={getType=function(self)return an end,setText=function(self,i)i=tostring(i)aT:setValue(i)if b_ then self.width=i:len()end;return self end,setSize=function(self,j,n)self.width,self.height=j,n;b_=false;return self end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:writeText(aX,aY,self:getValue(),self.bgColor,self.fgColor)end end end}return setmetatable(av,aT)end;local function c0(am)local aT=al(am)local an="Pane"local av={getType=function(self)return an end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(aX,aY,self.width,self.height,self.bgColor)end end end}return setmetatable(av,aT)end;local function c1(am)local aT=al(am)local an="Image"aT:setZIndex(2)local c2;local c3;local c4=false;local function c5()local c6={[0]={8,4,3,6,5},{4,14,8,7},{6,10,8,7},{9,11,8,0},{1,14,8,0},{13,12,8,0},{2,10,8,0},{15,8,10,11,12,14},{0,7,1,9,2,13},{3,11,8,7},{2,6,7,15},{9,3,7,15},{13,5,7,15},{5,12,8,7},{1,4,7,15},{7,10,11,12,14}}local c7,c8,c9={},{},{}for q=0,15 do c8[2^q]=q end;do local ca="0123456789abcdef"for q=1,16 do c7[ca:sub(q,q)]=q-1;c7[q-1]=ca:sub(q,q)c9[ca:sub(q,q)]=2^(q-1)c9[2^(q-1)]=ca:sub(q,q)local cb=c6[q-1]for q=1,#cb do cb[q]=2^cb[q]end end end;local function cc(cd)local ce=c6[c8[cd[#cd][1]]]for cf=1,#ce do local cg=ce[cf]for q=1,#cd-1 do if cd[q][1]==cg then return q end end end;return 1 end;local function ch(ci,cj)if not cj then local ck={}cj={}for q=1,6 do local cl=ci[q]local cm=cj[cl]cj[cl],ck[q]=cm and cm+1 or 1,cl end;ci=ck end;local cd={}for aN,ab in pairs(cj)do cd[#cd+1]={aN,ab}end;if#cd>1 then while#cd>2 do table.sort(cd,function(cn,bB)return cn[2]>bB[2]end)local co,cp=cc(cd),#cd;local cq,cr=cd[cp][1],cd[co][1]for q=1,6 do if ci[q]==cq then ci[q]=cr;cd[co][2]=cd[co][2]+1 end end;cd[cp]=nil end;local cs=128;for q=1,#ci-1 do if ci[q]~=ci[6]then cs=cs+2^(q-1)end end;return string.char(cs),c9[cd[1][1]==ci[6]and cd[2][1]or cd[1][1]],c9[ci[6]]else return"\128",c9[ci[1]],c9[ci[1]]end end;local ct,j,u,Y={{},{},{}},0,#c2+#c2%3,aT.bgColor or colors.black;for q=1,#c2 do if#c2[q]>j then j=#c2[q]end end;for O=0,u-1,3 do local cu,cv,cw,cx={},{},{},1;for N=0,j-1,2 do local ci,cj={},{}for cy=1,3 do for cz=1,2 do ci[#ci+1]=c2[O+cy]and c2[O+cy][N+cz]and(c2[O+cy][N+cz]==0 and Y or c2[O+cy][N+cz])or bgCol;cj[ci[#ci]]=cj[ci[#ci]]and cj[ci[#ci]]+1 or 1 end end;cu[cx],cv[cx],cw[cx]=ch(ci,cj)cx=cx+1 end;ct[1][#ct[1]+1],ct[2][#ct[2]+1],ct[3][#ct[3]+1]=table.concat(cu),table.concat(cv),table.concat(cw)end;ct.width,ct.height=#ct[1][1],#ct[1]c3=ct end;local av={getType=function(self)return an end,loadImage=function(self,af)c2=paintutils.loadImage(af)c4=false;return self end,loadBlittleImage=function(self,af)c4=true;return self end,shrinkImage=function(self)c5()c4=true;return self end,draw=function(self)if aT.draw(self)then if self.parent~=nil then if c2~=nil then local aX,aY=self:getAnchorPosition()if c4 then local p,cA,cB=c3[1],c3[2],c3[3]for q=1,c3.height do local cC=p[q]if type(cC)=="string"then self.parent:setText(aX,aY+q-1,cC)self.parent:setFG(aX,aY+q-1,cA[q])self.parent:setBG(aX,aY+q-1,cB[q])elseif type(cC)=="table"then self.parent:setText(aX,aY+q-1,cC[2])self.parent:setFG(aX,aY+q-1,cA[q])self.parent:setBG(aX,aY+q-1,cB[q])end end else for aA=1,math.min(#c2,self.height)do local cD=c2[aA]for az=1,math.min(#cD,self.width)do if cD[az]>0 then self.parent:drawBackgroundBox(aX+az-1,aY+aA-1,1,1,cD[az])end end end end end end end end}return setmetatable(av,aT)end;local function cE(am)local aT=al(am)local an="Checkbox"aT:setZIndex(5)aT:setValue(false)aT.width=1;aT.height=1;aT.bgColor=a.CheckboxBG;aT.fgColor=a.CheckboxFG;local av={symbol="\42",getType=function(self)return an end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then if a7=="mouse_click"and aK==1 then if self:getValue()~=true and self:getValue()~=false then self:setValue(false)else self:setValue(not self:getValue())end end;return true end;return false end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()local aZ=m(self.height,"center")self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)for E=1,self.height do if E==aZ then if self:getValue()==true then self.parent:writeText(aX,aY+E-1,h(self.symbol,self.width,"center"),self.bgColor,self.fgColor)else self.parent:writeText(aX,aY+E-1,h(" ",self.width,"center"),self.bgColor,self.fgColor)end end end end end end}return setmetatable(av,aT)end;local function cF(am)local aT=al(am)local an="Progressbar"local cG=0;aT:setZIndex(5)aT:setValue(false)aT.width=25;aT.height=1;aT.bgColor=a.CheckboxBG;aT.fgColor=a.CheckboxFG;local cH=colors.black;local cI=""local cJ=colors.white;local cK=""local cL=0;local av={getType=function(self)return an end,setDirection=function(self,cM)cL=cM;return self end,setProgressBar=function(self,aD,_,cN)cH=aD or cH;cI=_ or cI;cJ=cN or cJ;return self end,setBackgroundSymbol=function(self,_)cK=_:sub(1,1)return self end,setProgress=function(self,ab)if ab>=0 and ab<=100 and cG~=ab then cG=ab;self:setValue(cG)if cG==100 then self:progressDoneHandler()end end;return self end,getProgress=function(self)return cG end,onProgressDone=function(self,cO)self:registerEvent("progress_done",cO)return self end,progressDoneHandler=function(self)self:sendEvent("progress_done")end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(aX,aY,self.width,self.height,self.fgColor)self.parent:drawTextBox(aX,aY,self.width,self.height,cK)if cL==1 then self.parent:drawBackgroundBox(aX,aY,self.width,self.height/100*cG,cH)self.parent:drawForegroundBox(aX,aY,self.width,self.height/100*cG,cJ)self.parent:drawTextBox(aX,aY,self.width,self.height/100*cG,cI)elseif cL==2 then self.parent:drawBackgroundBox(aX,aY+math.ceil(self.height-self.height/100*cG),self.width,self.height/100*cG,cH)self.parent:drawForegroundBox(aX,aY+math.ceil(self.height-self.height/100*cG),self.width,self.height/100*cG,cJ)self.parent:drawTextBox(aX,aY+math.ceil(self.height-self.height/100*cG),self.width,self.height/100*cG,cI)elseif cL==3 then self.parent:drawBackgroundBox(aX+math.ceil(self.width-self.width/100*cG),aY,self.width/100*cG,self.height,cH)self.parent:drawForegroundBox(aX+math.ceil(self.width-self.width/100*cG),aY,self.width/100*cG,self.height,cJ)self.parent:drawTextBox(aX+math.ceil(self.width-self.width/100*cG),aY,self.width/100*cG,self.height,cI)else self.parent:drawBackgroundBox(aX,aY,self.width/100*cG,self.height,cH)self.parent:drawForegroundBox(aX,aY,self.width/100*cG,self.height,cJ)self.parent:drawTextBox(aX,aY,self.width/100*cG,self.height,cI)end end end end}return setmetatable(av,aT)end;local function cP(am)local aT=al(am)local an="Input"local cQ="text"local cR=0;aT:setZIndex(5)aT:setValue("")aT.width=10;aT.height=1;aT.bgColor=a.InputBG;aT.fgColor=a.InputFG;local cS=1;local cT=1;local cU=""local cV;local cW;local cX=cU;local cY=false;local av={getType=function(self)return an end,setInputType=function(self,cZ)if cZ=="password"or cZ=="number"or cZ=="text"then cQ=cZ end;return self end,setDefaultText=function(self,i,c_,d0)cU=i;defaultbgColor=d0 or cV;defaultfgColor=c_ or cW;if self:isFocused()then cX=""else cX=cU end;return self end,getInputType=function(self)return cQ end,setValue=function(self,d1)aT.setValue(self,tostring(d1))if not cY then cS=tostring(d1):len()+1 end;return self end,getValue=function(self)local d1=aT.getValue(self)return cQ=="number"and tonumber(d1)or d1 end,setInputLimit=function(self,d2)cR=tonumber(d2)or cR;return self end,getInputLimit=function(self)return cR end,getFocusHandler=function(self)aT.getFocusHandler(self)if self.parent~=nil then local aX,aY=self:getAnchorPosition()cX=""if self.parent~=nil then self.parent:setCursor(true,aX+cS-cT,aY,self.fgColor)end end end,loseFocusHandler=function(self)aT.loseFocusHandler(self)if self.parent~=nil then self.parent:setCursor(false)cX=cU end end,keyHandler=function(self,a7,aN)if aT.keyHandler(self,a7,aN)then cY=true;if a7=="key"then if aN==keys.backspace then local i=tostring(aT.getValue())if cS>1 then self:setValue(i:sub(1,cS-2)..i:sub(cS,i:len()))if cS>1 then cS=cS-1 end;if cT>1 then if cSd3 then cS=d3+1 end;if cS<1 then cS=1 end;if cS=self.width+cT then cT=cS-self.width+1 end;if cT<1 then cT=1 end end;if aN==keys.left then cS=cS-1;if cS>=1 then if cS=self.width+cT then cT=cS end end;if cS<1 then cS=1 end;if cT<1 then cT=1 end end end;if a7=="char"then local i=aT.getValue()if i:len()=self.width+cT then cT=cT+1 end end end;local aX,aY=self:getAnchorPosition()local d1=tostring(aT.getValue())local d5=(cS<=d1:len()and cS-1 or d1:len())-(cT-1)if d5>self.x+self.width-1 then d5=self.x+self.width-1 end;if self.parent~=nil then self.parent:setCursor(true,aX+d5,aY,self.fgColor)end;cY=false end end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then if a7=="mouse_click"and aK==1 then end;return true end;return false end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()local aZ=m(self.height,"center")self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)for E=1,self.height do if E==aZ then local d1=tostring(aT.getValue())local d0=self.bgColor;local c_=self.fgColor;local i;if d1:len()<=0 then i=cX;d0=defaultbgColor or d0;c_=defaultfgColor or c_ end;i=cX;if d1~=""then i=d1 end;i=i:sub(cT,self.width+cT-1)local d6=self.width-i:len()if d6<0 then d6=0 end;if cQ=="password"and d1~=""then i=string.rep("*",i:len())end;i=i..string.rep(" ",d6)self.parent:writeText(aX,aY+E-1,i,d0,c_)end end end end end}return setmetatable(av,aT)end;local function d7(am)local aT=al(am)local an="Textfield"local d8,cT,cS,d9=1,1,1,1;local da={""}local db={[colors.purple]={"break"}}aT.width=20;aT.height=8;aT.bgColor=a.textfieldBG;aT.fgColor=a.textfieldFG;aT:setZIndex(5)local av={getType=function(self)return an end,getLines=function(self)return da end,getLine=function(self,a6)return da[a6]or""end,editLine=function(self,a6,i)da[a6]=i or da[a6]return self end,addLine=function(self,i,a6)if a6~=nil then table.insert(da,a6,i)else table.insert(da,i)end;return self end,addKeyword=function(self,dc,aD)end,removeLine=function(self,a6)table.remove(da,a6 or#da)if#da<=0 then table.insert(da,"")end;return self end,getTextCursor=function(self)return cS,d9 end,getFocusHandler=function(self)aT.getFocusHandler(self)if self.parent~=nil then local aX,aY=self:getAnchorPosition()if self.parent~=nil then self.parent:setCursor(true,aX+cS-cT,aY+d9-d8,self.fgColor)end end end,loseFocusHandler=function(self)aT.loseFocusHandler(self)if self.parent~=nil then self.parent:setCursor(false)end end,keyHandler=function(self,a7,aN)if aT.keyHandler(self,a7,aN)then local aX,aY=self:getAnchorPosition()if a7=="key"then if aN==keys.backspace then if da[d9]==""then if d9>1 then table.remove(da,d9)cS=da[d9-1]:len()+1;cT=cS-self.width+1;if cT<1 then cT=1 end;d9=d9-1 end elseif cS<=1 then if d9>1 then cS=da[d9-1]:len()+1;cT=cS-self.width+1;if cT<1 then cT=1 end;da[d9-1]=da[d9-1]..da[d9]table.remove(da,d9)d9=d9-1 end else da[d9]=da[d9]:sub(1,cS-2)..da[d9]:sub(cS,da[d9]:len())if cS>1 then cS=cS-1 end;if cT>1 then if cSda[d9]:len()then if da[d9+1]~=nil then da[d9]=da[d9]..da[d9+1]table.remove(da,d9+1)end else da[d9]=da[d9]:sub(1,cS-1)..da[d9]:sub(cS+1,da[d9]:len())end end;if aN==keys.enter then table.insert(da,d9+1,da[d9]:sub(cS,da[d9]:len()))da[d9]=da[d9]:sub(1,cS-1)d9=d9+1;cS=1;cT=1;if d9-d8>=self.height then d8=d8+1 end;self:setValue("")end;if aN==keys.up then if d9>1 then d9=d9-1;if cS>da[d9]:len()+1 then cS=da[d9]:len()+1 end;if cT>1 then if cS1 then if d9da[d9]:len()+1 then cS=da[d9]:len()+1 end;if d9>=d8+self.height then d8=d8+1 end end end;if aN==keys.right then cS=cS+1;if d9<#da then if cS>da[d9]:len()+1 then cS=1;d9=d9+1 end elseif cS>da[d9]:len()then cS=da[d9]:len()+1 end;if cS<1 then cS=1 end;if cS=self.width+cT then cT=cS-self.width+1 end;if cT<1 then cT=1 end end;if aN==keys.left then cS=cS-1;if cS>=1 then if cS=self.width+cT then cT=cS end end;if d9>1 then if cS<1 then d9=d9-1;cS=da[d9]:len()+1;cT=cS-self.width+1 end end;if cS<1 then cS=1 end;if cT<1 then cT=1 end end end;if a7=="char"then da[d9]=da[d9]:sub(1,cS-1)..aN..da[d9]:sub(cS,da[d9]:len())cS=cS+1;if cS>=self.width+cT then cT=cT+1 end;self:setValue("")end;local d5=(cS<=da[d9]:len()and cS-1 or da[d9]:len())-(cT-1)if d5>self.x+self.width-1 then d5=self.x+self.width-1 end;local dd=d9-d8da[d9]:len()then cS=da[d9]:len()+1 end;if cSda[d9]:len()then cS=da[d9]:len()+1 end;if cS#da-(self.height-1)then d8=#da-(self.height-1)end;if d8<1 then d8=1 end;if self.parent~=nil then if aX+cS-cT>=aX and aX+cS-cT<=aX+self.width and(aY+d9-d8>=aY and aY+d9-d8<=aY+self.height)then self.parent:setCursor(true,de+cS-cT,df+d9-d8)else self.parent:setCursor(false)end end end;self:setVisualChanged()return true end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(aX,aY,self.width,self.height,self.fgColor)for E=1,self.height do local i=""if da[E+d8-1]~=nil then i=da[E+d8-1]end;i=i:sub(cT,self.width+cT-1)local d6=self.width-i:len()if d6<0 then d6=0 end;i=i..string.rep(" ",d6)self.parent:setText(aX,aY+E-1,i)end end end end}return setmetatable(av,aT)end;local function dg(am)local aT=al(am)local an="List"aT.width=16;aT.height=6;aT.bgColor=a.listBG;aT.fgColor=a.listFG;aT:setZIndex(5)local dh={}local di=a.selectionBG;local dj=a.selectionFG;local dk=true;local dl="left"local dm=0;local dn=true;local av={getType=function(self)return an end,addItem=function(self,i,Y,Z,...)table.insert(dh,{text=i,bgColor=Y or self.bgColor,fgColor=Z or self.fgColor,args={...}})if#dh==1 then self:setValue(dh[1])end;return self end,setIndexOffset=function(self,dp)dm=dp;return self end,getIndexOffset=function(self)return dm end,removeItem=function(self,a6)table.remove(dh,a6)return self end,getItem=function(self,a6)return dh[a6]end,getItemIndex=function(self)local dq=self:getValue()for aN,ab in pairs(dh)do if ab==dq then return aN end end end,clear=function(self)dh={}self:setValue({})return self end,getItemCount=function(self)return#dh end,editItem=function(self,a6,i,Y,Z,...)table.remove(dh,a6)table.insert(dh,a6,{text=i,bgColor=Y or self.bgColor,fgColor=Z or self.fgColor,args={...}})return self end,selectItem=function(self,a6)self:setValue(dh[a6]or{})return self end,setSelectedItem=function(self,Y,Z,dr)di=Y or self.bgColor;dj=Z or self.fgColor;dk=dr;return self end,setScrollable=function(self,ds)dn=ds;return self end,mouseClickHandler=function(self,a7,aK,N,O)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if aX<=N and aX+self.width>N and aY<=O and aY+self.height>O and self:isVisible()then if a7=="mouse_click"or a7=="mouse_drag"then if aK==1 then if#dh>0 then for E=1,self.height do if dh[E+dm]~=nil then if aX<=N and aX+self.width>N and aY+E-1==O then self:setValue(dh[E+dm])self:getEventSystem():sendEvent("mouse_click",self,"mouse_click",0,N,O,dh[E+dm])end end end end end end;if a7=="mouse_scroll"and dn then dm=dm+aK;if dm<0 then dm=0 end;if aK>=1 then if#dh>self.height then if dm>#dh-self.height then dm=#dh-self.height end;if dm>=#dh then dm=#dh-1 end else dm=dm-1 end end end;self:setVisualChanged()return true end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)for E=1,self.height do if dh[E+dm]~=nil then if dh[E+dm]==self:getValue()then if dk then self.parent:writeText(aX,aY+E-1,h(dh[E+dm].text,self.width,dl),di,dj)else self.parent:writeText(aX,aY+E-1,h(dh[E+dm].text,self.width,dl),dh[E+dm].bgColor,dh[E+dm].fgColor)end else self.parent:writeText(aX,aY+E-1,h(dh[E+dm].text,self.width,dl),dh[E+dm].bgColor,dh[E+dm].fgColor)end end end end end end}return setmetatable(av,aT)end;local function dt(am)local aT=al(am)local an="Menubar"local av={}aT.width=30;aT.height=1;aT.bgColor=colors.gray;aT.fgColor=colors.lightGray;aT:setZIndex(5)local dh={}local di=a.selectionBG;local dj=a.selectionFG;local dk=true;local dl="left"local du=0;local d6=2;local dn=false;local function dv()local dw=0;local az=1;for E=1,#dh do if az+dh[E].text:len()+d6*2>av.w then dw=dw+dh[E].text:len()+d6*2 end;az=az+dh[E].text:len()+d6*2 end;return dw end;av={getType=function(self)return an end,addItem=function(self,i,Y,Z,...)table.insert(dh,{text=i,bgColor=Y or self.bgColor,fgColor=Z or self.fgColor,args={...}})if#dh==1 then self:setValue(dh[1])end;return self end,getItemIndex=function(self)local dq=self:getValue()for aN,ab in pairs(dh)do if ab==dq then return aN end end end,clear=function(self)dh={}self:setValue({})return self end,setSpace=function(self,dx)d6=dx or d6;return self end,setButtonOffset=function(self,l)du=l or 0;if du<0 then du=0 end;local dw=dv()if du>dw then du=dw end;return self end,setScrollable=function(self,ds)dn=ds;return self end,removeItem=function(self,a6)table.remove(dh,a6)return self end,getItem=function(self,a6)return dh[a6]end,getItemCount=function(self)return#dh end,editItem=function(self,a6,i,Y,Z,...)table.remove(dh,a6)table.insert(dh,a6,{text=i,bgColor=Y or self.bgColor,fgColor=Z or self.fgColor,args={...}})return self end,selectItem=function(self,a6)self:setValue(dh[a6]or{})return self end,setSelectedItem=function(self,Y,Z,dr)di=Y or self.bgColor;dj=Z or self.fgColor;dk=dr;return self end,mouseClickHandler=function(self,a7,aK,N,O)local aL,aM=self:getAbsolutePosition(self:getAnchorPosition())if aL<=N and aL+self.width>N and aM<=O and aM+self.height>O and self:isVisible()then if self.parent~=nil then self.parent:setFocusedObject(self)end;if a7=="mouse_click"then local az=1;for E=1+du,#dh do if dh[E]~=nil then if az+dh[E].text:len()+d6*2<=self.width then if aL+az-1<=N and aL+az-1+dh[E].text:len()+d6*2>N and aM==O then self:setValue(dh[E])self:getEventSystem():sendEvent("mouse_click",self,"mouse_click",0,N,O,dh[E])end;az=az+dh[E].text:len()+d6*2 else break end end end end;if a7=="mouse_scroll"and dn then du=du+aK;if du<0 then du=0 end;local dw=dv()if du>dw then du=dw end end;return true end;return false end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)local az=0;for aa,ab in pairs(dh)do if az+ab.text:len()+d6*2<=self.width then if ab==self:getValue()then self.parent:writeText(aX+az-1+-du,aY,h((" "):rep(d6)..ab.text..(" "):rep(d6),ab.text:len()+d6*2,dl),di or ab.bgColor,dj or ab.fgColor)else self.parent:writeText(aX+az-1+-du,aY,h((" "):rep(d6)..ab.text..(" "):rep(d6),ab.text:len()+d6*2,dl),ab.bgColor,ab.fgColor)end;az=az+ab.text:len()+d6*2 else if az0 then for E=1,dA do if dh[E+dm]~=nil then if aX<=N and aX+dz>N and aY+E==O then self:setValue(dh[E+dm])return true end end end end end end;if a7=="mouse_scroll"then dm=dm+aK;if dm<0 then dm=0 end;if aK==1 then if#dh>dA then if dm>#dh-dA then dm=#dh-dA end else dm=dh-1 end end;return true end;self:setVisualChanged()end;if aT.mouseClickHandler(self,a7,aK,N,O)then dD=2 else dD=1 end end,draw=function(self)if aT.draw(self)then local aX,aY=self:getAnchorPosition()if self.parent~=nil then self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)if#dh>=1 then if self:getValue()~=nil then if self:getValue().text~=nil then if dD==1 then self.parent:writeText(aX,aY,h(self:getValue().text,self.width,dl):sub(1,self.width-1)..dB,self.bgColor,self.fgColor)else self.parent:writeText(aX,aY,h(self:getValue().text,self.width,dl):sub(1,self.width-1)..dC,self.bgColor,self.fgColor)end end end;if dD==2 then for E=1,dA do if dh[E+dm]~=nil then if dh[E+dm]==self:getValue()then if dk then self.parent:writeText(aX,aY+E,h(dh[E+dm].text,dz,dl),di,dj)else self.parent:writeText(aX,aY+E,h(dh[E+dm].text,dz,dl),dh[E+dm].bgColor,dh[E+dm].fgColor)end else self.parent:writeText(aX,aY+E,h(dh[E+dm].text,dz,dl),dh[E+dm].bgColor,dh[E+dm].fgColor)end end end end end end end end}return setmetatable(av,aT)end;local function dE(am)local aT=al(am)local an="Radio"aT.width=8;aT.bgColor=a.listBG;aT.fgColor=a.listFG;aT:setZIndex(5)local dh={}local di=a.selectionBG;local dj=a.selectionFG;local dF=aT.bgColor;local dG=aT.fgColor;local dk=true;local _="\7"local dl="left"local av={getType=function(self)return an end,addItem=function(self,i,N,O,Y,Z,...)table.insert(dh,{x=N or 1,y=O or 1,text=i,bgColor=Y or self.bgColor,fgColor=Z or self.fgColor,args={...}})if#dh==1 then self:setValue(dh[1])end;return self end,removeItem=function(self,a6)table.remove(dh,a6)return self end,getItem=function(self,a6)return dh[a6]end,getItemIndex=function(self)local dq=self:getValue()for aN,ab in pairs(dh)do if ab==dq then return aN end end end,clear=function(self)dh={}self:setValue({})return self end,getItemCount=function(self)return#dh end,editItem=function(self,a6,i,N,O,Y,Z,...)table.remove(dh,a6)table.insert(dh,a6,{x=N or 1,y=O or 1,text=i,bgColor=Y or self.bgColor,fgColor=Z or self.fgColor,args={...}})return self end,selectItem=function(self,a6)self:setValue(dh[a6]or{})return self end,setSelectedItem=function(self,Y,Z,dH,dI,dr)di=Y or di;dj=Z or dj;dF=dH or dF;dG=dI or dG;dk=dr;return self end,mouseClickHandler=function(self,a7,aK,N,O)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if a7=="mouse_click"then if aK==1 then if#dh>0 then for aa,ab in pairs(dh)do if aX+ab.x-1<=N and aX+ab.x-1+ab.text:len()+2>=N and aY+ab.y-1==O then self:setValue(ab)if self.parent~=nil then self.parent:setFocusedObject(self)end;self:setVisualChanged()return true end end end end end;return false end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()for aa,ab in pairs(dh)do if ab==self:getValue()then if dl=="left"then self.parent:writeText(ab.x+aX-1,ab.y+aY-1,_,dF,dG)self.parent:writeText(ab.x+2+aX-1,ab.y+aY-1,ab.text,di,dj)end else self.parent:drawBackgroundBox(ab.x+aX-1,ab.y+aY-1,1,1,self.bgColor)self.parent:writeText(ab.x+2+aX-1,ab.y+aY-1,ab.text,ab.bgColor,ab.fgColor)end end end end end}return setmetatable(av,aT)end;local function dJ(am)local an="Timer"local dK=0;local dL=0;local dM=0;local dN;local au=a4()local av={name=am,getType=function(self)return an end,getZIndex=function(self)return 1 end,getName=function(self)return self.name end,setTime=function(self,dO,dP)dK=dO or 0;dL=dP or 1;return self end,start=function(self)dM=dL;dN=os.startTimer(dK)return self end,cancel=function(self)if dN~=nil then os.cancelTimer(dN)end;return self end,onCall=function(self,a9)au:registerEvent("timed_event",a9)return self end,eventHandler=function(self,a7,dQ)if a7=="timer"and dQ==dN then au:sendEvent("timed_event",self)if dM>=1 then dM=dM-1;if dM>=1 then dN=os.startTimer(dK)end elseif dM==-1 then dN=os.startTimer(dK)end end end}av.__index=av;return av end;local function dR(am)local av;local an="Thread"local a9;local dS;local dT=false;av={name=am,getType=function(self)return an end,getZIndex=function(self)return 1 end,getName=function(self)return self.name end,start=function(self,cO)if cO==nil then error("function is nil")end;a9=cO;dS=coroutine.create(a9)dT=true;local aj,ak=coroutine.resume(dS)if not aj then if ak~="Terminated"then error("Threaderror - "..ak)end end;return self end,getStatus=function(self,cO)if dS~=nil then return coroutine.status(dS)end;return nil end,stop=function(self,cO)dT=false;return self end,eventHandler=function(self,a7,aO,aP,aQ)if dT then if coroutine.status(dS)~="dead"then local aj,ak=coroutine.resume(dS,a7,aO,aP,aQ)if not aj then if ak~="Terminated"then error("Threaderror - "..ak)end end else dT=false end end end}av.__index=av;return av end;local function dU(am)local av={}local an="Animation"local dN;local dV={}local a6=1;local dW=0;local dX;local function dY()if dV[a6]~=nil then dV[a6].f(av,a6)end;a6=a6+1;if dV[a6]~=nil then if dV[a6].t>0 then dN=os.startTimer(dV[a6].t)else dY()end end end;av={name=am,getType=function(self)return an end,getZIndex=function(self)return 1 end,getName=function(self)return self.name end,add=function(self,a9,dZ)dX=a9;table.insert(dV,{f=a9,t=dZ or dW})return self end,wait=function(self,dZ)dW=dZ;return self end,rep=function(self,d_)for N=1,d_ do table.insert(dV,{f=dX,t=dW})end;return self end,clear=function(self)dV={}dX=nil;dW=0;a6=1;return self end,play=function(self)a6=1;if dV[a6]~=nil then if dV[a6].t>0 then dN=os.startTimer(dV[a6].t)else dY()end end;return self end,cancel=function(self)os.cancelTimer(dN)return self end,eventHandler=function(self,a7,dQ)if a7=="timer"and dQ==dN then if dV[a6]~=nil then dY()end end end}av.__index=av;return av end;local function e0(am)local aT=al(am)local an="Slider"aT.width=8;aT.bgColor=colors.lightGray;aT.fgColor=colors.gray;aT:setValue(1)local e1="horizontal"local _=" "local e2=colors.black;local e3="\140"local e4=aT.width;local a6=1;local av={getType=function(self)return an end,setSymbol=function(self,e5)_=e5:sub(1,1)self:setVisualChanged()return self end,setBackgroundSymbol=function(self,e6)e3=string.sub(e6,1,1)self:setVisualChanged()return self end,setSymbolColor=function(self,e7)e2=e7;self:setVisualChanged()return self end,setBarType=function(self,e8)e1=e8:lower()return self end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if e1=="horizontal"then for e9=0,self.width-1 do if aX+e9==N and aY<=O and aY+self.height>O then a6=e9+1;self:setValue(e4/self.width*a6)self:setVisualChanged()end end end;if e1=="vertical"then for e9=0,self.height-1 do if aY+e9==O and aX<=N and aX+self.width>N then a6=e9+1;self:setValue(e4/self.height*a6)self:setVisualChanged()end end end end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()if e1=="horizontal"then self.parent:writeText(aX,aY,e3:rep(a6-1),self.bgColor,self.fgColor)self.parent:writeText(aX+a6-1,aY,_,e2,e2)self.parent:writeText(aX+a6,aY,e3:rep(self.width-a6),self.bgColor,self.fgColor)end;if e1=="vertical"then for E=0,self.height-1 do if E+1==a6 then self.parent:writeText(aX,aY+E,_,e2,e2)else self.parent:writeText(aX,aY+E,e3,self.bgColor,self.fgColor)end end end end end end}return setmetatable(av,aT)end;local function ea(am)local aT=al(am)local an="Scrollbar"aT.width=1;aT.height=8;aT.bgColor=colors.lightGray;aT.fgColor=colors.gray;aT:setValue(1)aT:setZIndex(2)local e1="vertical"local _=" "local e2=colors.black;local e3="\127"local e4=aT.height;local a6=1;local eb=1;local av={getType=function(self)return an end,setSymbol=function(self,e5)_=e5:sub(1,1)self:setVisualChanged()return self end,setSymbolSize=function(self,ec)eb=tonumber(ec)or 1;if e1=="vertical"then self:setValue(a6-1*e4/(self.height-(eb-1))-e4/(self.height-(eb-1)))elseif e1=="horizontal"then self:setValue(a6-1*e4/(self.width-(eb-1))-e4/(self.width-(eb-1)))end;self:setVisualChanged()return self end,setMaxValue=function(self,d1)e4=d1;return self end,setBackgroundSymbol=function(self,e6)e3=string.sub(e6,1,1)self:setVisualChanged()return self end,setSymbolColor=function(self,e7)e2=e7;self:setVisualChanged()return self end,setBarType=function(self,e8)e1=e8:lower()return self end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if(a7=="mouse_click"or a7=="mouse_drag")and aK==1 then if e1=="horizontal"then for e9=0,self.width do if aX+e9==N and aY<=O and aY+self.height>O then a6=math.min(e9+1,self.width-(eb-1))self:setValue(e4/self.width*a6)self:setVisualChanged()end end end;if e1=="vertical"then for e9=0,self.height do if aY+e9==O and aX<=N and aX+self.width>N then a6=math.min(e9+1,self.height-(eb-1))self:setValue(e4/self.height*a6)self:setVisualChanged()end end end end;if a7=="mouse_scroll"then a6=a6+aK;if a6<1 then a6=1 end;a6=math.min(a6,(e1=="vertical"and self.height or self.width)-(eb-1))self:setValue(e4/(e1=="vertical"and self.height or self.width)*a6)end;return true end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()if e1=="horizontal"then self.parent:writeText(aX,aY,e3:rep(a6-1),self.bgColor,self.fgColor)self.parent:writeText(aX+a6-1,aY,_:rep(eb),e2,e2)self.parent:writeText(aX+a6+eb-1,aY,e3:rep(self.width-(a6+eb-1)),self.bgColor,self.fgColor)end;if e1=="vertical"then for E=0,self.height-1 do if a6==E+1 then for ed=0,math.min(eb-1,self.height)do self.parent:writeText(aX,aY+E+ed,_,e2,e2)end else if E+1a6-1+eb then self.parent:writeText(aX,aY+E,e3,self.bgColor,self.fgColor)end end end end end end end}return setmetatable(av,aT)end;local function ee(am)local aT=al(am)local an="Switch"aT.width=3;aT.height=1;aT.bgColor=colors.lightGray;aT.fgColor=colors.gray;aT:setValue(false)aT:setZIndex(5)local av={getType=function(self)return an end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if(a7=="mouse_click"or a7=="mouse_drag")and aK==1 then end;return true end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()end end end}return setmetatable(av,aT)end;local function ef(am,eg)local aT=al(am)local an="Frame"local eh={}local ei={}local av={}local ej;aT:setZIndex(10)local b3=false;local b1=1;local b2=1;local ek=colors.white;local el,dm=0,0;if eg~=nil then aT.parent=eg;aT.width,aT.height=eg.w,eg.h;aT.bgColor=a.FrameBG;aT.fgColor=a.FrameFG else local em,en=f.getSize()aT.width,aT.height=em,en;aT.bgColor=a.basaltBG;aT.fgColor=a.basaltFG end;local function eo(am)for aa,ab in pairs(eh)do for aa,bB in pairs(ab)do if bB.name==am then return ab end end end end;local function ep(eq)local ao=eq:getZIndex()if eo(eq.name)~=nil then return nil end;if eh[ao]==nil then for N=1,#ei+1 do if ei[N]~=nil then if ao==ei[N]then break end;if ao>ei[N]then table.insert(ei,N,ao)break end else table.insert(ei,ao)end end;if#ei<=0 then table.insert(ei,ao)end;eh[ao]={}end;eq.parent=av;table.insert(eh[ao],eq)return eq end;local function er(eq)for cn,bB in pairs(eh)do for aN,ab in pairs(bB)do if ab==eq then table.remove(eh[cn],aN)return true end end end;return false end;av={barActive=false,barBackground=colors.gray,barTextcolor=colors.black,barText="New Frame",barTextAlign="left",isMoveable=false,getType=function(self)return an end,setFocusedObject=function(self,eq)for aa,a6 in pairs(ei)do for aa,ab in pairs(eh[a6])do if ab==eq then if ej~=nil then ej:loseFocusHandler()end;ej=eq;ej:getFocusHandler()end end end;return self end,setOffset=function(self,aH,aI)el=aH~=nil and math.floor(aH<0 and math.abs(aH)or-aH)or el;dm=aI~=nil and math.floor(aI<0 and math.abs(aI)or-aI)or dm;return self end,getFrameOffset=function(self)return el,dm end,removeFocusedObject=function(self)if ej~=nil then ej:loseFocusHandler()end;ej=nil;return self end,getFocusedObject=function(self)return ej end,show=function(self)aT:show()if self.parent==nil then c=self end;return self end,setCursor=function(self,es,et,eu,aD)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())b3=es or false;if et~=nil then b1=aX+et-1 end;if eu~=nil then b2=aY+eu-1 end;ek=aD or ek;self:setVisualChanged()return self end,setMoveable=function(self,ev)self.isMoveable=ev or not self.isMoveable;self:setVisualChanged()return self end,showBar=function(self,ew)self.barActive=ew or not self.barActive;self:setVisualChanged()return self end,setBar=function(self,i,Y,Z)self.barText=i or""self.barBackground=Y or self.barBackground;self.barTextcolor=Z or self.barTextcolor;self:setVisualChanged()return self end,setBarTextAlign=function(self,dl)self.barTextAlign=dl or"left"self:setVisualChanged()return self end,getVisualChanged=function(self)local ex=aT.getVisualChanged(self)for aa,a6 in pairs(ei)do if eh[a6]~=nil then for aa,ab in pairs(eh[a6])do if ab.getVisualChanged~=nil and ab:getVisualChanged()then ex=true end end end end;return ex end,loseFocusHandler=function(self)aT.loseFocusHandler(self)end,getFocusHandler=function(self)aT.getFocusHandler(self)if self.parent~=nil then self.parent:removeObject(self)self.parent:addObject(self)end end,keyHandler=function(self,a7,aN)if ej~=nil then if ej.keyHandler~=nil then if ej:keyHandler(a7,aN)then return true end end end;return false end,backgroundKeyHandler=function(self,a7,aN)aT.backgroundKeyHandler(self,a7,aN)for aa,a6 in pairs(ei)do if eh[a6]~=nil then for aa,ab in pairs(eh[a6])do if ab.backgroundKeyHandler~=nil then ab:backgroundKeyHandler(a7,aN)end end end end end,eventHandler=function(self,a7,aO,aP,aQ,aR)aT.eventHandler(self,a7,aO,aP,aQ,aR)for aa,a6 in pairs(ei)do if eh[a6]~=nil then for aa,ab in pairs(eh[a6])do if ab.eventHandler~=nil then ab:eventHandler(a7,aO,aP,aQ,aR)end end end end;if a7=="terminate"then f.clear()f.setCursorPos(1,1)b.stop()end end,mouseClickHandler=function(self,a7,aK,N,O)local aH,aI=self:getOffset()aH=aH<0 and math.abs(aH)or-aH;aI=aI<0 and math.abs(aI)or-aI;if self.drag then if a7=="mouse_drag"then local ey=1;local ez=1;if self.parent~=nil then ey,ez=self.parent:getAbsolutePosition(self.parent:getAnchorPosition())end;self:setPosition(N+self.xToRem-(ey-1)+aH,O-(ez-1)+aI)end;if a7=="mouse_up"then self.drag=false end;return true end;if aT.mouseClickHandler(self,a7,aK,N,O)then local aE,aF=self:getAbsolutePosition(self:getAnchorPosition())for aa,a6 in pairs(ei)do if eh[a6]~=nil then for aa,ab in o(eh[a6])do if ab.mouseClickHandler~=nil then if ab:mouseClickHandler(a7,aK,N+aH,O+aI)then return true end end end end end;if self.isMoveable then if N>=aE and N<=aE+self.width-1 and O==aF and a7=="mouse_click"then self.drag=true;self.xToRem=aE-N end end;if ej~=nil then ej:loseFocusHandler()ej=nil end;return true end;return false end,setText=function(self,N,O,i)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if O>=1 and O<=self.height then if self.parent~=nil then self.parent:setText(math.max(N+aX-1,aX)-(self.parent.x-1),aY+O-1-(self.parent.y-1),g(i,math.max(1-N+1,1),self.width-N+1))else X.setText(math.max(N+aX-1,aX),aY+O-1,g(i,math.max(1-N+1,1),self.width-N+1))end end end,setBG=function(self,N,O,Y)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if O>=1 and O<=self.height then if self.parent~=nil then self.parent:setBG(math.max(N+aX-1,aX)-(self.parent.x-1),aY+O-1-(self.parent.y-1),g(Y,math.max(1-N+1,1),self.width-N+1))else X.setBG(math.max(N+aX-1,aX),aY+O-1,g(Y,math.max(1-N+1,1),self.width-N+1))end end end,setFG=function(self,N,O,Z)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if O>=1 and O<=self.height then if self.parent~=nil then self.parent:setFG(math.max(N+aX-1,aX)-(self.parent.x-1),aY+O-1-(self.parent.y-1),g(Z,math.max(1-N+1,1),self.width-N+1))else X.setFG(math.max(N+aX-1,aX),aY+O-1,g(Z,math.max(1-N+1,1),self.width-N+1))end end end,writeText=function(self,N,O,i,Y,Z)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if O>=1 and O<=self.height then if self.parent~=nil then self.parent:writeText(math.max(N+aX-1,aX)-(self.parent.x-1),aY+O-1-(self.parent.y-1),g(i,math.max(1-N+1,1),self.width-N+1),Y,Z)else X.writeText(math.max(N+aX-1,aX),aY+O-1,g(i,math.max(1-N+1,1),self.width-N+1),Y,Z)end end end,drawBackgroundBox=function(self,N,O,j,u,bO)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())u=O<1 and(u+O>self.height and self.height or u+O-1)or(u+O>self.height and self.height-O+1 or u)j=N<1 and(j+N>self.width and self.width or j+N-1)or(j+N>self.width and self.width-N+1 or j)if self.parent~=nil then self.parent:drawBackgroundBox(math.max(N+aX-1,aX)-(self.parent.x-1),math.max(O+aY-1,aY)-(self.parent.y-1),j,u,bO)else X.drawBackgroundBox(math.max(N+aX-1,aX),math.max(O+aY-1,aY),j,u,bO)end end,drawTextBox=function(self,N,O,j,u,_)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())u=O<1 and(u+O>self.height and self.height or u+O-1)or(u+O>self.height and self.height-O+1 or u)j=N<1 and(j+N>self.width and self.width or j+N-1)or(j+N>self.width and self.width-N+1 or j)if self.parent~=nil then self.parent:drawTextBox(math.max(N+aX-1,aX)-(self.parent.x-1),math.max(O+aY-1,aY)-(self.parent.y-1),j,u,_:sub(1,1))else X.drawTextBox(math.max(N+aX-1,aX),math.max(O+aY-1,aY),j,u,_:sub(1,1))end end,drawForegroundBox=function(self,N,O,j,u,Z)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())u=O<1 and(u+O>self.height and self.height or u+O-1)or(u+O>self.height and self.height-O+1 or u)j=N<1 and(j+N>self.width and self.width or j+N-1)or(j+N>self.width and self.width-N+1 or j)if self.parent~=nil then self.parent:drawForegroundBox(math.max(N+aX-1,aX)-(self.parent.x-1),math.max(O+aY-1,aY)-(self.parent.y-1),j,u,Z)else X.drawForegroundBox(math.max(N+aX-1,aX),math.max(O+aY-1,aY),j,u,Z)end end,draw=function(self)if self:getVisualChanged()then if aT.draw(self)then local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())local de,df=self:getAnchorPosition()if self.parent~=nil then self.parent:drawBackgroundBox(de,df,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(de,df,self.width,self.height,self.fgColor)self.parent:drawTextBox(de,df,self.width,self.height," ")else X.drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)X.drawForegroundBox(aX,aY,self.width,self.height,self.fgColor)X.drawTextBox(aX,aY,self.width,self.height," ")end;f.setCursorBlink(false)if self.barActive then if self.parent~=nil then self.parent:writeText(de,df,h(self.barText,self.width,self.barTextAlign),self.barBackground,self.barTextcolor)else X.writeText(aX,aY,h(self.barText,self.width,self.barTextAlign),self.barBackground,self.barTextcolor)end end;for aa,a6 in o(ei)do if eh[a6]~=nil then for aa,ab in pairs(eh[a6])do if ab.draw~=nil then ab:draw()end end end end;if b3 then f.setTextColor(ek)f.setCursorPos(b1,b2)if self.parent~=nil then f.setCursorBlink(self:isFocused())else f.setCursorBlink(b3)end end;self:setVisualChanged(false)end end end,addObject=function(self,eq)return ep(eq)end,removeObject=function(self,eq)return er(eq)end,getObject=function(self,eq)return eo(eq)end,addButton=function(self,am)local eq=aS(am)eq.name=am;return ep(eq)end,addLabel=function(self,am)local eq=bZ(am)eq.name=am;eq.bgColor=self.bgColor;eq.fgColor=self.fgColor;return ep(eq)end,addCheckbox=function(self,am)local eq=cE(am)eq.name=am;return ep(eq)end,addInput=function(self,am)local eq=cP(am)eq.name=am;return ep(eq)end,addProgram=function(self,am)local eq=a_(am)eq.name=am;return ep(eq)end,addTextfield=function(self,am)local eq=d7(am)eq.name=am;return ep(eq)end,addList=function(self,am)local eq=dg(am)eq.name=am;return ep(eq)end,addDropdown=function(self,am)local eq=dy(am)eq.name=am;return ep(eq)end,addRadio=function(self,am)local eq=dE(am)eq.name=am;return ep(eq)end,addTimer=function(self,am)local eq=dJ(am)eq.name=am;return ep(eq)end,addAnimation=function(self,am)local eq=dU(am)eq.name=am;return ep(eq)end,addSlider=function(self,am)local eq=e0(am)eq.name=am;return ep(eq)end,addScrollbar=function(self,am)local eq=ea(am)eq.name=am;return ep(eq)end,addMenubar=function(self,am)local eq=dt(am)eq.name=am;return ep(eq)end,addThread=function(self,am)local eq=dR(am)eq.name=am;return ep(eq)end,addPane=function(self,am)local eq=c0(am)eq.name=am;return ep(eq)end,addImage=function(self,am)local eq=c1(am)eq.name=am;return ep(eq)end,addProgressbar=function(self,am)local eq=cF(am)eq.name=am;return ep(eq)end,addFrame=function(self,am)local eq=ef(am,self)eq.name=am;return ep(eq)end}setmetatable(av,aT)if eg==nil then table.insert(d,av)end;return av end;local eA=false;local function eB(a7,aO,aP,aQ,aR)if a7=="mouse_click"then c:mouseClickHandler(a7,aO,aP,aQ,aR)end;if a7=="mouse_drag"then c:mouseClickHandler(a7,aO,aP,aQ,aR)end;if a7=="mouse_up"then c:mouseClickHandler(a7,aO,aP,aQ,aR)end;if a7=="mouse_scroll"then c:mouseClickHandler(a7,aO,aP,aQ,aR)end;if a7=="key"or a7=="char"then c:keyHandler(a7,aO)c:backgroundKeyHandler(a7,aO)end;for aa,ab in pairs(d)do ab:eventHandler(a7,aO,aP,aQ,aR)end;if eA then c:draw()X.update()end end;function b.autoUpdate(dT)f.clear()eA=dT or true;c:draw()X.update()while eA do local a7,aO,aP,aQ,aR=os.pullEventRaw()eB(a7,aO,aP,aQ,aR)end end;function b.update(a7,aO,aP,aQ,aR)if a7~="nil"then eB(a7,aO,aP,aQ,aR)else c:draw()X.update()end end;function b.stop()eA=false end;function b.getFrame(am)for aa,ab in pairs(d)do if ab.name==am then return ab end end end;function b.getActiveFrame()return c end;function b.setActiveFrame(aw)if aw:getType()=="Frame"then c=aw;return true end;return false end;function b.createFrame(am)local aw=ef(am)return aw end;function b.removeFrame(am)for aN,ab in pairs(d)do if ab.name==am then d[aN]=nil;return true end end;return false end;if b.debugger then b.debugFrame=b.createFrame("basaltDebuggingFrame"):showBar():setBackground(colors.lightGray):setBar("Debug",colors.black,colors.gray)b.debugList=b.debugFrame:addList("debugList"):setSize(b.debugFrame.width-2,b.debugFrame.height-3):setPosition(2,3):setScrollable(true):show()b.debugFrame:addButton("back"):setAnchor("right"):setSize(1,1):setText("\22"):onClick(function()b.oldFrame:show()end):setBackground(colors.red):show()b.debugLabel=b.debugFrame:addLabel("debugLabel"):onClick(function()b.oldFrame=c;b.debugFrame:show()end):setBackground(colors.black):setForeground(colors.white):setAnchor("bottom"):setZIndex(20):show()end;if b.debugger then function b.debug(...)local ah={...}if c.name~="basaltDebuggingFrame"then if c~=b.debugLabel.frame then b.debugLabel:setParent(c)end end;local eC=""for aN,ab in pairs(ah)do eC=eC..tostring(ab)..(#ah~=aN and", "or"")end;b.debugLabel:setText("[Debug] "..eC)b.debugList:addItem(eC)if b.debugList:getItemCount()>50 then b.debugList:removeItem(1)end;b.debugList:setValue(b.debugList:getItem(b.debugList:getItemCount()))b.debugLabel:show()end end;return b \ No newline at end of file +local a={basaltBG=colors.lightGray,basaltFG=colors.black,FrameBG=colors.gray,FrameFG=colors.black,ButtonBG=colors.gray,ButtonFG=colors.black,CheckboxBG=colors.gray,CheckboxFG=colors.black,InputBG=colors.gray,InputFG=colors.black,textfieldBG=colors.gray,textfieldFG=colors.black,listBG=colors.gray,listFG=colors.black,dropdownBG=colors.gray,dropdownFG=colors.black,radioBG=colors.gray,radioFG=colors.black,selectionBG=colors.black,selectionFG=colors.lightGray}local b={debugger=true,version=1}local c;local d={}local e={}local f=term.current()local g=string.sub;local function h(i,j,k)i=string.sub(i,1,j)local l=j-string.len(i)if k=="right"then i=string.rep(" ",l)..i elseif k=="center"then i=string.rep(" ",math.floor(l/2))..i..string.rep(" ",math.floor(l/2))i=i..(string.len(i)=1 and O<=u then if N+i:len()>0 and N<=j then local P=v[O]local Q;local R=N+#i-1;if N<1 then local S=1-N+1;local T=j-N+1;i=g(i,S,T)elseif R>j then local T=j-N+1;i=g(i,1,T)end;if N>1 then local T=N-1;Q=g(P,1,T)..i else Q=i end;if R=1 and O<=u then if N+V:len()>0 and N<=j then local P=w[O]local Q;local R=N+#V-1;if N<1 then V=g(V,1-N+1,j-N+1)elseif R>j then V=g(V,1,j-N+1)end;if N>1 then Q=g(P,1,N-1)..V else Q=V end;if R=1 and O<=u then if N+V:len()>0 and N<=j then local P=x[O]local Q;local R=N+#V-1;if N<1 then local S=1-N+1;local T=j-N+1;V=g(V,S,T)elseif R>j then local T=j-N+1;V=g(V,1,T)end;if N>1 then local T=N-1;Q=g(P,1,T)..V else Q=V end;if RN and aM<=O and aM+self.height>O and as then if self.parent~=nil then self.parent:setFocusedObject(self)end;au:sendEvent(a7,self,a7,aK,N,O)return true end;return false end,keyHandler=function(self,a7,aN)if self:isFocused()then au:sendEvent(a7,self,a7,aN)return true end;return false end,backgroundKeyHandler=function(self,a7,aN)au:sendEvent("background_"..a7,self,a7,aN)end,valueChangedHandler=function(self)au:sendEvent("value_changed",self)end,eventHandler=function(self,a7,aO,aP,aQ,aR)au:sendEvent("custom_event_handler",self,a7,aO,aP,aQ,aR)end,getFocusHandler=function(self)au:sendEvent("get_focus",self)end,loseFocusHandler=function(self)au:sendEvent("lose_focus",self)end}av.__index=av;return av end;local function aS(am)local aT=al(am)local an="Button"aT:setValue("Button")aT:setZIndex(5)aT.width=8;aT.bgColor=a.ButtonBG;aT.fgColor=a.ButtonFG;local aU="center"local aV="center"local av={getType=function(self)return an end,setHorizontalAlign=function(self,aW)aU=aW end,setVerticalAlign=function(self,aW)aV=aW end,setText=function(self,i)aT:setValue(i)return self end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()local aZ=m(self.height,aV)self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(aX,aY,self.width,self.height,self.fgColor)self.parent:drawTextBox(aX,aY,self.width,self.height," ")for E=1,self.height do if E==aZ then self.parent:setText(aX,aY+E-1,h(self:getValue(),self.width,aU))end end end end end}return setmetatable(av,aT)end;local function a_(am)local aT=al(am)local an="Program"aT:setZIndex(5)local av;local function b0(N,O,j,u)local b1,b2=1,1;local b3,b4=colors.black,colors.white;local b5=false;local b6=false;local v={}local w={}local x={}local b7={}local B;local C={}for q=0,15 do local b8=2^q;b7[b8]={f.getPaletteColour(b8)}end;local function D()B=(" "):rep(j)for E=0,15 do local F=2^E;local G=r[F]C[F]=G:rep(j)end end;local function H()D()local I=B;local J=C[colors.white]local K=C[colors.black]for E=1,u do v[E]=g(v[E]==nil and I or v[E]..I:sub(1,j-v[E]:len()),1,j)x[E]=g(x[E]==nil and J or x[E]..J:sub(1,j-x[E]:len()),1,j)w[E]=g(w[E]==nil and K or w[E]..K:sub(1,j-w[E]:len()),1,j)end end;H()local function b9()if b1>=1 and b2>=1 and b1<=j and b2<=u then else end end;local function ba(bb,bc,bd)local be=b1;local R=be+#bb-1;if b2>=1 and b2<=u then if be<=j and R>=1 then if be==1 and R==j then v[b2]=bb;x[b2]=bc;w[b2]=bd else local bf,bg,bh;if be<1 then local bi=1-be+1;local bj=j-be+1;bf=g(bb,bi,bj)bg=g(bc,bi,bj)bh=g(bd,bi,bj)elseif R>j then local bj=j-be+1;bf=g(bb,1,bj)bg=g(bc,1,bj)bh=g(bd,1,bj)else bf=bb;bg=bc;bh=bd end;local bk=v[b2]local bl=x[b2]local bm=w[b2]local bn,bo,bp;if be>1 then local bq=be-1;bn=g(bk,1,bq)..bf;bo=g(bl,1,bq)..bg;bp=g(bm,1,bq)..bh else bn=bf;bo=bg;bp=bh end;if R=1 and O<=u then v[bO]=v[O]w[bO]=w[O]x[bO]=x[O]else v[bO]=bL;x[bO]=bM;w[bO]=bN end end end;if b6 then b9()end end,isColor=function()return f.isColor()end,isColour=function()return f.isColor()end,write=function(i)i=tostring(i)if b6 then ba(i,r[b4]:rep(i:len()),r[b3]:rep(i:len()))end end,clearLine=function()if b6 then M(1,b2,(" "):rep(j))U(1,b2,r[b3]:rep(j))W(1,b2,r[b4]:rep(j))end;if b6 then b9()end end,clear=function()for E=1,u do M(1,E,(" "):rep(j))U(1,E,r[b3]:rep(j))W(1,E,r[b4]:rep(j))end;if b6 then b9()end end,blit=function(i,bP,bQ)if type(i)~="string"then error("bad argument #1 (expected string, got "..type(i)..")",2)end;if type(bP)~="string"then error("bad argument #2 (expected string, got "..type(bP)..")",2)end;if type(bQ)~="string"then error("bad argument #3 (expected string, got "..type(bQ)..")",2)end;if#bP~=#i or#bQ~=#i then error("Arguments must be the same length",2)end;if b6 then ba(i,bP,bQ)end end}return bG end;aT.width=30;aT.height=12;local bR=b0(1,1,aT.width,aT.height)local bS;local bT=false;local bU={}av={getType=function(self)return an end,show=function(self)aT.show(self)bR.setBackgroundColor(self.bgColor)bR.setTextColor(self.fgColor)bR.basalt_setVisible(true)return self end,hide=function(self)aT.hide(self)bR.basalt_setVisible(false)return self end,setPosition=function(self,N,O,aB)aT.setPosition(self,N,O,aB)bR.basalt_reposition(self:getAnchorPosition())return self end,getBasaltWindow=function()return bR end,getBasaltProcess=function()return bS end,setSize=function(self,j,u)aT.setSize(self,j,u)bR.basalt_resize(self.width,self.height)return self end,getStatus=function(self)if bS~=nil then return bS:getStatus()end;return"inactive"end,execute=function(self,af,...)bS=ad:new(af,bR,...)bR.setBackgroundColor(colors.black)bR.setTextColor(colors.white)bR.clear()bR.setCursorPos(1,1)bS:resume()bT=false;return self end,stop=function(self)if bS~=nil then if not bS:isDead()then bS:resume("terminate")if bS:isDead()then if self.parent~=nil then self.parent:setCursor(false)end end end end;return self end,pause=function(self,bV)bT=bV or not bT;if bS~=nil then if not bS:isDead()then if not bT then self:injectEvents(bU)bU={}end end end;return self end,isPaused=function(self)return bT end,injectEvent=function(self,a7,aO,aP,aQ,aR,bW)if bS~=nil then if not bS:isDead()then if bT==false or bW then bS:resume(a7,aO,aP,aQ,aR)else table.insert(bU,{event=a7,args={aO,aP,aQ,aR}})end end end;return self end,getQueuedEvents=function(self)return bU end,updateQueuedEvents=function(self,a5)bU=a5 or bU;return self end,injectEvents=function(self,a5)if bS~=nil then if not bS:isDead()then for aa,ab in pairs(a5)do bS:resume(ab.event,table.unpack(ab.args))end end end;return self end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then if bS==nil then return false end;if not bS:isDead()then if not bT then local bX,bY=self:getAbsolutePosition(self:getAnchorPosition(nil,nil,true))bS:resume(a7,aK,N-bX+1,O-bY+1)end end;return true end end,keyHandler=function(self,a7,aN)aT.keyHandler(self,a7,aN)if self:isFocused()then if bS==nil then return false end;if not bS:isDead()then if not bT then if self.draw then bS:resume(a7,aN)end end end end end,getFocusHandler=function(self)aT.getFocusHandler(self)if bS~=nil then if not bS:isDead()then if not bT then if self.parent~=nil then local bZ,b_=bR.getCursorPos()local aX,aY=self:getAnchorPosition()if self.parent~=nil then if aX+bZ-1>=1 and aX+bZ-1<=aX+self.width-1 and b_+aY-1>=1 and b_+aY-1<=aY+self.height-1 then self.parent:setCursor(bR.getCursorBlink(),aX+bZ-1,b_+aY-1,bR.getTextColor())end end end end end end end,loseFocusHandler=function(self)aT.loseFocusHandler(self)if bS~=nil then if not bS:isDead()then if self.parent~=nil then self.parent:setCursor(false)end end end end,eventHandler=function(self,a7,aO,aP,aQ,aR)if bS==nil then return end;if not bS:isDead()then if not bT then if a7~="mouse_click"and a7~="mouse_up"and a7~="mouse_scroll"and a7~="mouse_drag"and a7~="key_up"and a7~="key"and a7~="char"and a7~="terminate"then bS:resume(a7,aO,aP,aQ,aR)end;if self:isFocused()then local aX,aY=self:getAnchorPosition()local bZ,b_=bR.getCursorPos()if self.parent~=nil then if aX+bZ-1>=1 and aX+bZ-1<=aX+self.width-1 and b_+aY-1>=1 and b_+aY-1<=aY+self.height-1 then self.parent:setCursor(bR.getCursorBlink(),aX+bZ-1,b_+aY-1,bR.getTextColor())end end;if a7=="terminate"and self:isFocused()then self:stop()end end else if a7~="mouse_click"and a7~="mouse_up"and a7~="mouse_scroll"and a7~="mouse_drag"and a7~="key_up"and a7~="key"and a7~="char"and a7~="terminate"then table.insert(bU,{event=a7,args={aO,aP,aQ,aR}})end end end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()bR.basalt_reposition(aX,aY)self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)bR.basalt_update()end end end}return setmetatable(av,aT)end;local function c0(am)local aT=al(am)local an="Label"aT:setZIndex(3)local c1=true;aT:setValue("")local av={getType=function(self)return an end,setText=function(self,i)i=tostring(i)aT:setValue(i)if c1 then self.width=i:len()end;return self end,setSize=function(self,j,n)self.width,self.height=j,n;c1=false;return self end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:writeText(aX,aY,self:getValue(),self.bgColor,self.fgColor)end end end}return setmetatable(av,aT)end;local function c2(am)local aT=al(am)local an="Pane"local av={getType=function(self)return an end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(aX,aY,self.width,self.height,self.bgColor)end end end}return setmetatable(av,aT)end;local function c3(am)local aT=al(am)local an="Image"aT:setZIndex(2)local c4;local c5;local c6=false;local function c7()local c8={[0]={8,4,3,6,5},{4,14,8,7},{6,10,8,7},{9,11,8,0},{1,14,8,0},{13,12,8,0},{2,10,8,0},{15,8,10,11,12,14},{0,7,1,9,2,13},{3,11,8,7},{2,6,7,15},{9,3,7,15},{13,5,7,15},{5,12,8,7},{1,4,7,15},{7,10,11,12,14}}local c9,ca,cb={},{},{}for q=0,15 do ca[2^q]=q end;do local cc="0123456789abcdef"for q=1,16 do c9[cc:sub(q,q)]=q-1;c9[q-1]=cc:sub(q,q)cb[cc:sub(q,q)]=2^(q-1)cb[2^(q-1)]=cc:sub(q,q)local cd=c8[q-1]for q=1,#cd do cd[q]=2^cd[q]end end end;local function ce(cf)local cg=c8[ca[cf[#cf][1]]]for ch=1,#cg do local ci=cg[ch]for q=1,#cf-1 do if cf[q][1]==ci then return q end end end;return 1 end;local function cj(ck,cl)if not cl then local cm={}cl={}for q=1,6 do local cn=ck[q]local co=cl[cn]cl[cn],cm[q]=co and co+1 or 1,cn end;ck=cm end;local cf={}for aN,ab in pairs(cl)do cf[#cf+1]={aN,ab}end;if#cf>1 then while#cf>2 do table.sort(cf,function(cp,bD)return cp[2]>bD[2]end)local cq,cr=ce(cf),#cf;local cs,ct=cf[cr][1],cf[cq][1]for q=1,6 do if ck[q]==cs then ck[q]=ct;cf[cq][2]=cf[cq][2]+1 end end;cf[cr]=nil end;local cu=128;for q=1,#ck-1 do if ck[q]~=ck[6]then cu=cu+2^(q-1)end end;return string.char(cu),cb[cf[1][1]==ck[6]and cf[2][1]or cf[1][1]],cb[ck[6]]else return"\128",cb[ck[1]],cb[ck[1]]end end;local cv,j,u,Y={{},{},{}},0,#c4+#c4%3,aT.bgColor or colors.black;for q=1,#c4 do if#c4[q]>j then j=#c4[q]end end;for O=0,u-1,3 do local cw,cx,cy,cz={},{},{},1;for N=0,j-1,2 do local ck,cl={},{}for cA=1,3 do for cB=1,2 do ck[#ck+1]=c4[O+cA]and c4[O+cA][N+cB]and(c4[O+cA][N+cB]==0 and Y or c4[O+cA][N+cB])or Y;cl[ck[#ck]]=cl[ck[#ck]]and cl[ck[#ck]]+1 or 1 end end;cw[cz],cx[cz],cy[cz]=cj(ck,cl)cz=cz+1 end;cv[1][#cv[1]+1],cv[2][#cv[2]+1],cv[3][#cv[3]+1]=table.concat(cw),table.concat(cx),table.concat(cy)end;cv.width,cv.height=#cv[1][1],#cv[1]c5=cv end;local av={getType=function(self)return an end,loadImage=function(self,af)c4=paintutils.loadImage(af)c6=false;return self end,loadBlittleImage=function(self,af)c6=true;return self end,shrinkImage=function(self)c7()c6=true;return self end,draw=function(self)if aT.draw(self)then if self.parent~=nil then if c4~=nil then local aX,aY=self:getAnchorPosition()if c6 then local p,cC,cD=c5[1],c5[2],c5[3]for q=1,c5.height do local cE=p[q]if type(cE)=="string"then self.parent:setText(aX,aY+q-1,cE)self.parent:setFG(aX,aY+q-1,cC[q])self.parent:setBG(aX,aY+q-1,cD[q])elseif type(cE)=="table"then self.parent:setText(aX,aY+q-1,cE[2])self.parent:setFG(aX,aY+q-1,cC[q])self.parent:setBG(aX,aY+q-1,cD[q])end end else for aA=1,math.min(#c4,self.height)do local cF=c4[aA]for az=1,math.min(#cF,self.width)do if cF[az]>0 then self.parent:drawBackgroundBox(aX+az-1,aY+aA-1,1,1,cF[az])end end end end end end end end}return setmetatable(av,aT)end;local function cG(am)local aT=al(am)local an="Checkbox"aT:setZIndex(5)aT:setValue(false)aT.width=1;aT.height=1;aT.bgColor=a.CheckboxBG;aT.fgColor=a.CheckboxFG;local av={symbol="\42",getType=function(self)return an end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then if a7=="mouse_click"and aK==1 then if self:getValue()~=true and self:getValue()~=false then self:setValue(false)else self:setValue(not self:getValue())end end;return true end;return false end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()local aZ=m(self.height,"center")self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)for E=1,self.height do if E==aZ then if self:getValue()==true then self.parent:writeText(aX,aY+E-1,h(self.symbol,self.width,"center"),self.bgColor,self.fgColor)else self.parent:writeText(aX,aY+E-1,h(" ",self.width,"center"),self.bgColor,self.fgColor)end end end end end end}return setmetatable(av,aT)end;local function cH(am)local aT=al(am)local an="Progressbar"local cI=0;aT:setZIndex(5)aT:setValue(false)aT.width=25;aT.height=1;aT.bgColor=a.CheckboxBG;aT.fgColor=a.CheckboxFG;local cJ=colors.black;local cK=""local cL=colors.white;local cM=""local cN=0;local av={getType=function(self)return an end,setDirection=function(self,cO)cN=cO;return self end,setProgressBar=function(self,aD,_,cP)cJ=aD or cJ;cK=_ or cK;cL=cP or cL;return self end,setBackgroundSymbol=function(self,_)cM=_:sub(1,1)return self end,setProgress=function(self,ab)if ab>=0 and ab<=100 and cI~=ab then cI=ab;self:setValue(cI)if cI==100 then self:progressDoneHandler()end end;return self end,getProgress=function(self)return cI end,onProgressDone=function(self,cQ)self:registerEvent("progress_done",cQ)return self end,progressDoneHandler=function(self)self:sendEvent("progress_done")end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(aX,aY,self.width,self.height,self.fgColor)self.parent:drawTextBox(aX,aY,self.width,self.height,cM)if cN==1 then self.parent:drawBackgroundBox(aX,aY,self.width,self.height/100*cI,cJ)self.parent:drawForegroundBox(aX,aY,self.width,self.height/100*cI,cL)self.parent:drawTextBox(aX,aY,self.width,self.height/100*cI,cK)elseif cN==2 then self.parent:drawBackgroundBox(aX,aY+math.ceil(self.height-self.height/100*cI),self.width,self.height/100*cI,cJ)self.parent:drawForegroundBox(aX,aY+math.ceil(self.height-self.height/100*cI),self.width,self.height/100*cI,cL)self.parent:drawTextBox(aX,aY+math.ceil(self.height-self.height/100*cI),self.width,self.height/100*cI,cK)elseif cN==3 then self.parent:drawBackgroundBox(aX+math.ceil(self.width-self.width/100*cI),aY,self.width/100*cI,self.height,cJ)self.parent:drawForegroundBox(aX+math.ceil(self.width-self.width/100*cI),aY,self.width/100*cI,self.height,cL)self.parent:drawTextBox(aX+math.ceil(self.width-self.width/100*cI),aY,self.width/100*cI,self.height,cK)else self.parent:drawBackgroundBox(aX,aY,self.width/100*cI,self.height,cJ)self.parent:drawForegroundBox(aX,aY,self.width/100*cI,self.height,cL)self.parent:drawTextBox(aX,aY,self.width/100*cI,self.height,cK)end end end end}return setmetatable(av,aT)end;local function cR(am)local aT=al(am)local an="Input"local cS="text"local cT=0;aT:setZIndex(5)aT:setValue("")aT.width=10;aT.height=1;aT.bgColor=a.InputBG;aT.fgColor=a.InputFG;local cU=1;local cV=1;local cW=""local cX;local cY;local cZ=cW;local c_=false;local av={getType=function(self)return an end,setInputType=function(self,d0)if d0=="password"or d0=="number"or d0=="text"then cS=d0 end;return self end,setDefaultText=function(self,i,d1,d2)cW=i;cX=d2 or cX;cY=d1 or cY;if self:isFocused()then cZ=""else cZ=cW end;return self end,getInputType=function(self)return cS end,setValue=function(self,d3)aT.setValue(self,tostring(d3))if not c_ then cU=tostring(d3):len()+1 end;return self end,getValue=function(self)local d3=aT.getValue(self)return cS=="number"and tonumber(d3)or d3 end,setInputLimit=function(self,d4)cT=tonumber(d4)or cT;return self end,getInputLimit=function(self)return cT end,getFocusHandler=function(self)aT.getFocusHandler(self)if self.parent~=nil then local aX,aY=self:getAnchorPosition()cZ=""if self.parent~=nil then self.parent:setCursor(true,aX+cU-cV,aY,self.fgColor)end end end,loseFocusHandler=function(self)aT.loseFocusHandler(self)if self.parent~=nil then self.parent:setCursor(false)cZ=cW end end,keyHandler=function(self,a7,aN)if aT.keyHandler(self,a7,aN)then c_=true;if a7=="key"then if aN==keys.backspace then local i=tostring(aT.getValue())if cU>1 then self:setValue(i:sub(1,cU-2)..i:sub(cU,i:len()))if cU>1 then cU=cU-1 end;if cV>1 then if cUd5 then cU=d5+1 end;if cU<1 then cU=1 end;if cU=self.width+cV then cV=cU-self.width+1 end;if cV<1 then cV=1 end end;if aN==keys.left then cU=cU-1;if cU>=1 then if cU=self.width+cV then cV=cU end end;if cU<1 then cU=1 end;if cV<1 then cV=1 end end end;if a7=="char"then local i=aT.getValue()if i:len()=self.width+cV then cV=cV+1 end end end;local aX,aY=self:getAnchorPosition()local d3=tostring(aT.getValue())local d7=(cU<=d3:len()and cU-1 or d3:len())-(cV-1)if d7>self.x+self.width-1 then d7=self.x+self.width-1 end;if self.parent~=nil then self.parent:setCursor(true,aX+d7,aY,self.fgColor)end;c_=false end end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then if a7=="mouse_click"and aK==1 then end;return true end;return false end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()local aZ=m(self.height,"center")self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)for E=1,self.height do if E==aZ then local d3=tostring(aT.getValue())local d2=self.bgColor;local d1=self.fgColor;local i;if d3:len()<=0 then i=cZ;d2=cX or d2;d1=cY or d1 end;i=cZ;if d3~=""then i=d3 end;i=i:sub(cV,self.width+cV-1)local d8=self.width-i:len()if d8<0 then d8=0 end;if cS=="password"and d3~=""then i=string.rep("*",i:len())end;i=i..string.rep(" ",d8)self.parent:writeText(aX,aY+E-1,i,d2,d1)end end end end end}return setmetatable(av,aT)end;local function d9(am)local aT=al(am)local an="Textfield"local da,cV,cU,db=1,1,1,1;local dc={""}local dd={[colors.purple]={"break"}}aT.width=20;aT.height=8;aT.bgColor=a.textfieldBG;aT.fgColor=a.textfieldFG;aT:setZIndex(5)local av={getType=function(self)return an end,getLines=function(self)return dc end,getLine=function(self,a6)return dc[a6]or""end,editLine=function(self,a6,i)dc[a6]=i or dc[a6]return self end,addLine=function(self,i,a6)if a6~=nil then table.insert(dc,a6,i)else table.insert(dc,i)end;return self end,addKeyword=function(self,de,aD)end,removeLine=function(self,a6)table.remove(dc,a6 or#dc)if#dc<=0 then table.insert(dc,"")end;return self end,getTextCursor=function(self)return cU,db end,getFocusHandler=function(self)aT.getFocusHandler(self)if self.parent~=nil then local aX,aY=self:getAnchorPosition()if self.parent~=nil then self.parent:setCursor(true,aX+cU-cV,aY+db-da,self.fgColor)end end end,loseFocusHandler=function(self)aT.loseFocusHandler(self)if self.parent~=nil then self.parent:setCursor(false)end end,keyHandler=function(self,a7,aN)if aT.keyHandler(self,a7,aN)then local aX,aY=self:getAnchorPosition()if a7=="key"then if aN==keys.backspace then if dc[db]==""then if db>1 then table.remove(dc,db)cU=dc[db-1]:len()+1;cV=cU-self.width+1;if cV<1 then cV=1 end;db=db-1 end elseif cU<=1 then if db>1 then cU=dc[db-1]:len()+1;cV=cU-self.width+1;if cV<1 then cV=1 end;dc[db-1]=dc[db-1]..dc[db]table.remove(dc,db)db=db-1 end else dc[db]=dc[db]:sub(1,cU-2)..dc[db]:sub(cU,dc[db]:len())if cU>1 then cU=cU-1 end;if cV>1 then if cUdc[db]:len()then if dc[db+1]~=nil then dc[db]=dc[db]..dc[db+1]table.remove(dc,db+1)end else dc[db]=dc[db]:sub(1,cU-1)..dc[db]:sub(cU+1,dc[db]:len())end end;if aN==keys.enter then table.insert(dc,db+1,dc[db]:sub(cU,dc[db]:len()))dc[db]=dc[db]:sub(1,cU-1)db=db+1;cU=1;cV=1;if db-da>=self.height then da=da+1 end;self:setValue("")end;if aN==keys.up then if db>1 then db=db-1;if cU>dc[db]:len()+1 then cU=dc[db]:len()+1 end;if cV>1 then if cU1 then if dbdc[db]:len()+1 then cU=dc[db]:len()+1 end;if db>=da+self.height then da=da+1 end end end;if aN==keys.right then cU=cU+1;if db<#dc then if cU>dc[db]:len()+1 then cU=1;db=db+1 end elseif cU>dc[db]:len()then cU=dc[db]:len()+1 end;if cU<1 then cU=1 end;if cU=self.width+cV then cV=cU-self.width+1 end;if cV<1 then cV=1 end end;if aN==keys.left then cU=cU-1;if cU>=1 then if cU=self.width+cV then cV=cU end end;if db>1 then if cU<1 then db=db-1;cU=dc[db]:len()+1;cV=cU-self.width+1 end end;if cU<1 then cU=1 end;if cV<1 then cV=1 end end end;if a7=="char"then dc[db]=dc[db]:sub(1,cU-1)..aN..dc[db]:sub(cU,dc[db]:len())cU=cU+1;if cU>=self.width+cV then cV=cV+1 end;self:setValue("")end;local d7=(cU<=dc[db]:len()and cU-1 or dc[db]:len())-(cV-1)if d7>self.x+self.width-1 then d7=self.x+self.width-1 end;local df=db-dadc[db]:len()then cU=dc[db]:len()+1 end;if cUdc[db]:len()then cU=dc[db]:len()+1 end;if cU#dc-(self.height-1)then da=#dc-(self.height-1)end;if da<1 then da=1 end;if self.parent~=nil then if aX+cU-cV>=aX and aX+cU-cV<=aX+self.width and(aY+db-da>=aY and aY+db-da<=aY+self.height)then self.parent:setCursor(true,dg+cU-cV,dh+db-da)else self.parent:setCursor(false)end end end;self:setVisualChanged()return true end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(aX,aY,self.width,self.height,self.fgColor)for E=1,self.height do local i=""if dc[E+da-1]~=nil then i=dc[E+da-1]end;i=i:sub(cV,self.width+cV-1)local d8=self.width-i:len()if d8<0 then d8=0 end;i=i..string.rep(" ",d8)self.parent:setText(aX,aY+E-1,i)end end end end}return setmetatable(av,aT)end;local function di(am)local aT=al(am)local an="List"aT.width=16;aT.height=6;aT.bgColor=a.listBG;aT.fgColor=a.listFG;aT:setZIndex(5)local dj={}local dk=a.selectionBG;local dl=a.selectionFG;local dm=true;local dn="left"local dp=0;local dq=true;local av={getType=function(self)return an end,addItem=function(self,i,Y,Z,...)table.insert(dj,{text=i,bgCol=Y or self.bgColor,fgCol=Z or self.fgColor,args={...}})if#dj==1 then self:setValue(dj[1])end;return self end,setIndexOffset=function(self,dr)dp=dr;return self end,getIndexOffset=function(self)return dp end,removeItem=function(self,a6)table.remove(dj,a6)return self end,getItem=function(self,a6)return dj[a6]end,getItemIndex=function(self)local ds=self:getValue()for aN,ab in pairs(dj)do if ab==ds then return aN end end end,clear=function(self)dj={}self:setValue({})return self end,getItemCount=function(self)return#dj end,editItem=function(self,a6,i,Y,Z,...)table.remove(dj,a6)table.insert(dj,a6,{text=i,bgCol=Y or self.bgColor,fgCol=Z or self.fgColor,args={...}})return self end,selectItem=function(self,a6)self:setValue(dj[a6]or{})return self end,setSelectedItem=function(self,Y,Z,dt)dk=Y or self.bgColor;dl=Z or self.fgColor;dm=dt;return self end,setScrollable=function(self,du)dq=du;return self end,mouseClickHandler=function(self,a7,aK,N,O)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if aX<=N and aX+self.width>N and aY<=O and aY+self.height>O and self:isVisible()then if a7=="mouse_click"or a7=="mouse_drag"then if aK==1 then if#dj>0 then for E=1,self.height do if dj[E+dp]~=nil then if aX<=N and aX+self.width>N and aY+E-1==O then self:setValue(dj[E+dp])self:getEventSystem():sendEvent("mouse_click",self,"mouse_click",0,N,O,dj[E+dp])end end end end end end;if a7=="mouse_scroll"and dq then dp=dp+aK;if dp<0 then dp=0 end;if aK>=1 then if#dj>self.height then if dp>#dj-self.height then dp=#dj-self.height end;if dp>=#dj then dp=#dj-1 end else dp=dp-1 end end end;self:setVisualChanged()return true end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)for E=1,self.height do if dj[E+dp]~=nil then if dj[E+dp]==self:getValue()then if dm then self.parent:writeText(aX,aY+E-1,h(dj[E+dp].text,self.width,dn),dk,dl)else self.parent:writeText(aX,aY+E-1,h(dj[E+dp].text,self.width,dn),dj[E+dp].bgCol,dj[E+dp].fgCol)end else self.parent:writeText(aX,aY+E-1,h(dj[E+dp].text,self.width,dn),dj[E+dp].bgCol,dj[E+dp].fgCol)end end end end end end}return setmetatable(av,aT)end;local function dv(am)local aT=al(am)local an="Menubar"local av={}aT.width=30;aT.height=1;aT.bgColor=colors.gray;aT.fgColor=colors.lightGray;aT:setZIndex(5)local dj={}local dk=a.selectionBG;local dl=a.selectionFG;local dm=true;local dn="left"local dw=0;local d8=2;local dq=false;local function dx()local dy=0;local az=1;for E=1,#dj do if az+dj[E].text:len()+d8*2>av.w then dy=dy+dj[E].text:len()+d8*2 end;az=az+dj[E].text:len()+d8*2 end;return dy end;av={getType=function(self)return an end,addItem=function(self,i,Y,Z,...)table.insert(dj,{text=i,bgCol=Y or self.bgColor,fgCol=Z or self.fgColor,args={...}})if#dj==1 then self:setValue(dj[1])end;return self end,getItemIndex=function(self)local ds=self:getValue()for aN,ab in pairs(dj)do if ab==ds then return aN end end end,clear=function(self)dj={}self:setValue({})return self end,setSpace=function(self,dz)d8=dz or d8;return self end,setButtonOffset=function(self,l)dw=l or 0;if dw<0 then dw=0 end;local dy=dx()if dw>dy then dw=dy end;return self end,setScrollable=function(self,du)dq=du;return self end,removeItem=function(self,a6)table.remove(dj,a6)return self end,getItem=function(self,a6)return dj[a6]end,getItemCount=function(self)return#dj end,editItem=function(self,a6,i,Y,Z,...)table.remove(dj,a6)table.insert(dj,a6,{text=i,bgCol=Y or self.bgColor,fgCol=Z or self.fgColor,args={...}})return self end,selectItem=function(self,a6)self:setValue(dj[a6]or{})return self end,setSelectedItem=function(self,Y,Z,dt)dk=Y or self.bgColor;dl=Z or self.fgColor;dm=dt;return self end,mouseClickHandler=function(self,a7,aK,N,O)local aL,aM=self:getAbsolutePosition(self:getAnchorPosition())if aL<=N and aL+self.width>N and aM<=O and aM+self.height>O and self:isVisible()then if self.parent~=nil then self.parent:setFocusedObject(self)end;if a7=="mouse_click"then local az=1;for E=1+dw,#dj do if dj[E]~=nil then if az+dj[E].text:len()+d8*2<=self.width then if aL+az-1<=N and aL+az-1+dj[E].text:len()+d8*2>N and aM==O then self:setValue(dj[E])self:getEventSystem():sendEvent("mouse_click",self,"mouse_click",0,N,O,dj[E])end;az=az+dj[E].text:len()+d8*2 else break end end end end;if a7=="mouse_scroll"and dq then dw=dw+aK;if dw<0 then dw=0 end;local dy=dx()if dw>dy then dw=dy end end;return true end;return false end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)local az=0;for aa,ab in pairs(dj)do if az+ab.text:len()+d8*2<=self.width then if ab==self:getValue()then self.parent:writeText(aX+az-1+-dw,aY,h((" "):rep(d8)..ab.text..(" "):rep(d8),ab.text:len()+d8*2,dn),dk or ab.bgCol,dl or ab.fgCol)else self.parent:writeText(aX+az-1+-dw,aY,h((" "):rep(d8)..ab.text..(" "):rep(d8),ab.text:len()+d8*2,dn),ab.bgCol,ab.fgCol)end;az=az+ab.text:len()+d8*2 else if az0 then for E=1,dC do if dj[E+dp]~=nil then if aX<=N and aX+dB>N and aY+E==O then self:setValue(dj[E+dp])return true end end end end end end;if a7=="mouse_scroll"then dp=dp+aK;if dp<0 then dp=0 end;if aK==1 then if#dj>dC then if dp>#dj-dC then dp=#dj-dC end else dp=dj-1 end end;return true end;self:setVisualChanged()end;if aT.mouseClickHandler(self,a7,aK,N,O)then dF=2 else dF=1 end end,draw=function(self)if aT.draw(self)then local aX,aY=self:getAnchorPosition()if self.parent~=nil then self.parent:drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)if#dj>=1 then if self:getValue()~=nil then if self:getValue().text~=nil then if dF==1 then self.parent:writeText(aX,aY,h(self:getValue().text,self.width,dn):sub(1,self.width-1)..dD,self.bgColor,self.fgColor)else self.parent:writeText(aX,aY,h(self:getValue().text,self.width,dn):sub(1,self.width-1)..dE,self.bgColor,self.fgColor)end end end;if dF==2 then for E=1,dC do if dj[E+dp]~=nil then if dj[E+dp]==self:getValue()then if dm then self.parent:writeText(aX,aY+E,h(dj[E+dp].text,dB,dn),dk,dl)else self.parent:writeText(aX,aY+E,h(dj[E+dp].text,dB,dn),dj[E+dp].bgCol,dj[E+dp].fgCol)end else self.parent:writeText(aX,aY+E,h(dj[E+dp].text,dB,dn),dj[E+dp].bgCol,dj[E+dp].fgCol)end end end end end end end end}return setmetatable(av,aT)end;local function dG(am)local aT=al(am)local an="Radio"aT.width=8;aT.bgColor=a.listBG;aT.fgColor=a.listFG;aT:setZIndex(5)local dj={}local dk=a.selectionBG;local dl=a.selectionFG;local dH=aT.bgColor;local dI=aT.fgColor;local dm=true;local _="\7"local dn="left"local av={getType=function(self)return an end,addItem=function(self,i,N,O,Y,Z,...)table.insert(dj,{x=N or 1,y=O or 1,text=i,bgCol=Y or self.bgColor,fgCol=Z or self.fgColor,args={...}})if#dj==1 then self:setValue(dj[1])end;return self end,removeItem=function(self,a6)table.remove(dj,a6)return self end,getItem=function(self,a6)return dj[a6]end,getItemIndex=function(self)local ds=self:getValue()for aN,ab in pairs(dj)do if ab==ds then return aN end end end,clear=function(self)dj={}self:setValue({})return self end,getItemCount=function(self)return#dj end,editItem=function(self,a6,i,N,O,Y,Z,...)table.remove(dj,a6)table.insert(dj,a6,{x=N or 1,y=O or 1,text=i,bgCol=Y or self.bgColor,fgCol=Z or self.fgColor,args={...}})return self end,selectItem=function(self,a6)self:setValue(dj[a6]or{})return self end,setSelectedItem=function(self,Y,Z,dJ,dK,dt)dk=Y or dk;dl=Z or dl;dH=dJ or dH;dI=dK or dI;dm=dt;return self end,mouseClickHandler=function(self,a7,aK,N,O)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if a7=="mouse_click"then if aK==1 then if#dj>0 then for aa,ab in pairs(dj)do if aX+ab.x-1<=N and aX+ab.x-1+ab.text:len()+2>=N and aY+ab.y-1==O then self:setValue(ab)if self.parent~=nil then self.parent:setFocusedObject(self)end;self:setVisualChanged()return true end end end end end;return false end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()for aa,ab in pairs(dj)do if ab==self:getValue()then if dn=="left"then self.parent:writeText(ab.x+aX-1,ab.y+aY-1,_,dH,dI)self.parent:writeText(ab.x+2+aX-1,ab.y+aY-1,ab.text,dk,dl)end else self.parent:drawBackgroundBox(ab.x+aX-1,ab.y+aY-1,1,1,self.bgColor)self.parent:writeText(ab.x+2+aX-1,ab.y+aY-1,ab.text,ab.bgCol,ab.fgCol)end end end end end}return setmetatable(av,aT)end;local function dL(am)local an="Timer"local dM=0;local dN=0;local dO=0;local dP;local au=a4()local av={name=am,getType=function(self)return an end,getZIndex=function(self)return 1 end,getName=function(self)return self.name end,setTime=function(self,dQ,dR)dM=dQ or 0;dN=dR or 1;return self end,start=function(self)dO=dN;dP=os.startTimer(dM)return self end,cancel=function(self)if dP~=nil then os.cancelTimer(dP)end;return self end,onCall=function(self,a9)au:registerEvent("timed_event",a9)return self end,eventHandler=function(self,a7,dS)if a7=="timer"and dS==dP then au:sendEvent("timed_event",self)if dO>=1 then dO=dO-1;if dO>=1 then dP=os.startTimer(dM)end elseif dO==-1 then dP=os.startTimer(dM)end end end}av.__index=av;return av end;local function dT(am)local av;local an="Thread"local a9;local dU;local dV=false;av={name=am,getType=function(self)return an end,getZIndex=function(self)return 1 end,getName=function(self)return self.name end,start=function(self,cQ)if cQ==nil then error("function is nil")end;a9=cQ;dU=coroutine.create(a9)dV=true;local aj,ak=coroutine.resume(dU)if not aj then if ak~="Terminated"then error("Threaderror - "..ak)end end;return self end,getStatus=function(self,cQ)if dU~=nil then return coroutine.status(dU)end;return nil end,stop=function(self,cQ)dV=false;return self end,eventHandler=function(self,a7,aO,aP,aQ)if dV then if coroutine.status(dU)~="dead"then local aj,ak=coroutine.resume(dU,a7,aO,aP,aQ)if not aj then if ak~="Terminated"then error("Threaderror - "..ak)end end else dV=false end end end}av.__index=av;return av end;local function dW(am)local av={}local an="Animation"local dP;local dX={}local a6=1;local dY=0;local dZ;local function d_()if dX[a6]~=nil then dX[a6].f(av,a6)end;a6=a6+1;if dX[a6]~=nil then if dX[a6].t>0 then dP=os.startTimer(dX[a6].t)else d_()end end end;av={name=am,getType=function(self)return an end,getZIndex=function(self)return 1 end,getName=function(self)return self.name end,add=function(self,a9,e0)dZ=a9;table.insert(dX,{f=a9,t=e0 or dY})return self end,wait=function(self,e0)dY=e0;return self end,rep=function(self,e1)for N=1,e1 do table.insert(dX,{f=dZ,t=dY})end;return self end,clear=function(self)dX={}dZ=nil;dY=0;a6=1;return self end,play=function(self)a6=1;if dX[a6]~=nil then if dX[a6].t>0 then dP=os.startTimer(dX[a6].t)else d_()end end;return self end,cancel=function(self)os.cancelTimer(dP)return self end,eventHandler=function(self,a7,dS)if a7=="timer"and dS==dP then if dX[a6]~=nil then d_()end end end}av.__index=av;return av end;local function e2(am)local aT=al(am)local an="Slider"aT.width=8;aT.bgColor=colors.lightGray;aT.fgColor=colors.gray;aT:setValue(1)local e3="horizontal"local _=" "local e4=colors.black;local e5="\140"local e6=aT.width;local a6=1;local av={getType=function(self)return an end,setSymbol=function(self,e7)_=e7:sub(1,1)self:setVisualChanged()return self end,setBackgroundSymbol=function(self,e8)e5=string.sub(e8,1,1)self:setVisualChanged()return self end,setSymbolColor=function(self,e9)e4=e9;self:setVisualChanged()return self end,setBarType=function(self,ea)e3=ea:lower()return self end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if e3=="horizontal"then for eb=0,self.width-1 do if aX+eb==N and aY<=O and aY+self.height>O then a6=eb+1;self:setValue(e6/self.width*a6)self:setVisualChanged()end end end;if e3=="vertical"then for eb=0,self.height-1 do if aY+eb==O and aX<=N and aX+self.width>N then a6=eb+1;self:setValue(e6/self.height*a6)self:setVisualChanged()end end end end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()if e3=="horizontal"then self.parent:writeText(aX,aY,e5:rep(a6-1),self.bgColor,self.fgColor)self.parent:writeText(aX+a6-1,aY,_,e4,e4)self.parent:writeText(aX+a6,aY,e5:rep(self.width-a6),self.bgColor,self.fgColor)end;if e3=="vertical"then for E=0,self.height-1 do if E+1==a6 then self.parent:writeText(aX,aY+E,_,e4,e4)else self.parent:writeText(aX,aY+E,e5,self.bgColor,self.fgColor)end end end end end end}return setmetatable(av,aT)end;local function ec(am)local aT=al(am)local an="Scrollbar"aT.width=1;aT.height=8;aT.bgColor=colors.lightGray;aT.fgColor=colors.gray;aT:setValue(1)aT:setZIndex(2)local e3="vertical"local _=" "local e4=colors.black;local e5="\127"local e6=aT.height;local a6=1;local ed=1;local av={getType=function(self)return an end,setSymbol=function(self,e7)_=e7:sub(1,1)self:setVisualChanged()return self end,setSymbolSize=function(self,ee)ed=tonumber(ee)or 1;if e3=="vertical"then self:setValue(a6-1*e6/(self.height-(ed-1))-e6/(self.height-(ed-1)))elseif e3=="horizontal"then self:setValue(a6-1*e6/(self.width-(ed-1))-e6/(self.width-(ed-1)))end;self:setVisualChanged()return self end,setMaxValue=function(self,d3)e6=d3;return self end,setBackgroundSymbol=function(self,e8)e5=string.sub(e8,1,1)self:setVisualChanged()return self end,setSymbolColor=function(self,e9)e4=e9;self:setVisualChanged()return self end,setBarType=function(self,ea)e3=ea:lower()return self end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if(a7=="mouse_click"or a7=="mouse_drag")and aK==1 then if e3=="horizontal"then for eb=0,self.width do if aX+eb==N and aY<=O and aY+self.height>O then a6=math.min(eb+1,self.width-(ed-1))self:setValue(e6/self.width*a6)self:setVisualChanged()end end end;if e3=="vertical"then for eb=0,self.height do if aY+eb==O and aX<=N and aX+self.width>N then a6=math.min(eb+1,self.height-(ed-1))self:setValue(e6/self.height*a6)self:setVisualChanged()end end end end;if a7=="mouse_scroll"then a6=a6+aK;if a6<1 then a6=1 end;a6=math.min(a6,(e3=="vertical"and self.height or self.width)-(ed-1))self:setValue(e6/(e3=="vertical"and self.height or self.width)*a6)end;return true end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()if e3=="horizontal"then self.parent:writeText(aX,aY,e5:rep(a6-1),self.bgColor,self.fgColor)self.parent:writeText(aX+a6-1,aY,_:rep(ed),e4,e4)self.parent:writeText(aX+a6+ed-1,aY,e5:rep(self.width-(a6+ed-1)),self.bgColor,self.fgColor)end;if e3=="vertical"then for E=0,self.height-1 do if a6==E+1 then for ef=0,math.min(ed-1,self.height)do self.parent:writeText(aX,aY+E+ef,_,e4,e4)end else if E+1a6-1+ed then self.parent:writeText(aX,aY+E,e5,self.bgColor,self.fgColor)end end end end end end end}return setmetatable(av,aT)end;local function eg(am)local aT=al(am)local an="Switch"aT.width=3;aT.height=1;aT.bgColor=colors.lightGray;aT.fgColor=colors.gray;aT:setValue(false)aT:setZIndex(5)local av={getType=function(self)return an end,mouseClickHandler=function(self,a7,aK,N,O)if aT.mouseClickHandler(self,a7,aK,N,O)then local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if(a7=="mouse_click"or a7=="mouse_drag")and aK==1 then end;return true end end,draw=function(self)if aT.draw(self)then if self.parent~=nil then local aX,aY=self:getAnchorPosition()end end end}return setmetatable(av,aT)end;local function eh(am,ei)local aT=al(am)local an="Frame"local ej={}local ek={}local av={}local el;aT:setZIndex(10)local b5=false;local b1=1;local b2=1;local em=colors.white;local en,dp=0,0;if ei~=nil then aT.parent=ei;aT.width,aT.height=ei.w,ei.h;aT.bgColor=a.FrameBG;aT.fgColor=a.FrameFG else local eo,ep=f.getSize()aT.width,aT.height=eo,ep;aT.bgColor=a.basaltBG;aT.fgColor=a.basaltFG end;local function eq(am)for aa,ab in pairs(ej)do for aa,bD in pairs(ab)do if bD.name==am then return ab end end end end;local function er(es)local ao=es:getZIndex()if eq(es.name)~=nil then return nil end;if ej[ao]==nil then for N=1,#ek+1 do if ek[N]~=nil then if ao==ek[N]then break end;if ao>ek[N]then table.insert(ek,N,ao)break end else table.insert(ek,ao)end end;if#ek<=0 then table.insert(ek,ao)end;ej[ao]={}end;es.parent=av;table.insert(ej[ao],es)return es end;local function et(es)for cp,bD in pairs(ej)do for aN,ab in pairs(bD)do if ab==es then table.remove(ej[cp],aN)return true end end end;return false end;av={barActive=false,barBackground=colors.gray,barTextcolor=colors.black,barText="New Frame",barTextAlign="left",isMoveable=false,getType=function(self)return an end,setFocusedObject=function(self,es)for aa,a6 in pairs(ek)do for aa,ab in pairs(ej[a6])do if ab==es then if el~=nil then el:loseFocusHandler()end;el=es;el:getFocusHandler()end end end;return self end,setOffset=function(self,aH,aI)en=aH~=nil and math.floor(aH<0 and math.abs(aH)or-aH)or en;dp=aI~=nil and math.floor(aI<0 and math.abs(aI)or-aI)or dp;return self end,getFrameOffset=function(self)return en,dp end,removeFocusedObject=function(self)if el~=nil then el:loseFocusHandler()end;el=nil;return self end,getFocusedObject=function(self)return el end,show=function(self)aT:show()if self.parent==nil then c=self end;return self end,setCursor=function(self,eu,ev,ew,aD)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())b5=eu or false;if ev~=nil then b1=aX+ev-1 end;if ew~=nil then b2=aY+ew-1 end;em=aD or em;self:setVisualChanged()return self end,setMoveable=function(self,ex)self.isMoveable=ex or not self.isMoveable;self:setVisualChanged()return self end,showBar=function(self,ey)self.barActive=ey or not self.barActive;self:setVisualChanged()return self end,setBar=function(self,i,Y,Z)self.barText=i or""self.barBackground=Y or self.barBackground;self.barTextcolor=Z or self.barTextcolor;self:setVisualChanged()return self end,setBarTextAlign=function(self,dn)self.barTextAlign=dn or"left"self:setVisualChanged()return self end,getVisualChanged=function(self)local ez=aT.getVisualChanged(self)for aa,a6 in pairs(ek)do if ej[a6]~=nil then for aa,ab in pairs(ej[a6])do if ab.getVisualChanged~=nil and ab:getVisualChanged()then ez=true end end end end;return ez end,loseFocusHandler=function(self)aT.loseFocusHandler(self)end,getFocusHandler=function(self)aT.getFocusHandler(self)if self.parent~=nil then self.parent:removeObject(self)self.parent:addObject(self)end end,keyHandler=function(self,a7,aN)if el~=nil then if el.keyHandler~=nil then if el:keyHandler(a7,aN)then return true end end end;return false end,backgroundKeyHandler=function(self,a7,aN)aT.backgroundKeyHandler(self,a7,aN)for aa,a6 in pairs(ek)do if ej[a6]~=nil then for aa,ab in pairs(ej[a6])do if ab.backgroundKeyHandler~=nil then ab:backgroundKeyHandler(a7,aN)end end end end end,eventHandler=function(self,a7,aO,aP,aQ,aR)aT.eventHandler(self,a7,aO,aP,aQ,aR)for aa,a6 in pairs(ek)do if ej[a6]~=nil then for aa,ab in pairs(ej[a6])do if ab.eventHandler~=nil then ab:eventHandler(a7,aO,aP,aQ,aR)end end end end;if a7=="terminate"then f.clear()f.setCursorPos(1,1)b.stop()end end,mouseClickHandler=function(self,a7,aK,N,O)local aH,aI=self:getOffset()aH=aH<0 and math.abs(aH)or-aH;aI=aI<0 and math.abs(aI)or-aI;if self.drag then if a7=="mouse_drag"then local eA=1;local eB=1;if self.parent~=nil then eA,eB=self.parent:getAbsolutePosition(self.parent:getAnchorPosition())end;self:setPosition(N+self.xToRem-(eA-1)+aH,O-(eB-1)+aI)end;if a7=="mouse_up"then self.drag=false end;return true end;if aT.mouseClickHandler(self,a7,aK,N,O)then local aE,aF=self:getAbsolutePosition(self:getAnchorPosition())for aa,a6 in pairs(ek)do if ej[a6]~=nil then for aa,ab in o(ej[a6])do if ab.mouseClickHandler~=nil then if ab:mouseClickHandler(a7,aK,N+aH,O+aI)then return true end end end end end;if self.isMoveable then if N>=aE and N<=aE+self.width-1 and O==aF and a7=="mouse_click"then self.drag=true;self.xToRem=aE-N end end;if el~=nil then el:loseFocusHandler()el=nil end;return true end;return false end,setText=function(self,N,O,i)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if O>=1 and O<=self.height then if self.parent~=nil then self.parent:setText(math.max(N+aX-1,aX)-(self.parent.x-1),aY+O-1-(self.parent.y-1),g(i,math.max(1-N+1,1),self.width-N+1))else X.setText(math.max(N+aX-1,aX),aY+O-1,g(i,math.max(1-N+1,1),self.width-N+1))end end end,setBG=function(self,N,O,Y)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if O>=1 and O<=self.height then if self.parent~=nil then self.parent:setBG(math.max(N+aX-1,aX)-(self.parent.x-1),aY+O-1-(self.parent.y-1),g(Y,math.max(1-N+1,1),self.width-N+1))else X.setBG(math.max(N+aX-1,aX),aY+O-1,g(Y,math.max(1-N+1,1),self.width-N+1))end end end,setFG=function(self,N,O,Z)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if O>=1 and O<=self.height then if self.parent~=nil then self.parent:setFG(math.max(N+aX-1,aX)-(self.parent.x-1),aY+O-1-(self.parent.y-1),g(Z,math.max(1-N+1,1),self.width-N+1))else X.setFG(math.max(N+aX-1,aX),aY+O-1,g(Z,math.max(1-N+1,1),self.width-N+1))end end end,writeText=function(self,N,O,i,Y,Z)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())if O>=1 and O<=self.height then if self.parent~=nil then self.parent:writeText(math.max(N+aX-1,aX)-(self.parent.x-1),aY+O-1-(self.parent.y-1),g(i,math.max(1-N+1,1),self.width-N+1),Y,Z)else X.writeText(math.max(N+aX-1,aX),aY+O-1,g(i,math.max(1-N+1,1),self.width-N+1),Y,Z)end end end,drawBackgroundBox=function(self,N,O,j,u,Y)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())u=O<1 and(u+O>self.height and self.height or u+O-1)or(u+O>self.height and self.height-O+1 or u)j=N<1 and(j+N>self.width and self.width or j+N-1)or(j+N>self.width and self.width-N+1 or j)if self.parent~=nil then self.parent:drawBackgroundBox(math.max(N+aX-1,aX)-(self.parent.x-1),math.max(O+aY-1,aY)-(self.parent.y-1),j,u,Y)else X.drawBackgroundBox(math.max(N+aX-1,aX),math.max(O+aY-1,aY),j,u,Y)end end,drawTextBox=function(self,N,O,j,u,_)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())u=O<1 and(u+O>self.height and self.height or u+O-1)or(u+O>self.height and self.height-O+1 or u)j=N<1 and(j+N>self.width and self.width or j+N-1)or(j+N>self.width and self.width-N+1 or j)if self.parent~=nil then self.parent:drawTextBox(math.max(N+aX-1,aX)-(self.parent.x-1),math.max(O+aY-1,aY)-(self.parent.y-1),j,u,_:sub(1,1))else X.drawTextBox(math.max(N+aX-1,aX),math.max(O+aY-1,aY),j,u,_:sub(1,1))end end,drawForegroundBox=function(self,N,O,j,u,Z)local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())u=O<1 and(u+O>self.height and self.height or u+O-1)or(u+O>self.height and self.height-O+1 or u)j=N<1 and(j+N>self.width and self.width or j+N-1)or(j+N>self.width and self.width-N+1 or j)if self.parent~=nil then self.parent:drawForegroundBox(math.max(N+aX-1,aX)-(self.parent.x-1),math.max(O+aY-1,aY)-(self.parent.y-1),j,u,Z)else X.drawForegroundBox(math.max(N+aX-1,aX),math.max(O+aY-1,aY),j,u,Z)end end,draw=function(self)if self:getVisualChanged()then if aT.draw(self)then local aX,aY=self:getAbsolutePosition(self:getAnchorPosition())local dg,dh=self:getAnchorPosition()if self.parent~=nil then self.parent:drawBackgroundBox(dg,dh,self.width,self.height,self.bgColor)self.parent:drawForegroundBox(dg,dh,self.width,self.height,self.fgColor)self.parent:drawTextBox(dg,dh,self.width,self.height," ")else X.drawBackgroundBox(aX,aY,self.width,self.height,self.bgColor)X.drawForegroundBox(aX,aY,self.width,self.height,self.fgColor)X.drawTextBox(aX,aY,self.width,self.height," ")end;f.setCursorBlink(false)if self.barActive then if self.parent~=nil then self.parent:writeText(dg,dh,h(self.barText,self.width,self.barTextAlign),self.barBackground,self.barTextcolor)else X.writeText(aX,aY,h(self.barText,self.width,self.barTextAlign),self.barBackground,self.barTextcolor)end end;for aa,a6 in o(ek)do if ej[a6]~=nil then for aa,ab in pairs(ej[a6])do if ab.draw~=nil then ab:draw()end end end end;if b5 then f.setTextColor(em)f.setCursorPos(b1,b2)if self.parent~=nil then f.setCursorBlink(self:isFocused())else f.setCursorBlink(b5)end end;self:setVisualChanged(false)end end end,addObject=function(self,es)return er(es)end,removeObject=function(self,es)return et(es)end,getObject=function(self,es)return eq(es)end,addButton=function(self,am)local es=aS(am)es.name=am;return er(es)end,addLabel=function(self,am)local es=c0(am)es.name=am;es.bgColor=self.bgColor;es.fgColor=self.fgColor;return er(es)end,addCheckbox=function(self,am)local es=cG(am)es.name=am;return er(es)end,addInput=function(self,am)local es=cR(am)es.name=am;return er(es)end,addProgram=function(self,am)local es=a_(am)es.name=am;return er(es)end,addTextfield=function(self,am)local es=d9(am)es.name=am;return er(es)end,addList=function(self,am)local es=di(am)es.name=am;return er(es)end,addDropdown=function(self,am)local es=dA(am)es.name=am;return er(es)end,addRadio=function(self,am)local es=dG(am)es.name=am;return er(es)end,addTimer=function(self,am)local es=dL(am)es.name=am;return er(es)end,addAnimation=function(self,am)local es=dW(am)es.name=am;return er(es)end,addSlider=function(self,am)local es=e2(am)es.name=am;return er(es)end,addScrollbar=function(self,am)local es=ec(am)es.name=am;return er(es)end,addMenubar=function(self,am)local es=dv(am)es.name=am;return er(es)end,addThread=function(self,am)local es=dT(am)es.name=am;return er(es)end,addPane=function(self,am)local es=c2(am)es.name=am;return er(es)end,addImage=function(self,am)local es=c3(am)es.name=am;return er(es)end,addProgressbar=function(self,am)local es=cH(am)es.name=am;return er(es)end,addFrame=function(self,am)local es=eh(am,self)es.name=am;return er(es)end}setmetatable(av,aT)if ei==nil then table.insert(d,av)end;return av end;local eC=false;local function eD(a7,aO,aP,aQ,aR)if a7=="mouse_click"then c:mouseClickHandler(a7,aO,aP,aQ,aR)end;if a7=="mouse_drag"then c:mouseClickHandler(a7,aO,aP,aQ,aR)end;if a7=="mouse_up"then c:mouseClickHandler(a7,aO,aP,aQ,aR)end;if a7=="mouse_scroll"then c:mouseClickHandler(a7,aO,aP,aQ,aR)end;if a7=="key"or a7=="char"then c:keyHandler(a7,aO)c:backgroundKeyHandler(a7,aO)end;for aa,ab in pairs(d)do ab:eventHandler(a7,aO,aP,aQ,aR)end;if eC then c:draw()X.update()end end;function b.autoUpdate(dV)f.clear()eC=dV or true;c:draw()X.update()while eC do local a7,aO,aP,aQ,aR=os.pullEventRaw()eD(a7,aO,aP,aQ,aR)end end;function b.update(a7,aO,aP,aQ,aR)if a7~="nil"then eD(a7,aO,aP,aQ,aR)else c:draw()X.update()end end;function b.stop()eC=false end;function b.getFrame(am)for aa,ab in pairs(d)do if ab.name==am then return ab end end end;function b.getActiveFrame()return c end;function b.setActiveFrame(aw)if aw:getType()=="Frame"then c=aw;return true end;return false end;function b.createFrame(am)local aw=eh(am)return aw end;function b.removeFrame(am)for aN,ab in pairs(d)do if ab.name==am then d[aN]=nil;return true end end;return false end;if b.debugger then b.debugFrame=b.createFrame("basaltDebuggingFrame"):showBar():setBackground(colors.lightGray):setBar("Debug",colors.black,colors.gray)b.debugList=b.debugFrame:addList("debugList"):setSize(b.debugFrame.width-2,b.debugFrame.height-3):setPosition(2,3):setScrollable(true):show()b.debugFrame:addButton("back"):setAnchor("right"):setSize(1,1):setText("\22"):onClick(function()b.oldFrame:show()end):setBackground(colors.red):show()b.debugLabel=b.debugFrame:addLabel("debugLabel"):onClick(function()b.oldFrame=c;b.debugFrame:show()end):setBackground(colors.black):setForeground(colors.white):setAnchor("bottom"):setZIndex(20):show()end;if b.debugger then function b.debug(...)local ah={...}if c.name~="basaltDebuggingFrame"then if c~=b.debugLabel.frame then b.debugLabel:setParent(c)end end;local eE=""for aN,ab in pairs(ah)do eE=eE..tostring(ab)..(#ah~=aN and", "or"")end;b.debugLabel:setText("[Debug] "..eE)b.debugList:addItem(eE)if b.debugList:getItemCount()>50 then b.debugList:removeItem(1)end;b.debugList:setValue(b.debugList:getItem(b.debugList:getItemCount()))b.debugLabel:show()end end;return b \ No newline at end of file diff --git a/source/basalt.lua b/source/basalt.lua index 16dbcfd..4a51f8c 100644 --- a/source/basalt.lua +++ b/source/basalt.lua @@ -223,14 +223,14 @@ local function basaltDrawHelper() setFG(x, y, colorStr) end; - drawBackgroundBox = function(x, y, width, height, bgColor) + drawBackgroundBox = function(x, y, width, height, bgCol) for n = 1, height do - setBG(x, y + (n - 1), tHex[bgColor]:rep(width)) + setBG(x, y + (n - 1), tHex[bgCol]:rep(width)) end end; - drawForegroundBox = function(x, y, width, height, fgColor) + drawForegroundBox = function(x, y, width, height, fgCol) for n = 1, height do - setFG(x, y + (n - 1), tHex[fgColor]:rep(width)) + setFG(x, y + (n - 1), tHex[fgCol]:rep(width)) end end; drawTextBox = function(x, y, width, height, symbol) @@ -238,12 +238,12 @@ local function basaltDrawHelper() setText(x, y + (n - 1), symbol:rep(width)) end end; - writeText = function(x, y, text, bgColor, fgColor) - bgColor = bgColor or terminal.getBackgroundColor() - fgColor = fgColor or terminal.getTextColor() + writeText = function(x, y, text, bgCol, fgCol) + bgCol = bgCol or terminal.getBackgroundColor() + fgCol = fgCol or terminal.getTextColor() setText(x, y, text) - setBG(x, y, tHex[bgColor]:rep(text:len())) - setFG(x, y, tHex[fgColor]:rep(text:len())) + setBG(x, y, tHex[bgCol]:rep(text:len())) + setFG(x, y, tHex[fgCol]:rep(text:len())) end; update = function() @@ -836,7 +836,7 @@ local function Program(name) end local function internalBlit(sText, sTextColor, sBackgroundColor) - -- copy pasta strikes again (cc: window.lua) + -- copy pasti strikes again (cc: window.lua) local nStart = xCursor local nEnd = nStart + #sText - 1 if yCursor >= 1 and yCursor <= height then @@ -1060,14 +1060,14 @@ local function Program(name) visible = vis end; - drawBackgroundBox = function(_x, _y, _width, _height, bgColor) + drawBackgroundBox = function(_x, _y, _width, _height, bgCol) for n = 1, _height do - setBG(_x, _y + (n - 1), tHex[bgColor]:rep(_width)) + setBG(_x, _y + (n - 1), tHex[bgCol]:rep(_width)) end end; - drawForegroundBox = function(_x, _y, _width, _height, fgColor) + drawForegroundBox = function(_x, _y, _width, _height, fgCol) for n = 1, _height do - setFG(_x, _y + (n - 1), tHex[fgColor]:rep(_width)) + setFG(_x, _y + (n - 1), tHex[fgCol]:rep(_width)) end end; drawTextBox = function(_x, _y, _width, _height, symbol) @@ -1076,12 +1076,12 @@ local function Program(name) end end; - writeText = function(_x, _y, text, bgColor, fgColor) - bgColor = bgColor or bgColor - fgColor = fgColor or fgColor + writeText = function(_x, _y, text, bgCol, fgCol) + bgCol = bgCol or bgColor + fgCol = fgCol or fgColor setText(x, _y, text) - setBG(_x, _y, tHex[bgColor]:rep(text:len())) - setFG(_x, _y, tHex[fgColor]:rep(text:len())) + setBG(_x, _y, tHex[bgCol]:rep(text:len())) + setFG(_x, _y, tHex[fgCol]:rep(text:len())) end; basalt_update = function() @@ -1158,25 +1158,25 @@ local function Program(name) end end; - blit = function(text, _fgColor, _bgColor) + blit = function(text, fgcol, bgcol) if type(text) ~= "string" then error("bad argument #1 (expected string, got " .. type(text) .. ")", 2) end - if type(_fgColor) ~= "string" then - error("bad argument #2 (expected string, got " .. type(_fgColor) .. ")", 2) + if type(fgcol) ~= "string" then + error("bad argument #2 (expected string, got " .. type(fgcol) .. ")", 2) end - if type(_bgColor) ~= "string" then - error("bad argument #3 (expected string, got " .. type(_bgColor) .. ")", 2) + if type(bgcol) ~= "string" then + error("bad argument #3 (expected string, got " .. type(bgcol) .. ")", 2) end - if #_fgColor ~= #text or #_bgColor ~= #text then + if #fgcol ~= #text or #bgcol ~= #text then error("Arguments must be the same length", 2) end if (visible) then --setText(xCursor, yCursor, text) - --setBG(xCursor, yCursor, bgColor) - --setFG(xCursor, yCursor, fgColor) + --setBG(xCursor, yCursor, bgcol) + --setFG(xCursor, yCursor, fgcol) --xCursor = xCursor+text:len() - internalBlit(text, _fgColor, _bgColor) + internalBlit(text, fgcol, bgcol) end end @@ -1587,7 +1587,7 @@ local function Image(name) end end - local results, width, height, bgColor = { {}, {}, {} }, 0, #image + #image % 3, base.bgColor or colors.black + local results, width, height, bgCol = { {}, {}, {} }, 0, #image + #image % 3, base.bgColor or colors.black for i = 1, #image do if #image[i] > width then width = #image[i] @@ -1603,7 +1603,7 @@ local function Image(name) for yy = 1, 3 do for xx = 1, 2 do - pattern[#pattern + 1] = (image[y + yy] and image[y + yy][x + xx]) and (image[y + yy][x + xx] == 0 and bgColor or image[y + yy][x + xx]) or bgCol + pattern[#pattern + 1] = (image[y + yy] and image[y + yy][x + xx]) and (image[y + yy][x + xx] == 0 and bgCol or image[y + yy][x + xx]) or bgCol totals[pattern[#pattern]] = totals[pattern[#pattern]] and (totals[pattern[#pattern]] + 1) or 1 end end @@ -1858,8 +1858,8 @@ local function Input(name) local wIndex = 1 local defaultText = "" - local defaultbgCol - local defaultfgCol + local defaultBGCol + local defaultFGCol local showingText = defaultText local internalValueChange = false @@ -1878,8 +1878,8 @@ local function Input(name) setDefaultText = function(self, text, fCol, bCol) defaultText = text - defaultbgColor = bCol or defaultbgCol - defaultfgColor = fCol or defaultfgCol + defaultBGCol = bCol or defaultBGCol + defaultFGCol = fCol or defaultFGCol if (self:isFocused()) then showingText = "" else @@ -2054,8 +2054,8 @@ local function Input(name) local text if (val:len() <= 0) then text = showingText - bCol = defaultbgColor or bCol - fCol = defaultfgColor or fCol + bCol = defaultBGCol or bCol + fCol = defaultFGCol or fCol end text = showingText @@ -2331,7 +2331,7 @@ local function Textfield(name) mouseClickHandler = function(self, event, button, x, y) if (base.mouseClickHandler(self, event, button, x, y)) then local obx, oby = self:getAbsolutePosition(self:getAnchorPosition()) - local anchorX, anchorY = self:getAnchorPosition() + local anchx, anchy = self:getAnchorPosition() if (event == "mouse_click") then if (lines[y - oby + hIndex] ~= nil) then textX = x - obx + wIndex @@ -2346,7 +2346,7 @@ local function Textfield(name) end end if (self.parent ~= nil) then - self.parent:setCursor(true, anchorX + textX - wIndex, anchorY + textY - hIndex) + self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex) end end end @@ -2364,7 +2364,7 @@ local function Textfield(name) end end if (self.parent ~= nil) then - self.parent:setCursor(true, anchorX + textX - wIndex, anchorY + textY - hIndex) + self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex) end end end @@ -2381,7 +2381,7 @@ local function Textfield(name) if (self.parent ~= nil) then if (obx + textX - wIndex >= obx and obx + textX - wIndex <= obx + self.width) and (oby + textY - hIndex >= oby and oby + textY - hIndex <= oby + self.height) then - self.parent:setCursor(true, anchorX + textX - wIndex, anchorY + textY - hIndex) + self.parent:setCursor(true, anchx + textX - wIndex, anchy + textY - hIndex) else self.parent:setCursor(false) end @@ -2441,8 +2441,8 @@ local function List(name) return objectType end; - addItem = function(self, text, bgColor, fgColor, ...) - table.insert(list, { text = text, bgColor = bgColor or self.bgColor, fgColor = fgColor or self.fgColor, args = { ... } }) + addItem = function(self, text, bgCol, fgCol, ...) + table.insert(list, { text = text, bgCol = bgCol or self.bgColor, fgCol = fgCol or self.fgColor, args = { ... } }) if (#list == 1) then self:setValue(list[1]) end @@ -2486,9 +2486,9 @@ local function List(name) return #list end; - editItem = function(self, index, text, bgColor, fgColor, ...) + editItem = function(self, index, text, bgCol, fgCol, ...) table.remove(list, index) - table.insert(list, index, { text = text, bgColor = bgColor or self.bgColor, fgColor = fgColor or self.fgColor, args = { ... } }) + table.insert(list, index, { text = text, bgCol = bgCol or self.bgColor, fgCol = fgCol or self.fgColor, args = { ... } }) return self end; @@ -2497,9 +2497,9 @@ local function List(name) return self end; - setSelectedItem = function(self, bgColor, fgColor, active) - itemSelectedBG = bgColor or self.bgColor - itemSelectedFG = fgColor or self.fgColor + setSelectedItem = function(self, bgCol, fgCol, active) + itemSelectedBG = bgCol or self.bgColor + itemSelectedFG = fgCol or self.fgColor selectionColorActive = active return self end; @@ -2562,10 +2562,10 @@ local function List(name) if (selectionColorActive) then self.parent:writeText(obx, oby + n - 1, getTextHorizontalAlign(list[n + yOffset].text, self.width, align), itemSelectedBG, itemSelectedFG) else - self.parent:writeText(obx, oby + n - 1, getTextHorizontalAlign(list[n + yOffset].text, self.width, align), list[n + yOffset].bgColor, list[n + yOffset].fgColor) + self.parent:writeText(obx, oby + n - 1, getTextHorizontalAlign(list[n + yOffset].text, self.width, align), list[n + yOffset].bgCol, list[n + yOffset].fgCol) end else - self.parent:writeText(obx, oby + n - 1, getTextHorizontalAlign(list[n + yOffset].text, self.width, align), list[n + yOffset].bgColor, list[n + yOffset].fgColor) + self.parent:writeText(obx, oby + n - 1, getTextHorizontalAlign(list[n + yOffset].text, self.width, align), list[n + yOffset].bgCol, list[n + yOffset].fgCol) end end end @@ -2615,8 +2615,8 @@ local function Menubar(name) return objectType end; - addItem = function(self, text, bgColor, fgColor, ...) - table.insert(list, { text = text, bgColor = bgColor or self.bgColor, fgColor = fgColor or self.fgColor, args = { ... } }) + addItem = function(self, text, bgCol, fgCol, ...) + table.insert(list, { text = text, bgCol = bgCol or self.bgColor, fgCol = fgCol or self.fgColor, args = { ... } }) if (#list == 1) then self:setValue(list[1]) end @@ -2674,9 +2674,9 @@ local function Menubar(name) return #list end; - editItem = function(self, index, text, bgColor, fgColor, ...) + editItem = function(self, index, text, bgCol, fgCol, ...) table.remove(list, index) - table.insert(list, index, { text = text, bgColor = bgColor or self.bgColor, fgColor = fgColor or self.fgColor, args = { ... } }) + table.insert(list, index, { text = text, bgCol = bgCol or self.bgColor, fgCol = fgCol or self.fgColor, args = { ... } }) return self end; @@ -2685,9 +2685,9 @@ local function Menubar(name) return self end; - setSelectedItem = function(self, bgColor, fgColor, active) - itemSelectedBG = bgColor or self.bgColor - itemSelectedFG = fgColor or self.fgColor + setSelectedItem = function(self, bgCol, fgCol, active) + itemSelectedBG = bgCol or self.bgColor + itemSelectedFG = fgCol or self.fgColor selectionColorActive = active return self end; @@ -2741,17 +2741,17 @@ local function Menubar(name) for _, value in pairs(list) do if (xPos + value.text:len() + space * 2 <= self.width) then if (value == self:getValue()) then - self.parent:writeText(obx + (xPos - 1) + (-itemOffset), oby, getTextHorizontalAlign((" "):rep(space) .. value.text .. (" "):rep(space), value.text:len() + space * 2, align), itemSelectedBG or value.bgColor, itemSelectedFG or value.fgColor) + self.parent:writeText(obx + (xPos - 1) + (-itemOffset), oby, getTextHorizontalAlign((" "):rep(space) .. value.text .. (" "):rep(space), value.text:len() + space * 2, align), itemSelectedBG or value.bgCol, itemSelectedFG or value.fgCol) else - self.parent:writeText(obx + (xPos - 1) + (-itemOffset), oby, getTextHorizontalAlign((" "):rep(space) .. value.text .. (" "):rep(space), value.text:len() + space * 2, align), value.bgColor, value.fgColor) + self.parent:writeText(obx + (xPos - 1) + (-itemOffset), oby, getTextHorizontalAlign((" "):rep(space) .. value.text .. (" "):rep(space), value.text:len() + space * 2, align), value.bgCol, value.fgCol) end xPos = xPos + value.text:len() + space * 2 else if (xPos < self.width + itemOffset) then if (value == self:getValue()) then - self.parent:writeText(obx + (xPos - 1) + (-itemOffset), oby, getTextHorizontalAlign((" "):rep(space) .. value.text .. (" "):rep(space), value.text:len() + space * 2, align):sub(1, self.width + itemOffset - xPos), itemSelectedBG or value.bgColor, itemSelectedFG or value.fgColor) + self.parent:writeText(obx + (xPos - 1) + (-itemOffset), oby, getTextHorizontalAlign((" "):rep(space) .. value.text .. (" "):rep(space), value.text:len() + space * 2, align):sub(1, self.width + itemOffset - xPos), itemSelectedBG or value.bgCol, itemSelectedFG or value.fgCol) else - self.parent:writeText(obx + (xPos - 1) + (-itemOffset), oby, getTextHorizontalAlign((" "):rep(space) .. value.text .. (" "):rep(space), value.text:len() + space * 2, align):sub(1, self.width + itemOffset - xPos), value.bgColor, value.fgColor) + self.parent:writeText(obx + (xPos - 1) + (-itemOffset), oby, getTextHorizontalAlign((" "):rep(space) .. value.text .. (" "):rep(space), value.text:len() + space * 2, align):sub(1, self.width + itemOffset - xPos), value.bgCol, value.fgCol) end xPos = xPos + value.text:len() + space * 2 end @@ -2801,8 +2801,8 @@ local function Dropdown(name) return yOffset end; - addItem = function(self, text, bgColor, fgColor, ...) - table.insert(list, { text = text, bgColor = bgColor or self.bgColor, fgColor = fgColor or self.fgColor, args = { ... } }) + addItem = function(self, text, bgCol, fgCol, ...) + table.insert(list, { text = text, bgCol = bgCol or self.bgColor, fgCol = fgCol or self.fgColor, args = { ... } }) return self end; @@ -2834,9 +2834,9 @@ local function Dropdown(name) return #list end; - editItem = function(self, index, text, bgColor, fgColor, ...) + editItem = function(self, index, text, bgCol, fgCol, ...) table.remove(list, index) - table.insert(list, index, { text = text, bgColor = bgColor or self.bgColor, fgColor = fgColor or self.fgColor, args = { ... } }) + table.insert(list, index, { text = text, bgCol = bgCol or self.bgColor, fgCol = fgCol or self.fgColor, args = { ... } }) return self end; @@ -2845,9 +2845,9 @@ local function Dropdown(name) return self end; - setSelectedItem = function(self, bgColor, fgColor, active) - itemSelectedBG = bgColor or self.bgColor - itemSelectedFG = fgColor or self.fgColor + setSelectedItem = function(self, bgCol, fgCol, active) + itemSelectedBG = bgCol or self.bgColor + itemSelectedFG = fgCol or self.fgColor selectionColorActive = active return self end; @@ -2923,10 +2923,10 @@ local function Dropdown(name) if (selectionColorActive) then self.parent:writeText(obx, oby + n, getTextHorizontalAlign(list[n + yOffset].text, dropdownW, align), itemSelectedBG, itemSelectedFG) else - self.parent:writeText(obx, oby + n, getTextHorizontalAlign(list[n + yOffset].text, dropdownW, align), list[n + yOffset].bgColor, list[n + yOffset].fgColor) + self.parent:writeText(obx, oby + n, getTextHorizontalAlign(list[n + yOffset].text, dropdownW, align), list[n + yOffset].bgCol, list[n + yOffset].fgCol) end else - self.parent:writeText(obx, oby + n, getTextHorizontalAlign(list[n + yOffset].text, dropdownW, align), list[n + yOffset].bgColor, list[n + yOffset].fgColor) + self.parent:writeText(obx, oby + n, getTextHorizontalAlign(list[n + yOffset].text, dropdownW, align), list[n + yOffset].bgCol, list[n + yOffset].fgCol) end end end @@ -2962,8 +2962,8 @@ local function Radio(name) return objectType end; - addItem = function(self, text, x, y, bgColor, fgColor, ...) - table.insert(list, { x = x or 1, y = y or 1, text = text, bgColor = bgColor or self.bgColor, fgColor = fgColor or self.fgColor, args = { ... } }) + addItem = function(self, text, x, y, bgCol, fgCol, ...) + table.insert(list, { x = x or 1, y = y or 1, text = text, bgCol = bgCol or self.bgColor, fgCol = fgCol or self.fgColor, args = { ... } }) if (#list == 1) then self:setValue(list[1]) end @@ -2998,9 +2998,9 @@ local function Radio(name) return #list end; - editItem = function(self, index, text, x, y, bgColor, fgColor, ...) + editItem = function(self, index, text, x, y, bgCol, fgCol, ...) table.remove(list, index) - table.insert(list, index, { x = x or 1, y = y or 1, text = text, bgColor = bgColor or self.bgColor, fgColor = fgColor or self.fgColor, args = { ... } }) + table.insert(list, index, { x = x or 1, y = y or 1, text = text, bgCol = bgCol or self.bgColor, fgCol = fgCol or self.fgColor, args = { ... } }) return self end; @@ -3009,9 +3009,9 @@ local function Radio(name) return self end; - setSelectedItem = function(self, bgColor, fgColor, boxBG, boxFG, active) - itemSelectedBG = bgColor or itemSelectedBG - itemSelectedFG = fgColor or itemSelectedFG + setSelectedItem = function(self, bgCol, fgCol, boxBG, boxFG, active) + itemSelectedBG = bgCol or itemSelectedBG + itemSelectedFG = fgCol or itemSelectedFG boxSelectedBG = boxBG or boxSelectedBG boxSelectedFG = boxFG or boxSelectedFG selectionColorActive = active @@ -3053,7 +3053,7 @@ local function Radio(name) end else self.parent:drawBackgroundBox(value.x + obx - 1, value.y + oby - 1, 1, 1, self.bgColor) - self.parent:writeText(value.x + 2 + obx - 1, value.y + oby - 1, value.text, value.bgColor, value.fgColor) + self.parent:writeText(value.x + 2 + obx - 1, value.y + oby - 1, value.text, value.bgCol, value.fgCol) end end end @@ -3734,10 +3734,10 @@ local function Frame(name, parent) return self end; - setBar = function(self, text, bgColor, fgColor) + setBar = function(self, text, bgCol, fgCol) self.barText = text or "" - self.barBackground = bgColor or self.barBackground - self.barTextcolor = fgColor or self.barTextcolor + self.barBackground = bgCol or self.barBackground + self.barTextcolor = fgCol or self.barTextcolor self:setVisualChanged() return self end; @@ -3875,47 +3875,47 @@ local function Frame(name, parent) end end; - setBG = function(self, x, y, bgColor) + setBG = function(self, x, y, bgCol) local obx, oby = self:getAbsolutePosition(self:getAnchorPosition()) if (y >= 1) and (y <= self.height) then if (self.parent ~= nil) then - self.parent:setBG(math.max(x + (obx - 1), obx) - (self.parent.x - 1), oby + y - 1 - (self.parent.y - 1), sub(bgColor, math.max(1 - x + 1, 1), self.width - x + 1)) + self.parent:setBG(math.max(x + (obx - 1), obx) - (self.parent.x - 1), oby + y - 1 - (self.parent.y - 1), sub(bgCol, math.max(1 - x + 1, 1), self.width - x + 1)) else - drawHelper.setBG(math.max(x + (obx - 1), obx), oby + y - 1, sub(bgColor, math.max(1 - x + 1, 1), self.width - x + 1)) + drawHelper.setBG(math.max(x + (obx - 1), obx), oby + y - 1, sub(bgCol, math.max(1 - x + 1, 1), self.width - x + 1)) end end end; - setFG = function(self, x, y, fgColor) + setFG = function(self, x, y, fgCol) local obx, oby = self:getAbsolutePosition(self:getAnchorPosition()) if (y >= 1) and (y <= self.height) then if (self.parent ~= nil) then - self.parent:setFG(math.max(x + (obx - 1), obx) - (self.parent.x - 1), oby + y - 1 - (self.parent.y - 1), sub(fgColor, math.max(1 - x + 1, 1), self.width - x + 1)) + self.parent:setFG(math.max(x + (obx - 1), obx) - (self.parent.x - 1), oby + y - 1 - (self.parent.y - 1), sub(fgCol, math.max(1 - x + 1, 1), self.width - x + 1)) else - drawHelper.setFG(math.max(x + (obx - 1), obx), oby + y - 1, sub(fgColor, math.max(1 - x + 1, 1), self.width - x + 1)) + drawHelper.setFG(math.max(x + (obx - 1), obx), oby + y - 1, sub(fgCol, math.max(1 - x + 1, 1), self.width - x + 1)) end end end; - writeText = function(self, x, y, text, bgColor, fgColor) + writeText = function(self, x, y, text, bgCol, fgCol) local obx, oby = self:getAbsolutePosition(self:getAnchorPosition()) if (y >= 1) and (y <= self.height) then if (self.parent ~= nil) then - self.parent:writeText(math.max(x + (obx - 1), obx) - (self.parent.x - 1), oby + y - 1 - (self.parent.y - 1), sub(text, math.max(1 - x + 1, 1), self.width - x + 1), bgColor, fgColor) + self.parent:writeText(math.max(x + (obx - 1), obx) - (self.parent.x - 1), oby + y - 1 - (self.parent.y - 1), sub(text, math.max(1 - x + 1, 1), self.width - x + 1), bgCol, fgCol) else - drawHelper.writeText(math.max(x + (obx - 1), obx), oby + y - 1, sub(text, math.max(1 - x + 1, 1), self.width - x + 1), bgColor, fgColor) + drawHelper.writeText(math.max(x + (obx - 1), obx), oby + y - 1, sub(text, math.max(1 - x + 1, 1), self.width - x + 1), bgCol, fgCol) end end end; - drawBackgroundBox = function(self, x, y, width, height, _bgColor) + drawBackgroundBox = function(self, x, y, width, height, bgCol) local obx, oby = self:getAbsolutePosition(self:getAnchorPosition()) height = (y < 1 and (height + y > self.height and self.height or height + y - 1) or (height + y > self.height and self.height - y + 1 or height)) width = (x < 1 and (width + x > self.width and self.width or width + x - 1) or (width + x > self.width and self.width - x + 1 or width)) if (self.parent ~= nil) then - self.parent:drawBackgroundBox(math.max(x + (obx - 1), obx) - (self.parent.x - 1), math.max(y + (oby - 1), oby) - (self.parent.y - 1), width, height, _bgColor) + self.parent:drawBackgroundBox(math.max(x + (obx - 1), obx) - (self.parent.x - 1), math.max(y + (oby - 1), oby) - (self.parent.y - 1), width, height, bgCol) else - drawHelper.drawBackgroundBox(math.max(x + (obx - 1), obx), math.max(y + (oby - 1), oby), width, height, _bgColor) + drawHelper.drawBackgroundBox(math.max(x + (obx - 1), obx), math.max(y + (oby - 1), oby), width, height, bgCol) end end; @@ -3930,14 +3930,14 @@ local function Frame(name, parent) end end; - drawForegroundBox = function(self, x, y, width, height, fgColor) + drawForegroundBox = function(self, x, y, width, height, fgCol) local obx, oby = self:getAbsolutePosition(self:getAnchorPosition()) height = (y < 1 and (height + y > self.height and self.height or height + y - 1) or (height + y > self.height and self.height - y + 1 or height)) width = (x < 1 and (width + x > self.width and self.width or width + x - 1) or (width + x > self.width and self.width - x + 1 or width)) if (self.parent ~= nil) then - self.parent:drawForegroundBox(math.max(x + (obx - 1), obx) - (self.parent.x - 1), math.max(y + (oby - 1), oby) - (self.parent.y - 1), width, height, fgColor) + self.parent:drawForegroundBox(math.max(x + (obx - 1), obx) - (self.parent.x - 1), math.max(y + (oby - 1), oby) - (self.parent.y - 1), width, height, fgCol) else - drawHelper.drawForegroundBox(math.max(x + (obx - 1), obx), math.max(y + (oby - 1), oby), width, height, fgColor) + drawHelper.drawForegroundBox(math.max(x + (obx - 1), obx), math.max(y + (oby - 1), oby), width, height, fgCol) end end; @@ -3945,11 +3945,11 @@ local function Frame(name, parent) if (self:getVisualChanged()) then if (base.draw(self)) then local obx, oby = self:getAbsolutePosition(self:getAnchorPosition()) - local anchorX, anchorY = self:getAnchorPosition() + local anchx, anchy = self:getAnchorPosition() if (self.parent ~= nil) then - self.parent:drawBackgroundBox(anchorX, anchorY, self.width, self.height, self.bgColor) - self.parent:drawForegroundBox(anchorX, anchorY, self.width, self.height, self.fgColor) - self.parent:drawTextBox(anchorX, anchorY, self.width, self.height, " ") + self.parent:drawBackgroundBox(anchx, anchy, self.width, self.height, self.bgColor) + self.parent:drawForegroundBox(anchx, anchy, self.width, self.height, self.fgColor) + self.parent:drawTextBox(anchx, anchy, self.width, self.height, " ") else drawHelper.drawBackgroundBox(obx, oby, self.width, self.height, self.bgColor) drawHelper.drawForegroundBox(obx, oby, self.width, self.height, self.fgColor) @@ -3958,7 +3958,7 @@ local function Frame(name, parent) parentTerminal.setCursorBlink(false) if (self.barActive) then if (self.parent ~= nil) then - self.parent:writeText(anchorX, anchorY, getTextHorizontalAlign(self.barText, self.width, self.barTextAlign), self.barBackground, self.barTextcolor) + self.parent:writeText(anchx, anchy, getTextHorizontalAlign(self.barText, self.width, self.barTextAlign), self.barBackground, self.barTextcolor) else drawHelper.writeText(obx, oby, getTextHorizontalAlign(self.barText, self.width, self.barTextAlign), self.barBackground, self.barTextcolor) end