| 381 | } |
| 382 | |
| 383 | void 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()) { |
nothing calls this directly
no test coverage detected