From owner-svn-src-head@freebsd.org Tue Feb 20 04:23:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79BAEF25863; Tue, 20 Feb 2018 04:23:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F654804DF; Tue, 20 Feb 2018 04:23:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A4C624641; Tue, 20 Feb 2018 04:23:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1K4NiWR063405; Tue, 20 Feb 2018 04:23:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1K4Ni9T063404; Tue, 20 Feb 2018 04:23:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201802200423.w1K4Ni9T063404@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 20 Feb 2018 04:23:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329624 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 329624 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Feb 2018 04:23:44 -0000 Author: kevans Date: Tue Feb 20 04:23:43 2018 New Revision: 329624 URL: https://svnweb.freebsd.org/changeset/base/329624 Log: stand/lua: Reduce exposure of the drawer module As part of an effort to slowly reduce our exports overall to a set of stable properties/functions, go ahead and reduce what drawer exposes to others. The graphics should generally not be modified on their own, but their position could be modified if additional grahics also need to be drawn. Export position/shift information, but leave the actual graphic local to the module. The next step will be to create a 'menudef' that gets exported instead, with each entry in the menudef table describing the graphic to be drawn along with specific positioning information. Modified: head/stand/lua/drawer.lua Modified: head/stand/lua/drawer.lua ============================================================================== --- head/stand/lua/drawer.lua Tue Feb 20 04:14:12 2018 (r329623) +++ head/stand/lua/drawer.lua Tue Feb 20 04:23:43 2018 (r329624) @@ -32,6 +32,13 @@ local screen = require("screen"); local drawer = {}; +local fbsd_logo; +local beastie_color; +local beastie; +local fbsd_logo_v; +local orb; +local none; + drawer.menu_name_handlers = { -- Menu name handlers should take the menu being drawn and entry being -- drawn as parameters, and return the name of the item. @@ -51,7 +58,14 @@ drawer.menu_name_handlers = { }; drawer.brand_position = {x = 2, y = 1}; -drawer.fbsd_logo = { +drawer.logo_position = {x = 46, y = 1}; +drawer.fbsd_logo_shift = {x = 5, y = 4}; +drawer.orb_shift = {x = 2, y = 4}; +drawer.none_shift = {x = 17, y = 0}; +drawer.menu_position = {x = 6, y = 11}; +drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; + +fbsd_logo = { " ______ ____ _____ _____ ", " | ____| | _ \\ / ____| __ \\ ", " | |___ _ __ ___ ___ | |_) | (___ | | | |", @@ -61,8 +75,7 @@ drawer.fbsd_logo = { " |_| |_| \\___|\\___||____/|_____/|_____/ " }; -drawer.logo_position = {x = 46, y = 1}; -drawer.beastie_color = { +beastie_color = { " \027[31m, ,", " /( )`", " \\ \\___ / |", @@ -84,7 +97,7 @@ drawer.beastie_color = { " `--{__________)\027[37m" }; -drawer.beastie = { +beastie = { " , ,", " /( )`", " \\ \\___ / |", @@ -106,8 +119,7 @@ drawer.beastie = { " `--{__________)" }; -drawer.fbsd_logo_shift = {x = 5, y = 4}; -drawer.fbsd_logo_v = { +fbsd_logo_v = { " ______", " | ____| __ ___ ___ ", " | |__ | '__/ _ \\/ _ \\", @@ -123,8 +135,7 @@ drawer.fbsd_logo_v = { " |____/|_____/|_____/" }; -drawer.orb_shift = {x = 2, y = 4}; -drawer.orb_color = { +orb_color = { " \027[31m``` \027[31;1m`\027[31m", " s` `.....---...\027[31;1m....--.``` -/\027[31m", " +o .--` \027[31;1m/y:` +.\027[31m", @@ -142,7 +153,7 @@ drawer.orb_color = { " .---.....----.\027[37m" }; -drawer.orb = { +orb = { " ``` `", " s` `.....---.......--.``` -/", " +o .--` /y:` +.", @@ -160,14 +171,8 @@ drawer.orb = { " .---.....----." }; -drawer.none = {""}; +none = {""}; -drawer.none_shift = {x = 17, y = 0}; - -drawer.menu_position = {x = 6, y = 11}; - -drawer.box_pos_dim = {x = 3, y = 10, w = 41, h = 11}; - function drawer.drawscreen(menu_opts) -- drawlogo() must go first. -- it determines the positions of other elements @@ -277,7 +282,7 @@ function drawer.drawbrand() drawer.brand_position.y; local logo = load("return " .. tostring(loader.getenv("loader_brand")))() or - drawer.fbsd_logo; + fbsd_logo; drawer.draw(x, y, logo); end @@ -293,25 +298,25 @@ function drawer.drawlogo() if (logo == "beastie") then if (colored) then - logo = drawer.beastie_color; + logo = beastie_color; end elseif (logo == "beastiebw") then - logo = drawer.beastie; + logo = beastie; elseif (logo == "fbsdbw") then - logo = drawer.fbsd_logo_v; + logo = fbsd_logo_v; s = drawer.fbsd_logo_shift; elseif (logo == "orb") then if (colored) then - logo = drawer.orb_color; + logo = orb_color; end s = drawer.orb_shift; elseif (logo == "orbbw") then - logo = drawer.orb; + logo = orb; s = drawer.orb_shift; elseif (logo == "tribute") then - logo = drawer.fbsd_logo; + logo = fbsd_logo; elseif (logo == "tributebw") then - logo = drawer.fbsd_logo; + logo = fbsd_logo; elseif (logo == "none") then --centre brand and text if no logo drawer.brand_position.x = drawer.brand_position.x + drawer.none_shift.x; @@ -323,13 +328,13 @@ function drawer.drawlogo() --prevent redraws from moving menu further drawer.none_shift.x = 0; drawer.none_shift.y = 0; - logo = drawer.none; + logo = none; end if (not logo) then if (colored) then - logo = drawer.orb_color; + logo = orb_color; else - logo = drawer.orb; + logo = orb; end end drawer.draw(x + s.x, y + s.y, logo);