/****************************************************************************
- * Copyright 2020 Thomas E. Dickey *
+ * Copyright 2020,2021 Thomas E. Dickey *
* Copyright 1998-2012,2014 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
#include "menu.priv.h"
-MODULE_ID("$Id: m_global.c,v 1.32 2020/12/12 00:38:02 tom Exp $")
+MODULE_ID("$Id: m_global.c,v 1.33 2021/03/27 23:46:29 tom Exp $")
static char mark[] = "-";
/* *INDENT-OFF* */
unsigned MaximumNameLength = 0;
unsigned MaximumDescriptionLength = 0;
ITEM **items;
- unsigned check;
assert(menu && menu->items);
for (items = menu->items; *items; items++)
{
- check = (unsigned)_nc_Calculate_Text_Width(&((*items)->name));
+ unsigned check = (unsigned)_nc_Calculate_Text_Width(&((*items)->name));
+
if (check > MaximumNameLength)
MaximumNameLength = check;
MENU_EXPORT(bool)
_nc_Connect_Items(MENU *menu, ITEM **items)
{
- ITEM **item;
unsigned int ItemCount = 0;
if (menu && items)
{
+ ITEM **item;
+
for (item = items; *item; item++)
{
if ((*item)->imenu)
calculate_actual_width(MENU *menu, bool name)
{
int width = 0;
- int check = 0;
- ITEM **items;
assert(menu && menu->items);
if (menu->items != 0)
{
+ ITEM **items;
+
for (items = menu->items; *items; items++)
{
- if (name)
- {
- check = _nc_Calculate_Text_Width(&((*items)->name));
- }
- else
- {
- check = _nc_Calculate_Text_Width(&((*items)->description));
- }
+ int check = (name
+ ? _nc_Calculate_Text_Width(&((*items)->name))
+ : _nc_Calculate_Text_Width(&((*items)->description)));
+
if (check > width)
width = check;
}
{
if (menu && menu->items && *(menu->items))
{
- int i, j;
+ int i;
ITEM *item;
int Number_Of_Items = menu->nitems;
int col = 0, row = 0;
else
{
int Number_Of_Rows = menu->rows;
+ int j;
for (j = 0; j < Number_Of_Items; j++)
{
MENU_EXPORT(void)
_nc_Show_Menu(const MENU *menu)
{
- WINDOW *win;
- int maxy, maxx;
-
assert(menu);
if ((menu->status & _POSTED) && !(menu->status & _IN_DRIVER))
{
+ WINDOW *win;
+ int maxy, maxx;
+
/* adjust the internal subwindow to start on the current top */
assert(menu->sub);
mvderwin(menu->sub, menu->spc_rows * menu->toprow, 0);
int new_toprow,
ITEM *new_current_item)
{
- ITEM *cur_item;
- bool mterm_called = FALSE;
- bool iterm_called = FALSE;
-
assert(menu);
if (menu->status & _POSTED)
{
+ ITEM *cur_item;
+ bool mterm_called = FALSE;
+ bool iterm_called = FALSE;
+
if (new_current_item != menu->curitem)
{
Call_Hook(menu, itemterm);