void Fl_Input_Browser::draw() { Fl_Flags f = flags(); if (!active_r()) f.set(FL_INACTIVE); //minw_ = w(); if (damage()&FL_DAMAGE_ALL) draw_frame(); int X = 0, Y = 0, W = w(), H = h(); box()->inset(X, Y, W, H); int W1 = H*4/5; if (damage()&(FL_DAMAGE_ALL|FL_DAMAGE_CHILD)) { input()->resize(X, Y, W-W1, H); input()->set_damage(FL_DAMAGE_ALL); input()->copy_style(style()); // force it to use this style input()->box(FL_FLAT_BOX); // fix for relative coordinates fl_push_matrix(); fl_translate(X,Y); input()->draw(); fl_pop_matrix(); input()->set_damage(0); } if(damage()&(FL_DAMAGE_ALL|FL_DAMAGE_VALUE|FL_DAMAGE_HIGHLIGHT)) { if(over_now) f.set(FL_HIGHLIGHT); X += W-W1; W = W1; button_box(FL_DIV_UP_BOX); // draw the little mark at the right: draw_glyph(FL_GLYPH_DOWN_BUTTON, X, Y, W, H, f); over_last = over_now; } }
void SpectrumView::draw ( void ) { //Clear Widget Fl_Box::draw(); int W = w() - padding_right; int H = h() - padding_bottom; if ( !_bands ) { analyze_data( W ); } //Draw grid fl_color(fl_color_add_alpha(fl_rgb_color( 100,100,100), 50 )); draw_semilog(); fl_push_clip( x(),y(),W,H); fl_color(fl_color_add_alpha( selection_color(), 20 )); fl_push_matrix(); fl_translate( x(), y() + 2 ); fl_scale( W,H- 2 ); fl_begin_polygon(); fl_vertex(0.0,1.0); draw_curve(); fl_vertex(1.0,1.0); fl_end_polygon(); fl_color(fl_color_add_alpha( selection_color(), 100 )); fl_begin_line(); fl_line_style(FL_SOLID,2); /* fl_vertex(0.0,1.0); */ draw_curve(); /* fl_vertex(1.0,1.0); */ fl_end_line(); fl_pop_matrix(); fl_line_style(FL_SOLID,0); fl_pop_clip(); }
void Drawing::draw() { draw_box(); fl_push_matrix(); fl_translate(w()/2, h()/2); fl_scale(w()/2, h()/2); fl_color(FL_BLACK); for (int i = 0; i < 20; i++) { for (int j = i+1; j < 20; j++) { fl_vertex(cosf(M_PI*i/10+.1), sinf(M_PI*i/10+.1)); fl_vertex(cosf(M_PI*j/10+.1), sinf(M_PI*j/10+.1)); fl_stroke(); } } fl_pop_matrix(); }
void draw() { fl_push_clip(0, 0, w(), h()); fl_color(FL_DARK3); fl_rectf(0, 0, w(), h()); fl_push_matrix(); // if (args[6]) { fl_translate(w()/2.0f, h()/2.0f); fl_rotate(args[6]); fl_translate(-w()/2.0f, -h()/2.0f); //} fl_arc(args[0],args[1],args[2],args[3],args[4],args[5]); fl_closepath(); fl_arc(120,120,40,40,0,-360); fl_ellipse(20,20,args[2],args[3]); // hardware circle fl_color(FL_WHITE); fl_fill_stroke(FL_RED); fl_pop_matrix(); fl_pop_clip(); }
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(); } }
void Fl_DialX::draw ( void ) { int X,Y,S; { int ox, oy, ww, hh, side; ox = x(); oy = y(); ww = w(); hh = h(); if (ww > hh) { side = hh; ox = ox + (ww - side) / 2; } else { side = ww; oy = oy + (hh - side) / 2; } side = w() > h() ? hh : ww; X = ox; Y = oy; S = side; } draw_box(); draw_label(); double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); fl_draw_box( box(), X, Y, S, S, color() ); /* shrink a bit */ int OX = x(); int OY = y(); X += S / 8; Y += S / 8; int OS = S; S -= S / 4; fl_line_style( FL_SOLID, S / 12 ); /* background arc */ fl_color( fl_darker( color() ) ); fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle2() ); /* foreground arc */ fl_color( selection_color() ); fl_arc( X, Y, S, S, 270 - angle1(), 270 - angle ); fl_line_style( FL_SOLID, 0 ); if ( active_r() ) { int W = OS; int H = OS; fl_push_matrix(); fl_translate(OX+W/2, OY+H/2); fl_scale(W, H); fl_rotate(310+angle); fl_color( fl_color_add_alpha( FL_WHITE, 127 )); fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.12); fl_end_polygon(); fl_color( FL_WHITE ); fl_begin_polygon(); fl_circle(-0.26, 0.26, 0.06); fl_end_polygon(); fl_pop_matrix(); } fl_color( fl_contrast( labelcolor(), color() ) ); if ( Fl::belowmouse() == this ) { char s[10]; fl_font( FL_HELVETICA, 10 ); snprintf( s, sizeof( s ), "%.1f", value() ); fl_color( FL_FOREGROUND_COLOR ); fl_draw( s, X, Y, S, S, FL_ALIGN_CENTER ); } }
void DesktopIcon::draw(void) { // draw_box(FL_UP_BOX, FL_BLACK); if(image() && (damage() & FL_DAMAGE_ALL)) { Fl_Image* im = image(); /* center image in the box */ int ix = (w()/2) - (im->w()/2); int iy = (h()/2) - (im->h()/2); ix += x(); iy += y(); /* darker_img is always present if image() is present */ if(is_focused()) darker_img->draw(ix, iy); else im->draw(ix, iy); E_DEBUG(E_STRLOC ": DesktopIcon icon redraw\n"); } if(gsettings->label_draw && (damage() & (FL_DAMAGE_ALL | EDAMAGE_CHILD_LABEL))) { int X = x() + w()-(w()/2)-(lwidth/2); int Y = y() + h() + LABEL_OFFSET; Fl_Color old = fl_color(); if(!gsettings->label_transparent) { fl_color(gsettings->label_background); fl_rectf(X, Y, lwidth, lheight); } int old_font = fl_font(); int old_font_sz = fl_size(); /* draw with icon's font */ fl_font(labelfont(), labelsize()); /* pseudo-shadow */ fl_color(FL_BLACK); fl_draw(label(), X+1, Y+1, lwidth, lheight, align(), 0, 0); fl_color(gsettings->label_foreground); fl_draw(label(), X, Y, lwidth, lheight, align(), 0, 0); /* restore old font */ fl_font(old_font, old_font_sz); if(is_focused()) { /* draw focused box on our way so later this can be used to draw customised boxes */ fl_color(gsettings->label_foreground); fl_line_style(FL_DOT); fl_push_matrix(); fl_begin_loop(); fl_vertex(X, Y); fl_vertex(X + lwidth, Y); fl_vertex(X + lwidth, Y + lheight); fl_vertex(X, Y + lheight); fl_vertex(X, Y); fl_end_loop(); fl_pop_matrix(); /* revert to default line style */ fl_line_style(0); } /* revert to old color whatever that be */ fl_color(old); E_DEBUG(E_STRLOC ": DesktopIcon label redraw\n"); } }
FL_EXPORT_C(void,flc_push_matrix)( ){ fl_push_matrix(); }
void Panner::draw ( void ) { draw_box(); // draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK ); draw_label(); if ( _bypassed ) { fl_color( 0 ); fl_font( FL_HELVETICA, 12 ); fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER ); return; } int tw, th, tx, ty; bbox( tx, ty, tw, th ); fl_push_clip( tx, ty, tw, th ); fl_color( FL_RED ); const int b = 10; tx += b; ty += b; tw -= b * 2; th -= b * 2; /* draw perimeter */ { Fl_Color c1, c2; int iter; if ( Fl::belowmouse() == this ) { iter = 12; c1 = fl_darker( FL_RED ); c2 = FL_GRAY; } else { iter = 6; c1 = FL_GRAY; c2 = FL_BLACK; } Fl_Color c = c1; for ( int i = iter; i--; ) { fl_color( c ); fl_arc( tx + (i * (tw / iter)) / 2, ty + (i * (th / iter)) / 2, tw - (i * (tw / iter)), th - (i * ( th / iter )), 0, 360 ); c = fl_color_average( c1, c2, (float)i / iter); } } /* fl_color( FL_WHITE ); */ /* fl_arc( tx, ty, tw, th, 0, 360 ); */ if ( _configs[ _outs ][0] >= 0 ) { for ( int i = _outs; i--; ) { int a = _configs[ _outs ][ i ]; Point p( 1.2f, (float)a ); float px, py; p.axes( &px, &py ); fl_push_matrix(); const int bx = tx + ((tw / 2) * px + (tw / 2)); const int by = ty + ((th / 2) * py + (th / 2)); fl_translate( bx, by ); fl_scale( 5, 5 ); a = 90 - a; fl_rotate( a ); draw_speaker( FL_WHITE ); fl_rotate( -a ); fl_pop_matrix(); } } /* ensure that points are drawn *inside* the circle */ for ( int i = _ins; i--; ) { Point *p = &_points[ i ]; Fl_Color c = (Fl_Color)(10 + i); int px, py, pw, ph; point_bbox( p, &px, &py, &pw, &ph ); /* draw point */ if ( p != drag ) fl_color( c ); else fl_color( FL_WHITE ); fl_pie( px, py, pw, ph, 0, 360 ); /* draw echo */ fl_color( c = fl_darker( c ) ); fl_arc( px - 5, py - 5, pw + 10, ph + 10, 0, 360 ); if ( Fl::belowmouse() == this ) { fl_color( c = fl_darker( c ) ); fl_arc( px - 10, py - 10, pw + 20, ph + 20, 0, 360 ); fl_color( c = fl_darker( c ) ); fl_arc( px - 30, py - 30, pw + 60, ph + 60, 0, 360 ); } /* draw number */ char pat[4]; snprintf( pat, 4, "%d", i + 1 ); fl_color( FL_BLACK ); fl_font( FL_HELVETICA, ph + 2 ); fl_draw( pat, px + 1, py + 1, pw - 1, ph - 1, FL_ALIGN_CENTER ); /* draw line */ /* fl_color( FL_WHITE ); */ /* fl_line( bx + pw() / 2, by + ph() / 2, tx + (tw / 2), ty + (th / 2) ); */ } fl_pop_clip(); }
void WidgetPDial::draw() { #ifdef NTK_GUI box( FL_NO_BOX ); Fl_Dial::draw(); return; #else const int cx = x(), cy = y(), sx = w(), sy = h(); const double a1 = angle1(), a2 = angle2(); const double val = (value() - minimum()) / (maximum() - minimum()); // even radius produces less artifacts if no antialiasing is avail const int rad = (sx > sy ? sy : sx) &~1; /* clears the button background */ pdialcolor(160, 160, 160); fl_pie(cx - 2, cy - 2, rad + 4, rad + 4, 0, 360); /* dark outline */ fl_color(60, 60, 60); fl_pie(cx - 1, cy - 1, rad + 2, rad + 2, 0, 360); /* Draws the button faceplate, min/max */ pdialcolor(110, 110, 115); fl_pie(cx, cy, rad, rad, 270 - a2, 270 - a1); /* knob center */ if (rad > 8) { pdialcolor(140, 140, 145); fl_pie(cx + 4, cy + 4, rad - 8, rad - 8, 0, 360); } /* value circle */ double a = -(a2 - a1) * val - a1; fl_line_style(0, 2, 0); pdialcolor(0, 200, 0); fl_arc(cx + 1, cy + 1, rad - 2, rad - 2, a - 90, a1 - 180); fl_line_style(0); /* draw value line */ int ll = rad/4; if (ll < 2) ll = 2; fl_push_matrix(); fl_translate(cx + rad / 2, cy + rad / 2); fl_rotate(a - 90.0f); fl_translate(rad / 2, 0); fl_begin_polygon(); pdialcolor(0, 0, 0); fl_vertex(-ll, 0); fl_vertex(0, 0); fl_end_polygon(); fl_pop_matrix(); #endif }
void Fl_Dial::draw() { int X = 0; int Y = 0; int W = w(); int H = h(); if (!(type() == FILL && box() == FL_OVAL_BOX)) { if (damage()&FL_DAMAGE_ALL) draw_box(); box()->inset(X,Y,W,H); } Fl_Color fillcolor = selection_color(); Fl_Color linecolor = highlight_color(); if (!active_r()) { fillcolor = fl_inactive(fillcolor); linecolor = fl_inactive(linecolor); } double angle = (a2-a1)*(value()-minimum())/(maximum()-minimum()) + a1; if (type() == FILL) { if (damage()&FL_DAMAGE_EXPOSE && box() == FL_OVAL_BOX) { fl_push_clip(0, 0, w(), h()); parent()->draw_group_box(); fl_pop_clip(); } fl_color(color()); fl_pie(X, Y, W-1, H-1, 270-a1, angle > a1 ? 360+270-angle : 270-360-angle); fl_color(fillcolor); fl_pie(X, Y, W-1, H-1, 270-angle, 270-a1); if (box() == FL_OVAL_BOX) { fl_ellipse(X, Y, W-1, H-1); fl_color(linecolor); fl_stroke(); } } else { if (!(damage()&FL_DAMAGE_ALL)) { fl_ellipse(X+1, Y+1, W-2, H-2); fl_color(color()); fl_fill(); } fl_push_matrix(); fl_translate(X+W/2-.5, Y+H/2-.5); fl_scale(W-1, H-1); fl_rotate(45-angle); if (type() == LINE) { fl_vertex(0.0, 0.0); fl_vertex(-0.04, 0.0); fl_vertex(-0.25, 0.25); fl_vertex(0.0, 0.04); } else { fl_circle(-0.20, 0.20, 0.07); } fl_color(fillcolor); fl_fill_stroke(linecolor); fl_pop_matrix(); } if (focused()) { fl_ellipse(X+2, Y+2, W-5, H-5); fl_color(linecolor); fl_line_style(FL_DASH); fl_stroke(); fl_line_style(0); } }
void Fl_Gauge::draw(void) { int X = x(); int Y = y(); int W = w(); int H = h(); draw_box(); X += Fl::box_dx(box()); Y += Fl::box_dy(box()); W -= Fl::box_dw(box()); H -= Fl::box_dh(box()); double frac = (value() - minimum()) / (maximum() - minimum()); double angle = (angle2() - angle1()) * frac + angle1(); float cx = X + W/2.0f; float cy = Y + H/2.0f; float d = (float)((W < H)? W : H); double num_major_ticks = (maximum() - minimum()) / major_step_size; double num_minor_ticks = (maximum() - minimum()) / minor_step_size; double minor_angle = (angle2() - angle1()) / num_minor_ticks; double major_angle = (angle2() - angle1()) / num_major_ticks; int i; fl_color(FL_WHITE); fl_line_style(FL_SOLID, 1); /* minor ticks */ fl_push_matrix(); fl_color(FL_WHITE); fl_translate(cx, cy); fl_scale(d, d); fl_rotate(-angle1()); for (i = 0; i <= num_minor_ticks; i++) { fl_begin_line(); fl_vertex(0, 0.40); fl_vertex(0, 0.45); fl_end_line(); fl_rotate(-minor_angle); } fl_pop_matrix(); /* major ticks */ fl_push_matrix(); fl_color(FL_WHITE); fl_line_style(FL_SOLID, 3); fl_translate(cx, cy); fl_scale(d, d); fl_rotate(-angle1()); for (i = 0; i <= num_major_ticks; i++) { fl_begin_line(); fl_vertex(0, 0.40); fl_vertex(0, 0.47); fl_end_line(); fl_rotate(-major_angle); } fl_pop_matrix(); /* tick labels */ char buf[128]; fl_color(FL_WHITE); for (i = 0; i <= num_major_ticks; i++) { snprintf(buf, sizeof(buf), "%.0lf", minimum() + i * major_step_size); double angle = 360.0 + -angle1() - 90 - i * major_angle; double rad = angle * M_PI/180.0; int width = 0; int height = 0; fl_measure(buf, width, height); if (width < 1) { width = 9; } if (height < 1) { height = 16; } double radius = d / 3; double x = cx + radius * cos(rad); double y = cy - radius * sin(rad); if (rad < M_PI/2.0 || rad > 3 * M_PI/2.0) { x = cx + (radius - width/2.0) * cos(rad); } x -= width/2.0; fl_draw(buf, x, y + height/2.0); } fl_push_matrix(); fl_translate(cx, cy); fl_scale(d, d); fl_color(FL_WHITE); fl_rotate(-angle); /* arrow */ fl_begin_polygon(); fl_vertex(-0.02, 0.03); fl_vertex(-0.02, 0.35); fl_vertex( 0.00, 0.37); fl_vertex( 0.02, 0.35); fl_vertex( 0.02, 0.03); fl_end_polygon(); /* border */ fl_begin_loop(); fl_circle(0.0, 0.0, 0.48); fl_end_loop(); fl_pop_matrix(); fl_color(FL_GRAY); fl_pie(cx - d * 0.05, cy - d * 0.05, d * 0.1, d * 0.1, 0, 360.0); fl_color(FL_BLACK); fl_pie(cx - d * 0.025, cy - d * 0.025, d * 0.05, d * 0.05, 0, 360.0); draw_label(); }