Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/menuc Add an option to supress the vertical space be...



details:   https://anonhg.NetBSD.org/src/rev/c72c673b6341
branches:  trunk
changeset: 997184:c72c673b6341
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Feb 25 20:47:37 2019 +0000

description:
Add an option to supress the vertical space between menu title and
menu items.

diffstat:

 usr.bin/menuc/mdb.c          |   5 +++--
 usr.bin/menuc/mdb.h          |   3 ++-
 usr.bin/menuc/menu_sys.def   |   8 +++++---
 usr.bin/menuc/menuc.1        |   8 ++++++--
 usr.bin/menuc/parse.y        |   4 +++-
 usr.bin/menuc/scan.l         |   4 +++-
 usr.bin/menuc/testm/menus.mc |  18 +++++++++++++++++-
 7 files changed, 39 insertions(+), 11 deletions(-)

diffs (186 lines):

diff -r 776c101d1b88 -r c72c673b6341 usr.bin/menuc/mdb.c
--- a/usr.bin/menuc/mdb.c       Mon Feb 25 19:55:35 2019 +0000
+++ b/usr.bin/menuc/mdb.c       Mon Feb 25 20:47:37 2019 +0000
@@ -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 @@
                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
diff -r 776c101d1b88 -r c72c673b6341 usr.bin/menuc/mdb.h
--- a/usr.bin/menuc/mdb.h       Mon Feb 25 19:55:35 2019 +0000
+++ b/usr.bin/menuc/mdb.h       Mon Feb 25 20:47:37 2019 +0000
@@ -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 @@
 #define MC_DFLTEXIT 32
 #define MC_ALWAYS_SCROLL 64
 #define MC_SUBMENU 128
+#define        MC_CONTINUOUS 256
 #define MC_VALID 0x10000
 #endif
diff -r 776c101d1b88 -r c72c673b6341 usr.bin/menuc/menu_sys.def
--- a/usr.bin/menuc/menu_sys.def        Mon Feb 25 19:55:35 2019 +0000
+++ b/usr.bin/menuc/menu_sys.def        Mon Feb 25 20:47:37 2019 +0000
@@ -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 @@
        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 @@
                        if (ep == NULL || *ep == 0)
                                break;
                }
-               tadd++;
+               if ((m->mopt & MC_CONTINUOUS) == 0)
+                       tadd++;
        }
 
        cury = tadd;
diff -r 776c101d1b88 -r c72c673b6341 usr.bin/menuc/menuc.1
--- a/usr.bin/menuc/menuc.1     Mon Feb 25 19:55:35 2019 +0000
+++ b/usr.bin/menuc/menuc.1     Mon Feb 25 20:47:37 2019 +0000
@@ -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 @@
 .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 @@
 #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,
diff -r 776c101d1b88 -r c72c673b6341 usr.bin/menuc/parse.y
--- a/usr.bin/menuc/parse.y     Mon Feb 25 19:55:35 2019 +0000
+++ b/usr.bin/menuc/parse.y     Mon Feb 25 20:47:37 2019 +0000
@@ -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 @@
 %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 @@
          | 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); }
diff -r 776c101d1b88 -r c72c673b6341 usr.bin/menuc/scan.l
--- a/usr.bin/menuc/scan.l      Mon Feb 25 19:55:35 2019 +0000
+++ b/usr.bin/menuc/scan.l      Mon Feb 25 20:47:37 2019 +0000
@@ -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 @@
 
 box    { return BOX; }
 
+continuous { return CONTINUOUS; }
+
 sub    { return SUB; }
 
 help   { return HELP; }
diff -r 776c101d1b88 -r c72c673b6341 usr.bin/menuc/testm/menus.mc
--- a/usr.bin/menuc/testm/menus.mc      Mon Feb 25 19:55:35 2019 +0000
+++ b/usr.bin/menuc/testm/menus.mc      Mon Feb 25 20:47:37 2019 +0000
@@ -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 @@
        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 @@
        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;
+



Home | Main Index | Thread Index | Old Index