test
This commit is contained in:
@@ -258,9 +258,9 @@ return function(name, parent, pTerm, basalt)
|
|||||||
|
|
||||||
setFocusedObject = function(self, obj)
|
setFocusedObject = function(self, obj)
|
||||||
if(self.parent~=nil)then
|
if(self.parent~=nil)then
|
||||||
--self:getBaseFrame():setFocusedObject(obj)
|
self.getBaseFrame():setFocusedObject(obj)
|
||||||
else
|
else
|
||||||
--focusedObjectCache = obj
|
focusedObjectCache = obj
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
@@ -775,7 +775,7 @@ return function(name, parent, pTerm, basalt)
|
|||||||
if(isMonitor)and not(monitorAttached)then return false end;
|
if(isMonitor)and not(monitorAttached)then return false end;
|
||||||
if (self:getVisualChanged()) then
|
if (self:getVisualChanged()) then
|
||||||
if (base.draw(self)) then
|
if (base.draw(self)) then
|
||||||
--[[if(self.parent==nil)then
|
if(self.parent==nil)then
|
||||||
local curObj = basalt.getFocusedObject()
|
local curObj = basalt.getFocusedObject()
|
||||||
basalt.setFocusedObject(focusedObjectCache)
|
basalt.setFocusedObject(focusedObjectCache)
|
||||||
if(focusedObjectCache~=nil)then
|
if(focusedObjectCache~=nil)then
|
||||||
@@ -786,7 +786,7 @@ return function(name, parent, pTerm, basalt)
|
|||||||
curObj:loseFocusHandler()
|
curObj:loseFocusHandler()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end]]
|
end
|
||||||
if(calculateDynValues)then
|
if(calculateDynValues)then
|
||||||
_recalculateDynamicValues()
|
_recalculateDynamicValues()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -681,7 +681,7 @@ return function(name)
|
|||||||
end
|
end
|
||||||
if(event~="mouse_drag")then
|
if(event~="mouse_drag")then
|
||||||
if (self.parent ~= nil)and(event~="mouse_up")then
|
if (self.parent ~= nil)and(event~="mouse_up")then
|
||||||
self.parent:setFocusedObject(self)
|
--self.parent:setFocusedObject(self)
|
||||||
elseif(self.parent == nil)and(event~="mouse_up")and(self:getType()=="Frame")then
|
elseif(self.parent == nil)and(event~="mouse_up")and(self:getType()=="Frame")then
|
||||||
--self:setFocusedObject(self)
|
--self:setFocusedObject(self)
|
||||||
end
|
end
|
||||||
|
|||||||
16
Basalt/libraries/logSystem.lua
Normal file
16
Basalt/libraries/logSystem.lua
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
local logDir = ""
|
||||||
|
local logFileName = "log.txt"
|
||||||
|
|
||||||
|
return {
|
||||||
|
setLogDir = function(dir)
|
||||||
|
logDir = dir
|
||||||
|
end,
|
||||||
|
|
||||||
|
setLogFileName = function(name)
|
||||||
|
logFileName = name
|
||||||
|
end,
|
||||||
|
|
||||||
|
__call = function()
|
||||||
|
--somelogs
|
||||||
|
end
|
||||||
|
}
|
||||||
@@ -1,3 +1,14 @@
|
|||||||
|
local splitString = function(str, sep)
|
||||||
|
if sep == nil then
|
||||||
|
sep = "%s"
|
||||||
|
end
|
||||||
|
local t={}
|
||||||
|
for v in string.gmatch(str, "([^"..sep.."]+)") do
|
||||||
|
table.insert(t, v)
|
||||||
|
end
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getTextHorizontalAlign = function(text, width, textAlign, replaceChar)
|
getTextHorizontalAlign = function(text, width, textAlign, replaceChar)
|
||||||
text = string.sub(text, 1, width)
|
text = string.sub(text, 1, width)
|
||||||
@@ -37,15 +48,23 @@ rpairs = function(t)
|
|||||||
end, t, #t + 1
|
end, t, #t + 1
|
||||||
end,
|
end,
|
||||||
|
|
||||||
splitString = function(str, sep)
|
splitString = splitString,
|
||||||
if sep == nil then
|
|
||||||
sep = "%s"
|
createText = function(msg, maxWidth)
|
||||||
|
local words = splitString(msg, " ")
|
||||||
|
local lines = {}
|
||||||
|
local line = ""
|
||||||
|
for k,v in pairs(words)do
|
||||||
|
if(#line+#v <= maxWidth)then
|
||||||
|
line = line=="" and v or line.." "..v
|
||||||
|
if(k==#words)then table.insert(lines, line) end
|
||||||
|
else
|
||||||
|
table.insert(lines, line)
|
||||||
|
line = v:sub(1,maxWidth)
|
||||||
|
if(k==#words)then table.insert(lines, line) end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local t={}
|
return lines
|
||||||
for v in string.gmatch(str, "([^"..sep.."]+)") do
|
|
||||||
table.insert(t, v)
|
|
||||||
end
|
|
||||||
return t
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
getValueFromXML = function(name, tab)
|
getValueFromXML = function(name, tab)
|
||||||
|
|||||||
@@ -98,9 +98,10 @@ return function(name)
|
|||||||
local splittedText = utils.splitString(self:getValue(), " ")
|
local splittedText = utils.splitString(self:getValue(), " ")
|
||||||
local text = {}
|
local text = {}
|
||||||
local line = ""
|
local line = ""
|
||||||
for _,v in pairs(splittedText)do
|
for k,v in pairs(splittedText)do
|
||||||
if(line:len()+v:len()<=w)then
|
if(line:len()+v:len()<=w)then
|
||||||
line = line=="" and v or line.." "..v
|
line = line=="" and v or line.." "..v
|
||||||
|
if(k==#splittedText)then table.insert(text, line) end
|
||||||
else
|
else
|
||||||
table.insert(text, line)
|
table.insert(text, line)
|
||||||
line = v:sub(1,w)
|
line = v:sub(1,w)
|
||||||
|
|||||||
@@ -147,6 +147,14 @@ return function(name)
|
|||||||
return self
|
return self
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
clear = function(self)
|
||||||
|
lines = {""}
|
||||||
|
bgLines = {""}
|
||||||
|
fgLines = {""}
|
||||||
|
hIndex, wIndex, textX, textY = 1, 1, 1, 1
|
||||||
|
return self
|
||||||
|
end,
|
||||||
|
|
||||||
addLine = function(self, text, index)
|
addLine = function(self, text, index)
|
||||||
if(text~=nil)then
|
if(text~=nil)then
|
||||||
if(#lines==1)and(lines[1]=="")then
|
if(#lines==1)and(lines[1]=="")then
|
||||||
|
|||||||
Reference in New Issue
Block a user