xref: /freebsd/stand/lua/drawer.lua.8 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
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.Dd August 19, 2018
28beacffb3SKyle Evans.Dt DRAWER.LUA 8
29beacffb3SKyle Evans.Os
30beacffb3SKyle Evans.Sh NAME
31beacffb3SKyle Evans.Nm drawer.lua
32beacffb3SKyle Evans.Nd FreeBSD menu/screen drawer module
33beacffb3SKyle Evans.Sh DESCRIPTION
34beacffb3SKyle Evans.Nm
35beacffb3SKyle Evanscontains functionality for drawing and manipulating the menu, logo, and brand
36beacffb3SKyle Evansto the screen.
37beacffb3SKyle Evans.Pp
38beacffb3SKyle EvansBefore using the functionality provided by
39beacffb3SKyle Evans.Nm ,
40beacffb3SKyle Evansit must be included with a statement such as the following:
41beacffb3SKyle Evans.Pp
42beacffb3SKyle Evans.Dl local drawer = require("drawer")
43beacffb3SKyle Evans.Ss BRAND DEFINITIONS
44beacffb3SKyle EvansBrand definitions describe a
45beacffb3SKyle Evans.Dq brand ,
46beacffb3SKyle Evanstraditionally drawn above the menu.
47beacffb3SKyle EvansThe exact position may be controlled by using the
48beacffb3SKyle Evans.Xr loader.conf 5
49beacffb3SKyle Evansvariables
50beacffb3SKyle Evans.Va loader_brand_x
51beacffb3SKyle Evansand
52beacffb3SKyle Evans.Va loader_brand_y .
53beacffb3SKyle EvansThe following keys may be defined for a brand definition:
54beacffb3SKyle Evans.Bl -tag -width ".Ic Graphic" -offset indent
55beacffb3SKyle Evans.It Ic graphic
56beacffb3SKyle EvansA table of strings containing rows of text to be drawn to the screen.
57beacffb3SKyle Evans.El
58beacffb3SKyle Evans.Ss LOGO DEFINITIONS
59beacffb3SKyle EvansLogo definitions describe a
60beacffb3SKyle Evans.Dq logo ,
61beacffb3SKyle Evanstraditionally to the right of the menu.
62beacffb3SKyle EvansThe exact position may be controlled by using the
63beacffb3SKyle Evans.Xr loader.conf 5
64beacffb3SKyle Evansvariables
65beacffb3SKyle Evans.Va loader_logo_x
66beacffb3SKyle Evansand
67beacffb3SKyle Evans.Va loader_logo_y .
68beacffb3SKyle EvansThe following keys may be defined for a logo definition:
69beacffb3SKyle Evans.Bl -tag -width ".Ic requires_color" -offset indent
70beacffb3SKyle Evans.It Ic requires_color
71beacffb3SKyle EvansA boolean describing whether or not this logo definition requires color.
72beacffb3SKyle EvansIf it is chosen to be drawn and it requires color on a color-disabled boot,
73beacffb3SKyle Evans.Nm
74beacffb3SKyle Evanswill elect to use the default
75beacffb3SKyle Evans.Dq orbbw
76beacffb3SKyle Evanslogo rather than the chosen logo.
77beacffb3SKyle Evans.It Ic graphic
78beacffb3SKyle EvansA table of strings containing rows of text to be drawn to the screen.
79beacffb3SKyle Evans.It Ic shift
80beacffb3SKyle EvansA table describing the
81beacffb3SKyle Evans.Va x
82beacffb3SKyle Evansand
83beacffb3SKyle Evans.Va y
84beacffb3SKyle Evansshift that should be applied to all elements should this logo be selected.
85beacffb3SKyle EvansThis is typically used for shifting the menu and brand if an empty or minimal
86beacffb3SKyle Evanslogo are selected.
87beacffb3SKyle Evans.El
88beacffb3SKyle Evans.Ss CUSTOM BRANDS AND LOGOS
89beacffb3SKyle EvansThe brand and logo system is designed to allow brands and logos to be easily
90beacffb3SKyle Evansplugged in.
91beacffb3SKyle EvansWhen an unrecognized
92beacffb3SKyle Evans.Ev loader_brand
93beacffb3SKyle Evansor
94beacffb3SKyle Evans.Ev loader_logo
95beacffb3SKyle Evansare encountered,
96beacffb3SKyle Evans.Nm
97beacffb3SKyle Evanswill attempt to include
98beacffb3SKyle Evans.Pa brand-${loader_brand}.lua
99beacffb3SKyle Evansor
100beacffb3SKyle Evans.Pa logo-${loader_logo}.lua
101beacffb3SKyle Evansrespectively.
102beacffb3SKyle EvansThese files are expected to call either
103beacffb3SKyle Evans.Fn drawer.addBrand
104beacffb3SKyle Evansor
105beacffb3SKyle Evans.Fn drawer.addLogo
106beacffb3SKyle Evansto add the requested branddef or logodef.
107beacffb3SKyle Evans.Nm
108beacffb3SKyle Evanswill attempt to do another lookup for the requested brand or logo before falling
109beacffb3SKyle Evansback to one of the following:
110beacffb3SKyle Evans.Bl -tag -width ".Ic drawer.default_color_logodef" -offset indent
111beacffb3SKyle Evans.It Ic drawer.default_brand
112beacffb3SKyle EvansThe default brand to be used if the requested brand cannot be located.
113beacffb3SKyle Evans.It Ic drawer.default_color_logodef
114beacffb3SKyle EvansThe default logodef to be used if an invalid logodef is requested and
115beacffb3SKyle Evans.Xr loader 8
116beacffb3SKyle Evanshas been configured to allow output of color.
117beacffb3SKyle Evans.It Ic drawer.default_bw_logodef
118beacffb3SKyle EvansThe default logodef to be used if either an invalid logodef has been requested,
119beacffb3SKyle Evansor a logodef has been requested that requires color and
120beacffb3SKyle Evans.Xr loader 8
121beacffb3SKyle Evanshas been configured to not output color.
122beacffb3SKyle Evans.El
123beacffb3SKyle Evans.Ss FRAME STYLES
124beacffb3SKyle Evans.Nm
125beacffb3SKyle Evanscontains the definitions for the different frame styles that may be drawn around
126beacffb3SKyle Evansthe menu.
127beacffb3SKyle EvansFrame styles define the characters drawn for horizontal lines, vertical aligns,
128beacffb3SKyle Evansand each of the four corner styles.
129beacffb3SKyle EvansThe following keys may be defined for a frame style:
130beacffb3SKyle Evans.Bl -bullet -width ""
131beacffb3SKyle Evans.It
132beacffb3SKyle Evanshorizontal
133beacffb3SKyle Evans.It
134beacffb3SKyle Evansvertical
135beacffb3SKyle Evans.It
136beacffb3SKyle Evanstop_left
137beacffb3SKyle Evans.It
138beacffb3SKyle Evansbottom_left
139beacffb3SKyle Evans.It
140beacffb3SKyle Evanstop_right
141beacffb3SKyle Evans.It
142beacffb3SKyle Evansbottom_right
143beacffb3SKyle Evans.El
144beacffb3SKyle EvansFrame styles are currently defined in the table
145beacffb3SKyle Evans.Ic drawer.frame_styles
146beacffb3SKyle Evansindexed by the name used for
147beacffb3SKyle Evans.Ev loader_menu_frame .
148beacffb3SKyle EvansNo API currently exists for manipulating this table indirectly.
149beacffb3SKyle Evans.Ss Exported functions
150beacffb3SKyle EvansThe following functions are exported from
151beacffb3SKyle Evans.Nm :
152beacffb3SKyle Evans.Bl -tag -width hook.registerType -offset indent
153beacffb3SKyle Evans.It Fn drawer.addBrand name def
154beacffb3SKyle EvansAdd the brand definition described by
155beacffb3SKyle Evans.Fa def
156beacffb3SKyle Evansto the table of known brand definitions, indexed by
157beacffb3SKyle Evans.Fa name .
158beacffb3SKyle Evans.It Fn drawer.addLogo name def
159beacffb3SKyle EvansAdd the logo definition described by
160beacffb3SKyle Evans.Fa def
161beacffb3SKyle Evansto the table of known logo definitions, indexed by
162beacffb3SKyle Evans.Fa name .
163beacffb3SKyle Evans.It Fn drawer.drawscreen menudef
164beacffb3SKyle EvansDraws the logo, brand, menu frame, and the current menu as described in
165beacffb3SKyle Evans.Fa menudef ,
166beacffb3SKyle Evansformatted as defined by
167beacffb3SKyle Evans.Xr menu.lua 8 .
168beacffb3SKyle Evans.El
169beacffb3SKyle Evans.Sh SEE ALSO
170beacffb3SKyle Evans.Xr menu.lua 8
171beacffb3SKyle Evans.Sh AUTHORS
172beacffb3SKyle EvansThe
173beacffb3SKyle Evans.Nm
174beacffb3SKyle Evansfile was originally written by
175beacffb3SKyle Evans.An Pedro Souza Aq Mt pedrosouza@FreeBSD.org .
176beacffb3SKyle EvansLater work and this manual page was done by
177beacffb3SKyle Evans.An Kyle Evans Aq Mt kevans@FreeBSD.org .
178