Skip to content

Commit

Permalink
Fix #635 Round 2 for Bookmarkview on Windows, should be OK now
Browse files Browse the repository at this point in the history
  • Loading branch information
vsonnier committed Mar 24, 2018
1 parent 120d394 commit 00a864f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 29 deletions.
12 changes: 6 additions & 6 deletions src/AppFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2973,24 +2973,24 @@ void AppFrame::toggleAllActiveDemodRecording() {

auto activeDemods = wxGetApp().getDemodMgr().getDemodulators();

//by default, do a false => true for all:
bool stateToSet = true;

for (auto i : activeDemods) {
if (i->isActive() && i->isRecording()) {
if (i->isRecording()) {
stateToSet = false;
break;
}
}

for (auto i : activeDemods) {
if (i->isActive() && i->isRecording() != stateToSet) {
i->setRecording(stateToSet);
}

i->setRecording(stateToSet);
}
//this effectively refresh the BookmarkView buttons, including Recording buttons.
wxGetApp().getBookmarkMgr().updateActiveList();
}



void AppFrame::setWaterfallLinesPerSecond(int lps) {
waterfallSpeedMeter->setUserInputValue(sqrt(lps));
}
Expand Down
4 changes: 2 additions & 2 deletions src/demod/DemodulatorInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,10 @@ bool DemodulatorInstance::isRecording()

void DemodulatorInstance::setRecording(bool recording_in)
{
if (!recording.load() && recording_in) {
if (recording_in) {
startRecording();
}
else if (recording.load() && !recording_in) {
else {
stopRecording();
}
}
Expand Down
34 changes: 15 additions & 19 deletions src/forms/Bookmark/BookmarkView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void BookmarkView::onUpdateTimer( wxTimerEvent& /* event */ ) {
}
}

bool BookmarkView::skipUserEvents() {
bool BookmarkView::skipEvents() {

return !this->IsShown() || doUpdateActive || doUpdateBookmarks;
}
Expand Down Expand Up @@ -511,6 +511,9 @@ void BookmarkView::doUpdateActiveList() {
m_treeView->SelectItem(selItem);
}

// Add an extra refresh, that rebuilds the buttons from sratch.
activeSelection(lastActiveDemodulator);

delete prevSelCopy;
}

Expand Down Expand Up @@ -543,10 +546,6 @@ void BookmarkView::onTreeActivate( wxTreeEvent& event ) {

void BookmarkView::onTreeCollapse( wxTreeEvent& event ) {

if (skipUserEvents()) {
return;
}

bool searchState = (searchKeywords.size() != 0);

if (searchState) {
Expand Down Expand Up @@ -577,10 +576,6 @@ void BookmarkView::onTreeCollapse( wxTreeEvent& event ) {

void BookmarkView::onTreeExpanded( wxTreeEvent& event ) {

if (skipUserEvents()) {
return;
}

bool searchState = (searchKeywords.size() != 0);

if (searchState) {
Expand Down Expand Up @@ -816,9 +811,12 @@ void BookmarkView::onBookmarkChoice( wxCommandEvent & /* event */ ) {
}
}


void BookmarkView::activeSelection(DemodulatorInstancePtr dsel) {


if (dsel == nullptr) {
return;
}

m_frequencyVal->SetLabelText(frequencyToStr(dsel->getFrequency()));
m_bandwidthVal->SetLabelText(frequencyToStr(dsel->getBandwidth()));
m_modulationVal->SetLabelText(dsel->getDemodulatorType());
Expand Down Expand Up @@ -1074,6 +1072,10 @@ void BookmarkView::activeBranchSelection() {

void BookmarkView::onTreeSelect( wxTreeEvent& event ) {

if (skipEvents()) {
return;
}

wxTreeItemId itm = event.GetItem();
TreeViewItem* tvi = dynamic_cast<TreeViewItem*>(m_treeView->GetItemData(itm));

Expand Down Expand Up @@ -1119,10 +1121,6 @@ void BookmarkView::onTreeSelect( wxTreeEvent& event ) {

void BookmarkView::onTreeSelectChanging( wxTreeEvent& event ) {

if (skipUserEvents()) {
return;
}

event.Skip();
}

Expand Down Expand Up @@ -1203,6 +1201,7 @@ void BookmarkView::onStartRecording( wxCommandEvent& /* event */ ) {
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
if (!curSel->demod->isRecording() && wxGetApp().getConfig()->verifyRecordingPath()) {
curSel->demod->setRecording(true);

wxGetApp().getBookmarkMgr().updateActiveList();
}
}
Expand All @@ -1216,6 +1215,7 @@ void BookmarkView::onStopRecording( wxCommandEvent& /* event */ ) {
if (curSel && curSel->type == TreeViewItem::TREEVIEW_ITEM_TYPE_ACTIVE) {
if (curSel->demod->isRecording()) {
curSel->demod->setRecording(false);

wxGetApp().getBookmarkMgr().updateActiveList();
}
}
Expand Down Expand Up @@ -1481,10 +1481,6 @@ void BookmarkView::onTreeEndDrag( wxTreeEvent& event ) {


void BookmarkView::onTreeItemGetTooltip( wxTreeEvent& event ) {

if (skipUserEvents()) {
return;
}

event.Skip();
}
Expand Down
5 changes: 3 additions & 2 deletions src/forms/Bookmark/BookmarkView.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ class BookmarkView : public BookmarkPanel {
void onActivateRange( wxCommandEvent& event );
void onUpdateRange( wxCommandEvent& event );

bool skipUserEvents();

bool skipEvents();
TreeViewItem *itemToTVI(wxTreeItemId item);

void SetTreeItemData(const wxTreeItemId& item, wxTreeItemData *data);
Expand Down Expand Up @@ -201,4 +201,5 @@ class BookmarkView : public BookmarkPanel {
std::vector<std::wstring> searchKeywords;

void setStatusText(std::string statusText);

};

0 comments on commit 00a864f

Please sign in to comment.