Extract FrequencyStepView from FrequencyOptionsView.

...for use in capture app.
This commit is contained in:
Jared Boone 2016-07-19 10:47:15 -07:00
parent 77291b4e31
commit a98ada0cb7
2 changed files with 30 additions and 19 deletions

View File

@ -232,7 +232,7 @@ FrequencyOptionsView::FrequencyOptionsView(
{
set_style(style);
options_step.on_change = [this](size_t n, OptionsField::value_t v) {
field_step.on_change = [this](size_t n, OptionsField::value_t v) {
(void)n;
this->on_step_changed(v);
};
@ -243,14 +243,14 @@ FrequencyOptionsView::FrequencyOptionsView(
add_children({ {
&text_step,
&options_step,
&field_step,
&field_ppm,
&text_ppm,
} });
}
void FrequencyOptionsView::set_step(rf::Frequency f) {
options_step.set_by_value(f);
field_step.set_by_value(f);
}
void FrequencyOptionsView::set_reference_ppm_correction(int32_t v) {

View File

@ -229,6 +229,32 @@ private:
void update_text();
};
class FrequencyStepView : public OptionsField {
public:
FrequencyStepView(
Point parent_pos
) : OptionsField {
parent_pos,
5,
{
{ " 100", 100 },
{ " 1k ", 1000 },
{ " 3k ", 3000 }, /* Approximate SSB bandwidth */
{ " 5k ", 5000 },
{ " 6k3", 6250 },
{ " 9k ", 9000 }, /* channel spacing for LF, MF in some regions */
{ " 10k ", 10000 },
{ " 12k5", 12500 },
{ " 25k ", 25000 },
{ "100k ", 100000 },
{ " 1M ", 1000000 },
{ " 10M ", 10000000 },
}
}
{
}
};
class FrequencyOptionsView : public View {
public:
std::function<void(rf::Frequency)> on_change_step;
@ -245,23 +271,8 @@ private:
"Step"
};
OptionsField options_step {
FrequencyStepView field_step {
{ 5 * 8, 0 * 16 },
5,
{
{ " 100", 100 },
{ " 1k ", 1000 },
{ " 3k ", 3000 }, /* Approximate SSB bandwidth */
{ " 5k ", 5000 },
{ " 6k3", 6250 },
{ " 9k ", 9000 }, /* channel spacing for LF, MF in some regions */
{ " 10k ", 10000 },
{ " 12k5", 12500 },
{ " 25k ", 25000 },
{ "100k ", 100000 },
{ " 1M ", 1000000 },
{ " 10M ", 10000000 },
}
};
void on_step_changed(rf::Frequency v);