test
This commit is contained in:
@@ -258,9 +258,9 @@ return function(name, parent, pTerm, basalt)
|
||||
|
||||
setFocusedObject = function(self, obj)
|
||||
if(self.parent~=nil)then
|
||||
--self:getBaseFrame():setFocusedObject(obj)
|
||||
self.getBaseFrame():setFocusedObject(obj)
|
||||
else
|
||||
--focusedObjectCache = obj
|
||||
focusedObjectCache = obj
|
||||
end
|
||||
return self
|
||||
end;
|
||||
@@ -775,7 +775,7 @@ return function(name, parent, pTerm, basalt)
|
||||
if(isMonitor)and not(monitorAttached)then return false end;
|
||||
if (self:getVisualChanged()) then
|
||||
if (base.draw(self)) then
|
||||
--[[if(self.parent==nil)then
|
||||
if(self.parent==nil)then
|
||||
local curObj = basalt.getFocusedObject()
|
||||
basalt.setFocusedObject(focusedObjectCache)
|
||||
if(focusedObjectCache~=nil)then
|
||||
@@ -786,7 +786,7 @@ return function(name, parent, pTerm, basalt)
|
||||
curObj:loseFocusHandler()
|
||||
end
|
||||
end
|
||||
end]]
|
||||
end
|
||||
if(calculateDynValues)then
|
||||
_recalculateDynamicValues()
|
||||
end
|
||||
|
||||
@@ -681,7 +681,7 @@ return function(name)
|
||||
end
|
||||
if(event~="mouse_drag")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
|
||||
--self:setFocusedObject(self)
|
||||
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 {
|
||||
getTextHorizontalAlign = function(text, width, textAlign, replaceChar)
|
||||
text = string.sub(text, 1, width)
|
||||
@@ -37,15 +48,23 @@ rpairs = function(t)
|
||||
end, t, #t + 1
|
||||
end,
|
||||
|
||||
splitString = function(str, sep)
|
||||
if sep == nil then
|
||||
sep = "%s"
|
||||
splitString = splitString,
|
||||
|
||||
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
|
||||
local t={}
|
||||
for v in string.gmatch(str, "([^"..sep.."]+)") do
|
||||
table.insert(t, v)
|
||||
end
|
||||
return t
|
||||
return lines
|
||||
end,
|
||||
|
||||
getValueFromXML = function(name, tab)
|
||||
|
||||
@@ -98,9 +98,10 @@ return function(name)
|
||||
local splittedText = utils.splitString(self:getValue(), " ")
|
||||
local text = {}
|
||||
local line = ""
|
||||
for _,v in pairs(splittedText)do
|
||||
for k,v in pairs(splittedText)do
|
||||
if(line:len()+v:len()<=w)then
|
||||
line = line=="" and v or line.." "..v
|
||||
if(k==#splittedText)then table.insert(text, line) end
|
||||
else
|
||||
table.insert(text, line)
|
||||
line = v:sub(1,w)
|
||||
|
||||
@@ -147,6 +147,14 @@ return function(name)
|
||||
return self
|
||||
end;
|
||||
|
||||
clear = function(self)
|
||||
lines = {""}
|
||||
bgLines = {""}
|
||||
fgLines = {""}
|
||||
hIndex, wIndex, textX, textY = 1, 1, 1, 1
|
||||
return self
|
||||
end,
|
||||
|
||||
addLine = function(self, text, index)
|
||||
if(text~=nil)then
|
||||
if(#lines==1)and(lines[1]=="")then
|
||||
|
||||
Reference in New Issue
Block a user