From 38e41eb85ee70838053a75ee5cc6afcef7225ed4 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Thu, 16 Mar 2017 23:23:21 -0400 Subject: [PATCH] Groups now renamed like everything else; remove onRenameGroup dc --- src/forms/Bookmark/BookmarkView.cpp | 35 +++++++++-------------------- src/forms/Bookmark/BookmarkView.h | 1 - 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/src/forms/Bookmark/BookmarkView.cpp b/src/forms/Bookmark/BookmarkView.cpp index fb73882..7051b42 100644 --- a/src/forms/Bookmark/BookmarkView.cpp +++ b/src/forms/Bookmark/BookmarkView.cpp @@ -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(); diff --git a/src/forms/Bookmark/BookmarkView.h b/src/forms/Bookmark/BookmarkView.h index dfe50d1..4aba503 100644 --- a/src/forms/Bookmark/BookmarkView.h +++ b/src/forms/Bookmark/BookmarkView.h @@ -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 );