Merge pull request #1508 from ajrhacker/input_parens

Parenthesize optional items in input menus
This commit is contained in:
R. Belmont 2016-10-14 11:12:22 -04:00 committed by GitHub
commit ff4948e128
2 changed files with 5 additions and 0 deletions

View File

@ -122,6 +122,7 @@ void menu_input_general::populate()
item->defseq = &entry.defseq(seqtype);
item->sortorder = sortorder * 4 + suborder[seqtype];
item->type = ioport_manager::type_is_analog(entry.type()) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
item->is_optional = false;
item->name = entry.name();
item->owner_name = nullptr;
item->next = itemlist;
@ -199,6 +200,7 @@ void menu_input_specific::populate()
item->defseq = &field.defseq(seqtype);
item->sortorder = sortorder + suborder[seqtype];
item->type = field.is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
item->is_optional = field.optional();
item->name = field.name();
item->owner_name = field.device().tag();
item->next = itemlist;
@ -420,6 +422,8 @@ void menu_input::populate_and_sort(input_item_data *itemlist)
}
std::string text = string_format(nameformat[item->type], item->name);
if (item->is_optional)
text = "(" + text + ")";
/* if we're polling this item, use some spaces with left/right arrows */
if (pollingref == item->ref)

View File

@ -55,6 +55,7 @@ protected:
const char * owner_name; /* pointer to the name of the owner of the item */
UINT32 sortorder; /* sorting information */
UINT8 type; /* type of port */
bool is_optional; /* true if this input is considered optional */
};
void populate_and_sort(struct input_item_data *itemlist);