From a512dd3c6b0e4b806b06e05381047ba6743ea70d Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 9 Dec 2022 03:51:41 -0500 Subject: [PATCH] GUI: prepare to add a time bar to sample editor --- src/gui/sampleEdit.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gui/sampleEdit.cpp b/src/gui/sampleEdit.cpp index 80e9e88b3..801281ef4 100644 --- a/src/gui/sampleEdit.cpp +++ b/src/gui/sampleEdit.cpp @@ -975,7 +975,26 @@ void FurnaceGUI::drawSampleEdit() { ImGui::Separator(); - ImVec2 avail=ImGui::GetContentRegionAvail(); // graph size determined here + // time + ImDrawList* dl=ImGui::GetWindowDrawList(); + ImGuiWindow* window=ImGui::GetCurrentWindow(); + + ImVec2 size=ImVec2(ImGui::GetContentRegionAvail().x,ImGui::GetFontSize()+2.0*dpiScale); + + ImVec2 minArea=window->DC.CursorPos; + ImVec2 maxArea=ImVec2( + minArea.x+size.x, + minArea.y+size.y + ); + ImRect rect=ImRect(minArea,maxArea); + ImGuiStyle& style=ImGui::GetStyle(); + + ImGui::ItemSize(size,style.FramePadding.y); + if (ImGui::ItemAdd(rect,ImGui::GetID("SETime"))) { + dl->AddText(minArea,0xffffffff,"0"); + } + + ImVec2 avail=ImGui::GetContentRegionAvail(); // sample view size determined here // don't do this. reason: mobile. /*if (ImGui::GetContentRegionAvail().y>(ImGui::GetContentRegionAvail().x*0.5f)) { avail=ImVec2(ImGui::GetContentRegionAvail().x,ImGui::GetContentRegionAvail().x*0.5f);