aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/menu
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ncurses/menu')
-rw-r--r--contrib/ncurses/menu/Makefile.in21
-rw-r--r--contrib/ncurses/menu/READ.ME32
-rw-r--r--contrib/ncurses/menu/eti.h6
-rw-r--r--contrib/ncurses/menu/llib-lmenu55
-rw-r--r--contrib/ncurses/menu/llib-lmenuw547
-rw-r--r--contrib/ncurses/menu/m_attribs.c26
-rw-r--r--contrib/ncurses/menu/m_cursor.c39
-rw-r--r--contrib/ncurses/menu/m_driver.c668
-rw-r--r--contrib/ncurses/menu/m_format.c70
-rw-r--r--contrib/ncurses/menu/m_global.c427
-rw-r--r--contrib/ncurses/menu/m_hook.c26
-rw-r--r--contrib/ncurses/menu/m_item_cur.c32
-rw-r--r--contrib/ncurses/menu/m_item_nam.c18
-rw-r--r--contrib/ncurses/menu/m_item_new.c131
-rw-r--r--contrib/ncurses/menu/m_item_opt.c59
-rw-r--r--contrib/ncurses/menu/m_item_top.c43
-rw-r--r--contrib/ncurses/menu/m_item_use.c16
-rw-r--r--contrib/ncurses/menu/m_item_val.c28
-rw-r--r--contrib/ncurses/menu/m_item_vis.c25
-rw-r--r--contrib/ncurses/menu/m_items.c36
-rw-r--r--contrib/ncurses/menu/m_new.c36
-rw-r--r--contrib/ncurses/menu/m_opts.c51
-rw-r--r--contrib/ncurses/menu/m_pad.c27
-rw-r--r--contrib/ncurses/menu/m_pattern.c57
-rw-r--r--contrib/ncurses/menu/m_post.c271
-rw-r--r--contrib/ncurses/menu/m_req_name.c76
-rw-r--r--contrib/ncurses/menu/m_scale.c19
-rw-r--r--contrib/ncurses/menu/m_spacing.c41
-rw-r--r--contrib/ncurses/menu/m_sub.c22
-rw-r--r--contrib/ncurses/menu/m_trace.c77
-rw-r--r--contrib/ncurses/menu/m_userptr.c16
-rw-r--r--contrib/ncurses/menu/m_win.c22
-rw-r--r--contrib/ncurses/menu/menu.h8
-rw-r--r--contrib/ncurses/menu/menu.priv.h40
-rw-r--r--contrib/ncurses/menu/mf_common.h30
-rw-r--r--contrib/ncurses/menu/modules5
36 files changed, 2039 insertions, 1064 deletions
diff --git a/contrib/ncurses/menu/Makefile.in b/contrib/ncurses/menu/Makefile.in
index b5c7b68cbd46..8c3aa6268cbf 100644
--- a/contrib/ncurses/menu/Makefile.in
+++ b/contrib/ncurses/menu/Makefile.in
@@ -1,6 +1,6 @@
-# $Id: Makefile.in,v 1.36 2002/01/20 01:49:17 tom Exp $
+# $Id: Makefile.in,v 1.43 2006/10/14 20:40:36 tom Exp $
##############################################################################
-# Copyright (c) 1998,1999,2000,2001,2002 Free Software Foundation, Inc. #
+# Copyright (c) 1998-2004,2006 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 "Software"), #
@@ -45,6 +45,9 @@
SHELL = /bin/sh
THIS = Makefile
+x = @EXEEXT@
+o = .@OBJEXT@
+
MODEL = @DFT_LWR_MODEL@
DESTDIR = @DESTDIR@
srcdir = @srcdir@
@@ -55,10 +58,15 @@ libdir = @libdir@
includedir = @includedir@
LIBTOOL = @LIBTOOL@
+LIBTOOL_CLEAN = @LIB_CLEAN@
+LIBTOOL_COMPILE = @LIB_COMPILE@
+LIBTOOL_LINK = @LIB_LINK@
+LIBTOOL_INSTALL = @LIB_INSTALL@
+LIBTOOL_UNINSTALL = @LIB_UNINSTALL@
INSTALL = @INSTALL@
INSTALL_LIB = @INSTALL@ @INSTALL_LIB@
-INSTALL_PROG = @INSTALL_PROG@
+INSTALL_PROG = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
AR = @AR@
@@ -71,8 +79,7 @@ CC = @CC@
CPP = @CPP@
CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@ \
- -DHAVE_CONFIG_H
+CPPFLAGS = -I@top_srcdir@/ncurses -DHAVE_CONFIG_H @CPPFLAGS@
CCFLAGS = $(CPPFLAGS) $(CFLAGS)
@@ -84,7 +91,7 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@
CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@)
-LINK = $(LIBTOOL) $(CC)
+LINK = $(LIBTOOL_LINK) $(CC)
LDFLAGS = @LDFLAGS@ @LD_MODEL@ @LIBS@
SHLIB_DIRS = -L../lib
@@ -97,7 +104,7 @@ NCURSES_MINOR = @NCURSES_MINOR@
REL_VERSION = @cf_cv_rel_version@
ABI_VERSION = @cf_cv_abi_version@
-RANLIB = @RANLIB@
+RANLIB = @LIB_PREP@
IMPORT_LIB = @IMPORT_LIB@
SHARED_LIB = @SHARED_LIB@
diff --git a/contrib/ncurses/menu/READ.ME b/contrib/ncurses/menu/READ.ME
index 3fd5627445e7..10ff5b0114fb 100644
--- a/contrib/ncurses/menu/READ.ME
+++ b/contrib/ncurses/menu/READ.ME
@@ -1,3 +1,33 @@
+-------------------------------------------------------------------------------
+-- Copyright (c) 1998-2003,2006 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 --
+-- "Software"), to deal in the Software without restriction, including --
+-- without limitation the rights to use, copy, modify, merge, publish, --
+-- distribute, distribute with modifications, sublicense, and/or sell copies --
+-- of the Software, and to permit persons to whom the Software is furnished --
+-- to do so, subject to the following conditions: --
+-- --
+-- The above copyright notice and this permission notice shall be included --
+-- in all copies or substantial portions of the Software. --
+-- --
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
+-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN --
+-- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
+-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
+-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE --
+-- USE OR OTHER DEALINGS IN THE SOFTWARE. --
+-- --
+-- Except as contained in this notice, the name(s) of the above copyright --
+-- holders shall not be used in advertising or otherwise to promote the --
+-- sale, use or other dealings in this Software without prior written --
+-- authorization. --
+-------------------------------------------------------------------------------
+-- $Id: READ.ME,v 1.9 2006/04/22 23:13:05 tom Exp $
+-------------------------------------------------------------------------------
+
This is a clone of the menu library that is available with typical
System V curses implementations (ETI).
@@ -10,5 +40,3 @@ For things that still need doing, see the TO-DO file in the top-level
directory.
Juergen Pfeifer
-
-eMail: juergen.pfeifer@gmx.net
diff --git a/contrib/ncurses/menu/eti.h b/contrib/ncurses/menu/eti.h
index 4561fa441df3..baa6190d8f84 100644
--- a/contrib/ncurses/menu/eti.h
+++ b/contrib/ncurses/menu/eti.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2002,2003 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 *
@@ -27,9 +27,11 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
+/* $Id: eti.h,v 1.8 2003/10/25 15:24:29 tom Exp $ */
+
#ifndef NCURSES_ETI_H_incl
#define NCURSES_ETI_H_incl 1
diff --git a/contrib/ncurses/menu/llib-lmenu b/contrib/ncurses/menu/llib-lmenu
index 3f421c1113b2..fc17cc364d42 100644
--- a/contrib/ncurses/menu/llib-lmenu
+++ b/contrib/ncurses/menu/llib-lmenu
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2002,2005 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey <dickey@clark.net> 1996,1997,1999 *
+ * Author: Thomas E. Dickey 1996-2002,2005 *
****************************************************************************/
/* LINTLIBRARY */
@@ -122,16 +122,21 @@ MENU _nc_Default_Menu;
ITEM _nc_Default_Item;
#undef _nc_Connect_Items
-bool _nc_Connect_Items(
+NCURSES_BOOL _nc_Connect_Items(
MENU *menu,
ITEM **items)
- { return(*(bool *)0); }
+ { return(*(NCURSES_BOOL *)0); }
#undef _nc_Disconnect_Items
void _nc_Disconnect_Items(
MENU *menu)
{ /* void */ }
+#undef _nc_Calculate_Text_Width
+int _nc_Calculate_Text_Width(
+ const TEXT *item)
+ { return(*(int *)0); }
+
#undef _nc_Calculate_Item_Length_and_Width
void _nc_Calculate_Item_Length_and_Width(
MENU *menu)
@@ -310,20 +315,20 @@ void *item_userptr(
#undef set_item_value
int set_item_value(
ITEM *item,
- bool value)
+ NCURSES_BOOL value)
{ return(*(int *)0); }
#undef item_value
-bool item_value(
+NCURSES_BOOL item_value(
const ITEM *item)
- { return(*(bool *)0); }
+ { return(*(NCURSES_BOOL *)0); }
/* ./m_item_vis.c */
#undef item_visible
-bool item_visible(
+NCURSES_BOOL item_visible(
const ITEM *item)
- { return(*(bool *)0); }
+ { return(*(NCURSES_BOOL *)0); }
/* ./m_items.c */
@@ -481,6 +486,38 @@ WINDOW *menu_sub(
const MENU *menu)
{ return(*(WINDOW **)0); }
+/* ./m_trace.c */
+
+#undef _nc_retrace_item
+ITEM *_nc_retrace_item(
+ ITEM *code)
+ { return(*(ITEM **)0); }
+
+#undef _nc_retrace_item_ptr
+ITEM **_nc_retrace_item_ptr(
+ ITEM **code)
+ { return(*(ITEM ***)0); }
+
+#undef _nc_retrace_item_opts
+Item_Options _nc_retrace_item_opts(
+ Item_Options code)
+ { return(*(Item_Options *)0); }
+
+#undef _nc_retrace_menu
+MENU *_nc_retrace_menu(
+ MENU *code)
+ { return(*(MENU **)0); }
+
+#undef _nc_retrace_menu_hook
+Menu_Hook _nc_retrace_menu_hook(
+ Menu_Hook code)
+ { return(*(Menu_Hook *)0); }
+
+#undef _nc_retrace_menu_opts
+Menu_Options _nc_retrace_menu_opts(
+ Menu_Options code)
+ { return(*(Menu_Options *)0); }
+
/* ./m_userptr.c */
#undef set_menu_userptr
diff --git a/contrib/ncurses/menu/llib-lmenuw b/contrib/ncurses/menu/llib-lmenuw
new file mode 100644
index 000000000000..d21fb9488499
--- /dev/null
+++ b/contrib/ncurses/menu/llib-lmenuw
@@ -0,0 +1,547 @@
+/****************************************************************************
+ * Copyright (c) 2002,2005 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Thomas E. Dickey 2002,2005 *
+ ****************************************************************************/
+/* LINTLIBRARY */
+
+/* ./m_attribs.c */
+
+#include "menu.priv.h"
+
+#undef set_menu_fore
+int set_menu_fore(
+ MENU *menu,
+ chtype attr)
+ { return(*(int *)0); }
+
+#undef menu_fore
+chtype menu_fore(
+ const MENU *menu)
+ { return(*(chtype *)0); }
+
+#undef set_menu_back
+int set_menu_back(
+ MENU *menu,
+ chtype attr)
+ { return(*(int *)0); }
+
+#undef menu_back
+chtype menu_back(
+ const MENU *menu)
+ { return(*(chtype *)0); }
+
+#undef set_menu_grey
+int set_menu_grey(
+ MENU *menu,
+ chtype attr)
+ { return(*(int *)0); }
+
+#undef menu_grey
+chtype menu_grey(
+ const MENU *menu)
+ { return(*(chtype *)0); }
+
+/* ./m_cursor.c */
+
+#undef _nc_menu_cursor_pos
+int _nc_menu_cursor_pos(
+ const MENU *menu,
+ const ITEM *item,
+ int *pY,
+ int *pX)
+ { return(*(int *)0); }
+
+#undef pos_menu_cursor
+int pos_menu_cursor(
+ const MENU *menu)
+ { return(*(int *)0); }
+
+/* ./m_driver.c */
+
+#undef _nc_Match_Next_Character_In_Item_Name
+int _nc_Match_Next_Character_In_Item_Name(
+ MENU *menu,
+ int ch,
+ ITEM **item)
+ { return(*(int *)0); }
+
+#undef menu_driver
+int menu_driver(
+ MENU *menu,
+ int c)
+ { return(*(int *)0); }
+
+/* ./m_format.c */
+
+#undef set_menu_format
+int set_menu_format(
+ MENU *menu,
+ int rows,
+ int cols)
+ { return(*(int *)0); }
+
+#undef menu_format
+void menu_format(
+ const MENU *menu,
+ int *rows,
+ int *cols)
+ { /* void */ }
+
+/* ./m_global.c */
+
+#undef _nc_Default_Menu
+MENU _nc_Default_Menu;
+#undef _nc_Default_Item
+ITEM _nc_Default_Item;
+
+#undef _nc_Connect_Items
+NCURSES_BOOL _nc_Connect_Items(
+ MENU *menu,
+ ITEM **items)
+ { return(*(NCURSES_BOOL *)0); }
+
+#undef _nc_Disconnect_Items
+void _nc_Disconnect_Items(
+ MENU *menu)
+ { /* void */ }
+
+#undef _nc_Calculate_Text_Width
+int _nc_Calculate_Text_Width(
+ const TEXT *item)
+ { return(*(int *)0); }
+
+#undef _nc_Calculate_Item_Length_and_Width
+void _nc_Calculate_Item_Length_and_Width(
+ MENU *menu)
+ { /* void */ }
+
+#undef _nc_Link_Items
+void _nc_Link_Items(
+ MENU *menu)
+ { /* void */ }
+
+#undef _nc_Show_Menu
+void _nc_Show_Menu(
+ const MENU *menu)
+ { /* void */ }
+
+#undef _nc_New_TopRow_and_CurrentItem
+void _nc_New_TopRow_and_CurrentItem(
+ MENU *menu,
+ int new_toprow,
+ ITEM *new_current_item)
+ { /* void */ }
+
+/* ./m_hook.c */
+
+#undef set_menu_init
+int set_menu_init(
+ MENU *menu,
+ Menu_Hook func)
+ { return(*(int *)0); }
+
+#undef menu_init
+Menu_Hook menu_init(
+ const MENU *menu)
+ { return(*(Menu_Hook *)0); }
+
+#undef set_menu_term
+int set_menu_term(
+ MENU *menu,
+ Menu_Hook func)
+ { return(*(int *)0); }
+
+#undef menu_term
+Menu_Hook menu_term(
+ const MENU *menu)
+ { return(*(Menu_Hook *)0); }
+
+#undef set_item_init
+int set_item_init(
+ MENU *menu,
+ Menu_Hook func)
+ { return(*(int *)0); }
+
+#undef item_init
+Menu_Hook item_init(
+ const MENU *menu)
+ { return(*(Menu_Hook *)0); }
+
+#undef set_item_term
+int set_item_term(
+ MENU *menu,
+ Menu_Hook func)
+ { return(*(int *)0); }
+
+#undef item_term
+Menu_Hook item_term(
+ const MENU *menu)
+ { return(*(Menu_Hook *)0); }
+
+/* ./m_item_cur.c */
+
+#undef set_current_item
+int set_current_item(
+ MENU *menu,
+ ITEM *item)
+ { return(*(int *)0); }
+
+#undef current_item
+ITEM *current_item(
+ const MENU *menu)
+ { return(*(ITEM **)0); }
+
+#undef item_index
+int item_index(
+ const ITEM *item)
+ { return(*(int *)0); }
+
+/* ./m_item_nam.c */
+
+#undef item_name
+const char *item_name(
+ const ITEM *item)
+ { return(*(const char **)0); }
+
+#undef item_description
+const char *item_description(
+ const ITEM *item)
+ { return(*(const char **)0); }
+
+/* ./m_item_new.c */
+
+#include <wctype.h>
+
+#undef new_item
+ITEM *new_item(
+ const char *name,
+ const char *description)
+ { return(*(ITEM **)0); }
+
+#undef free_item
+int free_item(
+ ITEM *item)
+ { return(*(int *)0); }
+
+#undef set_menu_mark
+int set_menu_mark(
+ MENU *menu,
+ const char *mark)
+ { return(*(int *)0); }
+
+#undef menu_mark
+const char *menu_mark(
+ const MENU *menu)
+ { return(*(const char **)0); }
+
+/* ./m_item_opt.c */
+
+#undef set_item_opts
+int set_item_opts(
+ ITEM *item,
+ Item_Options opts)
+ { return(*(int *)0); }
+
+#undef item_opts_off
+int item_opts_off(
+ ITEM *item,
+ Item_Options opts)
+ { return(*(int *)0); }
+
+#undef item_opts_on
+int item_opts_on(
+ ITEM *item,
+ Item_Options opts)
+ { return(*(int *)0); }
+
+#undef item_opts
+Item_Options item_opts(
+ const ITEM *item)
+ { return(*(Item_Options *)0); }
+
+/* ./m_item_top.c */
+
+#undef set_top_row
+int set_top_row(
+ MENU *menu,
+ int row)
+ { return(*(int *)0); }
+
+#undef top_row
+int top_row(
+ const MENU *menu)
+ { return(*(int *)0); }
+
+/* ./m_item_use.c */
+
+#undef set_item_userptr
+int set_item_userptr(
+ ITEM *item,
+ void *userptr)
+ { return(*(int *)0); }
+
+#undef item_userptr
+void *item_userptr(
+ const ITEM *item)
+ { return(*(void **)0); }
+
+/* ./m_item_val.c */
+
+#undef set_item_value
+int set_item_value(
+ ITEM *item,
+ NCURSES_BOOL value)
+ { return(*(int *)0); }
+
+#undef item_value
+NCURSES_BOOL item_value(
+ const ITEM *item)
+ { return(*(NCURSES_BOOL *)0); }
+
+/* ./m_item_vis.c */
+
+#undef item_visible
+NCURSES_BOOL item_visible(
+ const ITEM *item)
+ { return(*(NCURSES_BOOL *)0); }
+
+/* ./m_items.c */
+
+#undef set_menu_items
+int set_menu_items(
+ MENU *menu,
+ ITEM **items)
+ { return(*(int *)0); }
+
+#undef menu_items
+ITEM **menu_items(
+ const MENU *menu)
+ { return(*(ITEM ***)0); }
+
+#undef item_count
+int item_count(
+ const MENU *menu)
+ { return(*(int *)0); }
+
+/* ./m_new.c */
+
+#undef new_menu
+MENU *new_menu(
+ ITEM **items)
+ { return(*(MENU **)0); }
+
+#undef free_menu
+int free_menu(
+ MENU *menu)
+ { return(*(int *)0); }
+
+/* ./m_opts.c */
+
+#undef set_menu_opts
+int set_menu_opts(
+ MENU *menu,
+ Menu_Options opts)
+ { return(*(int *)0); }
+
+#undef menu_opts_off
+int menu_opts_off(
+ MENU *menu,
+ Menu_Options opts)
+ { return(*(int *)0); }
+
+#undef menu_opts_on
+int menu_opts_on(
+ MENU *menu,
+ Menu_Options opts)
+ { return(*(int *)0); }
+
+#undef menu_opts
+Menu_Options menu_opts(
+ const MENU *menu)
+ { return(*(Menu_Options *)0); }
+
+/* ./m_pad.c */
+
+#undef set_menu_pad
+int set_menu_pad(
+ MENU *menu,
+ int pad)
+ { return(*(int *)0); }
+
+#undef menu_pad
+int menu_pad(
+ const MENU *menu)
+ { return(*(int *)0); }
+
+/* ./m_pattern.c */
+
+#undef menu_pattern
+char *menu_pattern(
+ const MENU *menu)
+ { return(*(char **)0); }
+
+#undef set_menu_pattern
+int set_menu_pattern(
+ MENU *menu,
+ const char *p)
+ { return(*(int *)0); }
+
+/* ./m_post.c */
+
+#undef _nc_Post_Item
+void _nc_Post_Item(
+ const MENU *menu,
+ const ITEM *item)
+ { /* void */ }
+
+#undef _nc_Draw_Menu
+void _nc_Draw_Menu(
+ const MENU *menu)
+ { /* void */ }
+
+#undef post_menu
+int post_menu(
+ MENU *menu)
+ { return(*(int *)0); }
+
+#undef unpost_menu
+int unpost_menu(
+ MENU *menu)
+ { return(*(int *)0); }
+
+/* ./m_req_name.c */
+
+#undef menu_request_name
+const char *menu_request_name(
+ int request)
+ { return(*(const char **)0); }
+
+#undef menu_request_by_name
+int menu_request_by_name(
+ const char *str)
+ { return(*(int *)0); }
+
+/* ./m_scale.c */
+
+#undef scale_menu
+int scale_menu(
+ const MENU *menu,
+ int *rows,
+ int *cols)
+ { return(*(int *)0); }
+
+/* ./m_spacing.c */
+
+#undef set_menu_spacing
+int set_menu_spacing(
+ MENU *menu,
+ int s_desc,
+ int s_row,
+ int s_col)
+ { return(*(int *)0); }
+
+#undef menu_spacing
+int menu_spacing(
+ const MENU *menu,
+ int *s_desc,
+ int *s_row,
+ int *s_col)
+ { return(*(int *)0); }
+
+/* ./m_sub.c */
+
+#undef set_menu_sub
+int set_menu_sub(
+ MENU *menu,
+ WINDOW *win)
+ { return(*(int *)0); }
+
+#undef menu_sub
+WINDOW *menu_sub(
+ const MENU *menu)
+ { return(*(WINDOW **)0); }
+
+/* ./m_trace.c */
+
+#undef _nc_retrace_item
+ITEM *_nc_retrace_item(
+ ITEM *code)
+ { return(*(ITEM **)0); }
+
+#undef _nc_retrace_item_ptr
+ITEM **_nc_retrace_item_ptr(
+ ITEM **code)
+ { return(*(ITEM ***)0); }
+
+#undef _nc_retrace_item_opts
+Item_Options _nc_retrace_item_opts(
+ Item_Options code)
+ { return(*(Item_Options *)0); }
+
+#undef _nc_retrace_menu
+MENU *_nc_retrace_menu(
+ MENU *code)
+ { return(*(MENU **)0); }
+
+#undef _nc_retrace_menu_hook
+Menu_Hook _nc_retrace_menu_hook(
+ Menu_Hook code)
+ { return(*(Menu_Hook *)0); }
+
+#undef _nc_retrace_menu_opts
+Menu_Options _nc_retrace_menu_opts(
+ Menu_Options code)
+ { return(*(Menu_Options *)0); }
+
+/* ./m_userptr.c */
+
+#undef set_menu_userptr
+int set_menu_userptr(
+ MENU *menu,
+ void *userptr)
+ { return(*(int *)0); }
+
+#undef menu_userptr
+void *menu_userptr(
+ const MENU *menu)
+ { return(*(void **)0); }
+
+/* ./m_win.c */
+
+#undef set_menu_win
+int set_menu_win(
+ MENU *menu,
+ WINDOW *win)
+ { return(*(int *)0); }
+
+#undef menu_win
+WINDOW *menu_win(
+ const MENU *menu)
+ { return(*(WINDOW **)0); }
diff --git a/contrib/ncurses/menu/m_attribs.c b/contrib/ncurses/menu/m_attribs.c
index 4c87a94ce026..1126ffb84f5a 100644
--- a/contrib/ncurses/menu/m_attribs.c
+++ b/contrib/ncurses/menu/m_attribs.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_attribs.c,v 1.9 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_attribs.c,v 1.14 2004/12/11 23:29:12 tom Exp $")
/* Macro to redraw menu if it is posted and changed */
#define Refresh_Menu(menu) \
@@ -51,6 +51,7 @@ MODULE_ID("$Id: m_attribs.c,v 1.9 2000/12/10 02:16:48 tom Exp $")
#define GEN_MENU_ATTR_SET_FCT( name ) \
NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU * menu, chtype attr)\
{\
+ T((T_CALLED("set_menu_" #name "(%p,%s)"), menu, _traceattr(attr)));\
if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\
RETURN(E_BAD_ARGUMENT);\
if (menu && ( menu -> name != attr))\
@@ -62,11 +63,12 @@ NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU * menu, chtype attr)\
RETURN(E_OK);\
}
-/* "Template" macro to generate a function to get a menus attribute */
+/* "Template" macro to generate a function to get a menu's attribute */
#define GEN_MENU_ATTR_GET_FCT( name ) \
NCURSES_IMPEXP chtype NCURSES_API menu_ ## name (const MENU * menu)\
{\
- return (Normalize_Menu( menu ) -> name);\
+ T((T_CALLED("menu_" #name "(%p)"), menu));\
+ returnAttr(Normalize_Menu( menu ) -> name);\
}
/*---------------------------------------------------------------------------
@@ -74,14 +76,14 @@ NCURSES_IMPEXP chtype NCURSES_API menu_ ## name (const MENU * menu)\
| Function : int set_menu_fore(MENU *menu, chtype attr)
|
| Description : Set the attribute for selectable items. In single-
-| valued menus thiis is used to highlight the current
+| valued menus this is used to highlight the current
| item ((i.e. where the cursor is), in multi-valued
| menus this is used to highlight the selected items.
|
| Return Values : E_OK - success
| E_BAD_ARGUMENT - an invalid value has been passed
+--------------------------------------------------------------------------*/
-GEN_MENU_ATTR_SET_FCT( fore )
+GEN_MENU_ATTR_SET_FCT(fore)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -93,7 +95,7 @@ GEN_MENU_ATTR_SET_FCT( fore )
|
| Return Values : Attribute value
+--------------------------------------------------------------------------*/
-GEN_MENU_ATTR_GET_FCT( fore )
+GEN_MENU_ATTR_GET_FCT(fore)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -105,7 +107,7 @@ GEN_MENU_ATTR_GET_FCT( fore )
| Return Values : E_OK - success
| E_BAD_ARGUMENT - an invalid value has been passed
+--------------------------------------------------------------------------*/
-GEN_MENU_ATTR_SET_FCT( back )
+GEN_MENU_ATTR_SET_FCT(back)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -116,7 +118,7 @@ GEN_MENU_ATTR_SET_FCT( back )
|
| Return Values : Attribute value
+--------------------------------------------------------------------------*/
-GEN_MENU_ATTR_GET_FCT( back )
+GEN_MENU_ATTR_GET_FCT(back)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -127,7 +129,7 @@ GEN_MENU_ATTR_GET_FCT( back )
| Return Values : E_OK - success
| E_BAD_ARGUMENT - an invalid value has been passed
+--------------------------------------------------------------------------*/
-GEN_MENU_ATTR_SET_FCT( grey )
+GEN_MENU_ATTR_SET_FCT(grey)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -137,5 +139,5 @@ GEN_MENU_ATTR_SET_FCT( grey )
|
| Return Values : Attribute value
+--------------------------------------------------------------------------*/
-GEN_MENU_ATTR_GET_FCT( grey )
+GEN_MENU_ATTR_GET_FCT(grey)
/* m_attribs.c ends here */
diff --git a/contrib/ncurses/menu/m_cursor.c b/contrib/ncurses/menu/m_cursor.c
index ccca36cea233..0293f9073c32 100644
--- a/contrib/ncurses/menu/m_cursor.c
+++ b/contrib/ncurses/menu/m_cursor.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2005 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 *
@@ -27,17 +27,17 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
* Module m_cursor *
-* Correctly position a menus cursor *
+* Correctly position a menu's cursor *
***************************************************************************/
#include "menu.priv.h"
-MODULE_ID("$Id: m_cursor.c,v 1.14 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_cursor.c,v 1.20 2005/10/22 23:03:32 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -50,24 +50,23 @@ MODULE_ID("$Id: m_cursor.c,v 1.14 2000/12/10 02:16:48 tom Exp $")
| E_NOT_POSTED - Menu is not posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-_nc_menu_cursor_pos
-(const MENU* menu, const ITEM* item, int* pY, int* pX)
+_nc_menu_cursor_pos(const MENU * menu, const ITEM * item, int *pY, int *pX)
{
if (!menu || !pX || !pY)
- return(E_BAD_ARGUMENT);
+ return (E_BAD_ARGUMENT);
else
{
- if ((ITEM*)0 == item)
+ if ((ITEM *) 0 == item)
item = menu->curitem;
- assert(item!=(ITEM*)0);
+ assert(item != (ITEM *) 0);
- if ( !( menu->status & _POSTED ) )
- return(E_NOT_POSTED);
+ if (!(menu->status & _POSTED))
+ return (E_NOT_POSTED);
*pX = item->x * (menu->spc_cols + menu->itemlen);
*pY = (item->y - menu->toprow) * menu->spc_rows;
}
- return(E_OK);
+ return (E_OK);
}
/*---------------------------------------------------------------------------
@@ -81,24 +80,26 @@ _nc_menu_cursor_pos
| E_NOT_POSTED - Menu is not posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-pos_menu_cursor (const MENU * menu)
+pos_menu_cursor(const MENU * menu)
{
WINDOW *win, *sub;
- int x, y;
- int err = _nc_menu_cursor_pos(menu,(ITEM*)0,&y,&x);
+ int x = 0, y = 0;
+ int err = _nc_menu_cursor_pos(menu, (ITEM *) 0, &y, &x);
- if (E_OK==err)
+ T((T_CALLED("pos_menu_cursor(%p)"), menu));
+
+ if (E_OK == err)
{
win = menu->userwin ? menu->userwin : stdscr;
sub = menu->usersub ? menu->usersub : win;
assert(win && sub);
if ((menu->opt & O_SHOWMATCH) && (menu->pindex > 0))
- x += ( menu->pindex + menu->marklen - 1);
+ x += (menu->pindex + menu->marklen - 1);
- wmove(sub,y,x);
+ wmove(sub, y, x);
- if ( win != sub )
+ if (win != sub)
{
wcursyncup(sub);
wsyncup(sub);
diff --git a/contrib/ncurses/menu/m_driver.c b/contrib/ncurses/menu/m_driver.c
index 69115cf64811..d29c6024a7e3 100644
--- a/contrib/ncurses/menu/m_driver.c
+++ b/contrib/ncurses/menu/m_driver.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2005 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_driver.c,v 1.18 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_driver.c,v 1.25 2005/11/26 20:46:59 tom Exp $")
/* Macros */
@@ -62,28 +62,31 @@ MODULE_ID("$Id: m_driver.c,v 1.18 2000/12/10 02:16:48 tom Exp $")
| Return Values : TRUE - if it is a substring
| FALSE - if it is not a substring
+--------------------------------------------------------------------------*/
-static bool Is_Sub_String(
- bool IgnoreCaseFlag,
- const char *part,
- const char *string
- )
+static bool
+Is_Sub_String(
+ bool IgnoreCaseFlag,
+ const char *part,
+ const char *string
+)
{
- assert( part && string );
- if ( IgnoreCaseFlag )
+ assert(part && string);
+ if (IgnoreCaseFlag)
{
- while(*string && *part)
+ while (*string && *part)
{
- if (toupper(*string++)!=toupper(*part)) break;
+ if (toupper(*string++) != toupper(*part))
+ break;
part++;
}
}
else
{
- while( *string && *part )
- if (*part != *string++) break;
+ while (*string && *part)
+ if (*part != *string++)
+ break;
part++;
}
- return ( (*part) ? FALSE : TRUE );
+ return ((*part) ? FALSE : TRUE);
}
/*---------------------------------------------------------------------------
@@ -113,73 +116,77 @@ static bool Is_Sub_String(
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
_nc_Match_Next_Character_In_Item_Name
-(MENU *menu, int ch, ITEM **item)
+(MENU * menu, int ch, ITEM ** item)
{
bool found = FALSE, passed = FALSE;
- int idx, last;
+ int idx, last;
+
+ T((T_CALLED("_nc_Match_Next_Character(%p,%d,%p)"), menu, ch, item));
- assert( menu && item && *item);
+ assert(menu && item && *item);
idx = (*item)->index;
- if (ch && ch!=BS)
+ if (ch && ch != BS)
{
/* if we become to long, we need no further checking : there can't be
- a match ! */
- if ((menu->pindex+1) > menu->namelen)
+ a match ! */
+ if ((menu->pindex + 1) > menu->namelen)
RETURN(E_NO_MATCH);
- Add_Character_To_Pattern(menu,ch);
+ Add_Character_To_Pattern(menu, ch);
/* we artificially position one item back, because in the do...while
- loop we start with the next item. This means, that with a new
- pattern search we always start the scan with the actual item. If
- we do a NEXT_PATTERN oder PREV_PATTERN search, we start with the
- one after or before the actual item. */
+ loop we start with the next item. This means, that with a new
+ pattern search we always start the scan with the actual item. If
+ we do a NEXT_PATTERN oder PREV_PATTERN search, we start with the
+ one after or before the actual item. */
if (--idx < 0)
- idx = menu->nitems-1;
+ idx = menu->nitems - 1;
}
last = idx; /* this closes the cycle */
- do{
- if (ch==BS)
- { /* we have to go backward */
- if (--idx < 0)
- idx = menu->nitems-1;
- }
- else
- { /* otherwise we always go forward */
- if (++idx >= menu->nitems)
- idx = 0;
- }
- if (Is_Sub_String((menu->opt & O_IGNORECASE) != 0,
- menu->pattern,
- menu->items[idx]->name.str)
+ do
+ {
+ if (ch == BS)
+ { /* we have to go backward */
+ if (--idx < 0)
+ idx = menu->nitems - 1;
+ }
+ else
+ { /* otherwise we always go forward */
+ if (++idx >= menu->nitems)
+ idx = 0;
+ }
+ if (Is_Sub_String((bool)((menu->opt & O_IGNORECASE) != 0),
+ menu->pattern,
+ menu->items[idx]->name.str)
)
- found = TRUE;
- else
- passed = TRUE;
- } while (!found && (idx != last));
+ found = TRUE;
+ else
+ passed = TRUE;
+ }
+ while (!found && (idx != last));
if (found)
{
- if (!((idx==(*item)->index) && passed))
+ if (!((idx == (*item)->index) && passed))
{
*item = menu->items[idx];
RETURN(E_OK);
}
/* This point is reached, if we fully cycled through the item list
- and the only match we found is the starting item. With a NEXT_PATTERN
- or PREV_PATTERN scan this means, that there was no additional match.
- If we searched with an expanded new pattern, we should never reach
- this point, because if the expanded pattern matches also the actual
- item we will find it in the first attempt (passed==FALSE) and we
- will never cycle through the whole item array.
- */
- assert( ch==0 || ch==BS );
+ and the only match we found is the starting item. With a NEXT_PATTERN
+ or PREV_PATTERN scan this means, that there was no additional match.
+ If we searched with an expanded new pattern, we should never reach
+ this point, because if the expanded pattern matches also the actual
+ item we will find it in the first attempt (passed==FALSE) and we
+ will never cycle through the whole item array.
+ */
+ assert(ch == 0 || ch == BS);
}
else
{
- if (ch && ch!=BS && menu->pindex>0)
+ if (ch && ch != BS && menu->pindex > 0)
{
/* if we had no match with a new pattern, we have to restore it */
Remove_Character_From_Pattern(menu);
@@ -201,7 +208,7 @@ _nc_Match_Next_Character_In_Item_Name
| E_NOT_POSTED - menu is not posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-menu_driver (MENU * menu, int c)
+menu_driver(MENU * menu, int c)
{
#define NAVIGATE(dir) \
if (!item->dir)\
@@ -213,327 +220,332 @@ menu_driver (MENU * menu, int c)
ITEM *item;
int my_top_row, rdiff;
+ T((T_CALLED("menu_driver(%p,%d)"), menu, c));
+
if (!menu)
RETURN(E_BAD_ARGUMENT);
- if ( menu->status & _IN_DRIVER )
+ if (menu->status & _IN_DRIVER)
RETURN(E_BAD_STATE);
- if ( !( menu->status & _POSTED ) )
+ if (!(menu->status & _POSTED))
RETURN(E_NOT_POSTED);
item = menu->curitem;
- my_top_row = menu->toprow;
- assert(item);
-
- if ((c > KEY_MAX) && (c<=MAX_MENU_COMMAND))
- {
- if (!((c==REQ_BACK_PATTERN)
- || (c==REQ_NEXT_MATCH) || (c==REQ_PREV_MATCH)))
- {
- assert( menu->pattern );
- Reset_Pattern(menu);
- }
-
- switch(c)
- {
- case REQ_LEFT_ITEM:
+ my_top_row = menu->toprow;
+ assert(item);
+
+ if ((c > KEY_MAX) && (c <= MAX_MENU_COMMAND))
+ {
+ if (!((c == REQ_BACK_PATTERN)
+ || (c == REQ_NEXT_MATCH) || (c == REQ_PREV_MATCH)))
+ {
+ assert(menu->pattern);
+ Reset_Pattern(menu);
+ }
+
+ switch (c)
+ {
+ case REQ_LEFT_ITEM:
/*=================*/
- NAVIGATE(left);
- break;
+ NAVIGATE(left);
+ break;
- case REQ_RIGHT_ITEM:
+ case REQ_RIGHT_ITEM:
/*==================*/
- NAVIGATE(right);
- break;
+ NAVIGATE(right);
+ break;
- case REQ_UP_ITEM:
+ case REQ_UP_ITEM:
/*===============*/
- NAVIGATE(up);
- break;
+ NAVIGATE(up);
+ break;
- case REQ_DOWN_ITEM:
+ case REQ_DOWN_ITEM:
/*=================*/
- NAVIGATE(down);
- break;
+ NAVIGATE(down);
+ break;
- case REQ_SCR_ULINE:
+ case REQ_SCR_ULINE:
/*=================*/
if (my_top_row == 0 || !(item->up))
- result = E_REQUEST_DENIED;
- else
- {
- --my_top_row;
- item = item->up;
- }
- break;
-
- case REQ_SCR_DLINE:
+ result = E_REQUEST_DENIED;
+ else
+ {
+ --my_top_row;
+ item = item->up;
+ }
+ break;
+
+ case REQ_SCR_DLINE:
/*=================*/
if ((my_top_row + menu->arows >= menu->rows) || !(item->down))
- {
- /* only if the menu has less items than rows, we can deny the
- request. Otherwise the epilogue of this routine adjusts the
- top row if necessary */
- result = E_REQUEST_DENIED;
- }
- else {
- my_top_row++;
+ {
+ /* only if the menu has less items than rows, we can deny the
+ request. Otherwise the epilogue of this routine adjusts the
+ top row if necessary */
+ result = E_REQUEST_DENIED;
+ }
+ else
+ {
+ my_top_row++;
item = item->down;
- }
- break;
+ }
+ break;
- case REQ_SCR_DPAGE:
+ case REQ_SCR_DPAGE:
/*=================*/
rdiff = menu->rows - (menu->arows + my_top_row);
- if (rdiff > menu->arows)
- rdiff = menu->arows;
- if (rdiff<=0)
- result = E_REQUEST_DENIED;
- else
- {
- my_top_row += rdiff;
- while(rdiff-- > 0 && item!=(ITEM*)0)
- item = item->down;
- }
- break;
-
- case REQ_SCR_UPAGE:
+ if (rdiff > menu->arows)
+ rdiff = menu->arows;
+ if (rdiff <= 0)
+ result = E_REQUEST_DENIED;
+ else
+ {
+ my_top_row += rdiff;
+ while (rdiff-- > 0 && item != (ITEM *) 0)
+ item = item->down;
+ }
+ break;
+
+ case REQ_SCR_UPAGE:
/*=================*/
rdiff = (menu->arows < my_top_row) ? menu->arows : my_top_row;
- if (rdiff<=0)
- result = E_REQUEST_DENIED;
- else
- {
- my_top_row -= rdiff;
- while(rdiff-- && item!=(ITEM*)0)
- item = item->up;
- }
- break;
+ if (rdiff <= 0)
+ result = E_REQUEST_DENIED;
+ else
+ {
+ my_top_row -= rdiff;
+ while (rdiff-- && item != (ITEM *) 0)
+ item = item->up;
+ }
+ break;
- case REQ_FIRST_ITEM:
+ case REQ_FIRST_ITEM:
/*==================*/
- item = menu->items[0];
- break;
+ item = menu->items[0];
+ break;
- case REQ_LAST_ITEM:
+ case REQ_LAST_ITEM:
/*=================*/
- item = menu->items[menu->nitems-1];
- break;
+ item = menu->items[menu->nitems - 1];
+ break;
- case REQ_NEXT_ITEM:
+ case REQ_NEXT_ITEM:
/*=================*/
- if ((item->index+1)>=menu->nitems)
- {
- if (menu->opt & O_NONCYCLIC)
- result = E_REQUEST_DENIED;
- else
- item = menu->items[0];
- }
- else
- item = menu->items[item->index + 1];
- break;
-
- case REQ_PREV_ITEM:
+ if ((item->index + 1) >= menu->nitems)
+ {
+ if (menu->opt & O_NONCYCLIC)
+ result = E_REQUEST_DENIED;
+ else
+ item = menu->items[0];
+ }
+ else
+ item = menu->items[item->index + 1];
+ break;
+
+ case REQ_PREV_ITEM:
/*=================*/
- if (item->index<=0)
- {
- if (menu->opt & O_NONCYCLIC)
- result = E_REQUEST_DENIED;
- else
- item = menu->items[menu->nitems-1];
- }
- else
- item = menu->items[item->index - 1];
- break;
-
- case REQ_TOGGLE_ITEM:
- /*===================*/
- if (menu->opt & O_ONEVALUE)
- {
+ if (item->index <= 0)
+ {
+ if (menu->opt & O_NONCYCLIC)
result = E_REQUEST_DENIED;
- }
- else
- {
- if (menu->curitem->opt & O_SELECTABLE)
- {
- menu->curitem->value = !menu->curitem->value;
- Move_And_Post_Item(menu,menu->curitem);
- _nc_Show_Menu(menu);
- }
- else
- result = E_NOT_SELECTABLE;
- }
- break;
-
- case REQ_CLEAR_PATTERN:
+ else
+ item = menu->items[menu->nitems - 1];
+ }
+ else
+ item = menu->items[item->index - 1];
+ break;
+
+ case REQ_TOGGLE_ITEM:
+ /*===================*/
+ if (menu->opt & O_ONEVALUE)
+ {
+ result = E_REQUEST_DENIED;
+ }
+ else
+ {
+ if (menu->curitem->opt & O_SELECTABLE)
+ {
+ menu->curitem->value = !menu->curitem->value;
+ Move_And_Post_Item(menu, menu->curitem);
+ _nc_Show_Menu(menu);
+ }
+ else
+ result = E_NOT_SELECTABLE;
+ }
+ break;
+
+ case REQ_CLEAR_PATTERN:
/*=====================*/
- /* already cleared in prologue */
- break;
+ /* already cleared in prologue */
+ break;
- case REQ_BACK_PATTERN:
+ case REQ_BACK_PATTERN:
/*====================*/
- if (menu->pindex>0)
- {
- assert(menu->pattern);
- Remove_Character_From_Pattern(menu);
- pos_menu_cursor( menu );
- }
- else
- result = E_REQUEST_DENIED;
- break;
-
- case REQ_NEXT_MATCH:
+ if (menu->pindex > 0)
+ {
+ assert(menu->pattern);
+ Remove_Character_From_Pattern(menu);
+ pos_menu_cursor(menu);
+ }
+ else
+ result = E_REQUEST_DENIED;
+ break;
+
+ case REQ_NEXT_MATCH:
/*==================*/
- assert(menu->pattern);
- if (menu->pattern[0])
- result = _nc_Match_Next_Character_In_Item_Name(menu,0,&item);
- else
- {
- if ((item->index+1)<menu->nitems)
- item=menu->items[item->index+1];
- else
- {
- if (menu->opt & O_NONCYCLIC)
- result = E_REQUEST_DENIED;
- else
- item = menu->items[0];
- }
- }
- break;
-
- case REQ_PREV_MATCH:
+ assert(menu->pattern);
+ if (menu->pattern[0])
+ result = _nc_Match_Next_Character_In_Item_Name(menu, 0, &item);
+ else
+ {
+ if ((item->index + 1) < menu->nitems)
+ item = menu->items[item->index + 1];
+ else
+ {
+ if (menu->opt & O_NONCYCLIC)
+ result = E_REQUEST_DENIED;
+ else
+ item = menu->items[0];
+ }
+ }
+ break;
+
+ case REQ_PREV_MATCH:
/*==================*/
- assert(menu->pattern);
- if (menu->pattern[0])
- result = _nc_Match_Next_Character_In_Item_Name(menu,BS,&item);
- else
- {
- if (item->index)
- item = menu->items[item->index-1];
- else
- {
- if (menu->opt & O_NONCYCLIC)
- result = E_REQUEST_DENIED;
- else
- item = menu->items[menu->nitems-1];
- }
- }
- break;
-
- default:
+ assert(menu->pattern);
+ if (menu->pattern[0])
+ result = _nc_Match_Next_Character_In_Item_Name(menu, BS, &item);
+ else
+ {
+ if (item->index)
+ item = menu->items[item->index - 1];
+ else
+ {
+ if (menu->opt & O_NONCYCLIC)
+ result = E_REQUEST_DENIED;
+ else
+ item = menu->items[menu->nitems - 1];
+ }
+ }
+ break;
+
+ default:
/*======*/
- result = E_UNKNOWN_COMMAND;
- break;
- }
- }
- else
- { /* not a command */
- if ( !(c & ~((int)MAX_REGULAR_CHARACTER)) && isprint(c) )
- result = _nc_Match_Next_Character_In_Item_Name( menu, c, &item );
+ result = E_UNKNOWN_COMMAND;
+ break;
+ }
+ }
+ else
+ { /* not a command */
+ if (!(c & ~((int)MAX_REGULAR_CHARACTER)) && isprint(UChar(c)))
+ result = _nc_Match_Next_Character_In_Item_Name(menu, c, &item);
#ifdef NCURSES_MOUSE_VERSION
- else if (KEY_MOUSE == c)
- {
- MEVENT event;
- WINDOW* uwin = Get_Menu_UserWin(menu);
-
- getmouse(&event);
- if ((event.bstate & (BUTTON1_CLICKED |
- BUTTON1_DOUBLE_CLICKED |
- BUTTON1_TRIPLE_CLICKED ))
- && wenclose(uwin,event.y, event.x))
- { /* we react only if the click was in the userwin, that means
- * inside the menu display area or at the decoration window.
- */
- WINDOW* sub = Get_Menu_Window(menu);
- int ry = event.y, rx = event.x; /* screen coordinates */
+ else if (KEY_MOUSE == c)
+ {
+ MEVENT event;
+ WINDOW *uwin = Get_Menu_UserWin(menu);
+
+ getmouse(&event);
+ if ((event.bstate & (BUTTON1_CLICKED |
+ BUTTON1_DOUBLE_CLICKED |
+ BUTTON1_TRIPLE_CLICKED))
+ && wenclose(uwin, event.y, event.x))
+ { /* we react only if the click was in the userwin, that means
+ * inside the menu display area or at the decoration window.
+ */
+ WINDOW *sub = Get_Menu_Window(menu);
+ int ry = event.y, rx = event.x; /* screen coordinates */
- result = E_REQUEST_DENIED;
- if (mouse_trafo(&ry,&rx,FALSE))
- { /* rx, ry are now "curses" coordinates */
- if (ry < sub->_begy)
- { /* we clicked above the display region; this is
- * interpreted as "scroll up" request
- */
- if (event.bstate & BUTTON1_CLICKED)
- result = menu_driver(menu,REQ_SCR_ULINE);
- else if (event.bstate & BUTTON1_DOUBLE_CLICKED)
- result = menu_driver(menu,REQ_SCR_UPAGE);
- else if (event.bstate & BUTTON1_TRIPLE_CLICKED)
- result = menu_driver(menu,REQ_FIRST_ITEM);
- RETURN(result);
- }
- else if (ry >= sub->_begy + sub->_maxy)
- { /* we clicked below the display region; this is
- * interpreted as "scroll down" request
- */
- if (event.bstate & BUTTON1_CLICKED)
- result = menu_driver(menu,REQ_SCR_DLINE);
- else if (event.bstate & BUTTON1_DOUBLE_CLICKED)
- result = menu_driver(menu,REQ_SCR_DPAGE);
- else if (event.bstate & BUTTON1_TRIPLE_CLICKED)
- result = menu_driver(menu,REQ_LAST_ITEM);
- RETURN(result);
- }
- else if (wenclose(sub,event.y,event.x))
- { /* Inside the area we try to find the hit item */
- int i,x,y,err;
- ry = event.y; rx = event.x;
- if (wmouse_trafo(sub,&ry,&rx,FALSE))
- {
- for(i=0;i<menu->nitems;i++)
- {
- err = _nc_menu_cursor_pos(menu,menu->items[i],
- &y, &x);
- if (E_OK==err)
- {
- if ((ry==y) &&
- (rx>=x) &&
- (rx < x + menu->itemlen))
- {
- item = menu->items[i];
- result = E_OK;
- break;
- }
- }
- }
- if (E_OK==result)
- { /* We found an item, now we can handle the click.
+ result = E_REQUEST_DENIED;
+ if (mouse_trafo(&ry, &rx, FALSE))
+ { /* rx, ry are now "curses" coordinates */
+ if (ry < sub->_begy)
+ { /* we clicked above the display region; this is
+ * interpreted as "scroll up" request
+ */
+ if (event.bstate & BUTTON1_CLICKED)
+ result = menu_driver(menu, REQ_SCR_ULINE);
+ else if (event.bstate & BUTTON1_DOUBLE_CLICKED)
+ result = menu_driver(menu, REQ_SCR_UPAGE);
+ else if (event.bstate & BUTTON1_TRIPLE_CLICKED)
+ result = menu_driver(menu, REQ_FIRST_ITEM);
+ RETURN(result);
+ }
+ else if (ry > sub->_begy + sub->_maxy)
+ { /* we clicked below the display region; this is
+ * interpreted as "scroll down" request
+ */
+ if (event.bstate & BUTTON1_CLICKED)
+ result = menu_driver(menu, REQ_SCR_DLINE);
+ else if (event.bstate & BUTTON1_DOUBLE_CLICKED)
+ result = menu_driver(menu, REQ_SCR_DPAGE);
+ else if (event.bstate & BUTTON1_TRIPLE_CLICKED)
+ result = menu_driver(menu, REQ_LAST_ITEM);
+ RETURN(result);
+ }
+ else if (wenclose(sub, event.y, event.x))
+ { /* Inside the area we try to find the hit item */
+ int i, x, y, err;
+
+ ry = event.y;
+ rx = event.x;
+ if (wmouse_trafo(sub, &ry, &rx, FALSE))
+ {
+ for (i = 0; i < menu->nitems; i++)
+ {
+ err = _nc_menu_cursor_pos(menu, menu->items[i],
+ &y, &x);
+ if (E_OK == err)
+ {
+ if ((ry == y) &&
+ (rx >= x) &&
+ (rx < x + menu->itemlen))
+ {
+ item = menu->items[i];
+ result = E_OK;
+ break;
+ }
+ }
+ }
+ if (E_OK == result)
+ { /* We found an item, now we can handle the click.
* A single click just positions the menu cursor
* to the clicked item. A double click toggles
* the item.
*/
- if (event.bstate & BUTTON1_DOUBLE_CLICKED)
- {
- _nc_New_TopRow_and_CurrentItem(menu,
- my_top_row,
- item);
- menu_driver(menu,REQ_TOGGLE_ITEM);
- result = E_UNKNOWN_COMMAND;
- }
- }
- }
- }
- }
- }
- else
- result = E_REQUEST_DENIED;
- }
+ if (event.bstate & BUTTON1_DOUBLE_CLICKED)
+ {
+ _nc_New_TopRow_and_CurrentItem(menu,
+ my_top_row,
+ item);
+ menu_driver(menu, REQ_TOGGLE_ITEM);
+ result = E_UNKNOWN_COMMAND;
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ result = E_REQUEST_DENIED;
+ }
#endif /* NCURSES_MOUSE_VERSION */
- else
- result = E_UNKNOWN_COMMAND;
- }
+ else
+ result = E_UNKNOWN_COMMAND;
+ }
- if (E_OK==result)
+ if (E_OK == result)
{
- /* Adjust the top row if it turns out that the current item unfortunately
- doesn't appear in the menu window */
- if ( item->y < my_top_row )
- my_top_row = item->y;
- else if ( item->y >= (my_top_row + menu->arows) )
- my_top_row = item->y - menu->arows + 1;
-
- _nc_New_TopRow_and_CurrentItem( menu, my_top_row, item );
+ /* Adjust the top row if it turns out that the current item unfortunately
+ doesn't appear in the menu window */
+ if (item->y < my_top_row)
+ my_top_row = item->y;
+ else if (item->y >= (my_top_row + menu->arows))
+ my_top_row = item->y - menu->arows + 1;
+
+ _nc_New_TopRow_and_CurrentItem(menu, my_top_row, item);
}
diff --git a/contrib/ncurses/menu/m_format.c b/contrib/ncurses/menu/m_format.c
index ffd8e701e3ee..773cb27e774f 100644
--- a/contrib/ncurses/menu/m_format.c
+++ b/contrib/ncurses/menu/m_format.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,14 +37,14 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_format.c,v 1.10 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_format.c,v 1.15 2004/12/11 23:11:21 tom Exp $")
#define minimum(a,b) ((a)<(b) ? (a): (b))
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int set_menu_format(MENU *menu, int rows, int cols)
-|
+|
| Description : Sets the maximum number of rows and columns of items
| that may be displayed at one time on a menu. If the
| menu contains more items than can be displayed at
@@ -56,42 +56,44 @@ MODULE_ID("$Id: m_format.c,v 1.10 2000/12/10 02:16:48 tom Exp $")
| E_POSTED - the menu is already posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_format (MENU *menu, int rows, int cols)
+set_menu_format(MENU * menu, int rows, int cols)
{
int total_rows, total_cols;
-
- if (rows<0 || cols<0)
+
+ T((T_CALLED("set_menu_format(%p,%d,%d)"), menu, rows, cols));
+
+ if (rows < 0 || cols < 0)
RETURN(E_BAD_ARGUMENT);
-
+
if (menu)
{
- if ( menu->status & _POSTED )
+ if (menu->status & _POSTED)
RETURN(E_POSTED);
-
+
if (!(menu->items))
RETURN(E_NOT_CONNECTED);
-
- if (rows==0)
+
+ if (rows == 0)
rows = menu->frows;
- if (cols==0)
+ if (cols == 0)
cols = menu->fcols;
-
+
if (menu->pattern)
Reset_Pattern(menu);
-
+
menu->frows = rows;
menu->fcols = cols;
-
- assert(rows>0 && cols>0);
- total_rows = (menu->nitems - 1)/cols + 1;
- total_cols = (menu->status & O_ROWMAJOR) ?
- minimum(menu->nitems,cols) :
- (menu->nitems-1)/total_rows + 1;
-
- menu->rows = total_rows;
- menu->cols = total_cols;
- menu->arows = minimum(total_rows,rows);
- menu->toprow = 0;
+
+ assert(rows > 0 && cols > 0);
+ total_rows = (menu->nitems - 1) / cols + 1;
+ total_cols = (menu->opt & O_ROWMAJOR) ?
+ minimum(menu->nitems, cols) :
+ (menu->nitems - 1) / total_rows + 1;
+
+ menu->rows = total_rows;
+ menu->cols = total_cols;
+ menu->arows = minimum(total_rows, rows);
+ menu->toprow = 0;
menu->curitem = *(menu->items);
assert(menu->curitem);
menu->status |= _LINK_NEEDED;
@@ -99,24 +101,26 @@ set_menu_format (MENU *menu, int rows, int cols)
}
else
{
- if (rows>0) _nc_Default_Menu.frows = rows;
- if (cols>0) _nc_Default_Menu.fcols = cols;
+ if (rows > 0)
+ _nc_Default_Menu.frows = rows;
+ if (cols > 0)
+ _nc_Default_Menu.fcols = cols;
}
-
+
RETURN(E_OK);
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void menu_format(const MENU *menu, int *rows, int *cols)
-|
+|
| Description : Returns the maximum number of rows and columns that may
| be displayed at one time on menu.
|
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void)
-menu_format (const MENU *menu, int *rows, int *cols)
+menu_format(const MENU * menu, int *rows, int *cols)
{
if (rows)
*rows = Normalize_Menu(menu)->frows;
diff --git a/contrib/ncurses/menu/m_global.c b/contrib/ncurses/menu/m_global.c
index 927df28d65b0..28e836dd644e 100644
--- a/contrib/ncurses/menu/m_global.c
+++ b/contrib/ncurses/menu/m_global.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2005 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,10 +37,10 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_global.c,v 1.13 2002/06/01 16:16:44 tom Exp $")
+MODULE_ID("$Id: m_global.c,v 1.23 2005/12/31 21:51:52 tom Exp $")
static char mark[] = "-";
-
+/* *INDENT-OFF* */
NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = {
16, /* Nr. of chars high */
1, /* Nr. of chars wide */
@@ -95,6 +95,7 @@ NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = {
(ITEM *)0, /* up */
(ITEM *)0 /* down */
};
+/* *INDENT-ON* */
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -105,24 +106,29 @@ NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = {
|
| Return Values : -
+--------------------------------------------------------------------------*/
-INLINE static void ComputeMaximum_NameDesc_Lengths(MENU * menu)
+NCURSES_INLINE static void
+ComputeMaximum_NameDesc_Lengths(MENU * menu)
{
- unsigned MaximumNameLength = 0;
+ unsigned MaximumNameLength = 0;
unsigned MaximumDescriptionLength = 0;
ITEM **items;
-
+ unsigned check;
+
assert(menu && menu->items);
- for( items = menu->items; *items ; items++ )
+ for (items = menu->items; *items; items++)
{
- if (items[0]->name.length > MaximumNameLength )
- MaximumNameLength = items[0]->name.length;
-
- if (items[0]->description.length > MaximumDescriptionLength)
- MaximumDescriptionLength = items[0]->description.length;
+ check = _nc_Calculate_Text_Width(&((*items)->name));
+ if (check > MaximumNameLength)
+ MaximumNameLength = check;
+
+ check = _nc_Calculate_Text_Width(&((*items)->description));
+ if (check > MaximumDescriptionLength)
+ MaximumDescriptionLength = check;
}
-
+
menu->namelen = MaximumNameLength;
menu->desclen = MaximumDescriptionLength;
+ T(("ComputeMaximum_NameDesc_Lengths %d,%d", menu->namelen, menu->desclen));
}
/*---------------------------------------------------------------------------
@@ -134,22 +140,23 @@ INLINE static void ComputeMaximum_NameDesc_Lengths(MENU * menu)
|
| Return Values : -
+--------------------------------------------------------------------------*/
-INLINE static void ResetConnectionInfo(MENU *menu, ITEM **items)
+NCURSES_INLINE static void
+ResetConnectionInfo(MENU * menu, ITEM ** items)
{
ITEM **item;
-
+
assert(menu && items);
- for(item=items; *item; item++)
+ for (item = items; *item; item++)
{
(*item)->index = 0;
- (*item)->imenu = (MENU *)0;
+ (*item)->imenu = (MENU *) 0;
}
if (menu->pattern)
free(menu->pattern);
menu->pattern = (char *)0;
- menu->pindex = 0;
- menu->items = (ITEM **)0;
- menu->nitems = 0;
+ menu->pindex = 0;
+ menu->items = (ITEM **) 0;
+ menu->nitems = 0;
}
/*---------------------------------------------------------------------------
@@ -160,29 +167,29 @@ INLINE static void ResetConnectionInfo(MENU *menu, ITEM **items)
| Decorate all the items with a number and a backward
| pointer to the menu.
|
-| Return Values : TRUE - successfull connection
+| Return Values : TRUE - successful connection
| FALSE - connection failed
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(bool)
-_nc_Connect_Items (MENU *menu, ITEM **items)
+_nc_Connect_Items(MENU * menu, ITEM ** items)
{
ITEM **item;
unsigned int ItemCount = 0;
-
- if ( menu && items )
- {
- for(item=items; *item ; item++)
+
+ if (menu && items)
+ {
+ for (item = items; *item; item++)
{
- if ( (*item)->imenu )
+ if ((*item)->imenu)
{
/* if a item is already connected, reject connection */
break;
}
}
- if (! (*item) )
+ if (!(*item))
/* we reached the end, so there was no connected item */
{
- for(item=items; *item ; item++)
+ for (item = items; *item; item++)
{
if (menu->opt & O_ONEVALUE)
{
@@ -190,31 +197,31 @@ _nc_Connect_Items (MENU *menu, ITEM **items)
}
(*item)->index = ItemCount++;
(*item)->imenu = menu;
- }
+ }
}
}
else
- return(FALSE);
-
+ return (FALSE);
+
if (ItemCount != 0)
{
- menu->items = items;
+ menu->items = items;
menu->nitems = ItemCount;
ComputeMaximum_NameDesc_Lengths(menu);
- if ( (menu->pattern = (char *)malloc( (unsigned)(1 + menu->namelen))) )
+ if ((menu->pattern = typeMalloc(char, (unsigned)(1 + menu->namelen))))
{
- Reset_Pattern(menu);
- set_menu_format(menu,menu->frows,menu->fcols);
+ Reset_Pattern(menu);
+ set_menu_format(menu, menu->frows, menu->fcols);
menu->curitem = *items;
menu->toprow = 0;
- return(TRUE);
+ return (TRUE);
}
}
-
+
/* If we fall through to this point, we have to reset all items connection
and inform about a reject connection */
- ResetConnectionInfo( menu, items );
- return(FALSE);
+ ResetConnectionInfo(menu, items);
+ return (FALSE);
}
/*---------------------------------------------------------------------------
@@ -226,11 +233,99 @@ _nc_Connect_Items (MENU *menu, ITEM **items)
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void)
-_nc_Disconnect_Items (MENU * menu)
+_nc_Disconnect_Items(MENU * menu)
{
if (menu && menu->items)
- ResetConnectionInfo( menu, menu->items );
+ ResetConnectionInfo(menu, menu->items);
+}
+
+/*---------------------------------------------------------------------------
+| Facility : libnmenu
+| Function : int _nc_Calculate_Text_Width(const TEXT * item)
+|
+| Description : Calculate the number of columns for a TEXT.
+|
+| Return Values : the width
++--------------------------------------------------------------------------*/
+NCURSES_EXPORT(int)
+_nc_Calculate_Text_Width(const TEXT * item /*FIXME: limit length */ )
+{
+#if USE_WIDEC_SUPPORT
+ int result = item->length;
+
+ T((T_CALLED("_nc_menu_text_width(%p)"), item));
+ if (result != 0 && item->str != 0)
+ {
+ int count = mbstowcs(0, item->str, 0);
+ wchar_t *temp = 0;
+
+ if (count > 0
+ && (temp = typeMalloc(wchar_t, 2 + count)) != 0)
+ {
+ int n;
+
+ result = 0;
+ mbstowcs(temp, item->str, (unsigned)count);
+ for (n = 0; n < count; ++n)
+ {
+ int test = wcwidth(temp[n]);
+
+ if (test <= 0)
+ test = 1;
+ result += test;
+ }
+ free(temp);
+ }
+ }
+ returnCode(result);
+#else
+ return item->length;
+#endif
+}
+
+/*
+ * Calculate the actual width of a menu entry for wide-characters.
+ */
+#if USE_WIDEC_SUPPORT
+static int
+calculate_actual_width(MENU * menu, bool name)
+{
+ int width = 0;
+ int check = 0;
+ ITEM **items;
+
+ assert(menu && menu->items);
+
+ if (menu->items != 0)
+ {
+ for (items = menu->items; *items; items++)
+ {
+ if (name)
+ {
+ check = _nc_Calculate_Text_Width(&((*items)->name));
+ }
+ else
+ {
+ check = _nc_Calculate_Text_Width(&((*items)->description));
+ }
+ if (check > width)
+ width = check;
+ }
+ }
+ else
+ {
+ width = (name ? menu->namelen : menu->desclen);
+ }
+
+ T(("calculate_actual_width %s = %d/%d",
+ name ? "name" : "desc",
+ width,
+ name ? menu->namelen : menu->desclen));
+ return width;
}
+#else
+#define calculate_actual_width(menu, name) (name ? menu->namelen : menu->desclen)
+#endif
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -242,93 +337,103 @@ _nc_Disconnect_Items (MENU * menu)
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void)
-_nc_Calculate_Item_Length_and_Width (MENU * menu)
+_nc_Calculate_Item_Length_and_Width(MENU * menu)
{
int l;
-
+
assert(menu);
- menu->height = 1 + menu->spc_rows * (menu->arows - 1);
+ menu->height = 1 + menu->spc_rows * (menu->arows - 1);
+
+ l = calculate_actual_width(menu, TRUE);
+ l += menu->marklen;
+
+ if ((menu->opt & O_SHOWDESC) && (menu->desclen > 0))
+ {
+ l += calculate_actual_width(menu, FALSE);
+ l += menu->spc_desc;
+ }
- l = menu->namelen + menu->marklen;
- if ( (menu->opt & O_SHOWDESC) && (menu->desclen > 0) )
- l += (menu->desclen + menu->spc_desc);
-
menu->itemlen = l;
l *= menu->cols;
- l += (menu->cols-1)*menu->spc_cols; /* for the padding between the columns */
+ l += (menu->cols - 1) * menu->spc_cols; /* for the padding between the columns */
menu->width = l;
-}
+
+ T(("_nc_CalculateItem_Length_and_Width columns %d, item %d, width %d",
+ menu->cols,
+ menu->itemlen,
+ menu->width));
+}
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : void _nc_Link_Item(MENU *menu)
|
-| Description : Statically calculate for every item its four neighbours.
+| Description : Statically calculate for every item its four neighbors.
| This depends on the orientation of the menu. This
-| static aproach simplifies navigation in the menu a lot.
+| static approach simplifies navigation in the menu a lot.
|
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void)
-_nc_Link_Items (MENU * menu)
+_nc_Link_Items(MENU * menu)
{
if (menu && menu->items && *(menu->items))
{
- int i,j;
+ int i, j;
ITEM *item;
int Number_Of_Items = menu->nitems;
int col = 0, row = 0;
int Last_in_Row;
int Last_in_Column;
bool cycle = (menu->opt & O_NONCYCLIC) ? FALSE : TRUE;
-
+
menu->status &= ~_LINK_NEEDED;
-
+
if (menu->opt & O_ROWMAJOR)
{
int Number_Of_Columns = menu->cols;
-
- for(i=0; i < Number_Of_Items; i++)
+
+ for (i = 0; i < Number_Of_Items; i++)
{
item = menu->items[i];
-
- Last_in_Row = row * Number_Of_Columns + (Number_Of_Columns-1);
-
- item->left = (col) ?
- /* if we are not in the leftmost column, we can use the
- predecessor in the items array */
- menu->items[i-1] :
- (cycle ? menu->items[(Last_in_Row>=Number_Of_Items) ?
- Number_Of_Items-1:
- Last_in_Row] :
- (ITEM *)0 );
-
- item->right = ( (col < (Number_Of_Columns-1)) &&
- ((i+1) < Number_Of_Items)
- ) ?
- menu->items[i+1] :
- ( cycle ? menu->items[row * Number_Of_Columns] :
- (ITEM *)0
- );
-
- Last_in_Column = (menu->rows-1) * Number_Of_Columns + col;
-
- item->up = (row) ? menu->items[i-Number_Of_Columns] :
- (cycle ? menu->items[(Last_in_Column>=Number_Of_Items) ?
- Number_Of_Items-1 :
- Last_in_Column] :
- (ITEM *)0);
-
- item->down = ( (i+Number_Of_Columns) < Number_Of_Items )
- ?
- menu->items[i + Number_Of_Columns] :
- (cycle ? menu->items[(row+1)<menu->rows ?
- Number_Of_Items-1:col] :
- (ITEM *)0);
+
+ Last_in_Row = row * Number_Of_Columns + (Number_Of_Columns - 1);
+
+ item->left = (col) ?
+ /* if we are not in the leftmost column, we can use the
+ predecessor in the items array */
+ menu->items[i - 1] :
+ (cycle ? menu->items[(Last_in_Row >= Number_Of_Items) ?
+ Number_Of_Items - 1 :
+ Last_in_Row] :
+ (ITEM *) 0);
+
+ item->right = ((col < (Number_Of_Columns - 1)) &&
+ ((i + 1) < Number_Of_Items)
+ )?
+ menu->items[i + 1] :
+ (cycle ? menu->items[row * Number_Of_Columns] :
+ (ITEM *) 0
+ );
+
+ Last_in_Column = (menu->rows - 1) * Number_Of_Columns + col;
+
+ item->up = (row) ? menu->items[i - Number_Of_Columns] :
+ (cycle ? menu->items[(Last_in_Column >= Number_Of_Items) ?
+ Number_Of_Items - 1 :
+ Last_in_Column] :
+ (ITEM *) 0);
+
+ item->down = ((i + Number_Of_Columns) < Number_Of_Items)
+ ?
+ menu->items[i + Number_Of_Columns] :
+ (cycle ? menu->items[(row + 1) < menu->rows ?
+ Number_Of_Items - 1 : col] :
+ (ITEM *) 0);
item->x = col;
item->y = row;
- if ( ++col == Number_Of_Columns )
+ if (++col == Number_Of_Columns)
{
row++;
col = 0;
@@ -338,48 +443,48 @@ _nc_Link_Items (MENU * menu)
else
{
int Number_Of_Rows = menu->rows;
-
- for(j=0; j<Number_Of_Items; j++)
+
+ for (j = 0; j < Number_Of_Items; j++)
{
- item = menu->items[i=(col * Number_Of_Rows + row)];
-
- Last_in_Column = (menu->cols-1) * Number_Of_Rows + row;
-
- item->left = (col) ?
+ item = menu->items[i = (col * Number_Of_Rows + row)];
+
+ Last_in_Column = (menu->cols - 1) * Number_Of_Rows + row;
+
+ item->left = (col) ?
menu->items[i - Number_Of_Rows] :
- (cycle ? (Last_in_Column >= Number_Of_Items ) ?
- menu->items[Last_in_Column-Number_Of_Rows] :
- menu->items[Last_in_Column] :
- (ITEM *)0 );
-
- item->right = ((i + Number_Of_Rows) <Number_Of_Items)
- ?
- menu->items[i + Number_Of_Rows] :
- (cycle ? menu->items[row] : (ITEM *)0);
-
+ (cycle ? (Last_in_Column >= Number_Of_Items) ?
+ menu->items[Last_in_Column - Number_Of_Rows] :
+ menu->items[Last_in_Column] :
+ (ITEM *) 0);
+
+ item->right = ((i + Number_Of_Rows) < Number_Of_Items)
+ ?
+ menu->items[i + Number_Of_Rows] :
+ (cycle ? menu->items[row] : (ITEM *) 0);
+
Last_in_Row = col * Number_Of_Rows + (Number_Of_Rows - 1);
-
- item->up = (row) ?
- menu->items[i-1] :
- (cycle ?
- menu->items[(Last_in_Row>=Number_Of_Items) ?
- Number_Of_Items-1:
- Last_in_Row] :
- (ITEM *)0);
-
- item->down = (row < (Number_Of_Rows-1))
- ?
- (menu->items[((i+1)<Number_Of_Items) ?
- i+1 :
- (col-1)*Number_Of_Rows + row + 1]) :
- (cycle ?
- menu->items[col * Number_Of_Rows] :
- (ITEM *)0
- );
-
+
+ item->up = (row) ?
+ menu->items[i - 1] :
+ (cycle ?
+ menu->items[(Last_in_Row >= Number_Of_Items) ?
+ Number_Of_Items - 1 :
+ Last_in_Row] :
+ (ITEM *) 0);
+
+ item->down = (row < (Number_Of_Rows - 1))
+ ?
+ (menu->items[((i + 1) < Number_Of_Items) ?
+ i + 1 :
+ (col - 1) * Number_Of_Rows + row + 1]) :
+ (cycle ?
+ menu->items[col * Number_Of_Rows] :
+ (ITEM *) 0
+ );
+
item->x = col;
item->y = row;
- if ( (++row) == Number_Of_Rows )
+ if ((++row) == Number_Of_Rows)
{
col++;
row = 0;
@@ -398,31 +503,31 @@ _nc_Link_Items (MENU * menu)
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void)
-_nc_Show_Menu (const MENU *menu)
+_nc_Show_Menu(const MENU * menu)
{
WINDOW *win;
int maxy, maxx;
-
+
assert(menu);
- if ( (menu->status & _POSTED) && !(menu->status & _IN_DRIVER) )
+ if ((menu->status & _POSTED) && !(menu->status & _IN_DRIVER))
{
/* adjust the internal subwindow to start on the current top */
assert(menu->sub);
- mvderwin(menu->sub,menu->spc_rows * menu->toprow,0);
+ mvderwin(menu->sub, menu->spc_rows * menu->toprow, 0);
win = Get_Menu_Window(menu);
-
+
maxy = getmaxy(win);
- maxx = getmaxx(win);
-
- if (menu->height < maxy)
+ maxx = getmaxx(win);
+
+ if (menu->height < maxy)
maxy = menu->height;
- if (menu->width < maxx)
+ if (menu->width < maxx)
maxx = menu->width;
-
- copywin(menu->sub,win,0,0,0,0,maxy-1,maxx-1,0);
+
+ copywin(menu->sub, win, 0, 0, 0, 0, maxy - 1, maxx - 1, 0);
pos_menu_cursor(menu);
- }
-}
+ }
+}
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -438,41 +543,41 @@ _nc_Show_Menu (const MENU *menu)
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void)
-_nc_New_TopRow_and_CurrentItem
-(MENU *menu, int new_toprow, ITEM *new_current_item)
+ _nc_New_TopRow_and_CurrentItem
+ (MENU * menu, int new_toprow, ITEM * new_current_item)
{
ITEM *cur_item;
bool mterm_called = FALSE;
bool iterm_called = FALSE;
-
+
assert(menu);
if (menu->status & _POSTED)
{
if (new_current_item != menu->curitem)
{
- Call_Hook(menu,itemterm);
+ Call_Hook(menu, itemterm);
iterm_called = TRUE;
}
if (new_toprow != menu->toprow)
{
- Call_Hook(menu,menuterm);
+ Call_Hook(menu, menuterm);
mterm_called = TRUE;
- }
-
- cur_item = menu->curitem;
+ }
+
+ cur_item = menu->curitem;
assert(cur_item);
- menu->toprow = new_toprow;
- menu->curitem = new_current_item;
-
+ menu->toprow = new_toprow;
+ menu->curitem = new_current_item;
+
if (mterm_called)
{
- Call_Hook(menu,menuinit);
+ Call_Hook(menu, menuinit);
}
if (iterm_called)
{
/* this means, move from the old current_item to the new one... */
- Move_To_Current_Item( menu, cur_item );
- Call_Hook(menu,iteminit);
+ Move_To_Current_Item(menu, cur_item);
+ Call_Hook(menu, iteminit);
}
if (mterm_called || iterm_called)
{
@@ -482,8 +587,8 @@ _nc_New_TopRow_and_CurrentItem
pos_menu_cursor(menu);
}
else
- { /* if we are not posted, this is quite simple */
- menu->toprow = new_toprow;
+ { /* if we are not posted, this is quite simple */
+ menu->toprow = new_toprow;
menu->curitem = new_current_item;
}
}
diff --git a/contrib/ncurses/menu/m_hook.c b/contrib/ncurses/menu/m_hook.c
index 783ec007ba7b..8d768a303ffc 100644
--- a/contrib/ncurses/menu/m_hook.c
+++ b/contrib/ncurses/menu/m_hook.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,12 +37,13 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_hook.c,v 1.9 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_hook.c,v 1.14 2004/12/25 21:39:52 tom Exp $")
/* "Template" macro to generate function to set application specific hook */
#define GEN_HOOK_SET_FUNCTION( typ, name ) \
NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\
{\
+ T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), menu, func));\
(Normalize_Menu(menu) -> typ ## name = func );\
RETURN(E_OK);\
}
@@ -51,7 +52,8 @@ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook f
#define GEN_HOOK_GET_FUNCTION( typ, name ) \
NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\
{\
- return (Normalize_Menu(menu) -> typ ## name);\
+ T((T_CALLED(#typ "_" #name "(%p)"), menu));\
+ returnMenuHook(Normalize_Menu(menu) -> typ ## name);\
}
/*---------------------------------------------------------------------------
@@ -63,7 +65,7 @@ NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\
|
| Return Values : E_OK - success
+--------------------------------------------------------------------------*/
-GEN_HOOK_SET_FUNCTION( menu, init )
+GEN_HOOK_SET_FUNCTION(menu, init)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -75,7 +77,7 @@ GEN_HOOK_SET_FUNCTION( menu, init )
|
| Return Values : Menu init function address or NULL
+--------------------------------------------------------------------------*/
-GEN_HOOK_GET_FUNCTION( menu, init )
+GEN_HOOK_GET_FUNCTION(menu, init)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -86,7 +88,7 @@ GEN_HOOK_GET_FUNCTION( menu, init )
|
| Return Values : E_OK - success
+--------------------------------------------------------------------------*/
-GEN_HOOK_SET_FUNCTION( menu, term )
+GEN_HOOK_SET_FUNCTION(menu, term)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -98,7 +100,7 @@ GEN_HOOK_SET_FUNCTION( menu, term )
|
| Return Values : Menu finalization function address or NULL
+--------------------------------------------------------------------------*/
-GEN_HOOK_GET_FUNCTION( menu, term )
+GEN_HOOK_GET_FUNCTION(menu, term)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -109,7 +111,7 @@ GEN_HOOK_GET_FUNCTION( menu, term )
|
| Return Values : E_OK - success
+--------------------------------------------------------------------------*/
-GEN_HOOK_SET_FUNCTION( item, init )
+GEN_HOOK_SET_FUNCTION(item, init)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -121,7 +123,7 @@ GEN_HOOK_SET_FUNCTION( item, init )
|
| Return Values : Item init function address or NULL
+--------------------------------------------------------------------------*/
-GEN_HOOK_GET_FUNCTION( item, init )
+GEN_HOOK_GET_FUNCTION(item, init)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -132,7 +134,7 @@ GEN_HOOK_GET_FUNCTION( item, init )
|
| Return Values : E_OK - success
+--------------------------------------------------------------------------*/
-GEN_HOOK_SET_FUNCTION( item, term )
+GEN_HOOK_SET_FUNCTION(item, term)
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -144,6 +146,6 @@ GEN_HOOK_SET_FUNCTION( item, term )
|
| Return Values : Item finalization function address or NULL
+--------------------------------------------------------------------------*/
-GEN_HOOK_GET_FUNCTION( item, term )
+GEN_HOOK_GET_FUNCTION(item, term)
/* m_hook.c ends here */
diff --git a/contrib/ncurses/menu/m_item_cur.c b/contrib/ncurses/menu/m_item_cur.c
index a2b82ddb468a..dac12ed91c5e 100644
--- a/contrib/ncurses/menu/m_item_cur.c
+++ b/contrib/ncurses/menu/m_item_cur.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_item_cur.c,v 1.12 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_item_cur.c,v 1.17 2004/12/25 21:57:38 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -48,14 +48,16 @@ MODULE_ID("$Id: m_item_cur.c,v 1.12 2000/12/10 02:16:48 tom Exp $")
| Return Values : E_OK - success
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_current_item (MENU * menu, ITEM * item)
+set_current_item(MENU * menu, ITEM * item)
{
- if (menu && item && (item->imenu==menu))
+ T((T_CALLED("set_current_item(%p,%p)"), menu, item));
+
+ if (menu && item && (item->imenu == menu))
{
- if ( menu->status & _IN_DRIVER )
+ if (menu->status & _IN_DRIVER)
RETURN(E_BAD_STATE);
-
- assert( menu->curitem );
+
+ assert(menu->curitem);
if (item != menu->curitem)
{
if (menu->status & _LINK_NEEDED)
@@ -69,12 +71,12 @@ set_current_item (MENU * menu, ITEM * item)
assert(menu->pattern);
Reset_Pattern(menu);
/* adjust the window to make item visible and update the menu */
- Adjust_Current_Item(menu,menu->toprow,item);
+ Adjust_Current_Item(menu, menu->toprow, item);
}
}
else
RETURN(E_BAD_ARGUMENT);
-
+
RETURN(E_OK);
}
@@ -87,9 +89,10 @@ set_current_item (MENU * menu, ITEM * item)
| Return Values : Item pointer or NULL if failure
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(ITEM *)
-current_item (const MENU * menu)
+current_item(const MENU * menu)
{
- return (menu && menu->items) ? menu->curitem : (ITEM *)0;
+ T((T_CALLED("current_item(%p)"), menu));
+ returnItem((menu && menu->items) ? menu->curitem : (ITEM *) 0);
}
/*---------------------------------------------------------------------------
@@ -101,9 +104,10 @@ current_item (const MENU * menu)
| Return Values : The index or ERR if this is an invalid item pointer
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-item_index (const ITEM *item)
+item_index(const ITEM * item)
{
- return (item && item->imenu) ? item->index : ERR;
+ T((T_CALLED("item_index(%p)"), item));
+ returnCode((item && item->imenu) ? item->index : ERR);
}
/* m_item_cur.c ends here */
diff --git a/contrib/ncurses/menu/m_item_nam.c b/contrib/ncurses/menu/m_item_nam.c
index 0fa8e59d6876..05a169340b45 100644
--- a/contrib/ncurses/menu/m_item_nam.c
+++ b/contrib/ncurses/menu/m_item_nam.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_item_nam.c,v 1.10 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_item_nam.c,v 1.14 2004/12/25 21:41:54 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -48,11 +48,12 @@ MODULE_ID("$Id: m_item_nam.c,v 1.10 2000/12/10 02:16:48 tom Exp $")
| Return Values : See above; returns NULL if item is invalid
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(const char *)
-item_name (const ITEM * item)
+item_name(const ITEM * item)
{
- return ((item) ? item->name.str : (char *)0);
+ T((T_CALLED("item_name(%p)"), item));
+ returnCPtr((item) ? item->name.str : (char *)0);
}
-
+
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : char *item_description(const ITEM *item)
@@ -62,9 +63,10 @@ item_name (const ITEM * item)
| Return Values : See above; Returns NULL if item is invalid
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(const char *)
-item_description (const ITEM * item)
+item_description(const ITEM * item)
{
- return ((item) ? item->description.str : (char *)0);
+ T((T_CALLED("item_description(%p)"), item));
+ returnCPtr((item) ? item->description.str : (char *)0);
}
/* m_item_nam.c ends here */
diff --git a/contrib/ncurses/menu/m_item_new.c b/contrib/ncurses/menu/m_item_new.c
index 89e4469b8aa3..d7fe1f8542c2 100644
--- a/contrib/ncurses/menu/m_item_new.c
+++ b/contrib/ncurses/menu/m_item_new.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2006 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -38,7 +38,13 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_item_new.c,v 1.12 2000/12/10 02:16:48 tom Exp $")
+#if USE_WIDEC_SUPPORT
+#if HAVE_WCTYPE_H
+#include <wctype.h>
+#endif
+#endif
+
+MODULE_ID("$Id: m_item_new.c,v 1.27 2006/12/17 19:47:09 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -50,16 +56,44 @@ MODULE_ID("$Id: m_item_new.c,v 1.12 2000/12/10 02:16:48 tom Exp $")
| Return Values : TRUE - if string is printable
| FALSE - if string contains non-printable characters
+--------------------------------------------------------------------------*/
-static bool Is_Printable_String(const char *s)
+static bool
+Is_Printable_String(const char *s)
{
+ int result = TRUE;
+
+#if USE_WIDEC_SUPPORT
+ int count = mbstowcs(0, s, 0);
+ wchar_t *temp = 0;
+
+ assert(s);
+
+ if (count > 0
+ && (temp = typeCalloc(wchar_t, (2 + (unsigned)count))) != 0)
+ {
+ int n;
+
+ mbstowcs(temp, s, (unsigned)count);
+ for (n = 0; n < count; ++n)
+ if (!iswprint((wint_t) temp[n]))
+ {
+ result = FALSE;
+ break;
+ }
+ free(temp);
+ }
+#else
assert(s);
- while(*s)
+ while (*s)
{
- if (!isprint((unsigned char)*s))
- return FALSE;
+ if (!isprint(UChar(*s)))
+ {
+ result = FALSE;
+ break;
+ }
s++;
}
- return TRUE;
+#endif
+ return result;
}
/*---------------------------------------------------------------------------
@@ -73,41 +107,45 @@ static bool Is_Printable_String(const char *s)
| Return Values : The item pointer or NULL if creation failed.
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(ITEM *)
-new_item (const char *name, const char *description)
+new_item(const char *name, const char *description)
{
ITEM *item;
-
- if ( !name || (*name == '\0') || !Is_Printable_String(name) )
+
+ T((T_CALLED("new_item(\"%s\", \"%s\")"),
+ name ? name : "",
+ description ? description : ""));
+
+ if (!name || (*name == '\0') || !Is_Printable_String(name))
{
- item = (ITEM *)0;
- SET_ERROR( E_BAD_ARGUMENT );
+ item = (ITEM *) 0;
+ SET_ERROR(E_BAD_ARGUMENT);
}
else
{
- item = (ITEM *)calloc(1,sizeof(ITEM));
+ item = (ITEM *) calloc(1, sizeof(ITEM));
if (item)
{
- *item = _nc_Default_Item; /* hope we have struct assignment */
-
- item->name.length = strlen(name);
- item->name.str = name;
+ *item = _nc_Default_Item; /* hope we have struct assignment */
+
+ item->name.length = strlen(name);
+ item->name.str = name;
- if (description && (*description != '\0') &&
+ if (description && (*description != '\0') &&
Is_Printable_String(description))
{
- item->description.length = strlen(description);
- item->description.str = description;
+ item->description.length = strlen(description);
+ item->description.str = description;
}
else
{
item->description.length = 0;
- item->description.str = (char *)0;
+ item->description.str = (char *)0;
}
}
else
- SET_ERROR( E_SYSTEM_ERROR );
- }
- return(item);
+ SET_ERROR(E_SYSTEM_ERROR);
+ }
+ returnItem(item);
}
/*---------------------------------------------------------------------------
@@ -122,17 +160,19 @@ new_item (const char *name, const char *description)
| E_CONNECTED - item is still connected to a menu
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-free_item (ITEM * item)
+free_item(ITEM * item)
{
+ T((T_CALLED("free_item(%p)"), item));
+
if (!item)
- RETURN( E_BAD_ARGUMENT );
+ RETURN(E_BAD_ARGUMENT);
if (item->imenu)
- RETURN( E_CONNECTED );
-
+ RETURN(E_CONNECTED);
+
free(item);
- RETURN( E_OK );
+ RETURN(E_OK);
}
/*---------------------------------------------------------------------------
@@ -153,16 +193,18 @@ free_item (ITEM * item)
| E_SYSTEM_ERROR - no memory to store mark
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_mark (MENU * menu, const char * mark)
+set_menu_mark(MENU * menu, const char *mark)
{
- int l;
+ unsigned l;
+
+ T((T_CALLED("set_menu_mark(%p,%s)"), menu, _nc_visbuf(mark)));
- if ( mark && (*mark != '\0') && Is_Printable_String(mark) )
+ if (mark && (*mark != '\0') && Is_Printable_String(mark))
l = strlen(mark);
else
l = 0;
- if ( menu )
+ if (menu)
{
char *old_mark = menu->mark;
unsigned short old_status = menu->status;
@@ -171,13 +213,13 @@ set_menu_mark (MENU * menu, const char * mark)
{
/* If the menu is already posted, the geometry is fixed. Then
we can only accept a mark with exactly the same length */
- if (menu->marklen != l)
+ if (menu->marklen != (int)l)
RETURN(E_BAD_ARGUMENT);
- }
+ }
menu->marklen = l;
if (l)
{
- menu->mark = (char *)malloc(l+1);
+ menu->mark = (char *)malloc(l + 1);
if (menu->mark)
{
strcpy(menu->mark, mark);
@@ -192,24 +234,24 @@ set_menu_mark (MENU * menu, const char * mark)
}
else
menu->mark = (char *)0;
-
+
if ((old_status & _MARK_ALLOCATED) && old_mark)
free(old_mark);
if (menu->status & _POSTED)
{
- _nc_Draw_Menu( menu );
- _nc_Show_Menu( menu );
+ _nc_Draw_Menu(menu);
+ _nc_Show_Menu(menu);
}
else
{
/* Recalculate the geometry */
- _nc_Calculate_Item_Length_and_Width( menu );
+ _nc_Calculate_Item_Length_and_Width(menu);
}
}
else
{
- return set_menu_mark(&_nc_Default_Menu, mark);
+ returnCode(set_menu_mark(&_nc_Default_Menu, mark));
}
RETURN(E_OK);
}
@@ -223,9 +265,10 @@ set_menu_mark (MENU * menu, const char * mark)
| Return Values : The marker string pointer or NULL if no marker defined
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(const char *)
-menu_mark (const MENU * menu)
+menu_mark(const MENU * menu)
{
- return Normalize_Menu( menu )->mark;
+ T((T_CALLED("menu_mark(%p)"), menu));
+ returnPtr(Normalize_Menu(menu)->mark);
}
/* m_item_new.c */
diff --git a/contrib/ncurses/menu/m_item_opt.c b/contrib/ncurses/menu/m_item_opt.c
index c31ee49172d0..cfe7b75db392 100644
--- a/contrib/ncurses/menu/m_item_opt.c
+++ b/contrib/ncurses/menu/m_item_opt.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_item_opt.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_item_opt.c,v 1.17 2004/12/25 21:32:54 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -51,34 +51,36 @@ MODULE_ID("$Id: m_item_opt.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
| E_BAD_ARGUMENT - invalid item options
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_item_opts (ITEM *item, Item_Options opts)
-{
+set_item_opts(ITEM * item, Item_Options opts)
+{
+ T((T_CALLED("set_menu_opts(%p,%d)"), item, opts));
+
opts &= ALL_ITEM_OPTS;
if (opts & ~ALL_ITEM_OPTS)
RETURN(E_BAD_ARGUMENT);
-
+
if (item)
{
if (item->opt != opts)
- {
+ {
MENU *menu = item->imenu;
-
+
item->opt = opts;
-
+
if ((!(opts & O_SELECTABLE)) && item->value)
item->value = FALSE;
-
+
if (menu && (menu->status & _POSTED))
{
- Move_And_Post_Item( menu, item );
+ Move_And_Post_Item(menu, item);
_nc_Show_Menu(menu);
}
}
}
else
_nc_Default_Item.opt = opts;
-
+
RETURN(E_OK);
}
@@ -92,18 +94,21 @@ set_item_opts (ITEM *item, Item_Options opts)
| E_BAD_ARGUMENT - invalid options
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-item_opts_off (ITEM *item, Item_Options opts)
-{
- ITEM *citem = item; /* use a copy because set_item_opts must detect
- NULL item itself to adjust its behaviour */
+item_opts_off(ITEM * item, Item_Options opts)
+{
+ ITEM *citem = item; /* use a copy because set_item_opts must detect
+
+ NULL item itself to adjust its behavior */
+
+ T((T_CALLED("item_opts_off(%p,%d)"), item, opts));
if (opts & ~ALL_ITEM_OPTS)
RETURN(E_BAD_ARGUMENT);
else
{
- Normalize_Item(citem);
+ Normalize_Item(citem);
opts = citem->opt & ~(opts & ALL_ITEM_OPTS);
- return set_item_opts( item, opts );
+ returnCode(set_item_opts(item, opts));
}
}
@@ -117,11 +122,14 @@ item_opts_off (ITEM *item, Item_Options opts)
| E_BAD_ARGUMENT - invalid options
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-item_opts_on (ITEM *item, Item_Options opts)
+item_opts_on(ITEM * item, Item_Options opts)
{
- ITEM *citem = item; /* use a copy because set_item_opts must detect
- NULL item itself to adjust its behaviour */
-
+ ITEM *citem = item; /* use a copy because set_item_opts must detect
+
+ NULL item itself to adjust its behavior */
+
+ T((T_CALLED("item_opts_on(%p,%d)"), item, opts));
+
opts &= ALL_ITEM_OPTS;
if (opts & ~ALL_ITEM_OPTS)
RETURN(E_BAD_ARGUMENT);
@@ -129,7 +137,7 @@ item_opts_on (ITEM *item, Item_Options opts)
{
Normalize_Item(citem);
opts = citem->opt | opts;
- return set_item_opts( item, opts );
+ returnCode(set_item_opts(item, opts));
}
}
@@ -142,9 +150,10 @@ item_opts_on (ITEM *item, Item_Options opts)
| Return Values : Items options
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(Item_Options)
-item_opts (const ITEM * item)
+item_opts(const ITEM * item)
{
- return (ALL_ITEM_OPTS & Normalize_Item(item)->opt);
+ T((T_CALLED("item_opts(%p)"), item));
+ returnItemOpts(ALL_ITEM_OPTS & Normalize_Item(item)->opt);
}
/* m_item_opt.c ends here */
diff --git a/contrib/ncurses/menu/m_item_top.c b/contrib/ncurses/menu/m_item_top.c
index 1d751d94d8cb..7268a0e49f15 100644
--- a/contrib/ncurses/menu/m_item_top.c
+++ b/contrib/ncurses/menu/m_item_top.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,48 +37,50 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_item_top.c,v 1.5 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_item_top.c,v 1.10 2004/12/11 23:29:34 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : int set_top_row(MENU *menu, int row)
|
-| Description : Makes the speified row the top row in the menu
+| Description : Makes the specified row the top row in the menu
|
| Return Values : E_OK - success
| E_BAD_ARGUMENT - not a menu pointer or invalid row
| E_NOT_CONNECTED - there are no items for the menu
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_top_row (MENU * menu, int row)
+set_top_row(MENU * menu, int row)
{
ITEM *item;
-
+
+ T((T_CALLED("set_top_row(%p,%d)"), menu, row));
+
if (menu)
{
- if ( menu->status & _IN_DRIVER )
+ if (menu->status & _IN_DRIVER)
RETURN(E_BAD_STATE);
- if (menu->items == (ITEM **)0)
+ if (menu->items == (ITEM **) 0)
RETURN(E_NOT_CONNECTED);
-
- if ((row<0) || (row > (menu->rows - menu->arows)))
+
+ if ((row < 0) || (row > (menu->rows - menu->arows)))
RETURN(E_BAD_ARGUMENT);
}
else
RETURN(E_BAD_ARGUMENT);
-
+
if (row != menu->toprow)
{
- if (menu->status & _LINK_NEEDED)
+ if (menu->status & _LINK_NEEDED)
_nc_Link_Items(menu);
-
- item = menu->items[ (menu->opt&O_ROWMAJOR) ? (row*menu->cols) : row ];
+
+ item = menu->items[(menu->opt & O_ROWMAJOR) ? (row * menu->cols) : row];
assert(menu->pattern);
Reset_Pattern(menu);
_nc_New_TopRow_and_CurrentItem(menu, row, item);
}
-
- RETURN(E_OK);
+
+ RETURN(E_OK);
}
/*---------------------------------------------------------------------------
@@ -90,15 +92,16 @@ set_top_row (MENU * menu, int row)
| Return Values : The row number or ERR if there is no row
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-top_row (const MENU * menu)
+top_row(const MENU * menu)
{
+ T((T_CALLED("top_row(%p)"), menu));
if (menu && menu->items && *(menu->items))
{
- assert( (menu->toprow>=0) && (menu->toprow < menu->rows) );
- return menu->toprow;
+ assert((menu->toprow >= 0) && (menu->toprow < menu->rows));
+ returnCode(menu->toprow);
}
else
- return(ERR);
+ returnCode(ERR);
}
/* m_item_top.c ends here */
diff --git a/contrib/ncurses/menu/m_item_use.c b/contrib/ncurses/menu/m_item_use.c
index 1217735e4703..06a5baf984e8 100644
--- a/contrib/ncurses/menu/m_item_use.c
+++ b/contrib/ncurses/menu/m_item_use.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_item_use.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_item_use.c,v 1.16 2004/12/25 21:33:31 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -49,10 +49,11 @@ MODULE_ID("$Id: m_item_use.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
| Return Values : E_OK - success
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_item_userptr (ITEM * item, void * userptr)
+set_item_userptr(ITEM * item, void *userptr)
{
+ T((T_CALLED("set_item_userptr(%p,%p)"), item, userptr));
Normalize_Item(item)->userptr = userptr;
- RETURN( E_OK );
+ RETURN(E_OK);
}
/*---------------------------------------------------------------------------
@@ -66,9 +67,10 @@ set_item_userptr (ITEM * item, void * userptr)
| NULL is returned.
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void *)
-item_userptr (const ITEM * item)
+item_userptr(const ITEM * item)
{
- return Normalize_Item(item)->userptr;
+ T((T_CALLED("item_userptr(%p)"), item));
+ returnVoidPtr(Normalize_Item(item)->userptr);
}
/* m_item_use.c */
diff --git a/contrib/ncurses/menu/m_item_val.c b/contrib/ncurses/menu/m_item_val.c
index 48bde3ae4eba..cebf693fbd34 100644
--- a/contrib/ncurses/menu/m_item_val.c
+++ b/contrib/ncurses/menu/m_item_val.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,13 +37,13 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_item_val.c,v 1.9 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_item_val.c,v 1.14 2004/12/11 23:29:34 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : int set_item_value(ITEM *item, int value)
|
-| Description : Programmatically set the items selection value. This is
+| Description : Programmatically set the item's selection value. This is
| only allowed if the item is selectable at all and if
| it is not connected to a single-valued menu.
| If the item is connected to a posted menu, the menu
@@ -53,18 +53,19 @@ MODULE_ID("$Id: m_item_val.c,v 1.9 2000/12/10 02:16:48 tom Exp $")
| E_REQUEST_DENIED - not selectable or single valued menu
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_item_value (ITEM *item, bool value)
+set_item_value(ITEM * item, bool value)
{
MENU *menu;
-
+
+ T((T_CALLED("set_item_value(%p,%d)"), item, value));
if (item)
{
menu = item->imenu;
-
+
if ((!(item->opt & O_SELECTABLE)) ||
- (menu && (menu->opt & O_ONEVALUE)))
+ (menu && (menu->opt & O_ONEVALUE)))
RETURN(E_REQUEST_DENIED);
-
+
if (item->value ^ value)
{
item->value = value ? TRUE : FALSE;
@@ -72,7 +73,7 @@ set_item_value (ITEM *item, bool value)
{
if (menu->status & _POSTED)
{
- Move_And_Post_Item(menu,item);
+ Move_And_Post_Item(menu, item);
_nc_Show_Menu(menu);
}
}
@@ -80,7 +81,7 @@ set_item_value (ITEM *item, bool value)
}
else
_nc_Default_Item.value = value;
-
+
RETURN(E_OK);
}
@@ -94,9 +95,10 @@ set_item_value (ITEM *item, bool value)
| FALSE - if item is not selected
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(bool)
-item_value (const ITEM *item)
+item_value(const ITEM * item)
{
- return ((Normalize_Item(item)->value) ? TRUE : FALSE);
+ T((T_CALLED("item_value(%p)"), item));
+ returnBool((Normalize_Item(item)->value) ? TRUE : FALSE);
}
/* m_item_val.c ends here */
diff --git a/contrib/ncurses/menu/m_item_vis.c b/contrib/ncurses/menu/m_item_vis.c
index 9a2255e24331..f8fb97f028cb 100644
--- a/contrib/ncurses/menu/m_item_vis.c
+++ b/contrib/ncurses/menu/m_item_vis.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_item_vis.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_item_vis.c,v 1.15 2004/12/25 21:40:09 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -50,18 +50,19 @@ MODULE_ID("$Id: m_item_vis.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
| FALSE if invisible
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(bool)
-item_visible (const ITEM * item)
+item_visible(const ITEM * item)
{
MENU *menu;
-
- if ( item &&
- (menu=item->imenu) &&
- (menu->status & _POSTED) &&
- ( (menu->toprow + menu->arows) > (item->y) ) &&
- ( item->y >= menu->toprow) )
- return TRUE;
+
+ T((T_CALLED("item_visible(%p)"), item));
+ if (item &&
+ (menu = item->imenu) &&
+ (menu->status & _POSTED) &&
+ ((menu->toprow + menu->arows) > (item->y)) &&
+ (item->y >= menu->toprow))
+ returnBool(TRUE);
else
- return FALSE;
+ returnBool(FALSE);
}
/* m_item_vis.c ends here */
diff --git a/contrib/ncurses/menu/m_items.c b/contrib/ncurses/menu/m_items.c
index 3e21d2d15ef5..3e8f70b0fa7d 100644
--- a/contrib/ncurses/menu/m_items.c
+++ b/contrib/ncurses/menu/m_items.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2005 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_items.c,v 1.9 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_items.c,v 1.16 2005/01/16 01:02:23 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -53,39 +53,42 @@ MODULE_ID("$Id: m_items.c,v 1.9 2000/12/10 02:16:48 tom Exp $")
| passed to the function
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_items (MENU * menu, ITEM ** items)
+set_menu_items(MENU * menu, ITEM ** items)
{
+ T((T_CALLED("set_menu_items(%p,%p)"), menu, items));
+
if (!menu || (items && !(*items)))
RETURN(E_BAD_ARGUMENT);
-
- if ( menu->status & _POSTED )
+
+ if (menu->status & _POSTED)
RETURN(E_POSTED);
-
+
if (menu->items)
_nc_Disconnect_Items(menu);
-
+
if (items)
{
- if(!_nc_Connect_Items( menu, items ))
+ if (!_nc_Connect_Items(menu, items))
RETURN(E_CONNECTED);
}
-
+
menu->items = items;
RETURN(E_OK);
-}
+}
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : ITEM **menu_items(const MENU *menu)
|
-| Description : Returns a pointer to the item pointer arry of the menu
+| Description : Returns a pointer to the item pointer array of the menu
|
| Return Values : NULL on error
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(ITEM **)
-menu_items (const MENU *menu)
+menu_items(const MENU * menu)
{
- return(menu ? menu->items : (ITEM **)0);
+ T((T_CALLED("menu_items(%p)"), menu));
+ returnItemPtr(menu ? menu->items : (ITEM **) 0);
}
/*---------------------------------------------------------------------------
@@ -98,9 +101,10 @@ menu_items (const MENU *menu)
| Return Values : Number of items or -1 to indicate error.
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-item_count (const MENU *menu)
+item_count(const MENU * menu)
{
- return(menu ? menu->nitems : -1);
+ T((T_CALLED("item_count(%p)"), menu));
+ returnCode(menu ? menu->nitems : -1);
}
/* m_items.c ends here */
diff --git a/contrib/ncurses/menu/m_new.c b/contrib/ncurses/menu/m_new.c
index fc2642a7ce74..c20c66517790 100644
--- a/contrib/ncurses/menu/m_new.c
+++ b/contrib/ncurses/menu/m_new.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2006 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_new.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_new.c,v 1.18 2006/11/04 19:04:06 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -51,10 +51,12 @@ MODULE_ID("$Id: m_new.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
| Return Values : NULL on error
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(MENU *)
-new_menu (ITEM ** items)
+new_menu(ITEM ** items)
{
- MENU *menu = (MENU *)calloc(1,sizeof(MENU));
-
+ int err = E_SYSTEM_ERROR;
+ MENU *menu = (MENU *) calloc(1, sizeof(MENU));
+
+ T((T_CALLED("new_menu(%p)"), items));
if (menu)
{
*menu = _nc_Default_Menu;
@@ -63,18 +65,19 @@ new_menu (ITEM ** items)
menu->cols = menu->fcols;
if (items && *items)
{
- if (!_nc_Connect_Items(menu,items))
+ if (!_nc_Connect_Items(menu, items))
{
+ err = E_NOT_CONNECTED;
free(menu);
- menu = (MENU *)0;
+ menu = (MENU *) 0;
}
}
}
if (!menu)
- SET_ERROR(E_SYSTEM_ERROR);
+ SET_ERROR(err);
- return(menu);
+ returnMenu(menu);
}
/*---------------------------------------------------------------------------
@@ -89,17 +92,18 @@ new_menu (ITEM ** items)
| E_POSTED - Menu is already posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-free_menu (MENU * menu)
+free_menu(MENU * menu)
{
+ T((T_CALLED("free_menu(%p)"), menu));
if (!menu)
RETURN(E_BAD_ARGUMENT);
-
- if ( menu->status & _POSTED )
+
+ if (menu->status & _POSTED)
RETURN(E_POSTED);
-
- if (menu->items)
+
+ if (menu->items)
_nc_Disconnect_Items(menu);
-
+
if ((menu->status & _MARK_ALLOCATED) && menu->mark)
free(menu->mark);
diff --git a/contrib/ncurses/menu/m_opts.c b/contrib/ncurses/menu/m_opts.c
index 96a5320f0248..a7370b06f8e5 100644
--- a/contrib/ncurses/menu/m_opts.c
+++ b/contrib/ncurses/menu/m_opts.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_opts.c,v 1.13 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_opts.c,v 1.19 2004/12/25 21:36:12 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -53,8 +53,10 @@ MODULE_ID("$Id: m_opts.c,v 1.13 2000/12/10 02:16:48 tom Exp $")
| E_POSTED - menu is already posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_opts (MENU * menu, Menu_Options opts)
+set_menu_opts(MENU * menu, Menu_Options opts)
{
+ T((T_CALLED("set_menu_opts(%p,%d)"), menu, opts));
+
opts &= ALL_MENU_OPTS;
if (opts & ~ALL_MENU_OPTS)
@@ -62,18 +64,18 @@ set_menu_opts (MENU * menu, Menu_Options opts)
if (menu)
{
- if ( menu->status & _POSTED )
+ if (menu->status & _POSTED)
RETURN(E_POSTED);
- if ( (opts&O_ROWMAJOR) != (menu->opt&O_ROWMAJOR))
+ if ((opts & O_ROWMAJOR) != (menu->opt & O_ROWMAJOR))
{
/* we need this only if the layout really changed ... */
if (menu->items && menu->items[0])
{
- menu->toprow = 0;
+ menu->toprow = 0;
menu->curitem = menu->items[0];
assert(menu->curitem);
- set_menu_format( menu, menu->frows, menu->fcols );
+ set_menu_format(menu, menu->frows, menu->fcols);
}
}
@@ -83,13 +85,13 @@ set_menu_opts (MENU * menu, Menu_Options opts)
{
ITEM **item;
- if ( ((item=menu->items) != (ITEM**)0) )
- for(;*item;item++)
+ if (((item = menu->items) != (ITEM **) 0))
+ for (; *item; item++)
(*item)->value = FALSE;
}
if (opts & O_SHOWDESC) /* this also changes the geometry */
- _nc_Calculate_Item_Length_and_Width( menu );
+ _nc_Calculate_Item_Length_and_Width(menu);
}
else
_nc_Default_Menu.opt = opts;
@@ -111,10 +113,13 @@ set_menu_opts (MENU * menu, Menu_Options opts)
| E_POSTED - menu is already posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-menu_opts_off (MENU *menu, Menu_Options opts)
+menu_opts_off(MENU * menu, Menu_Options opts)
{
- MENU *cmenu = menu; /* use a copy because set_menu_opts must detect
- NULL menu itself to adjust its behaviour */
+ MENU *cmenu = menu; /* use a copy because set_menu_opts must detect
+
+ NULL menu itself to adjust its behavior */
+
+ T((T_CALLED("menu_opts_off(%p,%d)"), menu, opts));
opts &= ALL_MENU_OPTS;
if (opts & ~ALL_MENU_OPTS)
@@ -123,7 +128,7 @@ menu_opts_off (MENU *menu, Menu_Options opts)
{
Normalize_Menu(cmenu);
opts = cmenu->opt & ~opts;
- return set_menu_opts( menu, opts );
+ returnCode(set_menu_opts(menu, opts));
}
}
@@ -141,10 +146,13 @@ menu_opts_off (MENU *menu, Menu_Options opts)
| E_POSTED - menu is already posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-menu_opts_on (MENU * menu, Menu_Options opts)
+menu_opts_on(MENU * menu, Menu_Options opts)
{
- MENU *cmenu = menu; /* use a copy because set_menu_opts must detect
- NULL menu itself to adjust its behaviour */
+ MENU *cmenu = menu; /* use a copy because set_menu_opts must detect
+
+ NULL menu itself to adjust its behavior */
+
+ T((T_CALLED("menu_opts_on(%p,%d)"), menu, opts));
opts &= ALL_MENU_OPTS;
if (opts & ~ALL_MENU_OPTS)
@@ -153,7 +161,7 @@ menu_opts_on (MENU * menu, Menu_Options opts)
{
Normalize_Menu(cmenu);
opts = cmenu->opt | opts;
- return set_menu_opts(menu, opts);
+ returnCode(set_menu_opts(menu, opts));
}
}
@@ -166,9 +174,10 @@ menu_opts_on (MENU * menu, Menu_Options opts)
| Return Values : Menu options
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(Menu_Options)
-menu_opts (const MENU *menu)
+menu_opts(const MENU * menu)
{
- return (ALL_MENU_OPTS & Normalize_Menu( menu )->opt);
+ T((T_CALLED("menu_opts(%p)"), menu));
+ returnMenuOpts(ALL_MENU_OPTS & Normalize_Menu(menu)->opt);
}
/* m_opts.c ends here */
diff --git a/contrib/ncurses/menu/m_pad.c b/contrib/ncurses/menu/m_pad.c
index d7161e289a1e..76083ba36d34 100644
--- a/contrib/ncurses/menu/m_pad.c
+++ b/contrib/ncurses/menu/m_pad.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_pad.c,v 1.5 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_pad.c,v 1.10 2004/12/25 21:40:58 tom Exp $")
/* Macro to redraw menu if it is posted and changed */
#define Refresh_Menu(menu) \
@@ -59,18 +59,20 @@ MODULE_ID("$Id: m_pad.c,v 1.5 2000/12/10 02:16:48 tom Exp $")
| E_BAD_ARGUMENT - an invalid value has been passed
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_pad (MENU *menu, int pad)
+set_menu_pad(MENU * menu, int pad)
{
- bool do_refresh = (menu != (MENU*)0);
+ bool do_refresh = (menu != (MENU *) 0);
- if (!isprint((unsigned char)pad))
+ T((T_CALLED("set_menu_pad(%p,%d)"), menu, pad));
+
+ if (!isprint(UChar(pad)))
RETURN(E_BAD_ARGUMENT);
-
- Normalize_Menu( menu );
+
+ Normalize_Menu(menu);
menu->pad = pad;
-
+
if (do_refresh)
- Refresh_Menu( menu );
+ Refresh_Menu(menu);
RETURN(E_OK);
}
@@ -84,9 +86,10 @@ set_menu_pad (MENU *menu, int pad)
| Return Values : The pad character
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-menu_pad (const MENU * menu)
+menu_pad(const MENU * menu)
{
- return (Normalize_Menu( menu ) -> pad);
+ T((T_CALLED("menu_pad(%p)"), menu));
+ returnCode(Normalize_Menu(menu)->pad);
}
/* m_pad.c ends here */
diff --git a/contrib/ncurses/menu/m_pattern.c b/contrib/ncurses/menu/m_pattern.c
index 3e0590038c8f..1171390e214c 100644
--- a/contrib/ncurses/menu/m_pattern.c
+++ b/contrib/ncurses/menu/m_pattern.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2005,2006 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_pattern.c,v 1.6 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_pattern.c,v 1.15 2006/11/04 18:46:39 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -51,9 +51,12 @@ MODULE_ID("$Id: m_pattern.c,v 1.6 2000/12/10 02:16:48 tom Exp $")
| PatternString - as expected
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(char *)
-menu_pattern (const MENU * menu)
+menu_pattern(const MENU * menu)
{
- return (menu ? (menu->pattern ? menu->pattern : "") : (char *)0);
+ static char empty[] = "";
+
+ T((T_CALLED("menu_pattern(%p)"), menu));
+ returnPtr(menu ? (menu->pattern ? menu->pattern : empty) : 0);
}
/*---------------------------------------------------------------------------
@@ -65,54 +68,56 @@ menu_pattern (const MENU * menu)
|
| Return Values : E_OK - success
| E_BAD_ARGUMENT - invalid menu or pattern pointer
-| E_NOT_CONNECTED - no items connected to menu
| E_BAD_STATE - menu in user hook routine
+| E_NOT_CONNECTED - no items connected to menu
| E_NO_MATCH - no item matches pattern
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_pattern (MENU *menu, const char *p)
+set_menu_pattern(MENU * menu, const char *p)
{
ITEM *matchitem;
- int matchpos;
-
- if (!menu || !p)
+ int matchpos;
+
+ T((T_CALLED("set_menu_pattern(%p,%s)"), menu, _nc_visbuf(p)));
+
+ if (!menu || !p)
RETURN(E_BAD_ARGUMENT);
-
+
if (!(menu->items))
RETURN(E_NOT_CONNECTED);
-
- if ( menu->status & _IN_DRIVER )
+
+ if (menu->status & _IN_DRIVER)
RETURN(E_BAD_STATE);
-
+
Reset_Pattern(menu);
-
+
if (!(*p))
{
pos_menu_cursor(menu);
RETURN(E_OK);
}
-
- if (menu->status & _LINK_NEEDED)
+
+ if (menu->status & _LINK_NEEDED)
_nc_Link_Items(menu);
-
- matchpos = menu->toprow;
+
+ matchpos = menu->toprow;
matchitem = menu->curitem;
assert(matchitem);
-
- while(*p)
+
+ while (*p)
{
- if ( !isprint((unsigned char)(*p)) ||
- (_nc_Match_Next_Character_In_Item_Name(menu,*p,&matchitem) != E_OK) )
+ if (!isprint(UChar(*p)) ||
+ (_nc_Match_Next_Character_In_Item_Name(menu, *p, &matchitem) != E_OK))
{
Reset_Pattern(menu);
pos_menu_cursor(menu);
RETURN(E_NO_MATCH);
}
p++;
- }
-
+ }
+
/* This is reached if there was a match. So we position to the new item */
- Adjust_Current_Item(menu,matchpos,matchitem);
+ Adjust_Current_Item(menu, matchpos, matchitem);
RETURN(E_OK);
}
diff --git a/contrib/ncurses/menu/m_post.c b/contrib/ncurses/menu/m_post.c
index 0d24cc00618a..657d0f18420b 100644
--- a/contrib/ncurses/menu/m_post.c
+++ b/contrib/ncurses/menu/m_post.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,113 +37,117 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_post.c,v 1.17 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_post.c,v 1.26 2004/12/25 23:57:04 tom Exp $")
/*---------------------------------------------------------------------------
-| Facility : libnmenu
-| Function : void _nc_Post_Item(MENU *menu, ITEM *item)
-|
+| Facility : libnmenu
+| Function : void _nc_Post_Item(MENU *menu, ITEM *item)
+|
| Description : Draw the item in the menus window at the current
-| window position
+| window position
|
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void)
-_nc_Post_Item (const MENU * menu, const ITEM * item)
+_nc_Post_Item(const MENU * menu, const ITEM * item)
{
int i;
chtype ch;
int item_x, item_y;
int count = 0;
- bool isfore = FALSE, isback=FALSE, isgrey = FALSE;
-
+ bool isfore = FALSE, isback = FALSE, isgrey = FALSE;
+ int name_len;
+ int desc_len;
+
assert(menu->win);
-
- getyx(menu->win,item_y,item_x);
-
+
+ getyx(menu->win, item_y, item_x);
+
/* We need a marker iff
- it is a onevalued menu and it is the current item
- or it has a selection value
- */
- wattron(menu->win,menu->back);
- if (item->value || (item==menu->curitem))
+ */
+ wattron(menu->win, menu->back);
+ if (item->value || (item == menu->curitem))
{
- if (menu->marklen)
+ if (menu->marklen)
{
/* In a multi selection menu we use the fore attribute
for a selected marker that is not the current one.
This improves visualization of the menu, because now
always the 'normal' marker denotes the current
item. */
- if (!(menu->opt & O_ONEVALUE) && item->value && item!=menu->curitem)
+ if (!(menu->opt & O_ONEVALUE) && item->value && item != menu->curitem)
{
- wattron(menu->win,menu->fore);
+ wattron(menu->win, menu->fore);
isfore = TRUE;
}
- waddstr(menu->win,menu->mark);
+ waddstr(menu->win, menu->mark);
if (isfore)
{
- wattron(menu->win,menu->fore);
+ wattron(menu->win, menu->fore);
isfore = FALSE;
}
}
}
- else /* otherwise we have to wipe out the marker area */
- for(ch=' ',i=menu->marklen;i>0;i--)
- waddch(menu->win,ch);
- wattroff(menu->win,menu->back);
+ else /* otherwise we have to wipe out the marker area */
+ for (ch = ' ', i = menu->marklen; i > 0; i--)
+ waddch(menu->win, ch);
+ wattroff(menu->win, menu->back);
count += menu->marklen;
/* First we have to calculate the attribute depending on selectability
and selection status
- */
+ */
if (!(item->opt & O_SELECTABLE))
{
- wattron(menu->win,menu->grey);
+ wattron(menu->win, menu->grey);
isgrey = TRUE;
}
else
{
- if (item->value || item==menu->curitem)
+ if (item->value || item == menu->curitem)
{
- wattron(menu->win,menu->fore);
+ wattron(menu->win, menu->fore);
isfore = TRUE;
}
else
{
- wattron(menu->win,menu->back);
+ wattron(menu->win, menu->back);
isback = TRUE;
}
}
- waddnstr(menu->win,item->name.str,item->name.length);
- for(ch=' ',i=menu->namelen-item->name.length;i>0;i--)
+ waddnstr(menu->win, item->name.str, item->name.length);
+ name_len = _nc_Calculate_Text_Width(&(item->name));
+ for (ch = ' ', i = menu->namelen - name_len; i > 0; i--)
{
- waddch(menu->win,ch);
+ waddch(menu->win, ch);
}
count += menu->namelen;
/* Show description if required and available */
- if ( (menu->opt & O_SHOWDESC) && menu->desclen>0 )
+ if ((menu->opt & O_SHOWDESC) && menu->desclen > 0)
{
- int m = menu->spc_desc/2;
+ int m = menu->spc_desc / 2;
int cy = -1, cx = -1;
- for(ch=' ',i=0; i < menu->spc_desc; i++)
+ for (ch = ' ', i = 0; i < menu->spc_desc; i++)
{
- if (i==m)
+ if (i == m)
{
- waddch(menu->win,menu->pad);
- getyx(menu->win,cy,cx);
+ waddch(menu->win, menu->pad);
+ getyx(menu->win, cy, cx);
}
else
- waddch(menu->win,ch);
+ waddch(menu->win, ch);
}
if (item->description.length)
- waddnstr(menu->win,item->description.str,item->description.length);
- for(ch=' ',i=menu->desclen-item->description.length; i>0; i--)
+ waddnstr(menu->win, item->description.str, item->description.length);
+ desc_len = _nc_Calculate_Text_Width(&(item->description));
+ for (ch = ' ', i = menu->desclen - desc_len; i > 0; i--)
{
- waddch(menu->win,ch);
+ waddch(menu->win, ch);
}
count += menu->desclen + menu->spc_desc;
@@ -151,47 +155,49 @@ _nc_Post_Item (const MENU * menu, const ITEM * item)
{
int j, k, ncy, ncx;
- assert(cx>=0 && cy>=0);
- getyx(menu->win,ncy,ncx);
- if (isgrey) wattroff(menu->win,menu->grey);
- else if (isfore) wattroff(menu->win,menu->fore);
- wattron(menu->win,menu->back);
- for(j=1; j < menu->spc_rows;j++)
+ assert(cx >= 0 && cy >= 0);
+ getyx(menu->win, ncy, ncx);
+ if (isgrey)
+ wattroff(menu->win, menu->grey);
+ else if (isfore)
+ wattroff(menu->win, menu->fore);
+ wattron(menu->win, menu->back);
+ for (j = 1; j < menu->spc_rows; j++)
{
- if ((item_y+j) < getmaxy(menu->win))
+ if ((item_y + j) < getmaxy(menu->win))
{
- wmove (menu->win,item_y+j,item_x);
- for(k=0;k<count;k++)
- waddch(menu->win,' ');
+ wmove(menu->win, item_y + j, item_x);
+ for (k = 0; k < count; k++)
+ waddch(menu->win, ' ');
}
- if ((cy+j) < getmaxy(menu->win))
- mvwaddch(menu->win,cy+j,cx-1,menu->pad);
+ if ((cy + j) < getmaxy(menu->win))
+ mvwaddch(menu->win, cy + j, cx - 1, menu->pad);
}
- wmove(menu->win,ncy,ncx);
+ wmove(menu->win, ncy, ncx);
if (!isback)
- wattroff(menu->win,menu->back);
+ wattroff(menu->win, menu->back);
}
}
-
+
/* Remove attributes */
if (isfore)
- wattroff(menu->win,menu->fore);
+ wattroff(menu->win, menu->fore);
if (isback)
- wattroff(menu->win,menu->back);
+ wattroff(menu->win, menu->back);
if (isgrey)
- wattroff(menu->win,menu->grey);
-}
+ wattroff(menu->win, menu->grey);
+}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : void _nc_Draw_Menu(const MENU *)
-|
+|
| Description : Display the menu in its windows
|
| Return Values : -
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void)
-_nc_Draw_Menu (const MENU * menu)
+_nc_Draw_Menu(const MENU * menu)
{
ITEM *item = menu->items[0];
ITEM *lasthor, *lastvert;
@@ -202,75 +208,78 @@ _nc_Draw_Menu (const MENU * menu)
assert(item && menu->win);
s_bkgd = getbkgd(menu->win);
- wbkgdset(menu->win,menu->back);
+ wbkgdset(menu->win, menu->back);
werase(menu->win);
- wbkgdset(menu->win,s_bkgd);
+ wbkgdset(menu->win, s_bkgd);
- lastvert = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : item;
+ lastvert = (menu->opt & O_NONCYCLIC) ? (ITEM *) 0 : item;
do
- {
- wmove(menu->win,y,0);
+ {
+ wmove(menu->win, y, 0);
+
+ hitem = item;
+ lasthor = (menu->opt & O_NONCYCLIC) ? (ITEM *) 0 : hitem;
- hitem = item;
- lasthor = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : hitem;
-
do
{
- _nc_Post_Item( menu, hitem);
+ _nc_Post_Item(menu, hitem);
- wattron(menu->win,menu->back);
- if ( ((hitem = hitem->right) != lasthor) && hitem )
+ wattron(menu->win, menu->back);
+ if (((hitem = hitem->right) != lasthor) && hitem)
{
- int i,j, cy, cx;
+ int i, j, cy, cx;
chtype ch = ' ';
- getyx(menu->win,cy,cx);
- for(j=0;j<menu->spc_rows;j++)
+ getyx(menu->win, cy, cx);
+ for (j = 0; j < menu->spc_rows; j++)
{
- wmove(menu->win,cy+j,cx);
- for(i=0; i < menu->spc_cols; i++)
+ wmove(menu->win, cy + j, cx);
+ for (i = 0; i < menu->spc_cols; i++)
{
- waddch( menu->win,ch);
+ waddch(menu->win, ch);
}
}
- wmove(menu->win,cy,cx+menu->spc_cols);
+ wmove(menu->win, cy, cx + menu->spc_cols);
}
- } while (hitem && (hitem != lasthor));
- wattroff(menu->win,menu->back);
-
+ }
+ while (hitem && (hitem != lasthor));
+ wattroff(menu->win, menu->back);
+
item = item->down;
y += menu->spc_rows;
-
- } while( item && (item != lastvert) );
+
+ }
+ while (item && (item != lastvert));
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int post_menu(MENU *)
-|
+|
| Description : Post a menu to the screen. This makes it visible.
|
| Return Values : E_OK - success
| E_BAD_ARGUMENT - not a valid menu pointer
| E_SYSTEM_ERROR - error in lower layers
-| E_NO_ROOM - Menu to large for screen
| E_NOT_CONNECTED - No items connected to menu
| E_BAD_STATE - Menu in userexit routine
| E_POSTED - Menu already posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-post_menu (MENU * menu)
+post_menu(MENU * menu)
{
+ T((T_CALLED("post_menu(%p)"), menu));
+
if (!menu)
RETURN(E_BAD_ARGUMENT);
-
- if ( menu->status & _IN_DRIVER )
+
+ if (menu->status & _IN_DRIVER)
RETURN(E_BAD_STATE);
- if ( menu->status & _POSTED )
+ if (menu->status & _POSTED)
RETURN(E_POSTED);
-
+
if (menu->items && *(menu->items))
{
int y;
@@ -278,54 +287,50 @@ post_menu (MENU * menu)
WINDOW *win = Get_Menu_Window(menu);
int maxy = getmaxy(win);
- int maxx = getmaxx(win);
-
- if (maxx < menu->width || maxy < menu->height)
- RETURN(E_NO_ROOM);
- if ( (menu->win = newpad(h,menu->width)) )
+ if ((menu->win = newpad(h, menu->width)))
{
y = (maxy >= h) ? h : maxy;
- if (y>=menu->height)
+ if (y >= menu->height)
y = menu->height;
- if(!(menu->sub = subpad(menu->win,y,menu->width,0,0)))
+ if (!(menu->sub = subpad(menu->win, y, menu->width, 0, 0)))
RETURN(E_SYSTEM_ERROR);
}
- else
- RETURN(E_SYSTEM_ERROR);
-
- if (menu->status & _LINK_NEEDED)
+ else
+ RETURN(E_SYSTEM_ERROR);
+
+ if (menu->status & _LINK_NEEDED)
_nc_Link_Items(menu);
}
else
RETURN(E_NOT_CONNECTED);
-
+
menu->status |= _POSTED;
- if (!(menu->opt&O_ONEVALUE))
+ if (!(menu->opt & O_ONEVALUE))
{
ITEM **items;
-
- for(items=menu->items;*items;items++)
+
+ for (items = menu->items; *items; items++)
{
(*items)->value = FALSE;
}
}
-
+
_nc_Draw_Menu(menu);
-
- Call_Hook(menu,menuinit);
- Call_Hook(menu,iteminit);
-
+
+ Call_Hook(menu, menuinit);
+ Call_Hook(menu, iteminit);
+
_nc_Show_Menu(menu);
-
+
RETURN(E_OK);
}
/*---------------------------------------------------------------------------
-| Facility : libnmenu
+| Facility : libnmenu
| Function : int unpost_menu(MENU *)
-|
+|
| Description : Detach menu from screen
|
| Return Values : E_OK - success
@@ -334,36 +339,38 @@ post_menu (MENU * menu)
| E_NOT_POSTED - menu is not posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-unpost_menu (MENU * menu)
+unpost_menu(MENU * menu)
{
WINDOW *win;
-
+
+ T((T_CALLED("unpost_menu(%p)"), menu));
+
if (!menu)
RETURN(E_BAD_ARGUMENT);
-
- if ( menu->status & _IN_DRIVER )
+
+ if (menu->status & _IN_DRIVER)
RETURN(E_BAD_STATE);
- if ( !( menu->status & _POSTED ) )
+ if (!(menu->status & _POSTED))
RETURN(E_NOT_POSTED);
-
- Call_Hook(menu,itemterm);
- Call_Hook(menu,menuterm);
-
+
+ Call_Hook(menu, itemterm);
+ Call_Hook(menu, menuterm);
+
win = Get_Menu_Window(menu);
werase(win);
wsyncup(win);
-
+
assert(menu->sub);
delwin(menu->sub);
menu->sub = (WINDOW *)0;
-
+
assert(menu->win);
delwin(menu->win);
menu->win = (WINDOW *)0;
-
+
menu->status &= ~_POSTED;
-
+
RETURN(E_OK);
}
diff --git a/contrib/ncurses/menu/m_req_name.c b/contrib/ncurses/menu/m_req_name.c
index 130bd6f6e0a0..01fe79e3be84 100644
--- a/contrib/ncurses/menu/m_req_name.c
+++ b/contrib/ncurses/menu/m_req_name.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2005 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,27 +37,29 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_req_name.c,v 1.13 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_req_name.c,v 1.19 2005/04/16 16:59:52 tom Exp $")
-static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = {
- "LEFT_ITEM" ,
- "RIGHT_ITEM" ,
- "UP_ITEM" ,
- "DOWN_ITEM" ,
- "SCR_ULINE" ,
- "SCR_DLINE" ,
- "SCR_DPAGE" ,
- "SCR_UPAGE" ,
- "FIRST_ITEM" ,
- "LAST_ITEM" ,
- "NEXT_ITEM" ,
- "PREV_ITEM" ,
- "TOGGLE_ITEM" ,
+static const char *request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1] =
+{
+ "LEFT_ITEM",
+ "RIGHT_ITEM",
+ "UP_ITEM",
+ "DOWN_ITEM",
+ "SCR_ULINE",
+ "SCR_DLINE",
+ "SCR_DPAGE",
+ "SCR_UPAGE",
+ "FIRST_ITEM",
+ "LAST_ITEM",
+ "NEXT_ITEM",
+ "PREV_ITEM",
+ "TOGGLE_ITEM",
"CLEAR_PATTERN",
- "BACK_PATTERN" ,
- "NEXT_MATCH" ,
- "PREV_MATCH"
+ "BACK_PATTERN",
+ "NEXT_MATCH",
+ "PREV_MATCH"
};
+
#define A_SIZE (sizeof(request_names)/sizeof(request_names[0]))
/*---------------------------------------------------------------------------
@@ -70,18 +72,18 @@ static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = {
| NULL - on invalid request code
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(const char *)
-menu_request_name ( int request )
+menu_request_name(int request)
{
- if ( (request < MIN_MENU_COMMAND) || (request > MAX_MENU_COMMAND) )
+ T((T_CALLED("menu_request_name(%d)"), request));
+ if ((request < MIN_MENU_COMMAND) || (request > MAX_MENU_COMMAND))
{
SET_ERROR(E_BAD_ARGUMENT);
- return (const char *)0;
+ returnCPtr((const char *)0);
}
else
- return request_names[ request - MIN_MENU_COMMAND ];
+ returnCPtr(request_names[request - MIN_MENU_COMMAND]);
}
-
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : int menu_request_by_name (const char *str);
@@ -92,28 +94,30 @@ menu_request_name ( int request )
| E_NO_MATCH - request not found
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-menu_request_by_name ( const char *str )
-{
+menu_request_by_name(const char *str)
+{
/* because the table is so small, it doesn't really hurt
to run sequentially through it.
- */
+ */
unsigned int i = 0;
char buf[16];
-
+
+ T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str)));
+
if (str)
{
- strncpy(buf,str,sizeof(buf));
- while( (i<sizeof(buf)) && (buf[i] != '\0') )
+ strncpy(buf, str, sizeof(buf));
+ while ((i < sizeof(buf)) && (buf[i] != '\0'))
{
buf[i] = toupper(buf[i]);
i++;
}
-
- for (i=0; i < A_SIZE; i++)
+
+ for (i = 0; i < A_SIZE; i++)
{
- if (strncmp(request_names[i],buf,sizeof(buf))==0)
- return MIN_MENU_COMMAND + i;
- }
+ if (strncmp(request_names[i], buf, sizeof(buf)) == 0)
+ returnCode(MIN_MENU_COMMAND + (int)i);
+ }
}
RETURN(E_NO_MATCH);
}
diff --git a/contrib/ncurses/menu/m_scale.c b/contrib/ncurses/menu/m_scale.c
index e5c1101547b5..96c2d84eb3af 100644
--- a/contrib/ncurses/menu/m_scale.c
+++ b/contrib/ncurses/menu/m_scale.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_scale.c,v 1.5 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_scale.c,v 1.9 2004/12/11 23:29:34 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -51,11 +51,13 @@ MODULE_ID("$Id: m_scale.c,v 1.5 2000/12/10 02:16:48 tom Exp $")
| E_NOT_CONNECTED - no items are connected to menu
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-scale_menu (const MENU *menu, int *rows, int *cols)
+scale_menu(const MENU * menu, int *rows, int *cols)
{
- if (!menu)
- RETURN( E_BAD_ARGUMENT );
-
+ T((T_CALLED("scale_menu(%p,%p,%p)"), menu, rows, cols));
+
+ if (!menu)
+ RETURN(E_BAD_ARGUMENT);
+
if (menu->items && *(menu->items))
{
if (rows)
@@ -65,8 +67,7 @@ scale_menu (const MENU *menu, int *rows, int *cols)
RETURN(E_OK);
}
else
- RETURN( E_NOT_CONNECTED );
+ RETURN(E_NOT_CONNECTED);
}
/* m_scale.c ends here */
-
diff --git a/contrib/ncurses/menu/m_spacing.c b/contrib/ncurses/menu/m_spacing.c
index b384ef3ccaf8..039bbe4d59b1 100644
--- a/contrib/ncurses/menu/m_spacing.c
+++ b/contrib/ncurses/menu/m_spacing.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_spacing.c,v 1.12 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_spacing.c,v 1.17 2004/12/11 23:29:34 tom Exp $")
#define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8)
#define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8)
@@ -47,15 +47,17 @@ MODULE_ID("$Id: m_spacing.c,v 1.12 2000/12/10 02:16:48 tom Exp $")
| Facility : libnmenu
| Function : int set_menu_spacing(MENU *menu,int desc, int r, int c);
|
-| Description : Set the spacing between entried
+| Description : Set the spacing between entries
|
| Return Values : E_OK - on success
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_spacing
-(MENU *menu, int s_desc, int s_row, int s_col )
+set_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col)
{
- MENU *m; /* split for ATAC workaround */
+ MENU *m; /* split for ATAC workaround */
+
+ T((T_CALLED("set_menu_spacing(%p,%d,%d,%d)"), menu, s_desc, s_row, s_col));
+
m = Normalize_Menu(menu);
assert(m);
@@ -63,19 +65,18 @@ set_menu_spacing
RETURN(E_POSTED);
if (((s_desc < 0) || (s_desc > MAX_SPC_DESC)) ||
- ((s_row < 0) || (s_row > MAX_SPC_ROWS)) ||
- ((s_col < 0) || (s_col > MAX_SPC_COLS)))
+ ((s_row < 0) || (s_row > MAX_SPC_ROWS)) ||
+ ((s_col < 0) || (s_col > MAX_SPC_COLS)))
RETURN(E_BAD_ARGUMENT);
m->spc_desc = s_desc ? s_desc : 1;
- m->spc_rows = s_row ? s_row : 1;
- m->spc_cols = s_col ? s_col : 1;
+ m->spc_rows = s_row ? s_row : 1;
+ m->spc_cols = s_col ? s_col : 1;
_nc_Calculate_Item_Length_and_Width(m);
RETURN(E_OK);
}
-
/*---------------------------------------------------------------------------
| Facility : libnmenu
| Function : int menu_spacing (const MENU *,int *,int *,int *);
@@ -85,15 +86,21 @@ set_menu_spacing
| Return Values : E_OK - on success
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-menu_spacing ( const MENU *menu, int* s_desc, int* s_row, int* s_col)
+menu_spacing(const MENU * menu, int *s_desc, int *s_row, int *s_col)
{
- const MENU *m; /* split for ATAC workaround */
+ const MENU *m; /* split for ATAC workaround */
+
+ T((T_CALLED("menu_spacing(%p,%p,%p,%p)"), menu, s_desc, s_row, s_col));
+
m = Normalize_Menu(menu);
assert(m);
- if (s_desc) *s_desc = m->spc_desc;
- if (s_row) *s_row = m->spc_rows;
- if (s_col) *s_col = m->spc_cols;
+ if (s_desc)
+ *s_desc = m->spc_desc;
+ if (s_row)
+ *s_row = m->spc_rows;
+ if (s_col)
+ *s_col = m->spc_cols;
RETURN(E_OK);
}
diff --git a/contrib/ncurses/menu/m_sub.c b/contrib/ncurses/menu/m_sub.c
index 43d8521445f4..82649c57b130 100644
--- a/contrib/ncurses/menu/m_sub.c
+++ b/contrib/ncurses/menu/m_sub.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_sub.c,v 1.5 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_sub.c,v 1.10 2004/12/25 21:38:31 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -49,18 +49,20 @@ MODULE_ID("$Id: m_sub.c,v 1.5 2000/12/10 02:16:48 tom Exp $")
| E_POSTED - menu is already posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_sub (MENU *menu, WINDOW *win)
+set_menu_sub(MENU * menu, WINDOW *win)
{
+ T((T_CALLED("set_menu_sub(%p,%p)"), menu, win));
+
if (menu)
{
- if ( menu->status & _POSTED )
+ if (menu->status & _POSTED)
RETURN(E_POSTED);
menu->usersub = win;
_nc_Calculate_Item_Length_and_Width(menu);
}
else
_nc_Default_Menu.usersub = win;
-
+
RETURN(E_OK);
}
@@ -73,10 +75,12 @@ set_menu_sub (MENU *menu, WINDOW *win)
| Return Values : NULL on error, otherwise a pointer to the window
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(WINDOW *)
-menu_sub (const MENU * menu)
+menu_sub(const MENU * menu)
{
- const MENU* m = Normalize_Menu(menu);
- return Get_Menu_Window(m);
+ const MENU *m = Normalize_Menu(menu);
+
+ T((T_CALLED("menu_sub(%p)"), menu));
+ returnWin(Get_Menu_Window(m));
}
/* m_sub.c ends here */
diff --git a/contrib/ncurses/menu/m_trace.c b/contrib/ncurses/menu/m_trace.c
new file mode 100644
index 000000000000..0f9f90273a6a
--- /dev/null
+++ b/contrib/ncurses/menu/m_trace.c
@@ -0,0 +1,77 @@
+/****************************************************************************
+ * Copyright (c) 2004,2005 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 *
+ * "Software"), to deal in the Software without restriction, including *
+ * without limitation the rights to use, copy, modify, merge, publish, *
+ * distribute, distribute with modifications, sublicense, and/or sell *
+ * copies of the Software, and to permit persons to whom the Software is *
+ * furnished to do so, subject to the following conditions: *
+ * *
+ * The above copyright notice and this permission notice shall be included *
+ * in all copies or substantial portions of the Software. *
+ * *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
+ * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
+ * *
+ * Except as contained in this notice, the name(s) of the above copyright *
+ * holders shall not be used in advertising or otherwise to promote the *
+ * sale, use or other dealings in this Software without prior written *
+ * authorization. *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Author: Thomas E. Dickey *
+ ****************************************************************************/
+
+#include "menu.priv.h"
+
+MODULE_ID("$Id: m_trace.c,v 1.3 2005/01/16 01:06:11 tom Exp $")
+
+NCURSES_EXPORT(ITEM *)
+_nc_retrace_item(ITEM * code)
+{
+ T((T_RETURN("%p"), code));
+ return code;
+}
+
+NCURSES_EXPORT(ITEM **)
+_nc_retrace_item_ptr(ITEM ** code)
+{
+ T((T_RETURN("%p"), code));
+ return code;
+}
+
+NCURSES_EXPORT(Item_Options)
+_nc_retrace_item_opts(Item_Options code)
+{
+ T((T_RETURN("%d"), code));
+ return code;
+}
+
+NCURSES_EXPORT(MENU *)
+_nc_retrace_menu(MENU * code)
+{
+ T((T_RETURN("%p"), code));
+ return code;
+}
+
+NCURSES_EXPORT(Menu_Hook)
+_nc_retrace_menu_hook(Menu_Hook code)
+{
+ T((T_RETURN("%p"), code));
+ return code;
+}
+
+NCURSES_EXPORT(Menu_Options)
+_nc_retrace_menu_opts(Menu_Options code)
+{
+ T((T_RETURN("%d"), code));
+ return code;
+}
diff --git a/contrib/ncurses/menu/m_userptr.c b/contrib/ncurses/menu/m_userptr.c
index cab4d3c3d9b5..7b178b25a175 100644
--- a/contrib/ncurses/menu/m_userptr.c
+++ b/contrib/ncurses/menu/m_userptr.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_userptr.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_userptr.c,v 1.16 2004/12/25 21:38:55 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -49,10 +49,11 @@ MODULE_ID("$Id: m_userptr.c,v 1.11 2000/12/10 02:16:48 tom Exp $")
| Return Values : E_OK - success
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_userptr (MENU * menu, void * userptr)
+set_menu_userptr(MENU * menu, void *userptr)
{
+ T((T_CALLED("set_menu_userptr(%p,%p)"), menu, userptr));
Normalize_Menu(menu)->userptr = userptr;
- RETURN( E_OK );
+ RETURN(E_OK);
}
/*---------------------------------------------------------------------------
@@ -66,9 +67,10 @@ set_menu_userptr (MENU * menu, void * userptr)
| NULL is returned
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(void *)
-menu_userptr (const MENU * menu)
+menu_userptr(const MENU * menu)
{
- return( Normalize_Menu(menu)->userptr);
+ T((T_CALLED("menu_userptr(%p)"), menu));
+ returnVoidPtr(Normalize_Menu(menu)->userptr);
}
/* m_userptr.c ends here */
diff --git a/contrib/ncurses/menu/m_win.c b/contrib/ncurses/menu/m_win.c
index 85bb06f032af..c3f857f71688 100644
--- a/contrib/ncurses/menu/m_win.c
+++ b/contrib/ncurses/menu/m_win.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,7 +27,7 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
/***************************************************************************
@@ -37,7 +37,7 @@
#include "menu.priv.h"
-MODULE_ID("$Id: m_win.c,v 1.10 2000/12/10 02:16:48 tom Exp $")
+MODULE_ID("$Id: m_win.c,v 1.15 2004/12/25 21:39:20 tom Exp $")
/*---------------------------------------------------------------------------
| Facility : libnmenu
@@ -49,18 +49,20 @@ MODULE_ID("$Id: m_win.c,v 1.10 2000/12/10 02:16:48 tom Exp $")
| E_POSTED - menu is already posted
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(int)
-set_menu_win (MENU *menu, WINDOW *win)
+set_menu_win(MENU * menu, WINDOW *win)
{
+ T((T_CALLED("set_menu_win(%p,%p)"), menu, win));
+
if (menu)
{
- if ( menu->status & _POSTED )
+ if (menu->status & _POSTED)
RETURN(E_POSTED);
menu->userwin = win;
_nc_Calculate_Item_Length_and_Width(menu);
}
else
_nc_Default_Menu.userwin = win;
-
+
RETURN(E_OK);
}
@@ -73,10 +75,12 @@ set_menu_win (MENU *menu, WINDOW *win)
| Return Values : NULL on error, otherwise pointer to window
+--------------------------------------------------------------------------*/
NCURSES_EXPORT(WINDOW *)
-menu_win (const MENU *menu)
+menu_win(const MENU * menu)
{
- const MENU* m = Normalize_Menu(menu);
- return (m->userwin ? m->userwin : stdscr);
+ const MENU *m = Normalize_Menu(menu);
+
+ T((T_CALLED("menu_win(%p)"), menu));
+ returnWin(m->userwin ? m->userwin : stdscr);
}
/* m_win.c ends here */
diff --git a/contrib/ncurses/menu/menu.h b/contrib/ncurses/menu/menu.h
index 8c12894fdda4..f0b1f60b2259 100644
--- a/contrib/ncurses/menu/menu.h
+++ b/contrib/ncurses/menu/menu.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2002,2003 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 *
@@ -27,9 +27,11 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
+/* $Id: menu.h,v 1.18 2003/11/08 20:48:24 tom Exp $ */
+
#ifndef ETI_MENU
#define ETI_MENU
@@ -76,7 +78,7 @@ typedef struct tagITEM
short x;
bool value; /* Selection value */
- struct tagITEM *left; /* neighbour items */
+ struct tagITEM *left; /* neighbor items */
struct tagITEM *right;
struct tagITEM *up;
struct tagITEM *down;
diff --git a/contrib/ncurses/menu/menu.priv.h b/contrib/ncurses/menu/menu.priv.h
index 1b2c6283383b..10d3537594da 100644
--- a/contrib/ncurses/menu/menu.priv.h
+++ b/contrib/ncurses/menu/menu.priv.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2004,2005 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 *
@@ -27,9 +27,11 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
+/* $Id: menu.priv.h,v 1.22 2005/01/16 01:02:23 tom Exp $ */
+
/***************************************************************************
* Module menu.priv.h *
* Top level private header file for all libnmenu modules *
@@ -38,9 +40,7 @@
#ifndef MENU_PRIV_H_incl
#define MENU_PRIV_H_incl 1
-#include <ncurses_cfg.h>
-#include <curses.h>
-
+#include "curses.priv.h"
#include "mf_common.h"
#include "menu.h"
@@ -106,10 +106,13 @@ extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu;
{ (menu)->pindex = 0; \
(menu)->pattern[0] = '\0'; }
+#define UChar(c) ((unsigned char)(c))
+
/* Internal functions. */
extern NCURSES_EXPORT(void) _nc_Draw_Menu (const MENU *);
extern NCURSES_EXPORT(void) _nc_Show_Menu (const MENU *);
extern NCURSES_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *);
+extern NCURSES_EXPORT(int) _nc_Calculate_Text_Width(const TEXT *);
extern NCURSES_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *);
extern NCURSES_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **);
extern NCURSES_EXPORT(void) _nc_Disconnect_Items (MENU *);
@@ -119,4 +122,31 @@ extern NCURSES_EXPORT(int) _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITE
extern NCURSES_EXPORT(int) _nc_menu_cursor_pos (const MENU* menu, const ITEM* item,
int* pY, int* pX);
+#ifdef TRACE
+
+#define returnItem(code) TRACE_RETURN(code,item)
+#define returnItemPtr(code) TRACE_RETURN(code,item_ptr)
+#define returnItemOpts(code) TRACE_RETURN(code,item_opts)
+#define returnMenu(code) TRACE_RETURN(code,menu)
+#define returnMenuHook(code) TRACE_RETURN(code,menu_hook)
+#define returnMenuOpts(code) TRACE_RETURN(code,menu_opts)
+
+extern NCURSES_EXPORT(ITEM *) _nc_retrace_item (ITEM *);
+extern NCURSES_EXPORT(ITEM **) _nc_retrace_item_ptr (ITEM **);
+extern NCURSES_EXPORT(Item_Options) _nc_retrace_item_opts (Item_Options);
+extern NCURSES_EXPORT(MENU *) _nc_retrace_menu (MENU *);
+extern NCURSES_EXPORT(Menu_Hook) _nc_retrace_menu_hook (Menu_Hook);
+extern NCURSES_EXPORT(Menu_Options) _nc_retrace_menu_opts (Menu_Options);
+
+#else /* !TRACE */
+
+#define returnItem(code) return code
+#define returnItemPtr(code) return code
+#define returnItemOpts(code) return code
+#define returnMenu(code) return code
+#define returnMenuHook(code) return code
+#define returnMenuOpts(code) return code
+
+#endif /* TRACE/!TRACE */
+
#endif /* MENU_PRIV_H_incl */
diff --git a/contrib/ncurses/menu/mf_common.h b/contrib/ncurses/menu/mf_common.h
index bf0bf016204e..681672dc3424 100644
--- a/contrib/ncurses/menu/mf_common.h
+++ b/contrib/ncurses/menu/mf_common.h
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1998,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2003,2004 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 *
@@ -27,9 +27,11 @@
****************************************************************************/
/****************************************************************************
- * Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1995,1997 *
+ * Author: Juergen Pfeifer, 1995,1997 *
****************************************************************************/
+/* $Id: mf_common.h,v 0.22 2005/11/26 15:26:52 tom Exp $ */
+
/* Common internal header for menu and form library */
#ifndef MF_COMMON_H_incl
@@ -69,29 +71,25 @@ extern int errno;
#define MAX_REGULAR_CHARACTER (0xff)
#define SET_ERROR(code) (errno=(code))
-#define GET_ERROR() (errno)
-#define RETURN(code) return( SET_ERROR(code) )
+#define GET_ERROR() (errno)
+
+#ifdef TRACE
+#define RETURN(code) returnCode( SET_ERROR(code) )
+#else
+#define RETURN(code) return( SET_ERROR(code) )
+#endif
/* The few common values in the status fields for menus and forms */
-#define _POSTED (0x01) /* menu or form is posted */
-#define _IN_DRIVER (0x02) /* menu or form is processing hook routine */
+#define _POSTED (0x01U) /* menu or form is posted */
+#define _IN_DRIVER (0x02U) /* menu or form is processing hook routine */
/* Call object hook */
#define Call_Hook( object, handler ) \
- if ( (object) && ((object)->handler) )\
+ if ( (object) != 0 && ((object)->handler) != (void *) 0 )\
{\
(object)->status |= _IN_DRIVER;\
(object)->handler(object);\
(object)->status &= ~_IN_DRIVER;\
}
-#define INLINE
-
-#ifndef TRACE
-# if CC_HAS_INLINE_FUNCS
-# undef INLINE
-# define INLINE inline
-# endif
-#endif
-
#endif /* MF_COMMON_H_incl */
diff --git a/contrib/ncurses/menu/modules b/contrib/ncurses/menu/modules
index 5d6cc823abc1..c78178a13cc6 100644
--- a/contrib/ncurses/menu/modules
+++ b/contrib/ncurses/menu/modules
@@ -1,6 +1,6 @@
-# $Id: modules,v 1.14 1999/02/18 22:39:04 juergen Exp $
+# $Id: modules,v 1.16 2004/12/25 22:06:33 tom Exp $
##############################################################################
-# Copyright (c) 1998 Free Software Foundation, Inc. #
+# Copyright (c) 1998,2004 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 "Software"), #
@@ -56,5 +56,6 @@ m_req_name lib $(srcdir) $(MENU_PRIV_H)
m_scale lib $(srcdir) $(MENU_PRIV_H)
m_spacing lib $(srcdir) $(MENU_PRIV_H)
m_sub lib $(srcdir) $(MENU_PRIV_H)
+m_trace lib $(srcdir) $(MENU_PRIV_H)
m_userptr lib $(srcdir) $(MENU_PRIV_H)
m_win lib $(srcdir) $(MENU_PRIV_H)