Merge pull request #524 from cjcliffe/bookmark_label_edit_consistency

Groups now renamed like everything else via label control
This commit is contained in:
Charles J. Cliffe 2017-03-16 23:27:03 -04:00 committed by GitHub
commit cadee60c15
2 changed files with 11 additions and 25 deletions

View File

@ -924,15 +924,14 @@ void BookmarkView::groupSelection(std::string groupName) {
hideProps(); hideProps();
// m_labelText->SetValue(groupSel); m_labelText->SetValue(groupName);
// m_labelText->Show(); m_labelText->Show();
// m_labelLabel->Show(); m_labelLabel->Show();
addButton(m_buttonPanel, "Remove Group", wxCommandEventHandler( BookmarkView::onRemoveGroup )); addButton(m_buttonPanel, "Remove Group", wxCommandEventHandler( BookmarkView::onRemoveGroup ));
addButton(m_buttonPanel, BOOKMARK_VIEW_STR_RENAME_GROUP, wxCommandEventHandler( BookmarkView::onRenameGroup ));
// showProps(); showProps();
showButtons(); showButtons();
refreshLayout(); refreshLayout();
@ -1085,6 +1084,13 @@ void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) {
} else if (curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) { } else if (curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) {
curSel->rangeEnt->label = m_labelText->GetValue().ToStdWstring(); curSel->rangeEnt->label = m_labelText->GetValue().ToStdWstring();
wxGetApp().getBookmarkMgr().updateActiveList(); 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 */ ) { void BookmarkView::onAddRange( wxCommandEvent& /* event */ ) {
BookmarkRangeEntryPtr re = BookmarkView::makeActiveRangeEntry(); BookmarkRangeEntryPtr re = BookmarkView::makeActiveRangeEntry();

View File

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