Now, I can click on either of the waterfalls to tune into the desired signal. This functionality was gone for several weeks after I started my refactoring. The new feature is the white marker on the spectrum on the lower half to indicate the current VFO frequency of IC-7410.
Unfortunately, the implementation includes the lines which are not very elegant.
/* show IC-7410 passband on Soft66LC4 waterfall */ if(nch == 2) { cr->save(); cr->set_source_rgba(0.9, 0.9, 0.9, 0.4); cr->rectangle(xspacing + spectrum_x/2 + (AlsaParams::ic7410_frequency-AlsaParams::soft66_frequency)/ s->bin_size - 15, yspacing+(waveform_y+yspacing)*nch, 30, spectrum_y); cr->fill(); cr->stroke(); }
bool MyDrawingArea::on_button_press_event(GdkEventButton * event) { x_press = event->x; y_press = event->y; int freq; switch (nch) { case 1: /* IC-7410 */ if(s->operating_mode == 3) { /* CW is LSB */ freq = AlsaParams::ic7410_frequency - ( (x_press - xspacing) * s->bin_size - s->cw_pitch ); } else if(s->operating_mode == 7) { /* CW-R is USB */ freq = AlsaParams::ic7410_frequency + ( (x_press - xspacing) * s->bin_size - s->cw_pitch ); } else { ; } break; case 2: /* Soft66LC4 */ freq = AlsaParams::soft66_frequency + ( (x_press - xspacing) - (waterfall_x / 2) ) * s->bin_size; break; default: return false; } Sound::set_ic7410_frequency(freq); return true; }
Of course I can use virtual functions to eliminate all such if or switch statements, but I am not very sure if I should.
The exact position and the size of the white marker should reflect the bandwidth of IC-7410, and if it is in LSB or USB mode, but now they are both fixed.