Add an option to supress the vertical space between menu title and
menu items.
This commit is contained in:
parent
be7b2c4eb4
commit
a7fc6d1692
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mdb.c,v 1.50 2019/02/06 20:08:15 martin Exp $ */
|
||||
/* $NetBSD: mdb.c,v 1.51 2019/02/25 20:47:37 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
#include <sys/cdefs.h>
|
||||
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: mdb.c,v 1.50 2019/02/06 20:08:15 martin Exp $");
|
||||
__RCSID("$NetBSD: mdb.c,v 1.51 2019/02/25 20:47:37 martin Exp $");
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -225,6 +225,7 @@ write_menu_file(char *initcode)
|
|||
MC_OPT(MC_DFLTEXIT)
|
||||
MC_OPT(MC_ALWAYS_SCROLL)
|
||||
MC_OPT(MC_SUBMENU)
|
||||
MC_OPT(MC_CONTINUOUS)
|
||||
MC_OPT(MC_VALID)
|
||||
#undef MC_OPT
|
||||
#undef STR
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mdb.h,v 1.10 2018/11/21 20:04:48 martin Exp $ */
|
||||
/* $NetBSD: mdb.h,v 1.11 2019/02/25 20:47:37 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -95,5 +95,6 @@ struct menu_info {
|
|||
#define MC_DFLTEXIT 32
|
||||
#define MC_ALWAYS_SCROLL 64
|
||||
#define MC_SUBMENU 128
|
||||
#define MC_CONTINUOUS 256
|
||||
#define MC_VALID 0x10000
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: menu_sys.def,v 1.66 2019/02/16 18:57:21 martin Exp $ */
|
||||
/* $NetBSD: menu_sys.def,v 1.67 2019/02/25 20:47:37 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -141,7 +141,8 @@ init_menu(menudesc *m)
|
|||
y = m->y;
|
||||
w = m->w;
|
||||
wmax = 0;
|
||||
hadd = ((m->mopt & MC_NOBOX) ? 0 : 2);
|
||||
hadd = ((m->mopt & MC_NOBOX) ? 0 :
|
||||
((m->mopt & MC_CONTINUOUS) ? 1 : 2));
|
||||
wadd = ((m->mopt & MC_NOBOX) ? 2 : 4);
|
||||
if (!(m->mopt & MC_NOSHORTCUT))
|
||||
wadd += 3;
|
||||
|
@ -358,7 +359,8 @@ draw_menu(menudesc *m, void *arg)
|
|||
if (ep == NULL || *ep == 0)
|
||||
break;
|
||||
}
|
||||
tadd++;
|
||||
if ((m->mopt & MC_CONTINUOUS) == 0)
|
||||
tadd++;
|
||||
}
|
||||
|
||||
cury = tadd;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $NetBSD: menuc.1,v 1.36 2019/02/16 19:09:07 martin Exp $
|
||||
.\" $NetBSD: menuc.1,v 1.37 2019/02/25 20:47:37 martin Exp $
|
||||
.\"
|
||||
.\" Copyright 1997 Piermont Information Systems Inc.
|
||||
.\" All rights reserved.
|
||||
|
@ -29,7 +29,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
.\" THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd February 16, 2019
|
||||
.Dd February 25, 2019
|
||||
.Dt MENUC 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -233,6 +233,9 @@ menu window is created.
|
|||
.It Ic sub menu
|
||||
If specified, the screen contents that the menu window overwrites are saved
|
||||
and restored when the menu exits.
|
||||
.It Ic continuous title
|
||||
If specified there is no vertical space between the title and the menu
|
||||
content.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
|
@ -458,6 +461,7 @@ struct menudesc {
|
|||
#define MC_DFLTEXIT 32
|
||||
#define MC_ALWAYS_SCROLL 64
|
||||
#define MC_SUBMENU 128
|
||||
#define MC_CONTINUOUS 256
|
||||
|
||||
int new_menu(const char *title, menu_ent *opts, int numopts,
|
||||
int x, int y, int h, int w, int mopt,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: parse.y,v 1.17 2018/11/21 20:04:48 martin Exp $ */
|
||||
/* $NetBSD: parse.y,v 1.18 2019/02/25 20:47:37 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -54,6 +54,7 @@ static optn_info *cur_optn;
|
|||
%token <i_value> X Y W H NO BOX SUB HELP MENU NEXT EXIT ACTION ENDWIN OPTION
|
||||
%token <i_value> TITLE DEFAULT DISPLAY ERROR EXITSTRING EXPAND ALLOW DYNAMIC
|
||||
MENUS SCROLLABLE SHORTCUT CLEAR MESSAGES ALWAYS SCROLL
|
||||
CONTINUOUS
|
||||
%token <s_value> STRING NAME CODE INT_CONST CHAR_CONST
|
||||
|
||||
%type <s_value> init_code system helpstr text
|
||||
|
@ -150,6 +151,7 @@ opt : NO EXIT { cur_menu->info->mopt |= MC_NOEXITOPT; }
|
|||
| ALWAYS SCROLL { cur_menu->info->mopt |= MC_ALWAYS_SCROLL; }
|
||||
| NO SUB MENU { cur_menu->info->mopt &= ~MC_SUBMENU; }
|
||||
| SUB MENU { cur_menu->info->mopt |= MC_SUBMENU; }
|
||||
| CONTINUOUS TITLE { cur_menu->info->mopt |= MC_CONTINUOUS; }
|
||||
| X "=" INT_CONST { cur_menu->info->x = atoi($3); }
|
||||
| Y "=" INT_CONST { cur_menu->info->y = atoi($3); }
|
||||
| W "=" INT_CONST { cur_menu->info->w = atoi($3); }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: scan.l,v 1.17 2018/11/21 20:04:48 martin Exp $ */
|
||||
/* $NetBSD: scan.l,v 1.18 2019/02/25 20:47:37 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -70,6 +70,8 @@ no { return NO; }
|
|||
|
||||
box { return BOX; }
|
||||
|
||||
continuous { return CONTINUOUS; }
|
||||
|
||||
sub { return SUB; }
|
||||
|
||||
help { return HELP; }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: menus.mc,v 1.11 2004/09/17 18:16:31 wrstuden Exp $ */
|
||||
/* $NetBSD: menus.mc,v 1.12 2019/02/25 20:47:37 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1997 Piermont Information Systems Inc.
|
||||
|
@ -83,6 +83,9 @@ menu root, title " Main Menu of Test System", x=10;
|
|||
option "A dynamic menu ...",
|
||||
action { do_dynamic (); }
|
||||
;
|
||||
option "Continuous title and menu ...",
|
||||
sub menu contdemo
|
||||
;
|
||||
option "Run a shell...",
|
||||
action (endwin) { system ("/bin/sh"); }
|
||||
;
|
||||
|
@ -275,3 +278,16 @@ menu scrollit2, scrollable, title " Big scrollable Menu";
|
|||
option "option 49", action {};
|
||||
option "option 50", action {};
|
||||
option "option 51", action {};
|
||||
|
||||
menu contdemo, title "Menus without space between title and menu", y=3, x=10;
|
||||
option "With box", sub menu contdemo_box;
|
||||
option "No box", sub menu contdemo_none;
|
||||
|
||||
menu contdemo_box, title "title text ends here-->", y=3, x=10, no exit,
|
||||
continuous title;
|
||||
option "<--- first menu item here", exit;
|
||||
|
||||
menu contdemo_none, title "title text ends here-->", y=3, x=10, no box, no exit,
|
||||
continuous title;
|
||||
option "<--- first menu item here", exit;
|
||||
|
||||
|
|
Loading…
Reference in New Issue