| 4587 | } |
| 4588 | |
| 4589 | void CEditor::RenderEnvelopeEditor(CUIRect View) |
| 4590 | { |
| 4591 | Map()->m_SelectedEnvelope = Map()->m_vpEnvelopes.empty() ? -1 : std::clamp(Map()->m_SelectedEnvelope, 0, (int)Map()->m_vpEnvelopes.size() - 1); |
| 4592 | std::shared_ptr<CEnvelope> pEnvelope = Map()->m_vpEnvelopes.empty() ? nullptr : Map()->m_vpEnvelopes[Map()->m_SelectedEnvelope]; |
| 4593 | |
| 4594 | static EEnvelopeEditorOp s_Operation = EEnvelopeEditorOp::NONE; |
| 4595 | static std::vector<float> s_vAccurateDragValuesX = {}; |
| 4596 | static std::vector<float> s_vAccurateDragValuesY = {}; |
| 4597 | static float s_MouseXStart = 0.0f; |
| 4598 | static float s_MouseYStart = 0.0f; |
| 4599 | |
| 4600 | static CLineInput s_NameInput; |
| 4601 | |
| 4602 | CUIRect ToolBar, CurveBar, ColorBar, DragBar; |
| 4603 | View.HSplitTop(30.0f, &DragBar, nullptr); |
| 4604 | DragBar.y -= 2.0f; |
| 4605 | DragBar.w += 2.0f; |
| 4606 | DragBar.h += 4.0f; |
| 4607 | DoEditorDragBar(View, &DragBar, EDragSide::TOP, &m_aExtraEditorSplits[EXTRAEDITOR_ENVELOPES]); |
| 4608 | View.HSplitTop(15.0f, &ToolBar, &View); |
| 4609 | View.HSplitTop(15.0f, &CurveBar, &View); |
| 4610 | ToolBar.Margin(2.0f, &ToolBar); |
| 4611 | CurveBar.Margin(2.0f, &CurveBar); |
| 4612 | |
| 4613 | bool CurrentEnvelopeSwitched = false; |
| 4614 | |
| 4615 | // do the toolbar |
| 4616 | static int s_ActiveChannels = 0xf; |
| 4617 | { |
| 4618 | CUIRect Button; |
| 4619 | |
| 4620 | // redo button |
| 4621 | ToolBar.VSplitRight(25.0f, &ToolBar, &Button); |
| 4622 | static int s_RedoButton = 0; |
| 4623 | if(DoButton_FontIcon(&s_RedoButton, FontIcon::REDO, Map()->m_EnvelopeEditorHistory.CanRedo() ? 0 : -1, &Button, BUTTONFLAG_LEFT, "[Ctrl+Y] Redo the last action.", IGraphics::CORNER_R, 11.0f) == 1) |
| 4624 | { |
| 4625 | Map()->m_EnvelopeEditorHistory.Redo(); |
| 4626 | } |
| 4627 | |
| 4628 | // undo button |
| 4629 | ToolBar.VSplitRight(25.0f, &ToolBar, &Button); |
| 4630 | ToolBar.VSplitRight(10.0f, &ToolBar, nullptr); |
| 4631 | static int s_UndoButton = 0; |
| 4632 | if(DoButton_FontIcon(&s_UndoButton, FontIcon::UNDO, Map()->m_EnvelopeEditorHistory.CanUndo() ? 0 : -1, &Button, BUTTONFLAG_LEFT, "[Ctrl+Z] Undo the last action.", IGraphics::CORNER_L, 11.0f) == 1) |
| 4633 | { |
| 4634 | Map()->m_EnvelopeEditorHistory.Undo(); |
| 4635 | } |
| 4636 | |
| 4637 | ToolBar.VSplitRight(50.0f, &ToolBar, &Button); |
| 4638 | static int s_NewSoundButton = 0; |
| 4639 | if(DoButton_Editor(&s_NewSoundButton, "Sound+", 0, &Button, BUTTONFLAG_LEFT, "Create a new sound envelope.")) |
| 4640 | { |
| 4641 | Map()->m_EnvelopeEditorHistory.Execute(std::make_shared<CEditorActionEnvelopeAdd>(Map(), CEnvelope::EType::SOUND)); |
| 4642 | pEnvelope = Map()->m_vpEnvelopes[Map()->m_SelectedEnvelope]; |
| 4643 | CurrentEnvelopeSwitched = true; |
| 4644 | } |
| 4645 | |
| 4646 | ToolBar.VSplitRight(5.0f, &ToolBar, nullptr); |
nothing calls this directly
no test coverage detected