mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-27 06:08:37 -05:00
Status/tootips additions: Gain, Bookmarks. Fix Bookmark mousewheel handling (for Windows <= 7) for the tree view
This commit is contained in:
parent
b149da864a
commit
2760d3d12e
@ -28,6 +28,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include <wx/panel.h>
|
#include <wx/panel.h>
|
||||||
|
#include <wx/numformatter.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include "CubicSDR.xpm"
|
#include "CubicSDR.xpm"
|
||||||
@ -97,7 +98,7 @@ AppFrame::AppFrame() :
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
gainCanvas = new GainCanvas(demodPanel, attribList);
|
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 = demodTray->Add(gainCanvas, 0, wxEXPAND | wxALL, 0);
|
||||||
gainSizerItem->Show(false);
|
gainSizerItem->Show(false);
|
||||||
gainSpacerItem = demodTray->AddSpacer(1);
|
gainSpacerItem = demodTray->AddSpacer(1);
|
||||||
@ -181,8 +182,7 @@ AppFrame::AppFrame() :
|
|||||||
wxGetApp().getDemodSpectrumProcessor()->attachOutput(demodWaterfallCanvas->getVisualDataQueue());
|
wxGetApp().getDemodSpectrumProcessor()->attachOutput(demodWaterfallCanvas->getVisualDataQueue());
|
||||||
demodWaterfallCanvas->getVisualDataQueue()->set_max_num_items(3);
|
demodWaterfallCanvas->getVisualDataQueue()->set_max_num_items(3);
|
||||||
demodWaterfallCanvas->setLinesPerSecond((int)(DEFAULT_DEMOD_WATERFALL_LINES_NB / DEMOD_WATERFALL_DURATION_IN_SECONDS));
|
demodWaterfallCanvas->setLinesPerSecond((int)(DEFAULT_DEMOD_WATERFALL_LINES_NB / DEMOD_WATERFALL_DURATION_IN_SECONDS));
|
||||||
|
|
||||||
|
|
||||||
demodVisuals->SetMinSize(wxSize(128,-1));
|
demodVisuals->SetMinSize(wxSize(128,-1));
|
||||||
|
|
||||||
demodTray->Add(demodVisuals, 30, wxEXPAND | wxALL, 0);
|
demodTray->Add(demodVisuals, 30, wxEXPAND | wxALL, 0);
|
||||||
@ -2568,3 +2568,25 @@ std::vector<std::string> str_explode(const std::string &seperator, const std::st
|
|||||||
|
|
||||||
return vect_out;
|
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)));
|
||||||
|
}
|
||||||
|
@ -129,6 +129,9 @@ public:
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool canFocus();
|
bool canFocus();
|
||||||
#endif
|
#endif
|
||||||
|
//set tooltip to window
|
||||||
|
void setStatusText(wxWindow* window, std::string statusText);
|
||||||
|
void AppFrame::setStatusText(std::string statusText, int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnMenu(wxCommandEvent& event);
|
void OnMenu(wxCommandEvent& event);
|
||||||
@ -215,6 +218,8 @@ private:
|
|||||||
|
|
||||||
AboutDialog *aboutDlg;
|
AboutDialog *aboutDlg;
|
||||||
|
|
||||||
|
std::string lastToolTip;
|
||||||
|
|
||||||
#ifdef USE_HAMLIB
|
#ifdef USE_HAMLIB
|
||||||
void enableRig();
|
void enableRig();
|
||||||
void disableRig();
|
void disableRig();
|
||||||
|
@ -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_LEFT_DOWN, wxMouseEventHandler( BookmarkPanel::onSearchTextFocus ), NULL, this );
|
||||||
m_searchText->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( BookmarkPanel::onSearchText ), 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_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_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_BEGIN_LABEL_EDIT, wxTreeEventHandler( BookmarkPanel::onTreeBeginLabelEdit ), NULL, this );
|
||||||
m_treeView->Connect( wxEVT_COMMAND_TREE_END_DRAG, wxTreeEventHandler( BookmarkPanel::onTreeEndDrag ), NULL, this );
|
m_treeView->Connect( wxEVT_COMMAND_TREE_END_DRAG, wxTreeEventHandler( BookmarkPanel::onTreeEndDrag ), NULL, this );
|
||||||
|
@ -1429,10 +1429,12 @@ void BookmarkView::onEnterWindow( wxMouseEvent& event ) {
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (wxGetApp().getAppFrame()->canFocus()) {
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
this->SetFocus();
|
//make mousewheel work in the tree view.
|
||||||
|
m_treeView->SetFocus();
|
||||||
}
|
}
|
||||||
#endif
|
#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) {
|
if (visualDragItem != nullptr) {
|
||||||
visualDragItem->SetPosition(pos);
|
visualDragItem->SetPosition(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
event.Skip();
|
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 *BookmarkView::itemToTVI(wxTreeItemId item) {
|
||||||
TreeViewItem* tvi = nullptr;
|
TreeViewItem* tvi = nullptr;
|
||||||
|
|
||||||
|
@ -138,8 +138,7 @@ protected:
|
|||||||
void onRenameRange( wxCommandEvent& event );
|
void onRenameRange( wxCommandEvent& event );
|
||||||
void onActivateRange( wxCommandEvent& event );
|
void onActivateRange( wxCommandEvent& event );
|
||||||
void onUpdateRange( wxCommandEvent& event );
|
void onUpdateRange( wxCommandEvent& event );
|
||||||
|
|
||||||
|
|
||||||
TreeViewItem *itemToTVI(wxTreeItemId item);
|
TreeViewItem *itemToTVI(wxTreeItemId item);
|
||||||
|
|
||||||
MouseTracker mouseTracker;
|
MouseTracker mouseTracker;
|
||||||
@ -172,4 +171,6 @@ protected:
|
|||||||
|
|
||||||
// Search
|
// Search
|
||||||
std::vector<std::wstring> searchKeywords;
|
std::vector<std::wstring> searchKeywords;
|
||||||
|
|
||||||
|
void setStatusText(std::string statusText);
|
||||||
};
|
};
|
||||||
|
@ -113,6 +113,11 @@ void GainCanvas::OnMouseMoved(wxMouseEvent& event) {
|
|||||||
if (mouseTracker.mouseDown()) {
|
if (mouseTracker.mouseDown()) {
|
||||||
SetLevel();
|
SetLevel();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if (!helpTip.empty()) {
|
||||||
|
setStatusText(helpTip);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GainCanvas::OnMouseDown(wxMouseEvent& event) {
|
void GainCanvas::OnMouseDown(wxMouseEvent& event) {
|
||||||
|
@ -159,24 +159,13 @@ void InteractiveCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveCanvas::setStatusText(std::string statusText) {
|
void InteractiveCanvas::setStatusText(std::string statusText) {
|
||||||
wxGetApp().getAppFrame()->GetStatusBar()->SetStatusText(statusText);
|
|
||||||
if (wxGetApp().getConfig()->getShowTips()) {
|
wxGetApp().getAppFrame()->setStatusText(this, statusText);
|
||||||
if (statusText != lastToolTip) {
|
|
||||||
wxToolTip::Enable(false);
|
|
||||||
this->SetToolTip(statusText);
|
|
||||||
lastToolTip = statusText;
|
|
||||||
wxToolTip::SetDelay(1000);
|
|
||||||
wxToolTip::Enable(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this->SetToolTip("");
|
|
||||||
lastToolTip = "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InteractiveCanvas::setStatusText(std::string statusText, int value) {
|
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) {
|
void InteractiveCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
||||||
|
@ -64,6 +64,5 @@ protected:
|
|||||||
long long lastBandwidth;
|
long long lastBandwidth;
|
||||||
|
|
||||||
bool isView;
|
bool isView;
|
||||||
std::string lastToolTip;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user