diff --git a/common/dialogs/panel_common_settings.cpp b/common/dialogs/panel_common_settings.cpp index f2210603b2..8a90976412 100644 --- a/common/dialogs/panel_common_settings.cpp +++ b/common/dialogs/panel_common_settings.cpp @@ -140,6 +140,9 @@ bool PANEL_COMMON_SETTINGS::TransferDataToWindow() } m_PreferSelectToDrag->SetValue( option ); + commonSettings->Read( WARP_MOUSE_ON_MOVE_KEY, &option ); + m_warpMouseOnMove->SetValue( option ); + commonSettings->Read( IMMEDIATE_ACTIONS_KEY, &option ); m_NonImmediateActions->SetValue( !option ); @@ -177,6 +180,7 @@ bool PANEL_COMMON_SETTINGS::TransferDataFromWindow() commonSettings->Write( ENBL_MOUSEWHEEL_PAN_KEY, m_MousewheelPANOpt->GetValue() ); commonSettings->Write( ENBL_AUTO_PAN_KEY, m_AutoPANOpt->GetValue() ); commonSettings->Write( PREFER_SELECT_TO_DRAG_KEY, m_PreferSelectToDrag->GetValue() ); + commonSettings->Write( WARP_MOUSE_ON_MOVE_KEY, m_warpMouseOnMove->GetValue() ); commonSettings->Write( IMMEDIATE_ACTIONS_KEY, !m_NonImmediateActions->GetValue() ); Pgm().SetEditorName( m_textEditorPath->GetValue() ); diff --git a/common/dialogs/panel_common_settings_base.cpp b/common/dialogs/panel_common_settings_base.cpp index 874e81077c..a21ac96990 100644 --- a/common/dialogs/panel_common_settings_base.cpp +++ b/common/dialogs/panel_common_settings_base.cpp @@ -201,6 +201,9 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind m_PreferSelectToDrag = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, _("Prefer selection to dragging"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer4->Add( m_PreferSelectToDrag, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_warpMouseOnMove = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, _("Warp mouse to origin of moved object"), wxDefaultPosition, wxDefaultSize, 0 ); + sbSizer4->Add( m_warpMouseOnMove, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); + m_NonImmediateActions = new wxCheckBox( sbSizer4->GetStaticBox(), wxID_ANY, _("First hotkey selects tool"), wxDefaultPosition, wxDefaultSize, 0 ); m_NonImmediateActions->SetToolTip( _("If not checked, hotkeys will immediately perform an action even if the relevant tool was not previously selected.") ); diff --git a/common/dialogs/panel_common_settings_base.fbp b/common/dialogs/panel_common_settings_base.fbp index bf5e301a7d..fb6b5cd7a7 100644 --- a/common/dialogs/panel_common_settings_base.fbp +++ b/common/dialogs/panel_common_settings_base.fbp @@ -2650,6 +2650,94 @@ + + 5 + wxBOTTOM|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Warp mouse to origin of moved object + + 0 + + + 0 + + 1 + m_warpMouseOnMove + 1 + + + protected + 1 + + Resizable + 1 + + + ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxBOTTOM|wxRIGHT|wxLEFT diff --git a/common/dialogs/panel_common_settings_base.h b/common/dialogs/panel_common_settings_base.h index aa4c1ec488..c114007d08 100644 --- a/common/dialogs/panel_common_settings_base.h +++ b/common/dialogs/panel_common_settings_base.h @@ -72,6 +72,7 @@ class PANEL_COMMON_SETTINGS_BASE : public wxPanel wxCheckBox* m_MousewheelPANOpt; wxCheckBox* m_AutoPANOpt; wxCheckBox* m_PreferSelectToDrag; + wxCheckBox* m_warpMouseOnMove; wxCheckBox* m_NonImmediateActions; // Virtual event handlers, overide them in your derived class diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 19ec945efc..4f6d1fb6be 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -403,6 +403,7 @@ void EDA_BASE_FRAME::CommonSettingsChanged( bool aEnvVarsChanged ) wxConfigBase* settings = Pgm().CommonSettings(); + settings->Read( WARP_MOUSE_ON_MOVE_KEY, &m_moveWarpsCursor ); settings->Read( PREFER_SELECT_TO_DRAG_KEY, &m_dragSelects ); settings->Read( IMMEDIATE_ACTIONS_KEY, &m_immediateActions ); } @@ -467,6 +468,14 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) aCfg->Read( baseCfgName + entryMruPath, &m_mruPath ); wxConfigBase* settings = Pgm().CommonSettings(); + + if( !settings->Read( WARP_MOUSE_ON_MOVE_KEY, &m_moveWarpsCursor ) ) + { + // Legacy versions stored the property only for Eeschema, so see if we have it there + std::unique_ptr pcbSettings = GetNewConfig( wxT( "eeschema" ) ); + pcbSettings->Read( "MoveWarpsCursor", &m_moveWarpsCursor, true ); + } + if( !settings->Read( PREFER_SELECT_TO_DRAG_KEY, &m_dragSelects ) ) { // Legacy versions stored the property only for PCBNew, so see if we have it there diff --git a/eeschema/dialogs/panel_eeschema_settings.cpp b/eeschema/dialogs/panel_eeschema_settings.cpp index 03fa8dd3dd..d50b8a373e 100644 --- a/eeschema/dialogs/panel_eeschema_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_settings.cpp @@ -51,15 +51,7 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataToWindow() m_checkAutoplaceJustify->SetValue( m_frame->GetAutoplaceJustify() ); m_checkAutoplaceAlign->SetValue( m_frame->GetAutoplaceAlign() ); - m_moveWarpsCursor->SetValue( m_frame->GetMoveWarpsCursor() ); - m_moveTakesCursorAsOrigin->SetValue( m_frame->GetMoveTakesCursorAsOrigin() ); - - if( m_frame->GetDragAlwaysSelects() ) - m_choiceMouseAction->SetSelection( 2 ); - else if( m_frame->GetDragActionIsMove() ) - m_choiceMouseAction->SetSelection( 0 ); - else - m_choiceMouseAction->SetSelection( 1 ); + m_mouseDragIsDrag->SetValue( m_frame->GetDragActionIsMove() ); return true; } @@ -88,25 +80,7 @@ bool PANEL_EESCHEMA_SETTINGS::TransferDataFromWindow() m_frame->SetAutoplaceJustify( m_checkAutoplaceJustify->GetValue() ); m_frame->SetAutoplaceAlign( m_checkAutoplaceAlign->GetValue() ); - m_frame->SetMoveWarpsCursor( m_moveWarpsCursor->GetValue() ); - m_frame->SetMoveTakesCursorAsOrigin( m_moveTakesCursorAsOrigin->GetValue() ); - - switch( m_choiceMouseAction->GetSelection() ) - { - case 0: - m_frame->SetDragAlwaysSelects( false ); - m_frame->SetDragActionIsMove( true); - break; - case 1: - m_frame->SetDragAlwaysSelects( false ); - m_frame->SetDragActionIsMove( false ); - break; - case 2: - m_frame->SetDragAlwaysSelects( true ); - break; - default: - break; - } + m_frame->SetDragActionIsMove( !m_mouseDragIsDrag->GetValue() ); return true; } diff --git a/eeschema/dialogs/panel_eeschema_settings_base.cpp b/eeschema/dialogs/panel_eeschema_settings_base.cpp index f9acf3287e..84c6470b1a 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.cpp +++ b/eeschema/dialogs/panel_eeschema_settings_base.cpp @@ -11,7 +11,6 @@ BEGIN_EVENT_TABLE( PANEL_EESCHEMA_SETTINGS_BASE, wxPanel ) EVT_CHOICE( wxID_ANY, PANEL_EESCHEMA_SETTINGS_BASE::_wxFB_OnChooseUnits ) - EVT_CHOICE( wxID_ANY, PANEL_EESCHEMA_SETTINGS_BASE::_wxFB_OnChooseUnits ) END_EVENT_TABLE() PANEL_EESCHEMA_SETTINGS_BASE::PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style ) @@ -86,16 +85,6 @@ PANEL_EESCHEMA_SETTINGS_BASE::PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wx fgSizer3->Add( 0, 0, 1, wxEXPAND, 3 ); - m_staticText161 = new wxStaticText( this, wxID_ANY, _("Mouse drag action"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText161->Wrap( -1 ); - fgSizer3->Add( m_staticText161, 0, wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); - - wxString m_choiceMouseActionChoices[] = { _("Move"), _("Drag"), _("Rectanguar selection") }; - int m_choiceMouseActionNChoices = sizeof( m_choiceMouseActionChoices ) / sizeof( wxString ); - m_choiceMouseAction = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceMouseActionNChoices, m_choiceMouseActionChoices, 0 ); - m_choiceMouseAction->SetSelection( 2 ); - fgSizer3->Add( m_choiceMouseAction, 0, 0, 5 ); - bLeftColumn->Add( fgSizer3, 0, wxLEFT|wxRIGHT, 5 ); @@ -106,11 +95,10 @@ PANEL_EESCHEMA_SETTINGS_BASE::PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wx m_checkHVOrientation->SetValue(true); sbSizer11->Add( m_checkHVOrientation, 0, wxRIGHT|wxLEFT, 5 ); - m_moveWarpsCursor = new wxCheckBox( sbSizer11->GetStaticBox(), wxID_ANY, _("Warp mouse to origin of moved object"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer11->Add( m_moveWarpsCursor, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + m_mouseDragIsDrag = new wxCheckBox( sbSizer11->GetStaticBox(), wxID_ANY, _("Mouse drag performs drag (G) operation"), wxDefaultPosition, wxDefaultSize, 0 ); + m_mouseDragIsDrag->SetToolTip( _("If unchecked, mouse drag will perform move (M) operation") ); - m_moveTakesCursorAsOrigin = new wxCheckBox( sbSizer11->GetStaticBox(), wxID_ANY, _("Use cursor position as editing anchor"), wxDefaultPosition, wxDefaultSize, 0 ); - sbSizer11->Add( m_moveTakesCursorAsOrigin, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); + sbSizer11->Add( m_mouseDragIsDrag, 0, wxALL, 5 ); bLeftColumn->Add( sbSizer11, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); diff --git a/eeschema/dialogs/panel_eeschema_settings_base.fbp b/eeschema/dialogs/panel_eeschema_settings_base.fbp index 44613b9775..6bc9b6da1f 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.fbp +++ b/eeschema/dialogs/panel_eeschema_settings_base.fbp @@ -1241,177 +1241,6 @@ 0 - - 5 - wxLEFT|wxALIGN_CENTER_VERTICAL - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Mouse drag action - - 0 - - - 0 - - 1 - m_staticText161 - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - "Move" "Drag" "Rectanguar selection" - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_choiceMouseAction - 1 - - - protected - 1 - - Resizable - 2 - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnChooseUnits - - - - - - - - - - - - - - - - - - - - - - - - @@ -1517,7 +1346,7 @@ 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxALL 0 1 @@ -1548,7 +1377,7 @@ 0 0 wxID_ANY - Warp mouse to origin of moved object + Mouse drag performs drag (G) operation 0 @@ -1556,7 +1385,7 @@ 0 1 - m_moveWarpsCursor + m_mouseDragIsDrag 1 @@ -1567,97 +1396,9 @@ 1 - + ; forward_declare 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Use cursor position as editing anchor - - 0 - - - 0 - - 1 - m_moveTakesCursorAsOrigin - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - + If unchecked, mouse drag will perform move (M) operation wxFILTER_NONE wxDefaultValidator diff --git a/eeschema/dialogs/panel_eeschema_settings_base.h b/eeschema/dialogs/panel_eeschema_settings_base.h index d54faac714..9a0fb8394e 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.h +++ b/eeschema/dialogs/panel_eeschema_settings_base.h @@ -53,11 +53,8 @@ class PANEL_EESCHEMA_SETTINGS_BASE : public wxPanel wxStaticText* m_vPitchUnits; wxStaticText* m_staticText16; wxSpinCtrl* m_spinRepeatLabel; - wxStaticText* m_staticText161; - wxChoice* m_choiceMouseAction; wxCheckBox* m_checkHVOrientation; - wxCheckBox* m_moveWarpsCursor; - wxCheckBox* m_moveTakesCursorAsOrigin; + wxCheckBox* m_mouseDragIsDrag; wxCheckBox* m_checkAutoplaceFields; wxCheckBox* m_checkAutoplaceJustify; wxCheckBox* m_checkAutoplaceAlign; diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 80f1532741..917f4964aa 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -239,10 +239,7 @@ const wxChar RescueNeverShowEntry[] = wxT( "RescueNeverShow" ); const wxChar AutoplaceFieldsEntry[] = wxT( "AutoplaceFields" ); const wxChar AutoplaceJustifyEntry[] = wxT( "AutoplaceJustify" ); const wxChar AutoplaceAlignEntry[] = wxT( "AutoplaceAlign" ); -static const wxChar MoveWarpsCursorEntry[] = wxT( "MoveWarpsCursor" ); -static const wxChar MoveTakesCursorAsOriginEntry[] = wxT( "MoveTakesCursorAsOrigin" ); static const wxChar DragActionIsMoveEntry[] = wxT( "DragActionIsMove" ); -static const wxChar DragAlwaysSelectsEntry[] = wxT( "DragAlwaysSelects" ); static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" ); static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" ); static const wxChar DefaultWireWidthEntry[] = wxT( "DefaultWireWidth" ); @@ -330,10 +327,7 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) if( aCfg->Read( DefaultJctSizeEntry, &tmp ) ) SCH_JUNCTION::SetSymbolSize( (int) tmp ); - aCfg->Read( MoveWarpsCursorEntry, &m_moveWarpsCursor, true ); - aCfg->Read( MoveTakesCursorAsOriginEntry, &m_moveTakesCursorAsOrigin, false ); aCfg->Read( DragActionIsMoveEntry, &m_dragActionIsMove, true ); - aCfg->Read( DragAlwaysSelectsEntry, &m_dragAlwaysSelects, false ); aCfg->Read( ShowHiddenPinsEntry, &m_showAllPins, false ); aCfg->Read( HorzVertLinesOnlyEntry, &m_forceHVLines, true ); aCfg->Read( AutoplaceFieldsEntry, &m_autoplaceFields, true ); @@ -374,10 +368,7 @@ void SCH_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); - aCfg->Write( MoveWarpsCursorEntry, m_moveWarpsCursor ); - aCfg->Write( MoveTakesCursorAsOriginEntry, m_moveTakesCursorAsOrigin ); aCfg->Write( DragActionIsMoveEntry, m_dragActionIsMove ); - aCfg->Write( DragAlwaysSelectsEntry, m_dragAlwaysSelects ); aCfg->Write( DefaultBusWidthEntry, (long) GetDefaultBusThickness() ); aCfg->Write( DefaultWireWidthEntry, (long) GetDefaultWireThickness() ); aCfg->Write( DefaultJctSizeEntry, (long) SCH_JUNCTION::GetSymbolSize() ); diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index e522619d59..8b27f0cc94 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -91,11 +91,7 @@ protected: int m_repeatDeltaLabel; // the increment value of labels like bus members // when they are repeated bool m_showPinElectricalTypeName; - bool m_moveTakesCursorAsOrigin; // always take the cursor (instead of item origin) as - // the move anchor bool m_dragActionIsMove; // drag action defaults to move, otherwise it's drag - bool m_dragAlwaysSelects; // drag action selects items (and never drags/moves) - bool m_moveWarpsCursor; // cursor is warped to move/drag origin public: SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, @@ -160,18 +156,9 @@ public: */ const wxString GetZoomLevelIndicator() const override; - void SetMoveTakesCursorAsOrigin( bool aValue ) { m_moveTakesCursorAsOrigin = aValue; } - bool GetMoveTakesCursorAsOrigin() const { return m_moveTakesCursorAsOrigin; } - void SetDragActionIsMove( bool aValue ) { m_dragActionIsMove = aValue; } bool GetDragActionIsMove() const { return m_dragActionIsMove; } - void SetDragAlwaysSelects( bool aValue ) { m_dragAlwaysSelects = aValue; } - bool GetDragAlwaysSelects() const { return m_dragAlwaysSelects; } - - void SetMoveWarpsCursor( bool aValue ) { m_moveWarpsCursor = aValue; } - bool GetMoveWarpsCursor() const { return m_moveWarpsCursor; } - void SetPageSettings( const PAGE_INFO& aPageSettings ) override; const PAGE_INFO& GetPageSettings () const override; const wxSize GetPageSizeIU() const override; diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 040ab17047..f37163fedd 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -342,7 +342,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them else if( evt->IsDrag( BUT_LEFT ) ) { - if( m_additive || m_subtractive || m_exclusive_or || m_frame->GetDragAlwaysSelects() ) + if( m_additive || m_subtractive || m_exclusive_or || m_frame->GetDragSelects() ) { selectMultiple(); } diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index ec635bec0b..0fdac576ac 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -137,6 +137,7 @@ protected: // first invocation of a hotkey will just select the // relevant tool. bool m_dragSelects; // Prefer selection to dragging. + bool m_moveWarpsCursor; // cursor is warped to move/drag origin bool m_hasAutoSave; bool m_autoSaveState; int m_autoSaveInterval; // The auto save interval time in seconds. @@ -247,6 +248,12 @@ public: */ bool GetDragSelects() const { return m_dragSelects; } + /** + * Indicates that a move operation should warp the mouse pointer to the origin of the + * move object. This improves snapping, but some users are alergic to mouse warping. + */ + bool GetMoveWarpsCursor() const { return m_moveWarpsCursor; } + /** * Override the default process event handler to implement the auto save feature. * diff --git a/include/pgm_base.h b/include/pgm_base.h index 48f355d33f..89109b40e2 100644 --- a/include/pgm_base.h +++ b/include/pgm_base.h @@ -55,6 +55,7 @@ #define GAL_DISPLAY_OPTIONS_KEY wxT( "GalDisplayOptions" ) #define GAL_ANTIALIASING_MODE_KEY wxT( "OpenGLAntialiasingMode" ) #define CAIRO_ANTIALIASING_MODE_KEY wxT( "CairoAntialiasingMode" ) +#define WARP_MOUSE_ON_MOVE_KEY wxT( "MoveWarpsCursor" ) #define IMMEDIATE_ACTIONS_KEY wxT( "ImmediateActions" ) #define PREFER_SELECT_TO_DRAG_KEY wxT( "PreferSelectionToDragging" )