void TrackSelectUpdate(struct Tracker_Windows *window,struct WBlocks *wblock,int ret){ switch(ret){ case 0: return; case 1: R_SetCursorPos(window); break; case 2: window->must_redraw = true; #if 0 UpdateWBlockCoordinates(window,wblock); DrawUpAllWTracks(window,wblock,NULL); DrawAllWTrackHeaders(window,wblock); { struct WTracks *wtrack2=ListLast1(&wblock->wtracks->l); if(wtrack2->fxarea.x2<wblock->a.x2){ GFX_FilledBox(window,0,wtrack2->fxarea.x2+2,wblock->t.y1,wblock->a.x2,wblock->t.y2,PAINT_BUFFER); GFX_FilledBox(window,0,wtrack2->fxarea.x2+2,0,wblock->a.x2,wblock->t.y1,PAINT_DIRECTLY); } } DrawBottomSlider(window); DrawUpTrackerWindow(window); #endif break; } GFX_update_instrument_patch_gui(wblock->wtrack->track->patch); DrawAllWTrackHeaders(window,wblock); window->must_redraw=true; }
void DeleteBlock_CurrPos( struct Tracker_Windows *window ){ struct WBlocks *wblock=window->wblock; NInt blockpos; PlayStop(); if(wblock->l.next==NULL && wblock==window->wblocks) return; blockpos=window->wblock->l.num; Undo_Block_Delete(blockpos); DeleteBlock(blockpos); wblock=ListFindElement1_r0(&window->wblocks->l,blockpos); if(wblock==NULL){ wblock=ListLast1(&window->wblocks->l); } SelectWBlock(window,wblock); BS_UpdateBlockList(); BS_UpdatePlayList(); }
void Scroll_makePixMapLines( struct Tracker_Windows *window, int startrealline, int endrealline ){ struct WBlocks *wblock=window->wblock; if(WBlock_legalizeStartEndReallines(wblock,&startrealline,&endrealline)==false){ return; } PixMap_makeNewDefs( window, startrealline-wblock->top_realline, endrealline-wblock->top_realline ); { struct WTracks *wtrack=ListLast1(&wblock->wtracks->l); int x2=wtrack->fxarea.x2; EraseLines( window,wblock, wblock->a.x1, x2, startrealline, endrealline+1 ); } DrawWBlockSpesific( window, wblock, startrealline, endrealline ); UpdateAllWTracks( window, wblock, startrealline, endrealline ); }
/********************************************************************* FUNCTION Is ment to be called instead of clearing all of the window, to avoid flicker. *********************************************************************/ void ClearUnusedWindowsAreas(struct Tracker_Windows *window){ const int color = 0; struct WBlocks *wblock = window->wblock; #if !USE_OPENGL // Clears the area between the header and the first line, if there is space. { int top_line_y = Common_oldGetReallineY1Pos(window, wblock, 0); //printf("top_line_y: %d. wblock->t.y1: %d\n", top_line_y, wblock->t.y1); if(top_line_y>wblock->t.y1) GFX_FilledBox(window,color, window->leftslider.width+1, wblock->t.y1, window->width, top_line_y-1, PAINT_DIRECTLY ); } // Clears the area between the last line and the bottom slider, if there is space. { int bot_line_y2 = Common_oldGetReallineY2Pos(window, wblock, R_MIN(wblock->num_reallines-1,wblock->bot_realline)); if(bot_line_y2 < wblock->a.y2) GFX_FilledBox(window,color, window->leftslider.width+1, bot_line_y2, window->width, wblock->a.y2, PAINT_DIRECTLY ); } #endif // !USE_OPENGL // Clear the small area between the temposlider and the bottom slider. GFX_FilledBox( window,color, wblock->reltempo.x2+1, window->height - window->bottomslider.width+1, window->bottomslider.x-1, window->height-1, PAINT_DIRECTLY ); #if 0 // Clear the area to the right of the rightmost track. { struct WTracks *last_wtrack = ListLast1(&wblock->wtracks->l); if(last_wtrack->fxarea.x2<wblock->a.x2){ //GFX_P_FilledBox(window,color,last_wtrack->fxarea.x2+2,wblock->t.y1,wblock->a.x2,wblock->t.y2); GFX_FilledBox(window,color, last_wtrack->fxarea.x2+2, 0, wblock->a.x2, wblock->t.y1, PAINT_DIRECTLY ); } } #endif #if !USE_OPENGL // Clear the area between the Left slider and the line numbers. //printf("sl.x2: %d / %d\n", window->leftslider.width+1,wblock->zoomlevelarea.x-1); //if(window->leftslider.width+1 < wblock->zoomlevelarea.x-1) GFX_FilledBox( window,color, window->leftslider.width+1, wblock->t.y1, wblock->linenumarea.x, wblock->t.y2+1, PAINT_DIRECTLY ); //printf("%d/%d -> %d/%d\n",window->leftslider.width+1, wblock->t.y1, // wblock->zoomlevelarea.x-1, wblock->t.y2); // Clear the one pixel wide area in the left slider. GFX_Box( window,color, 1, wblock->t.y1+1, window->leftslider.width-1, wblock->t.y2, PAINT_DIRECTLY ); #endif }
/************************************************************************** FUNCTION Redraw without flickering. ***************************************************************************/ void DrawUpTrackerWindow(struct Tracker_Windows *window){ //printf("Draw up tracker. width: %d, height: %d\n",window->width,window->height); if(window->must_redraw==true) return; #if UPDATECOORDINATES_WHEN_DRAWING struct WBlocks *wblock = window->wblock; #endif #if 0 while(GetXSubTrack_B2(wblock,window->curr_track,window->curr_track_sub) >= wblock->a.x2){ if(window->curr_track<wblock->left_track) break; // should not be possible if(window->curr_track==wblock->left_track && window->curr_track_sub==wblock->left_subtrack) break; CursorLeft_CurrPos(window); } #endif #if !USE_OPENGL GFX_BouncePoints(window); // To clear point buffer. (TODO: Implement a clear point buffer function.) #endif #if UPDATECOORDINATES_WHEN_DRAWING UpdateTrackerWindowCoordinates(window); UpdateWBlockCoordinates(window,wblock); #endif #if !USE_OPENGL PixMap_reset(window); #endif #if !USE_OPENGL struct WTracks *wtrack=ListLast1(&wblock->wtracks->l); int x2=wtrack->fxarea.x2; EraseAllLines(window, window->wblock, 0, x2); GFX_FilledBox(window,0, x2,0, window->width-1,window->height-1, PAINT_BUFFER); DrawLeftSlider(window); #endif DrawWBlock(window,window->wblock); window->wblock->isgfxdatahere=true; #if !USE_OPENGL ClearUnusedWindowsAreas(window); Blt_unMarkVisible(window); // Need a better name for this function. #endif }
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; }
static void create_background_realline(const struct Tracker_Windows *window, const struct WBlocks *wblock, const struct WSignatures *wsignature, int realline){ const struct WTracks *last_wtrack = (const struct WTracks*)ListLast1(&wblock->wtracks->l); const struct LocalZooms *localzoom = wblock->reallines[realline]; //int x1 = wblock->linenumarea.x; int x1 = wblock->tempocolorarea.x; int x2 = last_wtrack->x2; int y1 = get_realline_y1(window, realline); int y2 = get_realline_y2(window, realline); // background { if(beat_opacity == -1) beat_opacity = SETTINGS_read_int("beat_opacity", 950); if(first_beat_opacity == -1) first_beat_opacity = SETTINGS_read_int("first_beat_opacity", 870); GE_Context *c; if (WSIGNATURE_is_first_beat(wsignature)) c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), first_beat_opacity, Z_BACKGROUND | Z_STATIC_X); else if (wsignature->beat_num>0) c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), beat_opacity, Z_BACKGROUND | Z_STATIC_X); else { if(localzoom->level>0 && localzoom->zoomline>0 && localzoom->autogenerated==false) c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(2), 925, Z_BACKGROUND | Z_STATIC_X); // manually splitted line else c = GE_color_z(15, Z_BACKGROUND | Z_STATIC_X); } GE_filledBox(c,x1,y1,x2,y2); } float line_width = 0.6f; // realline separator line if(1){ //if(line_opacity == -1) // line_opacity = SETTINGS_read_int("line_opacity", R_MAX(50, beat_opacity-500)); line_opacity = 900; if(line_opacity != 1000) { GE_Context *c; if (WSIGNATURE_is_first_beat(wsignature)) c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), first_beat_opacity-250, Z_ABOVE(Z_BACKGROUND) | Z_STATIC_X); else if (wsignature->beat_num>0) c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), beat_opacity-250, Z_ABOVE(Z_BACKGROUND) | Z_STATIC_X); else c = GE_mix_color_z(GE_get_rgb(15), GE_get_rgb(1), line_opacity, Z_ABOVE(Z_BACKGROUND) | Z_STATIC_X); if (true) { GE_line(c,x1,y1,x2,y1,line_width); VECTOR_FOR_EACH(float*, f_pointer, &wsignature->how_much_below){ float f = *f_pointer; if (fabs(f) > 0.1) { float y_ = scale(f, 0, 1, y1, y2); float x1_ = wblock->linenumarea.x; float x2_ = wblock->linenumarea.x2; GE_line(c,x1_,y_,x2_,y_,line_width); } }END_VECTOR_FOR_EACH; } else {