- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. *
+ * Copyright 2020 Thomas E. Dickey *
+ * Copyright 1998-2012,2014 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 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
0, /* length of widest description */
1, /* length of mark */
1, /* length of one item */
0, /* length of widest description */
1, /* length of mark */
1, /* length of one item */
1, /* Spacing for columns */
1, /* Spacing for rows */
(char *)0, /* buffer used to store match chars */
1, /* Spacing for columns */
1, /* Spacing for rows */
(char *)0, /* buffer used to store match chars */
0, /* Top row of menu */
(chtype)A_REVERSE, /* Attribute for selection */
(chtype)A_NORMAL, /* Attribute for nonselection */
0, /* Top row of menu */
(chtype)A_REVERSE, /* Attribute for selection */
(chtype)A_NORMAL, /* Attribute for nonselection */
' ', /* Pad character */
(Menu_Hook)0, /* Menu init */
(Menu_Hook)0, /* Menu term */
' ', /* Pad character */
(Menu_Hook)0, /* Menu init */
(Menu_Hook)0, /* Menu term */
| Description : Calculates the maximum name and description lengths
| of the items connected to the menu
|
| Return Values : -
+--------------------------------------------------------------------------*/
| Description : Calculates the maximum name and description lengths
| of the items connected to the menu
|
| Return Values : -
+--------------------------------------------------------------------------*/
ComputeMaximum_NameDesc_Lengths(MENU * menu)
{
unsigned MaximumNameLength = 0;
unsigned MaximumDescriptionLength = 0;
ITEM **items;
ComputeMaximum_NameDesc_Lengths(MENU * menu)
{
unsigned MaximumNameLength = 0;
unsigned MaximumDescriptionLength = 0;
ITEM **items;
- if (items[0]->name.length > MaximumNameLength)
- MaximumNameLength = items[0]->name.length;
+ check = (unsigned)_nc_Calculate_Text_Width(&((*items)->name));
+ if (check > MaximumNameLength)
+ MaximumNameLength = check;
- if (items[0]->description.length > MaximumDescriptionLength)
- MaximumDescriptionLength = items[0]->description.length;
+ check = (unsigned)_nc_Calculate_Text_Width(&((*items)->description));
+ if (check > MaximumDescriptionLength)
+ MaximumDescriptionLength = check;
T(("ComputeMaximum_NameDesc_Lengths %d,%d", menu->namelen, menu->desclen));
}
/*---------------------------------------------------------------------------
T(("ComputeMaximum_NameDesc_Lengths %d,%d", menu->namelen, menu->desclen));
}
/*---------------------------------------------------------------------------
| the item array that indicates a connection
|
| Return Values : -
+--------------------------------------------------------------------------*/
| the item array that indicates a connection
|
| Return Values : -
+--------------------------------------------------------------------------*/
| Function : bool _nc_Connect_Items(MENU *menu, ITEM **items)
|
| Description : Connect the items in the item array to the menu.
| Function : bool _nc_Connect_Items(MENU *menu, ITEM **items)
|
| Description : Connect the items in the item array to the menu.
ComputeMaximum_NameDesc_Lengths(menu);
if ((menu->pattern = typeMalloc(char, (unsigned)(1 + menu->namelen))))
{
ComputeMaximum_NameDesc_Lengths(menu);
if ((menu->pattern = typeMalloc(char, (unsigned)(1 + menu->namelen))))
{
and inform about a reject connection */
ResetConnectionInfo(menu, items);
return (FALSE);
}
/*---------------------------------------------------------------------------
and inform about a reject connection */
ResetConnectionInfo(menu, items);
return (FALSE);
}
/*---------------------------------------------------------------------------
- T((T_CALLED("_nc_menu_text_width(%p)"), item));
- if (count > 0
- && (temp = typeMalloc(wchar_t, 2 + count)) != 0)
+ T((T_CALLED("_nc_menu_text_width(%p)"), (const void *)item));
+ if (result != 0 && item->str != 0)
- result = 0;
- mbstowcs(temp, item->str, (unsigned)count);
- for (n = 0; n < count; ++n)
+ if (count > 0
+ && (temp = typeMalloc(wchar_t, 2 + count)) != 0)
- int test = wcwidth(temp[n]);
+ int n;
+
+ result = 0;
+ mbstowcs(temp, item->str, (unsigned)count);
+ for (n = 0; n < count; ++n)
+ {
+ int test = wcwidth(temp[n]);
}
T(("calculate_actual_width %s = %d/%d",
name ? "name" : "desc",
width,
name ? menu->namelen : menu->desclen));
}
T(("calculate_actual_width %s = %d/%d",
name ? "name" : "desc",
width,
name ? menu->namelen : menu->desclen));
T(("_nc_CalculateItem_Length_and_Width columns %d, item %d, width %d",
menu->cols,
T(("_nc_CalculateItem_Length_and_Width columns %d, item %d, width %d",
menu->cols,
| Description : Statically calculate for every item its four neighbors.
| This depends on the orientation of the menu. This
| static approach simplifies navigation in the menu a lot.
| Description : Statically calculate for every item its four neighbors.
| This depends on the orientation of the menu. This
| static approach simplifies navigation in the menu a lot.
| Description : Redisplay the menu so that the given row becomes the
| top row and the given item becomes the new current
| item.
| Description : Redisplay the menu so that the given row becomes the
| top row and the given item becomes the new current
| item.
- _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)