diff --git a/src/AppFrame.cpp b/src/AppFrame.cpp index d7713c8..f9291ca 100644 --- a/src/AppFrame.cpp +++ b/src/AppFrame.cpp @@ -28,6 +28,7 @@ #include #include +#include #ifdef __linux__ #include "CubicSDR.xpm" @@ -97,7 +98,7 @@ AppFrame::AppFrame() : #endif gainCanvas = new GainCanvas(demodPanel, attribList); - + gainCanvas->setHelpTip("Tuner gains in dB. Click / use Mousewheel to change."); gainSizerItem = demodTray->Add(gainCanvas, 0, wxEXPAND | wxALL, 0); gainSizerItem->Show(false); gainSpacerItem = demodTray->AddSpacer(1); @@ -181,8 +182,7 @@ AppFrame::AppFrame() : wxGetApp().getDemodSpectrumProcessor()->attachOutput(demodWaterfallCanvas->getVisualDataQueue()); demodWaterfallCanvas->getVisualDataQueue()->set_max_num_items(3); demodWaterfallCanvas->setLinesPerSecond((int)(DEFAULT_DEMOD_WATERFALL_LINES_NB / DEMOD_WATERFALL_DURATION_IN_SECONDS)); - - + demodVisuals->SetMinSize(wxSize(128,-1)); demodTray->Add(demodVisuals, 30, wxEXPAND | wxALL, 0); @@ -2568,3 +2568,25 @@ std::vector str_explode(const std::string &seperator, const std::st return vect_out; } + +void AppFrame::setStatusText(wxWindow* window, std::string statusText) { + GetStatusBar()->SetStatusText(statusText); + if (wxGetApp().getConfig()->getShowTips()) { + if (statusText != lastToolTip) { + wxToolTip::Enable(false); + window->SetToolTip(statusText); + lastToolTip = statusText; + wxToolTip::SetDelay(1000); + wxToolTip::Enable(true); + } + } + else { + window->SetToolTip(""); + lastToolTip = ""; + } +} + +void AppFrame::setStatusText(std::string statusText, int value) { + GetStatusBar()->SetStatusText( + wxString::Format(statusText.c_str(), wxNumberFormatter::ToString((long)value, wxNumberFormatter::Style_WithThousandsSep))); +} diff --git a/src/AppFrame.h b/src/AppFrame.h index d829be7..7ebb29e 100644 --- a/src/AppFrame.h +++ b/src/AppFrame.h @@ -129,6 +129,9 @@ public: #ifdef _WIN32 bool canFocus(); #endif + //set tooltip to window + void setStatusText(wxWindow* window, std::string statusText); + void AppFrame::setStatusText(std::string statusText, int value); private: void OnMenu(wxCommandEvent& event); @@ -215,6 +218,8 @@ private: AboutDialog *aboutDlg; + std::string lastToolTip; + #ifdef USE_HAMLIB void enableRig(); void disableRig(); diff --git a/src/forms/Bookmark/BookmarkPanel.cpp b/src/forms/Bookmark/BookmarkPanel.cpp index 8e0d6f1..de539f4 100644 --- a/src/forms/Bookmark/BookmarkPanel.cpp +++ b/src/forms/Bookmark/BookmarkPanel.cpp @@ -89,7 +89,12 @@ 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 ); - m_treeView->Connect( wxEVT_MOTION, wxMouseEventHandler( BookmarkPanel::onMotion ), 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_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 ); diff --git a/src/forms/Bookmark/BookmarkView.cpp b/src/forms/Bookmark/BookmarkView.cpp index 0c7b854..a13bb69 100644 --- a/src/forms/Bookmark/BookmarkView.cpp +++ b/src/forms/Bookmark/BookmarkView.cpp @@ -1429,10 +1429,12 @@ void BookmarkView::onEnterWindow( wxMouseEvent& event ) { #ifdef _WIN32 if (wxGetApp().getAppFrame()->canFocus()) { - this->SetFocus(); + //make mousewheel work in the tree view. + m_treeView->SetFocus(); } #endif + setStatusText("You can mouse-drag a bookmark entry from one category to the next..etc. TODO: add more Bookmarks descriptions"); } @@ -1450,10 +1452,15 @@ void BookmarkView::onMotion( wxMouseEvent& event ) { if (visualDragItem != nullptr) { visualDragItem->SetPosition(pos); } - + event.Skip(); } +void BookmarkView::setStatusText(std::string statusText) { + //make tooltips active on the tree view. + wxGetApp().getAppFrame()->setStatusText(m_treeView, statusText); +} + TreeViewItem *BookmarkView::itemToTVI(wxTreeItemId item) { TreeViewItem* tvi = nullptr; diff --git a/src/forms/Bookmark/BookmarkView.h b/src/forms/Bookmark/BookmarkView.h index 78c6fe9..0dbdeb2 100644 --- a/src/forms/Bookmark/BookmarkView.h +++ b/src/forms/Bookmark/BookmarkView.h @@ -138,8 +138,7 @@ protected: void onRenameRange( wxCommandEvent& event ); void onActivateRange( wxCommandEvent& event ); void onUpdateRange( wxCommandEvent& event ); - - + TreeViewItem *itemToTVI(wxTreeItemId item); MouseTracker mouseTracker; @@ -172,4 +171,6 @@ protected: // Search std::vector searchKeywords; + + void setStatusText(std::string statusText); }; diff --git a/src/visual/GainCanvas.cpp b/src/visual/GainCanvas.cpp index 56661de..a5c0b56 100644 --- a/src/visual/GainCanvas.cpp +++ b/src/visual/GainCanvas.cpp @@ -113,6 +113,11 @@ void GainCanvas::OnMouseMoved(wxMouseEvent& event) { if (mouseTracker.mouseDown()) { SetLevel(); } + else { + if (!helpTip.empty()) { + setStatusText(helpTip); + } + } } void GainCanvas::OnMouseDown(wxMouseEvent& event) { diff --git a/src/visual/InteractiveCanvas.cpp b/src/visual/InteractiveCanvas.cpp index b18a3ec..cfb9e85 100644 --- a/src/visual/InteractiveCanvas.cpp +++ b/src/visual/InteractiveCanvas.cpp @@ -159,24 +159,13 @@ void InteractiveCanvas::OnMouseEnterWindow(wxMouseEvent& event) { } void InteractiveCanvas::setStatusText(std::string statusText) { - wxGetApp().getAppFrame()->GetStatusBar()->SetStatusText(statusText); - if (wxGetApp().getConfig()->getShowTips()) { - if (statusText != lastToolTip) { - wxToolTip::Enable(false); - this->SetToolTip(statusText); - lastToolTip = statusText; - wxToolTip::SetDelay(1000); - wxToolTip::Enable(true); - } - } else { - this->SetToolTip(""); - lastToolTip = ""; - } + + wxGetApp().getAppFrame()->setStatusText(this, statusText); } void InteractiveCanvas::setStatusText(std::string statusText, int value) { - wxGetApp().getAppFrame()->GetStatusBar()->SetStatusText( - wxString::Format(statusText.c_str(), wxNumberFormatter::ToString((long) value, wxNumberFormatter::Style_WithThousandsSep))); + + wxGetApp().getAppFrame()->setStatusText(statusText, value); } void InteractiveCanvas::OnMouseRightDown(wxMouseEvent& event) { diff --git a/src/visual/InteractiveCanvas.h b/src/visual/InteractiveCanvas.h index c255720..3ffb173 100644 --- a/src/visual/InteractiveCanvas.h +++ b/src/visual/InteractiveCanvas.h @@ -64,6 +64,5 @@ protected: long long lastBandwidth; bool isView; - std::string lastToolTip; };