Display envelope name

This commit is contained in:
Learath 2020-01-23 20:26:06 +01:00
parent 4ef9866b84
commit 2abe4fbcfb
3 changed files with 35 additions and 8 deletions

View file

@ -1536,7 +1536,7 @@ void CEditor::DoSoundSource(CSoundSource *pSource, int Index)
m_Map.m_UndoModified++; m_Map.m_UndoModified++;
static int s_SourcePopupID = 0; static int s_SourcePopupID = 0;
UiInvokePopupMenu(&s_SourcePopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 200, PopupSource); UiInvokePopupMenu(&s_SourcePopupID, 0, UI()->MouseX(), UI()->MouseY(), 180, 200, PopupSource);
m_LockMouse = false; m_LockMouse = false;
} }
s_Operation = OP_NONE; s_Operation = OP_NONE;
@ -1741,7 +1741,7 @@ void CEditor::DoQuad(CQuad *q, int Index)
m_SelectedQuadIndex = FindSelectedQuadIndex(Index); m_SelectedQuadIndex = FindSelectedQuadIndex(Index);
static int s_QuadPopupID = 0; static int s_QuadPopupID = 0;
UiInvokePopupMenu(&s_QuadPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 180, PopupQuad); UiInvokePopupMenu(&s_QuadPopupID, 0, UI()->MouseX(), UI()->MouseY(), 160, 180, PopupQuad);
m_LockMouse = false; m_LockMouse = false;
} }
s_Operation = OP_NONE; s_Operation = OP_NONE;
@ -3247,6 +3247,33 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
Change = i; Change = i;
} }
} }
else if(pProps[i].m_Type == PROPTYPE_ENVELOPE)
{
CUIRect Inc, Dec;
char aBuf[64];
int Cur = pProps[i].m_Value;
Shifter.VSplitRight(10.0f, &Shifter, &Inc);
Shifter.VSplitLeft(10.0f, &Dec, &Shifter);
//TODO: Truncate this properly
int FieldLength = Shifter.w / 7.5f;
str_format(aBuf, sizeof(aBuf),"%.*s", FieldLength, Cur > 0 ? m_Map.m_lEnvelopes[Cur - 1]->m_aName : "None");
RenderTools()->DrawUIRect(&Shifter, Color, 0, 5.0f);
UI()->DoLabel(&Shifter, aBuf, 10, 0, -1);
if(DoButton_ButtonDec((char *) &pIDs[i] +1, 0, 0, &Dec, 0, "Previous Envelope"))
{
*pNewVal = pProps[i].m_Value-1;
Change = i;
}
if(DoButton_ButtonInc(((char *)&pIDs[i])+2, 0, 0, &Inc, 0, "Next Envelope"))
{
*pNewVal = pProps[i].m_Value+1;
Change = i;
}
}
} }
return Change; return Change;
@ -3437,7 +3464,7 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
} }
static int s_LayerPopupID = 0; static int s_LayerPopupID = 0;
if(Result == 2) if(Result == 2)
UiInvokePopupMenu(&s_LayerPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 300, PopupLayer); UiInvokePopupMenu(&s_LayerPopupID, 0, UI()->MouseX(), UI()->MouseY(), 180, 300, PopupLayer);
} }
LayerCur += 14.0f; LayerCur += 14.0f;

View file

@ -861,7 +861,7 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
{"Shift by", m_pEditor->m_ShiftBy, PROPTYPE_INT_SCROLL, 1, 100000}, {"Shift by", m_pEditor->m_ShiftBy, PROPTYPE_INT_SCROLL, 1, 100000},
{"Image", m_Image, PROPTYPE_IMAGE, 0, 0}, {"Image", m_Image, PROPTYPE_IMAGE, 0, 0},
{"Color", Color, PROPTYPE_COLOR, 0, 0}, {"Color", Color, PROPTYPE_COLOR, 0, 0},
{"Color Env", m_ColorEnv+1, PROPTYPE_INT_STEP, 0, m_pEditor->m_Map.m_lEnvelopes.size()+1}, {"Color Env", m_ColorEnv+1, PROPTYPE_ENVELOPE, 0, 0},
{"Color TO", m_ColorEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Color TO", m_ColorEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Auto Rule", m_AutoMapperConfig, PROPTYPE_AUTOMAPPER, m_Image, 0}, {"Auto Rule", m_AutoMapperConfig, PROPTYPE_AUTOMAPPER, m_Image, 0},
{"Seed", m_Seed, PROPTYPE_INT_SCROLL, 0, 1000000000}, {"Seed", m_Seed, PROPTYPE_INT_SCROLL, 0, 1000000000},

View file

@ -570,9 +570,9 @@ int CEditor::PopupQuad(CEditor *pEditor, CUIRect View)
CProperty aProps[] = { CProperty aProps[] = {
{"Pos X", pCurrentQuad->m_aPoints[4].x/1000, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Pos X", pCurrentQuad->m_aPoints[4].x/1000, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Pos Y", pCurrentQuad->m_aPoints[4].y/1000, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Pos Y", pCurrentQuad->m_aPoints[4].y/1000, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Pos. Env", pCurrentQuad->m_PosEnv+1, PROPTYPE_INT_STEP, 0, pEditor->m_Map.m_lEnvelopes.size()+1}, {"Pos. Env", pCurrentQuad->m_PosEnv+1, PROPTYPE_ENVELOPE, 0, 0},
{"Pos. TO", pCurrentQuad->m_PosEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Pos. TO", pCurrentQuad->m_PosEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Color Env", pCurrentQuad->m_ColorEnv+1, PROPTYPE_INT_STEP, 0, pEditor->m_Map.m_lEnvelopes.size()+1}, {"Color Env", pCurrentQuad->m_ColorEnv+1, PROPTYPE_ENVELOPE, 0, 0},
{"Color TO", pCurrentQuad->m_ColorEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Color TO", pCurrentQuad->m_ColorEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{0}, {0},
@ -712,9 +712,9 @@ int CEditor::PopupSource(CEditor *pEditor, CUIRect View)
{"Pan", pSource->m_Pan, PROPTYPE_BOOL, 0, 1}, {"Pan", pSource->m_Pan, PROPTYPE_BOOL, 0, 1},
{"Delay", pSource->m_TimeDelay, PROPTYPE_INT_SCROLL, 0, 1000000}, {"Delay", pSource->m_TimeDelay, PROPTYPE_INT_SCROLL, 0, 1000000},
{"Falloff", pSource->m_Falloff, PROPTYPE_INT_SCROLL, 0, 255}, {"Falloff", pSource->m_Falloff, PROPTYPE_INT_SCROLL, 0, 255},
{"Pos. Env", pSource->m_PosEnv+1, PROPTYPE_INT_STEP, 0, pEditor->m_Map.m_lEnvelopes.size()+1}, {"Pos. Env", pSource->m_PosEnv+1, PROPTYPE_ENVELOPE, 0, 0},
{"Pos. TO", pSource->m_PosEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Pos. TO", pSource->m_PosEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{"Sound Env", pSource->m_SoundEnv+1, PROPTYPE_INT_STEP, 0, pEditor->m_Map.m_lEnvelopes.size()+1}, {"Sound Env", pSource->m_SoundEnv+1, PROPTYPE_ENVELOPE, 0, 0},
{"Sound. TO", pSource->m_PosEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000}, {"Sound. TO", pSource->m_PosEnvOffset, PROPTYPE_INT_SCROLL, -1000000, 1000000},
{0}, {0},