2016-09-13 22:59:21 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "BookmarkPanel.h"
|
2016-09-14 19:46:57 -04:00
|
|
|
#include "BookmarkMgr.h"
|
2016-11-20 23:26:38 -05:00
|
|
|
#include "wx/choice.h"
|
2016-09-14 19:46:57 -04:00
|
|
|
|
2016-10-10 22:28:48 -04:00
|
|
|
class TreeViewItem : public wxTreeItemData {
|
|
|
|
public:
|
|
|
|
enum TreeViewItemType {
|
|
|
|
TREEVIEW_ITEM_TYPE_GROUP,
|
|
|
|
TREEVIEW_ITEM_TYPE_ACTIVE,
|
|
|
|
TREEVIEW_ITEM_TYPE_RECENT,
|
|
|
|
TREEVIEW_ITEM_TYPE_BOOKMARK
|
|
|
|
};
|
|
|
|
|
|
|
|
TreeViewItem() {
|
|
|
|
bookmarkEnt = nullptr;
|
|
|
|
demod = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
TreeViewItemType type;
|
|
|
|
BookmarkEntry *bookmarkEnt;
|
|
|
|
DemodulatorInstance *demod;
|
|
|
|
std::string groupName;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-09-13 22:59:21 -04:00
|
|
|
class BookmarkView : public BookmarkPanel {
|
|
|
|
public:
|
|
|
|
BookmarkView( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1, -1 ), long style = wxTAB_TRAVERSAL );
|
|
|
|
|
|
|
|
void updateActiveList();
|
2016-10-06 22:27:12 -04:00
|
|
|
void updateBookmarks();
|
|
|
|
void updateBookmarks(std::string group);
|
2016-09-28 20:37:39 -04:00
|
|
|
void activeSelection(DemodulatorInstance *dsel);
|
2016-10-05 19:10:01 -04:00
|
|
|
void bookmarkSelection(BookmarkEntry *bmSel);
|
|
|
|
void activateBookmark(BookmarkEntry *bmEnt);
|
|
|
|
void recentSelection(BookmarkEntry *bmSel);
|
2016-11-10 20:43:01 -05:00
|
|
|
void groupSelection(std::string groupName);
|
|
|
|
void bookmarkBranchSelection();
|
|
|
|
void recentBranchSelection();
|
|
|
|
void activeBranchSelection();
|
|
|
|
|
2016-10-06 22:27:12 -04:00
|
|
|
wxTreeItemId refreshBookmarks();
|
2016-09-29 21:57:23 -04:00
|
|
|
void updateTheme();
|
2016-10-06 21:08:45 -04:00
|
|
|
void onMenuItem(wxCommandEvent& event);
|
2016-10-13 00:41:35 -04:00
|
|
|
bool isMouseInView();
|
|
|
|
|
2016-09-13 22:59:21 -04:00
|
|
|
|
|
|
|
protected:
|
2016-09-28 20:37:39 -04:00
|
|
|
|
|
|
|
void hideProps();
|
2016-11-14 23:16:08 -05:00
|
|
|
void showProps();
|
2016-09-28 20:37:39 -04:00
|
|
|
|
2016-09-14 22:49:32 -04:00
|
|
|
void onUpdateTimer( wxTimerEvent& event );
|
|
|
|
void doUpdateActiveList();
|
|
|
|
|
2016-09-13 22:59:21 -04:00
|
|
|
void onTreeBeginLabelEdit( wxTreeEvent& event );
|
|
|
|
void onTreeEndLabelEdit( wxTreeEvent& event );
|
|
|
|
void onTreeActivate( wxTreeEvent& event );
|
|
|
|
void onTreeCollapse( wxTreeEvent& event );
|
|
|
|
void onTreeExpanded( wxTreeEvent& event );
|
2016-10-06 21:08:45 -04:00
|
|
|
void onTreeItemMenu( wxTreeEvent& event );
|
2016-09-13 22:59:21 -04:00
|
|
|
void onTreeSelect( wxTreeEvent& event );
|
|
|
|
void onTreeSelectChanging( wxTreeEvent& event );
|
|
|
|
void onLabelText( wxCommandEvent& event );
|
2016-09-29 20:47:38 -04:00
|
|
|
void onDoubleClickFreq( wxMouseEvent& event );
|
|
|
|
void onDoubleClickBandwidth( wxMouseEvent& event );
|
2016-10-13 00:41:35 -04:00
|
|
|
void onTreeBeginDrag( wxTreeEvent& event );
|
|
|
|
void onTreeEndDrag( wxTreeEvent& event );
|
|
|
|
void onTreeDeleteItem( wxTreeEvent& event );
|
|
|
|
void onTreeItemGetTooltip( wxTreeEvent& event );
|
|
|
|
void onEnterWindow( wxMouseEvent& event );
|
|
|
|
void onLeaveWindow( wxMouseEvent& event );
|
|
|
|
|
2016-11-08 01:35:34 -05:00
|
|
|
|
|
|
|
void clearButtons();
|
|
|
|
void showButtons();
|
2016-11-14 23:16:08 -05:00
|
|
|
void refreshLayout();
|
2016-11-08 01:35:34 -05:00
|
|
|
|
|
|
|
wxButton *makeButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler);
|
|
|
|
wxButton *addButton(wxWindow *parent, std::string labelVal, wxObjectEventFunction handler);
|
|
|
|
|
2016-11-21 20:47:16 -05:00
|
|
|
void doBookmarkActive(std::string group, DemodulatorInstance *demod);
|
|
|
|
void doBookmarkRecent(std::string group, BookmarkEntry *be);
|
2016-11-25 22:19:19 -05:00
|
|
|
void doMoveBookmark(BookmarkEntry *be, std::string group);
|
|
|
|
|
2016-11-20 23:26:38 -05:00
|
|
|
void updateBookmarkChoices();
|
|
|
|
void addBookmarkChoice(wxWindow *parent);
|
|
|
|
void onBookmarkChoice( wxCommandEvent &event );
|
|
|
|
|
2016-11-08 01:35:34 -05:00
|
|
|
void onRemoveActive( wxCommandEvent& event );
|
|
|
|
void onRemoveBookmark( wxCommandEvent& event );
|
|
|
|
|
|
|
|
void onActivateBookmark( wxCommandEvent& event );
|
|
|
|
void onActivateRecent( wxCommandEvent& event );
|
|
|
|
|
2016-11-10 20:43:01 -05:00
|
|
|
void onAddGroup( wxCommandEvent& event );
|
|
|
|
void onRemoveGroup( wxCommandEvent& event );
|
|
|
|
void onRenameGroup( wxCommandEvent& event );
|
|
|
|
|
2016-11-08 01:35:34 -05:00
|
|
|
|
2016-10-13 00:41:35 -04:00
|
|
|
std::atomic_bool mouseInView;
|
2016-09-14 19:46:57 -04:00
|
|
|
|
2016-10-05 19:10:01 -04:00
|
|
|
wxTreeItemId rootBranch, activeBranch, bookmarkBranch, recentBranch;
|
2016-10-06 21:08:45 -04:00
|
|
|
|
2016-11-25 22:19:19 -05:00
|
|
|
std::map<std::string, bool> expandState;
|
|
|
|
|
2016-10-13 00:41:35 -04:00
|
|
|
TreeViewItem *dragItem;
|
|
|
|
wxTreeItemId dragItemId;
|
|
|
|
|
2016-10-06 21:08:45 -04:00
|
|
|
// Bookmarks
|
2016-10-06 22:27:12 -04:00
|
|
|
std::atomic_bool doUpdateBookmarks;
|
|
|
|
std::set< std::string > doUpdateBookmarkGroup;
|
2016-11-10 20:43:01 -05:00
|
|
|
std::string groupSel;
|
2016-10-06 21:08:45 -04:00
|
|
|
BookmarkNames groupNames;
|
2016-09-29 20:47:38 -04:00
|
|
|
std::map<std::string, wxTreeItemId> groups;
|
2016-10-06 21:08:45 -04:00
|
|
|
BookmarkEntry *bookmarkSel;
|
2016-11-20 23:26:38 -05:00
|
|
|
wxArrayString bookmarkChoices;
|
|
|
|
wxChoice *bookmarkChoice;
|
2016-10-06 22:27:12 -04:00
|
|
|
|
2016-10-06 21:08:45 -04:00
|
|
|
// Active
|
2016-10-06 22:27:12 -04:00
|
|
|
std::atomic_bool doUpdateActive;
|
2016-09-28 20:37:39 -04:00
|
|
|
DemodulatorInstance *activeSel;
|
2016-10-06 21:08:45 -04:00
|
|
|
|
|
|
|
// Recent
|
2016-10-10 22:28:48 -04:00
|
|
|
BookmarkEntry *recentSel;
|
|
|
|
};
|