GUI: implement flip

This commit is contained in:
tildearrow 2022-03-13 02:36:52 -05:00
parent bd705d837d
commit cd42a8b9f3

View file

@ -3330,6 +3330,31 @@ void FurnaceGUI::doFlip() {
finishSelection(); finishSelection();
prepareUndo(GUI_UNDO_PATTERN_FLIP); 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 && (iCoarse<selEnd.xCoarse || iFine<=selEnd.xFine); iFine++) {
maskOut(iFine);
for (int j=selStart.y; j<=selEnd.y; j++) {
if (iFine==0) {
patBuffer.data[j][0]=pat->data[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); makeUndo(GUI_UNDO_PATTERN_FLIP);
} }