mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
menu: fixed top line computation. (nw)
This commit is contained in:
parent
028b4c5b21
commit
6d4f627035
@ -712,7 +712,7 @@ void ui_menu_file_selector::handle()
|
|||||||
// from current entry to the end
|
// from current entry to the end
|
||||||
for (entry = cur_selected; entry != nullptr; entry = entry->next)
|
for (entry = cur_selected; entry != nullptr; entry = entry->next)
|
||||||
{
|
{
|
||||||
if (entry->basename != nullptr && m_filename_buffer != nullptr)
|
if (entry->basename != nullptr && m_filename_buffer[0] != '\0')
|
||||||
{
|
{
|
||||||
int match = 0;
|
int match = 0;
|
||||||
for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++)
|
for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++)
|
||||||
@ -731,7 +731,7 @@ void ui_menu_file_selector::handle()
|
|||||||
// and from the first entry to current one
|
// and from the first entry to current one
|
||||||
for (entry = m_entrylist; entry != cur_selected; entry = entry->next)
|
for (entry = m_entrylist; entry != cur_selected; entry = entry->next)
|
||||||
{
|
{
|
||||||
if (entry->basename != nullptr && m_filename_buffer != nullptr)
|
if (entry->basename != nullptr && m_filename_buffer[0] != '\0')
|
||||||
{
|
{
|
||||||
int match = 0;
|
int match = 0;
|
||||||
for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++)
|
for (int i = 0; i < ARRAY_LENGTH(m_filename_buffer); i++)
|
||||||
|
@ -544,7 +544,7 @@ void ui_menu::draw(bool customonly, bool noimage, bool noinput)
|
|||||||
machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
machine().ui().draw_outlined_box(container, x1, y1, x2, y2, UI_BACKGROUND_COLOR);
|
||||||
|
|
||||||
// determine the first visible line based on the current selection
|
// determine the first visible line based on the current selection
|
||||||
if (selected > top_line + visible_lines)
|
if (selected > top_line + visible_lines || selected < top_line - visible_lines)
|
||||||
top_line = selected - (visible_lines / 2);
|
top_line = selected - (visible_lines / 2);
|
||||||
if (top_line < 0 || selected == 0)
|
if (top_line < 0 || selected == 0)
|
||||||
top_line = 0;
|
top_line = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user