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; PlayStop(); PlaceSetLastPos(wblock->block,&lastplace); switch(window->curr_track){ case LPBTRACK: if(cb_lpb==NULL) return; Undo_LPBs_CurrPos(window); block->lpbs=CB_CopyLPBs(cb_lpb); CutListAt_a(&block->lpbs,&lastplace); UpdateSTimes(block); UpdateBeats(block); UpdateWLPBs(window,wblock); #if !USE_OPENGL DrawUpLPBs(window,wblock); #endif break; case TEMPOTRACK: if(cb_tempo==NULL) return; 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) return; 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) return; Undo_Track_CurrPos(window); if(window->curr_track_sub==-1){ if(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{ if(CB_PasteTrackFX(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 } } break; } SetNoteSubtrackAttributes(wtrack->track); ValidateCursorPos(window); }
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); }
void Block_Set_num_lines( struct Blocks *block, int num_lines ){ Place lastplace1,lastplace; struct Tracker_Windows *window=root->song->tracker_windows; struct WBlocks *wblock; struct LocalZooms *localzoom; struct Tracks *track=block->tracks; struct Notes *note; struct FXs *fxs; int org_num_lines=block->num_lines; int lokke; if(org_num_lines==num_lines || num_lines<2) return; PlaceSetLastPos(block,&lastplace1); block->num_lines=num_lines; PlaceSetLastPos(block,&lastplace); if(num_lines<org_num_lines){ CutListAt_a(&block->lpbs,&lastplace); CutListAt_a(&block->tempos,&lastplace); CutListAt_a(&block->temponodes,&lastplace); PlaceSetLastPos(block,&block->lasttemponode->l.p); ListAddElement3(&block->temponodes,&block->lasttemponode->l); while(track!=NULL){ CutListAt_a(&track->notes,&lastplace); note=track->notes; while(note!=NULL){ CutListAt(¬e->velocities,&lastplace); CutListAt(¬e->pitches,&lastplace); if(PlaceEqual(¬e->end,&lastplace1) && note->noend==1){ PlaceCopy(¬e->end,&lastplace); } note=NextNote(note); } LegalizeNotes(block,track); CutListAt_a(&track->stops,&lastplace); fxs=track->fxs; while(fxs!=NULL){ CutListAt_a(&fxs->fxnodelines,&lastplace); fxs=NextFX(fxs); } LegalizeFXlines(block,track); track=NextTrack(track); } while(window!=NULL){ wblock=ListFindElement1(&window->wblocks->l,block->l.num); CutListAt_a(&wblock->localzooms,&lastplace); window=NextWindow(window); } }else{ PlaceSetLastPos(block,&block->lasttemponode->l.p); while(track!=NULL){ note=track->notes; while(note!=NULL){ if(PlaceEqual(¬e->end,&lastplace1) && note->noend==1){ PlaceSetLastPos(block,¬e->end); } note=NextNote(note); } LegalizeNotes(block,track); track=NextTrack(track); } while(window!=NULL){ wblock=ListFindElement1(&window->wblocks->l,block->l.num); for(lokke=org_num_lines;lokke<num_lines;lokke++){ localzoom=talloc(sizeof(struct LocalZooms)); localzoom->Tline=lokke; localzoom->Tdividor=1; localzoom->zoomline=lokke; ListAddElement3(&wblock->localzooms,&localzoom->l); } window=NextWindow(window); } } window=root->song->tracker_windows; while(window!=NULL){ wblock=ListFindElement1(&window->wblocks->l,block->l.num); UpdateWBlockWidths(window,wblock); UpdateRealLines(window,wblock); window=NextWindow(window); } UpdateSTimes(block); UpdateBeats(block); }