mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-10 14:23:27 -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 AppFrame::getFrequencyDialogTarget() {
|
||||||
FrequencyDialog::FrequencyDialogTarget target = FrequencyDialog::FrequencyDialogTarget::FDIALOG_TARGET_DEFAULT;
|
FrequencyDialog::FrequencyDialogTarget target = FrequencyDialog::FrequencyDialogTarget::FDIALOG_TARGET_DEFAULT;
|
||||||
|
|
||||||
|
@ -96,6 +96,8 @@ public:
|
|||||||
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
|
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
|
||||||
void refreshGainUI();
|
void refreshGainUI();
|
||||||
|
|
||||||
|
bool canFocus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnMenu(wxCommandEvent& event);
|
void OnMenu(wxCommandEvent& event);
|
||||||
void OnClose(wxCloseEvent& event);
|
void OnClose(wxCloseEvent& event);
|
||||||
|
@ -142,14 +142,34 @@ void MeterCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
|||||||
|
|
||||||
void MeterCanvas::OnMouseRightReleased(wxMouseEvent& event) {
|
void MeterCanvas::OnMouseRightReleased(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseRightReleased(event);
|
InteractiveCanvas::OnMouseRightReleased(event);
|
||||||
|
if (showUserInput) {
|
||||||
userInputValue = level - level * 0.02;
|
userInputValue = level - level * 0.02;
|
||||||
|
}
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
void MeterCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseWheelMoved(event);
|
InteractiveCanvas::OnMouseWheelMoved(event);
|
||||||
float movement = (float)event.GetWheelRotation() / (float)event.GetLinesPerAction();
|
float movement = (float)event.GetWheelRotation() / (float)event.GetLinesPerAction();
|
||||||
userInputValue = userInputValue + movement / 1000;
|
|
||||||
|
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();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +183,9 @@ void MeterCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
|||||||
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
||||||
SetCursor(wxCURSOR_CROSS);
|
SetCursor(wxCURSOR_CROSS);
|
||||||
Refresh();
|
Refresh();
|
||||||
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
this->SetFocus();
|
this->SetFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterCanvas::setHelpTip(std::string tip) {
|
void MeterCanvas::setHelpTip(std::string tip) {
|
||||||
|
@ -260,7 +260,9 @@ void SpectrumCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
|||||||
InteractiveCanvas::OnMouseEnterWindow(event);
|
InteractiveCanvas::OnMouseEnterWindow(event);
|
||||||
SetCursor(wxCURSOR_SIZEWE);
|
SetCursor(wxCURSOR_SIZEWE);
|
||||||
if (waterfallCanvas) {
|
if (waterfallCanvas) {
|
||||||
waterfallCanvas->SetFocus();
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
|
this->SetFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,9 @@ void TuningCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
|||||||
hoverIndex = 0;
|
hoverIndex = 0;
|
||||||
hoverState = TUNING_HOVER_NONE;
|
hoverState = TUNING_HOVER_NONE;
|
||||||
lastPPM = currentPPM = wxGetApp().getPPM();
|
lastPPM = currentPPM = wxGetApp().getPPM();
|
||||||
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
this->SetFocus();
|
this->SetFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TuningCanvas::setHelpTip(std::string tip) {
|
void TuningCanvas::setHelpTip(std::string tip) {
|
||||||
|
@ -852,7 +852,9 @@ void WaterfallCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
|||||||
void WaterfallCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
void WaterfallCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseEnterWindow(event);
|
InteractiveCanvas::OnMouseEnterWindow(event);
|
||||||
SetCursor(wxCURSOR_CROSS);
|
SetCursor(wxCURSOR_CROSS);
|
||||||
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
this->SetFocus();
|
this->SetFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaterfallCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
void WaterfallCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user