GUI: add more options for selection drag

ability to copy by dragging selection
This commit is contained in:
tildearrow 2025-01-31 17:29:51 -05:00
parent e22d46e619
commit b64c06dd4d
6 changed files with 21 additions and 7 deletions

View file

@ -409,6 +409,7 @@ void DivPlatformMSM6258::setFlags(const DivConfig& flags) {
for (int i=0; i<1; i++) { for (int i=0; i<1; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;
} }
variableRate=flags.getBool("variableRate",false);
} }
int DivPlatformMSM6258::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) { int DivPlatformMSM6258::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {

View file

@ -51,6 +51,7 @@ class DivPlatformMSM6258: public DivDispatch {
unsigned char sampleBank, msmPan, msmDivider, rateSel, msmClock, clockSel; unsigned char sampleBank, msmPan, msmDivider, rateSel, msmClock, clockSel;
signed char msmDividerCount, msmClockCount; signed char msmDividerCount, msmClockCount;
bool updateSampleFreq; bool updateSampleFreq;
bool variableRate;
short msmOut; short msmOut;
int delay, updateOsc, sample, samplePos; int delay, updateOsc, sample, samplePos;

View file

@ -43,7 +43,7 @@ void FurnaceGUI::startSelection(int xCoarse, int xFine, int y, bool fullRow) {
} }
} }
if ((settings.dragMovesSelection==1 || (settings.dragMovesSelection==2 && (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)))) && !fullRow) { if (((settings.dragMovesSelection==1 || settings.dragMovesSelection==3 || settings.dragMovesSelection==5) || ((settings.dragMovesSelection==2 || settings.dragMovesSelection==4) && (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl)))) && !fullRow) {
if (xCoarse>=selStart.xCoarse && (xFine>=selStart.xFine || xCoarse>selStart.xCoarse) && y>=selStart.y && if (xCoarse>=selStart.xCoarse && (xFine>=selStart.xFine || xCoarse>selStart.xCoarse) && y>=selStart.y &&
xCoarse<=selEnd.xCoarse && (xFine<=selEnd.xFine || xCoarse<selEnd.xCoarse) && y<=selEnd.y) { xCoarse<=selEnd.xCoarse && (xFine<=selEnd.xFine || xCoarse<selEnd.xCoarse) && y<=selEnd.y) {
dragging=true; dragging=true;
@ -176,7 +176,7 @@ void FurnaceGUI::finishSelection() {
selStart=cursorDrag; selStart=cursorDrag;
selEnd=cursorDrag; selEnd=cursorDrag;
} else { // perform drag } else { // perform drag
doDrag(); doDrag(settings.dragMovesSelection==3 || settings.dragMovesSelection==4 || (settings.dragMovesSelection==5 && (ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl))));
} }
dragging=false; dragging=false;

View file

@ -1809,15 +1809,15 @@ void FurnaceGUI::doAbsorbInstrument() {
logD("doAbsorbInstrument -- searched %d orders", curOrder-orderIdx); logD("doAbsorbInstrument -- searched %d orders", curOrder-orderIdx);
} }
void FurnaceGUI::doDrag() { void FurnaceGUI::doDrag(bool copy) {
int len=dragEnd.xCoarse-dragStart.xCoarse+1; int len=dragEnd.xCoarse-dragStart.xCoarse+1;
if (len<1) return; if (len<1) return;
prepareUndo(GUI_UNDO_PATTERN_DRAG); prepareUndo(GUI_UNDO_PATTERN_DRAG);
// copy and clear // copy and clear (if copy is false)
String c=doCopy(true,false,dragStart,dragEnd); String c=doCopy(!copy,false,dragStart,dragEnd);
logV(_("copy: %s"),c); logV(_("copy: %s"),c);

View file

@ -2984,7 +2984,7 @@ class FurnaceGUI {
void doRedo(); void doRedo();
void doFind(); void doFind();
void doReplace(); void doReplace();
void doDrag(); void doDrag(bool copy=false);
void editOptions(bool topMenu); void editOptions(bool topMenu);
DivSystem systemPicker(bool fullWidth); DivSystem systemPicker(bool fullWidth);
void noteInput(int num, int key, int vol=-1); void noteInput(int num, int key, int vol=-1);

View file

@ -2728,6 +2728,18 @@ void FurnaceGUI::drawSettings() {
settings.dragMovesSelection=2; settings.dragMovesSelection=2;
settingsChanged=true; settingsChanged=true;
} }
if (ImGui::RadioButton(_("Yes (copy)##dms3"),settings.dragMovesSelection==3)) {
settings.dragMovesSelection=3;
settingsChanged=true;
}
if (ImGui::RadioButton(_("Yes (while holding Ctrl only and copy)##dms4"),settings.dragMovesSelection==4)) {
settings.dragMovesSelection=4;
settingsChanged=true;
}
if (ImGui::RadioButton(_("Yes (holding Ctrl copies)##dms5"),settings.dragMovesSelection==5)) {
settings.dragMovesSelection=5;
settingsChanged=true;
}
ImGui::Unindent(); ImGui::Unindent();
ImGui::Text(_("Toggle channel solo on:")); ImGui::Text(_("Toggle channel solo on:"));
@ -5316,7 +5328,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
clampSetting(settings.effectValCellSpacing,0,32); clampSetting(settings.effectValCellSpacing,0,32);
clampSetting(settings.doubleClickColumn,0,1); clampSetting(settings.doubleClickColumn,0,1);
clampSetting(settings.blankIns,0,1); clampSetting(settings.blankIns,0,1);
clampSetting(settings.dragMovesSelection,0,2); clampSetting(settings.dragMovesSelection,0,5);
clampSetting(settings.draggableDataView,0,1); clampSetting(settings.draggableDataView,0,1);
clampSetting(settings.unsignedDetune,0,1); clampSetting(settings.unsignedDetune,0,1);
clampSetting(settings.noThreadedInput,0,1); clampSetting(settings.noThreadedInput,0,1);