예제 #1
0
void CopyRange_stops(
	struct Stops **tostop,
	struct Stops *fromstop,
	Place *p1,
	Place *p2
){
	struct Stops *stop;

	if(fromstop==NULL) return;

	if(PlaceLessThan(&fromstop->l.p,p1)){
		CopyRange_stops(tostop,NextStop(fromstop),p1,p2);
		return;
	}

	if(PlaceGreaterOrEqual(&fromstop->l.p,p2)) return;

	stop=talloc(sizeof(struct Stops));
        memcpy(stop, fromstop, sizeof(struct Stops));
	PlaceSub(&stop->l.p,p1);

	ListAddElement3(tostop,&stop->l);

	CopyRange_stops(tostop,NextStop(fromstop),p1,p2);

}
예제 #2
0
bool CB_PasteTrack(
	struct WBlocks *wblock,
	struct WTracks *wtrack,
	struct WTracks *towtrack
){
	struct Tracks *totrack;
	struct Tracks *track;
	Place *p1,p2;

	if(towtrack==NULL){
		RError("Error in function CB_PasteTrack in file clipboard_track_paste.c; towtrack=NULL\n");
		return false;
	}

	totrack=towtrack->track;
	track=wtrack->track;

	towtrack->notelength=wtrack->notelength;
	towtrack->fxwidth=wtrack->fxwidth;

	totrack->patch=track->patch;
	totrack->onoff=track->onoff;
	totrack->pan=track->pan;
	totrack->volume=track->volume;
	totrack->panonoff=track->panonoff;
	totrack->volumeonoff=track->volumeonoff;

	if(track->midi_instrumentdata!=NULL){
          totrack->midi_instrumentdata=MIDI_CopyInstrumentData(track);
	}

	totrack->trackname=talloc_strdup(track->trackname);

	totrack->notes=NULL;
	totrack->stops=NULL;
	totrack->fxs=NULL;

	p1=PlaceGetFirstPos();
	PlaceSetLastPos(wblock->block,&p2);

	CopyRange_notes(&totrack->notes,track->notes,p1,&p2);
	CopyRange_stops(&totrack->stops,track->stops,p1,&p2);
	CopyRange_fxs(&totrack->fxs,track->fxs,p1,&p2);

	LegalizeFXlines(wblock->block,totrack);
	LegalizeNotes(wblock->block,totrack);

	return true;
}
예제 #3
0
static bool paste_track(
                        struct WBlocks *wblock,
                        struct WTracks *wtrack,
                        struct WTracks *towtrack
                        )
{
        struct Tracks *totrack = towtrack->track;
        struct Tracks *track = wtrack->track;
        Place *p1,p2;

	towtrack->notelength=wtrack->notelength;
	towtrack->fxwidth=wtrack->fxwidth;

	totrack->onoff=track->onoff;
	totrack->pan=track->pan;
	totrack->volume=track->volume;
	totrack->panonoff=track->panonoff;
	totrack->volumeonoff=track->volumeonoff;
        ATOMIC_SET(totrack->midi_channel, ATOMIC_GET(track->midi_channel));
        
	if(track->midi_instrumentdata!=NULL){
          totrack->midi_instrumentdata=MIDI_CopyInstrumentData(track);
	}

	totrack->trackname=talloc_strdup(track->trackname);

	totrack->notes=NULL;
	totrack->stops=NULL;
	VECTOR_clean(&totrack->fxs);

	p1=PlaceGetFirstPos();
	PlaceSetLastPos(wblock->block,&p2);

	CopyRange_notes(&totrack->notes,track->notes,p1,&p2);
	CopyRange_stops(&totrack->stops,track->stops,p1,&p2);

        if (totrack->patch != NULL)
          CopyRange_fxs(&totrack->fxs,&track->fxs,p1,&p2);

	LegalizeFXlines(wblock->block,totrack);
	LegalizeNotes(wblock->block,totrack);

	return true;

}
예제 #4
0
파일: undo_range.c 프로젝트: onukore/radium
void Undo_Range(
	struct Tracker_Windows *window,
	struct Blocks *block,
	NInt starttrack,
	NInt endtrack,
	int realline
){
	Place *p1=PlaceGetFirstPos();
	Place p2;
	struct Range *undo_range;
	NInt num_tracks;
	NInt lokke;
	struct Tracks *track;
	NInt num_tracks_in_block=block->num_tracks;

	if(endtrack>=num_tracks_in_block){
		num_tracks=num_tracks_in_block-1;
	}else{
		num_tracks=endtrack-starttrack+1;
	}

	undo_range=talloc(sizeof(struct Range));
	undo_range->notes=talloc((size_t)(sizeof(struct Notes *)*num_tracks));
	undo_range->stops=talloc((size_t)(sizeof(struct Stops *)*num_tracks));
	undo_range->num_tracks=num_tracks;

	PlaceSetLastPos(block,&p2);

	for(lokke=0;lokke<num_tracks;lokke++){
		track=ListFindElement1(&block->tracks->l,lokke+starttrack);
		CopyRange_stops(&undo_range->stops[lokke],track->stops,p1,&p2);
		CopyRange_notes(&undo_range->notes[lokke],track->notes,p1,&p2);
	}

	Undo_Add(window->l.num,block->l.num,starttrack,realline,
                 undo_range,Undo_Do_Range,
                 "Range",
                 LOC()
                 );
}
예제 #5
0
void Undo_Notes(
	struct Tracker_Windows *window,
	struct Blocks *block,
	struct Tracks *track,
	int realline
){
	Place *p1=PlaceGetFirstPos();
	Place p2;
	struct Undo_Notes *undo_notes=talloc(sizeof(struct Undo_Notes));

	PlaceSetLastPos(block,&p2);

	CopyRange_stops(&undo_notes->stops,track->stops,p1,&p2);
	CopyRange_notes(&undo_notes->notes,track->notes,p1,&p2);

	Undo_Add(
                 window->l.num,
                 block->l.num,
                 track->l.num,
                 realline,
                 undo_notes,
                 Undo_Do_Notes);
}