From 87e71072b1ff01598337da507607c87f68e2c985 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 27 Nov 2021 11:52:36 +0000 Subject: [PATCH] Default line width to 0 in symbol editor. Also removes some atrophied settings for repeated non-pins in symbol editor (which only ever repeats pins). Fixes https://gitlab.com/kicad/code/kicad/issues/9776 --- .../dialogs/panel_sym_editing_options.cpp | 10 +- eeschema/dialogs/panel_sym_editing_options.h | 3 - .../panel_sym_editing_options_base.cpp | 22 -- .../panel_sym_editing_options_base.fbp | 372 ------------------ .../dialogs/panel_sym_editing_options_base.h | 6 - .../symbol_editor/symbol_editor_settings.cpp | 46 +-- .../symbol_editor/symbol_editor_settings.h | 2 - eeschema/tools/sch_edit_tool.cpp | 34 +- 8 files changed, 32 insertions(+), 463 deletions(-) diff --git a/eeschema/dialogs/panel_sym_editing_options.cpp b/eeschema/dialogs/panel_sym_editing_options.cpp index 5f69e7e95d..f07fb38550 100644 --- a/eeschema/dialogs/panel_sym_editing_options.cpp +++ b/eeschema/dialogs/panel_sym_editing_options.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Wayne Stambaugh - * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -38,9 +38,7 @@ PANEL_SYM_EDITING_OPTIONS::PANEL_SYM_EDITING_OPTIONS( SYMBOL_EDIT_FRAME* aFrame, m_textSize( aFrame, m_textSizeLabel, m_textSizeCtrl, m_textSizeUnits ), m_pinLength( aFrame, m_pinLengthLabel, m_pinLengthCtrl, m_pinLengthUnits ), m_pinNameSize( aFrame, m_pinNameSizeLabel, m_pinNameSizeCtrl, m_pinNameSizeUnits ), - m_pinNumberSize( aFrame, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits ), - m_hPitch( aFrame, m_hPitchLabel, m_hPitchCtrl, m_hPitchUnits ), - m_vPitch( aFrame, m_vPitchLabel, m_vPitchCtrl, m_vPitchUnits ) + m_pinNumberSize( aFrame, m_pinNumSizeLabel, m_pinNumSizeCtrl, m_pinNumSizeUnits ) {} @@ -53,8 +51,6 @@ bool PANEL_SYM_EDITING_OPTIONS::TransferDataToWindow() m_pinLength.SetValue( Mils2iu( settings->m_Defaults.pin_length ) ); m_pinNumberSize.SetValue( Mils2iu( settings->m_Defaults.pin_num_size ) ); m_pinNameSize.SetValue( Mils2iu( settings->m_Defaults.pin_name_size ) ); - m_hPitch.SetValue( Mils2iu( settings->m_Repeat.x_step ) ); - m_vPitch.SetValue( Mils2iu( settings->m_Repeat.y_step ) ); m_choicePinDisplacement->SetSelection( settings->m_Repeat.pin_step == 50 ? 1 : 0 ); m_spinRepeatLabel->SetValue( settings->m_Repeat.label_delta ); @@ -73,8 +69,6 @@ bool PANEL_SYM_EDITING_OPTIONS::TransferDataFromWindow() settings->m_Defaults.pin_length = Iu2Mils( (int) m_pinLength.GetValue() ); settings->m_Defaults.pin_num_size = Iu2Mils( (int) m_pinNumberSize.GetValue() ); settings->m_Defaults.pin_name_size = Iu2Mils( (int) m_pinNameSize.GetValue() ); - settings->m_Repeat.x_step = Iu2Mils( (int) m_hPitch.GetValue() ); - settings->m_Repeat.y_step = Iu2Mils( (int) m_vPitch.GetValue() ); settings->m_Repeat.label_delta = m_spinRepeatLabel->GetValue(); settings->m_Repeat.pin_step = m_choicePinDisplacement->GetSelection() == 1 ? 50 : 100; diff --git a/eeschema/dialogs/panel_sym_editing_options.h b/eeschema/dialogs/panel_sym_editing_options.h index 8c80515f13..4e73cd44fa 100644 --- a/eeschema/dialogs/panel_sym_editing_options.h +++ b/eeschema/dialogs/panel_sym_editing_options.h @@ -43,9 +43,6 @@ private: UNIT_BINDER m_pinLength; UNIT_BINDER m_pinNameSize; UNIT_BINDER m_pinNumberSize; - - UNIT_BINDER m_hPitch; - UNIT_BINDER m_vPitch; }; diff --git a/eeschema/dialogs/panel_sym_editing_options_base.cpp b/eeschema/dialogs/panel_sym_editing_options_base.cpp index 7a8ada2306..62319c68f1 100644 --- a/eeschema/dialogs/panel_sym_editing_options_base.cpp +++ b/eeschema/dialogs/panel_sym_editing_options_base.cpp @@ -108,28 +108,6 @@ PANEL_SYM_EDITING_OPTIONS_BASE::PANEL_SYM_EDITING_OPTIONS_BASE( wxWindow* parent fgSizer1->SetFlexibleDirection( wxBOTH ); fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_hPitchLabel = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("&Horizontal pitch:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_hPitchLabel->Wrap( -1 ); - fgSizer1->Add( m_hPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP, 5 ); - - m_hPitchCtrl = new wxTextCtrl( repeats->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS ); - fgSizer1->Add( m_hPitchCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); - - m_hPitchUnits = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); - m_hPitchUnits->Wrap( -1 ); - fgSizer1->Add( m_hPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT, 5 ); - - m_vPitchLabel = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("&Vertical pitch:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_vPitchLabel->Wrap( -1 ); - fgSizer1->Add( m_vPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - - m_vPitchCtrl = new wxTextCtrl( repeats->GetStaticBox(), wxID_ANY, _("100"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS ); - fgSizer1->Add( m_vPitchCtrl, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 ); - - m_vPitchUnits = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("mils"), wxDefaultPosition, wxDefaultSize, 0 ); - m_vPitchUnits->Wrap( -1 ); - fgSizer1->Add( m_vPitchUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 ); - m_pinPitchLabel = new wxStaticText( repeats->GetStaticBox(), wxID_ANY, _("&Pitch of repeated pins:"), wxDefaultPosition, wxDefaultSize, 0 ); m_pinPitchLabel->Wrap( -1 ); fgSizer1->Add( m_pinPitchLabel, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); diff --git a/eeschema/dialogs/panel_sym_editing_options_base.fbp b/eeschema/dialogs/panel_sym_editing_options_base.fbp index 38029d8545..e484320b2b 100644 --- a/eeschema/dialogs/panel_sym_editing_options_base.fbp +++ b/eeschema/dialogs/panel_sym_editing_options_base.fbp @@ -1147,378 +1147,6 @@ none 0 3 - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT|wxTOP - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Horizontal pitch: - 0 - - 0 - - - 0 - - 1 - m_hPitchLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_hPitchCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - 0 - - 0 - - - 0 - - 1 - m_hPitchUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - &Vertical pitch: - 0 - - 0 - - - 0 - - 1 - m_vPitchLabel - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - - 0 - - 1 - m_vPitchCtrl - 1 - - - protected - 1 - - Resizable - 1 - - wxSP_ARROW_KEYS - - 0 - - - wxFILTER_NONE - wxDefaultValidator - - 100 - - - - - - - 5 - wxALIGN_CENTER_VERTICAL|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - mils - 0 - - 0 - - - 0 - - 1 - m_vPitchUnits - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - - - - - -1 - - 5 wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT diff --git a/eeschema/dialogs/panel_sym_editing_options_base.h b/eeschema/dialogs/panel_sym_editing_options_base.h index 747f840ef1..3999ff842f 100644 --- a/eeschema/dialogs/panel_sym_editing_options_base.h +++ b/eeschema/dialogs/panel_sym_editing_options_base.h @@ -51,12 +51,6 @@ class PANEL_SYM_EDITING_OPTIONS_BASE : public wxPanel wxTextCtrl* m_pinNameSizeCtrl; wxStaticText* m_pinNameSizeUnits; wxCheckBox* m_cbShowPinElectricalType; - wxStaticText* m_hPitchLabel; - wxTextCtrl* m_hPitchCtrl; - wxStaticText* m_hPitchUnits; - wxStaticText* m_vPitchLabel; - wxTextCtrl* m_vPitchCtrl; - wxStaticText* m_vPitchUnits; wxStaticText* m_pinPitchLabel; wxChoice* m_choicePinDisplacement; wxStaticText* m_pinPitchUnits; diff --git a/eeschema/symbol_editor/symbol_editor_settings.cpp b/eeschema/symbol_editor/symbol_editor_settings.cpp index 2482295a25..f75696b814 100644 --- a/eeschema/symbol_editor/symbol_editor_settings.cpp +++ b/eeschema/symbol_editor/symbol_editor_settings.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * -* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. +* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -47,41 +47,38 @@ SYMBOL_EDITOR_SETTINGS::SYMBOL_EDITOR_SETTINGS() : SetLegacyFilename( "eeschema" ); m_params.emplace_back( new PARAM( "defaults.line_width", - &m_Defaults.line_width, DEFAULT_LINE_WIDTH_MILS ) ); + &m_Defaults.line_width, 0 ) ); m_params.emplace_back( new PARAM( "defaults.text_size", - &m_Defaults.text_size, DEFAULT_TEXT_SIZE ) ); + &m_Defaults.text_size, DEFAULT_TEXT_SIZE ) ); m_params.emplace_back( new PARAM( "defaults.pin_length", &m_Defaults.pin_length, DEFAULT_PIN_LENGTH ) ); m_params.emplace_back( new PARAM( "defaults.pin_name_size", - &m_Defaults.pin_name_size, DEFAULT_PINNAME_SIZE ) ); + &m_Defaults.pin_name_size, DEFAULT_PINNAME_SIZE ) ); m_params.emplace_back( new PARAM( "defaults.pin_num_size", - &m_Defaults.pin_num_size, DEFAULT_PINNUM_SIZE ) ); + &m_Defaults.pin_num_size, DEFAULT_PINNUM_SIZE ) ); m_params.emplace_back( new PARAM( "repeat.label_delta", &m_Repeat.label_delta, 1 ) ); m_params.emplace_back( new PARAM( "repeat.pin_step", &m_Repeat.pin_step, 100 ) ); - m_params.emplace_back( new PARAM( "repeat.x_step", &m_Repeat.x_step, 0 ) ); - - m_params.emplace_back( new PARAM( "repeat.y_step", &m_Repeat.y_step, 100 ) ); - m_params.emplace_back( new PARAM( "show_pin_electrical_type", - &m_ShowPinElectricalType, true ) ); + &m_ShowPinElectricalType, true ) ); - m_params.emplace_back( new PARAM( "lib_table_width", &m_LibWidth, 250 ) ); + m_params.emplace_back( new PARAM( "lib_table_width", + &m_LibWidth, 250 ) ); m_params.emplace_back( new PARAM( "edit_component_visible_columns", - &m_EditSymbolVisibleColumns, "0 1 2 3 4 5 6 7" ) ); + &m_EditSymbolVisibleColumns, "0 1 2 3 4 5 6 7" ) ); m_params.emplace_back( new PARAM( "pin_table_visible_columns", - &m_PinTableVisibleColumns, "0 1 2 3 4 8 9" ) ); + &m_PinTableVisibleColumns, "0 1 2 3 4 8 9" ) ); - m_params.emplace_back( - new PARAM( "use_eeschema_color_settings", &m_UseEeschemaColorSettings, true ) ); + m_params.emplace_back( new PARAM( "use_eeschema_color_settings", + &m_UseEeschemaColorSettings, true ) ); } @@ -104,22 +101,21 @@ bool SYMBOL_EDITOR_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) Set( gridSizePtr, 1 ); } - ret &= fromLegacy( aCfg, "DefaultWireWidth", "defaults.line_width" ); - ret &= fromLegacy( aCfg, "DefaultPinLength", "defaults.pin_length" ); - ret &= fromLegacy( aCfg, "LibeditPinNameSize", "defaults.pin_name_size" ); - ret &= fromLegacy( aCfg, "LibeditPinNumSize", "defaults.pin_num_size" ); + ret &= fromLegacy( aCfg, "DefaultWireWidth", "defaults.line_width" ); + ret &= fromLegacy( aCfg, "DefaultPinLength", "defaults.pin_length" ); + ret &= fromLegacy( aCfg, "LibeditPinNameSize", "defaults.pin_name_size" ); + ret &= fromLegacy( aCfg, "LibeditPinNumSize", "defaults.pin_num_size" ); - ret &= fromLegacy( aCfg, "LibeditRepeatLabelInc", "repeat.label_delta" ); - ret &= fromLegacy( aCfg, "LibeditPinRepeatStep", "repeat.pin_step" ); - ret &= fromLegacy( aCfg, "LibeditRepeatStepX", "repeat.x_step" ); - ret &= fromLegacy( aCfg, "LibeditRepeatStepY", "repeat.y_step" ); + ret &= fromLegacy( aCfg, "LibeditRepeatLabelInc", "repeat.label_delta" ); + ret &= fromLegacy( aCfg, "LibeditPinRepeatStep", "repeat.pin_step" ); + ret &= fromLegacy( aCfg, "LibeditRepeatStepX", "repeat.x_step" ); + ret &= fromLegacy( aCfg, "LibeditRepeatStepY", "repeat.y_step" ); ret &= fromLegacy( aCfg, "LibeditLibWidth", "lib_table_width" ); ret &= fromLegacy( aCfg, "LibeditShowPinElectricalType", "show_pin_electrical_type" ); ret &= fromLegacyString( aCfg, "LibEditFieldsShownColumns", "edit_component_visible_columns" ); - - ret &= fromLegacyString( aCfg, "PinTableShownColumns", "pin_table_visible_columns" ); + ret &= fromLegacyString( aCfg, "PinTableShownColumns", "pin_table_visible_columns" ); return ret; } diff --git a/eeschema/symbol_editor/symbol_editor_settings.h b/eeschema/symbol_editor/symbol_editor_settings.h index b837e12f56..ded7851639 100644 --- a/eeschema/symbol_editor/symbol_editor_settings.h +++ b/eeschema/symbol_editor/symbol_editor_settings.h @@ -44,8 +44,6 @@ public: { int label_delta; int pin_step; - int x_step; - int y_step; }; SYMBOL_EDITOR_SETTINGS(); diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 15dfe03cd2..6bda0149e2 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -875,36 +875,20 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) } else { - if( m_isSymbolEditor ) + EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings(); + + if( dynamic_cast( newItem ) ) { - auto* cfg = Pgm().GetSettingsManager().GetAppSettings(); + SCH_TEXT* text = static_cast( newItem ); - if( dynamic_cast( newItem ) ) - { - SCH_TEXT* text = static_cast( newItem ); - text->IncrementLabel( cfg->m_Repeat.label_delta ); - } + // If incrementing tries to go below zero, tell user why the value is repeated - newItem->Move( wxPoint( Mils2iu( cfg->m_Repeat.x_step ), - Mils2iu( cfg->m_Repeat.y_step ) ) ); + if( !text->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) ) + m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true ); } - else - { - EESCHEMA_SETTINGS* cfg = Pgm().GetSettingsManager().GetAppSettings(); - if( dynamic_cast( newItem ) ) - { - SCH_TEXT* text = static_cast( newItem ); - - // If incrementing tries to go below zero, tell user why the value is repeated - - if( !text->IncrementLabel( cfg->m_Drawing.repeat_label_increment ) ) - m_frame->ShowInfoBarWarning( _( "Label value cannot go below zero" ), true ); - } - - newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ), - Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) ); - } + newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ), + Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) ); } newItem->SetFlags( IS_NEW );