dialog.subr (293617) | dialog.subr (298884) |
---|---|
1if [ ! "$_DIALOG_SUBR" ]; then _DIALOG_SUBR=1 2# 3# Copyright (c) 2006-2015 Devin Teske 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# | 1if [ ! "$_DIALOG_SUBR" ]; then _DIALOG_SUBR=1 2# 3# Copyright (c) 2006-2015 Devin Teske 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 10 unchanged lines hidden (view full) --- 19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25# SUCH DAMAGE. 26# |
27# $FreeBSD: head/usr.sbin/bsdconfig/share/dialog.subr 293617 2016-01-09 23:13:43Z dteske $ | 27# $FreeBSD: head/usr.sbin/bsdconfig/share/dialog.subr 298884 2016-05-01 16:38:12Z pfg $ |
28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." dialog.subr 34f_include $BSDCFG_SHARE/strings.subr 35f_include $BSDCFG_SHARE/variable.subr --- 64 unchanged lines hidden (view full) --- 100# default(s) for all widgets of a given variant) 101# 102: ${DIALOG_MIN_WIDTH:=24} 103: ${XDIALOG_MIN_WIDTH:=35} 104 105# 106# When manually sizing Xdialog(1) widgets such as calendar and timebox, you'll 107# need to know the size of the embedded GUI objects because the height passed | 28# 29############################################################ INCLUDES 30 31BSDCFG_SHARE="/usr/share/bsdconfig" 32. $BSDCFG_SHARE/common.subr || exit 1 33f_dprintf "%s: loading includes..." dialog.subr 34f_include $BSDCFG_SHARE/strings.subr 35f_include $BSDCFG_SHARE/variable.subr --- 64 unchanged lines hidden (view full) --- 100# default(s) for all widgets of a given variant) 101# 102: ${DIALOG_MIN_WIDTH:=24} 103: ${XDIALOG_MIN_WIDTH:=35} 104 105# 106# When manually sizing Xdialog(1) widgets such as calendar and timebox, you'll 107# need to know the size of the embedded GUI objects because the height passed |
108# to Xdialog(1) for these widgets has to be tall enough to accomodate them. | 108# to Xdialog(1) for these widgets has to be tall enough to accommodate them. |
109# 110# These values are helpful when manually sizing with dialog(1) too, but in a | 109# 110# These values are helpful when manually sizing with dialog(1) too, but in a |
111# different way. dialog(1) does not make you accomodate the custom items in the | 111# different way. dialog(1) does not make you accommodate the custom items in the |
112# height (but does for width) -- a height of 3 will display three lines and a 113# full calendar, for example (whereas Xdialog will truncate the calendar if 114# given a height of 3). For dialog(1), use these values for making sure that 115# the height does not exceed max_height (obtained by f_dialog_max_size()). 116# 117DIALOG_CALENDAR_HEIGHT=15 118DIALOG_TIMEBOX_HEIGHT=6 119 --- 578 unchanged lines hidden (view full) --- 698 local __height_bbox_size __width_bbox_size 699 f_dialog_infobox_size -n \ 700 "${__var_height:+__height_bbox_size}" \ 701 "${__var_width:+__width_bbox_size}" \ 702 "$__title" "$__btitle" "$__prompt" "$__hline" 703 704 # Adjust height if desired 705 if [ "$__var_height" ]; then | 112# height (but does for width) -- a height of 3 will display three lines and a 113# full calendar, for example (whereas Xdialog will truncate the calendar if 114# given a height of 3). For dialog(1), use these values for making sure that 115# the height does not exceed max_height (obtained by f_dialog_max_size()). 116# 117DIALOG_CALENDAR_HEIGHT=15 118DIALOG_TIMEBOX_HEIGHT=6 119 --- 578 unchanged lines hidden (view full) --- 698 local __height_bbox_size __width_bbox_size 699 f_dialog_infobox_size -n \ 700 "${__var_height:+__height_bbox_size}" \ 701 "${__var_width:+__width_bbox_size}" \ 702 "$__title" "$__btitle" "$__prompt" "$__hline" 703 704 # Adjust height if desired 705 if [ "$__var_height" ]; then |
706 # Add height to accomodate the buttons | 706 # Add height to accommodate the buttons |
707 __height_bbox_size=$(( $__height_bbox_size + 2 )) 708 709 # Adjust for clipping with Xdialog(1) on Linux/GTK2 710 [ "$USE_XDIALOG" ] && 711 __height_bbox_size=$(( $__height_bbox_size + 3 )) 712 713 setvar "$__var_height" $__height_bbox_size 714 fi --- 662 unchanged lines hidden (view full) --- 1377 fi 1378 1379 # Calculate height if desired 1380 if [ "$__var_height" ]; then 1381 local __height 1382 __height=$( echo "$__prompt" | f_number_of_lines ) 1383 1384 if [ "$USE_XDIALOG" ]; then | 707 __height_bbox_size=$(( $__height_bbox_size + 2 )) 708 709 # Adjust for clipping with Xdialog(1) on Linux/GTK2 710 [ "$USE_XDIALOG" ] && 711 __height_bbox_size=$(( $__height_bbox_size + 3 )) 712 713 setvar "$__var_height" $__height_bbox_size 714 fi --- 662 unchanged lines hidden (view full) --- 1377 fi 1378 1379 # Calculate height if desired 1380 if [ "$__var_height" ]; then 1381 local __height 1382 __height=$( echo "$__prompt" | f_number_of_lines ) 1383 1384 if [ "$USE_XDIALOG" ]; then |
1385 # Add height to accomodate for embedded calendar widget | 1385 # Add height to accommodate for embedded calendar widget |
1386 __height=$(( $__height + $DIALOG_CALENDAR_HEIGHT - 1 )) 1387 1388 # Also, bump height if backtitle is enabled 1389 if [ "$__btitle" ]; then 1390 local __n 1391 __n=$( echo "$__btitle" | f_number_of_lines ) 1392 __height=$(( $__height + $__n + 2 )) 1393 fi --- 947 unchanged lines hidden --- | 1386 __height=$(( $__height + $DIALOG_CALENDAR_HEIGHT - 1 )) 1387 1388 # Also, bump height if backtitle is enabled 1389 if [ "$__btitle" ]; then 1390 local __n 1391 __n=$( echo "$__btitle" | f_number_of_lines ) 1392 __height=$(( $__height + $__n + 2 )) 1393 fi --- 947 unchanged lines hidden --- |