diff --git a/eeschema/dialogs/panel_eeschema_settings.cpp b/eeschema/dialogs/panel_eeschema_settings.cpp index 460ad8dfcf..03fa8dd3dd 100644 --- a/eeschema/dialogs/panel_eeschema_settings.cpp +++ b/eeschema/dialogs/panel_eeschema_settings.cpp @@ -51,6 +51,16 @@ 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 ); + return true; } @@ -78,6 +88,26 @@ 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; + } + return true; } diff --git a/eeschema/dialogs/panel_eeschema_settings_base.cpp b/eeschema/dialogs/panel_eeschema_settings_base.cpp index 17d14c2060..f6e8ba6d2d 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.cpp +++ b/eeschema/dialogs/panel_eeschema_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 5 2019) +// C++ code generated with wxFormBuilder (version Oct 17 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -11,16 +11,17 @@ 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, const wxString& name ) : wxPanel( parent, id, pos, size, style, name ) { wxBoxSizer* bPanelSizer; bPanelSizer = new wxBoxSizer( wxVERTICAL ); - + wxBoxSizer* bLeftColumn; bLeftColumn = new wxBoxSizer( wxVERTICAL ); - + wxFlexGridSizer* fgSizer3; fgSizer3 = new wxFlexGridSizer( 0, 3, 5, 5 ); fgSizer3->AddGrowableCol( 0 ); @@ -28,97 +29,120 @@ PANEL_EESCHEMA_SETTINGS_BASE::PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wx fgSizer3->AddGrowableCol( 2 ); fgSizer3->SetFlexibleDirection( wxBOTH ); fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - + m_staticText2 = new wxStaticText( this, wxID_ANY, _("&Measurement units:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText2->Wrap( -1 ); fgSizer3->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - + wxString m_choiceUnitsChoices[] = { _("inches"), _("millimeters") }; int m_choiceUnitsNChoices = sizeof( m_choiceUnitsChoices ) / sizeof( wxString ); m_choiceUnits = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceUnitsNChoices, m_choiceUnitsChoices, 0 ); m_choiceUnits->SetSelection( 0 ); fgSizer3->Add( m_choiceUnits, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - - + + fgSizer3->Add( 0, 0, 1, wxEXPAND, 3 ); - + m_textSizeLabel = new wxStaticText( this, wxID_ANY, _("Def&ault text size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_textSizeLabel->Wrap( -1 ); fgSizer3->Add( m_textSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - + m_textSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP ); fgSizer3->Add( m_textSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 10 ); - + m_textSizeUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_textSizeUnits->Wrap( -1 ); fgSizer3->Add( m_textSizeUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + m_hPitchLabel = new wxStaticText( this, wxID_ANY, _("&Horizontal pitch of repeated items:"), wxDefaultPosition, wxDefaultSize, 0 ); m_hPitchLabel->Wrap( -1 ); fgSizer3->Add( m_hPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - + m_hPitchCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP ); fgSizer3->Add( m_hPitchCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - + m_hPitchUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_hPitchUnits->Wrap( -1 ); fgSizer3->Add( m_hPitchUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + m_vPitchLabel = new wxStaticText( this, wxID_ANY, _("&Vertical pitch of repeated items:"), wxDefaultPosition, wxDefaultSize, 0 ); m_vPitchLabel->Wrap( -1 ); fgSizer3->Add( m_vPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - + m_vPitchCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP ); fgSizer3->Add( m_vPitchCtrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND, 5 ); - + m_vPitchUnits = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); m_vPitchUnits->Wrap( -1 ); fgSizer3->Add( m_vPitchUnits, 0, wxALIGN_CENTER_VERTICAL, 5 ); - + m_staticText16 = new wxStaticText( this, wxID_ANY, _("&Increment of repeated labels:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText16->Wrap( -1 ); fgSizer3->Add( m_staticText16, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 ); - + m_spinRepeatLabel = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS|wxSP_WRAP, -10, 10, 1 ); fgSizer3->Add( m_spinRepeatLabel, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 ); - - + + 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 ); - - wxBoxSizer* bSizer9; - bSizer9 = new wxBoxSizer( wxVERTICAL ); - - m_checkHVOrientation = new wxCheckBox( this, wxID_ANY, _("&Restrict buses and wires to H and V orientation"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer9->Add( m_checkHVOrientation, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - - m_footprintPreview = new wxCheckBox( this, wxID_ANY, _("Show footprint previews in symbol chooser"), wxDefaultPosition, wxDefaultSize, 0 ); - bSizer9->Add( m_footprintPreview, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); - - - bLeftColumn->Add( bSizer9, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); - + + wxStaticBoxSizer* sbSizer11; + sbSizer11 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Editing") ), wxVERTICAL ); + + m_checkHVOrientation = new wxCheckBox( sbSizer11->GetStaticBox(), wxID_ANY, _("&Restrict buses and wires to H and V orientation"), wxDefaultPosition, wxDefaultSize, 0 ); + 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_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 ); + + + bLeftColumn->Add( sbSizer11, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + wxStaticBoxSizer* sbSizer1; sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Symbol Field Automatic Placement") ), wxVERTICAL ); - + m_checkAutoplaceFields = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("A&utomatically place symbol fields"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer1->Add( m_checkAutoplaceFields, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - + m_checkAutoplaceJustify = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("A&llow field autoplace to change justification"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer1->Add( m_checkAutoplaceJustify, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - + m_checkAutoplaceAlign = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Al&ways align autoplaced fields to the 50 mil grid"), wxDefaultPosition, wxDefaultSize, 0 ); sbSizer1->Add( m_checkAutoplaceAlign, 0, wxEXPAND|wxALL, 5 ); - - - bLeftColumn->Add( sbSizer1, 0, wxTOP|wxEXPAND, 5 ); - - + + + bLeftColumn->Add( sbSizer1, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 ); + + wxBoxSizer* bSizer9; + bSizer9 = new wxBoxSizer( wxVERTICAL ); + + m_footprintPreview = new wxCheckBox( this, wxID_ANY, _("Show footprint previews in symbol chooser"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer9->Add( m_footprintPreview, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + + + bLeftColumn->Add( bSizer9, 0, wxTOP|wxBOTTOM|wxRIGHT, 5 ); + + bPanelSizer->Add( bLeftColumn, 0, wxRIGHT|wxLEFT, 5 ); - - + + this->SetSizer( bPanelSizer ); this->Layout(); bPanelSizer->Fit( this ); diff --git a/eeschema/dialogs/panel_eeschema_settings_base.fbp b/eeschema/dialogs/panel_eeschema_settings_base.fbp index 1cd762d3fb..8977cc7790 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.fbp +++ b/eeschema/dialogs/panel_eeschema_settings_base.fbp @@ -1348,20 +1348,210 @@ 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 + + + 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 + + + + + + + + + + + + + + + + + + + + + + + + 5 - wxTOP|wxBOTTOM|wxRIGHT - 0 - + wxEXPAND|wxTOP|wxBOTTOM + 1 + + wxID_ANY + Editing - bSizer9 + sbSizer11 wxVERTICAL + 1 none + 5 - wxBOTTOM|wxLEFT|wxRIGHT + wxRIGHT|wxLEFT 0 1 @@ -1377,7 +1567,7 @@ 1 0 - 0 + 1 1 1 @@ -1456,7 +1646,7 @@ 5 - wxBOTTOM|wxLEFT|wxRIGHT + wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 1 @@ -1487,7 +1677,7 @@ 0 0 wxID_ANY - Show footprint previews in symbol chooser + Warp mouse to origin of moved object 0 @@ -1495,7 +1685,7 @@ 0 1 - m_footprintPreview + m_moveWarpsCursor 1 @@ -1506,7 +1696,102 @@ 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 @@ -1553,7 +1838,7 @@ 5 - wxTOP|wxEXPAND + wxEXPAND|wxTOP|wxBOTTOM 0 wxID_ANY @@ -1853,115 +2138,16 @@ 5 - wxEXPAND - 1 - - wxID_ANY - Editing + wxTOP|wxBOTTOM|wxRIGHT + 0 + - sbSizer11 + bSizer9 wxVERTICAL - 1 none - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Warp mouse to origin of moved object(s) - - 0 - - - 0 - - 1 - m_moveWarpsCursor - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT + wxBOTTOM|wxLEFT|wxRIGHT 0 1 @@ -1992,7 +2178,7 @@ 0 0 wxID_ANY - Use cursor position as editing anchor + Show footprint previews in symbol chooser 0 @@ -2000,7 +2186,7 @@ 0 1 - m_moveTakesCursorAsOrigin + m_footprintPreview 1 @@ -2011,7 +2197,7 @@ 1 - + ; forward_declare 0 diff --git a/eeschema/dialogs/panel_eeschema_settings_base.h b/eeschema/dialogs/panel_eeschema_settings_base.h index cf1821b784..f808960f90 100644 --- a/eeschema/dialogs/panel_eeschema_settings_base.h +++ b/eeschema/dialogs/panel_eeschema_settings_base.h @@ -1,11 +1,12 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jan 5 2019) +// C++ code generated with wxFormBuilder (version Oct 17 2018) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#pragma once +#ifndef __PANEL_EESCHEMA_SETTINGS_BASE_H__ +#define __PANEL_EESCHEMA_SETTINGS_BASE_H__ #include #include @@ -29,15 +30,15 @@ /////////////////////////////////////////////////////////////////////////////// /// Class PANEL_EESCHEMA_SETTINGS_BASE /////////////////////////////////////////////////////////////////////////////// -class PANEL_EESCHEMA_SETTINGS_BASE : public wxPanel +class PANEL_EESCHEMA_SETTINGS_BASE : public wxPanel { DECLARE_EVENT_TABLE() private: - + // Private event handlers void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } - - + + protected: wxStaticText* m_staticText2; wxChoice* m_choiceUnits; @@ -52,20 +53,25 @@ 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_footprintPreview; + wxCheckBox* m_moveWarpsCursor; + wxCheckBox* m_moveTakesCursorAsOrigin; wxCheckBox* m_checkAutoplaceFields; wxCheckBox* m_checkAutoplaceJustify; wxCheckBox* m_checkAutoplaceAlign; - + wxCheckBox* m_footprintPreview; + // Virtual event handlers, overide them in your derived class virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); } - - + + public: - - PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); + + PANEL_EESCHEMA_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString ); ~PANEL_EESCHEMA_SETTINGS_BASE(); - + }; +#endif //__PANEL_EESCHEMA_SETTINGS_BASE_H__ diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h index dcded1a037..507ce90a20 100644 --- a/eeschema/sch_base_frame.h +++ b/eeschema/sch_base_frame.h @@ -92,6 +92,10 @@ protected: int m_repeatDeltaLabel; ///< the increment value of labels like bus members ///< when they are repeated bool m_showPinElectricalTypeName; + bool m_moveTakesCursorAsOrigin; ///< eemodern: always take the cursor (instead of item origin) as move anchor + bool m_dragActionIsMove; ///< eemodern: if true, drag action defaults to move, otherwise it's drag + bool m_dragAlwaysSelects; ///< eemodern: if true, drag action only selects items (and never drags/moves) + bool m_moveWarpsCursor; ///< eemodern: if true, cursor is warped to move/drag origin public: SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, @@ -166,6 +170,18 @@ 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/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 44dd45c03f..f1324aba9e 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -136,10 +136,6 @@ private: bool m_autoplaceJustify; ///< allow autoplace to change justification bool m_autoplaceAlign; ///< align autoplaced fields to the grid bool m_footprintPreview; ///< whether to show footprint previews - bool m_moveTakesCursorAsOrigin; ///< eemodern: always take the cursor (instead of item origin) as move anchor - bool m_dragActionIsMove; ///< eemodern: if true, drag action defaults to move, otherwise it's drag - bool m_dragAlwaysSelects; ///< eemodern: if true, drag action only selects items (and never drags/moves) - bool m_moveWarpsCursor; ///< eemodern: if true, cursor is warped to move/drag origin /// An index to the last find item in the found items list #m_foundItems. int m_foundItemIndex; @@ -210,18 +206,6 @@ public: void OnCloseWindow( wxCloseEvent& Event ); - 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; } - bool GetForceHVLines() const { return m_forceHVLines; } void SetForceHVLines( bool aForceHVdirection ) { m_forceHVLines = aForceHVdirection; } diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 69233ac5fe..dddd092b82 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -379,14 +379,14 @@ 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 ) ) { - bool stillEmpty = true; - if( m_selection.Empty() ) + bool empty = m_selection.Empty(); + if( empty ) { m_selection = RequestSelection( movableItems ); - stillEmpty = m_selection.Empty(); + empty = m_selection.Empty(); } - if( m_additive || m_subtractive || stillEmpty ) + if( m_additive || m_subtractive || empty || m_frame->GetDragAlwaysSelects() ) { selectMultiple(); } diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 20e4764041..b6904c395c 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -94,18 +94,6 @@ bool SCH_MOVE_TOOL::Init() } -void SCH_MOVE_TOOL::Reset( RESET_REASON aReason ) -{ - if( aReason == MODEL_RELOAD ) - { - m_moveInProgress = false; - m_moveOffset = { 0, 0 }; - - // Init variables used by every drawing tool - m_controls = getViewControls(); - m_frame = getEditFrame(); - } -} /* TODO - Tom/Jeff - add preferences option "Move origin: always cursor / item origin" @@ -149,12 +137,17 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) if( selection.Empty() ) return 0; - if( aEvent.IsAction( &EE_ACTIONS::move ) || aEvent.IsAction( &EE_ACTIONS::moveActivate ) ) + bool doMove = aEvent.IsAction( &EE_ACTIONS::move ) || + ( aEvent.IsAction( &EE_ACTIONS::moveActivate ) && m_frame->GetDragActionIsMove() ); + bool doDrag = aEvent.IsAction( &EE_ACTIONS::drag ) || + ( aEvent.IsAction( &EE_ACTIONS::moveActivate ) && !m_frame->GetDragActionIsMove() ); + + if( doMove ) { m_frame->SetToolID( ID_SCH_MOVE, wxCURSOR_DEFAULT, _( "Move Items" ) ); moveMode = true; } - else + else if ( doDrag ) { m_frame->SetToolID( ID_SCH_DRAG, wxCURSOR_DEFAULT, _( "Drag Items" ) ); moveMode = false; @@ -679,6 +672,7 @@ bool SCH_MOVE_TOOL::updateModificationPoint( SELECTION& aSelection ) void SCH_MOVE_TOOL::setTransitions() { + Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::moveActivate.MakeEvent() ); Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::move.MakeEvent() ); Go( &SCH_MOVE_TOOL::Main, EE_ACTIONS::drag.MakeEvent() ); }