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

Method RedrawCcBlock

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

Source from the content-addressed store, hash-verified

753
754
755void ChildFrame::RedrawCcBlock(const detail::Cc4Block &cc4, const wxTreeItemId &root) {
756 std::ostringstream sub_string;
757 const std::string cc_name = cc4.Name();
758 const std::string cc_unit = cc4.Unit();
759 const std::string cc_desc = cc4.Comment();
760
761 if (!cc_name.empty()) {
762 sub_string << cc_name;
763 }
764 if (!cc_unit.empty()) {
765 if (sub_string.str().empty()) {
766 sub_string << "[" << cc_unit << "]";
767 } else {
768 sub_string << " [" << cc_unit << "]";
769 }
770 }
771 if (!cc_desc.empty()) {
772 if (sub_string.str().empty()) {
773 sub_string << cc_desc;
774 } else {
775 sub_string << " " << cc_desc;
776 }
777 }
778
779 std::ostringstream cc_string;
780 cc_string << cc4.BlockType();
781 if (!sub_string.str().empty() ) {
782 cc_string << " (" << sub_string.str() << ")";
783 }
784
785 auto cc_root = left_->AppendItem(root, wxString::FromUTF8(cc_string.str()),
786 TREE_CC, TREE_CC, new BlockAddress(cc4.FilePosition()));
787
788 if ( const auto* reverse = cc4.Cc(); reverse != nullptr) {
789 RedrawCcBlock(*reverse, cc_root);
790 }
791 const auto& ref_list = cc4.References();
792 for (const auto& ref : ref_list) {
793 if (!ref || ref->BlockType() != "CC") {
794 continue;
795 }
796 const auto* ref4 = dynamic_cast<const mdf::detail::Cc4Block*>(ref.get());
797 if (ref4 != nullptr) {
798 RedrawCcBlock(*ref4, cc_root);
799 }
800 }
801}
802
803void ChildFrame::RedrawCxList(const std::vector<std::unique_ptr<mdf::detail::MdfBlock>>& cx_list,
804 const wxTreeItemId &root) {

Callers

nothing calls this directly

Calls 8

emptyMethod · 0.80
NameMethod · 0.45
UnitMethod · 0.45
CommentMethod · 0.45
BlockTypeMethod · 0.45
FilePositionMethod · 0.45
CcMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected