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

Method DoUpdate

src/HistoryWindow.cpp:286–328  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286void HistoryDialog::DoUpdate()
287{
288 int i = 0;
289
290 SpaceUsageCalculator calculator;
291 calculator.Calculate( *mManager );
292
293 // point to size for oldest state
294 auto iter = calculator.space.rbegin();
295
296 mList->DeleteAllItems();
297
298 wxLongLong_t total = 0;
299 mSelected = mManager->GetCurrentState();
300 mManager->VisitStates(
301 [&]( const UndoStackElem &elem ){
302 const auto space = *iter++;
303 total += space;
304 const auto size = Internat::FormatSize(space);
305 const auto &desc = elem.description;
306 mList->InsertItem(i, desc.Translation(), i == mSelected ? 1 : 0);
307 mList->SetItem(i, 1, size.Translation());
308 ++i;
309 },
310 false // oldest state first
311 );
312
313 mTotal->SetValue(Internat::FormatSize(total).Translation());
314
315 auto clipboardUsage = calculator.clipboardSpaceUsage;
316 mClipboard->SetValue(Internat::FormatSize(clipboardUsage).Translation());
317#if defined(ALLOW_DISCARD)
318 FindWindowById(ID_DISCARD_CLIPBOARD)->Enable(clipboardUsage > 0);
319#endif
320
321 mList->EnsureVisible(mSelected);
322
323 mList->SetItemState(mSelected,
324 wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED,
325 wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
326
327 UpdateLevels();
328}
329
330void HistoryDialog::UpdateLevels()
331{

Callers

nothing calls this directly

Calls 7

GetCurrentStateMethod · 0.80
VisitStatesMethod · 0.80
TranslationMethod · 0.80
CalculateMethod · 0.45
rbeginMethod · 0.45
SetValueMethod · 0.45
EnableMethod · 0.45

Tested by

no test coverage detected