7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 00:21:31 +00:00

mouse settings: add reverse zoom option

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18583
This commit is contained in:
Mike Williams 2024-09-23 10:09:25 -04:00
parent 1db63ef36f
commit 53022ab347
12 changed files with 3507 additions and 3436 deletions

View File

@ -123,6 +123,7 @@ 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_zoom = m_checkZoomReverse->GetValue();
cfg->m_Input.reverse_scroll_pan_h = m_checkPanHReverse->GetValue();
return true;
@ -180,6 +181,7 @@ void PANEL_MOUSE_SETTINGS::applySettingsToPanel( const COMMON_SETTINGS& aSetting
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.zoomReverse = aSettings.m_Input.reverse_scroll_zoom;
m_currentScrollMod.panHReverse = aSettings.m_Input.reverse_scroll_pan_h;
updateScrollModButtons();
@ -260,6 +262,7 @@ void PANEL_MOUSE_SETTINGS::updateScrollModButtons()
set_wheel_buttons( m_currentScrollMod.panv, m_rbPanVNone, m_rbPanVCtrl, m_rbPanVShift,
m_rbPanVAlt );
m_checkZoomReverse->SetValue( m_currentScrollMod.zoomReverse );
m_checkPanHReverse->SetValue( m_currentScrollMod.panHReverse );
}
@ -269,6 +272,7 @@ void PANEL_MOUSE_SETTINGS::onMouseDefaults( wxCommandEvent& event )
m_currentScrollMod.zoom = 0;
m_currentScrollMod.panh = WXK_CONTROL;
m_currentScrollMod.panv = WXK_SHIFT;
m_currentScrollMod.zoomReverse = false;
m_currentScrollMod.panHReverse = false;
updateScrollModButtons();
@ -282,6 +286,7 @@ void PANEL_MOUSE_SETTINGS::onTrackpadDefaults( wxCommandEvent& event )
m_currentScrollMod.zoom = WXK_CONTROL;
m_currentScrollMod.panh = WXK_SHIFT;
m_currentScrollMod.panv = 0;
m_currentScrollMod.zoomReverse = false;
m_currentScrollMod.panHReverse = false;
updateScrollModButtons();

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -241,9 +241,8 @@ 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_checkZoomReverse = new wxCheckBox( this, wxID_ANY, _("Reverse"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_checkZoomReverse, 0, wxALL, 5 );
m_staticText11 = new wxStaticText( this, wxID_ANY, _("Pan up/down:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText11->Wrap( -1 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf-dirty)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -76,7 +76,7 @@ class PANEL_MOUSE_SETTINGS_BASE : public RESETTABLE_PANEL
wxRadioButton* m_rbZoomCtrl;
wxRadioButton* m_rbZoomShift;
wxRadioButton* m_rbZoomAlt;
wxStaticText* m_staticText201;
wxCheckBox* m_checkZoomReverse;
wxStaticText* m_staticText11;
wxRadioButton* m_rbPanVNone;
wxRadioButton* m_rbPanVCtrl;

View File

@ -708,6 +708,7 @@ KIGFX::VC_SETTINGS EDA_DRAW_PANEL_GAL::GetVcSettings()
vcSettings.m_dragLeft = cfg->m_Input.drag_left;
vcSettings.m_dragMiddle = cfg->m_Input.drag_middle;
vcSettings.m_dragRight = cfg->m_Input.drag_right;
vcSettings.m_scrollReverseZoom = cfg->m_Input.reverse_scroll_zoom;
vcSettings.m_scrollReversePanH = cfg->m_Input.reverse_scroll_pan_h;
return vcSettings;

View File

@ -79,6 +79,7 @@ void HIDPI_GL_3D_CANVAS::OnMouseWheelCamera( wxMouseEvent& event, bool aPan )
float delta_move = m_delta_move_step_factor * m_camera.GetZoom();
float horizontalSign = m_settings.m_scrollReversePanH ? -1 : 1;
float zoomSign = m_settings.m_scrollReverseZoom ? -1 : 1;
if( aPan )
delta_move *= 0.01f * event.GetWheelRotation();
@ -116,7 +117,8 @@ void HIDPI_GL_3D_CANVAS::OnMouseWheelCamera( wxMouseEvent& event, bool aPan )
}
else
{
mouseActivity = m_camera.Zoom( event.GetWheelRotation() > 0 ? 1.1f : 1 / 1.1f );
mouseActivity =
m_camera.Zoom( ( event.GetWheelRotation() * zoomSign ) > 0 ? 1.1f : 1 / 1.1f );
}
// If it results on a camera movement

View File

@ -264,6 +264,9 @@ COMMON_SETTINGS::COMMON_SETTINGS() :
m_params.emplace_back( new PARAM<int>( "input.scroll_modifier_pan_v",
&m_Input.scroll_modifier_pan_v, WXK_SHIFT ) );
m_params.emplace_back( new PARAM<bool>( "input.reverse_scroll_zoom",
&m_Input.reverse_scroll_zoom, false ) );
m_params.emplace_back( new PARAM<bool>( "input.reverse_scroll_pan_h",
&m_Input.reverse_scroll_pan_h, false ) );

View File

@ -82,6 +82,7 @@ void VC_SETTINGS::Reset()
m_lastKeyboardCursorPositionValid = false;
m_lastKeyboardCursorPosition = { 0.0, 0.0 };
m_lastKeyboardCursorCommand = ACTIONS::CURSOR_NONE;
m_scrollReverseZoom = false;
m_scrollReversePanH = false;
}

View File

@ -184,6 +184,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_scrollReverseZoom = cfg->m_Input.reverse_scroll_zoom;
m_settings.m_scrollReversePanH = cfg->m_Input.reverse_scroll_pan_h;
m_zoomController.reset();
@ -385,7 +386,7 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
// as vertical scroll events and confuse the user.
if( modifiers == m_settings.m_scrollModifierZoom && axis == wxMOUSE_WHEEL_VERTICAL )
{
const int rotation = aEvent.GetWheelRotation();
const int rotation = aEvent.GetWheelRotation() * ( m_settings.m_scrollReverseZoom ? -1 : 1 );
const double zoomScale = m_zoomController->GetScaleForRotation( rotation );
if( IsCursorWarpingEnabled() )

View File

@ -33,6 +33,7 @@ struct SCROLL_MOD_SET
int zoom;
int panh;
int panv;
bool zoomReverse;
bool panHReverse;
};

View File

@ -100,6 +100,7 @@ public:
MOUSE_DRAG_ACTION drag_middle;
MOUSE_DRAG_ACTION drag_right;
bool reverse_scroll_zoom;
bool reverse_scroll_pan_h;
};

View File

@ -122,7 +122,11 @@ struct GAL_API VC_SETTINGS
///< Position of the above event.
VECTOR2D m_lastKeyboardCursorPosition;
///< Wether to invert the scroll wheel movement for horizontal pan
///< Whether to invert the scroll wheel movement for zoom
bool m_scrollReverseZoom;
///< Whether to invert the scroll wheel movement for horizontal pan
bool m_scrollReversePanH;
};