MCPcopy Create free account
hub / github.com/audacity/audacity / AddTime

Method AddTime

src/toolbars/SelectionBar.cpp:213–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211
212
213void SelectionBar::AddTime(int id, wxSizer * pSizer)
214{
215 auto &formats = ProjectNumericFormats::Get(mProject);
216 auto formatName = formats.GetSelectionFormat();
217 auto pCtrl = safenew NumericTextCtrl(FormatterContext::ProjectContext(mProject),
218 this, id, NumericConverterType_TIME(), formatName, 0.0);
219
220 pCtrl->Bind(
221 wxEVT_TEXT,
222 [this, id](auto& evt) { ModifySelection(id, evt.GetInt() != 0); });
223
224 pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5);
225
226 mTimeControls[id] = pCtrl;
227
228 mFormatChangedToFitValueSubscription[id] = pCtrl->Subscribe(
229 [this, id](const auto& msg)
230 {
231 auto altCtrl = mTimeControls[id == 0 ? 1 : 0];
232 if (altCtrl != nullptr)
233 altCtrl->UpdateFormatToFit(msg.value);
234
235 FitToTimeControls();
236 });
237}
238
239void SelectionBar::AddSelectionSetupButton(wxSizer* pSizer)
240{

Callers

nothing calls this directly

Calls 7

GetFunction · 0.85
BindMethod · 0.80
UpdateFormatToFitMethod · 0.80
NumericTextCtrlClass · 0.70
GetSelectionFormatMethod · 0.45
AddMethod · 0.45
SubscribeMethod · 0.45

Tested by

no test coverage detected