Exemplo n.º 1
0
void RemoveNoteCurrPos(struct Tracker_Windows *window){
  struct WBlocks       *wblock        = window->wblock;
  struct WTracks       *wtrack        = wblock->wtrack;
  struct Tracks        *track         = wtrack->track;
  struct LocalZooms    *realline      = wblock->reallines[wblock->curr_realline];
  int                   curr_realline = wblock->curr_realline;
  
  const Trs &trs = TRS_get(wblock, wtrack, curr_realline);

  ADD_UNDO(Notes_CurrPos(window));

  if (trs.size()==0) {
    InsertStop(window,wblock,wtrack,&realline->l.p);
    maybe_scroll_down(window);
    return;
  }

  
  const TrackRealline2 &tr2 = trs[0];

  if (tr2.pitch != NULL) {
    DeletePitch(track, tr2.note, tr2.pitch);
    if (trs.size()==1)
      maybe_scroll_down(window);
    return;
  }

  if (tr2.is_end_pitch) {
    struct Pitches *pitch = (struct Pitches*)ListLast3(&tr2.note->pitches->l);
    if (pitch!=NULL)
      tr2.note->pitch_end = pitch->note;
    else
      tr2.note->pitch_end = 0;
    return;
  }
                              
  if (tr2.note != NULL) {
    PLAYER_lock();{
      ListRemoveElement3(&track->notes,&tr2.note->l);
      LengthenNotesTo(wblock->block,track,&realline->l.p);
    }PLAYER_unlock();
    SetNotePolyphonyAttributes(wtrack->track);
    ValidateCursorPos(window);
    if (trs.size()==1)
      maybe_scroll_down(window);
    return;
  }

  const struct Stops *stop = tr2.stop;
  PLAYER_lock();{
    ListRemoveElement3(&track->stops, &stop->l);
    LengthenNotesTo(wblock->block,track,&realline->l.p);
  }PLAYER_unlock();
  
  if (trs.size()==1)
    maybe_scroll_down(window);
}
Exemplo n.º 2
0
void StopVelocityCurrPos(struct Tracker_Windows *window,int noend){
	struct WBlocks *wblock;
	struct WTracks *wtrack;
	int reallinerealline;
	struct LocalZooms *realline;
	struct Notes *note;
	int subtrack;

	wblock=window->wblock;
	wtrack=wblock->wtrack;
	reallinerealline=wblock->curr_realline;
	realline=wblock->reallines[reallinerealline];
	subtrack=window->curr_track_sub;
        
	note=FindNoteOnSubTrack(wtrack,subtrack,&realline->l.p);
	if(note==NULL)
          return;

        ADD_UNDO(Notes_CurrPos(window));

        PLAYER_lock();{

          if(PlaceGreaterOrEqual(&note->l.p,&realline->l.p)){
            RemoveNote(wblock->block,wtrack->track,note);
            SetNotePolyphonyAttributes(wtrack->track);
            ValidateCursorPos(window);
          }else{
            CutNoteAt(wblock->block, wtrack->track, note, &realline->l.p);
          }

          note->noend=noend;
          
        }PLAYER_unlock();
        
        window->must_redraw=true;
}
Exemplo n.º 3
0
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);
}
Exemplo n.º 4
0
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);
}