int gui_draw_string ( int x, int y, int w, int h, int color, const char *s, bool draw ) { int rw; if ( ! s ) return 0; fl_font( FL_COURIER, min( h, 18 ) ); rw = fl_width( s ); if ( fl_not_clipped( x, y, rw, h ) && draw ) { gui_clear_area( x, y, w, h ); if ( color ) fl_color( velocity_colors[ color ] ); else fl_color( FL_DARK_CYAN ); fl_draw( s, x, y + h / 2 + fl_descent() ); } return rw; }
void Desktop::draw() { int numchildren = children(); if(wpaper) { wpaper->draw(0,0,w(),h()); } else { fl_color(bg_color); fl_rectf(0,0,w(),h()); } int n; for(n = numchildren; n--;) { Fl_Widget &w = *child(n); if(!fl_not_clipped(w.x(), w.y(), w.w(), w.h())) continue; fl_push_matrix(); fl_translate(w.x(), w.y()); w.set_damage(FL_DAMAGE_ALL|FL_DAMAGE_EXPOSE); w.draw(); w.set_damage(0); fl_pop_matrix(); } }
FL_EXPORT_C(int,flc_not_clipped)(int x,int y,int w,int h){ return fl_not_clipped(x,y,w,h); }
void gui_draw_shape ( int x, int y, int w, int h, int shape, int state, int flags, int color ) { /* take advantage of FLTK's clipping */ if ( ! fl_not_clipped( x, y, w, h ) ) return; if ( flags & F_PLAYHEAD ) { state = state == FULL ? HIT : PLAYHEAD; flags &= ~ F_SELECTION; } Fl_Color c1, c2; if ( state == FULL && color ) { c1 = velocity_colors[ color ]; c2 = velocity2_colors[ color ]; } else { c1 = state_colors[ state ]; c2 = fl_color_average( FL_WHITE, c1, 0.1 ); } if ( flags & F_SELECTION ) fl_color( fl_darker( fl_color() ) ); int bw = 1; switch ( shape ) { case SQUARE: // fl_rectf( x, y, w, h, FL_BLACK ); fl_color( c1 ); fl_rectf( x + bw, y + bw, w - bw * 2, h - bw * 2 ); if ( draw_borders ) { fl_color( c2 ); fl_line_style( FL_SOLID, 2 ); fl_rect( x + bw + 1, y + bw + 1, w - (bw+1) * 2, h - (bw+1) * 2 ); fl_line_style( FL_SOLID, 0 ); } break; case BOX: fl_draw_box( FL_THIN_UP_BOX, x + bw, y + bw, w - bw * 2, h - bw * 2, c1 ); break; default: ASSERTION( "unknown shape" ); break; } if ( flags & F_P1 || flags & F_P2 ) { if ( flags & F_P1 ) fl_color( FL_GREEN ); else fl_color( FL_RED ); int rw = w / 4; int rh = h / 4; fl_rectf( x + (w / 2) - (rw / 2), y + (h / 2) - (rh / 2), rw, rh ); } }