Exemplo n.º 1
0
// TODO/FIX: Implement
void RemoveAllTempoNodesOnReallineCurrPos(struct Tracker_Windows *window){

#if !USE_OPENGL

  struct WBlocks *wblock=window->wblock;
	WTempoNodes *wtemponode;
	int realline=wblock->curr_realline;

	PlayStop();

	Undo_TempoNodes_CurrPos(window);

	wtemponode=wblock->wtemponodes[realline];

	while(wtemponode!=NULL){
		if(wtemponode->type==TEMPONODE_NODE)
			ListRemoveElement3(&wblock->block->temponodes,(struct ListHeader3 *)wtemponode->pointer);
		wtemponode=wtemponode->next;
	}

	LegalizeTempoNodes(wblock->block);

	UpdateWTempoNodes(window,wblock);

	DrawUpWTempoNodes(window,wblock);
	UpdateSTimes(wblock->block);
#endif
}
Exemplo n.º 2
0
void UpdateAllSTimes(void){
	struct Blocks *block=root->song->blocks;

	while(block!=NULL){
		UpdateSTimes(block);
		block=NextBlock(block);
	}
}
Exemplo n.º 3
0
void AddTempoNodeCurrPos(struct Tracker_Windows *window,float reltempo){
	struct WBlocks *wblock=window->wblock;

	PlayStop();

	AddTempoNode(
		window,wblock,
		&wblock->reallines[wblock->curr_realline]->l.p,
		reltempo
	);

#if !USE_OPENGL
	UpdateWTempoNodes(window,wblock);

	DrawUpWTempoNodes(window,wblock);
	UpdateSTimes(wblock->block);
#endif
}
Exemplo n.º 4
0
void *Undo_Do_Tempos(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	struct WTracks *wtrack,
	int realline,
	void *pointer
){
	struct Tempos *undo_tempos=(struct Tempos *)pointer;
	struct Tempos *temp=wblock->block->tempos;

	wblock->block->tempos=undo_tempos;

	//UpdateWTempos(window,wblock);

	UpdateSTimes(wblock->block);

	return temp;
}
Exemplo n.º 5
0
void *Undo_Do_Signatures(
	struct Tracker_Windows *window,
	struct WBlocks *wblock,
	struct WTracks *wtrack,
	int realline,
	void *pointer
){
	struct Signatures *undo_signatures=(struct Signatures *)pointer;
	struct Signatures *temp=wblock->block->signatures;

	wblock->block->signatures=undo_signatures;

	//UpdateWSignatures(window,wblock);

	UpdateSTimes(wblock->block); // is this necessary?
        UpdateBeats(wblock->block);


	return temp;
}
Exemplo n.º 6
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.º 7
0
/* Argh. This one was difficult, I don`t think it works correctly
   in all situations yet either.
*/
void InsertLines(
	struct Blocks *block,
	int line,
	int toinsert
){
	int lokke;
	struct LocalZooms *localzoom;
	struct Tracker_Windows *window=root->song->tracker_windows;
	struct WBlocks *wblock;
	struct Tracks *track=block->tracks;

	int num_lines=block->num_lines;

	if(line>num_lines+toinsert){
		toinsert=line-num_lines;
	}

        if (line==num_lines-1) { // special case
          Block_Properties(block, block->num_tracks, block->num_lines + toinsert);
          return;
        }
        
	if( line<0 || line>=num_lines) return;

	if(toinsert==0 || num_lines+toinsert<2 || num_lines+toinsert>=MAX_UINT32) return;

        
        PC_Pause();{
        
          blocktobelongtoforinsertlines_notes_a_terrible_hack=block;
          
          block->num_lines=num_lines+toinsert;
          
          List_InsertLines3(&block->temponodes,block->temponodes->l.next,line,toinsert,NULL);
          LegalizeTempoNodes(block);
          List_InsertLines3(&block->signatures,&block->signatures->l,line,toinsert,NULL);
          List_InsertLines3(&block->lpbs,&block->lpbs->l,line,toinsert,NULL);
          List_InsertLines3(&block->tempos,&block->tempos->l,line,toinsert,NULL);
          
          UpdateSTimes(block);
          UpdateBeats(block);

          while(track!=NULL){
            List_InsertLines3(&track->notes,&track->notes->l,line,toinsert,InsertLines_notes);
            LegalizeNotes(block,track);
            List_InsertLines3(&track->stops,&track->stops->l,line,toinsert,NULL);
            VECTOR_FOR_EACH(struct FXs *fxs, &track->fxs){
              List_InsertLines3(&fxs->fxnodelines,&fxs->fxnodelines->l,line,toinsert,NULL);
            }END_VECTOR_FOR_EACH;
            LegalizeFXlines(block,track);
            track=NextTrack(track);
          }

          while(window!=NULL){
            wblock=ListFindElement1(&window->wblocks->l,block->l.num);
            List_InsertLines3(
                              &wblock->localzooms,
                              &wblock->localzooms->l,
                              line,
                              toinsert,
                              InsertLines_localzooms
                              //			NULL
                              );
            for(lokke=line;lokke<line+toinsert;lokke++){
              localzoom=talloc(sizeof(struct LocalZooms));
              localzoom->Tline=lokke;
              localzoom->Tdividor=1;
              localzoom->zoomline=lokke;
              ListAddElement3(&wblock->localzooms,&localzoom->l);
            }
            UpdateWBlockWidths(window,wblock);
            wblock->reallines = NULL; // We changed the localzooms, which is used to set new curr_realline. We don't need to set new curr_realline, so just set reallines to NULL.
            UpdateRealLines(window,wblock);
            UpdateReallinesDependens(window,wblock);
            if(wblock->curr_realline>=wblock->num_reallines){
              wblock->curr_realline=wblock->num_reallines-1;
            }
            window=NextWindow(window);
          }
          
          blocktobelongtoforinsertlines_notes_a_terrible_hack=NULL;

        }PC_StopPause(window);
}
Exemplo n.º 8
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);
}
Exemplo n.º 9
0
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(&note->velocities,&lastplace);
				CutListAt(&note->pitches,&lastplace);
				if(PlaceEqual(&note->end,&lastplace1) && note->noend==1){
					PlaceCopy(&note->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(&note->end,&lastplace1) && note->noend==1){
					PlaceSetLastPos(block,&note->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);
}