Skip to content

Commit

Permalink
instrument drag&drop: adding option to disable
Browse files Browse the repository at this point in the history
  • Loading branch information
yohannd1 committed Dec 21, 2024
1 parent 8aeb50b commit 0b4cf34
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/gui/dataList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ const char* sampleNote[12]={
}

#define SIMPLE_DRAG_SOURCE(_c,_toMoveVar) \
if (ImGui::BeginDragDropSource()) { \
if (settings.draggableDataView && ImGui::BeginDragDropSource()) { \
_toMoveVar=i; \
ImGui::SetDragDropPayload(_c,NULL,0,ImGuiCond_Once); \
ImGui::Button(ICON_FA_ARROWS "##AssetDrag"); \
ImGui::EndDragDropSource(); \
}

#define SIMPLE_DRAG_TARGET(_c,_toMoveVar,_curVar,_swapFn,_moveUpFn,_moveDownFn) \
if (ImGui::BeginDragDropTarget()) { \
if (settings.draggableDataView && ImGui::BeginDragDropTarget()) { \
const ImGuiPayload* payload=ImGui::AcceptDragDropPayload(_c); \
if (payload!=NULL) { \
int target=i; \
Expand Down Expand Up @@ -129,7 +129,7 @@ void FurnaceGUI::insListItem(int i, int dir, int asset) {
ImGui::PushStyleColor(ImGuiCol_Text,uiColors[GUI_COLOR_INSTR_STD+ins->type]);
insIcon=insTypes[ins->type];
}

switch (settings.insIconsStyle) {
case 1:
name=fmt::sprintf("%s##_INS%d",insIcon[1],i);
Expand Down
8 changes: 5 additions & 3 deletions src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ class FurnaceGUI {
int pnQuality;
int saaQuality;
int sccQuality;
int smQuality;
int smQuality;
int swanQuality;
int vbQuality;
int arcadeCoreRender;
Expand All @@ -1818,7 +1818,7 @@ class FurnaceGUI {
int pnQualityRender;
int saaQualityRender;
int sccQualityRender;
int smQualityRender;
int smQualityRender;
int swanQualityRender;
int vbQualityRender;
int pcSpeakerOutMethod;
Expand Down Expand Up @@ -1914,6 +1914,7 @@ class FurnaceGUI {
int doubleClickColumn;
int blankIns;
int dragMovesSelection;
int draggableDataView;
int cursorFollowsOrder;
int unsignedDetune;
int noThreadedInput;
Expand Down Expand Up @@ -2176,6 +2177,7 @@ class FurnaceGUI {
doubleClickColumn(1),
blankIns(0),
dragMovesSelection(1),
draggableDataView(1),
cursorFollowsOrder(1),
unsignedDetune(0),
noThreadedInput(0),
Expand Down Expand Up @@ -2690,7 +2692,7 @@ class FurnaceGUI {
bool pianoReadonly;
int pianoOffset, pianoOffsetEdit;
int pianoView, pianoInputPadMode;

// effect sorting / searching
bool effectsShow[10];
ImGuiTextFilter effectSearch;
Expand Down
40 changes: 24 additions & 16 deletions src/gui/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1493,7 +1493,7 @@ void FurnaceGUI::drawSettings() {
ImGui::Text(_("Quality"));
ImGui::SameLine();
if (ImGui::Combo("##Quality",&settings.audioQuality,LocalizedComboGetter,audioQualities,2)) settingsChanged=true;

bool clampSamplesB=settings.clampSamples;
if (ImGui::Checkbox(_("Software clipping"),&clampSamplesB)) {
settings.clampSamples=clampSamplesB;
Expand Down Expand Up @@ -2688,6 +2688,12 @@ void FurnaceGUI::drawSettings() {
settingsChanged=true;
}

bool draggableDataViewB=settings.draggableDataView;
if (ImGui::Checkbox(_("Draggable instruments/samples/waves"),&draggableDataViewB)) {
settings.draggableDataView=draggableDataViewB;
settingsChanged=true;
}

ImGui::Text(_("Note preview behavior:"));
ImGui::Indent();
if (ImGui::RadioButton(_("Never##npb0"),settings.notePreviewBehavior==0)) {
Expand Down Expand Up @@ -4953,13 +4959,14 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
settings.cursorMoveNoScroll=conf.getInt("cursorMoveNoScroll",0);

settings.notePreviewBehavior=conf.getInt("notePreviewBehavior",1);

settings.absorbInsInput=conf.getInt("absorbInsInput",0);

settings.moveWindowTitle=conf.getInt("moveWindowTitle",1);

settings.doubleClickColumn=conf.getInt("doubleClickColumn",1);
settings.dragMovesSelection=conf.getInt("dragMovesSelection",2);
settings.draggableDataView=conf.getInt("draggableDataView",1);

settings.cursorFollowsOrder=conf.getInt("cursorFollowsOrder",1);

Expand Down Expand Up @@ -5397,7 +5404,7 @@ void FurnaceGUI::readConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
clampSetting(settings.backgroundPlay,0,1);

if (settings.exportLoops<0.0) settings.exportLoops=0.0;
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
if (settings.exportFadeOut<0.0) settings.exportFadeOut=0.0;
}

void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
Expand Down Expand Up @@ -5446,10 +5453,10 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
conf.set("blankIns",settings.blankIns);

conf.set("saveWindowPos",settings.saveWindowPos);

conf.set("saveUnusedPatterns",settings.saveUnusedPatterns);
conf.set("maxRecentFile",settings.maxRecentFile);

conf.set("persistFadeOut",settings.persistFadeOut);
conf.set("exportLoops",settings.exportLoops);
conf.set("exportFadeOut",settings.exportFadeOut);
Expand Down Expand Up @@ -5532,40 +5539,41 @@ void FurnaceGUI::writeConfig(DivConfig& conf, FurnaceGUISettingGroups groups) {
conf.set("pullDeleteBehavior",settings.pullDeleteBehavior);
conf.set("wrapHorizontal",settings.wrapHorizontal);
conf.set("wrapVertical",settings.wrapVertical);

conf.set("stepOnDelete",settings.stepOnDelete);
conf.set("scrollStep",settings.scrollStep);
conf.set("avoidRaisingPattern",settings.avoidRaisingPattern);
conf.set("insFocusesPattern",settings.insFocusesPattern);
conf.set("stepOnInsert",settings.stepOnInsert);
conf.set("effectCursorDir",settings.effectCursorDir);
conf.set("cursorPastePos",settings.cursorPastePos);

conf.set("effectDeletionAltersValue",settings.effectDeletionAltersValue);

conf.set("pushNibble",settings.pushNibble);
conf.set("scrollChangesOrder",settings.scrollChangesOrder);
conf.set("cursorMoveNoScroll",settings.cursorMoveNoScroll);

conf.set("notePreviewBehavior",settings.notePreviewBehavior);

conf.set("absorbInsInput",settings.absorbInsInput);

conf.set("moveWindowTitle",settings.moveWindowTitle);

conf.set("doubleClickColumn",settings.doubleClickColumn);
conf.set("dragMovesSelection",settings.dragMovesSelection);

conf.set("draggableDataView",settings.draggableDataView);

conf.set("cursorFollowsOrder",settings.cursorFollowsOrder);

conf.set("insertBehavior",settings.insertBehavior);
conf.set("pullDeleteRow",settings.pullDeleteRow);
conf.set("cursorFollowsWheel",settings.cursorFollowsWheel);
conf.set("cursorWheelStep",settings.cursorWheelStep);
conf.set("removeInsOff",settings.removeInsOff);
conf.set("removeVolOff",settings.removeVolOff);
conf.set("insTypeMenu",settings.insTypeMenu);

conf.set("selectAssetOnLoad",settings.selectAssetOnLoad);

conf.set("inputRepeat",settings.inputRepeat);
Expand Down Expand Up @@ -6307,7 +6315,7 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
}
}
}

if (updateFonts) {
// chan osc work pool
if (chanOscWorkPool!=NULL) {
Expand Down Expand Up @@ -6503,7 +6511,7 @@ void FurnaceGUI::applyUISettings(bool updateFonts) {
sty.ScaleAllSizes(dpiScale);

ImGui::GetStyle()=sty;

updateSampleTex=true;

ImGui::GetIO().ConfigInputTrickleEventQueue=settings.eventDelay;
Expand Down

0 comments on commit 0b4cf34

Please sign in to comment.