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 DrawWTrackNames( struct Tracker_Windows *window, 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 - 1; // Background unsigned int color = patch==NULL ? GFX_get_color(HIGH_EDITOR_BACKGROUND_COLOR_NUM) : patch->color; 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/. // Text GFX_SetClipRect(window,x1, 0, x2, wblock->t.y1, PAINT_BUFFER); { static char temp[500]; 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, wtrack1->x+window->fontwidth/2, wtrack1->y+WTRACKS_SPACE, wtrack1->x2-wtrack1->x-1, TEXT_CLIPRECT|TEXT_BOLD, PAINT_BUFFER ); int name_x = wtrack1->x+window->fontwidth/2 + 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 > 0){ 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, wtrack2->x2 - name_x, //(wtrack2->x2-window->fontwidth/2) - name_x, TEXT_SCALE, //|TEXT_CENTER, PAINT_BUFFER ); } GFX_CancelClipRect(window,PAINT_BUFFER); }