| 135 | } |
| 136 | |
| 137 | void SpectralSelectionBar::Populate() |
| 138 | { |
| 139 | SetBackgroundColour( theTheme.Colour( clrMedium ) ); |
| 140 | gPrefs->Read(preferencePath, &mbCenterAndWidth, true); |
| 141 | |
| 142 | auto &formats = ProjectNumericFormats::Get(mProject); |
| 143 | auto frequencyFormatName = formats.GetFrequencySelectionFormatName(); |
| 144 | auto bandwidthFormatName = formats.GetBandwidthSelectionFormatName(); |
| 145 | wxFlexGridSizer *mainSizer = safenew wxFlexGridSizer(1, 1, 1); |
| 146 | Add(mainSizer, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 5); |
| 147 | |
| 148 | // |
| 149 | // Top row, choice box |
| 150 | // |
| 151 | |
| 152 | const wxString choices[2] = { |
| 153 | _("Center frequency and Width"), |
| 154 | _("Low and High Frequencies"), |
| 155 | }; |
| 156 | mChoice = safenew wxChoice |
| 157 | (this, OnChoiceID, wxDefaultPosition, wxDefaultSize, 2, choices, |
| 158 | 0, wxDefaultValidator, _("Show")); |
| 159 | mChoice->SetSelection(mbCenterAndWidth ? 0 : 1); |
| 160 | #if wxUSE_ACCESSIBILITY |
| 161 | // so that name can be set on a standard control |
| 162 | mChoice->SetAccessible(safenew WindowAccessible(mChoice)); |
| 163 | #endif |
| 164 | mChoice->SetMinSize(wxSize(mChoice->GetBestSize().x, toolbarSingle)); |
| 165 | |
| 166 | mainSizer->Add(mChoice, 0, wxEXPAND | wxALIGN_TOP | wxRIGHT, 6); |
| 167 | |
| 168 | // |
| 169 | // Bottom row, split into two columns, each with one control |
| 170 | // |
| 171 | |
| 172 | { |
| 173 | auto subSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL); |
| 174 | |
| 175 | mCenterCtrl = safenew NumericTextCtrl(FormatterContext::ProjectContext(mProject), |
| 176 | this, OnCenterID, |
| 177 | NumericConverterType_FREQUENCY(), frequencyFormatName, 0.0, |
| 178 | NumericTextCtrl::Options{} |
| 179 | .InvalidValue( true, SelectedRegion::UndefinedFrequency ) |
| 180 | ); |
| 181 | mCenterCtrl->SetName( XO("Center Frequency") ); |
| 182 | subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); |
| 183 | |
| 184 | mWidthCtrl = safenew NumericTextCtrl( |
| 185 | FormatterContext::ProjectContext(mProject), |
| 186 | this, OnWidthID, |
| 187 | NumericConverterType_BANDWIDTH(), bandwidthFormatName, 0.0, |
| 188 | NumericTextCtrl::Options{} |
| 189 | .InvalidValue( true, -1.0 ) |
| 190 | ); |
| 191 | mWidthCtrl->SetName( XO("Bandwidth") ); |
| 192 | subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5); |
| 193 | |
| 194 | mLowCtrl = safenew NumericTextCtrl( |
nothing calls this directly
no test coverage detected