Skip to content

Commit

Permalink
ui/selmenu.cpp, debugger/debugimgui.cpp: Hack stuff out until it comp…
Browse files Browse the repository at this point in the history
…iles.
  • Loading branch information
cuavas committed Apr 3, 2024
1 parent fbd02a4 commit 5a40a7b
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 23 deletions.
78 changes: 55 additions & 23 deletions src/frontend/mame/ui/selmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ menu_select_launch::menu_select_launch(mame_ui_manager &mui, render_container &c
, m_cache(mui.get_session_data<menu_select_launch, cache_wrapper>(machine()))
, m_is_swlist(is_swlist)
, m_focus(focused_menu::MAIN)
, m_hover(1)
, m_pressed(false)
, m_repeat(0)
, m_right_visible_lines(0)
Expand Down Expand Up @@ -957,6 +958,7 @@ void menu_select_launch::draw_common_arrow(float origx1, float origy1, float ori
fgcolor_right = fgcolor_left = ui().colors().text_color();

// set hover
#if 0
if (mouse_in_rect(ar_x0, ar_y0, ar_x1, ar_y1) && current != dmax)
{
ui().draw_textured_box(container(), ar_x0 + 0.01f, ar_y0, ar_x1 - 0.01f, ar_y1, ui().colors().mouseover_bg_color(), rgb_t(43, 43, 43),
Expand All @@ -971,6 +973,7 @@ void menu_select_launch::draw_common_arrow(float origx1, float origy1, float ori
set_hover(HOVER_UI_LEFT);
fgcolor_left = ui().colors().mouseover_color();
}
#endif

// apply arrow
if (dmax == dmin)
Expand All @@ -995,6 +998,7 @@ void menu_select_launch::draw_info_arrow(int ub, float origx1, float origx2, flo
{
rgb_t fgcolor = ui().colors().text_color();

#if 0
if (mouse_in_rect(origx1, oy1, origx2, oy1 + line_height))
{
ui().draw_textured_box(
Expand All @@ -1006,6 +1010,7 @@ void menu_select_launch::draw_info_arrow(int ub, float origx1, float origx2, flo
set_hover(!ub ? HOVER_DAT_UP : HOVER_DAT_DOWN);
fgcolor = ui().colors().mouseover_color();
}
#endif

u32 const orientation = !ub ? ROT0 : (ROT0 ^ ORIENTATION_FLIP_Y);
draw_arrow(
Expand Down Expand Up @@ -1081,13 +1086,15 @@ float menu_select_launch::draw_left_panel(
// handle mouse hover in passing
rgb_t bgcolor = ui().colors().text_bg_color();
rgb_t fgcolor = ui().colors().text_color();
#if 0
if (mouse_in_rect(x1, y1, x2, y1 + line_height_max))
{
bgcolor = ui().colors().mouseover_bg_color();
fgcolor = ui().colors().mouseover_color();
set_hover(HOVER_FILTER_FIRST + filter);
highlight(x1, y1, x2, y1 + line_height_max, bgcolor);
}
#endif

// draw primary highlight if keyboard focus is here
if ((m_filter_highlight == filter) && (get_focus() == focused_menu::LEFT))
Expand Down Expand Up @@ -1127,11 +1134,13 @@ float menu_select_launch::draw_left_panel(
ui().draw_outlined_box(container(), x1, y1, x2, y2, rgb_t(0xef, 0x12, 0x47, 0x7b));

rgb_t fgcolor = ui().colors().text_color();
#if 0
if (mouse_in_rect(x1, y1, x2, y2))
{
fgcolor = ui().colors().mouseover_color();
set_hover(HOVER_LPANEL_ARROW);
}
#endif

draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90 ^ ORIENTATION_FLIP_X);
return x2 + lr_border();
Expand Down Expand Up @@ -1332,6 +1341,7 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2)

// add backtrack button
rgb_t color(0xffcccccc);
#if 0
if (mouse_in_rect(backtrack_pos, y1, x2, y2))
{
set_hover(HOVER_BACKTRACK);
Expand All @@ -1343,6 +1353,7 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2)
text_layout::text_justify::RIGHT, 1.0f - lr_border(), ypos,
ui().colors().background_color());
}
#endif
container().add_quad(
backtrack_pos, y1, x2, y2,
color,
Expand All @@ -1356,6 +1367,7 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2)
auto const bitmap = toolbar_bitmaps[z];
x2 = x1 + x_size;
color = rgb_t (0xffcccccc);
#if 0
if (mouse_in_rect(x1, y1, x2, y2))
{
bool const need_selection = (TOOLBAR_BITMAP_FAVORITE == bitmap) || (TOOLBAR_BITMAP_INFO == bitmap);
Expand All @@ -1371,6 +1383,7 @@ void menu_select_launch::draw_toolbar(float x1, float y1, float x2, float y2)
text_layout::text_justify::CENTER, (x1 + x2) * 0.5f, ypos,
ui().colors().background_color());
}
#endif
container().add_quad(
x1, y1, x2, y2,
color,
Expand Down Expand Up @@ -1469,7 +1482,7 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
{
// bail if no items
if (item_count() == 0)
return;
return false;

// if we hit select, return true or pop the stack, depending on the item
if (exclusive_input_pressed(iptkey, IPT_UI_SELECT, 0))
Expand All @@ -1482,21 +1495,21 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
{
filter_selected();
}
return;
return false;
}

if (exclusive_input_pressed(iptkey, IPT_UI_BACK, 0))
{
if (m_ui_error)
{
// dismiss error
return;
return false;
}
else if (!is_special_main_menu() && m_search.empty())
{
// pop the stack if this isn't the root session menu
stack_pop();
return;
return false;
}
}

Expand All @@ -1514,7 +1527,7 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
stack_pop();
machine().schedule_exit();
}
return;
return false;
}

// validate the current selection
Expand All @@ -1531,7 +1544,7 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
}
else
{
return;
return false;
}
}

Expand All @@ -1546,7 +1559,7 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
}
else
{
return;
return false;
}
}

Expand All @@ -1555,16 +1568,16 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
{
if (show_left_panel() && m_focus == focused_menu::LEFT)
{
return;
return false;
}
else if (show_right_panel() && ((m_focus == focused_menu::RIGHTTOP) || (m_focus == focused_menu::RIGHTBOTTOM)))
{
m_topline_datsview--;
return;
return false;
}
else if (selected_index() == m_available_items + 1 || is_first_selected() || m_ui_error)
{
return;
return false;
}

set_selected_index(selected_index() - 1);
Expand All @@ -1578,16 +1591,16 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
{
if (show_left_panel() && m_focus == focused_menu::LEFT)
{
return;
return false;
}
else if (show_right_panel() && ((m_focus == focused_menu::RIGHTTOP) || (m_focus == focused_menu::RIGHTBOTTOM)))
{
m_topline_datsview++;
return;
return false;
}
else if (is_last_selected() || selected_index() == m_available_items - 1 || m_ui_error)
{
return;
return false;
}

set_selected_index(selected_index() + 1);
Expand All @@ -1602,7 +1615,7 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
if (show_right_panel() && ((m_focus == focused_menu::RIGHTTOP) || (m_focus == focused_menu::RIGHTBOTTOM)))
{
m_topline_datsview -= m_right_visible_lines - 3;
return;
return false;
}

if (selected_index() < m_available_items && !m_ui_error)
Expand All @@ -1620,7 +1633,7 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
if (show_right_panel() && ((m_focus == focused_menu::RIGHTTOP) || (m_focus == focused_menu::RIGHTBOTTOM)))
{
m_topline_datsview += m_right_visible_lines - 3;
return;
return false;
}

if (selected_index() < m_available_items && !m_ui_error)
Expand All @@ -1636,12 +1649,12 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
{
if (show_left_panel() && m_focus == focused_menu::LEFT)
{
return;
return false;
}
else if (show_right_panel() && ((m_focus == focused_menu::RIGHTTOP) || (m_focus == focused_menu::RIGHTBOTTOM)))
{
m_topline_datsview = 0;
return;
return false;
}

if (selected_index() < m_available_items && !m_ui_error)
Expand All @@ -1653,12 +1666,12 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
{
if (show_left_panel() && m_focus == focused_menu::LEFT)
{
return;
return false;
}
else if (show_right_panel() && ((m_focus == focused_menu::RIGHTTOP) || (m_focus == focused_menu::RIGHTBOTTOM)))
{
m_topline_datsview = m_total_lines;
return;
return false;
}

if (selected_index() < m_available_items && !m_ui_error)
Expand Down Expand Up @@ -1713,6 +1726,7 @@ bool menu_select_launch::handle_keys(u32 flags, int &iptkey)
break;
}
}
return false;
}


Expand All @@ -1725,13 +1739,13 @@ bool menu_select_launch::handle_events(u32 flags, event &ev)
if (m_pressed)
{
bool const pressed = mouse_pressed();
s32 target_x, target_y;
bool button;
render_target *const mouse_target = machine().ui_input().find_mouse(&target_x, &target_y, &button);
//s32 target_x target_y;
bool button(false);
render_target *const mouse_target = nullptr/*machine().ui_input().find_mouse(&target_x, &target_y, &button)*/;
if (mouse_target && button && (hover() == HOVER_ARROW_DOWN || hover() == HOVER_ARROW_UP))
{
if (pressed)
machine().ui_input().push_mouse_down_event(mouse_target, target_x, target_y);
/*machine().ui_input().push_mouse_down_event(mouse_target, target_x, target_y)*/;
}
else
{
Expand All @@ -1746,6 +1760,7 @@ bool menu_select_launch::handle_events(u32 flags, event &ev)
{
switch (local_menu_event.event_type)
{
#if 0
// if we are hovering over a valid item, select it with a single click
case ui_event::type::MOUSE_DOWN:
if (m_ui_error)
Expand Down Expand Up @@ -1853,6 +1868,7 @@ bool menu_select_launch::handle_events(u32 flags, event &ev)
}
stop = true;
break;
#endif

// caught scroll event
case ui_event::type::MOUSE_WHEEL:
Expand Down Expand Up @@ -1902,6 +1918,7 @@ bool menu_select_launch::handle_events(u32 flags, event &ev)
}
break;

#if 0
case ui_event::type::MOUSE_RDOWN:
if (hover() >= 0 && hover() < item_count() - m_skip_main_items)
{
Expand All @@ -1914,6 +1931,7 @@ bool menu_select_launch::handle_events(u32 flags, event &ev)
stop = true;
}
break;
#endif

// ignore everything else
default:
Expand Down Expand Up @@ -1968,10 +1986,12 @@ void menu_select_launch::draw(u32 flags)
float visible_extra_menu_height = get_customtop() + get_custombottom() + extra_height;

// locate mouse
#if 0
if (noinput)
ignore_mouse();
else
map_mouse();
#endif

// account for extra space at the top and bottom
float visible_main_menu_height = 1.0f - 2.0f * tb_border() - visible_extra_menu_height;
Expand Down Expand Up @@ -2052,9 +2072,11 @@ void menu_select_launch::draw(u32 flags)
float line_x1 = x2 - 0.5f * UI_LINE_WIDTH;
float line_y1 = line_y + line_height();

#if 0
// set the hover if this is our item
if (mouse_in_rect(line_x0, line_y0, line_x1, line_y1) && is_selectable(pitem))
set_hover(itemnum);
#endif

if (is_selected(itemnum) && m_focus == focused_menu::MAIN)
{
Expand Down Expand Up @@ -2167,8 +2189,10 @@ void menu_select_launch::draw(u32 flags)
rgb_t fgcolor = ui().colors().text_color();
rgb_t bgcolor = ui().colors().text_bg_color();

#if 0
if (mouse_in_rect(line_x0, line_y0, line_x1, line_y1) && is_selectable(pitem))
set_hover(count);
#endif

// if we're selected, draw with a different background
if (is_selected(count) && m_focus == focused_menu::MAIN)
Expand Down Expand Up @@ -2251,11 +2275,13 @@ void menu_select_launch::draw_right_panel(float origx1, float origy1, float orig
ui().draw_outlined_box(container(), origx1, origy1, origx2, origy2, rgb_t(0xef, 0x12, 0x47, 0x7b));

rgb_t fgcolor(ui().colors().text_color());
#if 0
if (mouse_in_rect(origx1, origy1, x2, origy2))
{
fgcolor = ui().options().mouseover_color();
set_hover(HOVER_RPANEL_ARROW);
}
#endif

if (!show_right_panel())
{
Expand Down Expand Up @@ -2304,6 +2330,7 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo
rgb_t bgcolor = ui().colors().text_bg_color();
rgb_t fgcolor = ui().colors().text_color();

#if 0
if (mouse_in_rect(x1, y1, x1 + midl, y1 + line_height()))
{
if (m_right_panel != cells)
Expand All @@ -2313,6 +2340,7 @@ float menu_select_launch::draw_right_box_title(float x1, float y1, float x2, flo
set_hover(HOVER_RP_FIRST + cells);
}
}
#endif

if (m_right_panel != cells)
{
Expand Down Expand Up @@ -2756,11 +2784,13 @@ float menu_select_launch::draw_collapsed_left_panel(float x1, float y1, float x2
ui().draw_outlined_box(container(), x1, y1, x2, y2, rgb_t(0xef, 0x12, 0x47, 0x7b)); // FIXME: magic numbers in colour?

rgb_t fgcolor = ui().colors().text_color();
#if 0
if (mouse_in_rect(x1, y1, x2, y2))
{
fgcolor = ui().options().mouseover_color();
set_hover(HOVER_LPANEL_ARROW);
}
#endif

draw_arrow(ar_x0, ar_y0, ar_x1, ar_y1, fgcolor, ROT90);

Expand Down Expand Up @@ -2934,8 +2964,10 @@ void menu_select_launch::infos_render(float origx1, float origy1, float origx2,
bool const down_arrow = (m_topline_datsview + m_right_visible_lines) < m_total_lines;
int const r_visible_lines = m_right_visible_lines - (up_arrow ? 1 : 0) - (down_arrow ? 1 : 0);

#if 0
if (mouse_in_rect(origx1 + gutter_width, oy1, origx2 - gutter_width, origy2))
set_hover(HOVER_INFO_TEXT);
#endif

if (up_arrow)
draw_info_arrow(0, origx1, origx2, oy1, m_info_line_height, m_info_line_height * aspect);
Expand Down
Loading

0 comments on commit 5a40a7b

Please sign in to comment.