mirror of
https://git.code.sf.net/p/fldigi/fldigi
synced 2026-08-13 17:47:54 -04:00
scope colors
* fltk library issue moving from fltk 1.3.9 to fltk 1.4.3
. fl_scale and fl_circle parameter lists are incompatible.
. modified code to preclude using fl_scale to allow
one code source to compile and function correctly with
either library.
This commit is contained in:
parent
97d9ef6110
commit
146ca32833
1 changed files with 107 additions and 19 deletions
|
|
@ -203,15 +203,83 @@ void Digiscope::draw_phase()
|
|||
static double pvecstack[8][2];
|
||||
static const size_t psz = sizeof(pvecstack)/sizeof(*pvecstack);
|
||||
static unsigned pszn = 0;
|
||||
double scale = 0.95 * w() / 2.0;
|
||||
|
||||
fl_clip(x()+2,y()+2,w()-4,h()-4);
|
||||
fl_color(_bk_color);
|
||||
fl_rectf(x()+2,y()+2,w()-4,h()-4);
|
||||
//#if FLDIGI_FLTK_API_MINOR >= 4
|
||||
#if 1
|
||||
|
||||
fl_push_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4, _bk_color );
|
||||
fl_push_matrix();
|
||||
fl_translate(x() + w() / 2.0, y() + w() / 2.0);
|
||||
fl_scale( 0.9*w()/2, -0.9*w()/2);
|
||||
fl_color(_axis_color);
|
||||
fl_circle( 0.0, 0.0, 1.0);
|
||||
fl_color( _axis_color );
|
||||
fl_translate(x() + w() / 2, y() + w() / 2);
|
||||
fl_circle( 0.0, 0.0, scale);
|
||||
|
||||
fl_begin_line();
|
||||
fl_vertex(-scale, 0.0);
|
||||
fl_vertex(-(0.9 * scale), 0.0);
|
||||
fl_end_line();
|
||||
fl_begin_line();
|
||||
fl_vertex(scale, 0.0);
|
||||
fl_vertex(0.9 * scale, 0.0);
|
||||
fl_end_line();
|
||||
fl_begin_line();
|
||||
fl_vertex(0.0, -scale);
|
||||
fl_vertex(0.0, -(0.9 * scale));
|
||||
fl_end_line();
|
||||
fl_begin_line();
|
||||
fl_vertex(0.0, scale);
|
||||
fl_vertex(0.0, 0.9 * scale);
|
||||
fl_end_line();
|
||||
|
||||
if (_highlight) {
|
||||
if (_mode > PHASE1) {
|
||||
if (pszn == psz - 1)
|
||||
memmove(pvecstack, pvecstack + 1, (psz - 1) * sizeof(*pvecstack));
|
||||
else
|
||||
pszn++;
|
||||
pvecstack[pszn][0] = _phase;
|
||||
pvecstack[pszn][1] = _quality;
|
||||
|
||||
// draw the stack in progressively brighter green
|
||||
for (unsigned i = 0; i <= pszn; i++) {
|
||||
fl_color(fl_color_average(_color_1, _bk_color, 0.2 + 0.8 * i / pszn));
|
||||
fl_begin_line();
|
||||
fl_vertex(0.0, 0.0);
|
||||
if (_mode == PHASE3) // scale length by quality
|
||||
fl_vertex(0.9 * scale * cos(pvecstack[i][0] - M_PI / 2) * pvecstack[i][1],
|
||||
0.9 * scale * sin(pvecstack[i][0] - M_PI / 2) * pvecstack[i][1]);
|
||||
else
|
||||
fl_vertex(0.9 * scale * cos(pvecstack[i][0] - M_PI / 2),
|
||||
0.9 * scale * sin(pvecstack[i][0] - M_PI / 2));
|
||||
fl_end_line();
|
||||
}
|
||||
}
|
||||
else { // original style
|
||||
fl_color(_color_1);
|
||||
fl_begin_line();
|
||||
fl_vertex(0.0, 0.0);
|
||||
fl_vertex(0.9 * scale * cos(_phase - M_PI / 2), 0.9 * scale * sin( _phase - M_PI / 2));
|
||||
fl_end_line();
|
||||
}
|
||||
} else {
|
||||
fl_color(_color_1);
|
||||
fl_circle( 0.0, 0.0, 0.1 * scale);
|
||||
}
|
||||
fl_pop_matrix();
|
||||
fl_pop_clip();
|
||||
|
||||
#else
|
||||
|
||||
fl_push_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_color(_bk_color);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_push_matrix();
|
||||
fl_color( _axis_color );
|
||||
fl_translate(x() + w() / 2, y() + w() / 2);
|
||||
fl_scale( scale );
|
||||
fl_circle( 0.0, 0.0, 1.0 );
|
||||
|
||||
fl_begin_line();
|
||||
fl_vertex(-1.0, 0.0);
|
||||
fl_vertex(-0.9, 0.0);
|
||||
|
|
@ -240,7 +308,6 @@ void Digiscope::draw_phase()
|
|||
|
||||
// draw the stack in progressively brighter green
|
||||
for (unsigned i = 0; i <= pszn; i++) {
|
||||
// fl_color(fl_color_average(FL_GREEN, _bk_color, 1.0 - 0.8 * (n-i)/ pszn));
|
||||
fl_color(fl_color_average(_color_1, _bk_color, 0.2 + 0.8 * i / pszn));
|
||||
fl_begin_line();
|
||||
fl_vertex(0.0, 0.0);
|
||||
|
|
@ -266,14 +333,21 @@ void Digiscope::draw_phase()
|
|||
}
|
||||
fl_pop_matrix();
|
||||
fl_pop_clip();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void Digiscope::draw_scope()
|
||||
{
|
||||
int npts, np;
|
||||
fl_clip(x()+2,y()+2,w()-4,h()-4);
|
||||
#if FLDIGI_FLTK_API_MINOR >= 4
|
||||
fl_push_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4, _bk_color );
|
||||
#else
|
||||
fl_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_color(_bk_color);
|
||||
fl_rectf(x()+2,y()+2,w()-4,h()-4);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
#endif
|
||||
fl_push_matrix();
|
||||
npts = MIN(w(), _len);
|
||||
npts = MAX(1, npts);
|
||||
|
|
@ -347,9 +421,14 @@ void Digiscope::draw_scope()
|
|||
|
||||
void Digiscope::draw_xy()
|
||||
{
|
||||
fl_clip(x()+2,y()+2,w()-4,h()-4);
|
||||
#if FLDIGI_FLTK_API_MINOR >= 4
|
||||
fl_push_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4, _bk_color );
|
||||
#else
|
||||
fl_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_color(_bk_color);
|
||||
fl_rectf(x()+2,y()+2,w()-4,h()-4);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
#endif
|
||||
fl_push_matrix();
|
||||
fl_translate(x() + w() / 2.0, y() + w() / 2.0);
|
||||
fl_scale( w()/2.0, -w()/2.0);
|
||||
|
|
@ -398,9 +477,14 @@ void Digiscope::draw_xy()
|
|||
void Digiscope::draw_rtty()
|
||||
{
|
||||
int npts, np;
|
||||
fl_clip(x()+2,y()+2,w()-4,h()-4);
|
||||
#if FLDIGI_FLTK_API_MINOR >= 4
|
||||
fl_push_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4, _bk_color );
|
||||
#else
|
||||
fl_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_color(_bk_color);
|
||||
fl_rectf(x()+2,y()+2,w()-4,h()-4);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
#endif
|
||||
fl_push_matrix();
|
||||
npts = MIN(w(), _len);
|
||||
npts = MAX(1, npts);
|
||||
|
|
@ -458,12 +542,16 @@ void Digiscope::draw()
|
|||
case DOMDATA : draw_scope(); break;
|
||||
case BLANK :
|
||||
default:
|
||||
fl_clip(x()+2,y()+2,w()-4,h()-4);
|
||||
fl_color(_bk_color);
|
||||
fl_rectf(x()+2,y()+2,w()-4,h()-4);
|
||||
fl_push_matrix();
|
||||
fl_pop_matrix();
|
||||
#if FLDIGI_FLTK_API_MINOR >= 4
|
||||
fl_push_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4, _bk_color );
|
||||
fl_pop_clip();
|
||||
#else
|
||||
fl_clip(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_color(_bk_color);
|
||||
fl_rectf(x() + 2, y() + 2, w() - 4, h() - 4);
|
||||
fl_pop_clip();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue