From cae7225d591bc8265de90a5ccad4d21b63f9b6fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 11 Nov 2023 16:42:46 +0100 Subject: [PATCH] Extract `ShowPopupEnvPoint` local function --- src/game/editor/editor.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index b60949520ff..f5f0717293f 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -6263,6 +6263,11 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) } { + static SPopupMenuId s_PopupEnvPointId; + const auto &&ShowPopupEnvPoint = [&]() { + UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint); + }; + if(s_Operation == OP_NONE) SetHotEnvelopePoint(View, pEnvelope, s_ActiveChannels); @@ -6406,8 +6411,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) if(m_vSelectedEnvelopePoints.size() == 1) { m_UpdateEnvPointInfo = true; - static SPopupMenuId s_PopupEnvPointId; - UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint); + ShowPopupEnvPoint(); } else if(m_vSelectedEnvelopePoints.size() > 1) { @@ -6550,8 +6554,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) if(IsTangentOutPointSelected(i, c)) { m_UpdateEnvPointInfo = true; - static SPopupMenuId s_PopupEnvPointId; - UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint); + ShowPopupEnvPoint(); } UI()->SetActiveItem(nullptr); } @@ -6683,8 +6686,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View) if(IsTangentInPointSelected(i, c)) { m_UpdateEnvPointInfo = true; - static SPopupMenuId s_PopupEnvPointId; - UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint); + ShowPopupEnvPoint(); } UI()->SetActiveItem(nullptr); }