MCPcopy Create free account
hub / github.com/cjcliffe/CubicSDR / onLabelText

Method onLabelText

src/forms/Bookmark/BookmarkView.cpp:1175–1207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1173}
1174
1175void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) {
1176
1177 std::wstring newLabel = m_labelText->GetValue().ToStdWstring();
1178 TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
1179
1180 if (curSel != nullptr) {
1181 if (curSel->type == TreeViewItem::Type::TREEVIEW_ITEM_TYPE_ACTIVE) {
1182 curSel->demod->setDemodulatorUserLabel(newLabel);
1183 wxGetApp().getBookmarkMgr().updateActiveList();
1184 } else if (curSel->type == TreeViewItem::Type::TREEVIEW_ITEM_TYPE_BOOKMARK) {
1185 curSel->bookmarkEnt->label = m_labelText->GetValue().ToStdWstring();
1186 curSel->bookmarkEnt->node->child("user_label")->element()->set(newLabel);
1187 wxGetApp().getBookmarkMgr().updateBookmarks();
1188 } else if (curSel->type == TreeViewItem::Type::TREEVIEW_ITEM_TYPE_RECENT) {
1189 curSel->bookmarkEnt->label = m_labelText->GetValue().ToStdWstring();
1190 curSel->bookmarkEnt->node->child("user_label")->element()->set(newLabel);
1191 wxGetApp().getBookmarkMgr().updateActiveList();
1192 } else if (curSel->type == TreeViewItem::Type::TREEVIEW_ITEM_TYPE_RANGE) {
1193 curSel->rangeEnt->label = m_labelText->GetValue().ToStdWstring();
1194 wxGetApp().getBookmarkMgr().updateActiveList();
1195 } else if (curSel->type == TreeViewItem::Type::TREEVIEW_ITEM_TYPE_GROUP) {
1196 std::string newGroupName = m_labelText->GetValue().ToStdString();
1197
1198 if (!newGroupName.empty() && newGroupName != curSel->groupName) {
1199 wxGetApp().getBookmarkMgr().renameGroup(curSel->groupName, newGroupName);
1200 nextGroup = newGroupName;
1201 wxGetApp().getBookmarkMgr().updateBookmarks();
1202 }
1203 }
1204 }
1205
1206 if (!m_treeView->HasFocus()) { m_treeView->SetFocus(); }
1207}
1208
1209
1210void BookmarkView::onDoubleClickFreq( wxMouseEvent& /* event */ ) {

Callers

nothing calls this directly

Calls 8

elementMethod · 0.80
childMethod · 0.80
renameGroupMethod · 0.80
updateActiveListMethod · 0.45
setMethod · 0.45
updateBookmarksMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected