From 9f24fda5a8e7ab8243e71473c7e2dc98b4877e64 Mon Sep 17 00:00:00 2001 From: "Alfonso S. Siciliano" Date: Sun, 25 Sep 2022 15:04:33 +0200 Subject: contrib/bsddialog: Import version 0.4 Improvements and changes to integrate bsddialog(1) with scripts in BASE. Overview: * New options. --and-widget, --keep-tite, --calendar. * Change output format. Menus and --print-maxsize. * Redefine sizing. Fixed rows, cols and menurows became at the most. * Add DIAGNOSTICS. Error messages for bad arguments and options. * Add keys. Space for --menu, fast keys for --msgbox and --yesno. * Text. Change default text modification, add --cr-wrap. See /usr/src/contrib/bsddialog/CHANGELOG '2022-09-24 Version 0.4' for more detailed information. --- .gitignore | 27 +- CHANGELOG | 70 ++- GNUMakefile | 4 +- Makefile | 4 +- README.md | 26 +- bsddialog.1 | 170 ++++-- bsddialog.c | 1353 ++++++++++++++++++++++++------------------ examples_library/calendar.c | 55 ++ examples_library/compile | 2 +- examples_library/form.c | 4 +- examples_utility/calendar.sh | 34 ++ examples_utility/timebox.sh | 3 +- lib/GNUMakefile | 10 +- lib/Makefile | 6 +- lib/barbox.c | 2 +- lib/bsddialog.3 | 33 +- lib/bsddialog.h | 10 +- lib/calendarbox.c | 520 ++++++++++++++++ lib/formbox.c | 29 +- lib/lib_util.c | 14 +- lib/lib_util.h | 3 + lib/libbsddialog.c | 4 +- lib/menubox.c | 50 +- lib/messagebox.c | 42 +- lib/theme.c | 1 - lib/timebox.c | 20 +- util_theme.c | 79 ++- util_theme.h | 7 +- 28 files changed, 1735 insertions(+), 847 deletions(-) create mode 100644 examples_library/calendar.c create mode 100644 examples_utility/calendar.sh create mode 100644 lib/calendarbox.c diff --git a/.gitignore b/.gitignore index 10a6663fbb47..8b8ec9d4ae0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,24 @@ bsddialog +.depend* *.o -*~ +*.so* *.a -examples_library/buildlist +*.gz +*.core +*~ +BSDDIALOG.geany +BSDDIALOG.tags +examples_library/calendar examples_library/checklist examples_library/datebox examples_library/form -examples_library/formw -examples_library/margin +examples_library/infobox examples_library/menu examples_library/mixedlist -examples_library/radiolist -examples_library/theme -examples_library/treeview -examples_library/infobox examples_library/msgbox examples_library/pause +examples_library/radiolist examples_library/rangebox -examples_library/sade +examples_library/theme examples_library/timebox examples_library/yesno -examples_library/u_msgbox -*.gz -lib/libbsddialog.so* -BSDDIALOG.geany -BSDDIALOG.tags -*.core -freebsd-lab/ diff --git a/CHANGELOG b/CHANGELOG index d6de6928c111..883fe1016d01 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,17 +1,68 @@ +2022-09-24 Version 0.4 + + Utility: + * add: --normal-screen to set normal mode. + * add: --alternate-screen to set alternate mode. + * add: --keep-tite as --alternate-screen alias. + * add: --and-dialog to build other dialogs. + * add: --and-widget as --and-dialog alias. + * add: --no-names (--no-tags becames its alias). + * add: --no-descriptions (--no-items becames its alias). + * add: --help-print-name (--help-tags becames its alias). + * add: --item-bottom-desc (--item-help becames its alias). + * add: --cr-wrap (was partially implemented) to keep '\n' with "\n". + * add: --text-unchanged to avoid default modification. + * add: --tab-escape enables "\t" in text. + * add: --clear-screen to clear the screen. + * add: --clear-dialog to clear the dialog (was --clear). + * add: --calendar dialog to select a date. + * add: DIAGNOSTICS messages for bad arguments number. + * add: DIAGNOSTICS messages for missing and unexpected options. + * change: --clear becames alias for --clear-screen. + * change: --print-maxsize format output. + * change: --menu, --radiolist, --checklist and --treeview output. + - no printed items with Cancel or ESC. + - --separator prints before each item except HELP. + - --separator and --separate-output print after each item. + - quoted item name/desc only when needed. + - --menu avoids to print selected item after focused HELP item. + * change: text default modification. + - without a "\n": '\t' -> space, '\n' -> '\n', trim spaces. + - with a "\n": '\t' -> space, '\n' -> space, "\n" -> '\n', no trim. + - delete '\n' after "\n" (also with --cr-wrap). + * change: --datebox input and output format yy/mm/dd -> dd/mm/yy. + * delete: --no-collapse (partially implemented). + * delete: --no-nl-expand (partially implemented). + * delete: --trim (partially implemented). + + Library: + * add: bsddialog_msgbox() HOME, END, PPAGE and NPAGE keys. + * add: bsddialog_yesno() HOME, END, PPAGE and NPAGE keys. + * add: bsddialog_menu() SPACE key (equivalent to ENTER). + * add: bsddialog_calendar() to select a date. + * change: rename enum bsddialog_grouptype -> enum bsddialog_menutype. + * change: fixed-menurows becames at most menurows (depending on text). + * change: fixed-rows becames at most rows, min(rows, screenH - shadow). + * change: fixed-cols becames at most cols, min(cols, screenW - shadow). + * delete: undocumented internal bsddialog_menuitem.depth factor (was 2). + + 2022-08-29 Version 0.3 Utility: * add: --textbox accepts options for the first button. - * add: --columns-per-row option for text autosizing. - * add: --load-theme option to read and set a custom theme at runtime. - * add: --save-theme option to save current theme. - * add: --bikeshed option for random settings. + * add: --columns-per-row for text autosizing. + * add: --load-theme to read and set a custom theme at runtime. + * add: --save-theme to save current theme. + * add: --bikeshed for random settings. * add: --switch-buttons enables focus switching: buttons / input components. Available for: --form, --inputbox, --mixedform, --passwordform, --passwordbox, --timebox and --datebox. * change: rename --esc-cancelvalue to --esc-return-cancel. * change: form field value is printed like multibyte charachter string, previously widechar string. + * change: --timebox output with zero padding. + * change: --datebox output mm and dd with zero padding. * fix: --hline with empty string. * fix: avoid to overlay the backtitle by setting a top margin. * fix: avoid to overlay down shadow with menus and forms bottomdesc @@ -25,8 +76,8 @@ * add: conf.text.cols_per_row to set a ratio for text autosizing. * add: timebox and datebox arrows and focus background for boxes. * add: timebox and datebox UP key to switch focus. - * add: bsddialog_init_notheme() in bsddialo_theme.h. - * add: bsddialog_hascolors() in bsddialo_theme.h. + * add: bsddialog_init_notheme() in bsddialog.h. + * add: bsddialog_hascolors() in bsddialog_theme.h. * add: theme.form.bottomdesccolor and theme.menu.bottomdesccolor. * add: conf.button.always_active to disable buttons/input-boxes switch. * add: dynamic buttons margin. @@ -60,8 +111,8 @@ - add: formheight autosizing. - add: dynamic item position. * fix: bsddialog_gauge() with fd < 0. - * fix: internal segmentation fault with disabled shadow. * fix: bsddialog_gauge() refresh new text. + * fix: internal segmentation fault with disabled shadow. * fix: center position without shadow. * fix: bsddialog_infobox() with zero text length. * fix: text wrapping with more than 1024 words. @@ -92,7 +143,7 @@ * change: theme.button.[left|right]ch -> theme.button.[left|right]delim. * change: theme.button.space -> theme.button.hmargin. * change: theme.menu.arrowcolor -> theme.dialog.arrowcolor. - * change: default menu item depth 4 -> 2. + * change: internal bsddialog_menuitem.depth factor 4 -> 2. * fix: disable HOME, PPAGE, END and NPAGE keys in bsddialog_form(). * fix: visible cursor for timebox.c and form.c in VM VirtualBox. * fix: mixedlist, center position of separator with big pad. @@ -106,7 +157,7 @@ 2022-01-27 Version 0.1 - * Common-Options: --ascii-lines, --backtitle , --begin-x , + * Options: --ascii-lines, --backtitle , --begin-x , --begin-y , --cancel-label