void pasteTrack(int tracknum, int blocknum, int windownum){ if (tracknum==-1 && blocknum==-1){ struct Tracker_Windows *window=getWindowFromNum(windownum);if(window==NULL) return; CB_PasteTrack_CurrPos(window); return; } struct Tracker_Windows *window=NULL; struct WTracks *wtrack; struct WBlocks *wblock; wtrack=getWTrackFromNumA( windownum, &window, blocknum, &wblock, tracknum ); if(wtrack==NULL) return; if (cb_wtrack != NULL) { Undo_Open_rec();{ ADD_UNDO(Track(window, wblock, wtrack, wblock->curr_realline)); co_CB_PasteTrack(wblock, cb_wtrack, wtrack); }Undo_Close(); } window->must_redraw = true; }
int64_t pasteMixerObjects(float x, float y){ int64_t ret; Undo_Open();{ ret = MW_paste(x, y); }Undo_Close(); return ret; }
void CB_PasteTrack_CurrPos(struct Tracker_Windows *window){ struct WBlocks *wblock=window->wblock; struct Blocks *block=wblock->block; struct WTracks *wtrack=wblock->wtrack; Place lastplace; PlaceSetLastPos(wblock->block,&lastplace); PC_Pause(); switch(window->curr_track){ case SIGNATURETRACK: if(cb_signature==NULL) goto exit; ADD_UNDO(Signatures_CurrPos(window)); block->signatures=CB_CopySignatures(cb_signature); CutListAt_a(&block->signatures,&lastplace); UpdateWBlockWidths(window, wblock); UpdateBeats(block); //UpdateSTimes(block); //UpdateWLPBs(window,wblock); break; case LPBTRACK: if(cb_lpb==NULL) goto exit; ADD_UNDO(LPBs_CurrPos(window)); block->lpbs=CB_CopyLPBs(cb_lpb); CutListAt_a(&block->lpbs,&lastplace); UpdateSTimes(block); //UpdateWLPBs(window,wblock); UpdateBeats(block); #if !USE_OPENGL DrawUpLPBs(window,wblock); #endif break; case TEMPOTRACK: if(cb_tempo==NULL) goto exit; ADD_UNDO(Tempos_CurrPos(window)); block->tempos=CB_CopyTempos(cb_tempo); CutListAt_a(&block->tempos,&lastplace); //UpdateWTempos(window,wblock); #if !USE_OPENGL DrawUpTempos(window,wblock); #endif UpdateSTimes(block); break; case TEMPONODETRACK: if(cb_temponode==NULL) goto exit; ADD_UNDO(TempoNodes_CurrPos(window)); block->temponodes=CB_CopyTempoNodes(cb_temponode); CutListAt_a(&block->temponodes,&lastplace); LegalizeTempoNodes(block); #if !USE_OPENGL ///UpdateWTempoNodes(window,wblock); DrawUpWTempoNodes(window,wblock); #endif UpdateSTimes(block); break; default: if(cb_wtrack==NULL) goto exit; Undo_Open_rec();{ printf("curr_track_sub: %d\n",window->curr_track_sub); ADD_UNDO(Track_CurrPos(window)); if(window->curr_track_sub==-1 && cb_wtrack_only_contains_one_fxs==false){ // copy all printf("aaa\n"); if(co_CB_PasteTrack(wblock,cb_wtrack,wtrack)){ #if !USE_OPENGL UpdateFXNodeLines(window,wblock,wtrack); #endif window->must_redraw = true; }else{ #if !USE_OPENGL UpdateAndClearSomeTrackReallinesAndGfxWTracks( window, wblock, window->curr_track, window->curr_track ); #endif } }else{ printf("bbb\n"); // only copy fx struct WTracks *fromwtrack = cb_wtrack; if (cb_wtrack_only_contains_one_fxs==true){ // only copy one fx R_ASSERT(cb_wtrack->track->fxs.num_elements==1); struct FXs *fxs = cb_wtrack->track->fxs.elements[0]; vector_t *fxss = VECTOR_copy(&wtrack->track->fxs); remove_fxs_from_fxss(fxss, fxs); VECTOR_push_back(fxss, fxs); fromwtrack = CB_CopyTrack(wblock, cb_wtrack); fromwtrack->track->fxs = *VECTOR_copy(fxss); } if(co_CB_PasteTrackFX(wblock,fromwtrack,wtrack)){ #if !USE_OPENGL UpdateFXNodeLines(window,wblock,wtrack); #endif window->must_redraw = true; }else{ #if !USE_OPENGL UpdateAndClearSomeTrackReallinesAndGfxWTracks( window, wblock, window->curr_track, window->curr_track ); #endif } } }Undo_Close(); break; } SetNotePolyphonyAttributes(wtrack->track); ValidateCursorPos(window); exit: PC_StopPause(window); }