From cd42a8b9f38f62816e5418aecdebc63c7faefae0 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 13 Mar 2022 02:36:52 -0500 Subject: [PATCH] GUI: implement flip --- src/gui/gui.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 2220299f8..3b77476d6 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -3330,6 +3330,31 @@ void FurnaceGUI::doFlip() { finishSelection(); prepareUndo(GUI_UNDO_PATTERN_FLIP); + DivPattern patBuffer; + int iCoarse=selStart.xCoarse; + int iFine=selStart.xFine; + int ord=e->getOrder(); + for (; iCoarse<=selEnd.xCoarse; iCoarse++) { + if (!e->song.chanShow[iCoarse]) continue; + DivPattern* pat=e->song.pat[iCoarse].getPattern(e->song.orders.ord[iCoarse][ord],true); + for (; iFine<3+e->song.pat[iCoarse].effectRows*2 && (iCoarsedata[j][0]; + } + patBuffer.data[j][iFine+1]=pat->data[j][iFine+1]; + } + for (int j=selStart.y; j<=selEnd.y; j++) { + if (iFine==0) { + pat->data[j][0]=patBuffer.data[selEnd.y-j+selStart.y][0]; + } + pat->data[j][iFine+1]=patBuffer.data[selEnd.y-j+selStart.y][iFine+1]; + } + } + iFine=0; + } + makeUndo(GUI_UNDO_PATTERN_FLIP); }