instrument drag and drop: most of the code

Missing the code that actually swaps the instruments :)
This commit is contained in:
yohannd1 2024-12-19 12:00:24 -03:00
parent f3081dddef
commit 806e56a3b2
3 changed files with 19 additions and 1 deletions

View file

@ -127,6 +127,23 @@ void FurnaceGUI::insListItem(int i, int dir, int asset) {
if (insListDir) {
DRAG_SOURCE(dir,asset,"FUR_INSDIR");
DRAG_TARGET(dir,asset,e->song.insDir,"FUR_INSDIR");
} else {
if (ImGui::BeginDragDropSource()) {
insToMove=i;
ImGui::SetDragDropPayload("FUR_INS",NULL,0,ImGuiCond_Once);
ImGui::Button(ICON_FA_ARROWS "##AssetDrag");
ImGui::EndDragDropSource();
}
if (ImGui::BeginDragDropTarget()) {
const ImGuiPayload* payload=ImGui::AcceptDragDropPayload("FUR_INS");
if (payload!=NULL) {
int targetIns=i;
printf("From %d to %d\n",insToMove,targetIns);
// TODO: actually swap the instruments
insToMove=-1;
ImGui::EndDragDropTarget();
}
}
}
if (ImGui::BeginPopupContextItem("InsRightMenu")) {

View file

@ -8653,6 +8653,7 @@ FurnaceGUI::FurnaceGUI():
opToMove(-1),
assetToMove(-1),
dirToMove(-1),
insToMove(-1),
transposeAmount(0),
randomizeMin(0),
randomizeMax(255),

View file

@ -2523,7 +2523,7 @@ class FurnaceGUI {
std::map<FurnaceGUIImages,FurnaceGUIImage*> images;
int chanToMove, sysToMove, sysToDelete, opToMove;
int assetToMove, dirToMove;
int assetToMove, dirToMove, insToMove;
ImVec2 patWindowPos, patWindowSize;