Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

Commit

Permalink
Bug Fixes. 1.2.3 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
oeed committed Jul 20, 2014
1 parent 96c4799 commit 65cf759
Show file tree
Hide file tree
Showing 14 changed files with 143 additions and 59 deletions.
4 changes: 2 additions & 2 deletions Programs/App Store.program/startup
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ end)
end
Drawing.DrawBlankArea(e.X+1,e.Y+1,e.Width,e.Height,colours.grey)
Drawing.DrawBlankArea(e.X,e.Y,e.Width,e.Height,colours.white)
Drawing.DrawCharacters(e.X+8,e.Y+1,e.Title,colours.black,colours.white)
Drawing.DrawCharacters(e.X+8,e.Y+1,tostring(e.Title),colours.black,colours.white)
if e.Type~=2 then
Drawing.DrawCharacters(e.X+8,e.Y+2,"by "..e.Author,colours.grey,colours.white)
Drawing.DrawCharacters(e.Width-8,e.Y+t-1," Install ",colours.white,colours.green)
Expand Down Expand Up @@ -284,7 +284,7 @@ elseif e.Type==2 then
t=1
end
for o,a in ipairs(e.Description)do
Drawing.DrawCharacters(e.X+8,e.Y+t+o,a,colours.lightGrey,colours.white)
Drawing.DrawCharacters(e.X+8,e.Y+t+o,tostring(a),colours.lightGrey,colours.white)
end
end,
Initialise=function(o,i,r,n,c,l,u,d,s,h,a,t)
Expand Down
88 changes: 87 additions & 1 deletion Programs/Ink.program/startup
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,93 @@ end
local s=function(e)
return e:gsub('['..string.char(14)..'-'..string.char(29)..']','')
end
OneOS.LoadAPI('System/API/Printer.lua')
Printer = {
Name = nil,
PeripheralType = 'printer',
paperLevel = function(self)
return Peripheral.CallNamed(self.Name, 'getPaperLevel')
end,
newPage = function(self)
return Peripheral.CallNamed(self.Name, 'newPage')
end,
endPage = function(self)
return Peripheral.CallNamed(self.Name, 'endPage')
end,
pageWrite = function(self, text)
return Peripheral.CallNamed(self.Name, 'write', text)
end,
setPageTitle = function(self, title)
return Peripheral.CallNamed(self.Name, 'setPageTitle', title)
end,
inkLevel = function(self)
return Peripheral.CallNamed(self.Name, 'getInkLevel')
end,
getCursorPos = function(self)
return Peripheral.CallNamed(self.Name, 'getCursorPos')
end,
setCursorPos = function(self, x, y)
return Peripheral.CallNamed(self.Name, 'setCursorPos', x, y)
end,
pageSize = function(self)
return Peripheral.CallNamed(self.Name, 'getPageSize')
end,
Present = function()
if Peripheral.GetPeripheral(Printer.PeripheralType) == nil then
return false
else
return true
end
end,
PrintLines = function(self, lines, title, copies)
local pages = {}
local pageLines = {}
for i, line in ipairs(lines) do
table.insert(pageLines, TextLine:Initialise(s(line)))
if i % 25 == 0 then
table.insert(pages, pageLines)
pageLines = {}
end
end
if #pageLines ~= 0 then
table.insert(pages, pageLines)
end
return self:PrintPages(pages, title, copies)
end,
PrintPages = function(self, pages, title, copies)
copies = copies or 1
for c = 1, copies do
for p, page in ipairs(pages) do
if self:paperLevel() < #pages * copies then
return 'Add more paper to the printer'
end
if self:inkLevel() < #pages * copies then
return 'Add more ink to the printer'
end
self:newPage()
for i, line in ipairs(page) do
self:setCursorPos(1, i)
self:pageWrite(s(line.Text))
end
if title then
self:setPageTitle(title)
end
self:endPage()
end
end
end,
Initialise = function(self, name)
if Printer.Present() then --fix
local new = {} -- the new instance
setmetatable( new, {__index = self} )
if name and Peripheral.PresentNamed(name) then
new.Name = name
else
new.Name = Peripheral.GetPeripheral(Printer.PeripheralType).Side
end
return new
end
end
}
Clipboard=OneOS.Clipboard
OneOS.LoadAPI('System/API/Drawing.lua')
Current={
Expand Down
2 changes: 1 addition & 1 deletion System/.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16075615E9
1.033768345E9
2 changes: 1 addition & 1 deletion System/API/Bedrock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ end

function ForceDraw(self)
if not self.DrawTimer or self.DrawTimerExpiry <= os.clock() then
self.DrawTimer = true
self.DrawTimer = self:StartTimer(function()
self.DrawTimer = nil
self:Draw()
Expand Down Expand Up @@ -600,7 +601,6 @@ function StartRepeatingTimer(self, func, interval)
return
end
local timer = os.startTimer(int)

self.Timers[timer] = {func, true, interval}
return timer
end
Expand Down
2 changes: 1 addition & 1 deletion System/API/Environment.lua
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ end

FS = function(env, program, path)
local function doIndex()
_G.indexTimer = os.startTimer(Indexer.FSIndexRate)
Current.Bedrock:StartTimer(Indexer.DoIndex, 4)
end
local relPath = Helpers.RemoveFileName(path)
local list = {}
Expand Down
5 changes: 5 additions & 0 deletions System/API/Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Defaults = {
Label = 'Startup Program',
Default = nil,
},
DoubleClick = {
Type = 'Bool',
Label = 'Double Click',
Default = false,
},
Monitor = {
Type = 'Side',
Label = 'Monitor Side',
Expand Down
4 changes: 2 additions & 2 deletions System/Objects/Button.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ OnDraw = function(self, x, y)
end
Drawing.DrawCharacters(x + _x, y, self.Text, txt, bg)

if self.Momentary and self.Toggle ~= false then
self.Bedrock:StartTimer(function()self.Toggle = false end,0.15)
if self.Momentary and self.Toggle then
local t = self.Bedrock:StartTimer(function()self.Toggle = false end,0.15)
end
end

Expand Down
17 changes: 16 additions & 1 deletion System/Objects/FileView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BackgroundColour = colours.transparent
Path = ''
Width = 10
Height = 4
ClickTime = nil

OnLoad = function(self)
self.Width = 10
Expand Down Expand Up @@ -38,7 +39,21 @@ OnLoad = function(self)
Name = 'ShortcutLabel'
})
end
local click = function(obj, event, side, x, y) self:OnClick(event, side, x, y, obj) end
local click = function(obj, event, side, x, y)
--local settings = OneOS.Settings or Settings
local setting = false
if OneOS then
setting = OneOS.Settings:GetValues()['DoubleClick']
else
setting = Settings:GetValues()['DoubleClick']
end
--s:GetValues()['DoubleClick']
if side == 1 and setting and (not self.ClickTime or os.clock() - self.ClickTime <= 0.5) then
self.ClickTime = os.clock()
else
self:OnClick(event, side, x, y, obj)
end
end

label.OnClick = click
image.OnClick = click
Expand Down
4 changes: 4 additions & 0 deletions System/Objects/Overlay.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ UpdateButtons = function(self)
if Current.Program then
if Current.Program.Environment.OneOS.ToolBarColor ~= colours.white then
self.BackgroundColour = Current.Program.Environment.OneOS.ToolBarColor
Current.Program.Environment.OneOS.ToolBarColour = Current.Program.Environment.OneOS.ToolBarColor
else
self.BackgroundColour = Current.Program.Environment.OneOS.ToolBarColour
Current.Program.Environment.OneOS.ToolBarColor = Current.Program.Environment.OneOS.ToolBarColour
end

if Current.Program.Environment.OneOS.ToolBarTextColor ~= colours.black then
self.TextColour = Current.Program.Environment.OneOS.ToolBarTextColor
Current.Program.Environment.OneOS.ToolBarTextColour = Current.Program.Environment.OneOS.ToolBarTextColor
else
self.TextColour = Current.Program.Environment.OneOS.ToolBarTextColour
Current.Program.Environment.OneOS.ToolBarTextColor = Current.Program.Environment.OneOS.ToolBarTextColour
end
else
self.BackgroundColour = colours.white
Expand Down
51 changes: 13 additions & 38 deletions System/Objects/ProgramView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ OnDraw = function(self, x, y)
if Current.Overlay and self.CachedProgram and self.CachedProgram.Environment and (Current.Program.Environment.OneOS.ToolBarColor ~= Current.Overlay.BackgroundColour or Current.Program.Environment.OneOS.ToolBarColour ~= Current.Overlay.BackgroundColour or Current.Program.Environment.OneOS.ToolBarTextColor ~= Current.Overlay.TextColour or Current.Program.Environment.OneOS.ToolBarTextColour ~= Current.Overlay.TextColour) then
UpdateOverlay()
end

self:DrawProgram(Current.Program, x, y)
self.CachedProgram = Current.Program
self.CachedIndex = currentIndex
Expand All @@ -139,15 +138,22 @@ OnDraw = function(self, x, y)
end

DrawAnimation = function(self)
self.Animation.Function(self.Animation.Count)
self.Animation.Count = self.Animation.Count - 1
if self.Animation.Count <= 0 then
if Settings:GetValues()['UseAnimations'] then
self.Animation.Function(self.Animation.Count)
self.Animation.Count = self.Animation.Count - 1
if self.Animation.Count <= 0 then
self.Animation = nil
self.CachedProgram = Current.Program
self.CachedIndex = currentIndex
end
self:ForceDraw()
else
self.Animation = nil
self.CachedProgram = Current.Program
self.CachedIndex = currentIndex
self:ForceDraw()
self.Bedrock:Draw()
end
self:ForceDraw()
--self.Bedrock:Draw()
end

DrawProgram = function(self, program, x, y)
Expand All @@ -173,35 +179,4 @@ OnKeyChar = function(self, event, keychar)
end

OnDrag = OnClick
OnScroll = OnClick


--[[
for i, program in ipairs(Current.Programs) do
if program == self then
table.remove(Current.Programs, i)
if Current.Programs[i] then
--Current.Program = Current.Programs[i]
Animation.SwipeProgram(self, Current.Programs[i], 1)
elseif Current.Programs[i-1] then
--Current.Program = Current.Programs[i-1]
Animation.SwipeProgram(self, Current.Programs[i-1], -1)
end
break
end
end
if Desktop then
Desktop:RefreshFiles()
UpdateOverlay()
if Current.Program then
Drawing.Clear(colours.black)
Drawing.DrawBuffer()
os.queueEvent('oneos_draw')
else
if Desktop then
--Desktop:Draw()
end
end
]]--
OnScroll = OnClick
4 changes: 2 additions & 2 deletions System/Programs/Files.program/startup
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ function NoFileClick(self, event, side, x, y)
end

program:GetObject('NewFolderMenuItem').OnClick = function(_item)
OneOS.Helpers.NewFolder(OneOS.Helpers.ParentFolder(item.Path)..'/', RefreshFiles, program)
OneOS.Helpers.NewFolder(Current.Path, RefreshFiles, program)
end

program:GetObject('NewFileMenuItem').OnClick = function(_item)
OneOS.Helpers.NewFile(OneOS.Helpers.ParentFolder(item.Path)..'/', RefreshFiles, program)
OneOS.Helpers.NewFile(Current.Path, RefreshFiles, program)
end

end
Expand Down
4 changes: 2 additions & 2 deletions System/Programs/Settings.program/startup
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ program:Run(function()
Y = startY,
Width = 23,
Text = value,
OnClick = function(self)
OneOS.Settings:SetValue(k, self.TextInput.Value)
OnChange = function(self)
OneOS.Settings:SetValue(k, settings[k].Control.Text)
end
})
elseif v.Type == 'Program' then
Expand Down
11 changes: 5 additions & 6 deletions System/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ bedrock.EventHandler = function(self)
end
local event = { os.pullEventRaw() }

