GUI: finally add ability to change coarse editstep

This commit is contained in:
tildearrow 2024-04-26 12:53:33 -05:00
parent a42d6605d5
commit 7f354705e3
4 changed files with 84 additions and 29 deletions

View file

@ -691,15 +691,28 @@ void FurnaceGUI::drawEditControls() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::AlignTextToFramePadding();
ImGui::Text("Edit Step");
if (ImGui::SmallButton(changeCoarse?"Coarse Step":"Edit Step")) {
changeCoarse=!changeCoarse;
}
ImGui::TableNextColumn();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
if (editStep<0) editStep=0;
if (changeCoarse) {
if (ImGui::InputInt("##CoarseStep",&editStepCoarse,1,1)) {
if (editStepCoarse>=e->curSubSong->patLen) editStepCoarse=e->curSubSong->patLen-1;
if (editStepCoarse<0) editStepCoarse=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
}
} else {
if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
if (editStep<0) editStep=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
}
}
@ -837,15 +850,28 @@ void FurnaceGUI::drawEditControls() {
}
ImGui::SameLine();
ImGui::Text("Edit Step");
if (ImGui::SmallButton(changeCoarse?"Coarse Step":"Edit Step")) {
changeCoarse=!changeCoarse;
}
ImGui::SameLine();
ImGui::SetNextItemWidth(96.0f*dpiScale);
if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
if (editStep<0) editStep=0;
if (changeCoarse) {
if (ImGui::InputInt("##CoarseStep",&editStepCoarse,1,1)) {
if (editStepCoarse>=e->curSubSong->patLen) editStepCoarse=e->curSubSong->patLen-1;
if (editStepCoarse<0) editStepCoarse=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
}
} else {
if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
if (editStep<0) editStep=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
}
}
@ -941,14 +967,27 @@ void FurnaceGUI::drawEditControls() {
}
}
ImGui::Text("Step");
if (ImGui::SmallButton(changeCoarse?"Coarse":"Step")) {
changeCoarse=!changeCoarse;
}
ImGui::SetNextItemWidth(avail);
if (ImGui::InputInt("##EditStep",&editStep,0,0)) {
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
if (editStep<0) editStep=0;
if (changeCoarse) {
if (ImGui::InputInt("##CoarseStep",&editStepCoarse,1,1)) {
if (editStepCoarse>=e->curSubSong->patLen) editStepCoarse=e->curSubSong->patLen-1;
if (editStepCoarse<0) editStepCoarse=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
}
} else {
if (ImGui::InputInt("##EditStep",&editStep,0,0)) {
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
if (editStep<0) editStep=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
}
}
@ -1096,16 +1135,29 @@ void FurnaceGUI::drawEditControls() {
}
ImGui::AlignTextToFramePadding();
ImGui::Text("Step");
if (ImGui::SmallButton(changeCoarse?"Coarse":"Step")) {
changeCoarse=!changeCoarse;
}
ImGui::SameLine();
ImGui::SetCursorPosX(cursor);
ImGui::SetNextItemWidth(avail);
if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
if (editStep<0) editStep=0;
if (changeCoarse) {
if (ImGui::InputInt("##CoarseStep",&editStepCoarse,1,1)) {
if (editStepCoarse>=e->curSubSong->patLen) editStepCoarse=e->curSubSong->patLen-1;
if (editStepCoarse<0) editStepCoarse=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
}
} else {
if (ImGui::InputInt("##EditStep",&editStep,1,1)) {
if (editStep>=e->curSubSong->patLen) editStep=e->curSubSong->patLen-1;
if (editStep<0) editStep=0;
if (settings.insFocusesPattern && !ImGui::IsItemActive() && patternOpen) {
nextWindow=GUI_WINDOW_PATTERN;
}
}
}
ImGui::NextColumn();