diff --git a/TODO.md b/TODO.md index 0c5518f4..e2826a60 100644 --- a/TODO.md +++ b/TODO.md @@ -11,7 +11,6 @@ - volume commands should work on Game Boy - add another FM editor layout - if macros have release, note off should release them -- add ability to select a column by double clicking - add ability to move selection by dragging - Apply button in settings - find and replace diff --git a/src/gui/cursor.cpp b/src/gui/cursor.cpp index 24488073..e47dfd62 100644 --- a/src/gui/cursor.cpp +++ b/src/gui/cursor.cpp @@ -27,6 +27,21 @@ void FurnaceGUI::startSelection(int xCoarse, int xFine, int y, bool fullRow) { if (xCoarse!=selStart.xCoarse || xFine!=selStart.xFine || y!=selStart.y) { curNibble=false; } + + if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left) && !fullRow && settings.doubleClickColumn) { + if (cursor.xCoarse==xCoarse && cursor.xFine==xFine && cursor.y==y) { + // select entire channel + selStart.xCoarse=xCoarse; + selStart.xFine=0; + selStart.y=0; + selEnd.xCoarse=xCoarse; + selEnd.xFine=2+e->curPat[selEnd.xCoarse].effectCols*2; + selEnd.y=e->curSubSong->patLen-1; + + finishSelection(); + return; + } + } if (fullRow) { selStart.xCoarse=firstChannel; @@ -314,4 +329,4 @@ void FurnaceGUI::editAdvance() { selStart=cursor; selEnd=cursor; updateScroll(cursor.y); -} \ No newline at end of file +} diff --git a/src/gui/gui.h b/src/gui/gui.h index 898be919..2c6d54b0 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -950,6 +950,7 @@ class FurnaceGUI { int volCellSpacing; int effectCellSpacing; int effectValCellSpacing; + int doubleClickColumn; unsigned int maxUndoSteps; String mainFontPath; String patFontPath; @@ -1048,6 +1049,7 @@ class FurnaceGUI { volCellSpacing(0), effectCellSpacing(0), effectValCellSpacing(0), + doubleClickColumn(1), maxUndoSteps(100), mainFontPath(""), patFontPath(""), diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 78c81e2c..8176c6be 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -404,6 +404,11 @@ void FurnaceGUI::drawSettings() { settings.cursorMoveNoScroll=cursorMoveNoScrollB; } + bool doubleClickColumnB=settings.doubleClickColumn; + if (ImGui::Checkbox("Double click selects entire column",&doubleClickColumnB)) { + settings.doubleClickColumn=doubleClickColumnB; + } + bool allowEditDockingB=settings.allowEditDocking; if (ImGui::Checkbox("Allow docking editors",&allowEditDockingB)) { settings.allowEditDocking=allowEditDockingB; @@ -2009,7 +2014,7 @@ void FurnaceGUI::syncSettings() { settings.insCellSpacing=e->getConfInt("insCellSpacing",0); settings.volCellSpacing=e->getConfInt("volCellSpacing",0); settings.effectCellSpacing=e->getConfInt("effectCellSpacing",0); - settings.effectValCellSpacing=e->getConfInt("effectValCellSpacing",0); + settings.doubleClickColumn=e->getConfInt("doubleClickColumn",0); clampSetting(settings.mainFontSize,2,96); clampSetting(settings.patFontSize,2,96); @@ -2092,6 +2097,7 @@ void FurnaceGUI::syncSettings() { clampSetting(settings.volCellSpacing,0,32); clampSetting(settings.effectCellSpacing,0,32); clampSetting(settings.effectValCellSpacing,0,32); + clampSetting(settings.doubleClickColumn,0,1); settings.initialSys=e->decodeSysDesc(e->getConfString("initialSys","")); if (settings.initialSys.size()<4) { @@ -2223,6 +2229,7 @@ void FurnaceGUI::commitSettings() { e->setConf("volCellSpacing",settings.volCellSpacing); e->setConf("effectCellSpacing",settings.effectCellSpacing); e->setConf("effectValCellSpacing",settings.effectValCellSpacing); + e->setConf("doubleClickColumn",settings.doubleClickColumn); // colors for (int i=0; i