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);
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to