implement channel collapsing

kind of. TODO: care about selection
This commit is contained in:
tildearrow 2022-02-05 02:41:29 -05:00
parent 67acc7f7ab
commit 67346fb6ca
1 changed files with 135 additions and 120 deletions

View File

@ -2624,7 +2624,11 @@ void FurnaceGUI::drawPattern() {
for (int i=0; i<chans; i++) {
if (!e->song.chanShow[i]) continue;
ImGui::TableNextColumn();
if (e->song.chanCollapse[i]) {
snprintf(chanID,256,"%s##_CH%d",e->getChannelShortName(i),i);
} else {
snprintf(chanID,256," %s##_CH%d",e->getChannelName(i),i);
}
bool muted=e->isChannelMuted(i);
ImVec4 chanHead=muted?uiColors[GUI_COLOR_CHANNEL_MUTED]:uiColors[GUI_COLOR_CHANNEL_FM+e->getChannelType(i)];
ImVec4 chanHeadActive=chanHead;
@ -2635,6 +2639,8 @@ void FurnaceGUI::drawPattern() {
ImGui::PushStyleColor(ImGuiCol_Header,chanHead);
ImGui::PushStyleColor(ImGuiCol_HeaderActive,chanHeadActive);
ImGui::PushStyleColor(ImGuiCol_HeaderHovered,chanHeadHover);
// help me why is the color leakingggggggg
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg,ImGui::GetColorU32(chanHead));
if (muted) ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_CHANNEL_MUTED]);
ImGui::Selectable(chanID,true,ImGuiSelectableFlags_NoPadWithHalfSpacing,ImVec2(0.0f,lineHeight+1.0f*dpiScale));
if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) {
@ -2653,9 +2659,15 @@ void FurnaceGUI::drawPattern() {
e->toggleSolo(i);
}
if (extraChannelButtons) {
snprintf(chanID,256,"%c##_HCH%d",e->song.chanCollapse[i]?'+':'-',i);
ImGui::SetCursorPosX(ImGui::GetCursorPosX()+4.0f*dpiScale);
if (ImGui::SmallButton(chanID)) {
e->song.chanCollapse[i]=!e->song.chanCollapse[i];
}
if (!e->song.chanCollapse[i]) {
ImGui::SameLine();
snprintf(chanID,256,"<##_LCH%d",i);
ImGui::BeginDisabled(e->song.pat[i].effectRows<=1);
ImGui::SetCursorPosX(ImGui::GetCursorPosX()+4.0f*dpiScale);
if (ImGui::SmallButton(chanID)) {
e->song.pat[i].effectRows--;
if (e->song.pat[i].effectRows<1) e->song.pat[i].effectRows=1;
@ -2669,6 +2681,7 @@ void FurnaceGUI::drawPattern() {
if (e->song.pat[i].effectRows>8) e->song.pat[i].effectRows=8;
}
ImGui::EndDisabled();
}
ImGui::Spacing();
}
}
@ -2764,6 +2777,7 @@ void FurnaceGUI::drawPattern() {
}
ImGui::PopStyleColor();
if (!e->song.chanCollapse[j]) {
if (pat->data[i][2]==-1) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_PATTERN_INACTIVE]);
sprintf(id,"..##PI_%d_%d",i,j);
@ -2889,6 +2903,7 @@ void FurnaceGUI::drawPattern() {
}
}
}
}
for (int i=0; i<=dummyRows; i++) {
ImGui::TableNextRow(0,lineHeight);
ImGui::TableNextColumn();