Groups now renamed like everything else; remove onRenameGroup dc

This commit is contained in:
Charles J. Cliffe 2017-03-16 23:23:21 -04:00
parent e45de44dbd
commit 38e41eb85e
2 changed files with 11 additions and 25 deletions

View File

@ -924,15 +924,14 @@ void BookmarkView::groupSelection(std::string groupName) {
hideProps();
// m_labelText->SetValue(groupSel);
m_labelText->SetValue(groupName);
// m_labelText->Show();
// m_labelLabel->Show();
m_labelText->Show();
m_labelLabel->Show();
addButton(m_buttonPanel, "Remove Group", wxCommandEventHandler( BookmarkView::onRemoveGroup ));
addButton(m_buttonPanel, BOOKMARK_VIEW_STR_RENAME_GROUP, wxCommandEventHandler( BookmarkView::onRenameGroup ));
// showProps();
showProps();
showButtons();
refreshLayout();
@ -1085,6 +1084,13 @@ void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) {
} else if (curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) {
curSel->rangeEnt->label = m_labelText->GetValue().ToStdWstring();
wxGetApp().getBookmarkMgr().updateActiveList();
} else if (curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
std::string newGroupName = m_labelText->GetValue().ToStdString();
if (newGroupName != "" && newGroupName != curSel->groupName) {
wxGetApp().getBookmarkMgr().renameGroup(curSel->groupName, newGroupName);
wxGetApp().getBookmarkMgr().updateBookmarks();
}
}
}
@ -1217,25 +1223,6 @@ void BookmarkView::onRemoveGroup( wxCommandEvent& /* event */ ) {
}
void BookmarkView::onRenameGroup( wxCommandEvent& /* event */ ) {
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (!curSel || curSel->type != TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
return;
}
wxString stringVal = "";
stringVal = wxGetTextFromUser(BOOKMARK_VIEW_STR_RENAME_GROUP, "New Group Name", curSel->groupName);
std::string newGroupName = stringVal.Trim().ToStdString();
if (newGroupName != "") {
wxGetApp().getBookmarkMgr().renameGroup(curSel->groupName, newGroupName);
wxGetApp().getBookmarkMgr().updateBookmarks();
}
}
void BookmarkView::onAddRange( wxCommandEvent& /* event */ ) {
BookmarkRangeEntryPtr re = BookmarkView::makeActiveRangeEntry();

View File

@ -154,7 +154,6 @@ protected:
void onAddGroup( wxCommandEvent& event );
void onRemoveGroup( wxCommandEvent& event );
void onRenameGroup( wxCommandEvent& event );
void onAddRange( wxCommandEvent& event );
void onRemoveRange( wxCommandEvent& event );