xref: /freebsd/stand/lua/drawer.lua.8 (revision 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
1beacffb3SKyle Evans.\"
2*4d846d26SWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause
3beacffb3SKyle Evans.\"
4beacffb3SKyle Evans.\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
5beacffb3SKyle Evans.\"
6beacffb3SKyle Evans.\" Redistribution and use in source and binary forms, with or without
7beacffb3SKyle Evans.\" modification, are permitted provided that the following conditions
8beacffb3SKyle Evans.\" are met:
9beacffb3SKyle Evans.\" 1. Redistributions of source code must retain the above copyright
10beacffb3SKyle Evans.\"    notice, this list of conditions and the following disclaimer.
11beacffb3SKyle Evans.\" 2. Redistributions in binary form must reproduce the above copyright
12beacffb3SKyle Evans.\"    notice, this list of conditions and the following disclaimer in the
13beacffb3SKyle Evans.\"    documentation and/or other materials provided with the distribution.
14beacffb3SKyle Evans.\"
15beacffb3SKyle Evans.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16beacffb3SKyle Evans.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17beacffb3SKyle Evans.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18beacffb3SKyle Evans.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19beacffb3SKyle Evans.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20beacffb3SKyle Evans.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21beacffb3SKyle Evans.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22beacffb3SKyle Evans.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23beacffb3SKyle Evans.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24beacffb3SKyle Evans.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25beacffb3SKyle Evans.\" SUCH DAMAGE.
26beacffb3SKyle Evans.\"
27beacffb3SKyle Evans.\" $FreeBSD$
28beacffb3SKyle Evans.\"
29beacffb3SKyle Evans.Dd August 19, 2018
30beacffb3SKyle Evans.Dt DRAWER.LUA 8
31beacffb3SKyle Evans.Os
32beacffb3SKyle Evans.Sh NAME
33beacffb3SKyle Evans.Nm drawer.lua
34beacffb3SKyle Evans.Nd FreeBSD menu/screen drawer module
35beacffb3SKyle Evans.Sh DESCRIPTION
36beacffb3SKyle Evans.Nm
37beacffb3SKyle Evanscontains functionality for drawing and manipulating the menu, logo, and brand
38beacffb3SKyle Evansto the screen.
39beacffb3SKyle Evans.Pp
40beacffb3SKyle EvansBefore using the functionality provided by
41beacffb3SKyle Evans.Nm ,
42beacffb3SKyle Evansit must be included with a statement such as the following:
43beacffb3SKyle Evans.Pp
44beacffb3SKyle Evans.Dl local drawer = require("drawer")
45beacffb3SKyle Evans.Ss BRAND DEFINITIONS
46beacffb3SKyle EvansBrand definitions describe a
47beacffb3SKyle Evans.Dq brand ,
48beacffb3SKyle Evanstraditionally drawn above the menu.
49beacffb3SKyle EvansThe exact position may be controlled by using the
50beacffb3SKyle Evans.Xr loader.conf 5
51beacffb3SKyle Evansvariables
52beacffb3SKyle Evans.Va loader_brand_x
53beacffb3SKyle Evansand
54beacffb3SKyle Evans.Va loader_brand_y .
55beacffb3SKyle EvansThe following keys may be defined for a brand definition:
56beacffb3SKyle Evans.Bl -tag -width ".Ic Graphic" -offset indent
57beacffb3SKyle Evans.It Ic graphic
58beacffb3SKyle EvansA table of strings containing rows of text to be drawn to the screen.
59beacffb3SKyle Evans.El
60beacffb3SKyle Evans.Ss LOGO DEFINITIONS
61beacffb3SKyle EvansLogo definitions describe a
62beacffb3SKyle Evans.Dq logo ,
63beacffb3SKyle Evanstraditionally to the right of the menu.
64beacffb3SKyle EvansThe exact position may be controlled by using the
65beacffb3SKyle Evans.Xr loader.conf 5
66beacffb3SKyle Evansvariables
67beacffb3SKyle Evans.Va loader_logo_x
68beacffb3SKyle Evansand
69beacffb3SKyle Evans.Va loader_logo_y .
70beacffb3SKyle EvansThe following keys may be defined for a logo definition:
71beacffb3SKyle Evans.Bl -tag -width ".Ic requires_color" -offset indent
72beacffb3SKyle Evans.It Ic requires_color
73beacffb3SKyle EvansA boolean describing whether or not this logo definition requires color.
74beacffb3SKyle EvansIf it is chosen to be drawn and it requires color on a color-disabled boot,
75beacffb3SKyle Evans.Nm
76beacffb3SKyle Evanswill elect to use the default
77beacffb3SKyle Evans.Dq orbbw
78beacffb3SKyle Evanslogo rather than the chosen logo.
79beacffb3SKyle Evans.It Ic graphic
80beacffb3SKyle EvansA table of strings containing rows of text to be drawn to the screen.
81beacffb3SKyle Evans.It Ic shift
82beacffb3SKyle EvansA table describing the
83beacffb3SKyle Evans.Va x
84beacffb3SKyle Evansand
85beacffb3SKyle Evans.Va y
86beacffb3SKyle Evansshift that should be applied to all elements should this logo be selected.
87beacffb3SKyle EvansThis is typically used for shifting the menu and brand if an empty or minimal
88beacffb3SKyle Evanslogo are selected.
89beacffb3SKyle Evans.El
90beacffb3SKyle Evans.Ss CUSTOM BRANDS AND LOGOS
91beacffb3SKyle EvansThe brand and logo system is designed to allow brands and logos to be easily
92beacffb3SKyle Evansplugged in.
93beacffb3SKyle EvansWhen an unrecognized
94beacffb3SKyle Evans.Ev loader_brand
95beacffb3SKyle Evansor
96beacffb3SKyle Evans.Ev loader_logo
97beacffb3SKyle Evansare encountered,
98beacffb3SKyle Evans.Nm
99beacffb3SKyle Evanswill attempt to include
100beacffb3SKyle Evans.Pa brand-${loader_brand}.lua
101beacffb3SKyle Evansor
102beacffb3SKyle Evans.Pa logo-${loader_logo}.lua
103beacffb3SKyle Evansrespectively.
104beacffb3SKyle EvansThese files are expected to call either
105beacffb3SKyle Evans.Fn drawer.addBrand
106beacffb3SKyle Evansor
107beacffb3SKyle Evans.Fn drawer.addLogo
108beacffb3SKyle Evansto add the requested branddef or logodef.
109beacffb3SKyle Evans.Nm
110beacffb3SKyle Evanswill attempt to do another lookup for the requested brand or logo before falling
111beacffb3SKyle Evansback to one of the following:
112beacffb3SKyle Evans.Bl -tag -width ".Ic drawer.default_color_logodef" -offset indent
113beacffb3SKyle Evans.It Ic drawer.default_brand
114beacffb3SKyle EvansThe default brand to be used if the requested brand cannot be located.
115beacffb3SKyle Evans.It Ic drawer.default_color_logodef
116beacffb3SKyle EvansThe default logodef to be used if an invalid logodef is requested and
117beacffb3SKyle Evans.Xr loader 8
118beacffb3SKyle Evanshas been configured to allow output of color.
119beacffb3SKyle Evans.It Ic drawer.default_bw_logodef
120beacffb3SKyle EvansThe default logodef to be used if either an invalid logodef has been requested,
121beacffb3SKyle Evansor a logodef has been requested that requires color and
122beacffb3SKyle Evans.Xr loader 8
123beacffb3SKyle Evanshas been configured to not output color.
124beacffb3SKyle Evans.El
125beacffb3SKyle Evans.Ss FRAME STYLES
126beacffb3SKyle Evans.Nm
127beacffb3SKyle Evanscontains the definitions for the different frame styles that may be drawn around
128beacffb3SKyle Evansthe menu.
129beacffb3SKyle EvansFrame styles define the characters drawn for horizontal lines, vertical aligns,
130beacffb3SKyle Evansand each of the four corner styles.
131beacffb3SKyle EvansThe following keys may be defined for a frame style:
132beacffb3SKyle Evans.Bl -bullet -width ""
133beacffb3SKyle Evans.It
134beacffb3SKyle Evanshorizontal
135beacffb3SKyle Evans.It
136beacffb3SKyle Evansvertical
137beacffb3SKyle Evans.It
138beacffb3SKyle Evanstop_left
139beacffb3SKyle Evans.It
140beacffb3SKyle Evansbottom_left
141beacffb3SKyle Evans.It
142beacffb3SKyle Evanstop_right
143beacffb3SKyle Evans.It
144beacffb3SKyle Evansbottom_right
145beacffb3SKyle Evans.El
146beacffb3SKyle EvansFrame styles are currently defined in the table
147beacffb3SKyle Evans.Ic drawer.frame_styles
148beacffb3SKyle Evansindexed by the name used for
149beacffb3SKyle Evans.Ev loader_menu_frame .
150beacffb3SKyle EvansNo API currently exists for manipulating this table indirectly.
151beacffb3SKyle Evans.Ss Exported functions
152beacffb3SKyle EvansThe following functions are exported from
153beacffb3SKyle Evans.Nm :
154beacffb3SKyle Evans.Bl -tag -width hook.registerType -offset indent
155beacffb3SKyle Evans.It Fn drawer.addBrand name def
156beacffb3SKyle EvansAdd the brand definition described by
157beacffb3SKyle Evans.Fa def
158beacffb3SKyle Evansto the table of known brand definitions, indexed by
159beacffb3SKyle Evans.Fa name .
160beacffb3SKyle Evans.It Fn drawer.addLogo name def
161beacffb3SKyle EvansAdd the logo definition described by
162beacffb3SKyle Evans.Fa def
163beacffb3SKyle Evansto the table of known logo definitions, indexed by
164beacffb3SKyle Evans.Fa name .
165beacffb3SKyle Evans.It Fn drawer.drawscreen menudef
166beacffb3SKyle EvansDraws the logo, brand, menu frame, and the current menu as described in
167beacffb3SKyle Evans.Fa menudef ,
168beacffb3SKyle Evansformatted as defined by
169beacffb3SKyle Evans.Xr menu.lua 8 .
170beacffb3SKyle Evans.El
171beacffb3SKyle Evans.Sh SEE ALSO
172beacffb3SKyle Evans.Xr menu.lua 8
173beacffb3SKyle Evans.Sh AUTHORS
174beacffb3SKyle EvansThe
175beacffb3SKyle Evans.Nm
176beacffb3SKyle Evansfile was originally written by
177beacffb3SKyle Evans.An Pedro Souza Aq Mt pedrosouza@FreeBSD.org .
178beacffb3SKyle EvansLater work and this manual page was done by
179beacffb3SKyle Evans.An Kyle Evans Aq Mt kevans@FreeBSD.org .
180