From d6dd176acad935e657031938b235aa4673571268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= Date: Thu, 2 Mar 2017 19:58:14 +0100 Subject: [PATCH] Changed default increment values and added shift+scroll for fine tuning Fixes: lp:1669550 * https://bugs.launchpad.net/kicad/+bug/1669550 --- 3d-viewer/3d_cache/dialogs/panel_prev_model.cpp | 14 ++++++++++++++ 3d-viewer/3d_cache/dialogs/panel_prev_model.h | 17 ++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp index ddd88a75a5..9939325c81 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.cpp @@ -476,6 +476,9 @@ void PANEL_PREV_3D::onMouseWheelScale( wxMouseEvent& event ) double step = SCALE_INCREMENT; + if( event.ShiftDown( ) ) + step = SCALE_INCREMENT_FINE; + if( event.GetWheelRotation() >= 0 ) step = -step; @@ -487,8 +490,13 @@ void PANEL_PREV_3D::onMouseWheelRot( wxMouseEvent& event ) { wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject(); + wxKeyboardState kbdState; + double step = ROTATION_INCREMENT_WHEEL; + if( event.ShiftDown( ) ) + step = ROTATION_INCREMENT_WHEEL_FINE; + if( event.GetWheelRotation() >= 0 ) step = -step; @@ -500,9 +508,15 @@ void PANEL_PREV_3D::onMouseWheelOffset( wxMouseEvent& event ) wxTextCtrl* textCtrl = (wxTextCtrl*) event.GetEventObject(); double step = OFFSET_INCREMENT_MM; + if( event.ShiftDown( ) ) + step = OFFSET_INCREMENT_MM_FINE; if( g_UserUnit == INCHES ) + { step = OFFSET_INCREMENT_MIL/1000.0; + if( event.ShiftDown( ) ) + step = OFFSET_INCREMENT_MIL_FINE/1000.0; + } if( event.GetWheelRotation() >= 0 ) step = -step; diff --git a/3d-viewer/3d_cache/dialogs/panel_prev_model.h b/3d-viewer/3d_cache/dialogs/panel_prev_model.h index 3cef2f9299..37fde4d191 100644 --- a/3d-viewer/3d_cache/dialogs/panel_prev_model.h +++ b/3d-viewer/3d_cache/dialogs/panel_prev_model.h @@ -48,11 +48,18 @@ #define MAX_ROTATION 180.0 #define MAX_OFFSET 1000.0 -#define SCALE_INCREMENT 0.02 -#define ROTATION_INCREMENT 5 // in degrees, for spin button command -#define ROTATION_INCREMENT_WHEEL 1 // in degrees, for mouse wheel command -#define OFFSET_INCREMENT_MM 0.1 -#define OFFSET_INCREMENT_MIL 5.0 +#define SCALE_INCREMENT_FINE 0.02 +#define SCALE_INCREMENT 0.1 + +#define ROTATION_INCREMENT 5 // in degrees, for spin button command +#define ROTATION_INCREMENT_WHEEL 15 // in degrees, for mouse wheel command +#define ROTATION_INCREMENT_WHEEL_FINE 1 // in degrees, for mouse wheel command + +#define OFFSET_INCREMENT_MM 0.5 +#define OFFSET_INCREMENT_MM_FINE 0.1 + +#define OFFSET_INCREMENT_MIL 25.0 +#define OFFSET_INCREMENT_MIL_FINE 5.0 // Declared classes to create pointers