ui: be consistent with custom_render passed variable names

This commit is contained in:
hap 2024-08-06 14:18:40 +02:00
parent ca65298fd4
commit a75bb5341d
28 changed files with 60 additions and 60 deletions

View File

@ -30,7 +30,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual void populate_text(std::optional<text_layout> &layout, float &width, int &lines) override;

View File

@ -113,7 +113,7 @@ void menu_analog::recompute_metrics(uint32_t width, uint32_t height, float aspec
}
void menu_analog::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2)
void menu_analog::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
// work out how much space to use for field names
float const extrawidth(0.4F + (((ui().box_lr_border() * 2.0F) + ui().get_line_height()) * x_aspect()));
@ -133,19 +133,19 @@ void menu_analog::custom_render(uint32_t flags, void *selectedref, float top, fl
m_prompt = util::string_format(_("menu-analoginput", "Press %s to show settings"), ui().get_general_input_setting(IPT_UI_ON_SCREEN_DISPLAY));
draw_text_box(
&m_prompt, &m_prompt + 1,
m_box_left, m_box_right, y - top, y - top + line_height() + (tb_border() * 2.0F),
m_box_left, m_box_right, origy1 - top, origy1 - top + line_height() + (tb_border() * 2.0F),
text_layout::text_justify::CENTER, text_layout::word_wrapping::TRUNCATE, false,
fgcolor, ui().colors().background_color());
m_box_top = y - top + line_height() + (tb_border() * 3.0F);
firstliney = y - top + line_height() + (tb_border() * 4.0F);
m_visible_fields = std::min<int>(m_field_data.size(), int((y2 + bottom - tb_border() - firstliney) / line_height()));
m_box_top = origy1 - top + line_height() + (tb_border() * 3.0F);
firstliney = origy1 - top + line_height() + (tb_border() * 4.0F);
m_visible_fields = std::min<int>(m_field_data.size(), int((origy2 + bottom - tb_border() - firstliney) / line_height()));
m_box_bottom = firstliney + (line_height() * m_visible_fields) + tb_border();
}
else
{
m_box_top = y2 + tb_border();
m_box_bottom = y2 + bottom;
firstliney = y2 + (tb_border() * 2.0F);
m_box_top = origy2 + tb_border();
m_box_bottom = origy2 + bottom;
firstliney = origy2 + (tb_border() * 2.0F);
m_visible_fields = m_bottom_fields;
}
ui().draw_outlined_box(container(), m_box_left, m_box_top, m_box_right, m_box_bottom, ui().colors().background_color());

View File

@ -31,7 +31,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual std::tuple<int, bool, bool> custom_pointer_updated(bool changed, ui_event const &uievt) override;
virtual void menu_activated() override;

View File

@ -83,7 +83,7 @@ void menu_audit::recompute_metrics(uint32_t width, uint32_t height, float aspect
}
void menu_audit::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2)
void menu_audit::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
switch (m_phase)
{
@ -92,7 +92,7 @@ void menu_audit::custom_render(uint32_t flags, void *selectedref, float top, flo
{
draw_text_box(
&m_prompt, &m_prompt + 1,
x, x2, y2 + tb_border(), y2 + bottom,
origx1, origx2, origy2 + tb_border(), origy2 + bottom,
text_layout::text_justify::CENTER, text_layout::word_wrapping::NEVER, false,
ui().colors().text_color(), UI_GREEN_COLOR);
}

View File

@ -30,7 +30,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual bool custom_ui_back() override;
private:

View File

@ -348,7 +348,7 @@ void menu_settings_dip_switches::recompute_metrics(uint32_t width, uint32_t heig
}
void menu_settings_dip_switches::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
void menu_settings_dip_switches::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
// catch if no DIP locations have to be drawn
if (!m_visible_switch_groups)
@ -371,9 +371,9 @@ void menu_settings_dip_switches::custom_render(uint32_t flags, void *selectedref
}
// draw extra menu area
float const boxwidth((std::max)(width + (lr_border() * 2.0f), x2 - x1));
float const boxwidth((std::max)(width + (lr_border() * 2.0f), origx2 - origx1));
float const boxleft((1.0f - boxwidth) * 0.5f);
ui().draw_outlined_box(container(), boxleft, y2 + tb_border(), boxleft + boxwidth, y2 + bottom, ui().colors().background_color());
ui().draw_outlined_box(container(), boxleft, origy2 + tb_border(), boxleft + boxwidth, origy2 + bottom, ui().colors().background_color());
// calculate centred layout
float const nameleft((1.0f - width) * 0.5f);
@ -404,7 +404,7 @@ void menu_settings_dip_switches::custom_render(uint32_t flags, void *selectedref
}
// draw the name
float const liney(y2 + (tb_border() * 2.0f) + (line_height() * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) * line));
float const liney(origy2 + (tb_border() * 2.0f) + (line_height() * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) * line));
draw_text_normal(
group.name,
nameleft, liney + (line_height() * (DIP_SWITCH_HEIGHT - 1.0f) / 2.0f), namewidth,

View File

@ -84,7 +84,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual std::tuple<int, bool, bool> custom_pointer_updated(bool changed, ui_event const &uievt) override;
private:

View File

@ -60,7 +60,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual void menu_dismissed() override;
private:
@ -96,7 +96,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual void menu_dismissed() override;
private:
@ -145,7 +145,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
private:
enum

View File

@ -44,7 +44,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual std::tuple<int, bool, bool> custom_pointer_updated(bool changed, ui_event const &uievt) override;
virtual void populate_text(std::optional<text_layout> &layout, float &width, int &lines) override;

View File

@ -165,7 +165,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual bool custom_ui_back() override { return !m_search.empty(); }
@ -447,7 +447,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
private:
enum

View File

@ -48,7 +48,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual bool custom_ui_back() override;
private:

View File

@ -32,7 +32,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
private:
virtual void populate() override;

View File

@ -56,7 +56,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual bool custom_ui_back() override { return !m_filename.empty(); }
virtual std::tuple<int, bool, bool> custom_pointer_updated(bool changed, ui_event const &uievt) override;
virtual void menu_activated() override;

View File

@ -44,7 +44,7 @@ protected:
set_custom_space(0.0F, (line_height() * (m_have_analog ? 2.0F : 1.0F)) + (tb_border() * 3.0F));
}
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override
{
if (selectedref)
{
@ -57,20 +57,20 @@ protected:
// measure the name of the token string
float const tokenwidth = (std::min)(get_string_width(token) + (gutter_width() * 2.0F), 1.0F);
float const boxwidth = (std::max)(tokenwidth, x2 - x);
float const boxwidth = (std::max)(tokenwidth, origx2 - origx1);
rgb_t const fgcolor(ui().colors().text_color());
// draw the outer box
ui().draw_outlined_box(
container(),
(1.0F - boxwidth) * 0.5F, y2 + tb_border(),
(1.0F + boxwidth) * 0.5F, y2 + bottom,
(1.0F - boxwidth) * 0.5F, origy2 + tb_border(),
(1.0F + boxwidth) * 0.5F, origy2 + bottom,
ui().colors().background_color());
// show the token
draw_text_normal(
token,
(1.0F - boxwidth) * 0.5F, y2 + (tb_border() * 2.0F), boxwidth,
(1.0F - boxwidth) * 0.5F, origy2 + (tb_border() * 2.0F), boxwidth,
text_layout::text_justify::CENTER, text_layout::word_wrapping::TRUNCATE,
fgcolor);
@ -81,11 +81,11 @@ protected:
case ITEM_CLASS_RELATIVE:
{
// draw the indicator
float const indleft = x + gutter_width();
float const indright = x2 - gutter_width();
float const indtop = y2 + (tb_border() * 2.0F) + (line_height() * 1.2F);
float const indbottom = y2 + (tb_border() * 2.0F) + (line_height() * 1.8F);
float const indcentre = (x + x2) * 0.5F;
float const indleft = origx1 + gutter_width();
float const indright = origx2 - gutter_width();
float const indtop = origy2 + (tb_border() * 2.0F) + (line_height() * 1.2F);
float const indbottom = origy2 + (tb_border() * 2.0F) + (line_height() * 1.8F);
float const indcentre = (origx1 + origx2) * 0.5F;
s32 const value = (input.itemclass() == ITEM_CLASS_ABSOLUTE) ? input.read_as_absolute(ITEM_MODIFIER_NONE) : input.read_as_relative(ITEM_MODIFIER_NONE);
if (0 < value)
{

View File

@ -322,7 +322,7 @@ void menu_input::recompute_metrics(uint32_t width, uint32_t height, float aspect
}
void menu_input::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
void menu_input::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
if (pollingitem)
{
@ -330,7 +330,7 @@ void menu_input::custom_render(uint32_t flags, void *selectedref, float top, flo
char const *const text[] = { seqname.c_str() };
draw_text_box(
std::begin(text), std::end(text),
x1, x2, y2 + tb_border(), y2 + bottom,
origx1, origx2, origy2 + tb_border(), origy2 + bottom,
text_layout::text_justify::CENTER, text_layout::word_wrapping::NEVER, false,
ui().colors().text_color(), ui().colors().background_color());
}
@ -347,7 +347,7 @@ void menu_input::custom_render(uint32_t flags, void *selectedref, float top, flo
char const *const text[] = { errormsg.c_str() };
draw_text_box(
std::begin(text), std::end(text),
x1, x2, y2 + tb_border(), y2 + bottom,
origx1, origx2, origy2 + tb_border(), origy2 + bottom,
text_layout::text_justify::CENTER, text_layout::word_wrapping::NEVER, false,
ui().colors().text_color(), UI_RED_COLOR);
}
@ -359,7 +359,7 @@ void menu_input::custom_render(uint32_t flags, void *selectedref, float top, flo
char const *const text[] = { _("Pressed") };
draw_text_box(
std::begin(text), std::end(text),
x1, x2, y2 + tb_border(), y2 + bottom,
origx1, origx2, origy2 + tb_border(), origy2 + bottom,
text_layout::text_justify::CENTER, text_layout::word_wrapping::NEVER, false,
ui().colors().text_color(), ui().colors().background_color());
}
@ -370,7 +370,7 @@ void menu_input::custom_render(uint32_t flags, void *selectedref, float top, flo
(!item.seq.empty() || item.defseq->empty()) ? clearprompt.c_str() : defaultprompt.c_str() };
draw_text_box(
std::begin(text), std::end(text),
x1, x2, y2 + tb_border(), y2 + bottom,
origx1, origx2, origy2 + tb_border(), origy2 + bottom,
text_layout::text_justify::CENTER, text_layout::word_wrapping::NEVER, false,
ui().colors().text_color(), ui().colors().background_color());
}

View File

@ -65,7 +65,7 @@ protected:
menu_input(mame_ui_manager &mui, render_container &container);
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
void populate_sorted();
void toggle_none_default(input_seq &selected_seq, input_seq &original_seq, const input_seq &selected_defseq);

View File

@ -978,7 +978,7 @@ void menu::recompute_metrics(uint32_t width, uint32_t height, float aspect)
}
void menu::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2)
void menu::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
}

View File

@ -338,7 +338,7 @@ protected:
// draw additional menu content
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect);
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2);
// access to pointer state
bool have_pointer() const noexcept { return m_global_state.have_pointer(); }

View File

@ -39,7 +39,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual bool custom_ui_back() override { return !m_search.empty(); }
private:

View File

@ -797,7 +797,7 @@ void menu_select_launch::recompute_metrics(uint32_t width, uint32_t height, floa
// perform our special rendering
//-------------------------------------------------
void menu_select_launch::custom_render(u32 flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
void menu_select_launch::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
std::string tempbuf[4];

View File

@ -137,7 +137,7 @@ protected:
void launch_system(game_driver const &driver, ui_software_info const &swinfo, std::string const &part) { launch_system(ui(), driver, &swinfo, &part, nullptr); }
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(u32 flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual void menu_activated() override;
virtual void menu_deactivated() override;

View File

@ -32,7 +32,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual bool custom_ui_back() override { return !m_search.empty(); }
virtual std::tuple<int, bool, bool> custom_pointer_updated(bool changed, ui_event const &uievt) override;

View File

@ -258,7 +258,7 @@ void menu_sliders::recompute_metrics(uint32_t width, uint32_t height, float aspe
// custom_render - perform our special rendering
//-------------------------------------------------
void menu_sliders::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
void menu_sliders::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
const slider_state *curslider = (const slider_state *)selectedref;
if (curslider != nullptr)
@ -280,10 +280,10 @@ void menu_sliders::custom_render(uint32_t flags, void *selectedref, float top, f
tempstring.insert(0, " ").insert(0, curslider->description);
// move us to the bottom of the screen, and expand to full width
y2 = 1.0f - tb_border();
y1 = y2 - bottom;
x1 = lr_border();
x2 = 1.0f - lr_border();
float x1 = lr_border();
float x2 = 1.0f - lr_border();
float y1 = origy2 - bottom;
float y2 = 1.0f - tb_border();
// draw extra menu area
ui().draw_outlined_box(container(), x1, y1, x2, y2, ui().colors().background_color());

View File

@ -26,7 +26,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual void menu_activated() override;
virtual void menu_deactivated() override;

View File

@ -38,7 +38,7 @@ protected:
bool one_shot);
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual bool handle_keys(uint32_t flags, int &iptkey) override;
virtual std::tuple<int, bool, bool> custom_pointer_updated(bool changed, ui_event const &uievt) override;
virtual void populate() override;

View File

@ -61,7 +61,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
private:
virtual void populate() override;

View File

@ -492,12 +492,12 @@ void menu_fixed_textbox::recompute_metrics(uint32_t width, uint32_t height, floa
}
void menu_fixed_textbox::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
void menu_fixed_textbox::custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
{
std::string_view const toptext[] = { m_heading };
draw_text_box(
std::begin(toptext), std::end(toptext),
x1, x2, y1 - top, y1 - tb_border(),
origx1, origx2, origy1 - top, origy1 - tb_border(),
text_layout::text_justify::CENTER, text_layout::word_wrapping::NEVER, false,
ui().colors().text_color(), UI_GREEN_COLOR);
}

View File

@ -84,7 +84,7 @@ public:
protected:
virtual void recompute_metrics(uint32_t width, uint32_t height, float aspect) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float x, float y, float x2, float y2) override;
virtual void custom_render(uint32_t flags, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2) override;
virtual void populate_text(std::optional<text_layout> &layout, float &width, int &lines) override;