mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-22 03:36:24 -05:00
Mouse Wheel support for gain; @vsonnier's wheel movement tweak
This commit is contained in:
parent
ce1cd27007
commit
640b4bb219
@ -22,6 +22,7 @@ EVT_LEFT_DOWN(GainCanvas::OnMouseDown)
|
||||
EVT_LEFT_UP(GainCanvas::OnMouseReleased)
|
||||
EVT_LEAVE_WINDOW(GainCanvas::OnMouseLeftWindow)
|
||||
EVT_ENTER_WINDOW(GainCanvas::OnMouseEnterWindow)
|
||||
EVT_MOUSEWHEEL(GainCanvas::OnMouseWheelMoved)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
GainCanvas::GainCanvas(wxWindow *parent, int *dispAttrs) :
|
||||
@ -151,12 +152,31 @@ void GainCanvas::OnMouseDown(wxMouseEvent& event) {
|
||||
|
||||
void GainCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseWheelMoved(event);
|
||||
// Refresh();
|
||||
|
||||
CubicVR::vec2 hitResult;
|
||||
int panelHit = GetPanelHit(hitResult);
|
||||
|
||||
if (panelHit >= 0) {
|
||||
float movement = 3.0 * (float)event.GetWheelRotation();
|
||||
|
||||
GainInfo *gInfo;
|
||||
|
||||
gInfo = gainInfo[panelHit];
|
||||
|
||||
gInfo->current = gInfo->current + ((movement / 100.0) * ((gInfo->high - gInfo->low) / 100.0));
|
||||
gInfo->changed = true;
|
||||
|
||||
float levelVal = float(gInfo->current-gInfo->low)/float(gInfo->high-gInfo->low);
|
||||
gInfo->levelPanel.setSize(1.0, levelVal);
|
||||
gInfo->levelPanel.setPosition(0.0, levelVal-1.0);
|
||||
|
||||
gInfo->valuePanel.setText(std::to_string(int(gInfo->current)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GainCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseReleased(event);
|
||||
// Refresh();
|
||||
}
|
||||
|
||||
void GainCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
@ -174,7 +194,6 @@ void GainCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||
void GainCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
||||
SetCursor(wxCURSOR_CROSS);
|
||||
// Refresh();
|
||||
}
|
||||
|
||||
|
||||
|
@ -146,8 +146,8 @@ void MeterCanvas::OnMouseRightReleased(wxMouseEvent& event) {
|
||||
|
||||
void MeterCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
||||
InteractiveCanvas::OnMouseWheelMoved(event);
|
||||
float movement = (float)event.GetWheelRotation() / (float)event.GetLinesPerAction();
|
||||
|
||||
float movement = 3.0 * (float)event.GetWheelRotation();
|
||||
|
||||
float currentValue = 0;
|
||||
if (showUserInput) {
|
||||
currentValue = userInputValue;
|
||||
|
Loading…
Reference in New Issue
Block a user