diff --git a/common/dialogs/panel_mouse_settings.cpp b/common/dialogs/panel_mouse_settings.cpp index 165ce3c4e0..9e018d092f 100644 --- a/common/dialogs/panel_mouse_settings.cpp +++ b/common/dialogs/panel_mouse_settings.cpp @@ -123,6 +123,8 @@ bool PANEL_MOUSE_SETTINGS::TransferDataFromWindow() cfg->m_Input.scroll_modifier_pan_h = m_currentScrollMod.panh; cfg->m_Input.scroll_modifier_pan_v = m_currentScrollMod.panv; + cfg->m_Input.reverse_scroll_pan_h = m_checkPanHReverse->GetValue(); + return true; } @@ -175,9 +177,10 @@ void PANEL_MOUSE_SETTINGS::applySettingsToPanel( const COMMON_SETTINGS& aSetting default: break; } - m_currentScrollMod.zoom = aSettings.m_Input.scroll_modifier_zoom; - m_currentScrollMod.panh = aSettings.m_Input.scroll_modifier_pan_h; - m_currentScrollMod.panv = aSettings.m_Input.scroll_modifier_pan_v; + m_currentScrollMod.zoom = aSettings.m_Input.scroll_modifier_zoom; + m_currentScrollMod.panh = aSettings.m_Input.scroll_modifier_pan_h; + m_currentScrollMod.panv = aSettings.m_Input.scroll_modifier_pan_v; + m_currentScrollMod.panHReverse = aSettings.m_Input.reverse_scroll_pan_h; updateScrollModButtons(); } @@ -256,14 +259,17 @@ void PANEL_MOUSE_SETTINGS::updateScrollModButtons() set_wheel_buttons( m_currentScrollMod.panv, m_rbPanVNone, m_rbPanVCtrl, m_rbPanVShift, m_rbPanVAlt ); + + m_checkPanHReverse->SetValue( m_currentScrollMod.panHReverse ); } void PANEL_MOUSE_SETTINGS::onMouseDefaults( wxCommandEvent& event ) { - m_currentScrollMod.zoom = 0; - m_currentScrollMod.panh = WXK_CONTROL; - m_currentScrollMod.panv = WXK_SHIFT; + m_currentScrollMod.zoom = 0; + m_currentScrollMod.panh = WXK_CONTROL; + m_currentScrollMod.panv = WXK_SHIFT; + m_currentScrollMod.panHReverse = false; updateScrollModButtons(); @@ -273,9 +279,10 @@ void PANEL_MOUSE_SETTINGS::onMouseDefaults( wxCommandEvent& event ) void PANEL_MOUSE_SETTINGS::onTrackpadDefaults( wxCommandEvent& event ) { - m_currentScrollMod.zoom = WXK_CONTROL; - m_currentScrollMod.panh = WXK_SHIFT; - m_currentScrollMod.panv = 0; + m_currentScrollMod.zoom = WXK_CONTROL; + m_currentScrollMod.panh = WXK_SHIFT; + m_currentScrollMod.panv = 0; + m_currentScrollMod.panHReverse = false; updateScrollModButtons(); diff --git a/common/dialogs/panel_mouse_settings_base.cpp b/common/dialogs/panel_mouse_settings_base.cpp index a2cc32bb22..392c7b9e9f 100644 --- a/common/dialogs/panel_mouse_settings_base.cpp +++ b/common/dialogs/panel_mouse_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -196,7 +196,7 @@ PANEL_MOUSE_SETTINGS_BASE::PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindow bSizerLeft->Add( bSizer4, 0, wxEXPAND, 5 ); wxFlexGridSizer* fgSizer2; - fgSizer2 = new wxFlexGridSizer( 0, 5, 8, 0 ); + fgSizer2 = new wxFlexGridSizer( 0, 6, 8, 0 ); fgSizer2->AddGrowableCol( 0 ); fgSizer2->SetFlexibleDirection( wxBOTH ); fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); @@ -221,6 +221,10 @@ PANEL_MOUSE_SETTINGS_BASE::PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindow m_lblAlt->Wrap( -1 ); fgSizer2->Add( m_lblAlt, 0, wxALIGN_CENTER_HORIZONTAL|wxTOP|wxRIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + m_staticText18 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText18->Wrap( -1 ); + fgSizer2->Add( m_staticText18, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + m_staticText10 = new wxStaticText( this, wxID_ANY, _("Zoom:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText10->Wrap( -1 ); fgSizer2->Add( m_staticText10, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); @@ -237,6 +241,10 @@ PANEL_MOUSE_SETTINGS_BASE::PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindow m_rbZoomAlt = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer2->Add( m_rbZoomAlt, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + m_staticText201 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText201->Wrap( -1 ); + fgSizer2->Add( m_staticText201, 0, wxALL, 5 ); + m_staticText11 = new wxStaticText( this, wxID_ANY, _("Pan up/down:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText11->Wrap( -1 ); fgSizer2->Add( m_staticText11, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); @@ -253,6 +261,10 @@ PANEL_MOUSE_SETTINGS_BASE::PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindow m_rbPanVAlt = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer2->Add( m_rbPanVAlt, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 ); + m_staticText211 = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText211->Wrap( -1 ); + fgSizer2->Add( m_staticText211, 0, wxALL, 5 ); + m_staticText20 = new wxStaticText( this, wxID_ANY, _("Pan left/right:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText20->Wrap( -1 ); fgSizer2->Add( m_staticText20, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); @@ -269,6 +281,9 @@ PANEL_MOUSE_SETTINGS_BASE::PANEL_MOUSE_SETTINGS_BASE( wxWindow* parent, wxWindow m_rbPanHAlt = new wxRadioButton( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer2->Add( m_rbPanHAlt, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + m_checkPanHReverse = new wxCheckBox( this, wxID_ANY, _("Reverse"), wxDefaultPosition, wxDefaultSize, 0 ); + fgSizer2->Add( m_checkPanHReverse, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); + fgSizer2->Add( 0, 10, 1, wxEXPAND, 5 ); diff --git a/common/dialogs/panel_mouse_settings_base.fbp b/common/dialogs/panel_mouse_settings_base.fbp index 8cbaf6dfe1..d8adc8a40b 100644 --- a/common/dialogs/panel_mouse_settings_base.fbp +++ b/common/dialogs/panel_mouse_settings_base.fbp @@ -1626,7 +1626,7 @@ wxRIGHT|wxLEFT 0 - 5 + 6 wxBOTH 0 @@ -1942,6 +1942,67 @@ -1 + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + m_staticText18 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + 5 wxALIGN_CENTER_VERTICAL|wxRIGHT @@ -2263,6 +2324,67 @@ OnScrollRadioButton + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + m_staticText201 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + 5 wxALIGN_CENTER_VERTICAL|wxRIGHT @@ -2584,6 +2706,67 @@ OnScrollRadioButton + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + + 0 + + 1 + m_staticText211 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + 5 wxALIGN_CENTER_VERTICAL|wxRIGHT @@ -2905,6 +3088,70 @@ OnScrollRadioButton + + 5 + wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Reverse + + 0 + + + 0 + + 1 + m_checkPanHReverse + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxEXPAND diff --git a/common/dialogs/panel_mouse_settings_base.h b/common/dialogs/panel_mouse_settings_base.h index 681ea00962..bb66eb7d6e 100644 --- a/common/dialogs/panel_mouse_settings_base.h +++ b/common/dialogs/panel_mouse_settings_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -70,21 +70,25 @@ class PANEL_MOUSE_SETTINGS_BASE : public RESETTABLE_PANEL wxStaticText* m_lblCtrl; wxStaticText* m_staticText8; wxStaticText* m_lblAlt; + wxStaticText* m_staticText18; wxStaticText* m_staticText10; wxRadioButton* m_rbZoomNone; wxRadioButton* m_rbZoomCtrl; wxRadioButton* m_rbZoomShift; wxRadioButton* m_rbZoomAlt; + wxStaticText* m_staticText201; wxStaticText* m_staticText11; wxRadioButton* m_rbPanVNone; wxRadioButton* m_rbPanVCtrl; wxRadioButton* m_rbPanVShift; wxRadioButton* m_rbPanVAlt; + wxStaticText* m_staticText211; wxStaticText* m_staticText20; wxRadioButton* m_rbPanHNone; wxRadioButton* m_rbPanHCtrl; wxRadioButton* m_rbPanHShift; wxRadioButton* m_rbPanHAlt; + wxCheckBox* m_checkPanHReverse; wxCheckBox* m_checkEnablePanH; wxButton* m_mouseDefaults; wxButton* m_trackpadDefaults; diff --git a/common/gal/hidpi_gl_3D_canvas.cpp b/common/gal/hidpi_gl_3D_canvas.cpp index 3cb3c4ff6f..70f9725056 100644 --- a/common/gal/hidpi_gl_3D_canvas.cpp +++ b/common/gal/hidpi_gl_3D_canvas.cpp @@ -78,7 +78,8 @@ void HIDPI_GL_3D_CANVAS::OnMouseWheelCamera( wxMouseEvent& event, bool aPan ) : ( event.ControlDown() ? WXK_CONTROL : ( event.AltDown() ? WXK_ALT : 0 ) ); - float delta_move = m_delta_move_step_factor * m_camera.GetZoom(); + float delta_move = m_delta_move_step_factor * m_camera.GetZoom(); + float horizontalSign = m_settings.m_scrollReversePanH ? -1 : 1; if( aPan ) delta_move *= 0.01f * event.GetWheelRotation(); @@ -111,7 +112,7 @@ void HIDPI_GL_3D_CANVAS::OnMouseWheelCamera( wxMouseEvent& event, bool aPan ) } else if( modifiers == m_settings.m_scrollModifierPanH && !aPan ) { - m_camera.Pan( SFVEC3F( delta_move, 0.0f, 0.0f ) ); + m_camera.Pan( SFVEC3F( delta_move * horizontalSign, 0.0f, 0.0f ) ); mouseActivity = true; } else diff --git a/common/gal/hidpi_gl_canvas.cpp b/common/gal/hidpi_gl_canvas.cpp index 5c2ee9f4b3..4c10ce1b50 100644 --- a/common/gal/hidpi_gl_canvas.cpp +++ b/common/gal/hidpi_gl_canvas.cpp @@ -56,6 +56,7 @@ void HIDPI_GL_CANVAS::LoadSettings() m_settings.m_dragLeft = cfg->m_Input.drag_left; m_settings.m_dragMiddle = cfg->m_Input.drag_middle; m_settings.m_dragRight = cfg->m_Input.drag_right; + m_settings.m_scrollReversePanH = cfg->m_Input.reverse_scroll_pan_h; } wxSize HIDPI_GL_CANVAS::GetNativePixelSize() const diff --git a/common/settings/common_settings.cpp b/common/settings/common_settings.cpp index 7e3f6845cd..2e44b2f1e8 100644 --- a/common/settings/common_settings.cpp +++ b/common/settings/common_settings.cpp @@ -275,6 +275,9 @@ COMMON_SETTINGS::COMMON_SETTINGS() : m_params.emplace_back( new PARAM( "input.scroll_modifier_pan_v", &m_Input.scroll_modifier_pan_v, WXK_SHIFT ) ); + m_params.emplace_back( new PARAM( "input.reverse_scroll_pan_h", + &m_Input.reverse_scroll_pan_h, false ) ); + m_params.emplace_back( new PARAM_ENUM( "input.mouse_left", &m_Input.drag_left, MOUSE_DRAG_ACTION::DRAG_SELECTED, MOUSE_DRAG_ACTION::DRAG_ANY, MOUSE_DRAG_ACTION::SELECT ) ); diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index 73bb5c5369..8868ce92d0 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -171,6 +171,7 @@ void WX_VIEW_CONTROLS::LoadSettings() m_settings.m_dragLeft = cfg->m_Input.drag_left; m_settings.m_dragMiddle = cfg->m_Input.drag_middle; m_settings.m_dragRight = cfg->m_Input.drag_right; + m_settings.m_scrollReversePanH = cfg->m_Input.reverse_scroll_pan_h; m_zoomController.reset(); @@ -391,13 +392,24 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent ) // Scrolling VECTOR2D scrollVec = m_view->ToWorld( m_view->GetScreenPixelSize(), false ) * ( (double) aEvent.GetWheelRotation() * wheelPanSpeed ); - double scrollX = 0.0; - double scrollY = 0.0; + double scrollX = 0.0; + double scrollY = 0.0; + bool hReverse = false; + + if( axis != wxMOUSE_WHEEL_HORIZONTAL ) + hReverse = m_settings.m_scrollReversePanH; if( axis == wxMOUSE_WHEEL_HORIZONTAL || modifiers == m_settings.m_scrollModifierPanH ) - scrollX = ( axis == wxMOUSE_WHEEL_HORIZONTAL ) ? scrollVec.x : -scrollVec.x; + { + if( hReverse ) + scrollX = scrollVec.x; + else + scrollX = ( axis == wxMOUSE_WHEEL_HORIZONTAL ) ? scrollVec.x : -scrollVec.x; + } else + { scrollY = -scrollVec.y; + } VECTOR2D delta( scrollX, scrollY ); diff --git a/include/dialogs/panel_mouse_settings.h b/include/dialogs/panel_mouse_settings.h index 4352f94231..2b922b1b4b 100644 --- a/include/dialogs/panel_mouse_settings.h +++ b/include/dialogs/panel_mouse_settings.h @@ -33,6 +33,7 @@ struct SCROLL_MOD_SET int zoom; int panh; int panv; + bool panHReverse; }; diff --git a/include/settings/common_settings.h b/include/settings/common_settings.h index fe6277343a..e2194d7319 100644 --- a/include/settings/common_settings.h +++ b/include/settings/common_settings.h @@ -98,6 +98,8 @@ public: MOUSE_DRAG_ACTION drag_left; MOUSE_DRAG_ACTION drag_middle; MOUSE_DRAG_ACTION drag_right; + + bool reverse_scroll_pan_h; }; struct GRAPHICS diff --git a/include/view/view_controls.h b/include/view/view_controls.h index e612c613eb..61af3826e0 100644 --- a/include/view/view_controls.h +++ b/include/view/view_controls.h @@ -120,6 +120,9 @@ struct VC_SETTINGS ///< Position of the above event. VECTOR2D m_lastKeyboardCursorPosition; + + ///< Wether to invert the scroll wheel movement for horizontal pan + bool m_scrollReversePanH; };