├── r ├── Desktop ├── Programs.shortcut ├── Ink.shortcut ├── LuaIDE.shortcut ├── Shell.shortcut ├── Sketch.shortcut ├── Files.shortcut ├── App Store.shortcut ├── Door Lock.shortcut ├── Settings ├── Documents │ ├── .FolderIcon │ └── Welcome!.txt └── .FolderIcon ├── Favourites ├── Desktop ├── Programs ├── Documents └── .FolderIcon ├── Programs ├── Files ├── Settings ├── .FolderIcon ├── Shell.program │ └── icon ├── App Store.program │ ├── APIs │ │ ├── JSON.lua │ │ └── App.lua │ ├── icon │ ├── Objects │ │ ├── LoadingIndicator.lua │ │ ├── CategoryPageView.lua │ │ ├── AppCollectionView.lua │ │ ├── CategoriesPageView.lua │ │ ├── SearchResultsPageView.lua │ │ ├── AppView.lua │ │ ├── SearchPageView.lua │ │ ├── HomePageView.lua │ │ ├── InstallPageView.lua │ │ ├── AppDetailsView.lua │ │ └── PageView.lua │ ├── Views │ │ └── main.view │ └── startup ├── Ink.program │ ├── Icons │ │ ├── ink │ │ ├── text │ │ ├── txt │ │ └── license │ └── icon ├── LuaIDE.program │ ├── icon │ ├── Icons │ │ ├── lua │ │ ├── startup │ │ └── log │ └── .LuaIDE-Theme ├── Sketch.program │ ├── icon │ ├── Icons │ │ ├── nfp │ │ ├── nft │ │ ├── skch │ │ └── foldericon │ ├── Resources │ │ ├── filterPreview.nft │ │ ├── square.nft │ │ └── circle.nft │ ├── Objects │ │ ├── FiltersWindow.lua │ │ ├── ToolsWindow.lua │ │ ├── ColourView.lua │ │ ├── Sidebar.lua │ │ ├── BrushWindow.lua │ │ ├── ColoursWindow.lua │ │ ├── InfoWindow.lua │ │ ├── FilterPreview.lua │ │ ├── SidebarButton.lua │ │ ├── NumberBox.lua │ │ ├── LayersWindow.lua │ │ ├── SnapWindow.lua │ │ └── LayerView.lua │ ├── Views │ │ ├── layerswindow.view │ │ ├── main.view │ │ ├── layermenu.view │ │ ├── viewmenu.view │ │ ├── brushwindow.view │ │ ├── editmenu.view │ │ ├── sizepresetmenu.view │ │ ├── filemenu.view │ │ ├── sidebar.view │ │ ├── imagemenu.view │ │ ├── toolswindow.view │ │ ├── filterswindow.view │ │ ├── toolsmenu.view │ │ ├── toolbar.view │ │ ├── resizewindow.view │ │ ├── saveasformatwindow.view │ │ ├── infowindow.view │ │ ├── canvassizewindow.view │ │ ├── colourswindow.view │ │ └── newdocumentwindow.view │ └── APIs │ │ ├── SelectTool.lua │ │ ├── MoveTool.lua │ │ ├── HandTool.lua │ │ ├── EraserTool.lua │ │ ├── Clipboard.lua │ │ ├── PencilTool.lua │ │ ├── TextTool.lua │ │ ├── SprayTool.lua │ │ └── FillTool.lua ├── Door Lock.program │ └── icon └── Transmit.program │ ├── icon │ ├── Images │ ├── computer │ ├── anm0 │ ├── anm1 │ ├── anm3 │ ├── logo │ ├── anm2 │ └── disabled │ ├── Views │ ├── discover.view │ └── message.view │ └── Objects │ └── DiscoverView.lua ├── System ├── .FolderIcon ├── Resources │ ├── Icons │ │ ├── program │ │ ├── unknown │ │ ├── folder │ │ ├── bundle │ │ └── settings │ ├── crash │ └── logo.nft ├── Objects │ ├── FileIcon.lua │ ├── FilterView.lua │ ├── FilterLabel.lua │ ├── FilterTextbox.lua │ └── Switcher.lua ├── Programs │ ├── Setup.program │ │ ├── Objects │ │ │ ├── 0PageView.lua │ │ │ ├── FilterView.lua │ │ │ ├── ColourPicker.lua │ │ │ ├── 1PageView.lua │ │ │ ├── 4PageView.lua │ │ │ ├── 3PageView.lua │ │ │ ├── 2PageView.lua │ │ │ └── PageView.lua │ │ ├── APIs │ │ │ ├── System.lua │ │ │ └── Settings.lua │ │ ├── Resources │ │ │ └── logo.nft │ │ ├── Views │ │ │ ├── main.view │ │ │ ├── 2.view │ │ │ ├── 1.view │ │ │ ├── 4.view │ │ │ ├── 3.view │ │ │ └── 0.view │ │ └── startup │ ├── Update.program │ │ ├── APIs │ │ │ ├── JSON.lua │ │ │ ├── System.lua │ │ │ ├── Settings.lua │ │ │ └── GitHub.lua │ │ ├── Objects │ │ │ ├── FilterView.lua │ │ │ └── LoadingIndicator.lua │ │ ├── Views │ │ │ ├── main.view │ │ │ └── error.view │ │ └── startup │ ├── Files.program │ │ ├── icon │ │ ├── Objects │ │ │ └── FileIcon.lua │ │ ├── Views │ │ │ ├── bgmenu.view │ │ │ ├── main.view │ │ │ └── filemenu.view │ │ └── pkgmake │ ├── Settings.program │ │ ├── Objects │ │ │ ├── AboutPageView.lua │ │ │ ├── ColourPicker.lua │ │ │ ├── PageView.lua │ │ │ ├── AppearancePageView.lua │ │ │ ├── Switch.lua │ │ │ ├── SystemPageView.lua │ │ │ └── StoragePageView.lua │ │ ├── Resources │ │ │ └── logo.nft │ │ ├── icon │ │ ├── Views │ │ │ ├── appearance.view │ │ │ ├── about.view │ │ │ ├── storage.view │ │ │ ├── main.view │ │ │ └── system.view │ │ └── startup │ ├── Unpackager.program │ │ ├── Icons │ │ │ └── pkg │ │ ├── Views │ │ │ └── main.view │ │ └── startup │ └── Desktop.program │ │ ├── Objects │ │ ├── FileIcon.lua │ │ ├── FilterView.lua │ │ ├── FilterLabel.lua │ │ ├── FilterTextBox.lua │ │ └── SearchView.lua │ │ └── Views │ │ ├── desktopmenu.view │ │ ├── filemenu.view │ │ └── main.view ├── Views │ ├── switcher-controls.view │ ├── switcher-controls-pocket.view │ ├── main.view │ └── switcher.view ├── APIs │ ├── Log.lua │ ├── Settings.lua │ ├── Clipboard.lua │ ├── Indexer.lua │ └── FileSystem.lua ├── Shared Objects │ ├── ColourPicker.lua │ ├── FilterLabel.lua │ ├── FilterView.lua │ ├── FileIcon.lua │ └── FilterTextBox.lua ├── main.lua └── API │ └── Bootstrap.lua ├── .gitignore ├── startup ├── LICENSE └── README.md /r: -------------------------------------------------------------------------------- 1 | os.reboot() 2 | -------------------------------------------------------------------------------- /Desktop/Programs.shortcut: -------------------------------------------------------------------------------- 1 | /Programs/ -------------------------------------------------------------------------------- /Favourites/Desktop: -------------------------------------------------------------------------------- 1 | ALIAS/Desktop/ -------------------------------------------------------------------------------- /Favourites/Programs: -------------------------------------------------------------------------------- 1 | ALIAS/Programs/ -------------------------------------------------------------------------------- /Desktop/Ink.shortcut: -------------------------------------------------------------------------------- 1 | /Programs/Ink.program/ -------------------------------------------------------------------------------- /Desktop/LuaIDE.shortcut: -------------------------------------------------------------------------------- 1 | /Programs/LuaIDE.program/ -------------------------------------------------------------------------------- /Desktop/Shell.shortcut: -------------------------------------------------------------------------------- 1 | /Programs/Shell.program/ -------------------------------------------------------------------------------- /Desktop/Sketch.shortcut: -------------------------------------------------------------------------------- 1 | /Programs/Sketch.program/ -------------------------------------------------------------------------------- /Favourites/Documents: -------------------------------------------------------------------------------- 1 | ALIAS/Desktop/Documents/ -------------------------------------------------------------------------------- /Desktop/Files.shortcut: -------------------------------------------------------------------------------- 1 | /System/Programs/Files.program/ -------------------------------------------------------------------------------- /Programs/Files: -------------------------------------------------------------------------------- 1 | ALIAS/System/Programs/Files.program/ -------------------------------------------------------------------------------- /Desktop/App Store.shortcut: -------------------------------------------------------------------------------- 1 | /Programs/App Store.program/ -------------------------------------------------------------------------------- /Desktop/Door Lock.shortcut: -------------------------------------------------------------------------------- 1 | /Programs/Door Lock.program/ -------------------------------------------------------------------------------- /Desktop/Settings: -------------------------------------------------------------------------------- 1 | ALIAS/System/Programs/Settings.program/ -------------------------------------------------------------------------------- /Programs/Settings: -------------------------------------------------------------------------------- 1 | ALIAS/System/Programs/Settings.program/ -------------------------------------------------------------------------------- /Desktop/Documents/.FolderIcon: -------------------------------------------------------------------------------- 1 | 4  2 | 4 3 | 41Docs -------------------------------------------------------------------------------- /Programs/.FolderIcon: -------------------------------------------------------------------------------- 1 | 3b>f  2 | 3f 3 | 3bProg 4 | -------------------------------------------------------------------------------- /Programs/Shell.program/icon: -------------------------------------------------------------------------------- 1 | f4>0_ 2 | f 3 | f -------------------------------------------------------------------------------- /System/.FolderIcon: -------------------------------------------------------------------------------- 1 | 7e!! f 2 | 7f 3 | 71Syst 4 | -------------------------------------------------------------------------------- /Desktop/.FolderIcon: -------------------------------------------------------------------------------- 1 | 08---- 2 | 9e#5#b#4# 3 | 91#2#f 4 | -------------------------------------------------------------------------------- /Favourites/.FolderIcon: -------------------------------------------------------------------------------- 1 | 14** f 2 | 1f 3 | 14Favs 4 | -------------------------------------------------------------------------------- /Programs/App Store.program/APIs/JSON.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/APIs/JSON.lua -------------------------------------------------------------------------------- /Programs/Ink.program/Icons/ink: -------------------------------------------------------------------------------- 1 | 0bink7 2 | 07---- 3 | 07---- -------------------------------------------------------------------------------- /Programs/Ink.program/Icons/text: -------------------------------------------------------------------------------- 1 | 07text 2 | 07---- 3 | 07---- -------------------------------------------------------------------------------- /Programs/Ink.program/Icons/txt: -------------------------------------------------------------------------------- 1 | 07text 2 | 07---- 3 | 07---- -------------------------------------------------------------------------------- /Programs/LuaIDE.program/icon: -------------------------------------------------------------------------------- 1 | 73Lua 2 | 7eIDE 3 | 7 -------------------------------------------------------------------------------- /Programs/Sketch.program/icon: -------------------------------------------------------------------------------- 1 | bf 2 | b0 Sk 3 | bf 4 | -------------------------------------------------------------------------------- /System/Resources/Icons/program: -------------------------------------------------------------------------------- 1 | f4>_ 2 | f4prog 3 | f -------------------------------------------------------------------------------- /System/Resources/Icons/unknown: -------------------------------------------------------------------------------- 1 | 08---- 2 | 08---- 3 | 08---- -------------------------------------------------------------------------------- /System/Resources/crash: -------------------------------------------------------------------------------- 1 | 0 0 2 | 3 | 00000 4 | 0 0 -------------------------------------------------------------------------------- /Programs/App Store.program/icon: -------------------------------------------------------------------------------- 1 | 3f 2 | 3f 0ASf 3 | 3f -------------------------------------------------------------------------------- /Programs/Ink.program/Icons/license: -------------------------------------------------------------------------------- 1 | 0bblah 2 | 07blah 3 | 08blah 4 | -------------------------------------------------------------------------------- /Programs/Ink.program/icon: -------------------------------------------------------------------------------- 1 | 7f|0bInk 2 | 7b 08--- 3 | 7f|08--- -------------------------------------------------------------------------------- /Programs/LuaIDE.program/Icons/lua: -------------------------------------------------------------------------------- 1 | 0blua7 2 | 07---- 3 | 07---- -------------------------------------------------------------------------------- /Programs/LuaIDE.program/Icons/startup: -------------------------------------------------------------------------------- 1 | f4>_ 2 | f4prog 3 | f -------------------------------------------------------------------------------- /Programs/Sketch.program/Icons/nfp: -------------------------------------------------------------------------------- 1 | 4f 3bnfp 2 | 3f d 3 | df -------------------------------------------------------------------------------- /Programs/Sketch.program/Icons/nft: -------------------------------------------------------------------------------- 1 | 4f 3bnft 2 | 3f d 3 | df -------------------------------------------------------------------------------- /Programs/Sketch.program/Icons/skch: -------------------------------------------------------------------------------- 1 | 3bskch 2 | 3f d 3 | df -------------------------------------------------------------------------------- /System/Objects/FileIcon.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FileIcon.lua -------------------------------------------------------------------------------- /System/Objects/FilterView.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FilterView.lua -------------------------------------------------------------------------------- /System/Programs/Setup.program/Objects/0PageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' -------------------------------------------------------------------------------- /System/Programs/Update.program/APIs/JSON.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/APIs/JSON.lua -------------------------------------------------------------------------------- /System/Resources/Icons/folder: -------------------------------------------------------------------------------- 1 | 4f  2 | 4f 3 | 41Fldr 4 | -------------------------------------------------------------------------------- /Programs/Door Lock.program/icon: -------------------------------------------------------------------------------- 1 | 1f 0|=f 2 | 1f 0|f 3 | 10 @f -------------------------------------------------------------------------------- /Programs/LuaIDE.program/Icons/log: -------------------------------------------------------------------------------- 1 | 01log7 2 | 07---- 3 | 07---- 4 | -------------------------------------------------------------------------------- /Programs/Sketch.program/Resources/filterPreview.nft: -------------------------------------------------------------------------------- 1 | 3f 4 2 | df 3 | -------------------------------------------------------------------------------- /Programs/Transmit.program/icon: -------------------------------------------------------------------------------- 1 | 77 2 | 0c\7 c/ 3 | 0f 14 0f -------------------------------------------------------------------------------- /System/Objects/FilterLabel.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FilterLabel.lua -------------------------------------------------------------------------------- /System/Programs/Files.program/icon: -------------------------------------------------------------------------------- 1 | b 3. 3 b, 2 | b 3 3 | b 3 -------------------------------------------------------------------------------- /System/Programs/Setup.program/APIs/System.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/APIs/System.lua -------------------------------------------------------------------------------- /System/Programs/Update.program/APIs/System.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/APIs/System.lua -------------------------------------------------------------------------------- /System/Resources/Icons/bundle: -------------------------------------------------------------------------------- 1 | 1f c:f 2 | 1f c:f 3 | 1cBndl 4 | -------------------------------------------------------------------------------- /System/Resources/Icons/settings: -------------------------------------------------------------------------------- 1 | 08007180 2 | 08071180 3 | 07180071 -------------------------------------------------------------------------------- /Programs/Sketch.program/Icons/foldericon: -------------------------------------------------------------------------------- 1 | 4f 3bico 2 | 3f d 3 | df -------------------------------------------------------------------------------- /Programs/Sketch.program/Resources/square.nft: -------------------------------------------------------------------------------- 1 | 7f 2 | 7f 3 | 7f 4 | -------------------------------------------------------------------------------- /System/Objects/FilterTextbox.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FilterTextbox.lua -------------------------------------------------------------------------------- /System/Programs/Setup.program/APIs/Settings.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/APIs/Settings.lua -------------------------------------------------------------------------------- /System/Programs/Setup.program/Resources/logo.nft: -------------------------------------------------------------------------------- 1 | ALIAS/System/Resources/logo.nft -------------------------------------------------------------------------------- /System/Programs/Update.program/APIs/Settings.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/APIs/Settings.lua -------------------------------------------------------------------------------- /System/Programs/Settings.program/Objects/AboutPageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | -------------------------------------------------------------------------------- /System/Programs/Settings.program/Resources/logo.nft: -------------------------------------------------------------------------------- 1 | ALIAS/System/Resources/logo.nft -------------------------------------------------------------------------------- /System/Programs/Files.program/Objects/FileIcon.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FileIcon.lua -------------------------------------------------------------------------------- /System/Programs/Settings.program/icon: -------------------------------------------------------------------------------- 1 | 8f 7 8 7 2 | 8f 7 8 3 | 8f 7 8 4 | -------------------------------------------------------------------------------- /System/Programs/Unpackager.program/Icons/pkg: -------------------------------------------------------------------------------- 1 | 1f cp|f 2 | 1f ck|f 3 | 1f cg|f -------------------------------------------------------------------------------- /Programs/Sketch.program/Resources/circle.nft: -------------------------------------------------------------------------------- 1 |  7 7f  7 2 | 7f 3 |  7 7f  7 4 | -------------------------------------------------------------------------------- /System/Programs/Desktop.program/Objects/FileIcon.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FileIcon.lua -------------------------------------------------------------------------------- /System/Programs/Desktop.program/Objects/FilterView.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FilterView.lua -------------------------------------------------------------------------------- /System/Programs/Setup.program/Objects/FilterView.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FilterView.lua -------------------------------------------------------------------------------- /System/Programs/Update.program/Objects/FilterView.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FilterView.lua -------------------------------------------------------------------------------- /System/Resources/logo.nft: -------------------------------------------------------------------------------- 1 | bf 3 2 | bf 3 3 | bf 3 4 | b0OneOS3f 5 | -------------------------------------------------------------------------------- /System/Programs/Desktop.program/Objects/FilterLabel.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FilterLabel.lua -------------------------------------------------------------------------------- /System/Programs/Settings.program/Objects/ColourPicker.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/ColourPicker.lua -------------------------------------------------------------------------------- /System/Programs/Setup.program/Objects/ColourPicker.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/ColourPicker.lua -------------------------------------------------------------------------------- /Programs/Transmit.program/Images/computer: -------------------------------------------------------------------------------- 1 | 4f 2 | 4f f4>0_f 4 3 | 4f f 4 4 | 4f - -------------------------------------------------------------------------------- /System/Programs/Desktop.program/Objects/FilterTextBox.lua: -------------------------------------------------------------------------------- 1 | ALIAS/System/Shared Objects/FilterTextbox.lua -------------------------------------------------------------------------------- /System/Programs/Update.program/Objects/LoadingIndicator.lua: -------------------------------------------------------------------------------- 1 | ALIAS/Programs/App Store.program/Objects/LoadingIndicator.lua -------------------------------------------------------------------------------- /Programs/Transmit.program/Images/anm0: -------------------------------------------------------------------------------- 1 |  f 7  2 |  f 7  7  3 | 7f  7  7 4 |  f 7  7  5 |  f e  -------------------------------------------------------------------------------- /Programs/Transmit.program/Images/anm1: -------------------------------------------------------------------------------- 1 |  f 7  2 |  f 7  7  3 | 7f  e  7 4 |  f e  e  5 |  f 7  -------------------------------------------------------------------------------- /Programs/Transmit.program/Images/anm3: -------------------------------------------------------------------------------- 1 |  f 7  2 |  f 7  7  3 | 7f  7  7 4 |  f 7  7  5 |  f 7  -------------------------------------------------------------------------------- /Programs/Transmit.program/Images/logo: -------------------------------------------------------------------------------- 1 |  f e  2 |  f e  e  3 | ef  e  e 4 |  f e  e  5 |  f e  -------------------------------------------------------------------------------- /Programs/Transmit.program/Images/anm2: -------------------------------------------------------------------------------- 1 |  f e  2 |  f e  e  3 | ef  7  7 f e 4 |  f 7 7f  7  5 |  f 7  -------------------------------------------------------------------------------- /System/Views/switcher-controls.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 1, 5 | Y = 1, 6 | Type = 'Button', 7 | Text = 'Shutdown' 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /Programs/Transmit.program/Images/disabled: -------------------------------------------------------------------------------- 1 | ef 7 e 2 |  f 7 e  e 7  3 | 7f  7 e 7  7 4 |  f e  e  5 | ef  7  e -------------------------------------------------------------------------------- /Desktop/Documents/Welcome!.txt: -------------------------------------------------------------------------------- 1 | Hello and welcome to OneOS! If you have any problems, find a bug or have a suggestion let me (oeed) know on the ComputerCraft forums! 2 | 3 | Thanks for using OneOS! -------------------------------------------------------------------------------- /System/Programs/Settings.program/Objects/PageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'ScrollView' 2 | 3 | OnLoad = function(self) 4 | ScrollView.OnLoad(self) 5 | 6 | if self.OnPageLoad then 7 | self:OnPageLoad() 8 | end 9 | end -------------------------------------------------------------------------------- /System/Programs/Setup.program/Objects/1PageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnNext = function(self) 4 | local text = self:GetObject('NameTextBox').Text 5 | os.setComputerLabel((#text ~= 0 and text or nil)) 6 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/FiltersWindow.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'SnapWindow' 2 | ContentViewName = 'filterswindow' 3 | 4 | Title = 'Filters' 5 | 6 | OnContentLoad = function(self) 7 | self:GetObject('ScrollView'):UpdateScroll() 8 | end -------------------------------------------------------------------------------- /System/Programs/Setup.program/Objects/4PageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnNext = function(self) 4 | for k, v in pairs(self.Bedrock.SettingsValues) do 5 | self.Bedrock.Settings[k] = v 6 | end 7 | 8 | System.AnimateShutdown(true, true) 9 | end -------------------------------------------------------------------------------- /System/Programs/Setup.program/Views/main.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 4, 5 | Y = 3, 6 | Width = '100%,-4', 7 | Height = '100%,-3', 8 | Type = 'FilterView', 9 | FilterName = 'Darker' 10 | }, 11 | }, 12 | BackgroundColour = 'lightGrey', 13 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/layerswindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=20, 3 | ["Height"]=9, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=1, 8 | ["X"]=1, 9 | ["Width"]="100%", 10 | ["Height"]="100%", 11 | ["Type"]="ScrollView", 12 | ["Children"]={ 13 | } 14 | } 15 | }, 16 | } -------------------------------------------------------------------------------- /System/Programs/Unpackager.program/Views/main.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 1, 5 | Y = '50%', 6 | Width = '100%', 7 | Align = 'Center', 8 | Text = 'Extracting Package...', 9 | Type = 'Label', 10 | TextColour = 'blue' 11 | }, 12 | }, 13 | BackgroundColour = 'white', 14 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .Desktop.settings 3 | .OneOS.settings 4 | *.settings 5 | 6 | Desktop/.Desktop.settings 7 | 8 | .version 9 | 10 | *.settings 11 | 12 | Desktop/.Desktop.settings 13 | 14 | Programs/Quest 15 | 16 | System/.OneOS.settings 17 | 18 | System/.OneOS.settings 19 | 20 | Changes 21 | 22 | System/.fingerprint 23 | 24 | dorelease 25 | 26 | System/main-old.lua 27 | 28 | System/OneOS.log 29 | -------------------------------------------------------------------------------- /System/Programs/Setup.program/Objects/3PageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnPageLoad = function(self) 4 | self:GetObject('NoButton').OnClick = function() 5 | self.Bedrock.SettingsValues.UseAnimations = false 6 | self.Bedrock:NextPage() 7 | end 8 | 9 | self:GetObject('YesButton').OnClick = function() 10 | self.Bedrock.SettingsValues.UseAnimations = true 11 | self.Bedrock:NextPage() 12 | end 13 | end -------------------------------------------------------------------------------- /System/Programs/Setup.program/Objects/2PageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnPageLoad = function(self) 4 | self:GetObject('DesktopColourPicker').OnChange = function() 5 | self.Bedrock.View.BackgroundColour = self:GetObject('DesktopColourPicker').ActiveColour 6 | end 7 | end 8 | 9 | OnNext = function(self) 10 | self.Bedrock.SettingsValues.DesktopColour = self:GetObject('DesktopColourPicker').ActiveColour 11 | end -------------------------------------------------------------------------------- /Programs/LuaIDE.program/.LuaIDE-Theme: -------------------------------------------------------------------------------- 1 | background=gray 2 | backgroundHighlight=lightGray 3 | prompt=cyan 4 | promptHighlight=lightBlue 5 | err=red 6 | errHighlight=pink 7 | 8 | editorBackground=gray 9 | editorLineHightlight=lightBlue 10 | editorLineNumbers=gray 11 | editorLineNumbersHighlight=lightGray 12 | editorError=pink 13 | editorErrorHighlight=red 14 | 15 | textColor=white 16 | conditional=yellow 17 | constant=orange 18 | function=magenta 19 | string=red 20 | comment=lime -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/ToolsWindow.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'SnapWindow' 2 | ContentViewName = 'toolswindow' 3 | 4 | Title = 'Tools' 5 | 6 | OnContentLoad = function(self) 7 | local buttons = self:GetObjects('ToolButton') 8 | for i, button in ipairs(buttons) do 9 | button.OnClick = function(_self, event, side, x , y) 10 | local artboard = self.Bedrock:GetObject('Artboard') 11 | if artboard then 12 | artboard:SetTool(getfenv()[button.ToolName]) 13 | end 14 | end 15 | end 16 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/APIs/SelectTool.lua: -------------------------------------------------------------------------------- 1 | Name = 'Select' 2 | 3 | OnUse = function(artboard, event, side, x, y) 4 | if event == 'mouse_click' then 5 | artboard.Selection = { 6 | { 7 | X = x, 8 | Y = y 9 | }, 10 | nil 11 | } 12 | elseif event == 'mouse_drag' then 13 | if artboard.Selection and artboard.Selection[1] then 14 | artboard.Selection = { 15 | artboard.Selection[1], 16 | { 17 | X = x, 18 | Y = y 19 | } 20 | } 21 | end 22 | end 23 | end -------------------------------------------------------------------------------- /System/Programs/Desktop.program/Views/desktopmenu.view: -------------------------------------------------------------------------------- 1 | { 2 | Type = 'Menu', 3 | Children = { 4 | { 5 | Name = 'NewFileMenuItem', 6 | Type = 'MenuItem', 7 | Text = 'New File...' 8 | }, 9 | { 10 | Name = 'NewFolderMenuItem', 11 | Type = 'MenuItem', 12 | Text = 'New Folder...' 13 | }, 14 | { 15 | Type = 'Separator' 16 | }, 17 | { 18 | Name = 'RefreshMenuItem', 19 | Type = 'MenuItem', 20 | Text = 'Refresh' 21 | }, 22 | }, 23 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/APIs/MoveTool.lua: -------------------------------------------------------------------------------- 1 | Name = 'Move' 2 | 3 | OnUse = function(artboard, event, side, x, y) 4 | if event == 'mouse_click' then 5 | artboard.MoveHandle = { 6 | X = x, 7 | Y = y 8 | } 9 | elseif event == 'mouse_drag' then 10 | if artboard.MoveHandle and artboard.MoveHandle.X and artboard.MoveHandle.Y then 11 | artboard:GetCurrentLayer():Move(x - artboard.MoveHandle.X, y - artboard.MoveHandle.Y) 12 | artboard.MoveHandle = { 13 | X = x, 14 | Y = y 15 | } 16 | end 17 | end 18 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/main.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Children"]={ 3 | [1]={ 4 | ["Y"]=1, 5 | ["X"]=1, 6 | ["Name"]="Toolbar", 7 | ["Type"]="View", 8 | ["InheritView"]="toolbar" 9 | }, 10 | [2]={ 11 | ["Y"]=2, 12 | ["X"]="100%,-2", 13 | ["Type"]="Sidebar", 14 | ["InheritView"]="sidebar", 15 | ["Height"]="100%,-1", 16 | ["Width"]=3 17 | }, 18 | }, 19 | ["BackgroundColour"]=32768, 20 | ["ToolBarColour"]=128, 21 | ["ToolBarTextColour"]=1 22 | } -------------------------------------------------------------------------------- /startup: -------------------------------------------------------------------------------- 1 | -- Comment out these lines if you *really* want to try OneOS in TLCO 2 | dofile('/System/API/Bootstrap.lua') 3 | do return end 4 | 5 | -- TLCO 6 | os.queueEvent("modem_message") 7 | local r = rednet.run 8 | function rednet.run() 9 | error("", 0) 10 | end 11 | 12 | local s = shell 13 | local p = printError 14 | function _G.printError() 15 | _G.printError = p 16 | _G.shell = s 17 | rednet.run = r 18 | local ok, err = pcall(function() dofile('/System/API/Bootstrap.lua') end) 19 | if not ok then printError(err) end 20 | end -------------------------------------------------------------------------------- /System/Programs/Settings.program/Objects/AppearancePageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnPageLoad = function(self) 4 | self:GetObject('DesktopBackgroundColourPicker').ActiveColour = OneOS.System.Settings.DesktopColour 5 | 6 | self:GetObject('DesktopBackgroundColourPicker').OnChange = function(_, value) 7 | OneOS.System.Settings.DesktopColour = value 8 | end 9 | self:GetObject('UseAnimationsSwitch').Toggle = OneOS.System.Settings.UseAnimations 10 | 11 | self:GetObject('UseAnimationsSwitch').OnChange = function(_, value) 12 | OneOS.System.Settings.UseAnimations = value 13 | end 14 | end -------------------------------------------------------------------------------- /System/Programs/Setup.program/Objects/PageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'ScrollView' 2 | 3 | OnLoad = function(self) 4 | ScrollView.OnLoad(self) 5 | 6 | local back = self:GetObject('BackButton') 7 | 8 | if back then 9 | back.OnClick = function() 10 | self.Bedrock:PreviousPage() 11 | end 12 | end 13 | 14 | 15 | local next = self:GetObject('NextButton') 16 | if next then 17 | next.OnClick = function() 18 | if self.OnNext then 19 | self:OnNext() 20 | end 21 | 22 | self.Bedrock:NextPage() 23 | end 24 | end 25 | 26 | if self.OnPageLoad then 27 | self:OnPageLoad() 28 | end 29 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/ColourView.lua: -------------------------------------------------------------------------------- 1 | OnDraw = function(self, x, y) 2 | if self.BackgroundColour ~= colours.transparent then 3 | Drawing.DrawBlankArea(x, y, self.Width, self.Height, self.BackgroundColour) 4 | else 5 | for _x = 1, self.Width do 6 | local odd = (_x % 2) == 0 7 | for _y = 1, self.Height do 8 | if odd then 9 | Drawing.WriteToBuffer(x + _x - 1, y + _y - 1, ":", colours.lightGrey, colours.white) 10 | else 11 | Drawing.WriteToBuffer(x + _x - 1, y + _y - 1, ":", colours.white, colours.lightGrey) 12 | end 13 | odd = not odd 14 | end 15 | end 16 | end 17 | end -------------------------------------------------------------------------------- /System/APIs/Log.lua: -------------------------------------------------------------------------------- 1 | Initialise = function() 2 | local h = fs.open('/System/OneOS.log', 'w') 3 | h.write('-- OneOS Log --\n') 4 | h.close() 5 | end 6 | 7 | log = function(msg, state) 8 | state = state or '' 9 | if state ~= '' then 10 | state = ' '..state 11 | end 12 | local h = fs.open('/System/OneOS.log', 'a') 13 | h.write('['..os.clock()..state..'] '..tostring(msg) .. '\n') 14 | h.close() 15 | end 16 | 17 | Errors = {} 18 | 19 | e = function(msg) 20 | table.insert(Errors, 1, msg) 21 | log(msg, 'Error') 22 | end 23 | 24 | i = function(msg) 25 | log(msg, 'Info') 26 | end 27 | 28 | w = function(msg) 29 | log(msg, 'Warning') 30 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/APIs/HandTool.lua: -------------------------------------------------------------------------------- 1 | Name = 'Hand' 2 | 3 | OnUse = function(artboard, event, side, x, y) 4 | if event == 'mouse_click' then 5 | artboard.DragStart = {x, y} 6 | elseif event == 'mouse_drag' and artboard.DragStart then 7 | local deltaX = x - artboard.DragStart[1] 8 | local deltaY = y - artboard.DragStart[2] 9 | artboard.X = artboard.X + deltaX 10 | artboard.Y = artboard.Y + deltaY 11 | else return 12 | end 13 | 14 | artboard.DragTimer = artboard.Bedrock:StartTimer(function(_, timer) 15 | if timer == artboard.DragTimer then 16 | artboard.DragStart = nil 17 | artboard.DragTimer = nil 18 | end 19 | end, 1) 20 | end -------------------------------------------------------------------------------- /System/Programs/Settings.program/Objects/Switch.lua: -------------------------------------------------------------------------------- 1 | Width = 9 2 | 3 | Toggle = false 4 | 5 | OnDraw = function(self, x, y) 6 | local _x = 0 7 | 8 | local onColour = self.Toggle and colours.green or colours.lightGrey 9 | Drawing.DrawCharacters(x, y, ' On ', colours.white, onColour) 10 | 11 | local offColour = self.Toggle and colours.lightGrey or colours.red 12 | Drawing.DrawCharacters(x + 4, y, ' Off ', colours.white, offColour) 13 | end 14 | 15 | OnClick = function(self, event, side, x, y) 16 | if x >= 5 then 17 | self.Toggle = false 18 | else 19 | self.Toggle = true 20 | end 21 | 22 | if self.OnChange then 23 | self:OnChange(self.Toggle) 24 | end 25 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/APIs/EraserTool.lua: -------------------------------------------------------------------------------- 1 | Name = 'Eraser' 2 | 3 | OnUse = function(artboard, event, side, x, y) 4 | local layer = artboard:GetCurrentLayer() 5 | local pixels = layer:GetEffectedPixels(x, y, artboard.BrushSize, artboard.BrushShape, artboard.CorrectPixelRatio) 6 | 7 | local colour = colours.transparent 8 | if layer.Layer.LayerType ~= 'Normal' then 9 | colour = colours.black 10 | else 11 | colour = layer.BackgroundColour 12 | end 13 | 14 | for i, pixel in ipairs(pixels) do 15 | if side == 1 then 16 | layer:SetPixel(pixel[1], pixel[2], colour) 17 | elseif side == 2 then 18 | layer:SetPixel(pixel[1], pixel[2], nil, colours.black, ' ') 19 | end 20 | end 21 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/APIs/Clipboard.lua: -------------------------------------------------------------------------------- 1 | Content = nil 2 | Type = nil 3 | IsCut = false 4 | 5 | function Empty() 6 | Clipboard.Content = nil 7 | Clipboard.Type = nil 8 | Clipboard.IsCut = false 9 | end 10 | 11 | function isEmpty() 12 | return Clipboard.Content == nil 13 | end 14 | 15 | function Copy(content, _type) 16 | Clipboard.Content = content 17 | Clipboard.Type = _type or 'generic' 18 | Clipboard.IsCut = false 19 | end 20 | 21 | function Cut(content, _type) 22 | Clipboard.Content = content 23 | Clipboard.Type = _type or 'generic' 24 | Clipboard.IsCut = true 25 | end 26 | 27 | function Paste() 28 | local c, t = Clipboard.Content, Clipboard.Type 29 | if Clipboard.IsCut then 30 | Clipboard.Empty() 31 | end 32 | return c, t 33 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/APIs/PencilTool.lua: -------------------------------------------------------------------------------- 1 | Name = 'Pencil' 2 | 3 | OnUse = function(artboard, event, side, x, y) 4 | local layer = artboard:GetCurrentLayer() 5 | local pixels = layer:GetEffectedPixels(x, y, artboard.BrushSize, artboard.BrushShape, artboard.CorrectPixelRatio) 6 | 7 | local colour = (side == 1 and artboard.BrushColour or artboard.SecondaryBrushColour) 8 | if layer.Layer.LayerType ~= 'Normal' then 9 | if colour == colours.transparent then 10 | colour = colours.black 11 | end 12 | colour = Drawing.FilterColour(colour, Drawing.Filters.BlackWhite) 13 | end 14 | 15 | for i, pixel in ipairs(pixels) do 16 | layer:SetPixel(pixel[1], pixel[2], colour) 17 | -- elseif side == 3 then 18 | -- layer:SetPixel(pixel[1], pixel[2], nil, colour) 19 | -- end 20 | end 21 | end -------------------------------------------------------------------------------- /System/Programs/Unpackager.program/startup: -------------------------------------------------------------------------------- 1 | OneOS.LoadAPI('/System/API/Bedrock.lua') 2 | 3 | local program = Bedrock:Initialise() 4 | 5 | local tArgs = {...} 6 | 7 | if not tArgs[1] or not OneOS.FS.exists(tArgs[1]) then 8 | OneOS.Close() 9 | end 10 | 11 | program:Run(function() 12 | local packrun, err = OneOS.LoadFile(tArgs[1]) 13 | local env = getfenv() 14 | env['installLocation'] = program.Helpers.RemoveFileName(tArgs[1])..'/' 15 | setfenv( packrun, env) 16 | 17 | if packrun then 18 | packrun() 19 | program:GetObject('Label').Text = 'Package Extracted' 20 | else 21 | program:GetObject('Label').Text = 'The package appears to be corrupt.' 22 | program:GetObject('Label').TextColour = colours.red 23 | end 24 | 25 | program:StartTimer(function() 26 | OneOS.Close() 27 | end, 1) 28 | end) -------------------------------------------------------------------------------- /Programs/Sketch.program/APIs/TextTool.lua: -------------------------------------------------------------------------------- 1 | Name = 'Text' 2 | 3 | OnUse = function(artboard, event, side, x, y) 4 | local layer = artboard:GetCurrentLayer() 5 | if layer.Layer.LayerType ~= 'Normal' then 6 | layer.Bedrock:DisplayAlertWindow('Tool Not Supported!', "You cannot use the text tool on non-normal layers.", {'Ok'}, function()end) 7 | elseif side == 1 then 8 | layer.CursorPos = {x, y} 9 | layer.Bedrock:SetActiveObject(layer) 10 | elseif side == 2 then 11 | local pixels = layer:GetEffectedPixels(x, y, artboard.BrushSize, artboard.BrushShape, artboard.CorrectPixelRatio) 12 | for i, pixel in ipairs(pixels) do 13 | layer:SetPixel(pixel[1], pixel[2], nil, artboard.BrushColour) 14 | end 15 | end 16 | end 17 | 18 | OnStopUse = function(artboard) 19 | local layer = artboard:GetCurrentLayer() 20 | layer.Bedrock:SetActiveObject() 21 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/Sidebar.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | 3 | BackgroundColour = colours.grey 4 | FlashingColour = colours.lightBlue 5 | Z = 101 6 | Flashing = false 7 | 8 | OnDraw = function(self, x, y) 9 | local bgColour = self.BackgroundColour 10 | if self.Flashing then 11 | bgColour = self.FlashingColour 12 | end 13 | Drawing.DrawBlankArea(x, y, self.Width, self.Height, bgColour) 14 | end 15 | 16 | UpdateButtons = function(self, enabled) 17 | for i, v in ipairs(self.Children) do 18 | v.Enabled = enabled 19 | end 20 | end 21 | 22 | CloseDocked = function(self) 23 | for i, v in ipairs(self.Children) do 24 | if v.WindowDocked then 25 | v.Window:Close() 26 | end 27 | end 28 | end 29 | 30 | OnDock = function(self) 31 | self.Flashing = true 32 | self.Bedrock:StartTimer(function() 33 | self.Flashing = false 34 | end, 0.2) 35 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/layermenu.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Type"]="Menu", 3 | ["Children"]={ 4 | [1]={ 5 | ["Name"]="NewLayerMenuItem", 6 | ["Type"]="MenuItem", 7 | ["Text"]="New Layer..." 8 | }, 9 | [2]={ 10 | ["Name"]="Separator", 11 | ["Type"]="Separator" 12 | }, 13 | [3]={ 14 | ["Name"]="RenameLayerMenuItem", 15 | ["Type"]="MenuItem", 16 | ["Text"]="Rename Layer..." 17 | }, 18 | [4]={ 19 | ["Name"]="DeleteLayerMenuItem", 20 | ["Type"]="MenuItem", 21 | ["Text"]="Delete Layer" 22 | }, 23 | [5]={ 24 | ["Name"]="DuplicateLayerMenuItem", 25 | ["Type"]="MenuItem", 26 | ["Text"]="Duplicate Layer" 27 | }, 28 | [6]={ 29 | ["Name"]="MergeDownLayerMenuItem", 30 | ["Type"]="MenuItem", 31 | ["Text"]="Merge Down" 32 | }, 33 | }, 34 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/viewmenu.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Type"]="Menu", 3 | ["Owner"]="ViewMenuButton", 4 | ["HideTop"]=true, 5 | ["Children"]={ 6 | [1]={ 7 | ["Name"]="ZoomInMenuItem", 8 | ["Type"]="MenuItem", 9 | ["Text"]="Zoom In", 10 | ["Shortcut"]="#=" 11 | }, 12 | [2]={ 13 | ["Name"]="ZoomOutMenuItem", 14 | ["Type"]="MenuItem", 15 | ["Text"]="Zoom Out", 16 | ["Shortcut"]="#-" 17 | }, 18 | [3]={ 19 | ["Name"]="100%ZoomMenuItem", 20 | ["Type"]="MenuItem", 21 | ["Text"]="100% Zoom", 22 | ["Shortcut"]="#1" 23 | }, 24 | [4]={ 25 | ["Name"]="Separator", 26 | ["Type"]="Separator" 27 | }, 28 | [5]={ 29 | ["Name"]="FilterMaskMenuItem", 30 | ["Type"]="MenuItem", 31 | ["Text"]="Show Filter Masks", 32 | ["Shortcut"]="#M" 33 | }, 34 | }, 35 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/APIs/SprayTool.lua: -------------------------------------------------------------------------------- 1 | Name = 'Spray' 2 | 3 | OnUse = function(artboard, event, side, x, y) 4 | local layer = artboard:GetCurrentLayer() 5 | -- artboard.BrushSize 6 | local pixels = layer:GetEffectedPixels(x, y, artboard.BrushSize, artboard.BrushShape, artboard.CorrectPixelRatio) 7 | 8 | local colour = (side == 1 and artboard.BrushColour or artboard.SecondaryBrushColour) 9 | if layer.Layer.LayerType ~= 'Normal' then 10 | if colour == colours.transparent then 11 | colour = colours.black 12 | end 13 | colour = Drawing.FilterColour(colour, Drawing.Filters.BlackWhite) 14 | end 15 | 16 | for i, pixel in ipairs(pixels) do 17 | if math.random(0, 3) == 0 then 18 | if side == 1 then 19 | layer:SetPixel(pixel[1], pixel[2], colour) 20 | elseif side == 3 then 21 | layer:SetPixel(pixel[1], pixel[2], nil, colour) 22 | end 23 | end 24 | end 25 | end -------------------------------------------------------------------------------- /System/Views/switcher-controls-pocket.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = "50%,-9", 5 | Y = 2, 6 | Type = 'Button', 7 | Name = 'AboutButton', 8 | Text = '?', 9 | BackgroundColour = 'white' 10 | }, 11 | { 12 | X = "50%,-5", 13 | Y = 2, 14 | Type = 'Button', 15 | Name = 'SettingsButton', 16 | Text = 'U', 17 | BackgroundColour = 'white' 18 | }, 19 | { 20 | X = "50%,-1", 21 | Y = 2, 22 | Type = 'Button', 23 | Name = 'SettingsButton', 24 | Text = '#', 25 | BackgroundColour = 'white' 26 | }, 27 | { 28 | X = "50%,3", 29 | Y = 2, 30 | Type = 'Button', 31 | Name = 'ShutdownButton', 32 | Text = 'S', 33 | BackgroundColour = 'white' 34 | }, 35 | { 36 | X = "50%,7", 37 | Y = 2, 38 | Type = 'Button', 39 | Name = 'RestartButton', 40 | Text = 'R', 41 | BackgroundColour = 'white' 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /System/Programs/Desktop.program/Views/filemenu.view: -------------------------------------------------------------------------------- 1 | { 2 | Type = 'Menu', 3 | Children = { 4 | { 5 | Name = 'OpenMenuItem', 6 | Type = 'MenuItem', 7 | Text = 'Open' 8 | }, 9 | { 10 | Type = 'Separator' 11 | }, 12 | { 13 | Name = 'RenameMenuItem', 14 | Type = 'MenuItem', 15 | Text = 'Rename...' 16 | }, 17 | { 18 | Name = 'DeleteMenuItem', 19 | Type = 'MenuItem', 20 | Text = 'Delete...' 21 | }, 22 | { 23 | Type = 'Separator' 24 | }, 25 | { 26 | Name = 'NewFileMenuItem', 27 | Type = 'MenuItem', 28 | Text = 'New File...' 29 | }, 30 | { 31 | Name = 'NewFolderMenuItem', 32 | Type = 'MenuItem', 33 | Text = 'New Folder...' 34 | }, 35 | { 36 | Type = 'Separator' 37 | }, 38 | { 39 | Name = 'RefreshMenuItem', 40 | Type = 'MenuItem', 41 | Text = 'Refresh' 42 | }, 43 | }, 44 | } -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/LoadingIndicator.lua: -------------------------------------------------------------------------------- 1 | Width = 7 2 | Height = 5 3 | Text = 'Loading' 4 | 5 | Step = 1 6 | 7 | UpdateDrawBlacklist = { 8 | ['Step'] = true, 9 | } 10 | 11 | OnDraw = function(self, x, y) 12 | local reverseStep = 9 13 | local resetStep = 18 14 | if self.Step > resetStep then 15 | self.Step = 0 16 | end 17 | 18 | self.Step = self.Step + 1 19 | 20 | for i = 0, 3 do 21 | local _y = math.min(math.max(0, self.Step - 2 * i), 3) 22 | if self.Step > reverseStep then 23 | _y = 3 - math.min(math.max(0, self.Step - reverseStep - 2 * i), 3) 24 | end 25 | 26 | local colour = (_y == 3 and colours.blue or (_y == 0 and colours.white or colours.lightBlue)) 27 | Drawing.WriteToBuffer(x + i * 2, y + _y - 1, ' ', colours.black, colour) 28 | end 29 | 30 | Drawing.DrawCharacters(x, y + 4, self.Text, colours.blue, colours.transparent) 31 | 32 | self.Bedrock:StartTimer(function() 33 | self:ForceDraw() 34 | end, 0.05) 35 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/brushwindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=13, 3 | ["Height"]=9, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=2, 8 | ["X"]=2, 9 | ["Type"]="Label", 10 | ["TextColour"]=256, 11 | ["Text"]="Size" 12 | }, 13 | [2]={ 14 | ["Y"]=2, 15 | ["X"]=7, 16 | ["Width"]=6, 17 | ["Type"]="NumberBox", 18 | ["TextColour"]=128, 19 | ["Text"]="2", 20 | }, 21 | [3]={ 22 | ["Y"]=4, 23 | ["X"]=2, 24 | ["Type"]="Label", 25 | ["TextColour"]=256, 26 | ["Text"]="Shape" 27 | }, 28 | [4]={ 29 | ["Y"]=6, 30 | ["X"]=3, 31 | ["Width"]=3, 32 | ["Height"]=3, 33 | ["Type"]="ImageView", 34 | ["Name"]="SquareImageView", 35 | ["Path"]="Resources/square.nft" 36 | }, 37 | [5]={ 38 | ["Y"]=6, 39 | ["X"]=9, 40 | ["Width"]=3, 41 | ["Height"]=3, 42 | ["Type"]="ImageView", 43 | ["Name"]="CircleImageView", 44 | ["Path"]="Resources/circle.nft" 45 | }, 46 | }, 47 | } -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/CategoryPageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnDataLoad = function(self, url, data) 4 | self:RemoveAllObjects() 5 | 6 | local programs = textutils.unserialize(data) 7 | 8 | local function load(from) 9 | local to = {} 10 | for i, v in ipairs(from) do 11 | local app = App:Initialise(v, self.Bedrock) 12 | table.insert(to, app) 13 | end 14 | return to 15 | end 16 | 17 | local apps = load(programs) 18 | 19 | self:AddObject({ 20 | X = 1, 21 | Y = 1, 22 | Type = 'AppCollectionView', 23 | Width = '100%', 24 | Title = 'All ' .. self.CategoryName .. ' Programs', 25 | Height = 2 + math.ceil(#apps / 2) * 4, 26 | Name = self.CategoryName .. 'AppCollectionView', 27 | Items = apps 28 | }) 29 | 30 | self:UpdateScroll() 31 | end 32 | 33 | DataURL = function(self, info) 34 | return self.Bedrock.AppStoreURL .. 'api/?command=application&subcommand=category&name=' .. textutils.urlEncode(self.CategoryName) 35 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/BrushWindow.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'SnapWindow' 2 | ContentViewName = 'brushwindow' 3 | 4 | Title = 'Brush' 5 | 6 | OnContentLoad = function(self) 7 | self:GetObject('SquareImageView').OnClick = function(_self, event, side, x, y) 8 | local artboard = self.Bedrock:GetObject('Artboard') 9 | if artboard then 10 | artboard.BrushShape = 'Square' 11 | end 12 | end 13 | 14 | self:GetObject('CircleImageView').OnClick = function(_self, event, side, x, y) 15 | local artboard = self.Bedrock:GetObject('Artboard') 16 | if artboard then 17 | artboard.BrushShape = 'Circle' 18 | end 19 | end 20 | 21 | local artboard = self.Bedrock:GetObject('Artboard') 22 | if artboard then 23 | self:GetObject('NumberBox').Value = artboard.BrushSize 24 | end 25 | 26 | self:GetObject('NumberBox').OnChange = function(_self) 27 | local artboard = self.Bedrock:GetObject('Artboard') 28 | if artboard then 29 | artboard.BrushSize = _self.Value 30 | end 31 | end 32 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/editmenu.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Type"]="Menu", 3 | ["Owner"]="EditMenuButton", 4 | ["HideTop"]=true, 5 | ["Children"]={ 6 | [1]={ 7 | ["Name"]="UndoMenuItem", 8 | ["Type"]="MenuItem", 9 | ["Text"]="Undo", 10 | ["Shortcut"]="#Z" 11 | }, 12 | [2]={ 13 | ["Name"]="RedoMenuItem", 14 | ["Type"]="MenuItem", 15 | ["Text"]="Redo", 16 | ["Shortcut"]="#Y" 17 | }, 18 | [3]={ 19 | ["Name"]="Separator", 20 | ["Type"]="Separator" 21 | }, 22 | [4]={ 23 | ["Name"]="CutMenuItem", 24 | ["Type"]="MenuItem", 25 | ["Text"]="Cut ", 26 | ["Shortcut"]="#X" 27 | }, 28 | [5]={ 29 | ["Name"]="CopyMenuItem", 30 | ["Type"]="MenuItem", 31 | ["Text"]="Copy", 32 | ["Shortcut"]="#C" 33 | }, 34 | [6]={ 35 | ["Name"]="PasteMenuItem", 36 | ["Type"]="MenuItem", 37 | ["Text"]="Paste", 38 | ["Shortcut"]="#V" 39 | } 40 | }, 41 | } -------------------------------------------------------------------------------- /System/Programs/Files.program/Views/bgmenu.view: -------------------------------------------------------------------------------- 1 | { 2 | Type = 'Menu', 3 | Children = { 4 | { 5 | Name = 'ToggleHiddenMenuItem', 6 | Type = 'MenuItem', 7 | Text = 'Show Hidden Files' 8 | }, 9 | { 10 | Name = 'ToggleExtensionMenuItem', 11 | Type = 'MenuItem', 12 | Text = 'Show Extensions' 13 | }, 14 | { 15 | Type = 'Separator' 16 | }, 17 | { 18 | Name = 'NewFileMenuItem', 19 | Type = 'MenuItem', 20 | Text = 'New File...' 21 | }, 22 | { 23 | Name = 'NewFolderMenuItem', 24 | Type = 'MenuItem', 25 | Text = 'New Folder...' 26 | }, 27 | { 28 | Type = 'Separator' 29 | }, 30 | { 31 | Name = 'PasteMenuItem', 32 | Type = 'MenuItem', 33 | Text = 'Paste', 34 | Enabled = false 35 | }, 36 | { 37 | Type = 'Separator' 38 | }, 39 | { 40 | Name = 'RefreshMenuItem', 41 | Type = 'MenuItem', 42 | Text = 'Refresh' 43 | }, 44 | }, 45 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/sizepresetmenu.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Type"]="Menu", 3 | ["HideTop"]=true, 4 | ["Children"]={ 5 | [1]={ 6 | ["Name"]="CustomMenuItem", 7 | ["Type"]="MenuItem", 8 | ["Text"]="Custom", 9 | }, 10 | [2]={ 11 | ["Type"]="MenuItem", 12 | ["Name"]="PresetMenuItem", 13 | ["Text"]="OneOS Icon", 14 | ["SizeWidth"]=4, 15 | ["SizeHeight"]=3, 16 | }, 17 | [3]={ 18 | ["Type"]="MenuItem", 19 | ["Name"]="PresetMenuItem", 20 | ["Text"]="Computer Screen", 21 | ["SizeWidth"]=51, 22 | ["SizeHeight"]=19, 23 | }, 24 | [4]={ 25 | ["Type"]="MenuItem", 26 | ["Name"]="PresetMenuItem", 27 | ["Text"]="Pocket Computer Screen", 28 | ["SizeWidth"]=26, 29 | ["SizeHeight"]=19, 30 | }, 31 | [5]={ 32 | ["Type"]="MenuItem", 33 | ["Name"]="PresetMenuItem", 34 | ["Text"]="Turtle Screen", 35 | ["SizeWidth"]=39, 36 | ["SizeHeight"]=13, 37 | }, 38 | }, 39 | } -------------------------------------------------------------------------------- /System/Programs/Update.program/Views/main.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = '50%,-10', 5 | Y = '50%,-3', 6 | Width = 20, 7 | Height = 9, 8 | Type = 'FilterView', 9 | FilterName = 'Darker' 10 | }, 11 | { 12 | X = '50%,-11', 13 | Y = '50%,-4', 14 | Width = 20, 15 | Height = 9, 16 | Type = 'View', 17 | BackgroundColour = 'white', 18 | Children = { 19 | { 20 | X = '50%,-3', 21 | Y = '50%,-3', 22 | Type = 'LoadingIndicator', 23 | Text = '' 24 | }, 25 | { 26 | X = 1, 27 | Y = '50%, 1', 28 | Width = '100%', 29 | Align = 'Center', 30 | Type = 'Label', 31 | Text = 'Updating OneOS', 32 | TextColour = 'blue' 33 | }, 34 | { 35 | X = 1, 36 | Y = '50%, 3', 37 | Width = '100%', 38 | Align = 'Center', 39 | Type = 'Label', 40 | Name = 'StatusLabel', 41 | Text = 'Preparing...', 42 | TextColour = 'lightBlue' 43 | }, 44 | } 45 | }, 46 | }, 47 | BackgroundColour = 'lightGrey', 48 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Oliver Cooper 2015 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/filemenu.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Type"]="Menu", 3 | ["Owner"]="FileMenuButton", 4 | ["HideTop"]=true, 5 | ["Children"]={ 6 | [1]={ 7 | ["Name"]="NewMenuItem", 8 | ["Type"]="MenuItem", 9 | ["Text"]="New...", 10 | ["Shortcut"]="#N" 11 | }, 12 | [2]={ 13 | ["Name"]="OpenMenuItem", 14 | ["Type"]="MenuItem", 15 | ["Text"]="Open...", 16 | ["Shortcut"]="#O" 17 | }, 18 | [3]={ 19 | ["Name"]="Separator", 20 | ["Type"]="Separator" 21 | }, 22 | [4]={ 23 | ["Name"]="SaveMenuItem", 24 | ["Type"]="MenuItem", 25 | ["Text"]="Save", 26 | ["Shortcut"]="#S" 27 | }, 28 | [5]={ 29 | ["Name"]="SaveAsMenuItem", 30 | ["Type"]="MenuItem", 31 | ["Text"]="Save As...", 32 | ["Shortcut"]="^#S" 33 | }, 34 | [6]={ 35 | ["Name"]="Separator", 36 | ["Type"]="Separator" 37 | }, 38 | [7]={ 39 | ["Name"]="QuitMenuItem", 40 | ["Type"]="MenuItem", 41 | ["Text"]="Quit", 42 | ["Shortcut"]="#Q" 43 | }, 44 | }, 45 | } -------------------------------------------------------------------------------- /Programs/Transmit.program/Views/discover.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Children"]={ 3 | [1]={ 4 | ["Y"]=1, 5 | ["X"]=1, 6 | ["Name"]="DiscoverView", 7 | ["Type"]="DiscoverView", 8 | ["Width"]="100%", 9 | ["Height"]="100%" 10 | }, 11 | [2]={ 12 | ["Y"]="100%,-2", 13 | ["X"]=1, 14 | ["Name"]="HelpLabel", 15 | ["Width"]="100%", 16 | ["Height"]=2, 17 | ["Type"]="Label", 18 | ["Align"]="Center", 19 | ["TextColour"]=128, 20 | ["Text"]="Open Transmit on another computer then select it." 21 | }, 22 | [3]={ 23 | ["Y"]="100%", 24 | ["X"]=1, 25 | ["Name"]="ComputerLabel", 26 | ["Width"]="100%", 27 | ["Type"]="Label", 28 | ["Align"]="Center", 29 | ["TextColour"]=256, 30 | ["Text"]="" 31 | }, 32 | [4]={ 33 | ["Y"]="100%,-8", 34 | ["X"]="50%,-5", 35 | ["Name"]="StatusImageView", 36 | ["Type"]="ImageView", 37 | ["Width"]=10, 38 | ["Height"]=5, 39 | ["Path"]='/Images/anm1' 40 | }, 41 | }, 42 | ["BackgroundColour"]=1 43 | } -------------------------------------------------------------------------------- /System/Programs/Setup.program/startup: -------------------------------------------------------------------------------- 1 | Bedrock.ProgramPath = '/System/Programs/Setup.program/startup' 2 | 3 | local program = Bedrock:Initialise() 4 | program.Settings = Settings:Initialise() 5 | System.Bedrock = program 6 | 7 | local currentPage 8 | 9 | local function changePage(name) 10 | currentPage = name 11 | 12 | name = tostring(name) 13 | program:RemoveObject('CurrentPageView') 14 | program:AddObject({ 15 | X = 3, 16 | Y = 2, 17 | Width = '100%,-4', 18 | Height = '100%,-3', 19 | Type = 'View', 20 | BackgroundColour = 'white', 21 | Type = name .. 'PageView', 22 | InheritView = name:lower(), 23 | Name = 'CurrentPageView' 24 | }) 25 | end 26 | 27 | program.ChangePage = changePage 28 | program.NextPage = function() 29 | changePage(currentPage + 1) 30 | end 31 | 32 | program.ChangePage = function() 33 | changePage(currentPage - 1) 34 | end 35 | 36 | program.SettingsValues = {} 37 | 38 | function Initialise() 39 | program:Run(function() 40 | changePage(0) 41 | 42 | -- TODO: debug only 43 | program:RegisterKeyboardShortcut({'\\'}, function()os.reboot()end) 44 | 45 | 46 | end) 47 | end -------------------------------------------------------------------------------- /System/Views/main.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | -- { 4 | -- X = 1, 5 | -- Y = 1, 6 | -- Height = 1, 7 | -- Type = 'Label', 8 | -- Name = 'HomeButton', 9 | -- Text = '<' 10 | -- }, 11 | -- { 12 | -- X = "100%", 13 | -- Y = 1, 14 | -- Height = 1, 15 | -- Type = 'Label', 16 | -- Name = 'CloseButton', 17 | -- Text = 'x' 18 | -- }, 19 | { 20 | X = 1, 21 | Y = 1, 22 | Type = 'Switcher', 23 | Width = '100%' 24 | -- InheritView = 'switcher', 25 | }, 26 | { 27 | X = 1, 28 | Y = 1, 29 | Width = "100%", 30 | Height = '100%', 31 | Type = 'View', 32 | Name = 'SplashView', 33 | BackgroundColour = 'white', 34 | Children = { 35 | { 36 | X = 1, 37 | Y = '50%,-1', 38 | Width = '100%', 39 | Align = 'Center', 40 | Text = 'OneOS', 41 | Type = 'Label', 42 | TextColour = 'grey' 43 | }, 44 | { 45 | X = 1, 46 | Y = '50%', 47 | Width = '100%', 48 | Align = 'Center', 49 | Text = 'by oeed', 50 | Type = 'Label', 51 | TextColour = 'lightGrey' 52 | }, 53 | } 54 | }, 55 | }, 56 | BackgroundColour = 'black' 57 | } -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/AppCollectionView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | 3 | Items = nil 4 | Title = nil 5 | 6 | OnSeeMore = nil 7 | 8 | OnLoad = function(self) 9 | self:OnUpdate('Items') 10 | end 11 | 12 | OnUpdate = function(self, value) 13 | if value == 'Items' then 14 | self:RemoveAllObjects() 15 | 16 | self:AddObject({ 17 | X = 2, 18 | Y = 2, 19 | Type = 'Label', 20 | Text = self.Title, 21 | TextColour = colours.lightGrey 22 | }) 23 | 24 | if self.OnSeeMore then 25 | self:AddObject({ 26 | X = 3 + #self.Title, 27 | Y = 2, 28 | Type = 'Label', 29 | Text = 'See More >', 30 | TextColour = colours.blue, 31 | OnClick = self.OnSeeMore 32 | }) 33 | end 34 | 35 | local xStart = 2 + math.floor((self.Width % AppView.Width) / 2) 36 | local x = xStart 37 | local y = 4 38 | for i, app in ipairs(self.Items) do 39 | self:AddObject({ 40 | X = x, 41 | Y = y, 42 | Type = 'AppView', 43 | App = app 44 | }) 45 | 46 | x = x + AppView.Width 47 | if x + AppView.Width > self.Width then 48 | x = xStart 49 | y = y + AppView.Height 50 | end 51 | end 52 | end 53 | end -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/CategoriesPageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnDataLoad = function(self, url, data) 4 | self:RemoveAllObjects() 5 | 6 | local categories = textutils.unserialize(data) 7 | 8 | local function load(from) 9 | local to = {} 10 | for i, v in ipairs(from) do 11 | local app = App:Initialise(v, self.Bedrock) 12 | table.insert(to, app) 13 | end 14 | return to 15 | end 16 | 17 | local y = 1 18 | for category, programs in pairs(categories) do 19 | local apps = load(programs) 20 | 21 | self:AddObject({ 22 | X = 1, 23 | Y = y, 24 | Type = 'AppCollectionView', 25 | Width = '100%', 26 | Title = 'Top ' .. category .. ' Programs', 27 | Height = 2 + math.ceil(#apps / 2) * 4, 28 | Name = category .. 'AppCollectionView', 29 | Items = apps, 30 | OnSeeMore = function() 31 | self.Bedrock:OpenPage('CategoryPageView', { 32 | CategoryName = category 33 | }) 34 | end 35 | }) 36 | 37 | y = y + 4 + #apps * 2 38 | end 39 | 40 | self:UpdateScroll() 41 | end 42 | 43 | DataURL = function(self, info) 44 | return self.Bedrock.AppStoreURL .. 'api/?command=application&subcommand=categories' 45 | end -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/SearchResultsPageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnDataLoad = function(self, url, data) 4 | self:RemoveAllObjects() 5 | 6 | local _data = textutils.unserialize(data) 7 | 8 | local function load(from) 9 | local to = {} 10 | for i, v in ipairs(from) do 11 | local app = App:Initialise(v, self.Bedrock) 12 | table.insert(to, app) 13 | end 14 | return to 15 | end 16 | 17 | local results = load(_data) 18 | 19 | self:AddObject({ 20 | X = 1, 21 | Y = 1, 22 | Type = 'AppCollectionView', 23 | Width = '100%', 24 | Title = 'Search Results For: ' .. self.SearchTerm, 25 | Height = 2 + math.ceil(#results / 2) * 4, 26 | Name = 'SearchResultsCollectionView', 27 | Items = results 28 | }) 29 | 30 | if #results == 0 then 31 | self:AddObject({ 32 | X = 1, 33 | Y = '50%', 34 | Width = '100%', 35 | Align = 'Center', 36 | Type = 'Label', 37 | TextColour = 'grey', 38 | Text = 'No apps found' 39 | }) 40 | end 41 | 42 | self:UpdateScroll() 43 | end 44 | 45 | DataURL = function(self, info) 46 | return self.Bedrock.AppStoreURL .. 'api/?command=application&subcommand=search&name=' .. textutils.urlEncode(self.SearchTerm) 47 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/sidebar.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Children"]={ 3 | [1]={ 4 | ["Y"]=2, 5 | ["Type"]="SidebarButton", 6 | ["Name"]="ColoursSidebarButton", 7 | ["Text"]="Col", 8 | ["WindowName"]="ColoursWindow", 9 | ["Enabled"]=false 10 | }, 11 | [2]={ 12 | ["Y"]=4, 13 | ["Type"]="SidebarButton", 14 | ["Name"]="ToolsSidebarButton", 15 | ["Text"]="Tol", 16 | ["WindowName"]="ToolsWindow", 17 | ["Enabled"]=false 18 | }, 19 | [3]={ 20 | ["Y"]=6, 21 | ["Type"]="SidebarButton", 22 | ["Text"]="Bru", 23 | ["WindowName"]="BrushWindow", 24 | ["Enabled"]=false 25 | }, 26 | [4]={ 27 | ["Y"]=8, 28 | ["Type"]="SidebarButton", 29 | ["Text"]="Lay", 30 | ["WindowName"]="LayersWindow", 31 | ["Enabled"]=false 32 | }, 33 | [5]={ 34 | ["Y"]=10, 35 | ["Type"]="SidebarButton", 36 | ["Text"]="Inf", 37 | ["WindowName"]="InfoWindow", 38 | ["Enabled"]=false 39 | }, 40 | [6]={ 41 | ["Y"]=12, 42 | ["Type"]="SidebarButton", 43 | ["Text"]="Flt", 44 | ["WindowName"]="FiltersWindow", 45 | ["Enabled"]=false 46 | }, 47 | }, 48 | } -------------------------------------------------------------------------------- /System/Programs/Settings.program/Views/appearance.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 3, 5 | Y = 2, 6 | TextColour = 'grey', 7 | Type = 'Label', 8 | Text = 'Desktop Background' 9 | }, 10 | { 11 | X = 3, 12 | Y = 3, 13 | TextColour = 'lightGrey', 14 | Type = 'Label', 15 | Text = 'The colour of the desktop.' 16 | }, 17 | { 18 | X = 3, 19 | Y = 5, 20 | Type = 'ColourPicker', 21 | Name = 'DesktopBackgroundColourPicker', 22 | }, 23 | 24 | { 25 | X = 3, 26 | Y = 8, 27 | TextColour = 'grey', 28 | Type = 'Label', 29 | Text = 'Animations' 30 | }, 31 | { 32 | X = 3, 33 | Y = 9, 34 | TextColour = 'lightGrey', 35 | Type = 'Label', 36 | Text = 'Toggle animations system-wide.' 37 | }, 38 | { 39 | X = 3, 40 | Y = 11, 41 | Type = 'Switch', 42 | Name = 'UseAnimationsSwitch', 43 | }, 44 | }, 45 | BackgroundColour = 'white', 46 | } -------------------------------------------------------------------------------- /Programs/App Store.program/Views/main.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = '50%,-13', 5 | Y = 1, 6 | Text = 'Home', 7 | TextColour = 'grey', 8 | Name = 'HomeLabel', 9 | Type = 'Label' 10 | }, 11 | { 12 | X = '50%,-5', 13 | Y = 1, 14 | Text = 'Categories', 15 | TextColour = 'grey', 16 | Name = 'CategoriesLabel', 17 | Type = 'Label' 18 | }, 19 | { 20 | X = '50%,9', 21 | Y = 1, 22 | Text = 'Search', 23 | TextColour = 'grey', 24 | Name = 'SearchLabel', 25 | Type = 'Label' 26 | }, 27 | { 28 | X = 1, 29 | Y = 2, 30 | Type = 'Separator', 31 | Width = '100%', 32 | Colour = 'lightGrey' 33 | }, 34 | 35 | { 36 | X = 1, 37 | Y = 3, 38 | Width = '100%', 39 | Height = '100%,-2', 40 | Type = 'ScrollView', 41 | Name = 'ContentScrollView', 42 | Children = { 43 | { 44 | X = 1, 45 | Y = 1, 46 | Type = 'HomePageView', 47 | Name = 'CurrentPage', 48 | Width = '100%', 49 | Height = '100%' 50 | } 51 | } 52 | }, 53 | 54 | { 55 | X = '100%', 56 | Y = 1, 57 | Text = 'x', 58 | TextColour = 'blue', 59 | Name = 'QuitLabel', 60 | Type = 'Label' 61 | }, 62 | 63 | 64 | }, 65 | BackgroundColour = 'white' 66 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/ColoursWindow.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'SnapWindow' 2 | ContentViewName = 'colourswindow' 3 | 4 | Title = 'Colours' 5 | 6 | OnContentLoad = function(self) 7 | local artboard = self.Bedrock:GetObject('Artboard') 8 | if artboard then 9 | self:GetObject('PrimaryColourButton').BackgroundColour = artboard.BrushColour 10 | self:GetObject('SecondaryColourButton').BackgroundColour = artboard.SecondaryBrushColour 11 | else 12 | self:GetObject('PrimaryColourButton').BackgroundColour = colours.lightBlue 13 | self:GetObject('SecondaryColourButton').BackgroundColour = colours.magenta 14 | end 15 | 16 | local buttons = self:GetObjects('ColourButton') 17 | for i, button in ipairs(buttons) do 18 | button.OnClick = function(_self, event, side, x , y) 19 | local artboard = self.Bedrock:GetObject('Artboard') 20 | if artboard then 21 | if side == 1 then 22 | artboard:SetBrushColour(button.BackgroundColour) 23 | self:GetObject('PrimaryColourButton').BackgroundColour = button.BackgroundColour 24 | elseif side == 2 then 25 | artboard:SetSecondaryBrushColour(button.BackgroundColour) 26 | self:GetObject('SecondaryColourButton').BackgroundColour = button.BackgroundColour 27 | end 28 | end 29 | end 30 | end 31 | end -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/AppView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | 3 | Width = 24 4 | Height = 4 5 | App = nil 6 | 7 | OnLoad = function(self) 8 | self:AddObject({ 9 | X = 1, 10 | Y = 1, 11 | Width = 4, 12 | Height = 3, 13 | Type = 'ImageView', 14 | -- Path = '/Resources/Ink' 15 | }) 16 | 17 | self:AddObject({ 18 | X = 6, 19 | Y = 1, 20 | Type = 'Label', 21 | Name = 'NameLabel', 22 | Text = '' 23 | }) 24 | 25 | self:AddObject({ 26 | X = 6, 27 | Y = 2, 28 | Type = 'Label', 29 | Name = 'AuthorLabel', 30 | Text = '', 31 | TextColour = 'lightGrey' 32 | }) 33 | 34 | self:AddObject({ 35 | X = 6, 36 | Y = 3, 37 | Type = 'Label', 38 | -- Name = 'AuthorLabel', 39 | Text = 'Install >', 40 | TextColour = 'blue', 41 | OnClick = function() 42 | if self.App then 43 | self.App:Install() 44 | end 45 | end 46 | }) 47 | 48 | self:OnUpdate('App') 49 | end 50 | 51 | 52 | 53 | OnUpdate = function(self, value) 54 | if value == 'App' then 55 | self:GetObject('NameLabel').Text = self.Bedrock.Helpers.TruncateString(self.App.Name, self.Width - 6) 56 | self:GetObject('AuthorLabel').Text = self.Bedrock.Helpers.TruncateString(self.App.Author, self.Width - 6) 57 | self:GetObject('ImageView').Image = self.App.Icon 58 | end 59 | end -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/SearchPageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnLoad = function(self) 4 | ScrollView.OnLoad(self) 5 | 6 | self:AddObject({ 7 | X = 1, 8 | Y = '50%,-3', 9 | Width = '100%', 10 | Align = 'Center', 11 | TextColour = 'grey', 12 | Type = 'Label', 13 | Text = 'Search' 14 | }) 15 | 16 | self:AddObject({ 17 | X = 1, 18 | Y = '50%,-2', 19 | Width = '100%', 20 | Align = 'Center', 21 | TextColour = 'lightGrey', 22 | Type = 'Label', 23 | Text = 'Find that app you\'re looking for' 24 | }) 25 | 26 | self:AddObject({ 27 | X = '50%,-12', 28 | Y = '50%', 29 | Width = 21, 30 | Type = 'TextBox', 31 | Active = true, 32 | Placeholder = 'Search...', 33 | Name = 'SearchBox', 34 | OnChange = function(_, event, keychar) 35 | if keychar == keys.enter then 36 | self:GetObject('SearchButton'):OnClick() 37 | end 38 | end 39 | }) 40 | 41 | self:AddObject({ 42 | X = '50%,10', 43 | Y = '50%', 44 | Type = 'Button', 45 | BackgroundColour = 'blue', 46 | TextColour = 'white', 47 | Text = 'Go', 48 | Name = 'SearchButton', 49 | OnClick = function() 50 | local text = self:GetObject('SearchBox').Text 51 | 52 | if text ~= '' then 53 | self.Bedrock:OpenPage('SearchResultsPageView', {SearchTerm = text}) 54 | end 55 | end 56 | }) 57 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/InfoWindow.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'SnapWindow' 2 | ContentViewName = 'infowindow' 3 | 4 | Title = 'Info' 5 | 6 | OnContentLoad = function(self) 7 | self:UpdateInfo() 8 | end 9 | 10 | UpdateInfo = function(self) 11 | local artboard = self.Bedrock:GetObject('Artboard') 12 | local selection = (artboard == nil or artboard.Selection == nil or artboard.Selection[1] == nil or artboard.Selection[2] == nil) 13 | self:GetObject("CanvasWidthLabel").Text = (artboard == nil and '-' or tostring(#artboard:GetCurrentLayer().Layer.Pixels)) 14 | self:GetObject("CanvasHeightLabel").Text = (artboard == nil and '-' or tostring(#artboard:GetCurrentLayer().Layer.Pixels[1])) 15 | self:GetObject("SelectionWidthLabel").Text = (selection and '-' or tostring(math.abs(artboard.Selection[1].X-artboard.Selection[2].X))) 16 | self:GetObject("SelectionHeightLabel").Text = (selection and '-' or tostring(math.abs(artboard.Selection[1].Y-artboard.Selection[2].Y))) 17 | self:GetObject("SelectionX1Label").Text = (selection and '-' or tostring(artboard.Selection[1].X)) 18 | self:GetObject("SelectionY1Label").Text = (selection and '-' or tostring(artboard.Selection[1].Y)) 19 | self:GetObject("SelectionX2Label").Text = (selection and '-' or tostring(artboard.Selection[2].X)) 20 | self:GetObject("SelectionY2Label").Text = (selection and '-' or tostring(artboard.Selection[2].Y)) 21 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/APIs/FillTool.lua: -------------------------------------------------------------------------------- 1 | Name = 'Fill' 2 | 3 | OnUse = function(artboard, event, side, x, y) 4 | local layer = artboard:GetCurrentLayer() 5 | local pixels = layer.Layer.Pixels 6 | local replaceColour = pixels[x][y].BackgroundColour 7 | -- if side == 2 then 8 | -- replaceColour = pixels[x][y].TextColour 9 | -- end 10 | 11 | local colour = (side == 1 and artboard.BrushColour or artboard.SecondaryBrushColour) 12 | 13 | local nodes = {{X = x, Y = y}} 14 | 15 | while #nodes > 0 do 16 | local node = nodes[1] 17 | if pixels[node.X] and pixels[node.X][node.Y] then 18 | local replacing = pixels[node.X][node.Y].BackgroundColour 19 | -- if side == 2 then 20 | -- replacing = pixels[node.X][node.Y].TextColour 21 | -- end 22 | if replacing == replaceColour and replacing ~= colour then 23 | -- if side == 1 then 24 | layer:SetPixel(node.X, node.Y, colour) 25 | -- elseif side == 2 then 26 | -- layer:SetPixel(node.X, node.Y, nil, colour) 27 | -- end 28 | table.insert(nodes, {X = node.X, Y = node.Y + 1}) 29 | table.insert(nodes, {X = node.X + 1, Y = node.Y}) 30 | if x > 1 then 31 | table.insert(nodes, {X = node.X - 1, Y = node.Y}) 32 | end 33 | if y > 1 then 34 | table.insert(nodes, {X = node.X, Y = node.Y - 1}) 35 | end 36 | end 37 | end 38 | table.remove(nodes, 1) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/imagemenu.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Type"]="Menu", 3 | ["Owner"]="ImageMenuButton", 4 | ["HideTop"]=true, 5 | ["Children"]={ 6 | [1]={ 7 | ["Name"]="ResizeMenuItem", 8 | ["Type"]="MenuItem", 9 | ["Text"]="Resize Image...", 10 | ["Shortcut"]="~#I" 11 | }, 12 | [2]={ 13 | ["Name"]="CanvasSizeMenuItem", 14 | ["Type"]="MenuItem", 15 | ["Text"]="Canvas Size...", 16 | ["Shortcut"]="~#C" 17 | }, 18 | [3]={ 19 | ["Name"]="CropMenuItem", 20 | ["Type"]="MenuItem", 21 | ["Text"]="Crop", 22 | ["Shortcut"]="~#X" 23 | }, 24 | [4]={ 25 | ["Name"]="Separator", 26 | ["Type"]="Separator" 27 | }, 28 | [5]={ 29 | ["Name"]="NewLayerImageMenuItem", 30 | ["Type"]="MenuItem", 31 | ["Text"]="New Layer", 32 | ["Shortcut"]="#L" 33 | }, 34 | [6]={ 35 | ["Name"]="Separator", 36 | ["Type"]="Separator" 37 | }, 38 | [7]={ 39 | ["Name"]="EraseMenuItem", 40 | ["Type"]="MenuItem", 41 | ["Text"]="Erase Selection", 42 | ["Shortcut"]="<" 43 | }, 44 | [8]={ 45 | ["Name"]="Separator", 46 | ["Type"]="Separator" 47 | }, 48 | [9]={ 49 | ["Name"]="FlattenMenuItem", 50 | ["Type"]="MenuItem", 51 | ["Text"]="Flatten Image", 52 | ["Shortcut"]="#F" 53 | } 54 | }, 55 | } -------------------------------------------------------------------------------- /System/Programs/Update.program/Views/error.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = '50%,-11', 5 | Y = '50%,-3', 6 | Width = 24, 7 | Height = 7, 8 | Type = 'FilterView', 9 | FilterName = 'Darker' 10 | }, 11 | { 12 | X = '50%,-12', 13 | Y = '50%,-4', 14 | Width = 24, 15 | Height = 7, 16 | Type = 'View', 17 | BackgroundColour = 'white', 18 | Children = { 19 | { 20 | X = 1, 21 | Y = '50%,-1', 22 | Width = '100%', 23 | Align = 'Center', 24 | Type = 'Label', 25 | Text = 'An Error Occured', 26 | TextColour = 'red' 27 | }, 28 | { 29 | X = 1, 30 | Y = '50%', 31 | Width = '100%', 32 | Align = 'Center', 33 | Type = 'Label', 34 | Name = 'ErrorLabel', 35 | Text = 'Unknown', 36 | TextColour = 'orange' 37 | }, 38 | 39 | 40 | { 41 | X = '50%, -10', 42 | Y = '50%, 2', 43 | Align = 'Center', 44 | Type = 'Button', 45 | Name = 'SkipUpdateButton', 46 | Text = 'Skip Update', 47 | BackgroundColour = 'red', 48 | TextColour = 'white' 49 | }, 50 | { 51 | X = '50%, 5', 52 | Y = '50%, 2', 53 | Align = 'Center', 54 | Type = 'Button', 55 | Name = 'RetryButton', 56 | Text = 'Retry', 57 | BackgroundColour = 'red', 58 | TextColour = 'white' 59 | }, 60 | } 61 | }, 62 | }, 63 | BackgroundColour = 'lightGrey', 64 | } -------------------------------------------------------------------------------- /System/Shared Objects/ColourPicker.lua: -------------------------------------------------------------------------------- 1 | Width = 34 2 | 3 | ActiveColour = nil 4 | 5 | local pickerColours = { 6 | colours.brown, 7 | colours.yellow, 8 | colours.orange, 9 | colours.red, 10 | colours.green, 11 | colours.lime, 12 | colours.magenta, 13 | colours.pink, 14 | colours.purple, 15 | colours.blue, 16 | colours.cyan, 17 | colours.lightBlue, 18 | colours.lightGrey, 19 | colours.grey, 20 | colours.black, 21 | colours.white 22 | } 23 | 24 | OnDraw = function(self, x, y) 25 | local _x = 0 26 | 27 | for i, col in ipairs(pickerColours) do 28 | local w = 2 29 | if col == self.ActiveColour then 30 | w = 4 31 | end 32 | 33 | if col == colours.white then 34 | Drawing.DrawCharacters(x + _x, y, ('#'):rep(w), colours.lightGrey, col) 35 | else 36 | Drawing.DrawBlankArea(x + _x, y, w, self.Height, col) 37 | end 38 | 39 | _x = _x + w 40 | end 41 | end 42 | 43 | OnUpdate = function(self, value) 44 | if value == 'ActiveColour' then 45 | if self.OnChange then 46 | self:OnChange(self.ActiveColour) 47 | end 48 | end 49 | end 50 | 51 | OnClick = function(self, event, side, x, y) 52 | local _x = 0 53 | 54 | for i, col in ipairs(pickerColours) do 55 | local w = 2 56 | if col == self.ActiveColour then 57 | w = 4 58 | end 59 | 60 | if x >= _x + 1 and x <= _x + w + 1 then 61 | self.ActiveColour = col 62 | end 63 | 64 | _x = _x + w 65 | end 66 | end 67 | 68 | OnDrag = OnClick -------------------------------------------------------------------------------- /Programs/Transmit.program/Views/message.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Children"]={ 3 | [1]={ 4 | ["Y"]="50%,-4", 5 | ["X"]="50%,-5", 6 | ["Name"]="StatusImageView", 7 | ["Type"]="ImageView", 8 | ["Width"]=10, 9 | ["Height"]=5, 10 | }, 11 | [2]={ 12 | ["Y"]="50%,3", 13 | ["X"]=1, 14 | ["Name"]="StatusLabel", 15 | ["Width"]="100%", 16 | ["Height"]=2, 17 | ["Type"]="Label", 18 | ["Align"]="Center", 19 | ["Text"]="" 20 | }, 21 | [3]={ 22 | ["Y"]="50%,5", 23 | ["X"]=1, 24 | ["Name"]="SecondaryStatusLabel", 25 | ["Width"]="100%", 26 | ["Height"]=2, 27 | ["Type"]="Label", 28 | ["Align"]="Center", 29 | ["Text"]="" 30 | }, 31 | [4]={ 32 | ["Y"]="100%", 33 | ["X"]=1, 34 | ["Name"]="ComputerLabel", 35 | ["Width"]="100%", 36 | ["Type"]="Label", 37 | ["Align"]="Center", 38 | ["TextColour"]=256, 39 | ["Text"]="" 40 | }, 41 | [5]={ 42 | ["Y"]="50%,7", 43 | ["X"]="50%,-5", 44 | ["Name"]="YesButton", 45 | ["Height"]=1, 46 | ["Type"]="Button", 47 | ["Text"]="Yes", 48 | ["Visible"]=false 49 | }, 50 | [6]={ 51 | ["Y"]="50%,7", 52 | ["X"]="50%,2", 53 | ["Name"]="NoButton", 54 | ["Height"]=1, 55 | ["Type"]="Button", 56 | ["Text"]="No", 57 | ["Visible"]=false 58 | }, 59 | }, 60 | ["BackgroundColour"]=1 61 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/FilterPreview.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | 3 | BackgroundColour = colours.transparent 4 | TextColour = colours.black 5 | Height = 3 6 | Image = nil 7 | Enabled = true 8 | 9 | OnLoad = function(self) 10 | self.Image = Drawing.LoadImage('Resources/filterPreview.nft') 11 | 12 | self:AddObject({ 13 | X = 6, 14 | Y = 1, 15 | Text = self.FilterName, 16 | Type = 'Label', 17 | BackgroundColour = colours.transparent, 18 | TextColour = self.TextColour 19 | }) 20 | end 21 | 22 | OnDraw = function(self, x, y) 23 | if self.BackgroundColour then 24 | Drawing.DrawBlankArea(x, y, self.Width, self.Height, self.BackgroundColour) 25 | end 26 | 27 | local filter = Drawing.Filters[self.Filter] 28 | if not filter then 29 | filter = Drawing.Filters.None 30 | end 31 | 32 | for _y = 1, #self.Image do 33 | for _x = 1, #self.Image[_y] do 34 | local bgColour = Drawing.FilterColour(self.Image[_y][_x], filter) 35 | local textColour = Drawing.FilterColour(self.Image.textcol[_y][_x] or colours.white, filter) 36 | local char = self.Image.text[_y][_x] 37 | Drawing.WriteToBuffer(x+_x, y+_y-1, char, textColour, bgColour) 38 | end 39 | end 40 | end 41 | 42 | OnClick = function(self, event, side, x, y) 43 | if self.Enabled then 44 | local artboard = self.Bedrock:GetObject('Artboard') 45 | if artboard then 46 | artboard:CreateLayer(self.FilterName .. ' Filter', colours.white, 'Filter:' .. self.Filter) 47 | end 48 | end 49 | end -------------------------------------------------------------------------------- /System/Programs/Setup.program/Views/2.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 3, 5 | Y = 2, 6 | TextColour = 'grey', 7 | Type = 'Label', 8 | Text = 'OneOS' 9 | }, 10 | { 11 | X = 9, 12 | Y = 2, 13 | TextColour = 'lightGrey', 14 | Type = 'Label', 15 | Text = 'Setup' 16 | }, 17 | 18 | { 19 | X = 3, 20 | Y = 5, 21 | TextColour = 'grey', 22 | Type = 'Label', 23 | Text = 'Desktop Background' 24 | }, 25 | { 26 | X = 3, 27 | Y = 6, 28 | Width = '100%,-4', 29 | TextColour = 'lightGrey', 30 | Type = 'Label', 31 | Text = 'Choose a colour for your desktop.' 32 | }, 33 | 34 | 35 | { 36 | X = '50%,-17', 37 | Y = 9, 38 | Width = 34, 39 | Type = 'ColourPicker', 40 | Name = 'DesktopColourPicker', 41 | ActiveColour = 'cyan' 42 | }, 43 | 44 | 45 | { 46 | X = 3, 47 | Y = '100%,-1', 48 | Type = 'Button', 49 | Name = 'BackButton', 50 | Text = 'Back' 51 | }, 52 | { 53 | X = '100%,-7', 54 | Y = '100%,-1', 55 | Type = 'Button', 56 | Name = 'NextButton', 57 | Text = 'Next' 58 | }, 59 | }, 60 | } -------------------------------------------------------------------------------- /System/Programs/Update.program/startup: -------------------------------------------------------------------------------- 1 | Bedrock.ProgramPath = '/System/Programs/Update.program/startup' 2 | 3 | local program = Bedrock:Initialise() 4 | program.Settings = Settings:Initialise() 5 | System.Bedrock = program 6 | 7 | local function setStatus(text) 8 | program:GetObject('StatusLabel').Text = text 9 | end 10 | 11 | function Initialise() 12 | -- do return end 13 | program:Run(function() 14 | -- TODO: debug only 15 | program:RegisterKeyboardShortcut({'\\'}, function()os.reboot()end) 16 | 17 | local gitHub = GitHub:Initialise('oeed', 'OneOS', program) 18 | 19 | gitHub.OnDataFailed = function(self, reason) 20 | program:LoadView('error') 21 | program:GetObject('RetryButton').OnClick = os.reboot 22 | program:GetObject('SkipUpdateButton').OnClick = function() 23 | System.ClearBootArgs() 24 | os.reboot() 25 | end 26 | program:GetObject('ErrorLabel').Text = reason 27 | end 28 | 29 | setStatus('Fetching Version') 30 | -- gitHub:LatestRelease(program.Settings.UsePreReleases, function(release) 31 | release = 'v1.3.4' 32 | setStatus('Downloading Files') 33 | gitHub:DownloadFiles(release, function(raw) 34 | Log.i('Downloaded') 35 | setStatus('Installing Update') 36 | gitHub:InstallFiles(raw, function() 37 | gitHub:SaveVersion(release) 38 | setStatus('Update Complete') 39 | program:StartTimer(function() 40 | System.ClearBootArgs() 41 | os.reboot() 42 | end, 3) 43 | end) 44 | end) 45 | -- end) 46 | end) 47 | end 48 | 49 | -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/toolswindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=17, 3 | ["Height"]=9, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=2, 8 | ["X"]=2, 9 | ["Type"]="Button", 10 | ["Name"]="ToolButton", 11 | ["Text"]="Hand", 12 | ["ToolName"]="HandTool", 13 | }, 14 | [2]={ 15 | ["Y"]=2, 16 | ["X"]=9, 17 | ["Type"]="Button", 18 | ["Name"]="ToolButton", 19 | ["Text"]="Pencil", 20 | ["ToolName"]="PencilTool", 21 | }, 22 | [3]={ 23 | ["Y"]=4, 24 | ["X"]=2, 25 | ["Type"]="Button", 26 | ["Name"]="ToolButton", 27 | ["Text"]="Fill", 28 | ["ToolName"]="FillTool", 29 | }, 30 | [4]={ 31 | ["Y"]=4, 32 | ["X"]=9, 33 | ["Type"]="Button", 34 | ["Name"]="ToolButton", 35 | ["Text"]="Eraser", 36 | ["ToolName"]="EraserTool", 37 | }, 38 | [5]={ 39 | ["Y"]=6, 40 | ["X"]=2, 41 | ["Type"]="Button", 42 | ["Name"]="ToolButton", 43 | ["Text"]="Text", 44 | ["ToolName"]="TextTool", 45 | }, 46 | [6]={ 47 | ["Y"]=6, 48 | ["X"]=9, 49 | ["Width"]=8, 50 | ["Type"]="Button", 51 | ["Name"]="ToolButton", 52 | ["Text"]="Spray", 53 | ["ToolName"]="SprayTool", 54 | }, 55 | [7]={ 56 | ["Y"]=8, 57 | ["X"]=2, 58 | ["Type"]="Button", 59 | ["Name"]="ToolButton", 60 | ["Text"]="Move", 61 | ["ToolName"]="MoveTool", 62 | }, 63 | [8]={ 64 | ["Y"]=8, 65 | ["X"]=9, 66 | ["Type"]="Button", 67 | ["Name"]="ToolButton", 68 | ["Text"]="Select", 69 | ["ToolName"]="SelectTool", 70 | }, 71 | }, 72 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/filterswindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=22, 3 | ["Height"]=14, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=1, 8 | ["X"]=1, 9 | ["Width"]="100%", 10 | ["Height"]="100%", 11 | ["Type"]="ScrollView", 12 | ["Children"]={ 13 | [1]={ 14 | ["Y"]=2, 15 | ["X"]=1, 16 | ["Width"]="100%", 17 | ["Type"]="FilterPreview", 18 | ["Filter"]="None", 19 | ["FilterName"]="None", 20 | ["Enabled"]=false, 21 | ["TextColour"]=256 22 | }, 23 | [2]={ 24 | ["Y"]=5, 25 | ["X"]=1, 26 | ["Width"]="100%", 27 | ["Type"]="FilterPreview", 28 | ["Filter"]="Greyscale", 29 | ["FilterName"]="Greyscale", 30 | }, 31 | [3]={ 32 | ["Y"]=8, 33 | ["X"]=1, 34 | ["Width"]="100%", 35 | ["Type"]="FilterPreview", 36 | ["Filter"]="BlackWhite", 37 | ["FilterName"]="Black and White", 38 | }, 39 | [4]={ 40 | ["Y"]=11, 41 | ["X"]=1, 42 | ["Width"]="100%", 43 | ["Type"]="FilterPreview", 44 | ["Filter"]="Darker", 45 | ["FilterName"]="Darker", 46 | }, 47 | [5]={ 48 | ["Y"]=14, 49 | ["X"]=1, 50 | ["Width"]="100%", 51 | ["Type"]="FilterPreview", 52 | ["Filter"]="Lighter", 53 | ["FilterName"]="Lighter", 54 | }, 55 | [6]={ 56 | ["Y"]=17, 57 | ["X"]=1, 58 | ["Width"]="100%", 59 | ["Type"]="FilterPreview", 60 | ["Filter"]="Invert", 61 | ["FilterName"]="Invert", 62 | }, 63 | } 64 | } 65 | }, 66 | } -------------------------------------------------------------------------------- /System/Programs/Settings.program/startup: -------------------------------------------------------------------------------- 1 | OneOS.LoadAPI('/System/API/Bedrock.lua') 2 | 3 | local program = Bedrock:Initialise() 4 | 5 | local currentPage = nil 6 | 7 | local function changePage(name) 8 | currentPage = name 9 | local selectionButtons = program:GetObject('SelectionWrap').Children 10 | for i, v in ipairs(selectionButtons) do 11 | if v.Text == name then 12 | v.Toggle = true 13 | else 14 | v.Toggle = false 15 | end 16 | end 17 | 18 | program:RemoveObject('CurrentPageView') 19 | program:AddObject({ 20 | X = 1, 21 | Y = 4, 22 | Width = '100%', 23 | Height = '100%,-3', 24 | Type = name .. 'PageView', 25 | InheritView = name:lower(), 26 | Name = 'CurrentPageView' 27 | }) 28 | end 29 | 30 | local function updateStorage() 31 | if currentPage == 'Storage' then 32 | changePage('Storage') 33 | end 34 | end 35 | 36 | program:Run(function() 37 | program:RegisterEvent('disk', updateStorage) 38 | program:RegisterEvent('disk_eject', updateStorage) 39 | program:RegisterEvent('peripheral', updateStorage) 40 | program:RegisterEvent('peripheral_detach', updateStorage) 41 | 42 | changePage('About') 43 | 44 | local changeFunc = function(self, event, side, x, y) 45 | changePage(self.Text) 46 | end 47 | 48 | program:GetObject('AboutButton').OnClick = changeFunc 49 | program:GetObject('AppearanceButton').OnClick = changeFunc 50 | program:GetObject('StorageButton').OnClick = changeFunc 51 | program:GetObject('SystemButton').OnClick = changeFunc 52 | 53 | end) -------------------------------------------------------------------------------- /System/Programs/Settings.program/Objects/SystemPageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnPageLoad = function(self) 4 | self:GetObject('ComputerNameTextBox').Text = os.getComputerLabel() or '' 5 | self:GetObject('AutomaticUpdatesSwitch').Toggle = OneOS.System.Settings.AutomaticUpdates 6 | self:GetObject('UsePreReleasesSwitch').Toggle = OneOS.System.Settings.UsePreReleases 7 | self:GetObject('StartupProgramLabel').Text = OneOS.System.Settings.StartupProgram or 'None' 8 | 9 | self:GetObject('ComputerNameTextBox').OnChange = function(_) 10 | os.setComputerLabel(_.Text) 11 | end 12 | 13 | self:GetObject('AutomaticUpdatesSwitch').OnChange = function(_, value) 14 | OneOS.System.Settings.AutomaticUpdates = value 15 | end 16 | 17 | self:GetObject('UpdateNowButton').OnClick = function() 18 | OneOS.System.CheckUpdates(true) 19 | end 20 | 21 | self:GetObject('UsePreReleasesSwitch').OnChange = function(_, value) 22 | OneOS.System.Settings.UsePreReleases = value 23 | end 24 | 25 | self:GetObject('SelectStartupProgramButton').OnClick = function(_, event, side, x , y) 26 | self.Bedrock:DisplayOpenFileWindow('Startup File/Program', function(ok, path) 27 | if ok then 28 | OneOS.System.Settings.StartupProgram = path 29 | self:GetObject('StartupProgramLabel').Text = path 30 | end 31 | end) 32 | end 33 | 34 | self:GetObject('NoneStartupProgramButton').OnClick = function(_, event, side, x , y) 35 | OneOS.System.Settings.StartupProgram = nil 36 | self:GetObject('StartupProgramLabel').Text = 'None' 37 | end 38 | 39 | end -------------------------------------------------------------------------------- /System/Programs/Setup.program/Views/1.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 3, 5 | Y = 2, 6 | TextColour = 'grey', 7 | Type = 'Label', 8 | Text = 'OneOS' 9 | }, 10 | { 11 | X = 9, 12 | Y = 2, 13 | TextColour = 'lightGrey', 14 | Type = 'Label', 15 | Text = 'Setup' 16 | }, 17 | 18 | { 19 | X = 3, 20 | Y = 5, 21 | TextColour = 'grey', 22 | Type = 'Label', 23 | Text = 'Computer Name' 24 | }, 25 | { 26 | X = 3, 27 | Y = 6, 28 | Width = '100%,-4', 29 | TextColour = 'lightGrey', 30 | Type = 'Label', 31 | Text = 'Enter the name of this computer.' 32 | }, 33 | 34 | 35 | { 36 | X = '25%', 37 | Y = 9, 38 | Width = '50%', 39 | Type = 'TextBox', 40 | Name = 'NameTextBox', 41 | Text = 'OneOS Computer', 42 | Placeholder = 'No Name' 43 | }, 44 | 45 | 46 | { 47 | X = 3, 48 | Y = '100%,-1', 49 | Type = 'Button', 50 | Name = 'BackButton', 51 | Text = 'Back' 52 | }, 53 | { 54 | X = '100%,-7', 55 | Y = '100%,-1', 56 | Type = 'Button', 57 | Name = 'NextButton', 58 | Text = 'Next' 59 | }, 60 | }, 61 | } -------------------------------------------------------------------------------- /System/Programs/Setup.program/Views/4.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 3, 5 | Y = 2, 6 | TextColour = 'grey', 7 | Type = 'Label', 8 | Text = 'OneOS' 9 | }, 10 | { 11 | X = 9, 12 | Y = 2, 13 | TextColour = 'lightGrey', 14 | Type = 'Label', 15 | Text = 'Setup' 16 | }, 17 | 18 | { 19 | X = 3, 20 | Y = 5, 21 | TextColour = 'grey', 22 | Type = 'Label', 23 | Text = 'Done!' 24 | }, 25 | { 26 | X = 3, 27 | Y = 6, 28 | Width = '100%,-4', 29 | TextColour = 'lightGrey', 30 | Type = 'Label', 31 | Text = 'OneOS is all setup and ready to go.' 32 | }, 33 | { 34 | X = 1, 35 | Y = '100%,-3', 36 | Width = '100%', 37 | Align = 'Center', 38 | TextColour = 'lightGrey', 39 | Type = 'Label', 40 | Text = 'Click \'Reboot\' to start using OneOS.' 41 | }, 42 | 43 | { 44 | X = 3, 45 | Y = '100%,-1', 46 | Type = 'Button', 47 | Name = 'BackButton', 48 | Text = 'Back' 49 | }, 50 | { 51 | X = '100%,-9', 52 | Y = '100%,-1', 53 | Type = 'Button', 54 | Name = 'NextButton', 55 | Text = 'Reboot' 56 | }, 57 | }, 58 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/SidebarButton.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'Button' 2 | 3 | X = 1 4 | Width = 3 5 | Height = 1 6 | AutoWidth = false 7 | 8 | TextColour = colours.white 9 | ActiveTextColour = colours.lightGrey 10 | 11 | WindowDocked = false 12 | Window = false 13 | 14 | OnDraw = function(self, x, y) 15 | local text = self.Text 16 | if self.WindowDocked then 17 | text = ' > ' 18 | end 19 | 20 | local textColour = self.TextColour 21 | if self.Toggle then 22 | textColour = self.ActiveTextColour 23 | end 24 | if not self.Enabled then 25 | textColour = self.DisabledTextColour 26 | end 27 | 28 | Drawing.DrawCharacters(x, y, text, textColour, colours.transparent) 29 | end 30 | 31 | 32 | OnClick = function(self, event, side, x, y) 33 | if event == 'mouse_click' then 34 | if self.WindowName and not self.Window then 35 | self.Window = self.Bedrock:AddObject({ 36 | ["Y"]=(self.Bedrock:GetAbsolutePosition(self)).Y, 37 | ["Type"]=self.WindowName, 38 | ["Docked"]=true, 39 | OnDockChange = function(_self, state) 40 | self.WindowDocked = state 41 | if state then 42 | _self.Y = (self.Bedrock:GetAbsolutePosition(self)).Y 43 | _self.X = Drawing.Screen.Width - _self.Width - 2 44 | self.Parent:OnDock() 45 | end 46 | end, 47 | OnClose = function(_self) 48 | self.Window = nil 49 | self.WindowDocked = false 50 | end 51 | }) 52 | self.Window.X = Drawing.Screen.Width - self.Window.Width - 2 53 | self.Parent:CloseDocked() 54 | self.WindowDocked = true 55 | else 56 | self.Window:Close() 57 | end 58 | end 59 | end -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/HomePageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnDataLoad = function(self, url, data) 4 | self:RemoveAllObjects() 5 | 6 | local categories = textutils.unserialize(data) 7 | 8 | local function load(from) 9 | local to = {} 10 | for i, v in ipairs(from) do 11 | local app = App:Initialise(v, self.Bedrock) 12 | table.insert(to, app) 13 | end 14 | return to 15 | end 16 | 17 | local topcharts = load(categories.topcharts) 18 | 19 | local newest = load(categories.newest) 20 | 21 | local featured = load(categories.featured) 22 | 23 | self:AddObject({ 24 | X = 1, 25 | Y = 1, 26 | Type = 'AppCollectionView', 27 | Width = '100%', 28 | Title = 'Most Popular Apps', 29 | Height = 2 + math.ceil(#topcharts / 2) * 4, 30 | Name = 'PopularAppCollectionView', 31 | Items = topcharts 32 | }) 33 | 34 | self:AddObject({ 35 | X = 1, 36 | Y = 4 + #topcharts * 2, 37 | Type = 'AppCollectionView', 38 | Width = '100%', 39 | Title = 'Featured Apps', 40 | Height = 2 + math.ceil(#featured / 2) * 4, 41 | Name = 'FeaturedAppCollectionView', 42 | Items = featured 43 | }) 44 | 45 | self:AddObject({ 46 | X = 1, 47 | Y = 7 + #topcharts * 2 + #featured * 2, 48 | Type = 'AppCollectionView', 49 | Width = '100%', 50 | Title = 'Most Recently Added Apps', 51 | Height = 2 + math.ceil(#newest / 2) * 4, 52 | Name = 'RecentAppCollectionView', 53 | Items = newest 54 | }) 55 | 56 | self:UpdateScroll() 57 | end 58 | 59 | DataURL = function(self, info) 60 | return self.Bedrock.AppStoreURL .. 'api/?command=application&subcommand=home' 61 | end -------------------------------------------------------------------------------- /System/APIs/Settings.lua: -------------------------------------------------------------------------------- 1 | Defaults = { 2 | AutomaticUpdates = true, 3 | UsePreReleases = true, -- TODO: set this false when the beta ends 4 | StartupProgram = false, 5 | UseAnimations = true, 6 | DesktopColour = colours.cyan 7 | } 8 | 9 | Values = nil 10 | OnUpdateHandlers = nil 11 | 12 | function Initialise(self) 13 | local _new = {} -- the new instance 14 | setmetatable( _new, {__index = self} ) 15 | 16 | _new.Values = {} 17 | _new.OnUpdateHandlers = {} 18 | 19 | local new = {} -- the proxy 20 | setmetatable(new, { 21 | __index = function(t, k) 22 | 23 | Log.i('Index '..k) 24 | if k == 'OnUpdate' then 25 | return _new.OnUpdate 26 | elseif k == 'OnUpdateHandlers' then 27 | return _new.OnUpdateHandlers 28 | elseif _new.Values[k] == nil then 29 | return _new.Defaults[k] 30 | else 31 | return _new.Values[k] 32 | end 33 | end, 34 | 35 | __newindex = function (t,k,v) 36 | _new.Values[k] = v 37 | 38 | for i, handler in ipairs(_new.OnUpdateHandlers) do 39 | if handler then 40 | handler(k) 41 | end 42 | end 43 | 44 | local h = fs.open('/System/.OneOS.settings', 'w') 45 | if h then 46 | h.write(textutils.serialize(_new.Values)) 47 | h.close() 48 | end 49 | end 50 | }) 51 | 52 | local h = fs.open('/System/.OneOS.settings', 'r') 53 | if h then 54 | local values = textutils.unserialize(h.readAll()) 55 | 56 | for k, v in pairs(values) do 57 | _new.Values[k] = v 58 | end 59 | h.close() 60 | end 61 | 62 | return new 63 | end 64 | 65 | function OnUpdate(self, handler) 66 | table.insert(self.OnUpdateHandlers, handler) 67 | end -------------------------------------------------------------------------------- /System/Programs/Files.program/Views/main.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 1, 5 | Y = 1, 6 | Width = '100%', 7 | Height = 3, 8 | BackgroundColour = 'lightGrey', 9 | Type = 'View', 10 | Name = 'Toolbar', 11 | Children = { 12 | { 13 | X = 2, 14 | Y = 2, 15 | Type = 'Button', 16 | Name = 'BackButton', 17 | Text = '<', 18 | TextColour = 'grey', 19 | BackgroundColour = 'white', 20 | Enabled = false 21 | }, 22 | { 23 | X = 6, 24 | Y = 2, 25 | Type = 'Button', 26 | Name = 'ForwardButton', 27 | Text = '>', 28 | TextColour = 'grey', 29 | BackgroundColour = 'white', 30 | Enabled = false 31 | }, 32 | { 33 | X = 10, 34 | Y = 2, 35 | Type = 'Button', 36 | Text = 'Up', 37 | Name = 'UpButton', 38 | TextColour = 'grey', 39 | BackgroundColour = 'white' 40 | }, 41 | { 42 | X = 16, 43 | Y = 2, 44 | Type = 'TextBox', 45 | Name = 'PathTextBox', 46 | Text = '', 47 | Width = '100%,-16', 48 | TextColour = 'grey', 49 | BackgroundColour = 'white' 50 | }, 51 | -- { 52 | -- X = 1, 53 | -- Y = 3, 54 | -- Type = 'Separator', 55 | -- Character = '_', 56 | -- Colour = 'lightGrey', 57 | -- Width = '100%', 58 | -- } 59 | } 60 | }, 61 | 62 | { 63 | X = 1, 64 | Y = 4, 65 | Width = '100%', 66 | Height = '100%,-3', 67 | BackgroundColour = 'transparent', 68 | Type = 'CollectionView', 69 | Name = 'FilesCollectionView', 70 | Items = {} 71 | } 72 | }, 73 | BackgroundColour = 'white', 74 | } -------------------------------------------------------------------------------- /System/Shared Objects/FilterLabel.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'Label' 2 | Passes = 1 3 | 4 | OnLoad = function(self) 5 | self:OnUpdate('FilterName') 6 | end 7 | 8 | OnUpdate = function(self, value) 9 | if value == 'FilterName' then 10 | self.Filter = Drawing.Filters[self.FilterName] 11 | elseif value == 'Text' then 12 | if self.AutoWidth then 13 | self.Width = #self.Text 14 | else 15 | self.Height = #self.Bedrock.Helpers.WrapText(self.Text, self.Width) 16 | end 17 | end 18 | end 19 | 20 | OnDraw = function(self, x, y) 21 | local filter = self.Filter 22 | for i, v in ipairs(self.Bedrock.Helpers.WrapText(self.Text, self.Width)) do 23 | local _x = 0 24 | if self.Align == 'Right' then 25 | _x = self.Width - #v 26 | elseif self.Align == 'Center' then 27 | _x = math.floor((self.Width - #v) / 2) 28 | end 29 | 30 | for c = 1, #v do 31 | if Drawing.Buffer[y + i - 1] and Drawing.Buffer[y + i - 1][x + _x + c - 1] then 32 | local px = Drawing.Buffer[y + i - 1][x + _x + c - 1] 33 | -- error(Drawing.FilterColour(px[2], filter)) 34 | -- error(y + i - 1) 35 | -- Drawing.DrawCharacters(x + _x + c - 1, y + i - 1, 'a', colors.black, self.BackgroundColour) 36 | local colour = px[3] 37 | for i = 1, self.Passes do 38 | colour = Drawing.FilterColour(colour, filter) 39 | end 40 | if colour == px[3] then 41 | colour = colours.white 42 | end 43 | Drawing.WriteToBuffer(x + _x + c - 1, y + i - 1, v:sub(c, c), colour, self.BackgroundColour) 44 | end 45 | end 46 | end 47 | end 48 | 49 | -------------------------------------------------------------------------------- /System/Views/switcher.view: -------------------------------------------------------------------------------- 1 | { 2 | Width = "100%", 3 | Height = 6, 4 | Type = 'Switcher', 5 | BackgroundColour = 'black', 6 | Children = { 7 | -- { 8 | -- X = 1, 9 | -- Y = "100%,-2", 10 | -- Width = "100%", 11 | -- Height = 3, 12 | -- Type = 'View', 13 | -- BackgroundColour = 'grey', 14 | -- InheritView = 'switcher-controls' 15 | -- }, 16 | -- { 17 | -- X = 1, 18 | -- Y = "100%,-2", 19 | -- Type = 'Label', 20 | -- Text = 'OneOS', 21 | -- TextColour = 'white' 22 | -- }, 23 | -- { 24 | -- X = 7, 25 | -- Y = "100%,-2", 26 | -- Type = 'Label', 27 | -- Text = 'by oeed', 28 | -- TextColour = 'lightGrey' 29 | -- }, 30 | { 31 | Y = 2, 32 | X = 3, 33 | Type = 'ImageView', 34 | Path = '/icons/files', 35 | Width = 4, 36 | Height = 3, 37 | }, 38 | { 39 | Y = 5, 40 | X = 1, 41 | Type = 'Label', 42 | Text = 'Files', 43 | TextColour = 'white', 44 | Align = 'Center', 45 | Width = 8 46 | }, 47 | 48 | { 49 | Y = 2, 50 | X = 11, 51 | Type = 'ImageView', 52 | Path = '/icons/ink', 53 | Width = 4, 54 | Height = 3, 55 | }, 56 | { 57 | Y = 5, 58 | X = 9, 59 | Type = 'Label', 60 | Text = 'Ink', 61 | TextColour = 'white', 62 | Align = 'Center', 63 | Width = 8 64 | }, 65 | 66 | { 67 | Y = 2, 68 | X = 19, 69 | Type = 'ImageView', 70 | Path = '/icons/sketch', 71 | Width = 4, 72 | Height = 3, 73 | }, 74 | { 75 | Y = 5, 76 | X = 17, 77 | Type = 'Label', 78 | Text = 'Sketch', 79 | TextColour = 'white', 80 | Align = 'Center', 81 | Width = 8 82 | }, 83 | } 84 | } -------------------------------------------------------------------------------- /System/Programs/Setup.program/Views/3.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 3, 5 | Y = 2, 6 | TextColour = 'grey', 7 | Type = 'Label', 8 | Text = 'OneOS' 9 | }, 10 | { 11 | X = 9, 12 | Y = 2, 13 | TextColour = 'lightGrey', 14 | Type = 'Label', 15 | Text = 'Setup' 16 | }, 17 | 18 | { 19 | X = 3, 20 | Y = 5, 21 | TextColour = 'grey', 22 | Type = 'Label', 23 | Text = 'Use Animations?' 24 | }, 25 | { 26 | X = 3, 27 | Y = 6, 28 | Width = '100%,-4', 29 | TextColour = 'lightGrey', 30 | Type = 'Label', 31 | Text = 'Do not use animations on servers or slow computers.' 32 | }, 33 | 34 | { 35 | X = 3, 36 | Y = '100%,-1', 37 | Type = 'Button', 38 | Name = 'BackButton', 39 | Text = 'Back' 40 | }, 41 | { 42 | X = '100%,-12', 43 | Y = '100%,-1', 44 | Type = 'Button', 45 | Name = 'NoButton', 46 | BackgroundColour = 'red', 47 | TextColour = 'white', 48 | Text = 'No' 49 | }, 50 | { 51 | X = '100%,-6', 52 | Y = '100%,-1', 53 | Type = 'Button', 54 | Name = 'YesButton', 55 | BackgroundColour = 'green', 56 | TextColour = 'white', 57 | Text = 'Yes' 58 | }, 59 | }, 60 | } -------------------------------------------------------------------------------- /System/Programs/Files.program/pkgmake: -------------------------------------------------------------------------------- 1 | sPackage=[[local _fs = fs if OneOS then _fs = OneOS.FS end local pkg=%@1 2 | local function makeFile(_path,_content) 3 | local file=OneOS.FS.open(_path,"w") 4 | file.write(_content) 5 | file.close() 6 | end 7 | local function makeFolder(_path,_content) 8 | OneOS.FS.makeDir(_path) 9 | for k,v in pairs(_content) do 10 | if type(v)=="table" then 11 | makeFolder(_path.."/"..k,v) 12 | else 13 | makeFile(_path.."/"..k,v) 14 | end 15 | end 16 | end 17 | local sDest= installLocation or '/' 18 | if sDest=="root" then 19 | sDest="/" 20 | end 21 | sDest = sDest .. %@2 22 | local tPackage=pkg 23 | makeFolder(sDest,tPackage) 24 | ]]function addFile(a,b)if OneOS.FS.getName(b)==".DS_Store"then return a end;local c,d=OneOS.FS.open(b,"r")local e=c.readAll()e=e:gsub("%%","%%%%")a[OneOS.FS.getName(b)]=e;c.close()return a end;function addFolder(a,b)if string.sub(b,1,string.len("rom"))=="rom"or string.sub(b,1,string.len("/rom"))=="/rom"then return end;a=a or{}for f,g in ipairs(OneOS.FS.list(b))do local h=b.."/"..g;if OneOS.FS.isDir(h)then a[OneOS.FS.getName(g)]=addFolder(a[OneOS.FS.getName(g)],h)else a=addFile(a,h)end end;return a end;local i={...}local j=OneOS.Shell.resolve(i[1])local k=OneOS.Shell.resolve(i[2])if OneOS.FS.exists(j)and OneOS.FS.isDir(j)then tPackage={}tPackage=addFolder(tPackage,j)fPackage=OneOS.FS.open(k,"w")if fPackage then sPackage=string.gsub(sPackage,"%%@1",textutils.serialize(tPackage))sPackage=string.gsub(sPackage,"%%@2",textutils.serialize(OneOS.FS.getName(i[1])))fPackage.write(sPackage)fPackage.close()else error(k)end else error(j)error("Source does not exist or is not a folder.")end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/toolsmenu.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Type"]="Menu", 3 | ["Owner"]="ToolsMenuButton", 4 | ["HideTop"]=true, 5 | ["Children"]={ 6 | [1]={ 7 | ["Name"]="ToolMenuItem", 8 | ["ToolName"]="HandTool", 9 | ["Type"]="MenuItem", 10 | ["Text"]="Hand", 11 | ["Shortcut"]="~H" 12 | }, 13 | [2]={ 14 | ["Name"]="ToolMenuItem", 15 | ["ToolName"]="PencilTool", 16 | ["Type"]="MenuItem", 17 | ["Text"]="Pencil", 18 | ["Shortcut"]="~P" 19 | }, 20 | [3]={ 21 | ["Name"]="ToolMenuItem", 22 | ["ToolName"]="FillTool", 23 | ["Type"]="MenuItem", 24 | ["Text"]="Fill", 25 | ["Shortcut"]="~F" 26 | }, 27 | [4]={ 28 | ["Name"]="ToolMenuItem", 29 | ["ToolName"]="EraserTool", 30 | ["Type"]="MenuItem", 31 | ["Text"]="Eraser", 32 | ["Shortcut"]="~E" 33 | }, 34 | [5]={ 35 | ["Name"]="ToolMenuItem", 36 | ["ToolName"]="TextTool", 37 | ["Type"]="MenuItem", 38 | ["Text"]="Text", 39 | ["Shortcut"]="~T" 40 | }, 41 | [6]={ 42 | ["Name"]="ToolMenuItem", 43 | ["ToolName"]="SprayTool", 44 | ["Type"]="MenuItem", 45 | ["Text"]="Spray", 46 | ["Shortcut"]="~R" 47 | }, 48 | [7]={ 49 | ["Name"]="ToolMenuItem", 50 | ["ToolName"]="MoveTool", 51 | ["Type"]="MenuItem", 52 | ["Text"]="Move", 53 | ["Shortcut"]="~M" 54 | }, 55 | [8]={ 56 | ["Name"]="ToolMenuItem", 57 | ["ToolName"]="SelectTool", 58 | ["Type"]="MenuItem", 59 | ["Text"]="Select", 60 | ["Shortcut"]="~S" 61 | }, 62 | }, 63 | } -------------------------------------------------------------------------------- /System/Programs/Desktop.program/Views/main.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = '100%,-7', 5 | Y = '100%', 6 | Text = 'Shutdown', 7 | Name = 'ShutdownButton', 8 | Type = 'FilterLabel', 9 | FilterName = 'Highlight' 10 | }, 11 | { 12 | X = '100%,-15', 13 | Y = '100%', 14 | Text = 'Restart', 15 | Name = 'RestartButton', 16 | Type = 'FilterLabel', 17 | FilterName = 'Highlight' 18 | }, 19 | { 20 | X = '100%,-22', 21 | Y = '100%', 22 | Text = 'Search', 23 | Name = 'SearchButton', 24 | Type = 'FilterLabel', 25 | FilterName = 'Highlight' 26 | }, 27 | { 28 | X = 1, 29 | Y = -12, 30 | Height = 13, 31 | Width = '100%', 32 | Type = 'FilterView', 33 | FilterName = 'Darker', 34 | Children = { 35 | { 36 | X = 2, 37 | Y = '100%,-1', 38 | Width = '100%,-9', 39 | Type = 'FilterView', 40 | FilterName = 'Highlight' 41 | }, 42 | { 43 | X = 2, 44 | Y = '100%,-1', 45 | Width = '100%,-9', 46 | Type = 'TextBox', 47 | TextColour = 'white', 48 | BackgroundColour = 'transparent', 49 | Name = 'SearchTextBox', 50 | Placeholder = 'Search', 51 | Active = true 52 | }, 53 | { 54 | X = '100%,-6', 55 | Y = '100%,-1', 56 | Text = 'Cancel', 57 | Name = 'CancelLabel', 58 | Type = 'FilterLabel', 59 | FilterName = 'Highlight' 60 | } 61 | } 62 | }, 63 | { 64 | X = 1, 65 | Y = 1, 66 | Width = '100%', 67 | Height = '100%', 68 | Type = 'SearchView', 69 | BackgroundColour = 'cyan' 70 | } 71 | }, 72 | BackgroundColour = 'cyan', 73 | ToolBarColour = 'white', 74 | } -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/InstallPageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | TimeoutLength = 40 4 | 5 | OnLoad = function(self) 6 | self:RemoveAllObjects() 7 | ScrollView.OnLoad(self) 8 | self:AddObject({ 9 | X = '50%,-4', 10 | Y = '50%,-3', 11 | Type = 'LoadingIndicator', 12 | }) 13 | self:AddObject({ 14 | X = 1, 15 | Y = '50%,1', 16 | Width = '100%', 17 | Align = 'Center', 18 | Type = 'Label', 19 | TextColour = 'blue', 20 | Text = 'Downloading ' .. self.App.Name 21 | }) 22 | self:FetchData() 23 | end 24 | 25 | OnDataLoad = function(self, url, data) 26 | local location, err = self.App:InstallData(data) 27 | if err then 28 | self.Success = false 29 | self.Failed = true 30 | self:OnDataFailed(nil, err) 31 | return 32 | end 33 | 34 | self:RemoveAllObjects() 35 | 36 | self:AddObject({ 37 | X = 1, 38 | Y = '50%,-1', 39 | Width = '100%', 40 | Align = 'Center', 41 | Type = 'Label', 42 | TextColour = 'blue', 43 | Text = 'Installation Successful' 44 | }) 45 | 46 | self:AddObject({ 47 | X = 1, 48 | Y = '50%,0', 49 | Width = '100%', 50 | Align = 'Center', 51 | Type = 'Label', 52 | TextColour = 'lightBlue', 53 | Text = location 54 | }) 55 | 56 | self:AddObject({ 57 | X = 1, 58 | Y = '50%,2', 59 | X = '50%,-4', 60 | Type = 'Button', 61 | TextColour = 'white', 62 | BackgroundColour = 'blue', 63 | Text = 'Okay', 64 | OnClick = function() 65 | self.Bedrock:OpenPreviousPage() 66 | end 67 | }) 68 | end 69 | 70 | DataURL = function(self, info) 71 | return self.Bedrock.AppStoreURL .. 'api/?command=application&subcommand=download&id=' .. textutils.urlEncode(self.App.ID) 72 | end -------------------------------------------------------------------------------- /System/Programs/Setup.program/Views/0.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 2, 5 | Y = 2, 6 | Width = 6, 7 | Height = 4, 8 | Type = 'ImageView', 9 | Path = '/System/Programs/Setup.program/Resources/logo.nft' 10 | }, 11 | { 12 | X = 9, 13 | Y = 3, 14 | TextColour = 'grey', 15 | Type = 'Label', 16 | Text = 'OneOS' 17 | }, 18 | { 19 | X = 15, 20 | Y = 3, 21 | TextColour = 'lightGrey', 22 | Type = 'Label', 23 | Text = 'The all in one operating system.' 24 | }, 25 | { 26 | X = 9, 27 | Y = 4, 28 | TextColour = 'lightGrey', 29 | Type = 'Label', 30 | Text = 'by oeed' 31 | }, 32 | 33 | { 34 | X = 5, 35 | Y = 8, 36 | Width = '100%,-5', 37 | TextColour = 'grey', 38 | Type = 'Label', 39 | Align = 'Center', 40 | Text = 'Welcome to the ultimate ComputerCraft experience.' 41 | }, 42 | 43 | { 44 | X = 1, 45 | Y = '100%,-3', 46 | Width = '100%', 47 | Align = 'Center', 48 | TextColour = 'lightGrey', 49 | Type = 'Label', 50 | Text = 'Click \'Next\' to get started.' 51 | }, 52 | { 53 | X = '100%,-7', 54 | Y = '100%,-1', 55 | Type = 'Button', 56 | Name = 'NextButton', 57 | Text = 'Next' 58 | }, 59 | }, 60 | } -------------------------------------------------------------------------------- /System/APIs/Clipboard.lua: -------------------------------------------------------------------------------- 1 | Content = nil 2 | Type = nil 3 | IsCut = false 4 | 5 | Bedrock = nil 6 | 7 | LastPaste = 0 8 | 9 | function Initialise(self, bedrock) 10 | local new = {} -- the new instance 11 | setmetatable( new, {__index = self} ) 12 | 13 | new.Bedrock = bedrock 14 | 15 | new.Bedrock:RegisterEvent('paste', function(bedrock, event, text) 16 | 17 | Log.i('paste event!') 18 | 19 | Log.i(text) 20 | new.LastPaste = os.clock() 21 | end) 22 | 23 | 24 | return new 25 | end 26 | 27 | function Empty(self) 28 | self.Content = nil 29 | self.Type = nil 30 | self.IsCut = false 31 | end 32 | 33 | function isEmpty(self) 34 | return self.Content == nil 35 | end 36 | 37 | function Copy(self, content, _type) 38 | self.Content = content 39 | self.Type = _type or 'generic' 40 | self.IsCut = false 41 | end 42 | 43 | function Cut(self, content, _type) 44 | self.Content = content 45 | self.Type = _type or 'generic' 46 | self.IsCut = true 47 | end 48 | 49 | function Paste(self, callback) 50 | -- This is to allow for the user's real OS clipboard to do it's thing first 51 | self.Bedrock:StartTimer(function() 52 | if self.LastPaste + 0.15 < os.clock() then 53 | local c, t, is = self.Content, self.Type, self.IsCut 54 | if self.IsCut then 55 | self.Empty() 56 | end 57 | callback(c, t, is) 58 | end 59 | end, 0.2) 60 | end 61 | 62 | function PasteToActiveObject(self, bedrock) 63 | bedrock = bedrock or self.Bedrock 64 | local obj = bedrock:GetActiveObject() 65 | if obj then 66 | self:Paste(function(content, _type) 67 | if type(content) == 'string' then 68 | if obj.OnPaste then 69 | obj:OnPaste('oneos_paste', content) 70 | end 71 | end 72 | end) 73 | end 74 | end -------------------------------------------------------------------------------- /System/Programs/Settings.program/Views/about.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 2, 5 | Y = 2, 6 | Width = 6, 7 | Height = 4, 8 | Type = 'ImageView', 9 | Path = '/Resources/logo.nft' 10 | }, 11 | { 12 | X = 9, 13 | Y = 3, 14 | TextColour = 'grey', 15 | Type = 'Label', 16 | Text = 'OneOS' 17 | }, 18 | { 19 | X = 15, 20 | Y = 3, 21 | TextColour = 'lightGrey', 22 | Type = 'Label', 23 | Text = 'The all in one operating system.' 24 | }, 25 | { 26 | X = 9, 27 | Y = 4, 28 | TextColour = 'lightGrey', 29 | Type = 'Label', 30 | Text = 'Version v2.0.0. Powered by Bedrock' 31 | }, 32 | 33 | { 34 | X = 2, 35 | Y = 7, 36 | Width = '100%,-2', 37 | TextColour = 'grey', 38 | Type = 'Label', 39 | Text = 'The ultimate ComputerCraft experience is powered by the intensely powerful Bedrock framework and forty two and half hamsters. Thank you for supporting and using OneOS!' 40 | }, 41 | 42 | { 43 | X = 1, 44 | Y = '100%,-1', 45 | Width = '100%', 46 | Align = 'Center', 47 | TextColour = 'lightGrey', 48 | Type = 'Label', 49 | Text = '(c) Oliver \'oeed\' Cooper 2013-15' 50 | }, 51 | { 52 | X = 1, 53 | Y = '100%', 54 | Width = '100%', 55 | Align = 'Center', 56 | TextColour = 'lightGrey', 57 | Type = 'Label', 58 | Text = 'Under CC BY-NC-ND 4.0 License' 59 | }, 60 | }, 61 | BackgroundColour = 'white', 62 | } -------------------------------------------------------------------------------- /System/Shared Objects/FilterView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | FilterName = nil 3 | TextFilterName = nil 4 | 5 | OnLoad = function(self) 6 | self:OnUpdate('FilterName') 7 | end 8 | 9 | OnUpdate = function(self, value) 10 | if value == 'FilterName' then 11 | self.Filter = Drawing.Filters[self.FilterName or 'None'] 12 | elseif value == 'TextFilter' then 13 | self.TextFilter = Drawing.Filters[self.TextFilterName] 14 | end 15 | end 16 | 17 | OnDraw = function(self, x, y) 18 | local filter = self.Filter 19 | local textFilter = self.TextFilter or filter 20 | for _x = 1, self.Width do 21 | for _y = 1, self.Height do 22 | if Drawing.Buffer[y + _y - 1] and Drawing.Buffer[y + _y - 1][x + _x - 1] then 23 | local px = Drawing.Buffer[y + _y - 1][x + _x - 1] 24 | Drawing.WriteToBuffer(x + _x - 1, y + _y - 1, px[1], Drawing.FilterColour(px[2], filter), Drawing.FilterColour(px[3], textFilter)) 25 | end 26 | end 27 | end 28 | end 29 | 30 | Blah = function(self, event, side, x, y, z) 31 | OneOS.Log.i('clikging') 32 | if self.Visible and not self.IgnoreClick then 33 | for i = #self.Children, 1, -1 do --children are ordered from smallest Z to highest, so this is done in reverse 34 | local child = self.Children[i] 35 | OneOS.Log.i(child.Name .. ' ' .. self:CheckClick(child, x, y)) 36 | if self:DoClick(child, event, side, x, y) then 37 | if self.OnChildClick then 38 | self:OnChildClick(child, event, side, x, y) 39 | end 40 | return true 41 | end 42 | end 43 | if event == 'mouse_click' and self.OnClick and self:OnClick(event, side, x, y) ~= false then 44 | return true 45 | elseif event == 'mouse_drag' and self.OnDrag and self:OnDrag(event, side, x, y) ~= false then 46 | return true 47 | elseif event == 'mouse_scroll' and self.OnScroll and self:OnScroll(event, side, x, y) ~= false then 48 | return true 49 | else 50 | return false 51 | end 52 | else 53 | return false 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /Programs/Transmit.program/Objects/DiscoverView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | 3 | BackgroundColour = colours.transparent 4 | Computers = false 5 | 6 | local function AddComputer(self, computer, angle, radius) 7 | --sohcahtoa 8 | local vertexX, vertexY = Drawing.Screen.Width/2, Drawing.Screen.Height - 2 9 | width = (radius * math.sin(-angle/90)) * 1.5 -- to fix the pixel ratio 10 | height = radius * math.cos(-angle/90) 11 | 12 | local centerX = 1 + (Drawing.Screen.Width/2) - width 13 | local centerY = vertexY - height 14 | 15 | local imageView = self:AddObject({ 16 | ["Type"] = 'ImageView', 17 | ["Width"] = 5, 18 | ["Height"] = 4, 19 | ["X"] = centerX - 3, 20 | ["Y"] = centerY - 2, 21 | ["Path"] = '/Images/computer' 22 | }) 23 | 24 | local name = Helpers.TruncateString(computer.Name,13) 25 | local label = self:AddObject({ 26 | ["Type"] = 'Label', 27 | ["X"] = math.floor(centerX - (#name / 2)), 28 | ["Y"] = centerY + 3, 29 | ["Text"] = name 30 | }) 31 | 32 | label.OnClick = function() 33 | SendToComputer(computer) 34 | end 35 | imageView.OnClick = label.OnClick 36 | end 37 | 38 | OnUpdate = function(self, value) 39 | if value == 'Computers' and self.Computers then 40 | self:RemoveAllObjects() 41 | 42 | while #self.Computers > 4 do 43 | table.remove(self.Computers, #self.Computers) 44 | end 45 | 46 | local max = #self.Computers 47 | local separationAngle = 75 48 | for i, computer in ipairs(self.Computers) do 49 | local angle = 0 50 | if max % 2 == 0 then 51 | if max/2 == i then 52 | angle = separationAngle/2 53 | elseif max/2 == i - 1 then 54 | angle = -separationAngle/2 55 | else 56 | angle = separationAngle * (i - max/2) - separationAngle/2 57 | end 58 | else 59 | if math.ceil(max/2) == i then 60 | angle = 0 61 | else 62 | angle = separationAngle * (i - math.ceil(max/2)) 63 | end 64 | end 65 | AddComputer(self, computer, angle, 12) 66 | end 67 | end 68 | end -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/AppDetailsView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | 3 | App = nil 4 | 5 | OnLoad = function(self) 6 | self:AddObject({ 7 | X = 3, 8 | Y = 2, 9 | Width = 4, 10 | Height = 3, 11 | Type = 'ImageView', 12 | }) 13 | 14 | self:AddObject({ 15 | X = 8, 16 | Y = 2, 17 | Type = 'Label', 18 | Name = 'NameLabel', 19 | Text = '' 20 | }) 21 | 22 | self:AddObject({ 23 | X = 8, 24 | Y = 3, 25 | Type = 'Label', 26 | Name = 'AuthorLabel', 27 | Text = '', 28 | TextColour = 'lightGrey' 29 | }) 30 | 31 | self:AddObject({ 32 | X = 8, 33 | Y = 4, 34 | Type = 'Label', 35 | Name = 'CategoryLabel', 36 | Text = '', 37 | TextColour = 'grey' 38 | }) 39 | 40 | self:AddObject({ 41 | X = '100%,-10', 42 | Y = 2, 43 | Type = 'Button', 44 | Name = 'InstallButton', 45 | Text = 'Install', 46 | TextColour = 'white', 47 | BackgroundColour = 'blue', 48 | -- Visible = false 49 | }) 50 | 51 | self:AddObject({ 52 | X = 3, 53 | Y = 6, 54 | Type = 'Label', 55 | Text = 'Description', 56 | TextColour = 'lightGrey' 57 | }) 58 | 59 | self:AddObject({ 60 | X = 3, 61 | Y = 7, 62 | Width = '100%,-4', 63 | Type = 'Label', 64 | Name = 'DescriptionLabel', 65 | Text = 'No description', 66 | TextColour = 'grey' 67 | }) 68 | 69 | self:AddObject({ 70 | X = 3, 71 | Y = 6, 72 | Type = 'Label', 73 | Text = 'Description', 74 | TextColour = 'lightGrey' 75 | }) 76 | 77 | 78 | self:OnUpdate('App') 79 | end 80 | 81 | OnUpdate = function(self, value) 82 | if value == 'App' and self.App then 83 | self:GetObject('NameLabel').Text = self.App.Name 84 | self:GetObject('AuthorLabel').Text = self.App.Author 85 | self:GetObject('CategoryLabel').Text = self.App.Category 86 | self:GetObject('ImageView').Path = 'Resources/'..self.App.Name 87 | -- self:GetObject('InstallButton').X = 10 + math.max(#self.App.Name, #self.App.Author, #self.App.Category) 88 | 89 | self:GetObject('DescriptionLabel').Text = self.App.Description 90 | 91 | end 92 | end 93 | -------------------------------------------------------------------------------- /System/Programs/Files.program/Views/filemenu.view: -------------------------------------------------------------------------------- 1 | { 2 | Type = 'Menu', 3 | Children = { 4 | { 5 | Name = 'OpenMenuItem', 6 | Type = 'MenuItem', 7 | Text = 'Open' 8 | }, 9 | { 10 | Name = 'ViewBundleMenuItem', 11 | Type = 'MenuItem', 12 | Text = 'View Bundle Content' 13 | }, 14 | { 15 | Name = 'OpenArgsMenuItem', 16 | Type = 'MenuItem', 17 | Text = 'Open With Arguments...' 18 | }, 19 | { 20 | Name = 'OpenWithMenuItem', 21 | Type = 'MenuItem', 22 | Text = 'Open With...' 23 | }, 24 | { 25 | Type = 'Separator' 26 | }, 27 | { 28 | Name = 'TransmitMenuItem', 29 | Type = 'MenuItem', 30 | Text = 'Transmit' 31 | }, 32 | { 33 | Name = 'CreatePackageMenuItem', 34 | Type = 'MenuItem', 35 | Text = 'Create Package' 36 | }, 37 | { 38 | Type = 'Separator' 39 | }, 40 | { 41 | Name = 'RenameMenuItem', 42 | Type = 'MenuItem', 43 | Text = 'Rename...' 44 | }, 45 | { 46 | Name = 'DeleteMenuItem', 47 | Type = 'MenuItem', 48 | Text = 'Delete...' 49 | }, 50 | { 51 | Name = 'AddToFavouritesMenuItem', 52 | Type = 'MenuItem', 53 | Text = 'Add To Favourites' 54 | }, 55 | { 56 | Name = 'AddToDesktopMenuItem', 57 | Type = 'MenuItem', 58 | Text = 'Add To Desktop' 59 | }, 60 | { 61 | Name = 'MakeAliasMenuItem', 62 | Type = 'MenuItem', 63 | Text = 'Make Alias' 64 | }, 65 | { 66 | Name = 'ResolveAliasMenuItem', 67 | Type = 'MenuItem', 68 | Text = 'Show Real File' 69 | }, 70 | { 71 | Type = 'Separator' 72 | }, 73 | { 74 | Name = 'CopyMenuItem', 75 | Type = 'MenuItem', 76 | Text = 'Copy' 77 | }, 78 | { 79 | Name = 'CutMenuItem', 80 | Type = 'MenuItem', 81 | Text = 'Cut' 82 | }, 83 | { 84 | Name = 'PasteMenuItem', 85 | Type = 'MenuItem', 86 | Text = 'Paste', 87 | Enabled = false 88 | }, 89 | }, 90 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/toolbar.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]="100%", 3 | ["Height"]=1, 4 | ["Type"]="View", 5 | ["BackgroundColour"]=128, 6 | ["Z"]=100, 7 | ["Children"]={ 8 | [1]={ 9 | ["X"]=1, 10 | ["Name"]="FileMenuButton", 11 | ["Type"]="Button", 12 | ["TextColour"]=1, 13 | ["Text"]="File", 14 | ["BackgroundColour"]=0, 15 | ["Toggle"]=false 16 | }, 17 | [2]={ 18 | ["X"]=7, 19 | ["Name"]="EditMenuButton", 20 | ["Type"]="Button", 21 | ["TextColour"]=1, 22 | ["Text"]="Edit", 23 | ["BackgroundColour"]=0, 24 | ["Toggle"]=false 25 | }, 26 | [3]={ 27 | ["X"]=13, 28 | ["Name"]="ImageMenuButton", 29 | ["Type"]="Button", 30 | ["TextColour"]=1, 31 | ["Text"]="Image", 32 | ["BackgroundColour"]=0, 33 | ["Toggle"]=false 34 | }, 35 | [4]={ 36 | ["X"]=20, 37 | ["Name"]="ViewMenuButton", 38 | ["Type"]="Button", 39 | ["TextColour"]=1, 40 | ["Text"]="View", 41 | ["BackgroundColour"]=0, 42 | ["Toggle"]=false 43 | }, 44 | [5]={ 45 | ["X"]=26, 46 | ["Name"]="ToolsMenuButton", 47 | ["Type"]="Button", 48 | ["TextColour"]=1, 49 | ["Text"]="Tools", 50 | ["BackgroundColour"]=0, 51 | ["Toggle"]=false 52 | }, 53 | 54 | [6]={ 55 | ["Y"]=1, 56 | ["X"]="100%,-9", 57 | ["Name"]="CurrentToolLabel", 58 | ["Type"]="Label", 59 | ["Width"]=6, 60 | ["AutoWidth"]=false, 61 | ["Height"]=1, 62 | ["TextColour"]=256, 63 | ["Text"]="", 64 | ["Align"]="Right" 65 | }, 66 | [7]={ 67 | ["Y"]=1, 68 | ["X"]="100%,-2", 69 | ["Name"]="PrimaryColourView", 70 | ["Type"]="View", 71 | ["Width"]=2, 72 | ["Height"]=1, 73 | ["BackgroundColour"]=0 74 | }, 75 | [8]={ 76 | ["Y"]=1, 77 | ["X"]="100%", 78 | ["Name"]="SecondaryColourView", 79 | ["Type"]="View", 80 | ["Width"]=1, 81 | ["Height"]=1, 82 | ["BackgroundColour"]=0 83 | }, 84 | }, 85 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/resizewindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=20, 3 | ["Height"]=13, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=2, 8 | ["X"]=1, 9 | ["Width"]="100%", 10 | ["Align"]="Center", 11 | ["Type"]="Label", 12 | ["TextColour"]=256, 13 | ["Text"]="Stretch/Shrink" 14 | }, 15 | 16 | [2]={ 17 | ["Y"]=4, 18 | ["X"]=4, 19 | ["Type"]="Label", 20 | ["TextColour"]=32768, 21 | ["Text"]="Width" 22 | }, 23 | [3]={ 24 | ["Y"]=4, 25 | ["X"]=11, 26 | ["Name"]="WidthNumberBox", 27 | ["AutoWidth"]=false, 28 | ["Type"]="NumberBox", 29 | ["Value"]=1, 30 | }, 31 | [4]={ 32 | ["Y"]=6, 33 | ["X"]=4, 34 | ["Type"]="Label", 35 | ["TextColour"]=32768, 36 | ["Text"]="Height" 37 | }, 38 | [5]={ 39 | ["Y"]=6, 40 | ["X"]=11, 41 | ["Name"]="HeightNumberBox", 42 | ["AutoWidth"]=false, 43 | ["Type"]="NumberBox", 44 | ["Value"]=1, 45 | }, 46 | 47 | [6]={ 48 | ["Y"]=8, 49 | ["X"]=2, 50 | ["Width"]=1, 51 | ["Name"]="ProportionsButton", 52 | ["AutoWidth"]=false, 53 | ["Type"]="Button", 54 | ["Toggle"]=true, 55 | ["ActiveBackgroundColour"]=2048, 56 | ["ActiveTextColour"]=1, 57 | ["TextColour"]=256, 58 | ["Text"]="x", 59 | }, 60 | [7]={ 61 | ["Y"]=8, 62 | ["X"]=4, 63 | ["Type"]="Label", 64 | ["TextColour"]=128, 65 | ["Text"]="Lock Proportions" 66 | }, 67 | [8]={ 68 | ["Y"]=10, 69 | ["X"]=2, 70 | ["Width"]=1, 71 | ["Name"]="TextDetailButton", 72 | ["AutoWidth"]=false, 73 | ["Type"]="Button", 74 | ["Toggle"]=true, 75 | ["ActiveBackgroundColour"]=2048, 76 | ["ActiveTextColour"]=1, 77 | ["TextColour"]=256, 78 | ["Text"]="x", 79 | }, 80 | [9]={ 81 | ["Y"]=10, 82 | ["X"]=4, 83 | ["Type"]="Label", 84 | ["TextColour"]=128, 85 | ["Text"]="Keep Text Detail" 86 | }, 87 | 88 | [10]={ 89 | ["Y"]="100%,-1", 90 | ["X"]="100%,-17", 91 | ["Type"]="Button", 92 | ["Name"]="CancelButton", 93 | ["Text"]="Cancel" 94 | }, 95 | [11]={ 96 | ["Y"]="100%,-1", 97 | ["X"]="100%,-8", 98 | ["Type"]="Button", 99 | ["Name"]="ResizeButton", 100 | ["Text"]="Resize" 101 | }, 102 | }, 103 | } -------------------------------------------------------------------------------- /System/Programs/Settings.program/Views/storage.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 1, 5 | Y = 1, 6 | Width = '100%', 7 | Height = '100%,-3', 8 | Type = 'ScrollView', 9 | Name = 'StorageWrapperView', 10 | }, 11 | 12 | { 13 | Y = '100%,-1', 14 | X = 2, 15 | Width = 48, 16 | Name = 'KeyWrapperView', 17 | Type = 'View', 18 | Children = { 19 | { 20 | Y = 1, 21 | X = 1, 22 | Name = 'SystemKeyView', 23 | Type = 'View', 24 | BackgroundColour = 'red', 25 | }, 26 | { 27 | Y = 1, 28 | X = 3, 29 | Width = 6, 30 | Name = 'SystemKeyLabel', 31 | Text = 'System', 32 | Type = 'Label', 33 | TextColour = 'grey', 34 | }, 35 | { 36 | Y = 1, 37 | X = 11, 38 | Name = 'ProgramsKeyView', 39 | Type = 'View', 40 | BackgroundColour = 'blue', 41 | }, 42 | { 43 | Y = 1, 44 | X = 13, 45 | Width = 8, 46 | Name = 'ProgramsKeyLabel', 47 | Text = 'Programs', 48 | Type = 'Label', 49 | TextColour = 'grey', 50 | }, 51 | { 52 | Y = 1, 53 | X = 23, 54 | Name = 'DesktopKeyView', 55 | Type = 'View', 56 | BackgroundColour = 'green', 57 | }, 58 | { 59 | Y = 1, 60 | X = 25, 61 | Width = 8, 62 | Name = 'DesktopKeyLabel', 63 | Text = 'Desktop', 64 | Type = 'Label', 65 | TextColour = 'grey', 66 | }, 67 | { 68 | Y = 1, 69 | X = 34, 70 | Name = 'OtherKeyView', 71 | Type = 'View', 72 | BackgroundColour = 'yellow', 73 | }, 74 | { 75 | Y = 1, 76 | X = 36, 77 | Width = 8, 78 | Name = 'OtherKeyLabel', 79 | Text = 'Other', 80 | Type = 'Label', 81 | TextColour = 'grey', 82 | }, 83 | { 84 | Y = 1, 85 | X = 43, 86 | Name = 'FreeKeyView', 87 | Type = 'View', 88 | BackgroundColour = 'lightGrey', 89 | }, 90 | { 91 | Y = 1, 92 | X = 45, 93 | Width = 8, 94 | Name = 'FreeKeyLabel', 95 | Text = 'Free', 96 | Type = 'Label', 97 | TextColour = 'grey', 98 | }, 99 | } 100 | }, 101 | }, 102 | BackgroundColour = 'white', 103 | } -------------------------------------------------------------------------------- /System/Shared Objects/FileIcon.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | Width = 10 3 | Height = 4 4 | Selected = false 5 | ShowExtension = false 6 | ClickCount = 0 7 | ClickResetTimer = nil 8 | 9 | OnLoad = function(self) 10 | self:AddObject({ 11 | X = '50%,-1', 12 | Y = 1, 13 | Width = 4, 14 | Height = 3, 15 | Type = 'ImageView', 16 | Image = OneOS.GetIcon(self.Path), 17 | OnClick = function(_, event, side, x, y) self:OnClick(event, side, x, y, _) end 18 | }) 19 | 20 | local fileName = fs.getName(self.Path) 21 | if not self.ShowExtension and fileName:sub(1,1) ~= '.' then 22 | fileName = self.Bedrock.Helpers.RemoveExtension(fileName) 23 | end 24 | 25 | self:AddObject({ 26 | X = 1, 27 | Y = '100%,0', 28 | Width = '100%', 29 | Align = 'Center', 30 | Type = 'Label', 31 | Name = 'NameLabel', 32 | Text = fileName, 33 | Wrap = false, 34 | OnClick = function(_, event, side, x, y) self:OnClick(event, side, x, y, _) end 35 | }) 36 | 37 | if self.Bedrock.Helpers.Extension(self.Path) == 'shortcut' then 38 | self:AddObject({ 39 | Type = 'Label', 40 | X = '50%,2', 41 | Y = 3, 42 | Text = '>', 43 | BackgroundColour =colours.white 44 | }) 45 | end 46 | 47 | self:OnUpdate('Selected') 48 | end 49 | 50 | 51 | OnUpdate = function(self, value) 52 | if value == 'Selected' then 53 | local label = self:GetObject('NameLabel') 54 | if label then 55 | label.BackgroundColour = (self.Selected and colours.blue or colours.transparent) 56 | label.TextColour = (self.Selected and colours.white or colours.black) 57 | end 58 | end 59 | end 60 | 61 | OnClick = function(self, event, side, x, y, _) 62 | if not _ then return end 63 | 64 | if side == 1 then 65 | self.ClickCount = self.ClickCount + 1 66 | 67 | if self.ClickCount >= 3 then 68 | self.Selected = false 69 | self.ClickCount = 0 70 | else 71 | OneOS.Log.i('Hi') 72 | OneOS.Log.i(_) 73 | self.DragX = _.X + x - 2 74 | self.DragY = _.Y + y - 2 75 | self.Bedrock.DragIcon = self 76 | if self.Selected then 77 | OneOS.OpenFile(self.Path, nil, self.X, self.Y) 78 | else 79 | self.Selected = not self.Selected 80 | end 81 | end 82 | elseif side == 2 then 83 | self:ToggleMenu('filemenu', x, y) 84 | end 85 | end 86 | 87 | OnIconDrag = function(self, x, y) 88 | self.Selected = false 89 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/NumberBox.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | 3 | Value = 1 4 | Minimum = 1 5 | Maximum = 99 6 | BackgroundColour = colours.lightGrey 7 | TextBoxTimer = nil 8 | Width = 7 9 | 10 | OnLoad = function(self) 11 | self:AddObject({ 12 | X = self.Width - 1, 13 | Y = 1, 14 | Width = 1, 15 | AutoWidth = false, 16 | Text = '-', 17 | Type = 'Button', 18 | Name = 'AddButton', 19 | BackgroundColour = colours.transparent, 20 | OnClick = function() 21 | self:ShiftValue(-1) 22 | end 23 | }) 24 | 25 | self:AddObject({ 26 | X = self.Width, 27 | Y = 1, 28 | Width = 1, 29 | AutoWidth = false, 30 | Text = '+', 31 | Type = 'Button', 32 | Name = 'SubButton', 33 | BackgroundColour = colours.transparent, 34 | OnClick = function() 35 | self:ShiftValue(1) 36 | end 37 | }) 38 | 39 | self:AddObject({ 40 | X = 1, 41 | Y = 1, 42 | Width = self.Width - 2, 43 | Text = tostring(self.Value), 44 | Align = 'Center', 45 | Type = 'TextBox', 46 | BackgroundColour = colours.transparent, 47 | OnChange = function(_self, event, keychar) 48 | if keychar == keys.enter then 49 | self:SetValue(tonumber(_self.Text)) 50 | self.TextBoxTimer = nil 51 | end 52 | if self.TextBoxTimer then 53 | self.Bedrock:StopTimer(self.TextBoxTimer) 54 | end 55 | 56 | self.TextBoxTimer = self.Bedrock:StartTimer(function(_, timer) 57 | if timer and timer == self.TextBoxTimer then 58 | self:SetValue(tonumber(_self.Text)) 59 | self.TextBoxTimer = nil 60 | end 61 | end, 2) 62 | end 63 | }) 64 | end 65 | 66 | OnScroll = function(self, event, dir, x, y) 67 | self:ShiftValue(-dir) 68 | end 69 | 70 | ShiftValue = function(self, delta) 71 | local val = tonumber(self:GetObject('TextBox').Text) or self.Minimum 72 | self:SetValue(val + delta) 73 | end 74 | 75 | SetValue = function(self, newValue) 76 | newValue = newValue or 0 77 | if self.Maximum and newValue > self.Maximum then 78 | newValue = self.Maximum 79 | elseif self.Minimum and newValue < self.Minimum then 80 | newValue = self.Minimum 81 | end 82 | self.Value = newValue 83 | if self.OnChange then 84 | self:OnChange() 85 | end 86 | end 87 | 88 | OnUpdate = function(self, value) 89 | if value == 'Value' then 90 | local textbox = self:GetObject('TextBox') 91 | if textbox then 92 | textbox.Text = tostring(self.Value) 93 | end 94 | end 95 | end -------------------------------------------------------------------------------- /System/Programs/Settings.program/Views/main.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 1, 5 | Y = 1, 6 | Width = '100%', 7 | Height = 3, 8 | BackgroundColour = 'grey', 9 | Type = 'View', 10 | Name = 'Toolbar', 11 | Children = { 12 | { 13 | X = '50%,-19', 14 | Y = 2, 15 | Width = 39, 16 | Height = 1, 17 | Type = 'View', 18 | Name = 'SelectionWrap', 19 | Children = { 20 | { 21 | X = 1, 22 | Y = 1, 23 | Type = 'Button', 24 | Text = 'About', 25 | Name = 'AboutButton', 26 | TextColour = 'grey', 27 | BackgroundColour = 'white', 28 | Toggle = false 29 | }, 30 | { 31 | X = 9, 32 | Y = 1, 33 | Type = 'Button', 34 | Text = 'Appearance', 35 | Name = 'AppearanceButton', 36 | TextColour = 'grey', 37 | BackgroundColour = 'white', 38 | Toggle = false 39 | }, 40 | { 41 | X = 22, 42 | Y = 1, 43 | Type = 'Button', 44 | Text = 'Storage', 45 | Name = 'StorageButton', 46 | TextColour = 'grey', 47 | BackgroundColour = 'white', 48 | Toggle = false 49 | }, 50 | { 51 | X = 32, 52 | Y = 1, 53 | Type = 'Button', 54 | Text = 'System', 55 | Name = 'SystemButton', 56 | TextColour = 'grey', 57 | BackgroundColour = 'white', 58 | Toggle = false 59 | }, 60 | } 61 | } 62 | } 63 | }, 64 | }, 65 | BackgroundColour = 'white', 66 | } -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/LayersWindow.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'SnapWindow' 2 | ContentViewName = 'layerswindow' 3 | 4 | Title = 'Layers' 5 | 6 | OnContentLoad = function(self) 7 | self:UpdateLayers() 8 | end 9 | 10 | UpdateLayers = function(self) 11 | self:GetObject('ScrollView'):RemoveAllObjects() 12 | local artboard = self.Bedrock:GetObject('Artboard') 13 | if artboard then 14 | for i, layer in ipairs(artboard.Children) do 15 | self:GetObject('ScrollView'):AddObject({ 16 | Type = 'LayerView', 17 | X = 1, 18 | Y = 1 + (#artboard.Children - i) * LayerView.Height, 19 | Width = '100%', 20 | Layer = layer, 21 | LayerIndex = i 22 | }) 23 | end 24 | local maxHeight = Drawing.Screen.Height - 4 25 | local height = #artboard.Children * LayerView.Height 26 | if height > maxHeight then 27 | height = maxHeight 28 | end 29 | 30 | self:GetObject('ContentView').Height = height 31 | self:GetObject('ScrollView').Height = height 32 | self:GetObject('ScrollView'):UpdateScroll() 33 | self.Height = 1 + height 34 | end 35 | end 36 | 37 | OrderLayers = function(self) 38 | local artboard = self.Bedrock:GetObject('Artboard') 39 | if artboard then 40 | local layers = {} 41 | for i, v in ipairs(self:GetObject('ScrollView').Children) do 42 | if v.Type == 'LayerView' then 43 | table.insert(layers, v.Layer.Layer) 44 | end 45 | end 46 | artboard.Layers = layers 47 | artboard:PushState() 48 | end 49 | end 50 | 51 | Rearrange = function(self, dragging, y) 52 | local artboard = self.Bedrock:GetObject('Artboard') 53 | if artboard then 54 | local children = self:GetObject('ScrollView').Children 55 | 56 | local scrollBar = self:GetObject('ScrollViewScrollBar') 57 | 58 | local newIndex = #children - (scrollBar and 1 or 0) - math.floor((dragging.Y + y - 2 ) / 4) 59 | if newIndex > #children then 60 | newIndex = #children 61 | elseif newIndex < 1 then 62 | newIndex = 1 63 | end 64 | local oldIndex = dragging.LayerIndex 65 | 66 | if newIndex ~= oldIndex then 67 | local newChildren = {} 68 | newChildren[newIndex] = dragging 69 | dragging.LayerIndex = newIndex 70 | 71 | for i, layer in ipairs(children) do 72 | if layer ~= dragging then 73 | table.insert(newChildren, layer) 74 | local index = #newChildren 75 | if index == newIndex then 76 | index = index - 1 77 | end 78 | layer.LayerIndex = index 79 | layer.Y = 1 + (#children - layer.LayerIndex) * 4 80 | end 81 | end 82 | self:GetObject('ScrollView').Children = newChildren 83 | end 84 | end 85 | end -------------------------------------------------------------------------------- /Programs/App Store.program/Objects/PageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'ScrollView' 2 | 3 | PageInfo = nil 4 | Failed = false 5 | Success = false 6 | RequestURL = nil 7 | TimeoutTimer = nil 8 | TimeoutLength = 5 9 | LoadingText = nil 10 | 11 | OnLoad = function(self) 12 | self.Failed = false 13 | self.Success = false 14 | self:RemoveAllObjects() 15 | ScrollView.OnLoad(self) 16 | self:AddObject({ 17 | X = '50%,-4', 18 | Y = '50%,-3', 19 | Type = 'LoadingIndicator', 20 | }) 21 | self:FetchData() 22 | end 23 | 24 | FetchData = function(self) 25 | local url = self:DataURL(self.PageInfo) 26 | self.RequestURL = url 27 | local reason 28 | 29 | if not http then 30 | reason = 'Please enabled HTTP' 31 | elseif http.checkURL and not http.checkURL(url) then 32 | reason = 'Please set HTTP whitelist to "*"' 33 | end 34 | 35 | if not reason then 36 | local ok, err = http.request(url) 37 | if ok ~= false then -- on earlier versions ok will be nil regardless 38 | self.TimeoutTimer = self.Bedrock:StartTimer(function() 39 | if not self.Failed and not self.Success then 40 | self.Failed = true 41 | self:OnDataFailed(url, 'Request timeout') 42 | end 43 | end, self.TimeoutLength) 44 | else 45 | if err then 46 | reason = err 47 | else 48 | reason = 'HTTP request error' 49 | end 50 | end 51 | end 52 | 53 | if reason then 54 | self.Failed = true 55 | self:OnDataFailed(url, reason) 56 | end 57 | end 58 | 59 | OnDataFailed = function(self, url, reason) 60 | self:RemoveAllObjects() 61 | self:AddObject({ 62 | X = 1, 63 | Width = '100%', 64 | Align = 'Center', 65 | Y = '50%,-2', 66 | Type = 'Label', 67 | Text = 'Loading Failed', 68 | TextColour = 'red' 69 | }) 70 | 71 | self:AddObject({ 72 | X = 1, 73 | Width = '100%', 74 | Align = 'Center', 75 | Y = '50%,-1', 76 | Type = 'Label', 77 | Text = reason, 78 | TextColour = 'orange' 79 | }) 80 | 81 | self:AddObject({ 82 | X = 1, 83 | Y = '50%,1', 84 | X = '50%,-7', 85 | Type = 'Button', 86 | TextColour = 'white', 87 | BackgroundColour = 'red', 88 | Text = 'Back', 89 | OnClick = function() 90 | self.Bedrock:OpenPreviousPage() 91 | end 92 | }) 93 | 94 | self:AddObject({ 95 | X = 1, 96 | Y = '50%,1', 97 | X = '50%,1', 98 | Type = 'Button', 99 | TextColour = 'white', 100 | BackgroundColour = 'red', 101 | Text = 'Retry', 102 | OnClick = function() 103 | self:OnLoad() 104 | end 105 | }) 106 | end 107 | 108 | OnDataLoaded = function() 109 | 110 | end -------------------------------------------------------------------------------- /System/APIs/Indexer.lua: -------------------------------------------------------------------------------- 1 | --how often the computer is indexed 2 | IndexRate = 60 3 | 4 | --fs api calls will cause an index 3 seconds after they are run 5 | FSIndexRate = 3 6 | 7 | Index = {} 8 | 9 | OnIndex = nil 10 | 11 | -- Don't index through the sandboxed file system, it's slow and can have some undesired effects 12 | local _fs = _fileSystem.RawFS 13 | 14 | function AddToIndex(path, index) 15 | if string.sub(_fs.getName(path),1,1) == '.' or string.sub(path,1,string.len("rom"))=="rom" or string.sub(path,1,string.len("/rom"))=="/rom" then 16 | if _fs.getName(path) == '.DS_Store' then 17 | _fs.delete(path) 18 | end 19 | return index 20 | elseif _fs.isDir(path) then 21 | index[_fs.getName(path)] = {} 22 | for i, fileName in ipairs(_fs.list(path)) do 23 | index[_fs.getName(path)] = AddToIndex(path .. '/' .. fileName, index[_fs.getName(path)]) 24 | end 25 | else 26 | index[_fs.getName(path)] = true 27 | end 28 | return index 29 | end 30 | 31 | function RefreshIndex() 32 | Log.i('Refreshing Index...') 33 | local index = AddToIndex('', {}) 34 | if index['root'] then 35 | Indexer.Index = index['root'] 36 | end 37 | Log.i('Index refresh complete!') 38 | if Indexer.OnIndex then 39 | Indexer.OnIndex() 40 | end 41 | end 42 | 43 | function Search(filter, items, index, indexName) 44 | if filter == '' then 45 | return {} 46 | end 47 | items = items or {} 48 | index = index or Indexer.Index 49 | indexName = indexName or '' 50 | for name, _file in pairs(index) do 51 | if not (name == 'rom' and indexName == '') and not (name == 'System' and indexName == '') and not (name == 'startup' and indexName == '') then 52 | local _path = indexName..'/'..name 53 | if name == 'root' then 54 | _path = '/' 55 | end 56 | if type(_file) == 'table' and Helpers.Extension(name) ~= 'program' then 57 | items = Search(filter, items, index[name], _path) 58 | end 59 | if string.find(name:lower(), filter:lower()) ~= nil then 60 | table.insert(items, _path) 61 | end 62 | end 63 | end 64 | return items 65 | end 66 | 67 | --finds a file with the given name in a folder with the given name 68 | --used to find icon files 69 | function FindFileInFolder(file, folder, index, indexName) 70 | index = index or Indexer.Index 71 | for name, _file in pairs(index) do 72 | if type(_file) == 'table' then 73 | local _name = FindFileInFolder(file, folder, index[name], name) 74 | if _name and name ~= 'root' then 75 | return name .. '/' .. _name 76 | elseif _name then 77 | return _name 78 | end 79 | elseif name == file and indexName == folder then 80 | return name 81 | end 82 | end 83 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/saveasformatwindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=30, 3 | ["Height"]=15, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=2, 8 | ["X"]=1, 9 | ["Width"]="100%", 10 | ["Align"]="Center", 11 | ["Type"]="Label", 12 | ["TextColour"]=128, 13 | ["Text"]="Choose Image Format" 14 | }, 15 | [2]={ 16 | ["Y"]=4, 17 | ["X"]=2, 18 | ["Width"]=1, 19 | ["Name"]="FormatButton", 20 | ["Format"]="skch", 21 | ["AutoWidth"]=false, 22 | ["Type"]="Button", 23 | ["Toggle"]=true, 24 | ["ActiveBackgroundColour"]=2048, 25 | ["ActiveTextColour"]=1, 26 | ["TextColour"]=256, 27 | ["Text"]="x", 28 | }, 29 | [3]={ 30 | ["Y"]=4, 31 | ["X"]=4, 32 | ["Type"]="Label", 33 | ["TextColour"]=128, 34 | ["Text"]="Sketch (skch)" 35 | }, 36 | [4]={ 37 | ["Y"]=5, 38 | ["X"]=4, 39 | ["Width"]="100%,-4", 40 | ["Type"]="Label", 41 | ["TextColour"]=256, 42 | ["Text"]="Supports layers, filters, colour and text." 43 | }, 44 | 45 | 46 | [5]={ 47 | ["Y"]=8, 48 | ["X"]=2, 49 | ["Width"]=1, 50 | ["Name"]="FormatButton", 51 | ["Format"]="nft", 52 | ["AutoWidth"]=false, 53 | ["Type"]="Button", 54 | ["Toggle"]=false, 55 | ["ActiveBackgroundColour"]=2048, 56 | ["ActiveTextColour"]=1, 57 | ["TextColour"]=256, 58 | ["Text"]="x", 59 | }, 60 | [6]={ 61 | ["Y"]=8, 62 | ["X"]=4, 63 | ["Type"]="Label", 64 | ["TextColour"]=128, 65 | ["Text"]="NitroFingers Text (nft)" 66 | }, 67 | [7]={ 68 | ["Y"]=9, 69 | ["X"]=4, 70 | ["Width"]="100%,-4", 71 | ["Type"]="Label", 72 | ["TextColour"]=256, 73 | ["Text"]="Supports colour and text." 74 | }, 75 | 76 | 77 | [8]={ 78 | ["Y"]=11, 79 | ["X"]=2, 80 | ["Width"]=1, 81 | ["Name"]="FormatButton", 82 | ["Format"]="nfp", 83 | ["AutoWidth"]=false, 84 | ["Type"]="Button", 85 | ["Toggle"]=false, 86 | ["ActiveBackgroundColour"]=2048, 87 | ["ActiveTextColour"]=1, 88 | ["TextColour"]=256, 89 | ["Text"]="x", 90 | }, 91 | [9]={ 92 | ["Y"]=11, 93 | ["X"]=4, 94 | ["Type"]="Label", 95 | ["TextColour"]=128, 96 | ["Text"]="NitroFingers Paint (nfp)" 97 | }, 98 | [10]={ 99 | ["Y"]=12, 100 | ["X"]=4, 101 | ["Width"]="100%,-4", 102 | ["Type"]="Label", 103 | ["TextColour"]=256, 104 | ["Text"]="Supports colour." 105 | }, 106 | 107 | 108 | [11]={ 109 | ["Y"]="100%,-1", 110 | ["X"]="100%,-16", 111 | ["Type"]="Button", 112 | ["Name"]="CancelButton", 113 | ["Text"]="Cancel" 114 | }, 115 | [12]={ 116 | ["Y"]="100%,-1", 117 | ["X"]="100%,-6", 118 | ["Type"]="Button", 119 | ["Name"]="NextButton", 120 | ["Text"]="Next" 121 | }, 122 | }, 123 | } -------------------------------------------------------------------------------- /System/Programs/Settings.program/Objects/StoragePageView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'PageView' 2 | 3 | OnLoad = function(self) 4 | if fs.getFreeSpace and fs.getSize then 5 | self:AddStorage('Main Computer Storage', '/', 2) 6 | -- self:AddStorage('Left Disk', '/disk', 8) 7 | local y = 8 8 | for i, p in ipairs(Peripheral.GetPeripherals('drive')) do 9 | local info = Peripheral.GetInfo(p) 10 | if info['Disc Type'] == 'Data' then 11 | local name = info['Disc Label'] or self.Bedrock.Helpers.Capitalise(p.Side) 12 | self:AddStorage('Disc (' .. name .. ')', info['Mount Path'], y) 13 | y = y + 6 14 | end 15 | end 16 | 17 | self:GetObject('StorageWrapperView'):UpdateScroll() 18 | else 19 | 20 | end 21 | end 22 | 23 | local function formatBytes(bytes) 24 | if bytes == 0 then 25 | return 'Zero bytes' 26 | elseif bytes < 1024 then 27 | return "< 1kB" 28 | elseif bytes < 1024 * 1024 then 29 | return math.ceil(bytes / 1024) .. 'kB' 30 | elseif bytes < 1024 * 1024 * 1024 then 31 | local b = math.ceil((bytes / 1024 / 1024)*100) 32 | return b/100 .. 'MB' 33 | else 34 | return '> 1GB' 35 | end 36 | end 37 | 38 | local function folderSize(path) 39 | if not OneOS.FS.isDir(path) or path == '//.git' then 40 | return 0 41 | end 42 | local totalSize = 0 43 | for i, v in ipairs(OneOS.FS.list(path)) do 44 | if path..'/'..v ~= '//rom' and v ~= 'disk' and not string.match(v, 'disk%d') then 45 | if OneOS.FS.isDir(path..'/'..v) then 46 | totalSize = totalSize + folderSize(path..'/'..v) 47 | else 48 | totalSize = totalSize + OneOS.FS.getSize(path..'/'..v) 49 | end 50 | end 51 | end 52 | return totalSize 53 | end 54 | 55 | AddStorage = function(self, title, path, y) 56 | local systemSize = folderSize(path .. 'System/') + (OneOS.FS.exists(path .. 'startup') and OneOS.FS.getSize(path .. 'startup') or 0) 57 | local desktopSize = folderSize(path .. 'Desktop/') 58 | local programsSize = folderSize(path .. 'Programs/') 59 | local totalSize = folderSize(path) 60 | local maxSpace = OneOS.FS.getFreeSpace(path) + totalSize 61 | 62 | local scroll = self:GetObject('StorageWrapperView') 63 | scroll:AddObject({ 64 | X = 3, 65 | Y = y, 66 | TextColour = 'grey', 67 | Type = 'Label', 68 | Text = title 69 | }) 70 | 71 | scroll:AddObject({ 72 | X = 3, 73 | Y = y + 1, 74 | TextColour = 'lightGrey', 75 | Type = 'Label', 76 | Text = formatBytes(totalSize)..' used, '..formatBytes(maxSpace - totalSize)..' available' 77 | }) 78 | 79 | scroll:AddObject({ 80 | X = 3, 81 | Y = y + 3, 82 | Width = '100%,-4', 83 | Type = 'ProgressBar', 84 | Maximum = maxSpace, 85 | BarColour = {16384, 2048, 8192, 16}, 86 | Value = {systemSize, programsSize, desktopSize, totalSize-systemSize-programsSize-desktopSize} 87 | }) 88 | end -------------------------------------------------------------------------------- /System/Shared Objects/FilterTextBox.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'TextBox' 2 | 3 | FilterName = nil 4 | TextFilterName = nil 5 | 6 | OnLoad = function(self) 7 | if not self.CursorPos then 8 | self.CursorPos = #self.Text 9 | end 10 | 11 | self:OnUpdate('FilterName') 12 | self:OnUpdate('TextFilterName') 13 | end 14 | 15 | 16 | OnDraw = function(self, x, y) 17 | local filter = self.Filter 18 | local textFilter = self.TextFilter or filter 19 | for _x = 1, self.Width do 20 | for _y = 1, self.Height do 21 | if Drawing.Buffer[y + _y - 1] and Drawing.Buffer[y + _y - 1][x + _x - 1] then 22 | local px = Drawing.Buffer[y + _y - 1][x + _x - 1] 23 | Drawing.WriteToBuffer(x + _x - 1, y + _y - 1, ' ', Drawing.FilterColour(px[2], textFilter), Drawing.FilterColour(px[3], filter)) 24 | end 25 | end 26 | end 27 | 28 | local function textColour(_x, _y) 29 | if Drawing.Buffer[_y] and Drawing.Buffer[_y][_x] then 30 | local px = Drawing.Buffer[_y][_x] 31 | return Drawing.FilterColour(px[3], textFilter) 32 | end 33 | end 34 | 35 | if self.CursorPos > #self.Text then 36 | self.CursorPos = #self.Text 37 | elseif self.CursorPos < 0 then 38 | self.CursorPos = 0 39 | end 40 | local text = self.Text 41 | local offset = self:TextOffset() 42 | if #text > (self.Width - 2) then 43 | text = text:sub(offset+1, offset + self.Width - 2) 44 | -- self.Bedrock.CursorPos = {x + 1 + self.Width-2, y} 45 | -- else 46 | end 47 | if self.Bedrock:GetActiveObject() == self then 48 | -- error(y) 49 | self.Bedrock.CursorPos = {x + 1 + self.CursorPos - offset - objOffset.X, y} 50 | self.Bedrock.CursorColour = textColour(x + 1 + self.CursorPos - offset, y) 51 | else 52 | self.Selected = false 53 | end 54 | 55 | if #tostring(text) == 0 then 56 | Drawing.DrawCharacters(x + 1, y, self.Placeholder, self.PlaceholderTextColour, colours.transparent) 57 | else 58 | if not self.Selected then 59 | Drawing.DrawCharacters(x + 1, y, text, textColour(x + 1, y), colours.transparent) 60 | else 61 | local startPos = self.DragStart - offset 62 | local endPos = self.CursorPos - offset 63 | if startPos > endPos then 64 | startPos = self.CursorPos - offset 65 | endPos = self.DragStart - offset 66 | end 67 | for i = 1, #text do 68 | local char = text:sub(i, i) 69 | local tc = textColour(x + i, y) 70 | local backgroundColour = colours.transparent 71 | 72 | if i > startPos and i - 1 <= endPos then 73 | tc = self.SelectedTextColour 74 | backgroundColour = self.SelectedBackgroundColour 75 | end 76 | Drawing.DrawCharacters(x + i, y, char, tc, backgroundColour) 77 | end 78 | end 79 | end 80 | end 81 | 82 | OnUpdate = function(self, value) 83 | if value == 'FilterName' then 84 | self.Filter = Drawing.Filters[self.FilterName or 'None'] 85 | elseif value == 'TextFilterName' then 86 | self.TextFilter = Drawing.Filters[self.TextFilterName] 87 | end 88 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/infowindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=13, 3 | ["Height"]=13, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=2, 8 | ["X"]=2, 9 | ["Type"]="Label", 10 | ["TextColour"]=128, 11 | ["Text"]="Canvas Size" 12 | }, 13 | [2]={ 14 | ["Y"]=3, 15 | ["X"]=2, 16 | ["Type"]="Label", 17 | ["TextColour"]=256, 18 | ["Text"]="Width" 19 | }, 20 | [3]={ 21 | ["Y"]=3, 22 | ["X"]=9, 23 | ["Width"]=4, 24 | ["Align"]="Left", 25 | ["TextColour"]=32768, 26 | ["Type"]="Label", 27 | ["Name"]="CanvasWidthLabel", 28 | ["Text"]="-" 29 | }, 30 | [4]={ 31 | ["Y"]=4, 32 | ["X"]=2, 33 | ["Type"]="Label", 34 | ["TextColour"]=256, 35 | ["Text"]="Height" 36 | }, 37 | [5]={ 38 | ["Y"]=4, 39 | ["X"]=9, 40 | ["Width"]=4, 41 | ["Align"]="Left", 42 | ["Type"]="Label", 43 | ["TextColour"]=32768, 44 | ["Name"]="CanvasHeightLabel", 45 | ["Text"]="-" 46 | }, 47 | 48 | [6]={ 49 | ["Y"]=6, 50 | ["X"]=3, 51 | ["Type"]="Label", 52 | ["TextColour"]=128, 53 | ["Text"]="Selection" 54 | }, 55 | [7]={ 56 | ["Y"]=7, 57 | ["X"]=2, 58 | ["Type"]="Label", 59 | ["TextColour"]=256, 60 | ["Text"]="Width" 61 | }, 62 | [8]={ 63 | ["Y"]=7, 64 | ["X"]=9, 65 | ["Width"]=4, 66 | ["Align"]="Left", 67 | ["Type"]="Label", 68 | ["TextColour"]=32768, 69 | ["Name"]="SelectionWidthLabel", 70 | ["Text"]="-" 71 | }, 72 | [9]={ 73 | ["Y"]=8, 74 | ["X"]=2, 75 | ["Type"]="Label", 76 | ["TextColour"]=256, 77 | ["Text"]="Height" 78 | }, 79 | [10]={ 80 | ["Y"]=8, 81 | ["X"]=9, 82 | ["Width"]=4, 83 | ["Align"]="Left", 84 | ["Type"]="Label", 85 | ["TextColour"]=32768, 86 | ["Name"]="SelectionHeightLabel", 87 | ["Text"]="-" 88 | }, 89 | [11]={ 90 | ["Y"]=9, 91 | ["X"]=4, 92 | ["Type"]="Label", 93 | ["TextColour"]=256, 94 | ["Text"]="X1" 95 | }, 96 | [12]={ 97 | ["Y"]=9, 98 | ["X"]=9, 99 | ["Width"]=4, 100 | ["Align"]="Left", 101 | ["Type"]="Label", 102 | ["TextColour"]=32768, 103 | ["Name"]="SelectionX1Label", 104 | ["Text"]="-" 105 | }, 106 | [13]={ 107 | ["Y"]=10, 108 | ["X"]=4, 109 | ["Type"]="Label", 110 | ["TextColour"]=256, 111 | ["Text"]="Y1" 112 | }, 113 | [14]={ 114 | ["Y"]=10, 115 | ["X"]=9, 116 | ["Width"]=4, 117 | ["Align"]="Left", 118 | ["Type"]="Label", 119 | ["TextColour"]=32768, 120 | ["Name"]="SelectionY1Label", 121 | ["Text"]="-" 122 | }, 123 | [15]={ 124 | ["Y"]=11, 125 | ["X"]=4, 126 | ["Type"]="Label", 127 | ["TextColour"]=256, 128 | ["Text"]="X2" 129 | }, 130 | [16]={ 131 | ["Y"]=11, 132 | ["X"]=9, 133 | ["Width"]=4, 134 | ["Align"]="Left", 135 | ["Type"]="Label", 136 | ["TextColour"]=32768, 137 | ["Name"]="SelectionX2Label", 138 | ["Text"]="-" 139 | }, 140 | [17]={ 141 | ["Y"]=12, 142 | ["X"]=4, 143 | ["Type"]="Label", 144 | ["TextColour"]=256, 145 | ["Text"]="Y2" 146 | }, 147 | [18]={ 148 | ["Y"]=12, 149 | ["X"]=9, 150 | ["Width"]=4, 151 | ["Align"]="Left", 152 | ["Type"]="Label", 153 | ["TextColour"]=32768, 154 | ["Name"]="SelectionY2Label", 155 | ["Text"]="-" 156 | }, 157 | 158 | } 159 | } -------------------------------------------------------------------------------- /System/main.lua: -------------------------------------------------------------------------------- 1 | Bedrock.ProgramPath = shell.getRunningProgram() 2 | 3 | local bedrock = Bedrock:Initialise('/System') 4 | System.Bedrock = bedrock 5 | System.Initialise() 6 | 7 | -- bedrock.AnimationEnabled = false 8 | 9 | -- bedrock.OnKeyChar = function(self, event, keychar) 10 | -- if keychar == '\\' then 11 | -- os.reboot() 12 | -- end 13 | -- end 14 | 15 | bedrock.EventHandler = function(self) 16 | local programs = self:GetObjects('ProgramView') 17 | for i, program in ipairs(programs) do 18 | for i, event in ipairs(program.EventQueue) do 19 | program:Resume(unpack(event)) 20 | end 21 | if #program.EventQueue ~= 0 then 22 | program.EventQueue = {} 23 | end 24 | end 25 | local event = { os.pullEventRaw() } 26 | 27 | 28 | -- TODO: there seem to be tons of timers appearing out of no where 29 | local s = 'Event: ' 30 | for i, v in ipairs(event) do 31 | s = s..tostring(v)..', ' 32 | end 33 | 34 | local name = event[1] 35 | if name ~= 'char' and name ~= 'key' and name ~= 'mouse_click' and name ~= 'mouse_scroll' and name ~= 'mouse_drag' then 36 | if name ~= 'timer' or not self.Timers[event[2]] then 37 | for i, program in ipairs(programs) do 38 | program:QueueEvent(unpack(event)) 39 | end 40 | end 41 | end 42 | if self.EventHandlers[name] then 43 | for i, e in ipairs(self.EventHandlers[event[1]]) do 44 | e(self, unpack(event)) 45 | end 46 | end 47 | end 48 | 49 | 50 | function Initialise() 51 | bedrock.FileSystem = _fileSystem 52 | _fileSystem.Bedrock = bedrock 53 | 54 | Log.i(bedrock.FileSystem:ResolveAlias('/Favourites/Programs/Blah')) 55 | 56 | -- do return end 57 | 58 | bedrock:Run(function() 59 | 60 | Indexer.RefreshIndex() 61 | -- program:LoadView('main') 62 | -- TODO: debug only! 63 | bedrock:RegisterKeyboardShortcut({'\\'}, function()os.reboot()end) 64 | bedrock:RegisterKeyboardShortcut({keys.leftCtrl, 'v'}, function() 65 | Log.i('Pasting woot!') 66 | System.Clipboard:PasteToActiveObject() 67 | end) 68 | 69 | -- local clock = bedrock:GetObject('OneButton') 70 | local function updateClock() 71 | local time = os.time() 72 | if time >= 12 then 73 | sTOD = "pm" 74 | else 75 | sTOD = "am" 76 | end 77 | if time >= 13 then 78 | time = time - 12 79 | end 80 | local nHour = math.floor(time) 81 | local nMinute = math.floor((time - nHour)*60) 82 | clock.Text = string.format( "%d:%02d %s", nHour, nMinute, sTOD ) 83 | end 84 | -- bedrock:StartRepeatingTimer(updateClock, 5/6) 85 | -- updateClock() 86 | 87 | 88 | System.StartProgram('/System/Programs/Desktop.program', nil, true) 89 | 90 | local desktop = bedrock:GetObject('ProgramView') 91 | bedrock:GetObject('OneButton').OnClick = function() 92 | desktop:MakeActive() 93 | end 94 | 95 | if System.Settings.StartupProgram then 96 | System.OpenFile(System.Settings.StartupProgram) 97 | end 98 | 99 | if System.Settings.AutomaticUpdates then 100 | System.CheckUpdates() 101 | end 102 | 103 | -- System.StartProgram('/Programs/LuaIDE.program') 104 | -- System.StartProgram('/System/Programs/Files.program') 105 | -- System.StartProgram('/Programs/Sketch.program') 106 | -- System.StartProgram('/System/Programs/Settings.program') 107 | -- System.StartProgram('/Programs/test.program') 108 | end) 109 | end -------------------------------------------------------------------------------- /System/Programs/Desktop.program/Objects/SearchView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'ScrollView' 2 | Visible = false 3 | 4 | OnSearch = function(self, search) 5 | if search == '' then 6 | self.Visible = false 7 | else 8 | self:BringToFront() 9 | self:RemoveAllObjects() 10 | self.Visible = true 11 | 12 | local paths = OneOS.Indexer.Search(search) 13 | 14 | local searchItems = { 15 | Folders = {}, 16 | Documents = {}, 17 | Images = {}, 18 | Programs = {}, 19 | ['System Files'] = {}, 20 | Other = {} 21 | } 22 | 23 | -- TODO: selected item 24 | for i, path in ipairs(paths) do 25 | local extension = self.Bedrock.Helpers.Extension(path):lower() 26 | if extension ~= 'shortcut' then 27 | path = self.Bedrock.Helpers.TidyPath(path) 28 | local fileType = 'Other' 29 | if extension == 'txt' or extension == 'text' or extension == 'license' or extension == 'md' then 30 | fileType = 'Documents' 31 | elseif extension == 'nft' or extension == 'nfp' or extension == 'skch' or extension == 'paint' then 32 | fileType = 'Images' 33 | elseif extension == 'program' then 34 | fileType = 'Programs' 35 | elseif extension == 'lua' or extension == 'log' or extension == 'settings' or extension == 'version' or extension == 'hash' or extension == 'fingerprint' then 36 | fileType = 'System Files' 37 | elseif fs.isDir(path) then 38 | fileType = 'Folders' 39 | end 40 | if path == selected then 41 | Log.i('found') 42 | foundSelected = true 43 | end 44 | 45 | local parentFolder = fs.getName(path:sub(1, #path-#fs.getName(path)-1)) 46 | table.insert(searchItems[fileType], {Path = path, Text = self.Bedrock.Helpers.RemoveExtension(fs.getName(path)), Selected = (path == selected), Subtext = parentFolder}) 47 | end 48 | end 49 | 50 | local y = 2 51 | for name, items in pairs(searchItems) do 52 | if #items ~= 0 then 53 | self:AddObject({ 54 | X = 2, 55 | Y = y, 56 | Type = 'FilterLabel', 57 | FilterName = 'Highlight', 58 | Text = name 59 | }) 60 | y = y + 1 61 | 62 | self:AddObject({ 63 | X = 1, 64 | Width = '100%', 65 | Height = #items * 4 - 1, 66 | Y = y, 67 | Type = 'View', 68 | BackgroundColour = colours.grey 69 | -- Type = 'FilterView', 70 | -- FilterName = 'Highlight', 71 | }) 72 | 73 | for i, item in ipairs(items) do 74 | self:AddObject({ 75 | X = 2, 76 | Y = y, 77 | Type = 'ImageView', 78 | Image = OneOS.GetIcon(item.Path), 79 | Width = 4, 80 | Height = 3 81 | }) 82 | 83 | self:AddObject({ 84 | X = 7, 85 | Y = y, 86 | Type = 'Label', 87 | TextColour = colours.white, 88 | Text = item.Text 89 | }) 90 | 91 | self:AddObject({ 92 | X = 7, 93 | Y = y + 1, 94 | Type = 'FilterLabel', 95 | FilterName = 'Highlight', 96 | Text = item.Subtext 97 | }) 98 | y = y + 4 99 | end 100 | end 101 | end 102 | 103 | if y == 2 then 104 | self:AddObject({ 105 | X = 1, 106 | Width = '100%', 107 | Y = 3, 108 | Type = 'FilterLabel', 109 | FilterName = 'Highlight', 110 | Text = 'No Files Found', 111 | Align = 'Center' 112 | }) 113 | else 114 | end 115 | end 116 | end 117 | 118 | BringToFront = function(self) 119 | for i = #self.Bedrock.View.Children, 1, -1 do 120 | local child = self.Bedrock.View.Children[i] 121 | 122 | self.Z = child.Z + 1 123 | break 124 | end 125 | self.Bedrock:ReorderObjects() 126 | end -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Version 1.2 (beta) 2 | ==== 3 | I am currently working on version 1.2, I'm not sure when it will be released, but it's got some *huge* changes. The most significant being the new Bedrock framework which revolutionizes how GUI programs are made. You can try it out, by downloading this git, but the latest build may crash immediatly, so don't expect it to work. If it crashes or doesn't work well download the latest stable commit (pre-Bedrock): https://github.com/oeed/OneOS/archive/c3c1e7eb061397cecf49d74a0eac6dc03fb28f48.zip 4 | 5 | You will need to create a file named '.version' in the System folder and type in: 'v1.1.1' for it to work. 6 | 7 | OneOS 8 | ==== 9 | 10 | If you are going to modify any part of OneOS you MUST set isDebug to true in the startup folder. Otherwise I'll be bombarded with error reports that have nothing to do with me. 11 | 12 | Forums Post: http://www.computercraft.info/forums2/index.php?s=6cde19f0e95d5793f759f7ab9687abe4&app=forums&module=post§ion=post&do=edit_post&f=32&t=17286&p=166445&st=0&_from=quickedit 13 | 14 | Late last year I looked at PearOS and a few other ComputerCraft OSs and tried to find the best parts and problems with each. I found that in the case of PearOS and a few others you couldn't do anything. PearOS was nice and shiny, but it was completely useless. Others such as CraftBang were much loved by the community, however, I felt that CraftBang was a bit hard to use and a bit too plain. So, I set off to try to combine all the best parts of other OSs and a few things of my own in to one. I've tried to include everything into OneOS and what I couldn't/haven't can be found on the App Store (more on that later). In essence, it is an 'All in one OS' (are you picking up the meaning of the name yet :P) 15 | 16 | So, anyway, enough history. I present you the 21 thousand plus line monstrosity that is OneOS. 17 | 18 | I've compiled a fairly compact (trust me, a lot of features aren't listed) list of the main ones: 19 | - The ability to run any ComputerCraft program 20 | - Multitasking (not windowed, this was intentional) 21 | - A desktop interface 22 | - Custom file and folder icons 23 | - An easy to use file browser 24 | - An App Store 25 | - A very advanced Photoshop inspired image editor (Sketch) 26 | - An AirDrop like program to send files between computers quickly and easily 27 | - The ability to package a folder with a single click (similar to .zip files) 28 | - Aforementioned packages can then be extracted with a single click 29 | - A peripheral browser 30 | - A few games & LuaIDE 31 | - Auto-updating 32 | - A storage usage information page 33 | - Animations galore! 34 | - Many more 35 | - As you've hopefully picked up, this isn't another basic login screen OS. I started working on this in November and have worked on it fairly constantly since then. 36 | 37 | Installation 38 | ==== 39 | 40 | Simply run: 41 | pastebin run E1xftzLa 42 | 43 | If the above does not work replace run with 'get' and add 'installer' to the end, then type 'installer' in to the shell. 44 | 45 | FAQ 46 | ==== 47 | 48 | Why aren't you using windows? 49 | A few reasons, screen real estate is very minimal in CC, windows make that even worse. Many programs don't redraw when the screen size changes and they tend to be rather annoying to use. I'm quite happy with the tab based system in OneOS. 50 | 51 | Can you add ***? 52 | Let me know below, if it think it's a good idea and won't be too hard to add I might add it. 53 | 54 | I've found a bug/I've got a suggestion! 55 | Please to the GitHub issues page and make an issue there. Avoid posting an issue that is already listed. 56 | 57 | I'll add more here when people start asking more questions. 58 | -------------------------------------------------------------------------------- /System/Programs/Settings.program/Views/system.view: -------------------------------------------------------------------------------- 1 | { 2 | Children = { 3 | { 4 | X = 3, 5 | Y = 2, 6 | TextColour = 'grey', 7 | Type = 'Label', 8 | Text = 'Computer Name' 9 | }, 10 | { 11 | X = 3, 12 | Y = 3, 13 | TextColour = 'lightGrey', 14 | Type = 'Label', 15 | Text = 'The computer\'s name on the network/when dropped.' 16 | }, 17 | { 18 | X = 3, 19 | Y = 5, 20 | Width = 20, 21 | Type = 'TextBox', 22 | Name = 'ComputerNameTextBox', 23 | }, 24 | 25 | { 26 | X = 3, 27 | Y = 8, 28 | TextColour = 'grey', 29 | Type = 'Label', 30 | Text = 'Automatic Updates' 31 | }, 32 | { 33 | X = 3, 34 | Y = 9, 35 | TextColour = 'lightGrey', 36 | Type = 'Label', 37 | Text = 'Automatically update OneOS without asking.' 38 | }, 39 | { 40 | X = 3, 41 | Y = 11, 42 | Type = 'Switch', 43 | Name = 'AutomaticUpdatesSwitch', 44 | }, 45 | { 46 | X = 14, 47 | Y = 11, 48 | Text = 'Update Now', 49 | Type = 'Button', 50 | Name = 'UpdateNowButton', 51 | }, 52 | 53 | { 54 | X = 3, 55 | Y = 14, 56 | TextColour = 'grey', 57 | Type = 'Label', 58 | Text = 'Use Pre-Releases' 59 | }, 60 | { 61 | X = 3, 62 | Y = 15, 63 | TextColour = 'lightGrey', 64 | Type = 'Label', 65 | Text = 'Update to pre-release versions of OneOS.' 66 | }, 67 | { 68 | X = 3, 69 | Y = 17, 70 | Type = 'Switch', 71 | Name = 'UsePreReleasesSwitch', 72 | }, 73 | 74 | { 75 | X = 3, 76 | Y = 20, 77 | TextColour = 'grey', 78 | Type = 'Label', 79 | Text = 'Startup Program/File' 80 | }, 81 | { 82 | X = 3, 83 | Y = 21, 84 | TextColour = 'lightGrey', 85 | Type = 'Label', 86 | Text = 'Open a program or file when OneOS turns on.' 87 | }, 88 | { 89 | X = 3, 90 | Y = 23, 91 | Text = 'Select', 92 | Type = 'Button', 93 | BackgroundColour = 'grey', 94 | TextColour = 'white', 95 | Name = 'SelectStartupProgramButton', 96 | }, 97 | { 98 | X = 12, 99 | Y = 23, 100 | Text = 'None', 101 | Type = 'Button', 102 | BackgroundColour = 'grey', 103 | TextColour = 'white', 104 | Name = 'NoneStartupProgramButton', 105 | }, 106 | { 107 | X = 3, 108 | Y = 25, 109 | Text = 'Path:', 110 | Type = 'Label', 111 | TextColour = 'grey', 112 | }, 113 | { 114 | X = 9, 115 | Y = 25, 116 | Text = '', 117 | Type = 'Label', 118 | TextColour = 'lightGrey', 119 | Name = 'StartupProgramLabel', 120 | }, 121 | { 122 | X = 3, 123 | Y = 26, 124 | Type = 'View', 125 | }, 126 | }, 127 | BackgroundColour = 'white', 128 | } -------------------------------------------------------------------------------- /System/API/Bootstrap.lua: -------------------------------------------------------------------------------- 1 | cleanEnvironment = {} 2 | for k, v in pairs(_G) do 3 | cleanEnvironment[k] = v 4 | end 5 | 6 | local function anm(col) 7 | term.setBackgroundColour(col) 8 | term.clear() 9 | sleep(0.05) 10 | end 11 | 12 | anm(colours.black) 13 | anm(colours.grey) 14 | anm(colours.lightGrey) 15 | anm(colours.white) 16 | 17 | local function log(...) 18 | if Log then 19 | Log.i(...) 20 | end 21 | if isDebug or doLog then 22 | print(...) 23 | end 24 | end 25 | 26 | local function loadAPI(_sPath) 27 | local sName = string.gsub(fs.getName( _sPath ), "%.%w+$", "") 28 | log('Loading: '.._sPath) 29 | local tEnv = { isStartup = true } 30 | setmetatable( tEnv, { __index = getfenv()} ) 31 | local fnAPI, err = loadfile( _sPath ) 32 | if fnAPI then 33 | setfenv( fnAPI, tEnv ) 34 | fnAPI() 35 | else 36 | printError( err ) 37 | log('Error: '..err) 38 | return false 39 | end 40 | 41 | local tAPI = {} 42 | for k,v in pairs( tEnv ) do 43 | tAPI[k] = v 44 | end 45 | 46 | if not tAPI then 47 | log('Could not find API: '..sName) 48 | error('Could not find API: '..sName) 49 | end 50 | 51 | getfenv()[sName] = tAPI 52 | return true 53 | end 54 | 55 | loadAPI('/System/APIs/Log.lua') 56 | Log.Initialise() 57 | 58 | loadAPI('/System/APIs/FileSystem.lua') 59 | _fileSystem = FileSystem:Initialise() 60 | fs = _fileSystem.FS 61 | io = _fileSystem.IO 62 | loadfile = _fileSystem.LoadFile 63 | dofile = _fileSystem.DoFile 64 | paintutils.loadImage = _fileSystem.LoadImage 65 | 66 | loadAPI('/System/API/Bedrock.lua') 67 | 68 | if type(term.native) == 'function' then 69 | restoreTerm = function()term.redirect(term.native())end 70 | else 71 | restoreTerm = function()term.restore()end 72 | end 73 | 74 | local mode = '?' 75 | local modePath 76 | 77 | -- os.run(getfenv(), 'n') 78 | if not fs.exists('/System/.OneOS.settings') then 79 | mode = 'Setup' 80 | modePath = '/System/Programs/Setup.program/startup' 81 | os.run(getfenv(), '/System/Programs/Setup.program/startup') 82 | else 83 | local h = fs.open('/System/.bootargs', 'r') 84 | local main = true 85 | if h then 86 | local args = h.readAll() 87 | h.close() 88 | if args == 'update' then 89 | mode = 'Update' 90 | modePath = '/System/Programs/Update.program/startup' 91 | os.run(getfenv(), '/System/Programs/Update.program/startup') 92 | main = false 93 | end 94 | end 95 | 96 | if main then 97 | mode = 'Standard' 98 | modePath = '/System/main.lua' 99 | os.run(getfenv(), '/System/main.lua') 100 | end 101 | end 102 | 103 | -- TODO: if not Initialise then show error (attempt to call nil below) 104 | local _, err 105 | if Initialise then 106 | _, err= pcall(Initialise) 107 | else 108 | err = 'Unable to initialise (nil): ' .. mode 109 | end 110 | 111 | restoreTerm() 112 | 113 | if modePath and err then 114 | xpcall(function()loadfile('/System/main.lua')end, function(_err) 115 | if _err then 116 | err = err .. '\n' .. _err 117 | end 118 | end) 119 | end 120 | 121 | Log.e(err) 122 | printError(err) 123 | 124 | term.setBackgroundColour(colours.grey) 125 | term.clear() 126 | 127 | term.setTextColor(colours.white) 128 | term.setCursorPos(2, 2) 129 | print('OneOS Crashed :(') 130 | 131 | term.setTextColor(colours.lightGrey) 132 | term.setCursorPos(2, 4) 133 | print('Sorry about that!') 134 | 135 | term.setTextColor(colours.white) 136 | term.setCursorPos(2, 6) 137 | print('Please inform oeed with this information:') 138 | print() 139 | term.setTextColor(colours.lightGrey) 140 | 141 | local h = fs.open('/System/.version', 'r') 142 | if h then 143 | print('Version: ' .. h.readAll()) 144 | h.close() 145 | else 146 | print('Version: No .version file') 147 | end 148 | print() 149 | 150 | for i, v in ipairs(Log.Errors) do 151 | print(v) 152 | end 153 | 154 | local w, h = term.getSize() 155 | term.setCursorPos(1, h) -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/canvassizewindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=28, 3 | ["Height"]=10, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=2, 8 | ["X"]=6, 9 | ["Align"]="Center", 10 | ["Type"]="Label", 11 | ["TextColour"]=256, 12 | ["Text"]="New Size" 13 | }, 14 | [2]={ 15 | ["Y"]=4, 16 | ["X"]=3, 17 | ["Type"]="Label", 18 | ["TextColour"]=32768, 19 | ["Text"]="Width" 20 | }, 21 | [3]={ 22 | ["Y"]=4, 23 | ["X"]=10, 24 | ["Name"]="WidthNumberBox", 25 | ["AutoWidth"]=false, 26 | ["Type"]="NumberBox", 27 | ["Value"]=1, 28 | }, 29 | [4]={ 30 | ["Y"]=6, 31 | ["X"]=3, 32 | ["Type"]="Label", 33 | ["TextColour"]=32768, 34 | ["Text"]="Height" 35 | }, 36 | [5]={ 37 | ["Y"]=6, 38 | ["X"]=10, 39 | ["Name"]="HeightNumberBox", 40 | ["AutoWidth"]=false, 41 | ["Type"]="NumberBox", 42 | ["Value"]=1, 43 | }, 44 | 45 | [6]={ 46 | ["Y"]=2, 47 | ["X"]=20, 48 | ["Align"]="Center", 49 | ["Type"]="Label", 50 | ["TextColour"]=256, 51 | ["Text"]="Anchor", 52 | }, 53 | 54 | 55 | [7]={ 56 | ["Y"]=4, 57 | ["X"]=21, 58 | ["Width"]=1, 59 | ["AutoWidth"]=false, 60 | ["Type"]="Button", 61 | ["Name"]="Anchor1Button", 62 | ["ActiveBackgroundColour"]=256, 63 | ["ActiveTextColour"]=32768, 64 | ["Text"]=" " 65 | }, 66 | [8]={ 67 | ["Y"]=4, 68 | ["X"]=22, 69 | ["Width"]=1, 70 | ["AutoWidth"]=false, 71 | ["Type"]="Button", 72 | ["Name"]="Anchor2Button", 73 | ["ActiveBackgroundColour"]=256, 74 | ["ActiveTextColour"]=32768, 75 | ["Text"]=" " 76 | }, 77 | [9]={ 78 | ["Y"]=4, 79 | ["X"]=23, 80 | ["Width"]=1, 81 | ["AutoWidth"]=false, 82 | ["Type"]="Button", 83 | ["Name"]="Anchor3Button", 84 | ["ActiveBackgroundColour"]=256, 85 | ["ActiveTextColour"]=32768, 86 | ["Text"]=" " 87 | }, 88 | [10]={ 89 | ["Y"]=5, 90 | ["X"]=21, 91 | ["Width"]=1, 92 | ["AutoWidth"]=false, 93 | ["Type"]="Button", 94 | ["Name"]="Anchor4Button", 95 | ["ActiveBackgroundColour"]=256, 96 | ["ActiveTextColour"]=32768, 97 | ["Text"]=" " 98 | }, 99 | [11]={ 100 | ["Y"]=5, 101 | ["X"]=22, 102 | ["Width"]=1, 103 | ["AutoWidth"]=false, 104 | ["Type"]="Button", 105 | ["Name"]="Anchor5Button", 106 | ["ActiveBackgroundColour"]=256, 107 | ["ActiveTextColour"]=32768, 108 | ["Text"]=" " 109 | }, 110 | [12]={ 111 | ["Y"]=5, 112 | ["X"]=23, 113 | ["Width"]=1, 114 | ["AutoWidth"]=false, 115 | ["Type"]="Button", 116 | ["Name"]="Anchor6Button", 117 | ["ActiveBackgroundColour"]=256, 118 | ["ActiveTextColour"]=32768, 119 | ["Text"]=" " 120 | }, 121 | [13]={ 122 | ["Y"]=6, 123 | ["X"]=21, 124 | ["Width"]=1, 125 | ["AutoWidth"]=false, 126 | ["Type"]="Button", 127 | ["Name"]="Anchor7Button", 128 | ["ActiveBackgroundColour"]=256, 129 | ["ActiveTextColour"]=32768, 130 | ["Text"]=" " 131 | }, 132 | [14]={ 133 | ["Y"]=6, 134 | ["X"]=22, 135 | ["Width"]=1, 136 | ["AutoWidth"]=false, 137 | ["Type"]="Button", 138 | ["Name"]="Anchor8Button", 139 | ["ActiveBackgroundColour"]=256, 140 | ["ActiveTextColour"]=32768, 141 | ["Text"]=" " 142 | }, 143 | [15]={ 144 | ["Y"]=6, 145 | ["X"]=23, 146 | ["Width"]=1, 147 | ["AutoWidth"]=false, 148 | ["Type"]="Button", 149 | ["Name"]="Anchor9Button", 150 | ["ActiveBackgroundColour"]=256, 151 | ["ActiveTextColour"]=32768, 152 | ["Text"]=" " 153 | }, 154 | 155 | 156 | 157 | 158 | [16]={ 159 | ["Y"]="100%,-1", 160 | ["X"]="100%,-13", 161 | ["Type"]="Button", 162 | ["Name"]="CancelButton", 163 | ["Text"]="Cancel" 164 | }, 165 | [17]={ 166 | ["Y"]="100%,-1", 167 | ["X"]="100%,-4", 168 | ["Type"]="Button", 169 | ["Name"]="OkButton", 170 | ["Text"]="Ok" 171 | }, 172 | }, 173 | } -------------------------------------------------------------------------------- /Programs/App Store.program/startup: -------------------------------------------------------------------------------- 1 | local bedrockPath='/' if OneOS then OneOS.LoadAPI('/System/API/Bedrock.lua', false)elseif fs.exists(bedrockPath..'/Bedrock')then os.loadAPI(bedrockPath..'/Bedrock')else if http then print('Downloading Bedrock...')local h=http.get('http://pastebin.com/raw.php?i=0MgKNqpN')if h then local f=fs.open(bedrockPath..'/Bedrock','w')f.write(h.readAll())f.close()h.close()os.loadAPI(bedrockPath..'/Bedrock')else error('Failed to download Bedrock. Is your internet working?') end else error('This program needs to download Bedrock to work. Please enable HTTP.') end end if Bedrock then Bedrock.BasePath = bedrockPath Bedrock.ProgramPath = shell.getRunningProgram() end 2 | 3 | 4 | local program = Bedrock:Initialise() 5 | 6 | program.AppStoreURL = 'http://appstore.olivercooper.me/' 7 | 8 | program:RegisterKeyboardShortcut({'\\'}, function()os.reboot()end) 9 | 10 | program.OnKeyChar = function(self, event, keychar) 11 | if (keychar == keys.up or keychar == keys.down) then --and not program:GetActiveObject() then 12 | local currentPage = self:GetObject('CurrentPage') 13 | if currentPage then 14 | currentPage:OnScroll('mouse_scroll', (keychar == keys.up) and -1 or 1, 1, 1) 15 | end 16 | end 17 | end 18 | 19 | program.OpenPage = function(self, pageType, values) 20 | program:SetActiveObject() 21 | 22 | local currentPage = self:GetObject('CurrentPage') 23 | local previousPage = self:GetObject('PreviousPage') 24 | 25 | if currentPage then 26 | currentPage.Name = 'PreviousPage' 27 | currentPage.Visible = false 28 | end 29 | 30 | if previousPage then 31 | self:RemoveObject(previousPage) 32 | end 33 | 34 | if not values then 35 | values = {} 36 | end 37 | values.Type = pageType 38 | values.Name = 'CurrentPage' 39 | values.X = 1 40 | values.Y = 1 41 | values.Width = '100%' 42 | values.Height = '100%' 43 | self:GetObject('ContentScrollView'):AddObject(values) 44 | end 45 | 46 | program.OpenPreviousPage = function(self) 47 | program:SetActiveObject() 48 | 49 | local currentPage = self:GetObject('CurrentPage') 50 | local previousPage = self:GetObject('PreviousPage') 51 | if previousPage then 52 | previousPage.Name = 'CurrentPage' 53 | previousPage.Visible = true 54 | 55 | if currentPage then 56 | self:RemoveObject(currentPage) 57 | end 58 | else 59 | self:OpenPage('HomePageView') 60 | end 61 | end 62 | 63 | program:Run(function() 64 | program:RegisterEvent('http_success', function(self, event, url, h) 65 | local currentPage = self:GetObject('CurrentPage') 66 | if currentPage and not currentPage.Failed and not currentPage.Success and currentPage.RequestURL == url then 67 | currentPage.Success = true 68 | currentPage:OnDataLoad(url, h.readAll()) 69 | h.close() 70 | end 71 | end) 72 | 73 | program:RegisterEvent('http_failure', function(self, event, url) 74 | local currentPage = self:GetObject('CurrentPage') 75 | if currentPage and not currentPage.Failed and not currentPage.Success and currentPage.RequestURL == url then 76 | currentPage.Failed = true 77 | currentPage:OnDataFailed(url, 'Unknown error') 78 | end 79 | end) 80 | 81 | program:GetObject('HomeLabel').OnClick = function(self) 82 | program:OpenPage('HomePageView') 83 | end 84 | 85 | program:GetObject('CategoriesLabel').OnClick = function(self) 86 | program:OpenPage('CategoriesPageView') 87 | end 88 | 89 | program:GetObject('SearchLabel').OnClick = function(self) 90 | program:OpenPage('SearchPageView') 91 | end 92 | 93 | if OneOS then 94 | program:GetObject('QuitLabel').Visible = false 95 | else 96 | program:GetObject('QuitLabel').OnClick = function() 97 | term.setCursorPos(1, 1) 98 | term.setBackgroundColour(colors.black) 99 | term.setTextColor(colours.white) 100 | term.clear() 101 | print('Thanks for using the App Store!') 102 | print('(c) 2013 - 2015 oeed') 103 | program:Quit() 104 | end 105 | end 106 | 107 | end) -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/SnapWindow.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | BackgroundColour = colours.white 3 | ToolBarColour = colours.grey 4 | ToolBarTextColour = colours.white 5 | ShadowColour = colours.grey 6 | Title = '' 7 | CanClose = true 8 | DragX = nil 9 | Z = 50 10 | 11 | OnLoad = function(self) 12 | self:BringToFront() 13 | self:AddObject({ 14 | X = 1, 15 | Y = 1, 16 | Width = 1, 17 | Height = 1, 18 | Type = 'Button', 19 | BackgroundColour = colours.transparent, 20 | TextColour = colours.lightGrey, 21 | Text = 'x', 22 | Name = 'CloseButton', 23 | OnClick = function(btn) 24 | if self.OnCloseButton then 25 | self:OnCloseButton() 26 | end 27 | self:Close() 28 | end 29 | }) 30 | 31 | local view = self:AddObject({ 32 | X = 1, 33 | Y = 2, 34 | InheritView = self.ContentViewName, 35 | Type = 'View', 36 | Name = 'ContentView' 37 | }) 38 | 39 | if self.OnContentLoad then 40 | self:OnContentLoad() 41 | end 42 | 43 | self.Width = view.Width 44 | self.Height = view.Height + 1 45 | 46 | if self.Y + self.Height > Drawing.Screen.Height then 47 | self.Y = Drawing.Screen.Height - self.Height + 1 48 | end 49 | end 50 | 51 | OnWindowDrag = function(self, x, y) 52 | local old = self.Docked 53 | if x >= Drawing.Screen.Width - 2 then 54 | self.Docked = true 55 | self.Bedrock.DragWindow = nil 56 | else 57 | self.Docked = false 58 | end 59 | 60 | if old ~= self.Docked and self.OnDockChange then 61 | self:OnDockChange(self.Docked) 62 | if self.Y + self.Height > Drawing.Screen.Height then 63 | self.Y = Drawing.Screen.Height - self.Height + 1 64 | end 65 | end 66 | end 67 | 68 | OnDraw = function(self, x, y) 69 | Drawing.DrawBlankArea(x, y, self.Width, 1, self.ToolBarColour) 70 | local title = self.Bedrock.Helpers.TruncateString(self.Title, self.Width - 2) 71 | Drawing.DrawCharactersCenter(self.X, self.Y, self.Width, 1, title, self.ToolBarTextColour, self.ToolBarColour) 72 | Drawing.IgnoreConstraint = true 73 | Drawing.DrawBlankArea(x + 1, y + 1, self.Width, self.Height, self.ShadowColour) 74 | Drawing.IgnoreConstraint = false 75 | end 76 | 77 | BringToFront = function(self) 78 | for i = #self.Bedrock.View.Children, 1, -1 do 79 | local child = self.Bedrock.View.Children[i] 80 | 81 | if child.OnWindowDrag then 82 | self.Z = child.Z + 1 83 | break 84 | end 85 | end 86 | self.Bedrock:ReorderObjects() 87 | end 88 | 89 | Click = function(self, event, side, x, y, z) 90 | if self.Visible and not self.IgnoreClick then 91 | self:BringToFront() 92 | for i = #self.Children, 1, -1 do --children are ordered from smallest Z to highest, so this is done in reverse 93 | local child = self.Children[i] 94 | if self:DoClick(child, event, side, x, y) then 95 | if self.OnChildClick then 96 | self:OnChildClick(child, event, side, x, y) 97 | end 98 | return true 99 | end 100 | end 101 | if event == 'mouse_click' and self.OnClick and self:OnClick(event, side, x, y) ~= false then 102 | return true 103 | elseif event == 'mouse_drag' and self.OnDrag and self:OnDrag(event, side, x, y) ~= false then 104 | return true 105 | elseif event == 'mouse_scroll' and self.OnScroll and self:OnScroll(event, side, x, y) ~= false then 106 | return true 107 | else 108 | return false 109 | end 110 | else 111 | return false 112 | end 113 | end 114 | 115 | OnClick = function(self, event, side, x, y) 116 | if x ~= 1 and y == 1 then 117 | self.DragX = x 118 | self.Bedrock.DragWindow = self 119 | return true 120 | end 121 | return false 122 | end 123 | 124 | Close = function(self) 125 | self.Bedrock:RemoveObject(self) 126 | if self.OnClose then 127 | self:OnClose() 128 | end 129 | end 130 | 131 | OnUpdate = function(self, value) 132 | if value == 'Children' and self:GetObject('ContentView') then 133 | self.Width = self:GetObject('ContentView').Width 134 | self.Height = self:GetObject('ContentView').Height + 1 135 | end 136 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/colourswindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=13, 3 | ["Height"]=4, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=1, 8 | ["X"]=1, 9 | ["Name"]="PrimaryColourButton", 10 | ["Type"]="View", 11 | ["Width"]=5, 12 | ["Height"]=2, 13 | ["BackgroundColour"]=8, 14 | ["ActiveBackgroundColour"]=8 15 | }, 16 | [2]={ 17 | ["Y"]=3, 18 | ["X"]=1, 19 | ["Name"]="SecondaryColourButton", 20 | ["Type"]="View", 21 | ["Width"]=5, 22 | ["Height"]=2, 23 | ["BackgroundColour"]=4, 24 | ["ActiveBackgroundColour"]=4 25 | }, 26 | 27 | [3]={ 28 | ["Y"]=1, 29 | ["X"]=6, 30 | ["Type"]="Button", 31 | ["Name"]="ColourButton", 32 | ["Width"]=2, 33 | ["Height"]=1, 34 | ["BackgroundColour"]=4096, 35 | ["ActiveBackgroundColour"]=4096 36 | }, 37 | [4]={ 38 | ["Y"]=1, 39 | ["X"]=8, 40 | ["Type"]="Button", 41 | ["Name"]="ColourButton", 42 | ["Width"]=2, 43 | ["Height"]=1, 44 | ["BackgroundColour"]=16, 45 | ["ActiveBackgroundColour"]=16 46 | }, 47 | [5]={ 48 | ["Y"]=1, 49 | ["X"]=10, 50 | ["Type"]="Button", 51 | ["Name"]="ColourButton", 52 | ["Width"]=2, 53 | ["Height"]=1, 54 | ["BackgroundColour"]=2, 55 | ["ActiveBackgroundColour"]=2 56 | }, 57 | [6]={ 58 | ["Y"]=1, 59 | ["X"]=12, 60 | ["Type"]="Button", 61 | ["Name"]="ColourButton", 62 | ["Width"]=2, 63 | ["Height"]=1, 64 | ["BackgroundColour"]=16384, 65 | ["ActiveBackgroundColour"]=16384 66 | }, 67 | 68 | [7]={ 69 | ["Y"]=2, 70 | ["X"]=6, 71 | ["Type"]="Button", 72 | ["Name"]="ColourButton", 73 | ["Width"]=2, 74 | ["Height"]=1, 75 | ["BackgroundColour"]=8192, 76 | ["ActiveBackgroundColour"]=8192 77 | }, 78 | [8]={ 79 | ["Y"]=2, 80 | ["X"]=8, 81 | ["Type"]="Button", 82 | ["Name"]="ColourButton", 83 | ["Width"]=2, 84 | ["Height"]=1, 85 | ["BackgroundColour"]=32, 86 | ["ActiveBackgroundColour"]=32 87 | }, 88 | [9]={ 89 | ["Y"]=2, 90 | ["X"]=10, 91 | ["Type"]="Button", 92 | ["Name"]="ColourButton", 93 | ["Width"]=2, 94 | ["Height"]=1, 95 | ["BackgroundColour"]=4, 96 | ["ActiveBackgroundColour"]=4 97 | }, 98 | [10]={ 99 | ["Y"]=2, 100 | ["X"]=12, 101 | ["Type"]="Button", 102 | ["Name"]="ColourButton", 103 | ["Width"]=2, 104 | ["Height"]=1, 105 | ["BackgroundColour"]=64, 106 | ["ActiveBackgroundColour"]=64 107 | }, 108 | 109 | [11]={ 110 | ["Y"]=3, 111 | ["X"]=6, 112 | ["Type"]="Button", 113 | ["Name"]="ColourButton", 114 | ["Width"]=2, 115 | ["Height"]=1, 116 | ["BackgroundColour"]=1024, 117 | ["ActiveBackgroundColour"]=1024 118 | }, 119 | [12]={ 120 | ["Y"]=3, 121 | ["X"]=8, 122 | ["Type"]="Button", 123 | ["Name"]="ColourButton", 124 | ["Width"]=2, 125 | ["Height"]=1, 126 | ["BackgroundColour"]=2048, 127 | ["ActiveBackgroundColour"]=2048 128 | }, 129 | [13]={ 130 | ["Y"]=3, 131 | ["X"]=10, 132 | ["Type"]="Button", 133 | ["Name"]="ColourButton", 134 | ["Width"]=2, 135 | ["Height"]=1, 136 | ["BackgroundColour"]=512, 137 | ["ActiveBackgroundColour"]=512 138 | }, 139 | [14]={ 140 | ["Y"]=3, 141 | ["X"]=12, 142 | ["Type"]="Button", 143 | ["Name"]="ColourButton", 144 | ["Width"]=2, 145 | ["Height"]=1, 146 | ["BackgroundColour"]=8, 147 | ["ActiveBackgroundColour"]=8 148 | }, 149 | 150 | [15]={ 151 | ["Y"]=4, 152 | ["X"]=6, 153 | ["Type"]="Button", 154 | ["Name"]="ColourButton", 155 | ["Width"]=2, 156 | ["Height"]=1, 157 | ["BackgroundColour"]=256, 158 | ["ActiveBackgroundColour"]=256 159 | }, 160 | [16]={ 161 | ["Y"]=4, 162 | ["X"]=8, 163 | ["Type"]="Button", 164 | ["Name"]="ColourButton", 165 | ["Width"]=2, 166 | ["Height"]=1, 167 | ["BackgroundColour"]=128, 168 | ["ActiveBackgroundColour"]=128 169 | }, 170 | [17]={ 171 | ["Y"]=4, 172 | ["X"]=10, 173 | ["Type"]="Button", 174 | ["Name"]="ColourButton", 175 | ["Width"]=2, 176 | ["Height"]=1, 177 | ["BackgroundColour"]=32768, 178 | ["ActiveBackgroundColour"]=32768 179 | }, 180 | [18]={ 181 | ["Y"]=4, 182 | ["X"]=12, 183 | ["Type"]="Button", 184 | ["Name"]="ColourButton", 185 | ["Width"]=2, 186 | ["Height"]=1, 187 | ["BackgroundColour"]=1, 188 | ["ActiveBackgroundColour"]=1 189 | }, 190 | }, 191 | } -------------------------------------------------------------------------------- /Programs/App Store.program/APIs/App.lua: -------------------------------------------------------------------------------- 1 | ID = nil 2 | Author = nil 3 | Category = nil 4 | Name = nil 5 | Description = nil 6 | Icon = nil 7 | IconRaw = nil 8 | 9 | Bedrock = nil 10 | 11 | local function parseNFT(lines) 12 | local image = { 13 | text = {}, 14 | textcol = {} 15 | } 16 | for y, line in ipairs(lines) do 17 | table.insert(image, y, {}) 18 | table.insert(image.text, y, {}) 19 | table.insert(image.textcol, y, {}) 20 | 21 | local bgNext, fgNext = false, false 22 | local currBG, currFG = nil,nil 23 | local writePosition = 1 24 | for x = 1, #line do 25 | 26 | local nextChar = string.sub(line, x, x) 27 | if nextChar:byte() == 30 then 28 | bgNext = true 29 | elseif nextChar:byte() == 31 then 30 | fgNext = true 31 | elseif bgNext then 32 | currBG = Drawing.GetColour(nextChar) 33 | if currBG == nil then 34 | currBG = colours.transparent 35 | end 36 | bgNext = false 37 | elseif fgNext then 38 | currFG = Drawing.GetColour(nextChar) 39 | fgNext = false 40 | else 41 | if nextChar ~= " " and currFG == nil then 42 | currFG = colours.white 43 | end 44 | image[y][writePosition] = currBG 45 | image.textcol[y][writePosition] = currFG 46 | image.text[y][writePosition] = nextChar 47 | writePosition = writePosition + 1 48 | end 49 | end 50 | end 51 | return image 52 | end 53 | 54 | local function split(a,e) 55 | local t,e=e or":",{} 56 | local t=string.format("([^%s]+)",t) 57 | a:gsub(t,function(t)e[#e+1]=t end) 58 | return e 59 | end 60 | 61 | Initialise = function(self, data, bedrock) 62 | local new = {} -- the new instance 63 | setmetatable(new, {__index = self} ) 64 | 65 | new.ID = data.id 66 | new.Author = tostring(data.user.username) 67 | new.Category = tostring(data.category) 68 | new.Name = tostring(data.name) 69 | new.Description = tostring(data.description) 70 | new.Icon = parseNFT(split(data.icon, '\n')) 71 | new.IconRaw = data.icon 72 | 73 | new.Bedrock = bedrock 74 | 75 | return new 76 | end 77 | 78 | Install = function(self) 79 | self.Bedrock:OpenPage('InstallPageView', { 80 | App = self 81 | }) 82 | end 83 | 84 | InstallData = function(self, data) 85 | if type(data) ~= 'string' or #data == 0 then 86 | return false, 'Empty package (Very bad!! Let oeed know!)' 87 | end 88 | 89 | local pack = JSON.decode(data) 90 | 91 | if not pack then 92 | return false, 'Corrupted package' 93 | end 94 | 95 | local _fs = fs 96 | if OneOS then 97 | _fs = OneOS.FS 98 | end 99 | local function makeFile(_path,_content) 100 | local file=_fs.open(_path,"w") 101 | if file then 102 | file.write(_content) 103 | file.close() 104 | else 105 | error(_path) 106 | end 107 | end 108 | local function makeFolder(_path,_content) 109 | _fs.makeDir(_path) 110 | for k,v in pairs(_content) do 111 | if type(v)=="table" then 112 | makeFolder(_path.."/"..k,v) 113 | else 114 | makeFile(_path.."/"..k,v) 115 | end 116 | end 117 | end 118 | 119 | local installPath = '/' 120 | local removeSpaces = true 121 | local alwaysFolder = false 122 | local fullPath = false 123 | 124 | if OneOS then 125 | if self.Category == 'Game' or self.Category == 'Games' then 126 | installPath = '/Programs/Games/' .. self.Name .. '.program/' 127 | else 128 | installPath = '/Programs/' .. self.Name .. '.program/' 129 | end 130 | removeSpaces = false 131 | alwaysFolder = true 132 | fullPath = true 133 | end 134 | 135 | local appName = self.Name 136 | local keyCount = 0 137 | for k, v in pairs(pack) do 138 | keyCount = keyCount + 1 139 | end 140 | if removeSpaces then 141 | appName = appName:gsub(" ", "") 142 | end 143 | local location = installPath .. '/' 144 | 145 | if not fullPath then 146 | location = location .. appName 147 | end 148 | if keyCount == 1 and not alwaysFolder then 149 | makeFile(location, pack['startup']) 150 | else 151 | makeFolder(location, pack) 152 | location = location 153 | end 154 | 155 | if OneOS then 156 | local h = _fs.open(location .. '/icon', 'w') 157 | if h then 158 | h.write(self.IconRaw) 159 | h.close() 160 | end 161 | end 162 | 163 | return self.Bedrock.Helpers.TidyPath(location) 164 | end -------------------------------------------------------------------------------- /System/Programs/Update.program/APIs/GitHub.lua: -------------------------------------------------------------------------------- 1 | RequestURLs = nil 2 | Username = nil 3 | Repository = nil 4 | QueueCallbacks = nil 5 | CompletedRequests = nil 6 | 7 | Initialise = function(self, username, repository, bedrock) 8 | local new = {} -- the new instance 9 | setmetatable(new, {__index = self} ) 10 | 11 | new.QueueCallbacks = {} 12 | new.CompletedRequests = {} 13 | new.RequestURLs = {} 14 | new.Bedrock = bedrock 15 | new.Username = username 16 | new.Repository = repository 17 | 18 | bedrock:RegisterEvent('http_success', function(self, event, url, h) 19 | if new:IsValidURL(url) then 20 | for i, v in ipairs(new.RequestURLs) do 21 | if v[1] == url then 22 | v[2](h.readAll()) 23 | new.RequestURLs[i] = nil 24 | end 25 | end 26 | h.close() 27 | end 28 | end) 29 | 30 | bedrock:RegisterEvent('http_failure', function(self, event, url) 31 | if new:IsValidURL(url) then 32 | new:OnDataFailed('Unknown error') 33 | end 34 | end) 35 | 36 | return new 37 | end 38 | 39 | IsValidURL = function(self, url) 40 | for i, v in ipairs(self.RequestURLs) do 41 | if v[1] == url then 42 | return true 43 | end 44 | end 45 | return false 46 | end 47 | 48 | RemoveCompleted = function(self, url) 49 | for i, v in ipairs(self.RequestURLs) do 50 | if v[1] == url then 51 | self.RequestURLs[i] = nil 52 | end 53 | end 54 | end 55 | 56 | APIURL = function(self) 57 | return 'https://api.github.com/repos/' .. self.Username .. '/' .. self.Repository .. '/' 58 | end 59 | 60 | RawURL = function(self) 61 | return 'https://raw.github.com/' .. self.Username .. '/' .. self.Repository .. '/' 62 | end 63 | 64 | StartRequest = function(self, url, callback) 65 | table.insert(self.RequestURLs, {url, callback}) 66 | local reason 67 | 68 | if not http then 69 | reason = 'Please enabled HTTP' 70 | elseif http.checkURL and not http.checkURL(url) then 71 | reason = 'Please set HTTP whitelist to "*"' 72 | end 73 | 74 | if not reason then 75 | local ok, err = http.request(url) 76 | if ok == false then -- on earlier versions ok will be nil regardless 77 | if err then 78 | reason = err 79 | else 80 | reason = 'HTTP request error' 81 | end 82 | end 83 | end 84 | 85 | if reason then 86 | self.Failed = true 87 | self:OnDataFailed(url, reason) 88 | end 89 | end 90 | 91 | StartJSONRequest = function(self, url, callback) 92 | self:StartRequest(self:APIURL() .. url, function(data) 93 | local decoded = JSON.decode(data) 94 | callback(decoded) 95 | end) 96 | end 97 | 98 | OnDataFailed = function(self, reason) 99 | end 100 | 101 | LatestRelease = function(self, allowPreRelease, callback) 102 | self:StartJSONRequest('releases', function(releases) 103 | for i, v in ipairs(releases) do 104 | if allowPreRelease or not v.prerelease then 105 | callback(v.tag_name) 106 | break 107 | end 108 | end 109 | end) 110 | end 111 | 112 | FileTree = function(self, sha, callback) 113 | self:StartJSONRequest('git/trees/' .. sha .. '?recursive=1', function(tree) 114 | callback(tree.tree) 115 | end) 116 | end 117 | 118 | local blacklist = { 119 | '.gitignore', 120 | 'README.md', 121 | 'TODO', 122 | '.Desktop.settings', 123 | '.version' 124 | } 125 | 126 | IsBlacklisted = function(self, path) 127 | for i, item in ipairs(blacklist) do 128 | if item == path then 129 | return true 130 | end 131 | end 132 | return false 133 | end 134 | 135 | DownloadFiles = function(self, release, callback) 136 | self:StartRequest('http://cc.olivercooper.me/oneos/update.php?v=' .. release, function(data) 137 | callback(data) 138 | end) 139 | end 140 | 141 | InstallFiles = function(self, data, callback) 142 | local decoded = JSON.decode(data) 143 | 144 | local function saveFolder(path, tbl) 145 | fs.makeDir(path) 146 | for k, v in pairs(tbl) do 147 | if self:IsBlacklisted(k) then 148 | elseif type(v) == 'table' then 149 | saveFolder(path .. k .. '/', v) 150 | else 151 | local h = fs.open(path .. k, 'w') 152 | h.write(k:gsub('\/', '/')) 153 | h.close() 154 | end 155 | end 156 | end 157 | 158 | -- TODO: make this just / 159 | saveFolder('/update/', decoded) 160 | 161 | if fs.exists('/System/.onupdate') then 162 | dofile('/System/.onupdate') 163 | fs.delete('/System/.onupdate') 164 | end 165 | 166 | callback() 167 | end 168 | 169 | SaveVersion = function(self, version) 170 | local h = fs.open('/System/.version', 'w') 171 | h.write(version) 172 | h.close() 173 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Objects/LayerView.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | 3 | BackgroundColour = colours.transparent 4 | ActiveBackgroundColour = colours.blue 5 | ActiveTextColour = colours.white 6 | Height = 3 7 | DragStart = nil 8 | DragTimer = nil 9 | 10 | 11 | OnLoad = function(self) 12 | self:AddObject({ 13 | X = 2, 14 | Y = 1, 15 | Width = 1, 16 | AutoWidth = false, 17 | Text = (self.Layer.Visible and '@' or '*'), 18 | Type = 'Button', 19 | Name = 'VisibleButton', 20 | BackgroundColour = colours.transparent, 21 | ActiveBackgroundColour = colours.transparent, 22 | TextColour = colours.grey, 23 | ActiveTextColour = colours.black, 24 | Toggle = self.Layer.Visible, 25 | OnClick = function(_self) 26 | if _self.Toggle then 27 | _self.Text = '@' 28 | else 29 | _self.Text = '*' 30 | end 31 | self.Layer.Layer.Visible = _self.Toggle 32 | self.Layer.Visible = _self.Toggle 33 | end 34 | }) 35 | 36 | self:AddObject({ 37 | X = 2, 38 | Y = 2, 39 | Width = 1, 40 | AutoWidth = false, 41 | Text = 'X', 42 | Type = 'Button', 43 | Name = 'DeleteButton', 44 | BackgroundColour = colours.transparent, 45 | ActiveBackgroundColour = colours.transparent, 46 | TextColour = colours.red, 47 | OnClick = function(_self) 48 | self.Layer:DeleteLayer() 49 | end 50 | }) 51 | 52 | self:AddObject({ 53 | X = 9, 54 | Y = 1, 55 | Text = self.Layer.Layer.Name, 56 | Type = 'Label', 57 | Name = 'LayerNameLabel', 58 | BackgroundColour = colours.transparent, 59 | TextColour = colours.black 60 | }) 61 | end 62 | 63 | OnDraw = function(self, x, y) 64 | local artboard = self.Bedrock:GetObject('Artboard') 65 | 66 | local isActive = (artboard and artboard:GetCurrentLayer() == self.Layer) 67 | 68 | if isActive then 69 | Drawing.DrawBlankArea(x, y, self.Width, self.Height, self.ActiveBackgroundColour) 70 | self:GetObject('VisibleButton').TextColour = colours.lightGrey 71 | self:GetObject('VisibleButton').ActiveTextColour = colours.white 72 | self:GetObject('DeleteButton').TextColour = colours.white 73 | self:GetObject('LayerNameLabel').TextColour = colours.white 74 | else 75 | Drawing.DrawBlankArea(x, y, self.Width, self.Height, self.BackgroundColour) 76 | self:GetObject('VisibleButton').TextColour = colours.grey 77 | self:GetObject('VisibleButton').ActiveTextColour = colours.black 78 | self:GetObject('DeleteButton').TextColour = colours.red 79 | self:GetObject('LayerNameLabel').TextColour = colours.black 80 | end 81 | 82 | local previewX = 3 83 | local previewY = 0 84 | for _x = 1, 3 do 85 | local odd = (_x % 2) == 1 86 | for _y = 1, 2 do 87 | if odd then 88 | Drawing.WriteToBuffer(previewX + x + _x - 1, previewY + y + _y - 1, ":", colours.lightGrey, colours.white) 89 | else 90 | Drawing.WriteToBuffer(previewX + x + _x - 1, previewY + y + _y - 1, ":", colours.white, colours.lightGrey) 91 | end 92 | odd = not odd 93 | end 94 | end 95 | 96 | for _x, col in ipairs(self.Layer:GetZoomPixels(3, 2)) do 97 | for _y, pixel in ipairs(col) do 98 | if pixel.Character ~= ' ' or pixel.BackgroundColour ~= colours.transparent then 99 | Drawing.WriteToBuffer(previewX + x + _x - 1, previewY + y + _y - 1, pixel.Character, pixel.TextColour, pixel.BackgroundColour) 100 | end 101 | end 102 | end 103 | 104 | local splitterColour = colours.lightGrey 105 | 106 | 107 | Drawing.DrawArea(x, y + self.Height - 1, self.Width, 1, '-', (isActive and colours.white or colours.lightGrey), colours.transparent) 108 | 109 | end 110 | 111 | OnClick = function(self, event, side, x, y) 112 | if side == 1 then 113 | self.DragStart = y 114 | 115 | local artboard = self.Bedrock:GetObject('Artboard') 116 | if artboard then 117 | artboard:SetCurrentLayer(self.Layer) 118 | end 119 | elseif side == 2 then 120 | if self:ToggleMenu('layermenu', x, y) then 121 | local artboard = self.Bedrock:GetObject('Artboard') 122 | if artboard then 123 | self.Bedrock:GetObject('NewLayerMenuItem').OnClick = function() 124 | artboard:NewLayer() 125 | end 126 | self.Bedrock:GetObject('RenameLayerMenuItem').OnClick = function() 127 | self.Layer:RenameLayer() 128 | end 129 | self.Bedrock:GetObject('DeleteLayerMenuItem').OnClick = function() 130 | self.Layer:DeleteLayer() 131 | end 132 | self.Bedrock:GetObject('DuplicateLayerMenuItem').OnClick = function() 133 | artboard:DuplicateLayer(self.Layer.Layer) 134 | end 135 | self.Bedrock:GetObject('MergeDownLayerMenuItem').OnClick = function() 136 | self.Layer:MergeDown() 137 | end 138 | end 139 | end 140 | end 141 | end 142 | 143 | 144 | OnDrag = function(self, event, side, x, y) 145 | if self.DragStart then 146 | local deltaY = y - self.DragStart 147 | self.Y = self.Y + deltaY 148 | self.Parent.Parent.Parent:Rearrange(self, y) 149 | end 150 | 151 | self.DragTimer = self.Bedrock:StartTimer(function(_, timer) 152 | if timer == self.DragTimer then 153 | self.Parent.Parent.Parent:OrderLayers() 154 | self.Parent.Parent.Parent:UpdateLayers() 155 | self.DragStart = nil 156 | self.DragTimer = nil 157 | end 158 | end, 1) 159 | end -------------------------------------------------------------------------------- /System/APIs/FileSystem.lua: -------------------------------------------------------------------------------- 1 | local _fs = fs 2 | 3 | FS = nil 4 | IO = nil 5 | 6 | function Initialise(self) 7 | local new = {} -- the new instance 8 | setmetatable( new, {__index = self} ) 9 | 10 | new.RawFS = _fs 11 | 12 | new.FS = {} 13 | for k, v in pairs(fs) do 14 | new.FS[k] = new:SandboxFunction(k, v) 15 | end 16 | 17 | new.IO = io 18 | new.IO.open = new:SandboxFunction('open', io.open) 19 | 20 | new.LoadFile = function( _sFile) 21 | local file = new.FS.open( _sFile, "r") 22 | if file then 23 | local func, err = loadstring( file.readAll(), new.FS.getName( _sFile) ) 24 | file.close() 25 | return func, err 26 | end 27 | return nil, "File not found" 28 | end 29 | 30 | new.DoFile = function( _sFile ) 31 | local fnFile, e = new.LoadFile( _sFile ) 32 | if fnFile then 33 | setfenv( fnFile, getfenv(2) ) 34 | return fnFile() 35 | else 36 | error( e, 2 ) 37 | end 38 | end 39 | 40 | new.LoadImage = function( sPath ) 41 | local relPath = new.Bedrock.Helpers.RemoveFileName(path) .. sPath 42 | local tImage = {} 43 | if new.FS.exists( relPath ) then 44 | local file = new.IO.open(relPath, "r" ) 45 | local sLine = file:read() 46 | while sLine do 47 | local tLine = {} 48 | for x=1,sLine:len() do 49 | tLine[x] = tColourLookup[ string.byte(sLine,x,x) ] or 0 50 | end 51 | table.insert( tImage, tLine ) 52 | sLine = file:read() 53 | end 54 | file:close() 55 | return tImage 56 | end 57 | return nil 58 | end 59 | 60 | return new 61 | end 62 | 63 | function HandleError(self, k, v) 64 | if type(v) ~= 'function' then 65 | return v 66 | end 67 | return function(...) 68 | local response = {pcall(v, ...)} 69 | local ok = response[1] 70 | table.remove(response, 1) 71 | if ok then 72 | return unpack(response) 73 | else 74 | for i, err in ipairs(response) do 75 | Log.e('File System Error: ' .. k .. ': ' .. err) 76 | error('File System Error: ' .. k .. ': ' .. err) 77 | end 78 | 79 | end 80 | end 81 | end 82 | 83 | function UpdateIndex(self) 84 | -- self.Bedrock:StartTimer(function() 85 | -- Indexer.RefreshIndex() 86 | -- end, 3) 87 | end 88 | 89 | function SandboxFunction(self, k, v) 90 | local f 91 | if k == 'getName' or k == 'getDir' or k == 'find' or k == 'delete' then 92 | f = function(_path) 93 | return v(_path) 94 | end 95 | elseif k == 'copy' or k == 'move' then 96 | f = function(_path, _path2) 97 | self:UpdateIndex() 98 | return v(self:ResolveAlias(_path), self:ResolveAlias(_path2)) 99 | end 100 | elseif k == 'combine' then 101 | f = function(_path, _path2) 102 | return v(_path, _path2) 103 | end 104 | elseif k == 'open' then 105 | f = function(_path, mode) 106 | if mode ~= 'r' then 107 | self:UpdateIndex() 108 | end 109 | return v(self:ResolveAlias(_path), mode) 110 | end 111 | else 112 | f = function(_path) 113 | self:UpdateIndex() 114 | 115 | if k == 'list' then 116 | Log.i('list') 117 | Log.i(_path) 118 | end 119 | 120 | return v(self:ResolveAlias(_path)) 121 | end 122 | end 123 | 124 | if f then 125 | return self:HandleError(k, f) 126 | end 127 | end 128 | 129 | AliasIdentifier = string.char(1) .. 'ALIAS' .. string.char(2) 130 | 131 | function ResolveAlias(self, path) 132 | if not path or path == '/System/OneOS.log' or type(path) ~= 'string' then 133 | return path 134 | end 135 | 136 | if path:sub(1,1) ~= '/' then 137 | path = '/' .. path 138 | end 139 | 140 | local function split(a,e) 141 | local t,e=e or":",{} 142 | local t=string.format("([^%s]+)",t) 143 | a:gsub(t,function(t)e[#e+1]=t end) 144 | return e 145 | end 146 | 147 | local function tryReadAlias(_path) 148 | local h = _fs.open(_path, 'r') 149 | if h then 150 | local str = h.readLine() 151 | h.close() 152 | if str and str:sub(1, #self.AliasIdentifier) == self.AliasIdentifier then 153 | return str:sub(#self.AliasIdentifier + 1) 154 | end 155 | end 156 | end 157 | 158 | 159 | 160 | local tmpPath = path 161 | 162 | local function resolveFolders() 163 | -- If it exists (meaning that it's not within a 'fake' alias folder) try reading it's alias 164 | if _fs.exists(tmpPath) then 165 | return tryReadAlias(tmpPath) or tmpPath 166 | end 167 | 168 | local parts = split(tmpPath, '/') 169 | for i = #parts, 1, -1 do 170 | local _path = '/' .. table.concat(parts, '/') 171 | if _fs.exists(_path) then 172 | if _fs.isDir(_path) then 173 | return tmpPath 174 | end 175 | 176 | local pointer = tryReadAlias(_path) 177 | -- Log.i('Replace: ' .. _path .. ' With: ' .. pointer) 178 | tmpPath = pointer .. tmpPath:sub(#_path + 2) 179 | return resolveFolders() 180 | end 181 | table.remove(parts, i) 182 | end 183 | return path 184 | end 185 | 186 | tmpPath = resolveFolders() 187 | 188 | -- if it's not an alias just return the original path 189 | return tmpPath 190 | end 191 | 192 | function MakeAlias(self, path, pointer) 193 | if self.Bedrock then 194 | pointer = self.Bedrock.Helpers.TidyPath(pointer) 195 | end 196 | pointer = self:ResolveAlias(pointer) 197 | 198 | if not fs.exists(pointer) then 199 | return false 200 | end 201 | 202 | local h = _fs.open(path, 'w') 203 | if h then 204 | h.write(self.AliasIdentifier .. pointer) 205 | h.close() 206 | return true 207 | end 208 | return false 209 | end -------------------------------------------------------------------------------- /System/Objects/Switcher.lua: -------------------------------------------------------------------------------- 1 | Inherit = 'View' 2 | 3 | AnimationSpeed = 0.4 4 | LastPrograms = {} 5 | ProgramOrder = {} 6 | LeftMargin = 0 7 | 8 | OnLoad = function(self) 9 | self.BackgroundColour = colours.green 10 | 11 | self:AddObject({ 12 | X = 1, 13 | Type = 'FilterLabel', 14 | Name = 'ProgramCloseButton', 15 | Text = 'x', 16 | Align = 'Center', 17 | Width = 3, 18 | AutoWidth = false, 19 | FilterName = 'Highlight', 20 | OnClick = function() 21 | local program = System.CurrentProgram() 22 | if program and program.Close then 23 | program:Close() 24 | end 25 | end 26 | }) 27 | 28 | self:AddObject({ 29 | X = 1, 30 | Width = 1, 31 | Visible = false, 32 | Type = 'FilterView', 33 | FilterName = 'Highlight' 34 | }) 35 | 36 | -- self:AddObject({ 37 | -- X = 1, 38 | -- Width = 5, 39 | -- Type = 'FilterView', 40 | -- NameType = 'OneButtonFilterView', 41 | -- FilterName = 'Darker' 42 | -- }) 43 | 44 | self:AddObject({ 45 | X = -4, 46 | Type = 'FilterLabel', 47 | Name = 'OneButton', 48 | Text = 'One', 49 | AutoWidth = false, 50 | Width = 5, 51 | Align = 'Center', 52 | Passes = 2, 53 | FilterName = 'Highlight' 54 | }) 55 | 56 | self:AddObject({ 57 | X = 1, 58 | Width = '100%', 59 | Align = 'Center', 60 | Type = 'FilterLabel', 61 | Name = 'OneLabel', 62 | Text = 'OneOS', 63 | FilterName = 'Highlight' 64 | }) 65 | end 66 | 67 | OnUpdate = function(self, value) 68 | if value == 'LeftMargin' then 69 | local oneButton = self:GetObject('OneButton') 70 | if oneButton then 71 | oneButton:AnimateValue('X', nil, self.LeftMargin - 4, self.AnimationSpeed) 72 | end 73 | elseif value == 'BackgroundColour' and self.Bedrock.View then 74 | if self.Bedrock:GetObject('SplashView') then 75 | self.Bedrock:RemoveObject('SplashView') 76 | end 77 | end 78 | end 79 | 80 | SwitchBackground = function(self, from, to, direction) 81 | self.BackgroundColour = colours.black 82 | 83 | local margin = 5 84 | 85 | local one = self:AddObject({ 86 | X = (self.Width + margin) * direction, 87 | BackgroundColour = to, 88 | Type = 'View', 89 | Width = self.Width 90 | }, nil, true) 91 | one:AnimateValue('X', (self.Width + margin) * direction, 1, self.AnimationSpeed) 92 | 93 | local two = self:AddObject({ 94 | X = 1, 95 | BackgroundColour = from, 96 | Type = 'View', 97 | Width = self.Width 98 | }, nil, true) 99 | two:AnimateValue('X', 1, (self.Width + 1 + margin) * -direction, self.AnimationSpeed, function() 100 | self.Bedrock:RemoveObject(one) 101 | self.Bedrock:RemoveObject(two) 102 | self.BackgroundColour = to 103 | end) 104 | end 105 | 106 | UpdateButtons = function(self) 107 | if System.CurrentProgram().Hidden then 108 | self.LeftMargin = 0 109 | else 110 | self.LeftMargin = self:GetObject('OneButton').Width 111 | end 112 | 113 | local count = 0 114 | local newPrograms = {} 115 | for i, v in ipairs(self.Bedrock:GetObjects('ProgramView')) do 116 | if not v.Hidden then 117 | local name = tostring(v) 118 | newPrograms[name] = v 119 | count = count + 1 120 | if not self.LastPrograms[name] then 121 | self:AddObject({ 122 | Name = 'ProgramButton:' .. name, 123 | Type = 'FilterLabel', 124 | Align = 'Center', 125 | AutoWidth = false, 126 | FilterName = 'Highlight', 127 | Text = v.Title, 128 | ProgramView = v, 129 | OnClick = function(_, event, side) 130 | if side == 1 then 131 | v:MakeActive() 132 | elseif side == 3 then 133 | v:Close() 134 | end 135 | end 136 | }, nil, true) 137 | table.insert(self.ProgramOrder, name) 138 | end 139 | end 140 | end 141 | 142 | for name, v in pairs(self.LastPrograms) do 143 | if not newPrograms[name] then 144 | self:RemoveObject('ProgramButton:'..name) 145 | for i, n in ipairs(self.ProgramOrder) do 146 | if n == name then 147 | table.remove(self.ProgramOrder, i) 148 | break 149 | end 150 | end 151 | end 152 | end 153 | self.LastPrograms = newPrograms 154 | 155 | local buttonWidth = math.floor((self.Width - self.LeftMargin) / count) 156 | local activeButtonWidth = self.Width - self.LeftMargin - (buttonWidth * (count - 1)) 157 | 158 | local x = 1 + self.LeftMargin 159 | local activeX 160 | local activeProgram = System.CurrentProgram() 161 | for i, name in pairs(self.ProgramOrder) do 162 | local program = newPrograms[name] 163 | local button = self:GetObject('ProgramButton:'..name) 164 | local isActive = (program == activeProgram) 165 | 166 | local newWidth = (isActive and activeButtonWidth - 2 or buttonWidth) 167 | local newX = (isActive and x + 2 or x) 168 | 169 | if button.X == 1 then 170 | button.Width = newWidth 171 | button.X = newX 172 | else 173 | button:AnimateValue('Width', nil, newWidth, self.AnimationSpeed, function() 174 | end) 175 | button:AnimateValue('X', nil, newX, self.AnimationSpeed) 176 | end 177 | button.Text = self.Bedrock.Helpers.TruncateString(program.Title, newWidth - 2) 178 | 179 | if isActive then 180 | activeX = x 181 | end 182 | x = x + (isActive and activeButtonWidth or buttonWidth) 183 | end 184 | 185 | if activeX then 186 | local filterView = self:GetObject('FilterView') 187 | local closeButton = self:GetObject('ProgramCloseButton') 188 | if not filterView.Visible then 189 | filterView.X = activeX 190 | filterView.Width = activeButtonWidth 191 | filterView.Visible = true 192 | closeButton.Visible = true 193 | closeButton.X = activeX 194 | else 195 | filterView:AnimateValue('X', nil, activeX, self.AnimationSpeed) 196 | filterView:AnimateValue('Width', nil, activeButtonWidth, self.AnimationSpeed) 197 | closeButton:AnimateValue('X', nil, activeX, self.AnimationSpeed) 198 | end 199 | 200 | else 201 | self:GetObject('FilterView').Visible = false 202 | self:GetObject('ProgramCloseButton').Visible = false 203 | self:GetObject('FilterView').X = 1 204 | end 205 | 206 | if self.LeftMargin == 0 and count == 0 then 207 | self:GetObject('OneLabel').Visible = true 208 | else 209 | self:GetObject('OneLabel').Visible = false 210 | end 211 | 212 | end -------------------------------------------------------------------------------- /Programs/Sketch.program/Views/newdocumentwindow.view: -------------------------------------------------------------------------------- 1 | { 2 | ["Width"]=29, 3 | ["Height"]=11, 4 | ["BackgroundColour"]=1, 5 | ["Children"]={ 6 | [1]={ 7 | ["Y"]=2, 8 | ["X"]=1, 9 | ["Width"]=15, 10 | ["Align"]="Center", 11 | ["Type"]="Label", 12 | ["TextColour"]=128, 13 | ["Text"]="Size" 14 | }, 15 | [2]={ 16 | ["Y"]=4, 17 | ["X"]=2, 18 | ["Width"]=15, 19 | ["Name"]="PresetButton", 20 | ["Type"]="Button", 21 | ["Text"]="Custom V", 22 | ["Toggle"]=false 23 | }, 24 | [3]={ 25 | ["Y"]=6, 26 | ["X"]=2, 27 | ["Type"]="Label", 28 | ["TextColour"]=128, 29 | ["Text"]="Width" 30 | }, 31 | [4]={ 32 | ["Y"]=6, 33 | ["X"]=9, 34 | ["Width"]=7, 35 | ["Name"]="WidthNumberBox", 36 | ["Type"]="NumberBox", 37 | ["Minimum"]=1, 38 | ["Value"]=15, 39 | }, 40 | [5]={ 41 | ["Y"]=8, 42 | ["X"]=2, 43 | ["Type"]="Label", 44 | ["TextColour"]=128, 45 | ["Text"]="Height" 46 | }, 47 | [6]={ 48 | ["Y"]=8, 49 | ["X"]=9, 50 | ["Width"]=7, 51 | ["Name"]="HeightNumberBox", 52 | ["Type"]="NumberBox", 53 | ["Minimum"]=1, 54 | ["Value"]=10, 55 | }, 56 | 57 | [7]={ 58 | ["Y"]=1, 59 | ["X"]=17, 60 | ["Height"]="100%,-3", 61 | ["Type"]="Separator", 62 | ["Minimum"]=1, 63 | ["Value"]=15, 64 | }, 65 | 66 | [8]={ 67 | ["Y"]=2, 68 | ["X"]=19, 69 | ["Width"]=10, 70 | ["Align"]="Center", 71 | ["Type"]="Label", 72 | ["TextColour"]=128, 73 | ["Text"]="Background" 74 | }, 75 | 76 | 77 | [9]={ 78 | ["X"]=19, 79 | ["Y"]=4, 80 | ["Name"]="CurrentColourButton", 81 | ["Type"]="ColourView", 82 | ["Width"]=3, 83 | ["Height"]=1, 84 | ["BackgroundColour"]=0, 85 | ["ActiveBackgroundColour"]=0 86 | }, 87 | [10]={ 88 | ["X"]=23, 89 | ["Y"]=4, 90 | ["Name"]="NoneColourButton", 91 | ["Type"]="Button", 92 | ["Height"]=1, 93 | ["Text"]="None" 94 | }, 95 | [11]={ 96 | ["Y"]=6, 97 | ["X"]=20, 98 | ["Type"]="Button", 99 | ["Name"]="BackgroundColourButton", 100 | ["Width"]=1, 101 | ["Height"]=1, 102 | ["BackgroundColour"]=1, 103 | ["ActiveBackgroundColour"]=1 104 | }, 105 | [12]={ 106 | ["Y"]=6, 107 | ["X"]=21, 108 | ["Type"]="Button", 109 | ["Name"]="BackgroundColourButton", 110 | ["Width"]=1, 111 | ["Height"]=1, 112 | ["BackgroundColour"]=16, 113 | ["ActiveBackgroundColour"]=16 114 | }, 115 | [13]={ 116 | ["Y"]=6, 117 | ["X"]=22, 118 | ["Type"]="Button", 119 | ["Name"]="BackgroundColourButton", 120 | ["Width"]=1, 121 | ["Height"]=1, 122 | ["BackgroundColour"]=2, 123 | ["ActiveBackgroundColour"]=2 124 | }, 125 | [14]={ 126 | ["Y"]=6, 127 | ["X"]=23, 128 | ["Type"]="Button", 129 | ["Name"]="BackgroundColourButton", 130 | ["Width"]=1, 131 | ["Height"]=1, 132 | ["BackgroundColour"]=16384, 133 | ["ActiveBackgroundColour"]=16384 134 | }, 135 | 136 | [15]={ 137 | ["Y"]=6, 138 | ["X"]=24, 139 | ["Type"]="Button", 140 | ["Name"]="BackgroundColourButton", 141 | ["Width"]=1, 142 | ["Height"]=1, 143 | ["BackgroundColour"]=8192, 144 | ["ActiveBackgroundColour"]=8192 145 | }, 146 | [16]={ 147 | ["Y"]=6, 148 | ["X"]=25, 149 | ["Type"]="Button", 150 | ["Name"]="BackgroundColourButton", 151 | ["Width"]=1, 152 | ["Height"]=1, 153 | ["BackgroundColour"]=32, 154 | ["ActiveBackgroundColour"]=32 155 | }, 156 | [17]={ 157 | ["Y"]=6, 158 | ["X"]=26, 159 | ["Type"]="Button", 160 | ["Name"]="BackgroundColourButton", 161 | ["Width"]=1, 162 | ["Height"]=1, 163 | ["BackgroundColour"]=4, 164 | ["ActiveBackgroundColour"]=4 165 | }, 166 | [18]={ 167 | ["Y"]=6, 168 | ["X"]=27, 169 | ["Type"]="Button", 170 | ["Name"]="BackgroundColourButton", 171 | ["Width"]=1, 172 | ["Height"]=1, 173 | ["BackgroundColour"]=64, 174 | ["ActiveBackgroundColour"]=64 175 | }, 176 | 177 | [19]={ 178 | ["Y"]=7, 179 | ["X"]=20, 180 | ["Type"]="Button", 181 | ["Name"]="BackgroundColourButton", 182 | ["Width"]=1, 183 | ["Height"]=1, 184 | ["BackgroundColour"]=1024, 185 | ["ActiveBackgroundColour"]=1024 186 | }, 187 | [20]={ 188 | ["Y"]=7, 189 | ["X"]=21, 190 | ["Type"]="Button", 191 | ["Name"]="BackgroundColourButton", 192 | ["Width"]=1, 193 | ["Height"]=1, 194 | ["BackgroundColour"]=2048, 195 | ["ActiveBackgroundColour"]=2048 196 | }, 197 | [21]={ 198 | ["Y"]=7, 199 | ["X"]=22, 200 | ["Type"]="Button", 201 | ["Name"]="BackgroundColourButton", 202 | ["Width"]=1, 203 | ["Height"]=1, 204 | ["BackgroundColour"]=512, 205 | ["ActiveBackgroundColour"]=512 206 | }, 207 | [22]={ 208 | ["Y"]=7, 209 | ["X"]=23, 210 | ["Type"]="Button", 211 | ["Name"]="BackgroundColourButton", 212 | ["Width"]=1, 213 | ["Height"]=1, 214 | ["BackgroundColour"]=8, 215 | ["ActiveBackgroundColour"]=8 216 | }, 217 | 218 | [23]={ 219 | ["Y"]=7, 220 | ["X"]=24, 221 | ["Type"]="Button", 222 | ["Name"]="BackgroundColourButton", 223 | ["Width"]=1, 224 | ["Height"]=1, 225 | ["BackgroundColour"]=256, 226 | ["ActiveBackgroundColour"]=256 227 | }, 228 | [24]={ 229 | ["Y"]=7, 230 | ["X"]=25, 231 | ["Type"]="Button", 232 | ["Name"]="BackgroundColourButton", 233 | ["Width"]=1, 234 | ["Height"]=1, 235 | ["BackgroundColour"]=128, 236 | ["ActiveBackgroundColour"]=128 237 | }, 238 | [25]={ 239 | ["Y"]=7, 240 | ["X"]=26, 241 | ["Type"]="Button", 242 | ["Name"]="BackgroundColourButton", 243 | ["Width"]=1, 244 | ["Height"]=1, 245 | ["BackgroundColour"]=32768, 246 | ["ActiveBackgroundColour"]=32768 247 | }, 248 | [26]={ 249 | ["Y"]=7, 250 | ["X"]=27, 251 | ["Type"]="Button", 252 | ["Name"]="BackgroundColourButton", 253 | ["Width"]=1, 254 | ["Height"]=1, 255 | ["BackgroundColour"]=4096, 256 | ["ActiveBackgroundColour"]=4096 257 | }, 258 | 259 | 260 | 261 | [27]={ 262 | ["Y"]="100%,-1", 263 | ["X"]="100%,-13", 264 | ["Type"]="Button", 265 | ["Name"]="CancelButton", 266 | ["Text"]="Cancel" 267 | }, 268 | [28]={ 269 | ["Y"]="100%,-1", 270 | ["X"]="100%,-4", 271 | ["Type"]="Button", 272 | ["Name"]="OkButton", 273 | ["Text"]="Ok" 274 | }, 275 | }, 276 | } --------------------------------------------------------------------------------