Fixes for #635, round 1: BookmarkView

This commit is contained in:
vsonnier 2018-03-20 20:00:59 +01:00
parent 876b477ae8
commit 225a795f31
2 changed files with 14 additions and 122 deletions

View File

@ -113,7 +113,7 @@ public:
DemodulatorThreadOutputQueuePtr getAudioVisualQueue();
DemodulatorThreadInputQueuePtr getIQVisualQueue();
DemodulatorThreadInputQueuePtr getWaterfallVisualQueue();
DemodulatorThreadInputQueuePtr getActiveDemodVisualQueue();
DemodulatorMgr &getDemodMgr();
BookmarkMgr &getBookmarkMgr();

View File

@ -186,7 +186,7 @@ void BookmarkView::onUpdateTimer( wxTimerEvent& /* event */ ) {
if (bmSel) {
m_treeView->SelectItem(bmSel);
}
doUpdateBookmarks.store(false);
doUpdateBookmarks.store(false);
}
}
@ -517,10 +517,6 @@ void BookmarkView::doUpdateActiveList() {
void BookmarkView::onTreeActivate( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
wxTreeItemId itm = event.GetItem();
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(itm));
@ -615,10 +611,6 @@ void BookmarkView::onTreeExpanded( wxTreeEvent& event ) {
void BookmarkView::onTreeItemMenu( wxTreeEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (m_treeView->GetSelection() == bookmarkBranch) {
wxMenu menu;
menu.Append(wxCONTEXT_ADD_GROUP_ID, BOOKMARK_VIEW_STR_ADD_GROUP);
@ -630,10 +622,6 @@ void BookmarkView::onTreeItemMenu( wxTreeEvent& /* event */ ) {
void BookmarkView::onMenuItem(wxCommandEvent& event) {
if (skipUserEvents()) {
return;
}
if (event.GetId() == wxCONTEXT_ADD_GROUP_ID) {
onAddGroup(event);
}
@ -711,10 +699,13 @@ wxButton *BookmarkView::makeButton(wxWindow *parent, std::string labelVal, wxObj
nButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, handler, nullptr, this);
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
wxColour textColor(ThemeMgr::mgr.currentTheme->text);
// wxColour fgColor(ThemeMgr::mgr.currentTheme->button);
//Force white color:
wxColour textColorWhite(RGBA4f(255,255,255));
nButton->SetBackgroundColour(bgColor);
nButton->SetForegroundColour(textColor);
nButton->SetForegroundColour(textColorWhite);
return nButton;
}
@ -790,11 +781,7 @@ void BookmarkView::addBookmarkChoice(wxWindow *parent) {
void BookmarkView::onBookmarkChoice( wxCommandEvent & /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *tvi = itemToTVI(m_treeView->GetSelection());
int numSel = bookmarkChoice->GetCount();
@ -855,15 +842,16 @@ void BookmarkView::activeSelection(DemodulatorInstancePtr dsel) {
addBookmarkChoice(m_buttonPanel);
if (dsel->isActive() && !(dsel->isRecording())) {
addButton(m_buttonPanel, "Start Recording", wxCommandEventHandler( BookmarkView::onStartRecording ));
} else {
addButton(m_buttonPanel, "Stop Recording", wxCommandEventHandler( BookmarkView::onStopRecording ));
if (dsel->isActive()) {
if (!(dsel->isRecording())) {
addButton(m_buttonPanel, "Start Recording", wxCommandEventHandler(BookmarkView::onStartRecording));
} else {
addButton(m_buttonPanel, "Stop Recording", wxCommandEventHandler(BookmarkView::onStopRecording));
}
}
addButton(m_buttonPanel, "Remove Active", wxCommandEventHandler( BookmarkView::onRemoveActive ));
showProps();
showButtons();
refreshLayout();
@ -1086,10 +1074,6 @@ void BookmarkView::activeBranchSelection() {
void BookmarkView::onTreeSelect( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
wxTreeItemId itm = event.GetItem();
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(itm));
@ -1145,10 +1129,6 @@ void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) {
void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
std::wstring newLabel = m_labelText->GetValue().ToStdWstring();
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
@ -1182,10 +1162,6 @@ void BookmarkView::onLabelText( wxCommandEvent& /* event */ ) {
void BookmarkView::onDoubleClickFreq( wxMouseEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1198,10 +1174,6 @@ void BookmarkView::onDoubleClickFreq( wxMouseEvent& /* event */ ) {
void BookmarkView::onDoubleClickBandwidth( wxMouseEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1214,10 +1186,6 @@ void BookmarkView::onDoubleClickBandwidth( wxMouseEvent& /* event */ ) {
void BookmarkView::onRemoveActive( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1230,10 +1198,6 @@ void BookmarkView::onRemoveActive( wxCommandEvent& /* event */ ) {
void BookmarkView::onStartRecording( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1247,10 +1211,6 @@ void BookmarkView::onStartRecording( wxCommandEvent& /* event */ ) {
void BookmarkView::onStopRecording( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
@ -1265,10 +1225,6 @@ void BookmarkView::onStopRecording( wxCommandEvent& /* event */ ) {
void BookmarkView::onRemoveBookmark( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) {
return;
}
@ -1283,10 +1239,6 @@ void BookmarkView::onRemoveBookmark( wxCommandEvent& /* event */ ) {
void BookmarkView::onActivateBookmark( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_BOOKMARK) {
@ -1297,10 +1249,6 @@ void BookmarkView::onActivateBookmark( wxCommandEvent& /* event */ ) {
void BookmarkView::onActivateRecent( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RECENT) {
@ -1317,10 +1265,6 @@ void BookmarkView::onActivateRecent( wxCommandEvent& /* event */ ) {
void BookmarkView::onRemoveRecent ( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) {
return;
}
@ -1339,10 +1283,6 @@ void BookmarkView::onRemoveRecent ( wxCommandEvent& /* event */ ) {
void BookmarkView::onClearRecents ( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) {
return;
}
@ -1352,10 +1292,6 @@ void BookmarkView::onClearRecents ( wxCommandEvent& /* event */ ) {
void BookmarkView::onAddGroup( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
wxString stringVal = wxGetTextFromUser(BOOKMARK_VIEW_STR_ADD_GROUP_DESC, BOOKMARK_VIEW_STR_ADD_GROUP, "");
if (stringVal.ToStdString() != "") {
wxGetApp().getBookmarkMgr().addGroup(stringVal.ToStdString());
@ -1366,10 +1302,6 @@ void BookmarkView::onAddGroup( wxCommandEvent& /* event */ ) {
void BookmarkView::onRemoveGroup( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) {
return;
}
@ -1383,10 +1315,6 @@ void BookmarkView::onRemoveGroup( wxCommandEvent& /* event */ ) {
void BookmarkView::onAddRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
BookmarkRangeEntryPtr re = BookmarkView::makeActiveRangeEntry();
@ -1399,10 +1327,6 @@ void BookmarkView::onAddRange( wxCommandEvent& /* event */ ) {
void BookmarkView::onRemoveRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
if (editingLabel) {
return;
}
@ -1417,10 +1341,6 @@ void BookmarkView::onRemoveRange( wxCommandEvent& /* event */ ) {
void BookmarkView::onRenameRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (!curSel || curSel->type != TreeViewItem::TREEVIEW_ITEM_TYPE_GROUP) {
@ -1440,10 +1360,6 @@ void BookmarkView::onRenameRange( wxCommandEvent& /* event */ ) {
void BookmarkView::onActivateRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) {
@ -1453,10 +1369,6 @@ void BookmarkView::onActivateRange( wxCommandEvent& /* event */ ) {
void BookmarkView::onUpdateRange( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
TreeViewItem *curSel = itemToTVI(m_treeView->GetSelection());
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_RANGE) {
@ -1466,10 +1378,6 @@ void BookmarkView::onUpdateRange( wxCommandEvent& /* event */ ) {
void BookmarkView::onTreeBeginDrag( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(event.GetItem()));
dragItem = nullptr;
@ -1514,10 +1422,6 @@ void BookmarkView::onTreeBeginDrag( wxTreeEvent& event ) {
void BookmarkView::onTreeEndDrag( wxTreeEvent& event ) {
if (skipUserEvents()) {
return;
}
wxColour bgColor(ThemeMgr::mgr.currentTheme->generalBackground);
wxColour textColor(ThemeMgr::mgr.currentTheme->text);
@ -1635,10 +1539,6 @@ TreeViewItem *BookmarkView::itemToTVI(wxTreeItemId item) {
void BookmarkView::onSearchTextFocus( wxMouseEvent& event ) {
if (skipUserEvents()) {
return;
}
mouseTracker.OnMouseMoved(event);
//apparently needed ???
@ -1664,10 +1564,6 @@ void BookmarkView::onSearchTextFocus( wxMouseEvent& event ) {
void BookmarkView::onSearchText( wxCommandEvent& event ) {
if (skipUserEvents()) {
return;
}
std::wstring searchText = m_searchText->GetValue().Trim().Lower().ToStdWstring();
searchKeywords.clear();
@ -1699,10 +1595,6 @@ void BookmarkView::onSearchText( wxCommandEvent& event ) {
void BookmarkView::onClearSearch( wxCommandEvent& /* event */ ) {
if (skipUserEvents()) {
return;
}
m_clearSearchButton->Hide();
m_searchText->SetValue(L"Search..");
m_treeView->SetFocus();