channel drag copy: initial impl

This commit is contained in:
yohannd1 2025-09-28 12:43:47 -03:00 committed by tildearrow
parent e6c98506d1
commit 1099c79ec8
3 changed files with 44 additions and 4 deletions

View file

@ -603,10 +603,33 @@ void DivEngine::createNewFromDefaults() {
BUSY_END;
}
void DivEngine::copyChannel(int src, int dest) {
logV("copying channel %d to %d",src,dest);
if (src==dest) {
logV("not copying because it's the same channel!");
return;
}
for (int i=0; i<DIV_MAX_PATTERNS; i++) {
curOrders->ord[dest][i]=curOrders->ord[src][i];
if (curPat[src].data[i]!=NULL && curPat[dest].data[i]!=NULL) {
curPat[src].data[i]->copyOn(curPat[dest].data[i]);
}
}
curPat[dest].effectCols=curPat[src].effectCols;
curSubSong->chanName[dest]=curSubSong->chanName[src];
curSubSong->chanShortName[dest]=curSubSong->chanShortName[src];
curSubSong->chanShow[dest]=curSubSong->chanShow[src];
curSubSong->chanShowChanOsc[dest]=curSubSong->chanShowChanOsc[src];
curSubSong->chanCollapse[dest]=curSubSong->chanCollapse[src];
}
void DivEngine::swapChannels(int src, int dest) {
logV("swapping channel %d with %d",src,dest);
if (src==dest) {
logV("not swapping channels because it's the same channel!",src,dest);
logV("not swapping channels because it's the same channel!");
return;
}
@ -746,6 +769,16 @@ void DivEngine::checkAssetDir(std::vector<DivAssetDir>& dir, size_t entries) {
delete[] inAssetDir;
}
void DivEngine::copyChannelP(int src, int dest) {
if (src<0 || src>=chans) return;
if (dest<0 || dest>=chans) return;
BUSY_BEGIN;
saveLock.lock();
copyChannel(src,dest);
saveLock.unlock();
BUSY_END;
}
void DivEngine::swapChannelsP(int src, int dest) {
if (src<0 || src>=chans) return;
if (dest<0 || dest>=chans) return;