Reserve same space for all envelope channel buttons

Keep all the UI elements in the envelope editor at the same position, independent from the number of channels of the selected envelope.

Previously the UI elements changed their position due to different numbers of channels of the different envelope types. Now the space for the maximum number of channels is always reserved and the UI elements don't move around.
This commit is contained in:
Robert Müller 2023-01-24 20:19:30 +01:00
parent 7ce143bd9e
commit 27790be784

View file

@ -4972,12 +4972,14 @@ void CEditor::RenderEnvelopeEditor(CUIRect View)
static int s_aChannelButtons[CEnvPoint::MAX_CHANNELS] = {0};
int Bit = 1;
for(int i = 0; i < pEnvelope->m_Channels; i++, Bit <<= 1)
for(int i = 0; i < CEnvPoint::MAX_CHANNELS; i++, Bit <<= 1)
{
ToolBar.VSplitLeft(15.0f, &Button, &ToolBar);
if(DoButton_Env(&s_aChannelButtons[i], s_aapNames[pEnvelope->m_Channels - 1][i], s_ActiveChannels & Bit, &Button, s_aapDescriptions[pEnvelope->m_Channels - 1][i], aColors[i]))
s_ActiveChannels ^= Bit;
if(i < pEnvelope->m_Channels)
{
if(DoButton_Env(&s_aChannelButtons[i], s_aapNames[pEnvelope->m_Channels - 1][i], s_ActiveChannels & Bit, &Button, s_aapDescriptions[pEnvelope->m_Channels - 1][i], aColors[i]))
s_ActiveChannels ^= Bit;
}
}
// sync checkbox