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

@ -520,10 +520,10 @@ void FurnaceGUI::doAction(int what) {
moveCursorBottom(false);
break;
case GUI_ACTION_PAT_CURSOR_UP_COARSE:
moveCursor(0,-16,false);
moveCursor(0,-editStepCoarse,false);
break;
case GUI_ACTION_PAT_CURSOR_DOWN_COARSE:
moveCursor(0,16,false);
moveCursor(0,editStepCoarse,false);
break;
case GUI_ACTION_PAT_SELECTION_UP:
moveCursor(0,-MAX(1,settings.scrollStep?editStep:1),true);
@ -550,10 +550,10 @@ void FurnaceGUI::doAction(int what) {
moveCursorBottom(true);
break;
case GUI_ACTION_PAT_SELECTION_UP_COARSE:
moveCursor(0,-16,true);
moveCursor(0,-editStepCoarse,true);
break;
case GUI_ACTION_PAT_SELECTION_DOWN_COARSE:
moveCursor(0,16,true);
moveCursor(0,editStepCoarse,true);
break;
case GUI_ACTION_PAT_DELETE:
doDelete();

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();

View file

@ -7484,6 +7484,7 @@ FurnaceGUI::FurnaceGUI():
snesFilterHex(false),
modTableHex(false),
displayEditString(false),
changeCoarse(false),
mobileEdit(false),
killGraphics(false),
safeMode(false),
@ -7573,6 +7574,7 @@ FurnaceGUI::FurnaceGUI():
prevIns(0),
oldRow(0),
editStep(1),
editStepCoarse(16),
exportLoops(0),
soloChan(-1),
orderEditMode(0),

View file

@ -1552,6 +1552,7 @@ class FurnaceGUI {
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
bool displayNew, displayExport, displayPalette, fullScreen, preserveChanPos, sysDupCloneChannels, sysDupEnd, wantScrollList, noteInputPoly, notifyWaveChange;
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
bool changeCoarse;
bool mobileEdit;
bool killGraphics;
bool safeMode;
@ -2145,7 +2146,7 @@ class FurnaceGUI {
int pendingLayoutImportStep;
FixedQueue<bool*,64> pendingLayoutImportReopen;
int curIns, curWave, curSample, curOctave, curOrder, playOrder, prevIns, oldRow, editStep, exportLoops, soloChan, orderEditMode, orderCursor;
int curIns, curWave, curSample, curOctave, curOrder, playOrder, prevIns, oldRow, editStep, editStepCoarse, exportLoops, soloChan, orderEditMode, orderCursor;
int loopOrder, loopRow, loopEnd, isClipping, newSongCategory, latchTarget;
int wheelX, wheelY, dragSourceX, dragSourceXFine, dragSourceY, dragDestinationX, dragDestinationXFine, dragDestinationY, oldBeat, oldBar;
int curGroove, exitDisabledTimer;