drawer.lua (ada26c4a885910e0b07367b260ba049cfbae4a10) drawer.lua (a7cf056239ff1366cb231f8c6f516b023922bf4e)
1--
2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
3-- All rights reserved.
4--
5-- Redistribution and use in source and binary forms, with or without
6-- modification, are permitted provided that the following conditions
7-- are met:
8-- 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24-- SUCH DAMAGE.
25--
26-- $FreeBSD$
27--
28
29local drawer = {};
30
31local color = require("color");
1--
2-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
3-- All rights reserved.
4--
5-- Redistribution and use in source and binary forms, with or without
6-- modification, are permitted provided that the following conditions
7-- are met:
8-- 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24-- SUCH DAMAGE.
25--
26-- $FreeBSD$
27--
28
29local drawer = {};
30
31local color = require("color");
32local core = require("core");
32local screen = require("screen");
33
34drawer.brand_position = {x = 2, y = 1};
35drawer.fbsd_logo = {
36 " ______ ____ _____ _____ ",
37 " | ____| | _ \\ / ____| __ \\ ",
38 " | |___ _ __ ___ ___ | |_) | (___ | | | |",
39 " | ___| '__/ _ \\/ _ \\| _ < \\___ \\| | | |",

--- 121 unchanged lines hidden (view full) ---

161function drawer.drawmenu(m)
162 x = drawer.menu_position.x;
163 y = drawer.menu_position.y;
164
165 -- print the menu and build the alias table
166 local alias_table = {};
167 local entry_num = 0;
168 for line_num, e in ipairs(m) do
33local screen = require("screen");
34
35drawer.brand_position = {x = 2, y = 1};
36drawer.fbsd_logo = {
37 " ______ ____ _____ _____ ",
38 " | ____| | _ \\ / ____| __ \\ ",
39 " | |___ _ __ ___ ___ | |_) | (___ | | | |",
40 " | ___| '__/ _ \\/ _ \\| _ < \\___ \\| | | |",

--- 121 unchanged lines hidden (view full) ---

162function drawer.drawmenu(m)
163 x = drawer.menu_position.x;
164 y = drawer.menu_position.y;
165
166 -- print the menu and build the alias table
167 local alias_table = {};
168 local entry_num = 0;
169 for line_num, e in ipairs(m) do
169 if (e.entry_type ~= "separator") then
170 if (e.entry_type ~= core.MENU_SEPARATOR) then
170 entry_num = entry_num + 1;
171 screen.setcursor(x, y + line_num);
172 local name = "";
173
171 entry_num = entry_num + 1;
172 screen.setcursor(x, y + line_num);
173 local name = "";
174
174 if (e.entry_type == "carousel_entry") then
175 if (e.entry_type == core.MENU_CAROUSEL_ENTRY) then
175 local carid = e.carousel_id;
176 local caridx = menu.getCarouselIndex(carid);
177 local choices = e.items();
178
179 if (#choices < caridx) then
180 caridx = 1;
181 end;
182 name = e.name(caridx, choices[caridx], choices);

--- 143 unchanged lines hidden ---
176 local carid = e.carousel_id;
177 local caridx = menu.getCarouselIndex(carid);
178 local choices = e.items();
179
180 if (#choices < caridx) then
181 caridx = 1;
182 end;
183 name = e.name(caridx, choices[caridx], choices);

--- 143 unchanged lines hidden ---