mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-02-21 04:58:39 -05:00
Selection and button handlers
This commit is contained in:
parent
b89b557352
commit
d4fb63cb77
@ -243,11 +243,7 @@ void BookmarkView::onTreeItemMenu( wxTreeEvent& event ) {
|
|||||||
|
|
||||||
void BookmarkView::onMenuItem(wxCommandEvent& event) {
|
void BookmarkView::onMenuItem(wxCommandEvent& event) {
|
||||||
if (event.GetId() == wxCONTEXT_ADD_GROUP_ID) {
|
if (event.GetId() == wxCONTEXT_ADD_GROUP_ID) {
|
||||||
wxString stringVal = wxGetTextFromUser("Enter Group Name", "Add Group", "");
|
onAddGroup(event);
|
||||||
if (stringVal.ToStdString() != "") {
|
|
||||||
wxGetApp().getBookmarkMgr().getGroup(stringVal.ToStdString());
|
|
||||||
wxGetApp().getBookmarkMgr().updateBookmarks();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,14 +413,74 @@ void BookmarkView::recentSelection(BookmarkEntry *bmSel) {
|
|||||||
this->Layout();
|
this->Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BookmarkView::groupSelection(std::string groupName) {
|
||||||
|
recentSel = nullptr;
|
||||||
|
activeSel = nullptr;
|
||||||
|
bookmarkSel = nullptr;
|
||||||
|
groupSel = groupName;
|
||||||
|
|
||||||
void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
|
clearButtons();
|
||||||
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(event.GetItem()));
|
|
||||||
|
|
||||||
if (!tvi) {
|
hideProps();
|
||||||
|
|
||||||
|
addButton(m_buttonPanel, "Remove Group", wxCommandEventHandler( BookmarkView::onRemoveGroup ));
|
||||||
|
addButton(m_buttonPanel, "Rename Group", wxCommandEventHandler( BookmarkView::onRenameGroup ));
|
||||||
|
|
||||||
|
showButtons();
|
||||||
|
|
||||||
|
this->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BookmarkView::bookmarkBranchSelection() {
|
||||||
|
recentSel = nullptr;
|
||||||
|
activeSel = nullptr;
|
||||||
|
bookmarkSel = nullptr;
|
||||||
|
|
||||||
|
clearButtons();
|
||||||
|
|
||||||
|
hideProps();
|
||||||
|
|
||||||
|
addButton(m_buttonPanel, "Add Group", wxCommandEventHandler( BookmarkView::onAddGroup ));
|
||||||
|
|
||||||
|
showButtons();
|
||||||
|
|
||||||
|
this->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BookmarkView::recentBranchSelection() {
|
||||||
m_propPanel->Hide();
|
m_propPanel->Hide();
|
||||||
hideProps();
|
hideProps();
|
||||||
this->Layout();
|
this->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BookmarkView::activeBranchSelection() {
|
||||||
|
m_propPanel->Hide();
|
||||||
|
hideProps();
|
||||||
|
this->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
|
||||||
|
wxTreeItemId itm = event.GetItem();
|
||||||
|
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(itm));
|
||||||
|
|
||||||
|
if (!tvi) {
|
||||||
|
|
||||||
|
if (itm == bookmarkBranch) {
|
||||||
|
|
||||||
|
} else if (itm == activeBranch) {
|
||||||
|
|
||||||
|
} else if (itm == recentBranch) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
m_propPanel->Hide();
|
||||||
|
hideProps();
|
||||||
|
this->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,6 +494,9 @@ void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
|
|||||||
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
|
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
|
||||||
m_propPanel->Show();
|
m_propPanel->Show();
|
||||||
bookmarkSelection(tvi->bookmarkEnt);
|
bookmarkSelection(tvi->bookmarkEnt);
|
||||||
|
} else if (tvi->type == TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
|
||||||
|
m_propPanel->Show();
|
||||||
|
groupSelection(tvi->groupName);
|
||||||
} else {
|
} else {
|
||||||
m_propPanel->Hide();
|
m_propPanel->Hide();
|
||||||
hideProps();
|
hideProps();
|
||||||
@ -516,6 +575,25 @@ void BookmarkView::onActivateRecent( wxCommandEvent& event ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BookmarkView::onAddGroup( wxCommandEvent& event ) {
|
||||||
|
wxString stringVal = wxGetTextFromUser("Enter Group Name", "Add Group", "");
|
||||||
|
if (stringVal.ToStdString() != "") {
|
||||||
|
wxGetApp().getBookmarkMgr().getGroup(stringVal.ToStdString());
|
||||||
|
wxGetApp().getBookmarkMgr().updateBookmarks();
|
||||||
|
groupSel = stringVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BookmarkView::onRemoveGroup( wxCommandEvent& event ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BookmarkView::onRenameGroup( wxCommandEvent& event ) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void BookmarkView::onTreeBeginDrag( wxTreeEvent& event ) {
|
void BookmarkView::onTreeBeginDrag( wxTreeEvent& event ) {
|
||||||
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(event.GetItem()));
|
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(event.GetItem()));
|
||||||
|
|
||||||
|
@ -36,6 +36,11 @@ public:
|
|||||||
void bookmarkSelection(BookmarkEntry *bmSel);
|
void bookmarkSelection(BookmarkEntry *bmSel);
|
||||||
void activateBookmark(BookmarkEntry *bmEnt);
|
void activateBookmark(BookmarkEntry *bmEnt);
|
||||||
void recentSelection(BookmarkEntry *bmSel);
|
void recentSelection(BookmarkEntry *bmSel);
|
||||||
|
void groupSelection(std::string groupName);
|
||||||
|
void bookmarkBranchSelection();
|
||||||
|
void recentBranchSelection();
|
||||||
|
void activeBranchSelection();
|
||||||
|
|
||||||
wxTreeItemId refreshBookmarks();
|
wxTreeItemId refreshBookmarks();
|
||||||
void updateTheme();
|
void updateTheme();
|
||||||
void onMenuItem(wxCommandEvent& event);
|
void onMenuItem(wxCommandEvent& event);
|
||||||
@ -83,6 +88,10 @@ protected:
|
|||||||
void onActivateBookmark( wxCommandEvent& event );
|
void onActivateBookmark( wxCommandEvent& event );
|
||||||
void onActivateRecent( wxCommandEvent& event );
|
void onActivateRecent( wxCommandEvent& event );
|
||||||
|
|
||||||
|
void onAddGroup( wxCommandEvent& event );
|
||||||
|
void onRemoveGroup( wxCommandEvent& event );
|
||||||
|
void onRenameGroup( wxCommandEvent& event );
|
||||||
|
|
||||||
|
|
||||||
std::atomic_bool mouseInView;
|
std::atomic_bool mouseInView;
|
||||||
|
|
||||||
@ -94,6 +103,7 @@ protected:
|
|||||||
// Bookmarks
|
// Bookmarks
|
||||||
std::atomic_bool doUpdateBookmarks;
|
std::atomic_bool doUpdateBookmarks;
|
||||||
std::set< std::string > doUpdateBookmarkGroup;
|
std::set< std::string > doUpdateBookmarkGroup;
|
||||||
|
std::string groupSel;
|
||||||
BookmarkNames groupNames;
|
BookmarkNames groupNames;
|
||||||
std::map<std::string, wxTreeItemId> groups;
|
std::map<std::string, wxTreeItemId> groups;
|
||||||
BookmarkEntry *bookmarkSel;
|
BookmarkEntry *bookmarkSel;
|
||||||
|
Loading…
Reference in New Issue
Block a user