/* ================================================================= draw_static: This routine draws the static portions of the LCD, such as erasing the background, drawing function key labls, etc. ================================================================= */ void Fl_Usage_Box::draw() { int c, i; int x_pos, y_pos; // Draw background fl_color(m_backgroundColor); fl_rectf(x()+1,y()+1,w()-2,h()-2); // Draw frame fl_color(FL_BLACK); fl_rect(x(),y(), w(), h()); // Draw usage information for (c = 1; c < 256; c++) { // Test if index greater than max usage entry if (c > m_maxUsageEntry) break; // Selet Color for this usage entry fl_color(m_usageColors[c]); // "Walk" through the usage map and draw a pixel for each entry with this usage for (i = 0; i < m_usageMapSize; i++) { if (m_pUsageMap[i] == c) { x_pos = i / (h()-4) + 2; y_pos = i % (h()-4) + 2; fl_point(x() + x_pos, y() + y_pos); } } } }
void draw(){ int wt, wb, wc; wt = y() + 24;// wave top wb = y() + h() - 10;// wave bottom wc = (w() - 20) * sh / (sh + sl) + x() + 10;// wave change fl_color(FL_BLACK); fl_rectf(x(), y(), w(), h()); if(sh == 0 && sl == 0){ return; } fl_color(FL_GREEN); fl_xyline(x(), wb, x() + 10); fl_yxline(x() + 10, wt, wb); fl_xyline(x() + 10, wt, wc); fl_yxline(wc, wt, wb); fl_xyline(wc, wb, x() + w() - 10); fl_yxline(x() + w() - 10, wt, wb); fl_xyline(x() + w() - 10, wt, x() + w()); fl_color(FL_WHITE); fl_font(FL_HELVETICA, 10); fl_draw(t, x(), y() + 10); sprintf(buf, "%dusec", sh); fl_draw(buf, x() + 12, wt - 2); sprintf(buf, "%dusec", sl); fl_draw(buf, wc + 2, wb - 2); }
void Box::draw_lines() const{ if(fill_color().visibility()) { // fill fl_color(fill_color().as_int()); fl_rectf(point(0).x + r, point(0).y, w - r - r, h); // 丸角四角形内の縦の長方形 fl_rectf(point(0).x, point(0).y + r, w, h - r - r); // 丸角四角形内の横の長方形 fl_pie(point(0).x + w - r - r, point(0).y, r + r, r + r, 0, 90); // 右上円 fl_pie(point(0).x, point(0).y, r + r, r + r, 90, 180); // 左上円 fl_pie(point(0).x, point(0).y + h - r - r, r + r, r + r, 180, 270); // 左下円 fl_pie(point(0).x + w - r - r, point(0).y + h - r - r, r + r, r + r, 270, 360); // 右下円 fl_color(color().as_int()); // reset color } if(color().visibility()) { // lines on top of fill fl_color(color().as_int()); fl_line(point(0).x + r, point(0).y, point(0).x + w - r, point(0).y); // 上線 fl_line(point(0).x + r, point(0).y + h, point(0).x + w - r, point(0).y + h); // 下線 fl_line(point(0).x, point(0).y + r, point(0).x, point(0).y + h - r); // 左線 fl_line(point(0).x + w, point(0).y + r, point(0).x + w, point(0).y + h - r); // 右線 fl_arc(point(0).x + w - r - r, point(0).y, r + r, r + r, 0, 90); // 右上角丸 fl_arc(point(0).x, point(0).y, r + r, r + r, 90, 180); // 左上角丸 fl_arc(point(0).x, point(0).y + h - r - r, r + r, r + r, 180, 270); // 左下角丸 fl_arc(point(0).x + w - r - r, point(0).y + h - r - r, r + r, r + r, 270, 360); // 右下角丸 } int ofnt = fl_font(); int osz = fl_size(); fl_font(fnt.as_int(), fnt_sz); fl_draw(lab.c_str(), point(0).x + r, point(0).y + h - r); fl_font(ofnt, osz); }
void draw(){ int i; int pitch, level; fl_color(FL_BLACK); fl_rectf(x(), y(), w(), h()); if(c <= 0){ return; } pitch = w() / c; fl_color(FL_GREEN); for(i = 0; i < c; i++){ level = (center - s[i]) / 2 + h() / 2 + y(); fl_rectf( i * pitch + x(), level, pitch > 1 ? pitch - 1 : pitch, h() + y() - level); } fl_color(FL_WHITE); fl_line(x(), h() / 2 + y(), w() + x(), h() / 2 + y()); fl_font(FL_HELVETICA, 10); fl_draw(buf, x(), y() + 10); }
void Ca_PolyLine::draw(){ Ca_Point::draw(); if(next) return; Ca_PolyLine * temp; int c=color; int style=line_style; int size=line_width; fl_color(c); fl_line_style(style,size); fl_begin_line(); fl_vertex(x_axis_->position(x),y_axis_->position(y)); temp=(Ca_PolyLine *)previous; while(temp){ fl_vertex(temp->x_axis_->position(temp->x),temp->y_axis_->position(temp->y)); if((temp->line_style != style)||(temp->color!=c)||(temp->line_width!=size)){ fl_end_line(); c=temp->color; style=temp->line_style; size=temp->line_width; fl_color(c); fl_line_style(style,size); fl_begin_line(); fl_vertex(temp->x_axis_->position(x),temp->y_axis_->position(y)); } temp=(Ca_PolyLine *)(temp->previous); } fl_end_line(); fl_line_style(0,0); };
void IndicatorWindow::draw() { fl_color(255, 255, 255); fl_rectf(0, 0, w(), h()); // draw range if (m_bRangeMarkerEnabled) { fl_color(200,200,200); int min = toWindowX(m_fRangeMarkerMin); int max = toWindowX(m_fRangeMarkerMax); fl_rectf(min, 0, max - min, h()); } // draw indicators fl_color(0, 0, 255); for (int i = 0; i < m_fvIndicators.size(); ++i) { int x = toWindowX(m_fvIndicators[i]); fl_line(x, 0, x, h()); } // draw the floating indicator if (m_iSelectedIndicator < 0) fl_color(255, 0, 0); else fl_color(0, 255, 0); int x = toWindowX(m_fFloatingIndicator); fl_line(x, 0, x, h()); }
void CairoBox::draw(void) { // using fltk functions, set up white background with thin black frame fl_push_no_clip(); /* remove any clipping region set by the expose events... */ fl_push_clip(x(), y(), w(), h()); fl_color(FL_WHITE); fl_rectf(x(), y(), w(), h()); fl_color(FL_BLACK); fl_rect(x(), y(), w(), h()); // set up cairo structures surface = set_surface(w(), h()); cr = cairo_create(surface); /* All Cairo co-ordinates are shifted by 0.5 pixels to correct anti-aliasing */ cairo_translate(cr, 0.5, 0.5); cairo_set_source_rgb(cr, 0.0, 0.0, 0.0); // set drawing color to black cairo_new_path(cr); // virtual function defined in driver program graphic(cr, x(), y(), w(), h()); // release the cairo context cairo_destroy(cr); cairo_surface_destroy(surface); // cr = NULL; // remove clip regions fl_pop_clip(); // local clip region fl_pop_clip(); // "no_clip" region }
void Control_Point::draw_box ( void ) { if ( selected() ) fl_color( selection_color() ); else fl_color( box_color() ); fl_pie( x() - w() / 2, y() - h() / 2, w(), h(), 0, 360 ); if ( this == Sequence_Widget::belowmouse() || this == Sequence_Widget::pushed() ) { char val[10]; snprintf( val, sizeof( val ), "%+.2f", 1.0 - _y * 2 ); Fl_Align a = 0; if ( x() < _sequence->x() + ( _sequence->w() / 2 ) ) a |= FL_ALIGN_RIGHT; else a |= FL_ALIGN_LEFT; if ( y() < _sequence->y() + ( _sequence->h() / 2 ) ) a |= FL_ALIGN_BOTTOM; else a |= FL_ALIGN_TOP; draw_label( val, a, FL_FOREGROUND_COLOR ); } }
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 g_customDownBox(int x, int y, int w, int h, Fl_Color c) { fl_color(c); fl_rectf(x, y, w, h); fl_color(COLOR_BG_0); fl_rect(x, y, w, h); }
void g_customBorderBox(int x, int y, int w, int h, Fl_Color c) { fl_color(c); fl_rectf(x, y, w, h); fl_color(COLOR_BD_0); fl_rect(x, y, w, h); }
void Fl_Arc_Dial::draw ( void ) { int X = x(); int Y = y(); int W = w(); int H = h(); draw_box(); draw_label(); X += Fl::box_dx(box()); Y += Fl::box_dy(box()); W -= Fl::box_dw(box()); H -= Fl::box_dh(box()); double angle = ( angle2() - angle1() ) * ( value() - minimum()) / ( maximum() - minimum() ) + angle1(); fl_line_style( FL_SOLID, W / 6 ); X += W / 8; Y += H / 8; W -= W / 4; H -= H / 4; if ( box() == FL_NO_BOX ) { /* draw backgrond arc */ fl_color( fl_color_average( FL_BLACK, selection_color(), 0.80f ) ); fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle2() ); } fl_color( selection_color() ); // fl_color( fl_color_average( FL_RED, selection_color(), ( value() - minimum() ) / ( maximum() - minimum() ) ) ); if ( type() == FL_FILL_DIAL ) fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle ); else { const int d = 6; /* account for edge conditions */ angle = angle < angle1() + d ? angle1() + d : angle; angle = angle > angle2() - d ? angle2() - d : angle; fl_arc( X, Y, W, H, 270 - (angle - d), 270 - (angle + d) ); } fl_line_style( FL_SOLID, 0 ); fl_color( labelcolor() ); char s[10]; fl_font( FL_HELVETICA, 8 ); snprintf( s, sizeof( s ), "%.1f", value() ); fl_draw( s, X, Y, W, H, FL_ALIGN_BOTTOM ); }
void Parallelogram::draw_lines() const { /* if (fill_color().visibility()) { // fill fl_color(fill_color().as_int()); fl_paraf(point(0).tl,point(0).tr,point(0).bl,point(0).br); fl_color(color().as_int()); // reset color } if (color().visibility()) { // lines on top of fill fl_color(color().as_int()); fl_rect(point(0).tl,point(0).tr,point(0).bl,point(0).br); } */ if (fill_color().visibility()) { fl_color(fill_color().as_int()); fl_begin_complex_polygon(); for(int i=0; i<number_of_points(); ++i){ fl_vertex(point(i).x, point(i).y); } fl_end_complex_polygon(); fl_color(color().as_int()); // reset color } if (color().visibility()) Shape::draw_lines(); }
void Fl_ImageViewer::draw() { fl_push_clip( x(), y(), w(), h() ); Fl_Scroll::draw(); if ( isdrawruler == true ) { fl_color( FL_BLUE ); fl_line_style( 0, 3, NULL ); fl_line( coordclicked_x, coordclicked_y, coordmoving_x, coordmoving_y ); } else if ( isdrawclickpointer == true ) { fl_color( colorclicked ); fl_line_style( 0, 1, NULL ); fl_line( coordclicked_x , y() , coordclicked_x, coordclicked_y - 1 ); fl_line( coordclicked_x, coordclicked_y + 1 , coordclicked_x, y() + h() ); fl_line( x(), coordclicked_y, coordclicked_x - 1, coordclicked_y ); fl_line( coordclicked_x + 1, coordclicked_y, x() + w(), coordclicked_y ); } fl_pop_clip(); }
void gBeatMeter::draw() { int cursorW = (w()/MAX_BEATS); fl_rect(x(), y(), w(), h(), COLOR_BD_0); // border fl_rectf(x()+1, y()+1, w()-2, h()-2, FL_BACKGROUND_COLOR); // bg fl_rectf(x()+(G_Mixer.actualBeat*cursorW)+3, y()+3, cursorW-5, h()-6, COLOR_BG_2); // cursor /* beat cells */ fl_color(COLOR_BD_0); for (int i=1; i<=G_Mixer.beats; i++) fl_line(x()+cursorW*i, y()+1, x()+cursorW*i, y()+h()-2); /* bar line */ fl_color(COLOR_BG_2); int delta = G_Mixer.beats / G_Mixer.bars; for (int i=1; i<G_Mixer.bars; i++) fl_line(x()+cursorW*(i*delta), y()+1, x()+cursorW*(i*delta), y()+h()-2); /* unused grey area */ fl_rectf(x()+(G_Mixer.beats*cursorW)+1, y()+1, ((MAX_BEATS-G_Mixer.beats)*cursorW)-1, h()-2, COLOR_BG_1); }
void Fl_ProgressBar::draw() { int bdx, bdy; double pct; if(damage() & FL_DAMAGE_ALL) draw_box(); int X = 0, Y = 0; bdx = box()->dx(); bdy = box()->dy(); fl_color(selection_color()); if(mPresent > mMax) mPresent = mMax; if(mPresent < mMin) mPresent = mMin; pct = (mPresent - mMin) / mMax; fl_rectf(X + bdx, Y + bdy, (int)(((double)w() - 2*bdx) * pct), h() - (2*bdy + 1)); if(mShowPct) { char buffer[30]; sprintf(buffer, "%d%%", (int) (pct * 100)); fl_color(textcolor()); fl_font(this->label_font(), this->label_size()); fl_draw(buffer, X + (w() - fl_width(buffer))/2, Y + fl_height() + (((h() - 2*bdy) - fl_height())/2)); } }
virtual void draw() { fl_color(FL_BLACK); // draw face short centerX, centerY; float radius; centerX = w()/2; centerY = h()/2; radius = MIN(w(), h())/4; fl_pie(centerX - radius, centerY-radius, radius*2, radius*2, 0, 360); // draw hands int hourX, hourY, minuteX, minuteY, secondX, secondY; hourX = centerX + 0.35 * radius * cos(RADIAN(hourHand)); hourY = centerY + 0.35 * radius * sin(RADIAN(hourHand)); minuteX = centerX + 0.65 * radius * cos(RADIAN(minuteHand)); minuteY = centerY + 0.65 * radius * sin(RADIAN(minuteHand)); secondX = centerX + 0.85 * radius * cos(RADIAN(secondHand)); secondY = centerY + 0.85 * radius * sin(RADIAN(secondHand)); fl_color(FL_GREEN); fl_line_style(FL_SOLID, 3); fl_line(centerX, centerY, hourX, hourY); fl_line(centerX, centerY, minuteX, minuteY); fl_color(FL_RED); fl_line_style(FL_SOLID, 1); fl_line(centerX, centerY, secondX, secondY); }
void gMuteChannel::draw() { baseDraw(); /* print label */ fl_color(COLOR_BG_1); fl_font(FL_HELVETICA, 12); fl_draw("mute", x()+4, y(), w(), h(), (Fl_Align) (FL_ALIGN_LEFT | FL_ALIGN_CENTER)); /* draw "on" and "off" labels. Must stay in background */ fl_color(COLOR_BG_1); fl_font(FL_HELVETICA, 9); fl_draw("on", x()+4, y(), w(), h(), (Fl_Align) (FL_ALIGN_LEFT | FL_ALIGN_TOP)); fl_draw("off", x()+4, y()+h()-14, w(), h(), (Fl_Align) (FL_ALIGN_LEFT | FL_ALIGN_TOP)); /* draw on-off points. On = higher rect, off = lower rect. It always * starts with a note_off */ fl_color(COLOR_BG_2); int pxOld = x()+1; int pxNew = 0; int py = y()+h()-5; int pyDot = py-6; for (unsigned i=0; i<points.size; i++) { /* next px */ pxNew = points.at(i).x+x(); /* draw line from pxOld to pxNew. * i % 2 == 0: first point, mute_on * i % 2 != 0: second point, mute_off */ fl_line(pxOld, py, pxNew, py); pxOld = pxNew; py = i % 2 == 0 ? y()+4 : y()+h()-5; /* draw dots (handles) */ fl_line(pxNew, y()+h()-5, pxNew, y()+4); if (selectedPoint == (int) i) { fl_color(COLOR_BD_1); fl_rectf(pxNew-3, pyDot, 7, 7); fl_color(COLOR_BG_2); } else fl_rectf(pxNew-3, pyDot, 7, 7); } /* last section */ py = y()+h()-5; fl_line(pxNew+3, py, pParent->coverX+x()-1, py); }
void CCanvas::draw_sensor_beam() { const int drawing_offset = 4; // Offset happens on y, don't know why?? // Sensor hit mark if (m_drawing_mode == AZ_DRAW_SENSOR_STRIKE) { fl_color(FL_RED); for (int i = 0; i < m_cfg->LIDAR_RAYS; i = i + 1) fl_circle(m_sensor_data[i].get_hit_point().x(), m_sensor_data[i].get_hit_point().y() + drawing_offset, 1.0); // Size of sensor hit mark } // Occupancy grid // Draw only grid with OCC != 127, OCC = 127 means unknown else if (m_drawing_mode == AZ_DRAW_GRID_MAP) { // Hide the real map fl_rectf(0, 25, w(), h() + 25, 127,127,127); // Scan m_gridmap and draw // We have offset of 25 pixels because of menu bar for (int y = 0; y < h() + 25; y = y + 1) { for (int x = 0; x < w(); x = x + 1) { if (m_grid_map[x + y * m_cfg->GRID_MAP_W] != 127) { unsigned char c = 255 - m_grid_map[x + y * m_cfg->GRID_MAP_W]; fl_color(c, c, c); fl_point(x, y + drawing_offset); } //end if } // end for x } // end for y } // end else if }
void Binary_tree_rectangle::draw_lines() const{ if(fill_color().visibility()) { // fill fl_color(fill_color().as_int()); for(int i = 0; i < number_of_points(); ++i) fl_rectf(point(i).x, point(i).y, radius * 2, radius * 2); // ノード(正方形)を描画 fl_color(color().as_int()); // reset color } if(color().visibility()) { fl_color(color().as_int()); int parent = 0; // point(i)に対する親ノードのインデックス for(int i = 0; i < number_of_points(); ++i){ fl_rect(point(i).x, point(i).y, radius * 2, radius * 2); // ノード(正方形)を描画 // エッジ(線)を描画 if(i != 0){ fl_line(point(parent).x + radius, point(parent).y + radius * 2, point(i).x + radius, point(i).y); if(i % 2 == 0) parent++; } } } }
void Fl_Sparkline::drawCursor(void) { int x = Fl::event_x() - Fl_Widget::x(); int index; float value; hideCursor(); x -= padding; index = num_values * x / width; index = snap(index); x = index * width / num_values; value = map(values[index], values[min_index], values[max_index], height, 0); fl_color(FL_BLUE); fl_rectf(Fl_Widget::x() + padding + x - 1, y() + value + padding - 1, 3, 3); fl_color(FL_RED); fl_line_style(FL_SOLID, 1); fl_line(Fl_Widget::x() + padding + x, y() + padding, Fl_Widget::x() + padding + x, y() + h() - padding); prev_x = x; }
void shape_window::draw() { fl_color(0); fl_rectf(0,0,w(),h()); fl_font(0,20); fl_color(7); fl_draw("This requires GL",0,0,w(),h(),FL_ALIGN_CENTER); }
void WidgetPDial::pdialcolor(int r, int g, int b) { if(active_r()) fl_color(r, g, b); else fl_color(160 - (160 - r) / 3, 160 - (160 - b) / 3, 160 - (160 - b) / 3); }
static void glyph(const Fl_Widget* widget, int glyph, int x,int y,int w,int h, Fl_Flags flags) { if (!glyph) flags.clear(FL_VALUE); Fl_Widget::default_glyph(widget, glyph, x, y, w, h, flags); // draw the divider line into slider: if (!glyph) { if (w < 4 || h < 4) return; // ignore FILL widgets if (!((Fl_Slider*)widget)->slider_size()) return; if (widget->type()&1) // horizontal { x = x+(w+1)/2; fl_color(FL_DARK3); fl_line(x-1, y+1, x-1, y+h-2); fl_color(FL_LIGHT3); fl_line(x, y+1, x, y+h-2); } else { y = y+(h+1)/2; fl_color(FL_DARK3); fl_line(x+1, y-1, x+w-2, y-1); fl_color(FL_LIGHT3); fl_line(x+1, y, x+w-2, y); } } }
void Fl_Canvas::DrawIncompleteWire() { // draw the wire we are currently connecting if(m_IncompleteWire.InputID!=-1) { Fl_DeviceGUI* Device = FindDevice(m_IncompleteWire.InputID); if (!Device) { SpiralInfo::Alert("Cant find source or dest device while drawing wires"); return; } Fl_Color col = (Fl_Color) WIRE_COL0; switch (Device->GetPortType(m_IncompleteWire.InputPort)) { case 0: col = (Fl_Color) WIRE_COL0; break; case 1: col = (Fl_Color) WIRE_COL1; break; case 2: col = (Fl_Color) WIRE_COL2; break; case 3: col = (Fl_Color) WIRE_COL3; break; case 4: col = (Fl_Color) WIRE_COL4; break; default: col = (Fl_Color) WIRE_COL0; } fl_color(col); fl_line(Device->GetPortX(m_IncompleteWire.InputPort), Device->GetPortY(m_IncompleteWire.InputPort), Fl::event_x(), Fl::event_y()); } if(m_IncompleteWire.OutputID!=-1) { Fl_DeviceGUI* Device = FindDevice(m_IncompleteWire.OutputID); if (!Device) { SpiralInfo::Alert("Cant find source or dest device while drawing wires"); return; } Fl_Color col = (Fl_Color) WIRE_COL0; switch (Device->GetPortType(m_IncompleteWire.OutputPort+Device->GetInfo()->NumInputs)) { case 0: col = (Fl_Color) WIRE_COL0; break; case 1: col = (Fl_Color) WIRE_COL1; break; case 2: col = (Fl_Color) WIRE_COL2; break; case 3: col = (Fl_Color) WIRE_COL3; break; case 4: col = (Fl_Color) WIRE_COL4; break; default: col = (Fl_Color) WIRE_COL0; } fl_color(col); fl_line(Device->GetPortX(m_IncompleteWire.OutputPort+Device->GetInfo()->NumInputs), Device->GetPortY(m_IncompleteWire.OutputPort+Device->GetInfo()->NumInputs), Fl::event_x(), Fl::event_y()); } }
void Flu_Choice_Group :: draw() { int i; // make sure the selected child is still a child bool found = false; for( i = 1; i < children(); i++ ) if( child(i) == selected ) { found = true; break; } if( !found ) selected = NULL; if( !selected && children() > 1 ) value( child(1) ); int lblW = 0, lblH = 0, X; for( i = 1; i < children(); i++ ) { int W = 0, H; fl_measure( child(i)->label(), W, H ); if( W > lblW ) lblW = W; if( H > lblH ) lblH = H; } lblW += 26; lblH += 6; // align the label if( align() & FL_ALIGN_LEFT ) X = 4; else if( align() & FL_ALIGN_RIGHT ) X = w() - lblW - 8; else X = w()/2 - lblW/2 - 2; // draw the main group box if( damage() & ~FL_DAMAGE_CHILD ) fl_draw_box( box(), x(), y()+lblH/2, w(), h()-lblH/2, color() ); // clip and draw the children choice->resize( choice->x(), choice->y(), 0, 0 ); fl_clip( x()+2, y()+lblH+1, w()-4, h()-lblH-3 ); draw_children(); fl_pop_clip(); // clear behind the button and draw it fl_color( color() ); fl_rectf( x()+X, y(), lblW+4, lblH ); fl_color( labelcolor() ); choice->resize( x()+X+2, y(), lblW, lblH ); draw_child( *choice ); }
void WidgetTable::draw_cell(TableContext context, int R, int C, int X, int Y, int W, int H) { switch (context) { case CONTEXT_STARTPAGE: fl_font(FL_HELVETICA, 12); // font used by all headers col_width_all(50); // sets the width of the columns break; case CONTEXT_RC_RESIZE: { int X, Y, W, H; int index = 0; for (int r = 0; r<rows(); r++) { for (int c = 0; c<cols(); c++) { if (index >= children()) break; find_cell(CONTEXT_TABLE, r, c, X, Y, W, H); child(index++)->resize(X, Y, W, H); } } init_sizes(); // tell group children resized return; } case CONTEXT_ROW_HEADER: fl_push_clip(X, Y, W, H); { static char s[40]; sprintf(s, "Row %d", R); fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, row_header_color()); fl_color(FL_BLACK); fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); } fl_pop_clip(); return; case CONTEXT_COL_HEADER: fl_push_clip(X, Y, W, H); { static char s[40]; sprintf(s, "Column %d", C); fl_draw_box(FL_THIN_UP_BOX, X, Y, W, H, col_header_color()); fl_color(FL_BLACK); fl_draw(s, X, Y, W, H, FL_ALIGN_CENTER); } fl_pop_clip(); return; case CONTEXT_CELL: return; // fltk handles drawing the widgets default: return; } }
/** \brief The specialised drawing function for Missile. * * The draw_missile() function uses the FLTK routines to draw the Missile as * a line from its start location to its current location. */ void Missile::draw_missile() { #ifdef DEBUG fl_color(FL_RED); fl_circle(x(), y(), radius()); #endif fl_color(FL_BLACK); fl_line((int)start_x(), (int)start_y(), (int)x(), (int)y()); }
void ResonanceGraph::draw() { int ox=x(),oy=y(),lx=w(),ly=h(),i,ix,iy,oiy; REALTYPE freqx; fl_color(FL_BLACK); fl_rectf(ox,oy,lx,ly); //draw the lines fl_color(FL_GRAY); fl_line_style(FL_SOLID); fl_line(ox+2,oy+ly/2,ox+lx-2,oy+ly/2); freqx=respar->getfreqpos(1000.0); if ((freqx>0.0)&&(freqx<1.0)) fl_line(ox+(int) (freqx*lx),oy, ox+(int) (freqx*lx),oy+ly); for (i=1;i<10;i++){ if(i==1){ draw_freq_line(i*100.0,0); draw_freq_line(i*1000.0,0); }else if (i==5){ draw_freq_line(i*100.0,2); draw_freq_line(i*1000.0,2); }else{ draw_freq_line(i*100.0,1); draw_freq_line(i*1000.0,1); }; }; draw_freq_line(10000.0,0); draw_freq_line(20000.0,1); fl_line_style(FL_DOT); int GY=10;if (ly<GY*3) GY=-1; for (i=1;i<GY;i++){ int tmp=(int)(ly/(REALTYPE)GY*i); fl_line(ox+2,oy+tmp,ox+lx-2,oy+tmp); }; //draw the data fl_color(FL_RED); fl_line_style(FL_SOLID); oiy=(int)(respar->Prespoints[0]/128.0*ly); for (i=1;i<N_RES_POINTS;i++){ ix=(int)(i*1.0/N_RES_POINTS*lx); iy=(int)(respar->Prespoints[i]/128.0*ly); fl_line(ox+ix-1,oy+ly-oiy,ox+ix,oy+ly-iy); oiy=iy; }; }
void gDial::draw() { double angle = (angle2()-angle1())*(value()-minimum())/(maximum()-minimum()) + angle1(); fl_color(COLOR_BG_0); fl_pie(x(), y(), w(), h(), 270-angle1(), angle > angle1() ? 360+270-angle : 270-360-angle); fl_color(COLOR_BD_0); fl_arc(x(), y(), w(), h(), 0, 360); fl_pie(x(), y(), w(), h(), 270-angle, 270-angle1()); }