GUI: move cursor up on pull delete

fixes #28
This commit is contained in:
tildearrow 2022-01-20 02:53:59 -05:00
parent 4ee17d35cd
commit 04240ffa46
2 changed files with 16 additions and 0 deletions

View file

@ -1971,6 +1971,11 @@ void FurnaceGUI::drawSettings() {
if (ImGui::RadioButton("Double-click##soloD",settings.soloAction==2)) { if (ImGui::RadioButton("Double-click##soloD",settings.soloAction==2)) {
settings.soloAction=2; settings.soloAction=2;
} }
bool pullDeleteBehaviorB=settings.pullDeleteBehavior;
if (ImGui::Checkbox("Move cursor up on backspace-delete",&pullDeleteBehaviorB)) {
settings.pullDeleteBehavior=pullDeleteBehaviorB;
}
ImGui::EndTabItem(); ImGui::EndTabItem();
} }
if (ImGui::BeginTabItem("Audio")) { if (ImGui::BeginTabItem("Audio")) {
@ -2088,6 +2093,7 @@ void FurnaceGUI::syncSettings() {
settings.patRowsBase=e->getConfInt("patRowsBase",0); settings.patRowsBase=e->getConfInt("patRowsBase",0);
settings.orderRowsBase=e->getConfInt("orderRowsBase",1); settings.orderRowsBase=e->getConfInt("orderRowsBase",1);
settings.soloAction=e->getConfInt("soloAction",0); settings.soloAction=e->getConfInt("soloAction",0);
settings.pullDeleteBehavior=e->getConfInt("pullDeleteBehavior",1);
} }
void FurnaceGUI::commitSettings() { void FurnaceGUI::commitSettings() {
@ -2106,6 +2112,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("patRowsBase",settings.patRowsBase); e->setConf("patRowsBase",settings.patRowsBase);
e->setConf("orderRowsBase",settings.orderRowsBase); e->setConf("orderRowsBase",settings.orderRowsBase);
e->setConf("soloAction",settings.soloAction); e->setConf("soloAction",settings.soloAction);
e->setConf("pullDeleteBehavior",settings.pullDeleteBehavior);
e->saveConf(); e->saveConf();
@ -2413,6 +2420,13 @@ void FurnaceGUI::doPullDelete() {
prepareUndo(GUI_ACTION_PATTERN_PULL); prepareUndo(GUI_ACTION_PATTERN_PULL);
curNibble=false; curNibble=false;
if (settings.pullDeleteBehavior) {
if (--selStart.y<0) selStart.y=0;
if (--selEnd.y<0) selEnd.y=0;
if (--cursor.y<0) cursor.y=0;
updateScroll(cursor.y);
}
int iCoarse=selStart.xCoarse; int iCoarse=selStart.xCoarse;
int iFine=selStart.xFine; int iFine=selStart.xFine;
int ord=e->getOrder(); int ord=e->getOrder();

View file

@ -188,6 +188,7 @@ class FurnaceGUI {
int patRowsBase; int patRowsBase;
int orderRowsBase; int orderRowsBase;
int soloAction; int soloAction;
int pullDeleteBehavior;
unsigned int maxUndoSteps; unsigned int maxUndoSteps;
String mainFontPath; String mainFontPath;
String patFontPath; String patFontPath;
@ -206,6 +207,7 @@ class FurnaceGUI {
patRowsBase(0), patRowsBase(0),
orderRowsBase(1), orderRowsBase(1),
soloAction(0), soloAction(0),
pullDeleteBehavior(1),
maxUndoSteps(100), maxUndoSteps(100),
mainFontPath(""), mainFontPath(""),
patFontPath("") {} patFontPath("") {}