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

Method RedrawListView

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

Source from the content-addressed store, hash-verified

1093}
1094
1095void ChildFrame::RedrawListView() {
1096 property_view_->DeleteAllItems();
1097 property_list_.clear();
1098
1099 if (splitter_->GetWindow2() != property_view_) {
1100 return;
1101 }
1102
1103 auto* doc = GetDoc();
1104 if (doc == nullptr) {
1105 return;
1106 }
1107
1108 auto id = doc->GetSelectedBlockId();
1109 const auto* block = doc->GetBlock(id);
1110 if (block == nullptr) {
1111 return;
1112 }
1113
1114 block->GetBlockProperty(property_list_);
1115
1116 long line = 0;
1117 for (const auto& prop : property_list_) {
1118 switch (prop.Type()) {
1119 case mdf::detail::BlockItemType::HeaderItem:
1120 {
1121 auto index = property_view_->InsertItem(line, wxString::FromUTF8(prop.Label()));
1122 auto font = property_view_->GetItemFont(index);
1123 font.MakeItalic();
1124 property_view_->SetItemFont(index, font);
1125 }
1126 break;
1127
1128 case mdf::detail::BlockItemType::LinkItem:
1129 {
1130 auto index = property_view_->InsertItem(line, wxString::FromUTF8(prop.Label()));
1131 if (prop.Link() > 0) {
1132 property_view_->SetItem(index, 1, wxString::FromUTF8(prop.Value()));
1133 property_view_->SetItem(index, 2, wxString::FromUTF8(prop.Description()));
1134 } else if (!prop.Description().empty()) {
1135 property_view_->SetItem(index, 2, wxString::FromUTF8(prop.Description()));
1136 }
1137 }
1138 break;
1139
1140 case mdf::detail::BlockItemType::BlankItem:
1141 {
1142 auto index = property_view_->InsertItem(line, "");
1143 property_view_->SetItem(index, 1, "");
1144 property_view_->SetItem(index, 2, "");
1145 }
1146 break;
1147
1148 default:
1149 {
1150 auto index = property_view_->InsertItem(line, wxString::FromUTF8(prop.Label()));
1151 property_view_->SetItem(index, 1, wxString::FromUTF8(prop.Value()));
1152 property_view_->SetItem(index, 2, wxString::FromUTF8(prop.Description()));

Callers

nothing calls this directly

Calls 10

GetSelectedBlockIdMethod · 0.80
GetBlockMethod · 0.80
LabelMethod · 0.80
emptyMethod · 0.80
clearMethod · 0.45
GetBlockPropertyMethod · 0.45
TypeMethod · 0.45
LinkMethod · 0.45
ValueMethod · 0.45
DescriptionMethod · 0.45

Tested by

no test coverage detected