Changeset View
Changeset View
Standalone View
Standalone View
stand/lua/drawer.lua
| -- | -- | ||||
| -- SPDX-License-Identifier: BSD-2-Clause-FreeBSD | -- SPDX-License-Identifier: BSD-2-Clause-FreeBSD | ||||
| -- | -- | ||||
| -- Copyright (c) 2023 The SmartixOS Project <ip@smartix.llc> | |||||
| -- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> | -- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org> | ||||
| -- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> | -- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org> | ||||
| -- All rights reserved. | -- All rights reserved. | ||||
| -- | -- | ||||
| -- Redistribution and use in source and binary forms, with or without | -- Redistribution and use in source and binary forms, with or without | ||||
| Context not available. | |||||
| -- $FreeBSD$ | -- $FreeBSD$ | ||||
| -- | -- | ||||
| local color = require("color") | local color = require("color") | ||||
| local config = require("config") | local config = require("config") | ||||
| local core = require("core") | local core = require("core") | ||||
| local screen = require("screen") | local screen = require("screen") | ||||
| local fbsd_graphic_func = function () | |||||
| return{ | |||||
| " ______ ____ _____ _____ ", | |||||
| " | ____| | _ \\ / ____| __ \\ ", | |||||
| " | |___ _ __ ___ ___ | |_) | (___ | | | |", | |||||
| " | ___| '__/ _ \\/ _ \\| _ < \\___ \\| | | |", | |||||
| " | | | | | __/ __/| |_) |____) | |__| |", | |||||
| " | | | | | | || | | |", | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .." |_| |_| \\___|\\___||____/|_____/|_____/ " .. color.resetfg() ) | |||||
| } | |||||
| end | |||||
| local orb_graphic_func = function() | |||||
| return { | |||||
| " \027[31m``` \027[31;1m`\027[31m", | |||||
| " s` `.....---...\027[31;1m....--.``` -/\027[31m", | |||||
| " +o .--` \027[31;1m/y:` +.\027[31m", | |||||
| " yo`:. \027[31;1m:o `+-\027[31m", | |||||
| " y/ \027[31;1m-/` -o/\027[31m", | |||||
| " .- \027[31;1m::/sy+:.\027[31m", | |||||
| " / \027[31;1m`-- /\027[31m", | |||||
| " `: \027[31;1m:`\027[31m", | |||||
| " `: \027[31;1m:`\027[31m", | |||||
| " / \027[31;1m/\027[31m", | |||||
| " .- \027[31;1m-.\027[31m", | |||||
| " -- \027[31;1m-.\027[31m", | |||||
| " `:` \027[31;1m`:`", | |||||
| " \027[31;1m.-- `--.", | |||||
| " .---.....----.\027[m", | |||||
| } | |||||
| end | |||||
| local fbsd_brand = { | |||||
| brand = { | |||||
| graphic = fbsd_graphic_func(), | |||||
| image = "/boot/images/freebsd-brand-rev.png", | |||||
| -- shift = {x = 0, y = 0 }, | |||||
| } -- end brand | |||||
| } -- end fbsd_brand | |||||
| -- this table is not necessarily empty but just holds empty logo and brand definitions to be reused | |||||
| -- whenever an empty logo or brand is needed | |||||
| local empty_table = { | |||||
| brand = { | |||||
| graphic = "", | |||||
| image = nil, | |||||
| -- shift = {x = 0, y = 0}, | |||||
| }, | |||||
| logo = { | |||||
| graphic = "", | |||||
| image = nil, | |||||
| shift = {x = 17, y = 0}, | |||||
| } | |||||
| } -- end empty_table | |||||
| local orb_logo = { | |||||
| logo = { | |||||
| graphic = orb_graphic_func(), | |||||
| requires_color = true, | |||||
| shift = {x = 2, y = 3}, | |||||
| image = "/boot/images/freebsd-logo-rev.png", | |||||
| image_rl = 15 | |||||
| } -- end logo | |||||
| } -- end orb_logo | |||||
| local drawer = {} | local drawer = {} | ||||
| local fbsd_brand | |||||
| local none | local none | ||||
| local menu_name_handlers | local menu_name_handlers | ||||
| Context not available. | |||||
| local default_shift | local default_shift | ||||
| local shift | local shift | ||||
| local welcome_msg = "Welcome to FreeBSD" | |||||
| -- A helper function to retrieve the content of the given object | |||||
| local function getContent(object) | |||||
| if type(object) == "function" then | |||||
| return object() | |||||
| end | |||||
| -- further test can be implemented | |||||
| -- elseif type() then end | |||||
| return object | |||||
| end | |||||
| local function menuEntryName(drawing_menu, entry) | local function menuEntryName(drawing_menu, entry) | ||||
| local name_handler = menu_name_handlers[entry.entry_type] | local name_handler = menu_name_handlers[entry.entry_type] | ||||
| if name_handler ~= nil then | if name_handler ~= nil then | ||||
| return name_handler(drawing_menu, entry) | return name_handler(drawing_menu, entry) | ||||
| end | end | ||||
| if type(entry.name) == "function" then | return getContent(entry.name) | ||||
| return entry.name() | |||||
| end | |||||
| return entry.name | |||||
| end | end | ||||
| local function processFile(gfxname) | local function processFile(gfxname) | ||||
| if gfxname == nil then | if gfxname == nil then | ||||
| return false, "Missing filename" | return false, "Missing filename" | ||||
| end | end | ||||
| local ret = try_include('gfx-' .. gfxname) | local returned_table = include_file('gfx-' .. gfxname) | ||||
| if ret == nil then | if returned_table == nil then | ||||
| return false, "Failed to include gfx-" .. gfxname | return false, "Failed to include gfx-" .. gfxname | ||||
| end | end | ||||
| -- Legacy format | -- Legacy format | ||||
| if type(ret) ~= "table" then | if type(returned_table) ~= "table" then | ||||
| return true | return true | ||||
| end | end | ||||
| for gfxtype, def in pairs(ret) do | for key, value in pairs(returned_table) do | ||||
| if gfxtype == "brand" then | if key == "brand" then | ||||
| drawer.addBrand(gfxname, def) | drawer.addBrand(gfxname, value) | ||||
| elseif gfxtype == "logo" then | elseif key == "logo" then | ||||
| drawer.addLogo(gfxname, def) | drawer.addLogo(gfxname, value) | ||||
| else | else | ||||
| return false, "Unknown graphics type '" .. gfxtype .. | return false, "Unknown graphics type '" .. key .. "'" | ||||
| "'" | |||||
| end | end | ||||
| end | end | ||||
| return true | return true | ||||
| end | end | ||||
| local function getBranddef(brand) | -- This function takes a file which is supposed to contained a table representing a logo or brand, | ||||
| if brand == nil then | -- and caches its content in another global table used as cache. | ||||
| local function cache_table(givenTable,filename) | |||||
| -- Legacy format | |||||
| if type(givenTable) ~= "table" then | |||||
| return true | |||||
| end | |||||
| for key, value in pairs(givenTable) do | |||||
| if key == "brand" then | |||||
| drawer.addBrand(filename, value) | |||||
| elseif key == "logo" then | |||||
| drawer.addLogo(filename, value) | |||||
| else | |||||
| return false, "Unknown graphics type '" .. key .. "'" | |||||
| end | |||||
| end | |||||
| end | |||||
| local function fetchFile(prefix , filename) | |||||
| if filename == nil then | |||||
| return false, "Missing filename" | |||||
| end | |||||
| if prefix == nil or prefix == "" then | |||||
| prefix = 'gfx-' | |||||
| end | |||||
| local returned_table = include_file(prefix .. filename) | |||||
| if returned_table == nil then | |||||
| return false, "Failed to include " .. prefix .. filename | |||||
| end | |||||
| local result = cache_table(returned_table, filename) | |||||
| if not result then | |||||
| return result | |||||
| end | |||||
| return true | |||||
| end | |||||
| local function getBranddef(brand_name) | |||||
| if brand_name == nil then | |||||
| return nil | return nil | ||||
| end | end | ||||
| -- Look it up | -- Look it up | ||||
| local branddef = branddefs[brand] | local branddef = branddefs[brand_name] | ||||
| -- Try to pull it in | -- Try to pull it in | ||||
| if branddef == nil then | if branddef == nil then | ||||
| local res, err = processFile(brand) | local res, err = processFile(brand_name) | ||||
| if not res then | if not res then | ||||
| -- This fallback should go away after FreeBSD 13. | -- This fallback should go away after FreeBSD 13. | ||||
| try_include('brand-' .. brand) | |||||
| -- try_include('brand-' .. brand_name) | |||||
| include_file('brand-' .. brand_name) | |||||
| -- If the fallback also failed, print whatever error | -- If the fallback also failed, print whatever error | ||||
| -- we encountered in the original processing. | -- we encountered in the original processing. | ||||
| if branddefs[brand] == nil then | if branddefs[brand_name] == nil then | ||||
| print(err) | |||||
| return nil | |||||
| end | |||||
| end | |||||
| branddef = branddefs[brand_name] | |||||
| end | |||||
| return branddef | |||||
| end | |||||
| local function fetchBranddef(brand_name) | |||||
| if brand_name == nil then | |||||
| return nil | |||||
| end | |||||
| -- Look it up | |||||
| local branddef = branddefs[brand_name] | |||||
| -- Try to pull it in | |||||
| if branddef == nil then | |||||
| local res, err = fetchFile('gfx-',brand_name) | |||||
| if not res then | |||||
| res, err = fetchFile('brand-',brand_name) | |||||
| if branddefs[brand_name] == nil then | |||||
| print(err) | print(err) | ||||
| return nil | return nil | ||||
| end | end | ||||
| end | end | ||||
| branddef = branddefs[brand] | branddef = branddefs[brand_name] | ||||
| end | end | ||||
| return branddef | return branddef | ||||
| end | end | ||||
| local function getLogodef(logo) | local function fetchLogodef(logo_name) | ||||
| if logo == nil then | if logo_name == nil then | ||||
| return nil | |||||
| end | |||||
| -- Look it up | |||||
| local logodef = logodefs[logo_name] | |||||
| -- Try to pull it in | |||||
| if logodef == nil then | |||||
| local res, err = fetchFile('gfx-',logo_name) | |||||
| if not res then | |||||
| res, err = fetchFile('logo-',logo_name) | |||||
| if logodefs[logo_name] == nil then | |||||
| print(err) | |||||
| return nil | |||||
| end | |||||
| end | |||||
| logodef = logodefs[logo_name] | |||||
| end | |||||
| return logodef | |||||
| end | |||||
| local function getLogodef(logo_name) | |||||
| if logo_name == nil then | |||||
| return nil | return nil | ||||
| end | end | ||||
| -- Look it up | -- Look it up | ||||
| local logodef = logodefs[logo] | local logodef = logodefs[logo_name] | ||||
| -- Try to pull it in | -- Try to pull it in | ||||
| if logodef == nil then | if logodef == nil then | ||||
| local res, err = processFile(logo) | local res, err = processFile(logo_name) | ||||
| if not res then | if not res then | ||||
| -- This fallback should go away after FreeBSD 13. | -- This fallback should go away after FreeBSD 13. | ||||
| try_include('logo-' .. logo) | |||||
| -- try_include('logo-' .. logo_name) | |||||
| include_file('logo-' .. logo_name) | |||||
| -- If the fallback also failed, print whatever error | -- If the fallback also failed, print whatever error | ||||
| -- we encountered in the original processing. | -- we encountered in the original processing. | ||||
| if logodefs[logo] == nil then | if logodefs[logo_name] == nil then | ||||
| print(err) | print(err) | ||||
| return nil | return nil | ||||
| end | end | ||||
| end | end | ||||
| logodef = logodefs[logo] | logodef = logodefs[logo_name] | ||||
| end | end | ||||
| return logodef | return logodef | ||||
| Context not available. | |||||
| end | end | ||||
| local function drawmenu(menudef) | local function drawmenu(menudef) | ||||
| local x = menu_position.x | local XPosition = menu_position.x | ||||
| local y = menu_position.y | local YPosition = menu_position.y | ||||
| x = x + shift.x | XPosition = XPosition + shift.x | ||||
| y = y + shift.y | YPosition = YPosition + shift.y | ||||
| -- print the menu and build the alias table | -- print the menu and build the alias table | ||||
| local alias_table = {} | local alias_table = {} | ||||
| local entry_num = 0 | local entry_num = 0 | ||||
| local menu_entries = menudef.entries | local menu_entries = getContent(menudef.entries) | ||||
| local effective_line_num = 0 | local effective_line_num = 0 | ||||
| if type(menu_entries) == "function" then | |||||
| menu_entries = menu_entries() | |||||
| end | |||||
| for _, e in ipairs(menu_entries) do | for _, e in ipairs(menu_entries) do | ||||
| -- Allow menu items to be conditionally visible by specifying | -- Allow menu items to be conditionally visible by specifying | ||||
| -- a visible function. | -- a visible function. | ||||
| Context not available. | |||||
| effective_line_num = effective_line_num + 1 | effective_line_num = effective_line_num + 1 | ||||
| if e.entry_type ~= core.MENU_SEPARATOR then | if e.entry_type ~= core.MENU_SEPARATOR then | ||||
| entry_num = entry_num + 1 | entry_num = entry_num + 1 | ||||
| screen.setcursor(x, y + effective_line_num) | screen.setcursor(XPosition, YPosition + effective_line_num) | ||||
| printc(entry_num .. ". " .. menuEntryName(menudef, e)) | printc(entry_num .. ". " .. menuEntryName(menudef, e)) | ||||
| Context not available. | |||||
| end | end | ||||
| end | end | ||||
| else | else | ||||
| screen.setcursor(x, y + effective_line_num) | screen.setcursor(XPosition, YPosition + effective_line_num) | ||||
| printc(menuEntryName(menudef, e)) | printc(menuEntryName(menudef, e)) | ||||
| end | end | ||||
| ::continue:: | ::continue:: | ||||
| Context not available. | |||||
| end | end | ||||
| local function drawframe() | local function drawframe() | ||||
| local x = menu_position.x - 3 | local XPosition = menu_position.x - 3 | ||||
| local y = menu_position.y - 1 | local YPosition = menu_position.y - 1 | ||||
| local w = frame_size.w | local width = frame_size.w | ||||
| local h = frame_size.h | local height = frame_size.h | ||||
| local framestyle = loader.getenv("loader_menu_frame") or defaultframe() | local framestyle = loader.getenv("loader_menu_frame") or defaultframe() | ||||
| local framespec = drawer.frame_styles[framestyle] | local framespec = drawer.frame_styles[framestyle] | ||||
| Context not available. | |||||
| return false | return false | ||||
| end | end | ||||
| local hl = framespec.horizontal | local horizontal = framespec.horizontal | ||||
| local vl = framespec.vertical | local vertical = framespec.vertical | ||||
| local tl = framespec.top_left | local top_left = framespec.top_left | ||||
| local bl = framespec.bottom_left | local bottom_left = framespec.bottom_left | ||||
| local tr = framespec.top_right | local top_right = framespec.top_right | ||||
| local br = framespec.bottom_right | local bottom_right = framespec.bottom_right | ||||
| x = x + shift.x | XPosition = XPosition + shift.x | ||||
| y = y + shift.y | YPosition = YPosition + shift.y | ||||
| if core.isFramebufferConsole() and loader.term_drawrect ~= nil then | if core.isFramebufferConsole() and loader.term_drawrect ~= nil then | ||||
| loader.term_drawrect(x, y, x + w, y + h) | loader.term_drawrect(XPosition, YPosition, XPosition + width, YPosition + height) | ||||
| return true | return true | ||||
| end | end | ||||
| screen.setcursor(x, y); printc(tl) | screen.setcursor(XPosition, YPosition); printc(top_left) | ||||
| screen.setcursor(x, y + h); printc(bl) | screen.setcursor(XPosition, YPosition + height); printc(bottom_left) | ||||
| screen.setcursor(x + w, y); printc(tr) | screen.setcursor(XPosition + width, YPosition); printc(top_right) | ||||
| screen.setcursor(x + w, y + h); printc(br) | screen.setcursor(XPosition + width, YPosition + height); printc(bottom_right) | ||||
| screen.setcursor(x + 1, y) | screen.setcursor(XPosition + 1, YPosition) | ||||
| for _ = 1, w - 1 do | for _ = 1, width - 1 do | ||||
| printc(hl) | printc(horizontal) | ||||
| end | end | ||||
| screen.setcursor(x + 1, y + h) | screen.setcursor(XPosition + 1, YPosition + height) | ||||
| for _ = 1, w - 1 do | for _ = 1, width - 1 do | ||||
| printc(hl) | printc(horizontal) | ||||
| end | end | ||||
| for i = 1, h - 1 do | for i = 1, height - 1 do | ||||
| screen.setcursor(x, y + i) | screen.setcursor(XPosition, YPosition + i) | ||||
| printc(vl) | printc(vertical) | ||||
| screen.setcursor(x + w, y + i) | screen.setcursor(XPosition + width, YPosition + i) | ||||
| printc(vl) | printc(vertical) | ||||
| end | end | ||||
| return true | return true | ||||
| end | end | ||||
| local function drawbox() | local function drawbox() | ||||
| local x = menu_position.x - 3 | local Xposition = menu_position.x - 3 | ||||
| local y = menu_position.y - 1 | local Yposition = menu_position.y - 1 | ||||
| local w = frame_size.w | local width = frame_size.w | ||||
| local menu_header = loader.getenv("loader_menu_title") or | local menu_header = loader.getenv("loader_menu_title") or welcome_msg | ||||
| "Welcome to FreeBSD" | |||||
| local menu_header_align = loader.getenv("loader_menu_title_align") | local menu_header_align = loader.getenv("loader_menu_title_align") | ||||
| local menu_header_x | local menu_header_x | ||||
| x = x + shift.x | Xposition = Xposition + shift.x | ||||
| y = y + shift.y | Yposition = Yposition + shift.y | ||||
| if drawframe(x, y, w) == false then | if drawframe(Xposition, Yposition, width) == false then | ||||
| return | return | ||||
| end | end | ||||
| Context not available. | |||||
| menu_header_align = menu_header_align:lower() | menu_header_align = menu_header_align:lower() | ||||
| if menu_header_align == "left" then | if menu_header_align == "left" then | ||||
| -- Just inside the left border on top | -- Just inside the left border on top | ||||
| menu_header_x = x + 1 | menu_header_x = Xposition + 1 | ||||
| elseif menu_header_align == "right" then | elseif menu_header_align == "right" then | ||||
| -- Just inside the right border on top | -- Just inside the right border on top | ||||
| menu_header_x = x + w - #menu_header | menu_header_x = Xposition + width - #menu_header | ||||
| end | end | ||||
| end | end | ||||
| if menu_header_x == nil then | if menu_header_x == nil then | ||||
| menu_header_x = x + (w // 2) - (#menu_header // 2) | menu_header_x = Xposition + (width // 2) - (#menu_header // 2) | ||||
| end | end | ||||
| screen.setcursor(menu_header_x - 1, y) | screen.setcursor(menu_header_x - 1, Yposition) | ||||
| if menu_header ~= "" then | if menu_header ~= "" then | ||||
| printc(" " .. menu_header .. " ") | printc(" " .. menu_header .. " ") | ||||
| end | end | ||||
| Context not available. | |||||
| end | end | ||||
| local function drawbrand() | local function drawbrand() | ||||
| local x = tonumber(loader.getenv("loader_brand_x")) or | local XPosition = tonumber(loader.getenv("loader_brand_x")) or | ||||
| brand_position.x | brand_position.x | ||||
| local y = tonumber(loader.getenv("loader_brand_y")) or | local YPosition = tonumber(loader.getenv("loader_brand_y")) or | ||||
| brand_position.y | brand_position.y | ||||
| local branddef = getBranddef(loader.getenv("loader_brand")) | local requested_brand= loader.getenv("loader_brand"); | ||||
| local branddef = fetchBranddef(requested_brand) | |||||
| -- local branddef = getBranddef(loader.getenv("loader_brand")) | |||||
| if branddef == nil then | if branddef == nil then | ||||
| branddef = getBranddef(drawer.default_brand) | branddef = fetchBranddef(drawer.default_brand) | ||||
| -- branddef = getBranddef(drawer.default_brand) | |||||
| end | end | ||||
| local graphic = branddef.graphic | |||||
| -- local graphic = branddef.graphic | |||||
| local graphic = getContent(branddef.graphic) | |||||
| x = x + shift.x | XPosition = XPosition + shift.x | ||||
| y = y + shift.y | YPosition = YPosition + shift.y | ||||
| if branddef.shift ~= nil then | if branddef.shift ~= nil then | ||||
| x = x + branddef.shift.x | XPosition = XPosition + branddef.shift.x | ||||
| y = y + branddef.shift.y | YPosition = YPosition + branddef.shift.y | ||||
| end | end | ||||
| if core.isFramebufferConsole() and | if core.isFramebufferConsole() and | ||||
| Context not available. | |||||
| return true | return true | ||||
| end | end | ||||
| end | end | ||||
| draw(x, y, graphic) | draw(XPosition, YPosition, graphic) | ||||
| end | end | ||||
| local function drawlogo() | local function drawlogo() | ||||
| local x = tonumber(loader.getenv("loader_logo_x")) or | local XPosition = tonumber(loader.getenv("loader_logo_x")) or | ||||
| logo_position.x | logo_position.x | ||||
| local y = tonumber(loader.getenv("loader_logo_y")) or | local YPosition = tonumber(loader.getenv("loader_logo_y")) or | ||||
| logo_position.y | logo_position.y | ||||
| local logo = loader.getenv("loader_logo") | local logo = loader.getenv("loader_logo") | ||||
| local colored = color.isEnabled() | local colored = color.isEnabled() | ||||
| local logodef = getLogodef(logo) | -- local logodef = getLogodef(logo) | ||||
| local logodef = fetchLogodef(logo) | |||||
| if logodef == nil then | |||||
| logodef = fetchLogodef(drawer.default_logo) | |||||
| -- logodef = getLogodef(drawer.default_logo) | |||||
| end | |||||
| local graphic = getContent(logodef.graphic) | |||||
| if logodef == nil or logodef.graphic == nil or | if logodef == nil or graphic == nil or | ||||
| (not colored and logodef.requires_color) then | (not colored and logodef.requires_color) then | ||||
| -- Choose a sensible default | -- Choose a sensible default | ||||
| if colored then | if colored then | ||||
| Context not available. | |||||
| end | end | ||||
| end | end | ||||
| if logodef ~= nil and logodef.graphic == none then | if logodef ~= nil and graphic == none then | ||||
| shift = logodef.shift | shift = logodef.shift | ||||
| else | else | ||||
| shift = default_shift | shift = default_shift | ||||
| end | end | ||||
| x = x + shift.x | XPosition = XPosition + shift.x | ||||
| y = y + shift.y | YPosition = YPosition + shift.y | ||||
| if logodef ~= nil and logodef.shift ~= nil then | if logodef ~= nil and logodef.shift ~= nil then | ||||
| x = x + logodef.shift.x | XPosition = XPosition + logodef.shift.x | ||||
| y = y + logodef.shift.y | YPosition = YPosition + logodef.shift.y | ||||
| end | end | ||||
| if core.isFramebufferConsole() and | if core.isFramebufferConsole() and | ||||
| Context not available. | |||||
| if logodef.image_rl ~= nil then | if logodef.image_rl ~= nil then | ||||
| y1 = logodef.image_rl | y1 = logodef.image_rl | ||||
| end | end | ||||
| if loader.term_putimage(logodef.image, x, y, 0, y + y1, 0) | if loader.term_putimage(logodef.image, XPosition, YPosition, 0, YPosition + y1, 0) | ||||
| then | then | ||||
| return true | return true | ||||
| end | end | ||||
| end | end | ||||
| draw(x, y, logodef.graphic) | draw(XPosition, YPosition, graphic) | ||||
| end | end -- drawlogo() | ||||
| local function drawitem(func) | local function drawitem(func) | ||||
| local console = loader.getenv("console") | local console = loader.getenv("console") | ||||
| local c | |||||
| for c in string.gmatch(console, "%w+") do | for c in string.gmatch(console, "%w+") do | ||||
| loader.setenv("console", c) | loader.setenv("console", c) | ||||
| func() | func() | ||||
| end | end | ||||
| loader.setenv("console", console) | loader.setenv("console", console) | ||||
| end | end -- drawitem(func) | ||||
| fbsd_brand = { | |||||
| " ______ ____ _____ _____ ", | |||||
| " | ____| | _ \\ / ____| __ \\ ", | |||||
| " | |___ _ __ ___ ___ | |_) | (___ | | | |", | |||||
| " | ___| '__/ _ \\/ _ \\| _ < \\___ \\| | | |", | |||||
| " | | | | | __/ __/| |_) |____) | |__| |", | |||||
| " | | | | | | || | | |", | |||||
| " |_| |_| \\___|\\___||____/|_____/|_____/ " | |||||
| } | |||||
| none = {""} | none = {""} | ||||
| menu_name_handlers = { | menu_name_handlers = { | ||||
| Context not available. | |||||
| -- types not specified here is to use entry.name directly. | -- types not specified here is to use entry.name directly. | ||||
| [core.MENU_SEPARATOR] = function(_, entry) | [core.MENU_SEPARATOR] = function(_, entry) | ||||
| if entry.name ~= nil then | if entry.name ~= nil then | ||||
| if type(entry.name) == "function" then | -- if type(entry.name) == "function" then | ||||
| return entry.name() | -- return entry.name() | ||||
| end | -- end | ||||
| return entry.name | -- return entry.name | ||||
| return getContent(entry.name) | |||||
| end | end | ||||
| return "" | return "" | ||||
| end, | end, | ||||
| Context not available. | |||||
| local carid = entry.carousel_id | local carid = entry.carousel_id | ||||
| local caridx = config.getCarouselIndex(carid) | local caridx = config.getCarouselIndex(carid) | ||||
| local choices = entry.items | local choices = entry.items | ||||
| if type(choices) == "function" then | if type(choices) == "function" then | ||||
| choices = choices() | choices = choices() | ||||
| end | end | ||||
| Context not available. | |||||
| branddefs = { | branddefs = { | ||||
| -- Indexed by valid values for loader_brand in loader.conf(5). Valid | -- Indexed by valid values for loader_brand in loader.conf(5). Valid | ||||
| -- keys are: graphic (table depicting graphic) | -- keys are: graphic (table depicting graphic) | ||||
| ["fbsd"] = { | ["fbsd"] = fbsd_brand.brand, | ||||
| graphic = fbsd_brand, | |||||
| image = "/boot/images/freebsd-brand-rev.png", | ["none"] = empty_table.brand, | ||||
| }, | |||||
| ["none"] = { | |||||
| graphic = none, | |||||
| }, | |||||
| } | } | ||||
| local tribute_graphic_func = function() | |||||
| return { | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .::' .." .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .::: ..... '::." .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::::. :::." .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::'::''::::::::::::" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .:..:' :::::::::::" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ::::::: :::::::::'" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " . :::::::'.::::::::" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ..::.::::::::::::::::" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "..'::.: ':::::::::::::'" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. "':::::::::.'::::::::'" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::.::::::::." .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '::::::::::::::" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ':::::::::::" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::." .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :::::::::::.." .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " .......:::::::::::::::...." .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " :'....'''''::::::::. '''''::::.." .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " '''':::::::::::.'' .: .:::" .. color.resetfg() ), | |||||
| color.highlight(color.escapefg(color.getTheme(color.LOGO)) .. " ..::::::::'" .. color.resetfg() ), | |||||
| } | |||||
| end | |||||
| local tribute_logo = { | |||||
| logo = { | |||||
| graphic = tribute_graphic_func(), | |||||
| -- requires_color = true, | |||||
| shift = {x = 0, y = 1 }, | |||||
| -- image = "/boot/images/freebsd-logo-rev.png", | |||||
| -- image_rl = 15 | |||||
| } -- end logo | |||||
| } -- end tribute_logo | |||||
| logodefs = { | logodefs = { | ||||
| -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys | -- Indexed by valid values for loader_logo in loader.conf(5). Valid keys | ||||
| -- are: requires_color (boolean), graphic (table depicting graphic), and | -- are: requires_color (boolean), graphic (table depicting graphic), and | ||||
| -- shift (table containing x and y). | -- shift (table containing x and y). | ||||
| ["tribute"] = { | ["tribute"] = tribute_logo.logo, | ||||
| graphic = fbsd_brand, | |||||
| }, | -- ["tributebw"] = { | ||||
| -- graphic = fbsd_graphic_func(), | |||||
| -- shift = {x = 0, y = 4}, | |||||
| -- }, | |||||
| ["tributebw"] = { | ["tributebw"] = { | ||||
| graphic = fbsd_brand, | graphic = empty_table.logo.graphic, | ||||
| }, | img = empty_table.logo.img, | ||||
| ["none"] = { | shift = empty_table.logo.shift, | ||||
| graphic = none, | |||||
| shift = {x = 17, y = 0}, | }, | ||||
| }, | |||||
| ["orb"] = orb_logo.logo, | |||||
| ["none"] = empty_table.logo, | |||||
| } | } | ||||
| brand_position = {x = 2, y = 1} | brand_position = {x = 1, y = 1} | ||||
| logo_position = {x = 46, y = 4} | logo_position = {x = 46, y = 4} | ||||
| menu_position = {x = 5, y = 10} | menu_position = {x = 5, y = 10} | ||||
| frame_size = {w = 42, h = 13} | frame_size = {w = 42, h = 13} | ||||
| Context not available. | |||||
| shift = default_shift | shift = default_shift | ||||
| -- Module exports | -- Module exports | ||||
| drawer.default_logo = 'orb' | |||||
| drawer.default_brand = 'fbsd' | drawer.default_brand = 'fbsd' | ||||
| drawer.default_color_logodef = 'orb' | drawer.default_color_logodef = 'orb' | ||||
| drawer.default_bw_logodef = 'orbbw' | drawer.default_bw_logodef = 'orbbw' | ||||
| -- For when things go terribly wrong; this def should be present here in the | -- For when things go terribly wrong; this def should be present here in the | ||||
| -- drawer module in case it's a filesystem issue. | -- drawer module in case it's a filesystem issue. | ||||
| Context not available. | |||||