void SetMouseActionWTrackBorder( struct Tracker_Windows *window, struct MouseAction *action, int x ){ struct WBlocks *wblock=window->wblock; NInt wtracknum=wblock->left_track; NInt rwtracknum=wblock->right_track; struct WTracks *wtrack=ListFindElement1(&wblock->wtracks->l,wtracknum); struct WTracks *next=NextWTrack(wtrack); if(x<=wtrack->fxarea.x){ SetMouseActionTempoNodeBorder(window,action,x); return; } for(;;){ if(wtrack->l.num==rwtracknum) break; if(x>=wtrack->x2 && x<=next->fxarea.x) break; wtrack=next; next=NextWTrack(wtrack); } if(wtrack->x < wblock->t.x1) return; // Changing trackwidth of a partly shown track doesnt work quite well. action->eint1=wtrack->l.num; action->action=TRACKBORDER; action->MouseUpFunction= &MoveWTrackBorder_Mouse; }
static void DrawAllWTrackNames( struct Tracker_Windows *window, const struct WBlocks *wblock ) { //int num_tracks = ListFindNumElements1(&wblock->wtracks->l); //bool *draw_border = alloca(sizeof(bool) * num_tracks); //memset(draw_border, 0, sizeof(bool) * num_tracks); { const struct WTracks *wtrack1 = get_leftmost_visible_wtrack(wblock); if (wtrack1==NULL) return; const struct WTracks *rightmost_wtrack = get_rightmost_visible_wtrack(wblock, wtrack1); R_ASSERT_RETURN_IF_FALSE(rightmost_wtrack!=NULL); int tracknum1 = wtrack1->l.num; int channelnum1 = ATOMIC_GET(wtrack1->track->midi_channel); struct Patch *patch1 = wtrack1->track->patch; struct WTracks *wtrack2 = NextWTrack(wtrack1); int tracknum2 = tracknum1; for(;;){ int channelnum2 = wtrack2==NULL ? 0 : ATOMIC_GET(wtrack2->track->midi_channel); if (wtrack2==NULL || wtrack2->track->patch==NULL || patch1==NULL || wtrack2->track->patch != patch1 || channelnum2 != channelnum1){ DrawWTrackNames(window, wblock, tracknum1, tracknum2); tracknum1 = tracknum2 = tracknum2+1; channelnum1 = channelnum2; patch1 = wtrack2==NULL ? NULL : wtrack2->track->patch; if (tracknum1 > rightmost_wtrack->l.num) break; } else { tracknum2++; } if (wtrack2==NULL) break; //if (tracknum2 - tracknum1 >= 1) // draw_border[wtrack2->l.num] = true; wtrack2 = NextWTrack(wtrack2); } } }
void SaveWTrack(struct WTracks *wtrack){ if(wtrack==NULL) return; DC_start("WTRACK"); DC_SaveN(wtrack->l.num); DC_SSI("notesonoff",wtrack->notesonoff); DC_SSI("notelength",wtrack->notelength); DC_SSI("fxwidth",wtrack->fxwidth); //DC_SSI("num_vel",wtrack->num_vel); DC_SSB("is_wide",wtrack->is_wide); DC_SSB("show_pianoroll",wtrack->pianoroll_on); DC_SSI("pianoroll_lowkey",wtrack->pianoroll_lowkey); DC_SSI("pianoroll_highkey",wtrack->pianoroll_highkey); DC_SSB("show_centtext",wtrack->centtext_on); DC_SSB("show_chancetext",wtrack->chancetext_on); DC_SSB("show_veltext",wtrack->veltext_on); DC_SSB("show_fxtext",wtrack->fxtext_on); DC_end(); SaveWTrack(NextWTrack(wtrack)); }
static SliderData get_sliderdata(struct Tracker_Windows *window){ SliderData data; struct WBlocks *wblock = window->wblock; struct WTracks *wtrack = wblock->wtracks; int x = 0; if (wblock->left_track < 0) data.leftmost_visible_x = 0; while(wtrack != NULL){ int num_subtracks = WTRACK_num_subtracks(wtrack); int track_width = WTRACK_getWidth(window, wtrack); if (wtrack->l.num == wblock->left_track){ if (wblock->left_subtrack==-1) data.leftmost_visible_x = x; else data.leftmost_visible_x = x + scale(wblock->left_subtrack, 0, num_subtracks, (wtrack->notelength*window->fontwidth)+2, track_width); } x += track_width; if (wtrack->l.num == wblock->right_track) data.rightmost_visible_x = x - (wtrack->x2-wblock->a.x2); wtrack = NextWTrack(wtrack); } data.total_width = x; return data; }
static void DrawAllWTrackOnOffs( struct Tracker_Windows *window, struct WBlocks *wblock ) { struct WTracks *wtrack=(struct WTracks *)ListFindElement1(&wblock->wtracks->l,wblock->left_track); while(wtrack!=NULL && wtrack->l.num<=wblock->right_track){ if(wtrack->track->onoff==0){ GFX_T_Line(window,WAVEFORM_COLOR_NUM, wtrack->x+2,wtrack->y+1, wtrack->x2-2,wtrack->y+(window->org_fontheight*2)-1, PAINT_BUFFER ); GFX_T_Line(window,WAVEFORM_COLOR_NUM, wtrack->x2-2,wtrack->y+1, wtrack->x+2,wtrack->y+(window->org_fontheight*2)-1, PAINT_BUFFER ); } wtrack=NextWTrack(wtrack); } }
void UpdateAllFXNodeLines( struct Tracker_Windows *window, struct WBlocks *wblock ){ struct WTracks *wtrack=wblock->wtracks; while(wtrack!=NULL){ UpdateFXNodeLines(window,wblock,wtrack); wtrack=NextWTrack(wtrack); } }
void DLoadWTracks( struct Root *newroot, struct Tracker_Windows *window, struct WBlocks *wblock, struct WTracks *wtrack ){ if(wtrack==NULL) return; wtrack->fxonoff=1; wtrack->track=(struct Tracks *)ListFindElement1(&wblock->block->tracks->l,wtrack->l.num); DLoadWTracks(newroot,window,wblock,NextWTrack(wtrack)); }
static void DrawAllPianoRollHeaders_old( struct Tracker_Windows *window, struct WBlocks *wblock ) { struct WTracks *wtrack=(struct WTracks *)ListFindElement1(&wblock->wtracks->l,wblock->left_track); while(wtrack!=NULL && wtrack->l.num<=wblock->right_track){ //struct Tracks *track = wtrack->track; int x1 = wtrack->x + 2; int x2 = wtrack->panonoff.x1; int y1 = wtrack->panonoff.y1; //int y2 = wtrack->panonoff.y2; // Text // GFX_SetClipRect(window,x1, 0, x2, wblock->t.y1, PAINT_BUFFER); { //static char temp[500]; //sprintf(temp,"%d->%d:", wtrack1->l.num, wtrack2->l.num); int midpos1 = scale(1,0,3,x1,x2); int midpos2 = scale(2,0,3,x1,x2); //printf("_________ T_TEXT %d: %s %d %d %d. midpos: %d, x1: %d, x2: %d\n",wtrack->l.num,NotesTexts3[wtrack->pianoroll_lowkey],x1,y1,midpos-x1,midpos,x1,x2); GFX_T_Text( window, 8, NotesTexts3[wtrack->pianoroll_lowkey], x1, y1+3, midpos1 - x1, TEXT_CLIPRECT|TEXT_SCALE|TEXT_CENTER|TEXT_BOLD, PAINT_BUFFER ); printf("%d:, x1: %d, midpos1: %d, midpos2: %d, x2: %d\n",wtrack->l.num,x1, midpos1, midpos2, x2); GFX_T_Text( window, 8, NotesTexts3[wtrack->pianoroll_highkey], midpos2, y1+3, x2 - midpos2, TEXT_CLIPRECT|TEXT_SCALE|TEXT_CENTER|TEXT_BOLD, PAINT_BUFFER ); } //GFX_CancelClipRect(window,PAINT_BUFFER); wtrack=NextWTrack(wtrack); } }
static void DrawAllWTrackNames( struct Tracker_Windows *window, struct WBlocks *wblock ) { struct WTracks *wtrack1 = (struct WTracks *)ListFindElement1(&wblock->wtracks->l,wblock->left_track); if (wtrack1==NULL) return; int tracknum1 = wtrack1->l.num; int channelnum1 = ATOMIC_GET(wtrack1->track->midi_channel); struct Patch *patch1 = wtrack1->track->patch; struct WTracks *wtrack2 = NextWTrack(wtrack1); int tracknum2 = tracknum1; for(;;){ int channelnum2 = wtrack2==NULL ? 0 : ATOMIC_GET(wtrack2->track->midi_channel); if (wtrack2==NULL || wtrack2->track->patch==NULL || patch1==NULL || wtrack2->track->patch != patch1 || channelnum2 != channelnum1){ DrawWTrackNames(window, wblock, tracknum1, tracknum2); tracknum1 = tracknum2 = tracknum2+1; channelnum1 = channelnum2; patch1 = wtrack2==NULL ? NULL : wtrack2->track->patch; } else { tracknum2++; } if (wtrack2==NULL) break; else wtrack2 = NextWTrack(wtrack2); } }
void UpdateAllPianoRollHeaders( struct Tracker_Windows *window, struct WBlocks *wblock ) { struct WTracks *wtrack=wblock->wtracks; int tracknum = 0; if (wtrack!=NULL) R_ASSERT(tracknum==wtrack->l.num); while(wtrack!=NULL) { void *pianorollheader = get_pianorollheader(wtrack->l.num, true); if (wtrack->l.num < wblock->left_track || wtrack->l.num > wblock->right_track+1 || wtrack->pianoroll_area.x < wblock->t.x1) { if (pianorollheader != NULL) PIANOROLLHEADER_hide(pianorollheader); } else { //struct Tracks *track = wtrack->track; int x1 = wtrack->x + 2; int x2 = wtrack->panonoff.x1; int y1 = wtrack->panonoff.y1 + 2; int y2 = wtrack->volumeonoff.y2; PIANOROLLHEADER_assignTrack(pianorollheader, wblock->l.num, wtrack->l.num); PIANOROLLHEADER_show(pianorollheader, x1, y1, x2, y2); } wtrack=NextWTrack(wtrack); tracknum++; if (wtrack!=NULL) R_ASSERT(tracknum==wtrack->l.num); } // Make sure all pianoroll headers to the right of the rightmost track is hidden. for(;;){ void *pianorollheader = get_pianorollheader(tracknum, false); if (pianorollheader==NULL) break; PIANOROLLHEADER_hide(pianorollheader); tracknum++; } }
void SaveWTrack(struct WTracks *wtrack){ if(wtrack==NULL) return; DC_start("WTRACK"); DC_SaveN(wtrack->l.num); DC_SSI("notesonoff",wtrack->notesonoff); DC_SSI("notelength",wtrack->notelength); DC_SSI("fxwidth",wtrack->fxwidth); //DC_SSI("num_vel",wtrack->num_vel); DC_SSB("is_wide",wtrack->is_wide); DC_end(); SaveWTrack(NextWTrack(wtrack)); }
void UpdateSomeFXNodeLines( struct Tracker_Windows *window, struct WBlocks *wblock, NInt starttrack, NInt endtrack ){ NInt lokke; struct WTracks *wtrack=ListFindElement1(&wblock->wtracks->l,starttrack); if(wtrack==NULL) return; for(lokke=0;lokke<=endtrack-starttrack;lokke++){ UpdateFXNodeLines(window,wblock,wtrack); wtrack=NextWTrack(wtrack); if(wtrack==NULL) break; } }
static void DrawAllWTrackSliders( struct Tracker_Windows *window, struct WBlocks *wblock ) { struct WTracks *wtrack=(struct WTracks *)ListFindElement1(&wblock->wtracks->l,wblock->left_track); while(wtrack!=NULL && wtrack->l.num<=wblock->right_track){ if(wtrack->x >= wblock->a.x2){ break; } UpdatePanSlider(window,wblock,wtrack); UpdateVolumeSlider(window,wblock,wtrack); wtrack=NextWTrack(wtrack); } }
vector_t *get_all_ranged_notes(struct WBlocks *wblock){ vector_t *v=talloc(sizeof(vector_t)); struct WTracks *wtrack = wblock->wtracks; while(wtrack!=NULL){ struct Tracks *track = wtrack->track; if(is_track_ranged(wblock,wtrack)){ struct Notes *note = track->notes; while(note!=NULL){ if(isPlaceRanged(wblock,¬e->l.p)) VECTOR_push_back(v, note); note=NextNote(note); } } wtrack=NextWTrack(wtrack); } return v; }
void TRACKREALLINES_update_peak_tracks(struct Tracker_Windows *window, struct Patch *patch){ struct WBlocks *wblock=window->wblocks; while(wblock!=NULL){ struct WTracks *wtrack=wblock->wtracks; while(wtrack!=NULL){ struct Tracks *track=wtrack->track; if(track->patch==patch || patch==NULL) if(TRACK_has_peaks(wtrack->track)) UpdateTrackReallines( window, wblock, wtrack ); wtrack=NextWTrack(wtrack); } wblock=NextWBlock(wblock); } }
int MoveWTrackBorder_Mouse( struct Tracker_Windows *window, float x,float y ){ struct WBlocks *wblock=window->wblock; struct WTracks *wtrack=(struct WTracks *)ListFindElement1_r0(&wblock->wtracks->l,(NInt)window->prevaction.eint1); if(window->prevaction.action==NOACTION) window->must_redraw=true; // fix up slightly skewed gradient caused by the direct blitting. (blitting is wrong, but it's faster) if(wtrack==NULL) return 0; x=R_BOUNDARIES(wtrack->fxarea.x+3, x, wblock->t.x2-3); int oldfxwidth=wtrack->fxwidth; wtrack->fxwidth=x - wtrack->fxarea.x; wtrack->fxwidth=R_MAX(wtrack->fxwidth,2); if(oldfxwidth==wtrack->fxwidth && window->prevaction.action!=NOACTION){ return 0; } #if !USE_OPENGL NInt oldrighttrack=wblock->right_track; GFX_BitBlt(window,wtrack->fxwidth-oldfxwidth,0, wtrack->fxarea.x2-2,wblock->a.y1, wblock->a.x2,wblock->t.y2 ); #endif UpdateWBlockCoordinates(window,wblock); DrawAllWTrackHeaders(window,wblock); #if !USE_OPENGL DrawUpWTrack(window,wblock,wtrack); struct WTracks *wtrack2; if(oldfxwidth>wtrack->fxwidth){ wtrack2=ListFindElement1(&wblock->wtracks->l,oldrighttrack); while(wtrack2!=NULL && wtrack2->l.num<=wblock->right_track){ DrawUpWTrack(window,wblock,wtrack2); DrawWTrackHeader(window,wblock,wtrack2); wtrack2=NextWTrack(wtrack2); } }else{ while(GetXSubTrack_B2(wblock,window->curr_track,window->curr_track_sub)+3>=wblock->a.x2){ window->curr_track_sub--; if(window->curr_track_sub==-2){ wblock->wtrack=ListFindElement1(&wblock->wtracks->l,window->curr_track-1); window->curr_track_sub=wblock->wtrack->num_vel-1; window->curr_track--; } } } wtrack2=ListLast1(&wblock->wtracks->l); if(wtrack2->fxarea.x2<wblock->a.x2){ GFX_FilledBox(window,0, wtrack2->fxarea.x2+1,wblock->a.y1, wblock->a.x2,wblock->t.y1, PAINT_BUFFER); GFX_FilledBox(window,0,wtrack2->fxarea.x2+3,wblock->a.y1,wblock->a.x2,wblock->t.y2,PAINT_BUFFER); EraseAllLines(window,wblock, wtrack2->x, wtrack2->x2); } UpdateBottomSlider(window); if(wtrack->fxarea.x2<wblock->a.x2){ Blt_mark(window,wblock->top_realline,wblock->bot_realline, wtrack->fxarea.x2,wblock->a.x2 ); Blt_marktrackheader(window,wtrack->l.num,wblock->right_track); } #else UpdateBottomSlider(window); { struct WTracks *wtrack2=wtrack; while(wtrack2!=NULL && wtrack2->l.num<=wblock->right_track){ DrawAllWTrackHeaders(window,wblock); wtrack2=NextWTrack(wtrack2); } } #endif //window->must_redraw=true; return 0; }
int CursorRight(struct Tracker_Windows *window,struct WBlocks *wblock){ struct WTracks *wtrack=wblock->wtrack; struct WTracks *leftwtrack; struct WTracks *rightwtrack; int update=0; int x2; if(window->curr_track>=0){ window->curr_track_sub++; int num_subtracks = GetNumSubtracks(wtrack); if(window->curr_track_sub>=num_subtracks){ window->curr_track++; if(NextWTrack(wtrack)==NULL){ window->curr_track--; window->curr_track_sub--; return 0; }else{ window->curr_track_sub= -1; ATOMIC_WRITE(wblock->wtrack, NextWTrack(wtrack)); } } while( window->curr_track>wblock->right_track || ( window->curr_track==wblock->right_track && window->curr_track_sub>wblock->right_subtrack ) ){ leftwtrack=ListFindElement1(&wblock->wtracks->l,wblock->left_track); int num_subtracks = GetNumSubtracks(leftwtrack); wblock->left_subtrack++; if(wblock->left_subtrack>=num_subtracks){ if (wblock->left_track < wblock->block->num_tracks-1) { wblock->left_subtrack= -1; wblock->left_track++; //return 0; } else { UpdateAllWTracksCoordinates(window,wblock); wblock->left_subtrack--; return 1; } } leftwtrack=ListFindElement1(&wblock->wtracks->l,wblock->left_track); if( wblock->left_track==wblock->block->num_tracks-1 && wblock->left_subtrack==num_subtracks-1 ){ UpdateAllWTracksCoordinates(window,wblock); return 2; } UpdateAllWTracksCoordinates(window,wblock); update=1; } for(;;){ rightwtrack=ListFindElement1(&wblock->wtracks->l,window->curr_track); int num_subtracks = GetNumSubtracks(rightwtrack); x2=GetXSubTrack2(rightwtrack,window->curr_track_sub); if(x2>wblock->a.x2){ leftwtrack=ListFindElement1(&wblock->wtracks->l,wblock->left_track); wblock->left_subtrack++; if(wblock->left_subtrack>=num_subtracks){ if (wblock->left_track < wblock->block->num_tracks-1) { wblock->left_subtrack= -1; wblock->left_track++; } else { wblock->left_subtrack--; UpdateAllWTracksCoordinates(window,wblock); return 1; } } leftwtrack=ListFindElement1(&wblock->wtracks->l,wblock->left_track); UpdateAllWTracksCoordinates(window,wblock); update=1; }else{ break; } } }else{ ATOMIC_INC(window->curr_track, 1); if (window->curr_track==LPBTRACK && window->show_lpb_track==false) ATOMIC_INC(window->curr_track, 1); if (window->curr_track==SIGNATURETRACK && window->show_signature_track==false) ATOMIC_INC(window->curr_track, 1); if (window->curr_track==LINENUMBTRACK) ATOMIC_INC(window->curr_track, 1); if (window->curr_track==TEMPONODETRACK && window->show_reltempo_track==false) ATOMIC_INC(window->curr_track, 1); if (0==window->curr_track) window->curr_track_sub= -1; } if(update==1){ return 2; }else{ return 1; } }
static void DrawWTrackNames( struct Tracker_Windows *window, const struct WBlocks *wblock, int starttrack, int endtrack ) { struct WTracks *wtrack1 = (struct WTracks *)ListFindElement1(&wblock->wtracks->l, starttrack); struct WTracks *wtrack2 = (struct WTracks *)ListFindElement1(&wblock->wtracks->l, endtrack); struct Patch *patch = wtrack1->track->patch; int x1 = wtrack1->x + 2; int x2 = wtrack2->x2 - 1; int y1 = wtrack1->y; int y2 = wtrack1->panonoff.y1 - 2; // Background unsigned int color = patch==NULL ? GFX_get_color(HIGH_EDITOR_BACKGROUND_COLOR_NUM) : get_displayed_instrument_color(patch).rgb(); bool is_current_track = get_current_instruments_gui_patch()==patch; if(is_current_track) GFX_SetMixColor2(window, WHITE_COLOR_NUM, color, 150); else GFX_SetMixColor2(window, WHITE_COLOR_NUM, color, 0); GFX_T_FilledBox(window, CURSOR_EDIT_ON_COLOR_NUM, x1,y1,x2,y2, PAINT_BUFFER); GFX_CancelMixColor(window); // in case track is not visible and the above filledbox call is not executed, the mixcolor will be set for the next paint operation instead. Bad stuff, caused by radium originally being written for amigaos, where painting outside the visible area would cause memory corruption (instead of being ignored). Unfortunately, the cliprect system was wrongly put into common/ instead of amiga/. // Track border if (endtrack > starttrack){ struct WTracks *wtrack = NextWTrack(wtrack1); while(wtrack != NULL){ //for(int i=0;i<num_tracks;i++){ //printf("%d: %d\n", i, draw_border[i]); //struct WTracks *next = NextWTrack(wtrack2); //printf(" Drawing track header border for track %d\n", wtrack->l.num); GFX_Line(window,TRACK_SEPARATOR2B_COLOR_NUM, wtrack->x, wtrack->y, wtrack->x, wtrack->panonoff.y1 - 1, PAINT_BUFFER); if (wtrack==wtrack2) break; wtrack = NextWTrack(wtrack); } } // Text GFX_SetClipRect(window,x1, 0, x2, wblock->t.y1, PAINT_BUFFER); { static char temp[500]; int wtrack_x1 = R_MAX(wtrack1->x, wblock->t.x1) + window->fontwidth/2; if (wtrack1->l.num==wtrack2->l.num) sprintf(temp,"%d:", wtrack1->l.num); else sprintf(temp,"%d->%d:", wtrack1->l.num, wtrack2->l.num); GFX_T_Text( window,TEXT_COLOR_NUM,temp, wtrack_x1, wtrack1->y+WTRACKS_SPACE-1, wtrack1->x2-wtrack1->x-1, TEXT_CLIPRECT|TEXT_BOLD|TEXT_NOTEXT, PAINT_BUFFER ); int name_x = wtrack_x1 + GFX_get_text_width(window,temp) + window->fontwidth; const char *name = patch==NULL ? wtrack1->track->trackname : patch->name; int midi_channel = ATOMIC_GET(wtrack1->track->midi_channel); if (midi_channel){ if (patch==NULL || patch->instrument!=get_MIDI_instrument()){ snprintf(temp, 498, "%s [%d]", name, midi_channel+1); name = (const char*)&temp; } } GFX_T_Text( window,INSTRUMENT_NAME_COLOR_NUM, name, name_x, wtrack1->y+WTRACKS_SPACE-1, wtrack2->x2 - name_x, //(wtrack2->x2-window->fontwidth/2) - name_x, TEXT_SCALE|TEXT_NOTEXT, //|TEXT_CENTER, PAINT_BUFFER ); } GFX_CancelClipRect(window,PAINT_BUFFER); }
void CB_PasteBlock( struct Tracker_Windows *window, struct WBlocks *wblock, struct WBlocks *towblock ){ R_ASSERT(is_playing()==false); struct Blocks *block=wblock->block; struct Blocks *toblock=towblock->block; struct WTracks *towtrack=towblock->wtracks; struct WTracks *towtrack_wtrack=towblock->wtrack; struct Tracks *totrack=toblock->tracks; struct WTracks *wtrack; NInt wblocknum=towblock->l.num; struct ListHeader1 *nextwblock=towblock->l.next; NInt blocknum=toblock->l.num; struct ListHeader1 *nextblock=toblock->l.next; unsigned int org_color = toblock->color; NInt org_num_tracks=toblock->num_tracks; memcpy(towblock,wblock,sizeof(struct WBlocks)); memcpy(toblock,block,sizeof(struct Blocks)); toblock->color = org_color; // Don't want to paste color. towblock->l.next=nextwblock; towblock->l.num=wblocknum; towblock->block=toblock; towblock->wtracks=towtrack; towblock->wtrack=towtrack_wtrack; toblock->tracks=totrack; toblock->l.next=nextblock; toblock->l.num=blocknum; //printf("org num_tracks: %d, before: %d\n",org_num_tracks,toblock->num_tracks); toblock->num_tracks=org_num_tracks; Block_Set_num_tracks(toblock,block->num_tracks); TIME_everything_in_block_has_changed(towblock->block); // UpdateReallines requires updated time values (for whether to show swing type track or not). toblock->name=block->name; towblock->localzooms=NULL; CB_UnpackLocalZooms(&towblock->localzooms,wblock->localzooms,block->num_lines); //towblock->reallines=NULL; UpdateRealLines_dont_change_curr_realline(window, towblock); //towblock->wtempos=NULL; //towblock->wlpbs=NULL; toblock->swings=CB_CopySwings(block->swings, NULL); toblock->signatures=CB_CopySignatures(block->signatures); toblock->lpbs=CB_CopyLPBs(block->lpbs); toblock->tempos=CB_CopyTempos(block->tempos); toblock->temponodes=CB_CopyTempoNodes(block->temponodes); toblock->lasttemponode=(struct TempoNodes *)ListLast3(&toblock->temponodes->l); UpdateReallinesDependens(window,towblock); wtrack=wblock->wtracks; towtrack=towblock->wtracks; while(wtrack!=NULL){ if(towtrack==NULL){ RError("Error in funtion CB_PasteBlock in file clipboard_block_paste.c; towtrack=NULL\n"); break; } if(towtrack->l.num!=wtrack->l.num){ RError("Error in funtion CB_PasteBlock in file clipboard_block_paste.c; towtrack->l.num!=wtrack->l.num\n"); break; } co_CB_PasteTrack(towblock,wtrack,towtrack); towtrack=NextWTrack(towtrack); wtrack=NextWTrack(wtrack); } if(towtrack!=NULL){ RError("Error in funtion CB_PasteBlock in file clipboard_block_paste.c; towtrack!=NULL when wtrack==NULL\n"); } g_editor_blocks_generation++; BS_UpdateBlockList(); BS_UpdatePlayList(); }
void UpdateBottomSlider(struct Tracker_Windows *window){ struct WBlocks *wblock=window->wblock; struct WTracks *wtrack; int sx1=window->bottomslider.x; int sx2=window->bottomslider.x2; int vx1=0,vx2=0; int rx1=0; int rx2; int x; int x2; int lx=window->bottomslider.lx; int lx2=window->bottomslider.lx2; int mdx=0; int y1,y2; y1=wblock->t.y2+2; y2=window->height - 2; while(y2<=y1){ y1--; y2++; } wtrack=wblock->wtracks; while(wtrack!=NULL){ if (wtrack->l.num==wblock->left_track) vx1=mdx; mdx += wtrack->fxwidth + (wtrack->notelength*window->fontwidth); if(wtrack->l.num==wblock->right_track) vx2=mdx - (wtrack->x2-wblock->a.x2); wtrack=NextWTrack(wtrack); } vx2=R_MIN(vx2,mdx); rx2=mdx; x = sx1 + (sx2-sx1)*(vx1-rx1)/(rx2-rx1) + 2; x2 = sx1 + (sx2-sx1)*(vx2-rx1)/(rx2-rx1) - 2; if(lx2<=x || x2<=lx){ BottomSliderBox(0,lx,lx2); // BottomSliderBox(2,x,x2); GFX_FilledBox( window,2,x,y1+1,x2,y2-1, PAINT_DIRECTLY ); window->bottomslider.lx=x; window->bottomslider.lx2=x2; return; } if(lx<x) BottomSliderBox(0,lx,x-1); else if(lx>x) // BottomSliderBox(2,x,lx-1); GFX_FilledBox(window,2,x,y1+1,lx-1,y2-1,PAINT_DIRECTLY); if(lx2>x2) BottomSliderBox(0,x2+1,lx2); else if(lx2<x2) // BottomSliderBox(2,lx2+1,x2); GFX_FilledBox(window,2,lx2+1,y1+1,x2,y2-1,PAINT_DIRECTLY); window->bottomslider.lx=x; window->bottomslider.lx2=x2; }