diff --git a/eeschema/dialogs/panel_eeschema_editing_options.cpp b/eeschema/dialogs/panel_eeschema_editing_options.cpp index 0f1ea82aa6..20943b0d28 100644 --- a/eeschema/dialogs/panel_eeschema_editing_options.cpp +++ b/eeschema/dialogs/panel_eeschema_editing_options.cpp @@ -31,6 +31,42 @@ #include +static int arcEditModeToComboIndex( ARC_EDIT_MODE aMode ) +{ + switch( aMode ) + { + case ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS: + return 0; + case ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION: + return 1; + case ARC_EDIT_MODE::KEEP_CENTER_ENDS_ADJUST_ANGLE: + return 2; + // No default + } + wxFAIL_MSG( "Invalid ARC_EDIT_MODE" ); + return 0; +}; + + +static ARC_EDIT_MODE arcEditModeToEnum( int aIndex ) +{ + switch( aIndex ) + { + case 0: + return ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS; + case 1: + return ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION; + case 2: + return ARC_EDIT_MODE::KEEP_CENTER_ENDS_ADJUST_ANGLE; + default: + wxFAIL_MSG( wxString::Format( "Invalid index for ARC_EDIT_MODE: %d", aIndex ) ); + break; + } + + return ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS; +}; + + PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS( wxWindow* aWindow, UNITS_PROVIDER* aUnitsProvider, wxWindow* aEventSource ) : @@ -77,6 +113,7 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC false ); m_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode ); + m_choiceArcMode->SetSelection( arcEditModeToComboIndex( aCfg->m_Drawing.arc_edit_mode ) ); m_footprintPreview->SetValue( aCfg->m_Appearance.footprint_preview ); m_neverShowRescue->SetValue( aCfg->m_RescueNeverShow ); @@ -119,6 +156,7 @@ bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow() cfg->m_Drawing.repeat_label_increment = m_spinLabelRepeatStep->GetValue(); cfg->m_Drawing.line_mode = m_choiceLineMode->GetSelection(); + cfg->m_Drawing.arc_edit_mode = arcEditModeToEnum( m_choiceArcMode->GetSelection() ); cfg->m_Appearance.footprint_preview = m_footprintPreview->GetValue(); cfg->m_RescueNeverShow = m_neverShowRescue->GetValue(); @@ -142,5 +180,3 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::ResetPanel() loadEEschemaSettings( &cfg ); } - - diff --git a/eeschema/dialogs/panel_eeschema_editing_options_base.cpp b/eeschema/dialogs/panel_eeschema_editing_options_base.cpp index 34432ea4ee..d4084e70b6 100644 --- a/eeschema/dialogs/panel_eeschema_editing_options_base.cpp +++ b/eeschema/dialogs/panel_eeschema_editing_options_base.cpp @@ -43,6 +43,16 @@ PANEL_EESCHEMA_EDITING_OPTIONS_BASE::PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWind bSizer5->Add( bSizer61, 1, wxEXPAND, 5 ); + m_staticTextArcEdit = new wxStaticText( this, wxID_ANY, _("Arc editing mode:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextArcEdit->Wrap( -1 ); + bSizer5->Add( m_staticTextArcEdit, 0, wxALL, 5 ); + + wxString m_choiceArcModeChoices[] = { _("Keep center, adjust radius"), _("Keep endpoints or direction of starting point"), _("Keep center and radius, adjust endpoints") }; + int m_choiceArcModeNChoices = sizeof( m_choiceArcModeChoices ) / sizeof( wxString ); + m_choiceArcMode = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceArcModeNChoices, m_choiceArcModeChoices, 0 ); + m_choiceArcMode->SetSelection( 1 ); + bSizer5->Add( m_choiceArcMode, 0, wxALL|wxEXPAND, 5 ); + m_mouseDragIsDrag = new wxCheckBox( this, wxID_ANY, _("Mouse drag performs Drag (G) operation"), wxDefaultPosition, wxDefaultSize, 0 ); m_mouseDragIsDrag->SetToolTip( _("If unchecked, mouse drag will perform move (M) operation") ); diff --git a/eeschema/dialogs/panel_eeschema_editing_options_base.fbp b/eeschema/dialogs/panel_eeschema_editing_options_base.fbp index f58649d1db..9a24260c09 100644 --- a/eeschema/dialogs/panel_eeschema_editing_options_base.fbp +++ b/eeschema/dialogs/panel_eeschema_editing_options_base.fbp @@ -337,6 +337,133 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Arc editing mode: + 0 + + 0 + + + 0 + + 1 + m_staticTextArcEdit + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + "Keep center, adjust radius" "Keep endpoints or direction of starting point" "Keep center and radius, adjust endpoints" + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceArcMode + 1 + + + protected + 1 + + Resizable + 1 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxLEFT|wxRIGHT|wxTOP diff --git a/eeschema/dialogs/panel_eeschema_editing_options_base.h b/eeschema/dialogs/panel_eeschema_editing_options_base.h index 0e08fc9472..533ed3a043 100644 --- a/eeschema/dialogs/panel_eeschema_editing_options_base.h +++ b/eeschema/dialogs/panel_eeschema_editing_options_base.h @@ -42,6 +42,8 @@ class PANEL_EESCHEMA_EDITING_OPTIONS_BASE : public RESETTABLE_PANEL wxStaticLine* m_staticline3; wxStaticText* m_staticText24; wxChoice* m_choiceLineMode; + wxStaticText* m_staticTextArcEdit; + wxChoice* m_choiceArcMode; wxCheckBox* m_mouseDragIsDrag; wxCheckBox* m_cbAutoStartWires; wxCheckBox* m_escClearsNetHighlight; diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index 1a0efdbe76..026fe05346 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -359,6 +359,10 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : m_params.emplace_back( new PARAM( "drawing.line_mode", &m_Drawing.line_mode, LINE_MODE::LINE_MODE_90 ) ); + m_params.emplace_back( new PARAM( "editing.arc_edit_mode", + reinterpret_cast( &m_Drawing.arc_edit_mode ), + static_cast( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ) ) ); + m_params.emplace_back( new PARAM( "drawing.auto_start_wires", &m_Drawing.auto_start_wires, true ) ); diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h index 50d6600d1e..29b3af8bcb 100644 --- a/eeschema/eeschema_settings.h +++ b/eeschema/eeschema_settings.h @@ -168,6 +168,7 @@ public: POWER_SYMBOLS new_power_symbols; wxString field_names; int line_mode; + ARC_EDIT_MODE arc_edit_mode; int repeat_label_increment; bool intersheets_ref_show; bool intersheets_ref_own_page; diff --git a/eeschema/tools/sch_point_editor.cpp b/eeschema/tools/sch_point_editor.cpp index d8fe1e159e..2fbc08b5c6 100644 --- a/eeschema/tools/sch_point_editor.cpp +++ b/eeschema/tools/sch_point_editor.cpp @@ -853,7 +853,7 @@ void SCH_POINT_EDITOR::makePointsAndBehavior( EDA_ITEM* aItem ) { case SHAPE_T::ARC: m_editBehavior = std::make_unique( - *shape, ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS, *getViewControls() ); + *shape, m_frame->eeconfig()->m_Drawing.arc_edit_mode, *getViewControls() ); break; case SHAPE_T::CIRCLE: m_editBehavior = std::make_unique( *shape );