Add hover helptips, show hover helptips by default for new users.

This commit is contained in:
Charles J. Cliffe 2016-02-08 22:43:11 -05:00
parent 8737728cf9
commit 393cd5f635
5 changed files with 37 additions and 2 deletions

View File

@ -198,6 +198,7 @@ AppConfig::AppConfig() : configName("") {
winW.store(0);
winH.store(0);
winMax.store(false);
showTips.store(true);
themeId.store(0);
snap.store(1);
centerFreq.store(100000000);
@ -253,6 +254,14 @@ bool AppConfig::getWindowMaximized() {
return winMax.load();
}
void AppConfig::setShowTips(bool show) {
showTips.store(show);
}
bool AppConfig::getShowTips() {
return showTips.load();
}
wxRect *AppConfig::getWindow() {
wxRect *r = NULL;
if (winH.load() && winW.load()) {
@ -347,6 +356,7 @@ bool AppConfig::save() {
*window_node->newChild("h") = winH.load();
*window_node->newChild("max") = winMax.load();
*window_node->newChild("tips") = showTips.load();
*window_node->newChild("theme") = themeId.load();
*window_node->newChild("snap") = snap.load();
*window_node->newChild("center_freq") = centerFreq.load();
@ -426,7 +436,7 @@ bool AppConfig::load() {
if (cfg.rootNode()->hasAnother("window")) {
int x,y,w,h;
int max;
int max,tips;
DataNode *win_node = cfg.rootNode()->getNext("window");
@ -447,6 +457,11 @@ bool AppConfig::load() {
winMax.store(max?true:false);
}
if (win_node->hasAnother("tips")) {
win_node->getNext("tips")->element()->get(tips);
showTips.store(tips?true:false);
}
if (win_node->hasAnother("theme")) {
int theme;
win_node->getNext("theme")->element()->get(theme);

View File

@ -70,6 +70,9 @@ public:
void setWindowMaximized(bool max);
bool getWindowMaximized();
void setShowTips(bool show);
bool getShowTips();
void setTheme(int themeId);
int getTheme();
@ -109,7 +112,7 @@ private:
std::string configName;
std::map<std::string, DeviceConfig *> deviceConfig;
std::atomic_int winX,winY,winW,winH;
std::atomic_bool winMax;
std::atomic_bool winMax, showTips;
std::atomic_int themeId;
std::atomic_llong snap;
std::atomic_llong centerFreq;

View File

@ -552,6 +552,10 @@ void AppFrame::updateDeviceParams() {
// Build settings menu
wxMenu *newSettingsMenu = new wxMenu;
showTipMenuItem = newSettingsMenu->AppendCheckItem(wxID_SET_TIPS, "Show Hover Tips");
if (wxGetApp().getConfig()->getShowTips()) {
showTipMenuItem->Check();
}
newSettingsMenu->Append(wxID_SET_FREQ_OFFSET, "Frequency Offset");
if (devInfo->hasCORR(SOAPY_SDR_RX, 0)) {
newSettingsMenu->Append(wxID_SET_PPM, "Device PPM");
@ -673,6 +677,12 @@ void AppFrame::OnMenu(wxCommandEvent& event) {
activeDemodulator->setOutputDevice(event.GetId() - wxID_RT_AUDIO_DEVICE);
activeDemodulator = NULL;
}
} else if (event.GetId() == wxID_SET_TIPS ) {
if (wxGetApp().getConfig()->getShowTips()) {
wxGetApp().getConfig()->setShowTips(false);
} else {
wxGetApp().getConfig()->setShowTips(true);
}
} else if (event.GetId() == wxID_SET_FREQ_OFFSET) {
long ofs = wxGetNumberFromUser("Shift the displayed frequency by this amount.\ni.e. -125000000 for -125 MHz", "Frequency (Hz)",
"Frequency Offset", wxGetApp().getOffset(), -2000000000, 2000000000, this);

View File

@ -26,6 +26,7 @@
#define wxID_SET_FREQ_OFFSET 2001
#define wxID_RESET 2002
#define wxID_SET_PPM 2003
#define wxID_SET_TIPS 2004
#define wxID_SDR_DEVICES 2008
#define wxID_AGC_CONTROL 2009
@ -150,6 +151,7 @@ private:
wxMenuItem *sdrIFMenuItem;
std::map<int, wxMenuItem *> rigSerialMenuItems;
std::map<int, wxMenuItem *> rigModelMenuItems;
wxMenuItem *showTipMenuItem;
int rigModel;
int rigSerialRate;
long long rigSDRIF;

View File

@ -157,6 +157,11 @@ void InteractiveCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
void InteractiveCanvas::setStatusText(std::string statusText) {
wxGetApp().getAppFrame()->GetStatusBar()->SetStatusText(statusText);
if (wxGetApp().getConfig()->getShowTips()) {
this->SetToolTip(statusText);
} else {
this->SetToolTip("");
}
}
void InteractiveCanvas::setStatusText(std::string statusText, int value) {