-- local s = 'Event: '
-- for i, v in ipairs(event) do
-- s = s..tostring(v)..', '
-- end
-- Log.i(s)
local s = 'Event: '
for i, v in ipairs(event) do
s = s..tostring(v)..', '
end
Log.i(s)

if self.EventHandlers[event[1]] then
for i, e in ipairs(self.EventHandlers[event[1]]) do
Expand Down Expand Up @@ -116,7 +116,6 @@ function AnimateShutdown(restart, animate)
Drawing.Clear(colours.white)
Drawing.DrawBuffer()
sleep(0)
Log.i('out')
local x = 0
local y = 0
local w = 0
Expand Down
4 changes: 2 additions & 2 deletions startup
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ local function addFolder(path, input)
local _path = path .. '/' .. file
if fs.isDir(_path) then
input = addFolder(_path, input)
elseif file:sub(1,1) ~= '.' then
elseif file:sub(1,1) ~= '.' and not file:find('.log') then
input = addFile(_path, input)
end
end
Expand Down Expand Up @@ -674,7 +674,7 @@ elseif Start() then

local detailString = textutils.serialize(detail) ..'\n\n'

local h = fs.open('/System/OneOS.log')
local h = fs.open('/System/OneOS.log', 'r')
if h then
detailString = detailString .. 'Log:\n'..h.readAll()
h.close()
Expand Down

0 comments on commit 65cf759

Please sign in to comment.