mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-10 06:18:57 -05:00
Tweak mousewheel response for Meter UI elements
This commit is contained in:
parent
bd3b9ac921
commit
a0d15026df
@ -1780,6 +1780,10 @@ void AppFrame::refreshGainUI() {
|
||||
}
|
||||
|
||||
|
||||
bool AppFrame::canFocus() {
|
||||
return (!wxGetApp().isDeviceSelectorOpen() && (!modemProps || !modemProps->isMouseInView()));
|
||||
}
|
||||
|
||||
FrequencyDialog::FrequencyDialogTarget AppFrame::getFrequencyDialogTarget() {
|
||||
FrequencyDialog::FrequencyDialogTarget target = FrequencyDialog::FrequencyDialogTarget::FDIALOG_TARGET_DEFAULT;
|
||||
|
||||
|
@ -96,6 +96,8 @@ public:
|
||||
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
|
||||
void refreshGainUI();
|
||||
|
||||
bool canFocus();
|
||||
|
||||
private:
|
||||
void OnMenu(wxCommandEvent& event);
|
||||
void OnClose(wxCloseEvent& event);
|
||||
|
@ -142,15 +142,35 @@ void MeterCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
||||
|
||||
void MeterCanvas::OnMouseRightReleased(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseRightReleased(event);
|
||||
userInputValue = level - level * 0.02;
|
||||
Refresh();
|
||||
if (showUserInput) {
|
||||
userInputValue = level - level * 0.02;
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void MeterCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseWheelMoved(event);
|
||||
float movement = (float)event.GetWheelRotation() / (float)event.GetLinesPerAction();
|
||||
userInputValue = userInputValue + movement / 1000;
|
||||
Refresh();
|
||||
|
||||
float currentValue = 0;
|
||||
if (showUserInput) {
|
||||
currentValue = userInputValue;
|
||||
} else {
|
||||
currentValue = level;
|
||||
}
|
||||
|
||||
currentValue = currentValue + ((movement / 100.0) * ((level_max - level_min) / 100.0));
|
||||
|
||||
if (currentValue > level_max) {
|
||||
currentValue = level_max;
|
||||
}
|
||||
if (currentValue < level_min) {
|
||||
currentValue = level_min;
|
||||
}
|
||||
|
||||
userInputValue = currentValue;
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void MeterCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
@ -163,7 +183,9 @@ void MeterCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
||||
SetCursor(wxCURSOR_CROSS);
|
||||
Refresh();
|
||||
this->SetFocus();
|
||||
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||
this->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void MeterCanvas::setHelpTip(std::string tip) {
|
||||
|
@ -260,7 +260,9 @@ void SpectrumCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseEnterWindow(event);
|
||||
SetCursor(wxCURSOR_SIZEWE);
|
||||
if (waterfallCanvas) {
|
||||
waterfallCanvas->SetFocus();
|
||||
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||
this->SetFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,9 @@ void TuningCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
hoverIndex = 0;
|
||||
hoverState = TUNING_HOVER_NONE;
|
||||
lastPPM = currentPPM = wxGetApp().getPPM();
|
||||
this->SetFocus();
|
||||
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||
this->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void TuningCanvas::setHelpTip(std::string tip) {
|
||||
|
@ -852,7 +852,9 @@ void WaterfallCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
void WaterfallCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseEnterWindow(event);
|
||||
SetCursor(wxCURSOR_CROSS);
|
||||
this->SetFocus();
|
||||
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||
this->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void WaterfallCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
||||
|
Loading…
Reference in New Issue
Block a user