Fl_Arc_Dial: Draw value over face of dial
This commit is contained in:
parent
4f5ce252e0
commit
7e328df3c3
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include <Fl/fl_draw.H>
|
#include <Fl/fl_draw.H>
|
||||||
#include <Fl/Fl.H>
|
#include <Fl/Fl.H>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
Fl_Arc_Dial::handle ( int m )
|
Fl_Arc_Dial::handle ( int m )
|
||||||
|
@ -88,6 +90,8 @@ Fl_Arc_Dial::draw ( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_color( selection_color() );
|
fl_color( selection_color() );
|
||||||
|
// fl_color( fl_color_average( FL_RED, selection_color(), ( value() - minimum() ) / ( maximum() - minimum() ) ) );
|
||||||
|
|
||||||
|
|
||||||
if ( type() == FL_FILL_DIAL )
|
if ( type() == FL_FILL_DIAL )
|
||||||
fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle );
|
fl_arc( X, Y, W, H, 270 - angle1(), 270 - angle );
|
||||||
|
@ -100,7 +104,16 @@ Fl_Arc_Dial::draw ( void )
|
||||||
angle = angle > angle2() - d ? angle2() - d : angle;
|
angle = angle > angle2() - d ? angle2() - d : angle;
|
||||||
|
|
||||||
fl_arc( X, Y, W, H, 270 - (angle - d), 270 - (angle + d) );
|
fl_arc( X, Y, W, H, 270 - (angle - d), 270 - (angle + d) );
|
||||||
|
}
|
||||||
|
|
||||||
fl_line_style( FL_SOLID, 0 );
|
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 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue