diff --git a/src/forms/Bookmark/BookmarkPanel.cpp b/src/forms/Bookmark/BookmarkPanel.cpp index 259e76c..cb3efd4 100644 --- a/src/forms/Bookmark/BookmarkPanel.cpp +++ b/src/forms/Bookmark/BookmarkPanel.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 23 2015) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -20,7 +20,7 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po m_clearSearchButton = new wxButton( this, wxID_ANY, wxT("Clear Search"), wxDefaultPosition, wxDefaultSize, 0 ); bSizer1->Add( m_clearSearchButton, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); - m_treeView = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxTR_EDIT_LABELS|wxTR_HAS_VARIABLE_ROW_HEIGHT|wxTR_HIDE_ROOT|wxTR_SINGLE ); + m_treeView = new wxTreeCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE|wxTR_HAS_VARIABLE_ROW_HEIGHT|wxTR_HIDE_ROOT|wxTR_SINGLE ); bSizer1->Add( m_treeView, 1, wxEXPAND, 5 ); m_propPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); @@ -89,16 +89,11 @@ BookmarkPanel::BookmarkPanel( wxWindow* parent, wxWindowID id, const wxPoint& po m_searchText->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( BookmarkPanel::onSearchTextFocus ), NULL, this ); m_searchText->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BookmarkPanel::onSearchText ), NULL, this ); m_clearSearchButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onClearSearch ), NULL, this ); - - //VSO: Added m_treeView wxEVT_ENTER_WINDOW/wxEVT_LEAVE_WINDOW that was missing. - m_treeView->Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(BookmarkPanel::onEnterWindow), NULL, this); - m_treeView->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(BookmarkPanel::onLeaveWindow), NULL, this); - - m_treeView->Connect( wxEVT_MOTION, wxMouseEventHandler( BookmarkPanel::onMotion ), NULL, this ); + m_treeView->Connect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( BookmarkPanel::onEnterWindow ), NULL, this ); + m_treeView->Connect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BookmarkPanel::onLeaveWindow ), NULL, this ); + m_treeView->Connect( wxEVT_MOTION, wxMouseEventHandler( BookmarkPanel::onMotion ), NULL, this ); m_treeView->Connect( wxEVT_COMMAND_TREE_BEGIN_DRAG, wxTreeEventHandler( BookmarkPanel::onTreeBeginDrag ), NULL, this ); - m_treeView->Connect( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeBeginLabelEdit ), NULL, this ); m_treeView->Connect( wxEVT_COMMAND_TREE_END_DRAG, wxTreeEventHandler( BookmarkPanel::onTreeEndDrag ), NULL, this ); - m_treeView->Connect( wxEVT_COMMAND_TREE_END_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeEndLabelEdit ), NULL, this ); m_treeView->Connect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( BookmarkPanel::onTreeActivate ), NULL, this ); m_treeView->Connect( wxEVT_COMMAND_TREE_ITEM_COLLAPSED, wxTreeEventHandler( BookmarkPanel::onTreeCollapse ), NULL, this ); m_treeView->Connect( wxEVT_COMMAND_TREE_ITEM_EXPANDED, wxTreeEventHandler( BookmarkPanel::onTreeExpanded ), NULL, this ); @@ -121,16 +116,11 @@ BookmarkPanel::~BookmarkPanel() m_searchText->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( BookmarkPanel::onSearchTextFocus ), NULL, this ); m_searchText->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BookmarkPanel::onSearchText ), NULL, this ); m_clearSearchButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BookmarkPanel::onClearSearch ), NULL, this ); - - //VSO: Added m_treeView wxEVT_ENTER_WINDOW/wxEVT_LEAVE_WINDOW that was missing. - m_treeView->Disconnect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(BookmarkPanel::onEnterWindow), NULL, this); - m_treeView->Disconnect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(BookmarkPanel::onLeaveWindow), NULL, this); - + m_treeView->Disconnect( wxEVT_ENTER_WINDOW, wxMouseEventHandler( BookmarkPanel::onEnterWindow ), NULL, this ); + m_treeView->Disconnect( wxEVT_LEAVE_WINDOW, wxMouseEventHandler( BookmarkPanel::onLeaveWindow ), NULL, this ); m_treeView->Disconnect( wxEVT_MOTION, wxMouseEventHandler( BookmarkPanel::onMotion ), NULL, this ); m_treeView->Disconnect( wxEVT_COMMAND_TREE_BEGIN_DRAG, wxTreeEventHandler( BookmarkPanel::onTreeBeginDrag ), NULL, this ); - m_treeView->Disconnect( wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeBeginLabelEdit ), NULL, this ); m_treeView->Disconnect( wxEVT_COMMAND_TREE_END_DRAG, wxTreeEventHandler( BookmarkPanel::onTreeEndDrag ), NULL, this ); - m_treeView->Disconnect( wxEVT_COMMAND_TREE_END_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeEndLabelEdit ), NULL, this ); m_treeView->Disconnect( wxEVT_COMMAND_TREE_ITEM_ACTIVATED, wxTreeEventHandler( BookmarkPanel::onTreeActivate ), NULL, this ); m_treeView->Disconnect( wxEVT_COMMAND_TREE_ITEM_COLLAPSED, wxTreeEventHandler( BookmarkPanel::onTreeCollapse ), NULL, this ); m_treeView->Disconnect( wxEVT_COMMAND_TREE_ITEM_EXPANDED, wxTreeEventHandler( BookmarkPanel::onTreeExpanded ), NULL, this ); diff --git a/src/forms/Bookmark/BookmarkPanel.fbp b/src/forms/Bookmark/BookmarkPanel.fbp index 8214f9d..5faf349 100644 --- a/src/forms/Bookmark/BookmarkPanel.fbp +++ b/src/forms/Bookmark/BookmarkPanel.fbp @@ -311,7 +311,7 @@ Resizable 1 - wxTR_DEFAULT_STYLE|wxTR_EDIT_LABELS|wxTR_HAS_VARIABLE_ROW_HEIGHT|wxTR_HIDE_ROOT|wxTR_SINGLE + wxTR_DEFAULT_STYLE|wxTR_HAS_VARIABLE_ROW_HEIGHT|wxTR_HIDE_ROOT|wxTR_SINGLE 0 @@ -319,12 +319,12 @@ - + onEnterWindow - + onLeaveWindow @@ -341,11 +341,11 @@ onTreeBeginDrag - onTreeBeginLabelEdit + onTreeEndDrag - onTreeEndLabelEdit + onTreeActivate onTreeCollapse diff --git a/src/forms/Bookmark/BookmarkPanel.h b/src/forms/Bookmark/BookmarkPanel.h index ecb09cb..f6fd49f 100644 --- a/src/forms/Bookmark/BookmarkPanel.h +++ b/src/forms/Bookmark/BookmarkPanel.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Aug 23 2015) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -57,9 +57,7 @@ class BookmarkPanel : public wxPanel virtual void onSearchText( wxCommandEvent& event ) { event.Skip(); } virtual void onClearSearch( wxCommandEvent& event ) { event.Skip(); } virtual void onTreeBeginDrag( wxTreeEvent& event ) { event.Skip(); } - virtual void onTreeBeginLabelEdit( wxTreeEvent& event ) { event.Skip(); } virtual void onTreeEndDrag( wxTreeEvent& event ) { event.Skip(); } - virtual void onTreeEndLabelEdit( wxTreeEvent& event ) { event.Skip(); } virtual void onTreeActivate( wxTreeEvent& event ) { event.Skip(); } virtual void onTreeCollapse( wxTreeEvent& event ) { event.Skip(); } virtual void onTreeExpanded( wxTreeEvent& event ) { event.Skip(); } diff --git a/src/forms/Bookmark/BookmarkView.cpp b/src/forms/Bookmark/BookmarkView.cpp index 1800cc0..fb73882 100644 --- a/src/forms/Bookmark/BookmarkView.cpp +++ b/src/forms/Bookmark/BookmarkView.cpp @@ -499,72 +499,6 @@ void BookmarkView::doUpdateActiveList() { } -void BookmarkView::onTreeBeginLabelEdit( wxTreeEvent& event ) { - TreeViewItem* tvi = dynamic_cast(m_treeView->GetItemData(event.GetItem())); - - //if edition do not work, m_treeView->GetEditControl() may be null... - if (!tvi || (m_treeView->GetEditControl() == NULL)) { - event.Veto(); - return; - } - - if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE || - tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT || - tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK || - tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP || - tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) - { - event.Allow(); - editingLabel = true; - } else { - event.Veto(); - } -} - - -void BookmarkView::onTreeEndLabelEdit( wxTreeEvent& event ) { - wxTreeItemId itm = event.GetItem(); - TreeViewItem* tvi = dynamic_cast(m_treeView->GetItemData(itm)); - - //if edition do not work, m_treeView->GetEditControl() may be null... - if (m_treeView->GetEditControl() == NULL) { - event.Veto(); - return; - } - - std::wstring newText = m_treeView->GetEditControl()->GetValue().ToStdWstring(); - - editingLabel = false; - - if (!tvi) { - return; - } - - if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) { - tvi->demod->setDemodulatorUserLabel(newText); - wxGetApp().getBookmarkMgr().updateActiveList(); - } else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) { - tvi->bookmarkEnt->label = newText; - tvi->bookmarkEnt->node->child("user_label")->element()->set(newText); - wxGetApp().getBookmarkMgr().updateActiveList(); - } else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) { - tvi->bookmarkEnt->label = newText; - tvi->bookmarkEnt->node->child("user_label")->element()->set(newText); - wxGetApp().getBookmarkMgr().updateBookmarks(); - } else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) { - std::string newGroup = m_treeView->GetEditControl()->GetValue().ToStdString(); - wxGetApp().getBookmarkMgr().renameGroup(tvi->groupName, newGroup); - wxGetApp().getBookmarkMgr().updateBookmarks(); - } else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) { - std::wstring newName = m_treeView->GetEditControl()->GetValue().ToStdWstring(); - if (newName.length() != 0) { - tvi->rangeEnt->label = newName; - wxGetApp().getBookmarkMgr().updateActiveList(); - } - } -} - - void BookmarkView::onTreeActivate( wxTreeEvent& event ) { wxTreeItemId itm = event.GetItem(); @@ -811,7 +745,7 @@ void BookmarkView::updateBookmarkChoices() { void BookmarkView::addBookmarkChoice(wxWindow *parent) { updateBookmarkChoices(); - bookmarkChoice = new wxChoice(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, bookmarkChoices, wxALL|wxEXPAND, wxDefaultValidator, "Bookmark"); + bookmarkChoice = new wxChoice(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, bookmarkChoices, wxEXPAND, wxDefaultValidator, "Bookmark"); bookmarkChoice->Connect( wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction)&BookmarkView::onBookmarkChoice, nullptr, this); parent->GetSizer()->Add(bookmarkChoice, 0, wxALL | wxEXPAND); } diff --git a/src/forms/Bookmark/BookmarkView.h b/src/forms/Bookmark/BookmarkView.h index 04d8e2b..dfe50d1 100644 --- a/src/forms/Bookmark/BookmarkView.h +++ b/src/forms/Bookmark/BookmarkView.h @@ -106,8 +106,6 @@ protected: //refresh / rebuild the whole tree item immediatly void doUpdateActiveList(); - void onTreeBeginLabelEdit( wxTreeEvent& event ); - void onTreeEndLabelEdit( wxTreeEvent& event ); void onTreeActivate( wxTreeEvent& event ); void onTreeCollapse( wxTreeEvent& event ); void onTreeExpanded( wxTreeEvent& event );