From 507f3d7de1173c47afead5b8e83f4e6950f42f60 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Fri, 4 Feb 2022 00:11:16 -0500 Subject: [PATCH] GUI: there we go now the buttons won't scroll in lists --- src/gui/gui.cpp | 64 ++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 59c8ccfc6..c7a85771c 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1911,22 +1911,27 @@ void FurnaceGUI::drawWaveList() { } } ImGui::Separator(); - for (int i=0; i<(int)e->song.wave.size(); i++) { - DivWavetable* wave=e->song.wave[i]; - for (int i=0; ilen; i++) { - wavePreview[i]=wave->data[i]; - } - if (wave->len>0) wavePreview[wave->len]=wave->data[wave->len-1]; - if (ImGui::Selectable(fmt::sprintf("%d##_WAVE%d\n",i,i).c_str(),curWave==i)) { - curWave=i; - } - if (ImGui::IsItemHovered()) { - if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { - waveEditOpen=true; + if (ImGui::BeginTable("WaveListScroll",1,ImGuiTableFlags_ScrollY)) { + for (int i=0; i<(int)e->song.wave.size(); i++) { + DivWavetable* wave=e->song.wave[i]; + for (int i=0; ilen; i++) { + wavePreview[i]=wave->data[i]; } + if (wave->len>0) wavePreview[wave->len]=wave->data[wave->len-1]; + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if (ImGui::Selectable(fmt::sprintf("%d##_WAVE%d\n",i,i).c_str(),curWave==i)) { + curWave=i; + } + if (ImGui::IsItemHovered()) { + if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { + waveEditOpen=true; + } + } + ImGui::SameLine(); + PlotNoLerp(fmt::sprintf("##_WAVEP%d",i).c_str(),wavePreview,wave->len+1,0,NULL,0,wave->max); } - ImGui::SameLine(); - PlotNoLerp(fmt::sprintf("##_WAVEP%d",i).c_str(),wavePreview,wave->len+1,0,NULL,0,wave->max); + ImGui::EndTable(); } } if (ImGui::IsWindowFocused()) curWindow=GUI_WINDOW_WAVE_LIST; @@ -2046,21 +2051,26 @@ void FurnaceGUI::drawSampleList() { e->stopSamplePreview(); } ImGui::Separator(); - for (int i=0; i<(int)e->song.sample.size(); i++) { - DivSample* sample=e->song.sample[i]; - if ((i%12)==0) { - if (i>0) ImGui::Unindent(); - ImGui::Text("Bank %d",i/12); - ImGui::Indent(); - } - if (ImGui::Selectable(fmt::sprintf("%s: %s##_SAM%d",sampleNote[i%12],sample->name,i).c_str(),curSample==i)) { - curSample=i; - } - if (ImGui::IsItemHovered()) { - if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { - sampleEditOpen=true; + if (ImGui::BeginTable("SampleListScroll",1,ImGuiTableFlags_ScrollY)) { + for (int i=0; i<(int)e->song.sample.size(); i++) { + DivSample* sample=e->song.sample[i]; + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if ((i%12)==0) { + if (i>0) ImGui::Unindent(); + ImGui::Text("Bank %d",i/12); + ImGui::Indent(); + } + if (ImGui::Selectable(fmt::sprintf("%s: %s##_SAM%d",sampleNote[i%12],sample->name,i).c_str(),curSample==i)) { + curSample=i; + } + if (ImGui::IsItemHovered()) { + if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) { + sampleEditOpen=true; + } } } + ImGui::EndTable(); } ImGui::Unindent(); }