GUI: add operator copy

This commit is contained in:
tildearrow 2022-09-13 03:29:28 -05:00
parent a08ae8cce7
commit d19c6fc236

View file

@ -1564,20 +1564,32 @@ void FurnaceGUI::drawMacros(std::vector<FurnaceGUIMacroDesc>& macros) {
opToMove=i; \ opToMove=i; \
ImGui::SetDragDropPayload("FUR_OP",NULL,0,ImGuiCond_Once); \ ImGui::SetDragDropPayload("FUR_OP",NULL,0,ImGuiCond_Once); \
ImGui::Button(ICON_FA_ARROWS "##SysDrag"); \ ImGui::Button(ICON_FA_ARROWS "##SysDrag"); \
ImGui::SameLine(); \
if (ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) { \
ImGui::Text("(copying)"); \
} else { \
ImGui::Text("(swapping)"); \
} \
ImGui::EndDragDropSource(); \ ImGui::EndDragDropSource(); \
} else if (ImGui::IsItemHovered()) { \ } else if (ImGui::IsItemHovered()) { \
ImGui::SetTooltip("(drag to swap operators)"); \ ImGui::SetTooltip("- drag to swap operator\n- shift-drag to copy operator"); \
} \ } \
if (ImGui::BeginDragDropTarget()) { \ if (ImGui::BeginDragDropTarget()) { \
const ImGuiPayload* dragItem=ImGui::AcceptDragDropPayload("FUR_OP"); \ const ImGuiPayload* dragItem=ImGui::AcceptDragDropPayload("FUR_OP"); \
if (dragItem!=NULL) { \ if (dragItem!=NULL) { \
if (dragItem->IsDataType("FUR_OP")) { \ if (dragItem->IsDataType("FUR_OP")) { \
if (opToMove!=i && opToMove>=0) { \ if (opToMove!=i && opToMove>=0) { \
if (ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift)) { \
e->lockEngine([this,ins,i]() { \
ins->fm.op[orderedOps[i]]=ins->fm.op[orderedOps[opToMove]]; \
}); \
} else { \
e->lockEngine([this,ins,i]() { \ e->lockEngine([this,ins,i]() { \
DivInstrumentFM::Operator origOp=ins->fm.op[orderedOps[opToMove]]; \ DivInstrumentFM::Operator origOp=ins->fm.op[orderedOps[opToMove]]; \
ins->fm.op[orderedOps[opToMove]]=ins->fm.op[orderedOps[i]]; \ ins->fm.op[orderedOps[opToMove]]=ins->fm.op[orderedOps[i]]; \
ins->fm.op[orderedOps[i]]=origOp; \ ins->fm.op[orderedOps[i]]=origOp; \
}); \ }); \
} \
PARAMETER; \ PARAMETER; \
} \ } \
opToMove=-1; \ opToMove=-1; \