mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-26 05:38:39 -05:00
Merge pull request #355 from cjcliffe/mousewheel_tweak
Mousewheel tweaks - Fix wheel for windows 7 - Fix mousewheel ranges and movement - Add gain mousewheel support - Focus tweaks / fixes
This commit is contained in:
commit
a75faaf4f2
@ -6,7 +6,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
|||||||
|
|
||||||
SET(CUBICSDR_VERSION_MAJOR "0")
|
SET(CUBICSDR_VERSION_MAJOR "0")
|
||||||
SET(CUBICSDR_VERSION_MINOR "1")
|
SET(CUBICSDR_VERSION_MINOR "1")
|
||||||
SET(CUBICSDR_VERSION_PATCH "28")
|
SET(CUBICSDR_VERSION_PATCH "29")
|
||||||
SET(CUBICSDR_VERSION_REL "alpha")
|
SET(CUBICSDR_VERSION_REL "alpha")
|
||||||
SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}-${CUBICSDR_VERSION_REL}")
|
SET(CUBICSDR_VERSION "${CUBICSDR_VERSION_MAJOR}.${CUBICSDR_VERSION_MINOR}.${CUBICSDR_VERSION_PATCH}-${CUBICSDR_VERSION_REL}")
|
||||||
|
|
||||||
|
@ -1490,6 +1490,12 @@ void AppFrame::OnIdle(wxIdleEvent& event) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (scopeCanvas->HasFocus()) {
|
||||||
|
waterfallCanvas->SetFocus();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!this->IsActive()) {
|
if (!this->IsActive()) {
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
std::this_thread::sleep_for(std::chrono::milliseconds(30));
|
||||||
} else {
|
} else {
|
||||||
@ -1779,6 +1785,11 @@ void AppFrame::refreshGainUI() {
|
|||||||
gainCanvas->Refresh();
|
gainCanvas->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
bool AppFrame::canFocus() {
|
||||||
|
return (!wxGetApp().isDeviceSelectorOpen() && (!modemProps || !modemProps->isMouseInView()));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
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,10 @@ public:
|
|||||||
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
|
FrequencyDialog::FrequencyDialogTarget getFrequencyDialogTarget();
|
||||||
void refreshGainUI();
|
void refreshGainUI();
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
bool canFocus();
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnMenu(wxCommandEvent& event);
|
void OnMenu(wxCommandEvent& event);
|
||||||
void OnClose(wxCloseEvent& event);
|
void OnClose(wxCloseEvent& event);
|
||||||
|
@ -22,6 +22,7 @@ EVT_LEFT_DOWN(GainCanvas::OnMouseDown)
|
|||||||
EVT_LEFT_UP(GainCanvas::OnMouseReleased)
|
EVT_LEFT_UP(GainCanvas::OnMouseReleased)
|
||||||
EVT_LEAVE_WINDOW(GainCanvas::OnMouseLeftWindow)
|
EVT_LEAVE_WINDOW(GainCanvas::OnMouseLeftWindow)
|
||||||
EVT_ENTER_WINDOW(GainCanvas::OnMouseEnterWindow)
|
EVT_ENTER_WINDOW(GainCanvas::OnMouseEnterWindow)
|
||||||
|
EVT_MOUSEWHEEL(GainCanvas::OnMouseWheelMoved)
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
GainCanvas::GainCanvas(wxWindow *parent, int *dispAttrs) :
|
GainCanvas::GainCanvas(wxWindow *parent, int *dispAttrs) :
|
||||||
@ -151,12 +152,31 @@ void GainCanvas::OnMouseDown(wxMouseEvent& event) {
|
|||||||
|
|
||||||
void GainCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
void GainCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseWheelMoved(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) {
|
void GainCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseReleased(event);
|
InteractiveCanvas::OnMouseReleased(event);
|
||||||
// Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GainCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
void GainCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||||
@ -174,7 +194,11 @@ void GainCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
|||||||
void GainCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
void GainCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
||||||
SetCursor(wxCURSOR_CROSS);
|
SetCursor(wxCURSOR_CROSS);
|
||||||
// Refresh();
|
#ifdef _WIN32
|
||||||
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
|
this->SetFocus();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,31 +126,45 @@ void MeterCanvas::OnMouseDown(wxMouseEvent& event) {
|
|||||||
InteractiveCanvas::OnMouseDown(event);
|
InteractiveCanvas::OnMouseDown(event);
|
||||||
userInputValue = mouseTracker.getMouseY() * (level_max-level_min) + level_min;
|
userInputValue = mouseTracker.getMouseY() * (level_max-level_min) + level_min;
|
||||||
mouseTracker.setHorizDragLock(true);
|
mouseTracker.setHorizDragLock(true);
|
||||||
Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterCanvas::OnMouseReleased(wxMouseEvent& event) {
|
void MeterCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseReleased(event);
|
InteractiveCanvas::OnMouseReleased(event);
|
||||||
userInputValue = mouseTracker.getMouseY() * (level_max-level_min) + level_min;
|
userInputValue = mouseTracker.getMouseY() * (level_max-level_min) + level_min;
|
||||||
Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
void MeterCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseRightDown(event);
|
InteractiveCanvas::OnMouseRightDown(event);
|
||||||
Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = 3.0 * (float)event.GetWheelRotation();
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MeterCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
void MeterCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||||
@ -162,9 +176,12 @@ void MeterCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
|||||||
void MeterCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
void MeterCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
InteractiveCanvas::mouseTracker.OnMouseEnterWindow(event);
|
||||||
SetCursor(wxCURSOR_CROSS);
|
SetCursor(wxCURSOR_CROSS);
|
||||||
Refresh();
|
#ifdef _WIN32
|
||||||
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
this->SetFocus();
|
this->SetFocus();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void MeterCanvas::setHelpTip(std::string tip) {
|
void MeterCanvas::setHelpTip(std::string tip) {
|
||||||
helpTip = tip;
|
helpTip = tip;
|
||||||
|
@ -248,6 +248,9 @@ void SpectrumCanvas::OnMouseDown(wxMouseEvent& event) {
|
|||||||
|
|
||||||
void SpectrumCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
void SpectrumCanvas::OnMouseWheelMoved(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseWheelMoved(event);
|
InteractiveCanvas::OnMouseWheelMoved(event);
|
||||||
|
if (waterfallCanvas) {
|
||||||
|
waterfallCanvas->OnMouseWheelMoved(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectrumCanvas::OnMouseReleased(wxMouseEvent& event) {
|
void SpectrumCanvas::OnMouseReleased(wxMouseEvent& event) {
|
||||||
@ -259,9 +262,11 @@ void SpectrumCanvas::OnMouseReleased(wxMouseEvent& event) {
|
|||||||
void SpectrumCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
void SpectrumCanvas::OnMouseEnterWindow(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseEnterWindow(event);
|
InteractiveCanvas::OnMouseEnterWindow(event);
|
||||||
SetCursor(wxCURSOR_SIZEWE);
|
SetCursor(wxCURSOR_SIZEWE);
|
||||||
if (waterfallCanvas) {
|
#ifdef _WIN32
|
||||||
waterfallCanvas->SetFocus();
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
|
this->SetFocus();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectrumCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
void SpectrumCanvas::OnMouseLeftWindow(wxMouseEvent& event) {
|
||||||
|
@ -410,8 +410,12 @@ 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();
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
this->SetFocus();
|
this->SetFocus();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void TuningCanvas::setHelpTip(std::string tip) {
|
void TuningCanvas::setHelpTip(std::string tip) {
|
||||||
helpTip = tip;
|
helpTip = tip;
|
||||||
|
@ -852,8 +852,12 @@ 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);
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (wxGetApp().getAppFrame()->canFocus()) {
|
||||||
this->SetFocus();
|
this->SetFocus();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void WaterfallCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
void WaterfallCanvas::OnMouseRightDown(wxMouseEvent& event) {
|
||||||
InteractiveCanvas::OnMouseRightDown(event);
|
InteractiveCanvas::OnMouseRightDown(event);
|
||||||
|
@ -35,6 +35,7 @@ public:
|
|||||||
|
|
||||||
void OnKeyDown(wxKeyEvent& event);
|
void OnKeyDown(wxKeyEvent& event);
|
||||||
void OnKeyUp(wxKeyEvent& event);
|
void OnKeyUp(wxKeyEvent& event);
|
||||||
|
void OnMouseWheelMoved(wxMouseEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
@ -43,7 +44,6 @@ private:
|
|||||||
void updateHoverState();
|
void updateHoverState();
|
||||||
|
|
||||||
void OnMouseMoved(wxMouseEvent& event);
|
void OnMouseMoved(wxMouseEvent& event);
|
||||||
void OnMouseWheelMoved(wxMouseEvent& event);
|
|
||||||
void OnMouseDown(wxMouseEvent& event);
|
void OnMouseDown(wxMouseEvent& event);
|
||||||
void OnMouseReleased(wxMouseEvent& event);
|
void OnMouseReleased(wxMouseEvent& event);
|
||||||
void OnMouseRightDown(wxMouseEvent& event);
|
void OnMouseRightDown(wxMouseEvent& event);
|
||||||
|
Loading…
Reference in New Issue
Block a user