| 284 | } |
| 285 | |
| 286 | void 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 | |
| 330 | void HistoryDialog::UpdateLevels() |
| 331 | { |
nothing calls this directly
no test coverage detected