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

Method OnShowChannelData

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

Source from the content-addressed store, hash-verified

381}
382
383void MdfDocument::OnShowChannelData(wxCommandEvent &) {
384 if (!reader_) {
385 return;
386 }
387 const auto* mdf_file = reader_->GetFile();
388 if (mdf_file == nullptr) {
389 return;
390 }
391
392
393
394 const IChannel* channel = nullptr;
395 const auto selected_id = GetSelectedBlockId();
396 const auto *selected_block = GetBlock(selected_id);
397 if (selected_block != nullptr && selected_block->BlockType() == "CN") {
398 channel = dynamic_cast<const IChannel*>(selected_block);
399 }
400 if (channel == nullptr) {
401 return;
402 }
403
404 auto *data_group = mdf_file->FindParentDataGroup(*channel);
405 if (data_group == nullptr) {
406 return;
407 }
408
409 const auto *channel_group = data_group->FindParentChannelGroup(*channel);
410 if (channel_group == nullptr) {
411 return;
412 }
413
414 // Need to show the master channel as well as the data channel
415 const auto* x_axis = channel_group->GetXChannel(*channel);
416 // Need to show the master channel as well as the data channel
417
418 auto* view = GetFirstView();
419 if (view == nullptr) {
420 return;
421 }
422
423 auto* parent = view->GetFrame();
424 if (parent == nullptr) {
425 return;
426 }
427
428 std::ostringstream title;
429 if (!channel->Name().empty()) {
430 title << channel->Name();
431 }
432
433 if (!channel_group->Name().empty()) {
434 if (!title.str().empty()) {
435 title << "/";
436 }
437 title << channel_group->Name();
438 }
439
440 if (!data_group->Description().empty()) {

Callers

nothing calls this directly

Calls 12

CreateChannelObserverFunction · 0.85
emptyMethod · 0.80
GetFileMethod · 0.45
BlockTypeMethod · 0.45
FindParentDataGroupMethod · 0.45
GetXChannelMethod · 0.45
NameMethod · 0.45
DescriptionMethod · 0.45
ShortNameMethod · 0.45
IndexMethod · 0.45
ReadDataMethod · 0.45

Tested by

no test coverage detected