MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / RedrawTreeList

Method RedrawTreeList

lib/mdflib/mdfviewer/src/childframe.cpp:207–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

205}
206
207void ChildFrame::RedrawTreeList() {
208
209 left_->DeleteAllItems();
210
211 auto* doc = wxDynamicCast(GetDocument(), MdfDocument); // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
212 if (doc == nullptr) {
213 return;
214 }
215 const auto* reader = doc->GetReader();
216 if (reader == nullptr) {
217 return;
218 }
219
220 left_->AddRoot(reader->ShortName(), TREE_ROOT, TREE_ROOT);
221
222 const auto* file = doc->GetFile();
223 if (file == nullptr) {
224 return;
225 }
226
227 const auto* file3 = dynamic_cast<const mdf::detail::Mdf3File*>(file);
228 const auto* file4 = dynamic_cast<const mdf::detail::Mdf4File*>(file);
229
230 if (file4 != nullptr) {
231 RedrawMdf4Blocks(file4);
232 } else if (file3 != nullptr) {
233 RedrawMdf3Blocks(file3);
234 }
235
236 auto selected_id = doc->GetSelectedBlockId();
237 auto found = FindId(left_, left_->GetRootItem(), selected_id);
238 if (found.IsOk()) {
239 left_->SelectItem(found);
240 left_->EnsureVisible(found);
241 }
242}
243
244void ChildFrame::RedrawMdf3Blocks(const mdf::detail::Mdf3File *file) {
245 if (file == nullptr) {

Callers

nothing calls this directly

Calls 6

FindIdFunction · 0.85
GetReaderMethod · 0.80
GetSelectedBlockIdMethod · 0.80
ShortNameMethod · 0.45
GetFileMethod · 0.45
IsOkMethod · 0.45

Tested by

no test coverage detected