]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/demo_menus.c
ncurses 5.9 - patch 20120908
[ncurses.git] / test / demo_menus.c
index 90caf821b712754edbc32204d92fec878d361d5c..9edab95cccf8801b0e69ad6183b639f743e0a791 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 2005-2008,2009 Free Software Foundation, Inc.              *
+ * Copyright (c) 2005-2011,2012 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -26,7 +26,7 @@
  * authorization.                                                           *
  ****************************************************************************/
 /*
- * $Id: demo_menus.c,v 1.29 2009/10/24 21:19:27 tom Exp $
+ * $Id: demo_menus.c,v 1.35 2012/09/09 00:01:20 tom Exp $
  *
  * Demonstrate a variety of functions from the menu library.
  * Thomas Dickey - 2005/4/9
@@ -202,7 +202,7 @@ menu_offset(MenuNo number)
 #endif
 
        /* FIXME: MENU.itemlen seems the only way to get actual width of items */
-       result = (number - (eBanner + 1)) * (mpBanner->itemlen + spc_rows);
+       result = (number - (eBanner + 1)) * (menu_itemwidth(mpBanner) + spc_rows);
     }
     return result;
 }
@@ -225,8 +225,8 @@ menu_create(ITEM ** items, int count, int ncols, MenuNo number)
     result = new_menu(items);
 
     if (has_colors()) {
-       set_menu_fore(result, COLOR_PAIR(1));
-       set_menu_back(result, COLOR_PAIR(2));
+       set_menu_fore(result, (chtype) COLOR_PAIR(1));
+       set_menu_back(result, (chtype) COLOR_PAIR(2));
     }
 
     set_menu_format(result, maxrow, maxcol);
@@ -546,8 +546,8 @@ perform_trace_menu(int cmd)
            trace(newtrace);
            Trace(("trace level interactively set to %s", tracetrace(_nc_tracing)));
 
-           (void) mvprintw(LINES - 2, 0,
-                           "Trace level is %s\n", tracetrace(_nc_tracing));
+           MvPrintw(LINES - 2, 0,
+                    "Trace level is %s\n", tracetrace(_nc_tracing));
            refresh();
        }
     }
@@ -831,7 +831,7 @@ usage(void)
 {
     static const char *const tbl[] =
     {
-       "Usage: demo_menus [options]"
+       "Usage: demo_menus [options] [menu-file]"
        ,""
        ,"Options:"
 #if HAVE_RIPOFFLINE
@@ -867,7 +867,7 @@ main(int argc, char *argv[])
 #endif /* HAVE_RIPOFFLINE */
 #ifdef TRACE
        case 't':
-           trace(strtoul(optarg, 0, 0));
+           trace((unsigned) strtoul(optarg, 0, 0));
            break;
 #endif
        default: