Extract ShowPopupEnvPoint local function

This commit is contained in:
Robert Müller 2023-11-11 16:42:46 +01:00
parent c48623de8f
commit d8452ad02c

View file

@ -6269,6 +6269,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) if(s_Operation == OP_NONE)
SetHotEnvelopePoint(View, pEnvelope, s_ActiveChannels); SetHotEnvelopePoint(View, pEnvelope, s_ActiveChannels);
@ -6412,8 +6417,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
if(m_vSelectedEnvelopePoints.size() == 1) if(m_vSelectedEnvelopePoints.size() == 1)
{ {
m_UpdateEnvPointInfo = true; m_UpdateEnvPointInfo = true;
static SPopupMenuId s_PopupEnvPointId; ShowPopupEnvPoint();
UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint);
} }
else if(m_vSelectedEnvelopePoints.size() > 1) else if(m_vSelectedEnvelopePoints.size() > 1)
{ {
@ -6556,8 +6560,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
if(IsTangentOutPointSelected(i, c)) if(IsTangentOutPointSelected(i, c))
{ {
m_UpdateEnvPointInfo = true; m_UpdateEnvPointInfo = true;
static SPopupMenuId s_PopupEnvPointId; ShowPopupEnvPoint();
UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint);
} }
UI()->SetActiveItem(nullptr); UI()->SetActiveItem(nullptr);
} }
@ -6689,8 +6692,7 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
if(IsTangentInPointSelected(i, c)) if(IsTangentInPointSelected(i, c))
{ {
m_UpdateEnvPointInfo = true; m_UpdateEnvPointInfo = true;
static SPopupMenuId s_PopupEnvPointId; ShowPopupEnvPoint();
UI()->DoPopupMenu(&s_PopupEnvPointId, UI()->MouseX(), UI()->MouseY(), 150, 56, this, PopupEnvPoint);
} }
UI()->SetActiveItem(nullptr); UI()->SetActiveItem(nullptr);
} }