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

Method OnShowSrData

lib/mdflib/mdfviewer/src/mdfdocument.cpp:488–555  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486}
487
488void MdfDocument::OnShowSrData(wxCommandEvent &) {
489 if (!reader_) {
490 return;
491 }
492 const auto* mdf_file = reader_->GetFile();
493 if (mdf_file == nullptr) {
494 return;
495 }
496
497 ISampleReduction* sr_block = nullptr;
498 const auto selected_id = GetSelectedBlockId();
499 auto *selected_block = GetBlock(selected_id);
500 if (selected_block != nullptr && selected_block->BlockType() == "SR") {
501 sr_block = dynamic_cast<ISampleReduction*>(selected_block);
502 }
503 if (sr_block == nullptr) {
504 return;
505 }
506 const auto* channel_group = sr_block->ChannelGroup();
507 if (channel_group == nullptr) {
508 return;
509 }
510 const auto *data_group = channel_group->DataGroup();
511 if (data_group == nullptr) {
512 return;
513 }
514
515 auto* view = GetFirstView();
516 if (view == nullptr) {
517 return;
518 }
519
520 auto* parent = view->GetFrame();
521 if (parent == nullptr) {
522 return;
523 }
524
525 std::ostringstream title;
526 title << "SR (Samples: " << sr_block << ")";
527
528 if (!channel_group->Name().empty()) {
529 if (!title.str().empty()) {
530 title << "/";
531 }
532 title << channel_group->Name();
533 }
534 if (!data_group->Description().empty()) {
535 if (!title.str().empty()) {
536 title << "/";
537 }
538 title << data_group->Description();
539 }
540
541 if (!title.str().empty()) {
542 title << "/";
543 }
544 title << reader_->ShortName();
545

Callers

nothing calls this directly

Calls 9

emptyMethod · 0.80
ReadSrDataMethod · 0.80
GetFileMethod · 0.45
BlockTypeMethod · 0.45
ChannelGroupMethod · 0.45
DataGroupMethod · 0.45
NameMethod · 0.45
DescriptionMethod · 0.45
ShortNameMethod · 0.45

Tested by

no test coverage detected