From 87ccb2abc0382d13aa9cfcb5d8b1a835f62da886 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 12 Aug 2025 11:33:08 -0700 Subject: [PATCH] Move Annotation preferences (most) to schematic setup The scope, recursion, reset options and message filters remain in the user preferences. Others including numbering, sort order and reuse are schematic preferences. Also, the oddball subunit display remains here but it doesn't really belong in annotation. Fixes https://gitlab.com/kicad/code/kicad/-/issues/17942 --- common/eda_base_frame.cpp | 1 - eeschema/CMakeLists.txt | 2 - eeschema/dialogs/dialog_annotate.cpp | 69 +-- .../dialog_sch_import_settings_base.cpp | 5 +- .../dialog_sch_import_settings_base.fbp | 187 +++++--- .../dialogs/dialog_sch_import_settings_base.h | 3 +- eeschema/dialogs/dialog_schematic_setup.cpp | 10 +- .../panel_eeschema_annotation_options.cpp | 109 +++-- .../panel_eeschema_annotation_options.h | 6 +- ...panel_eeschema_annotation_options_base.cpp | 30 +- ...panel_eeschema_annotation_options_base.fbp | 235 +++++++++- .../panel_eeschema_annotation_options_base.h | 14 +- .../panel_eeschema_editing_options.cpp | 2 + .../panel_eeschema_editing_options_base.cpp | 7 +- .../panel_eeschema_editing_options_base.fbp | 67 ++- .../panel_eeschema_editing_options_base.h | 3 +- eeschema/dialogs/panel_setup_annotation.cpp | 98 ---- eeschema/dialogs/panel_setup_annotation.h | 48 -- .../dialogs/panel_setup_annotation_base.cpp | 66 --- .../dialogs/panel_setup_annotation_base.fbp | 421 ------------------ .../dialogs/panel_setup_annotation_base.h | 49 -- eeschema/eeschema.cpp | 3 - eeschema/eeschema_settings.cpp | 7 - eeschema/eeschema_settings.h | 2 - eeschema/sch_edit_frame.cpp | 3 +- eeschema/schematic_settings.cpp | 8 + eeschema/schematic_settings.h | 3 + eeschema/tools/sch_drawing_tools.cpp | 19 +- eeschema/tools/sch_edit_tool.cpp | 13 +- eeschema/tools/sch_editor_control.cpp | 25 +- eeschema/tools/sch_editor_control.h | 1 - include/frame_type.h | 1 - 32 files changed, 622 insertions(+), 895 deletions(-) delete mode 100644 eeschema/dialogs/panel_setup_annotation.cpp delete mode 100644 eeschema/dialogs/panel_setup_annotation.h delete mode 100644 eeschema/dialogs/panel_setup_annotation_base.cpp delete mode 100644 eeschema/dialogs/panel_setup_annotation_base.fbp delete mode 100644 eeschema/dialogs/panel_setup_annotation_base.h diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index 97344ca353..6c5672fa5a 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -1288,7 +1288,6 @@ void EDA_BASE_FRAME::ShowPreferences( wxString aStartPage, wxString aStartParent book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_DISP_OPTIONS ), _( "Display Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_GRIDS ), _( "Grids" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_EDIT_OPTIONS ), _( "Editing Options" ) ); - book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_ANNO_OPTIONS ), _( "Annotation Options" ) ); book->AddLazySubPage( LAZY_CTOR( PANEL_SCH_COLORS ), _( "Colors" ) ); if( ADVANCED_CFG::GetCfg().m_ConfigurableToolbars ) diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 96342b23f7..66ae33ba4f 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -176,8 +176,6 @@ set( EESCHEMA_DLGS dialogs/panel_eeschema_annotation_options_base.cpp dialogs/panel_eeschema_editing_options.cpp dialogs/panel_eeschema_editing_options_base.cpp - dialogs/panel_setup_annotation.cpp - dialogs/panel_setup_annotation_base.cpp dialogs/panel_setup_buses.cpp dialogs/panel_setup_buses_base.cpp dialogs/panel_setup_formatting.cpp diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp index 3c5cb64808..ebde35dbde 100644 --- a/eeschema/dialogs/dialog_annotate.cpp +++ b/eeschema/dialogs/dialog_annotate.cpp @@ -131,11 +131,10 @@ DIALOG_ANNOTATE::~DIALOG_ANNOTATE() // We still save/restore to config (instead of letting DIALOG_SHIM do it) because we also // allow editing of these settings in preferences. + SCHEMATIC_SETTINGS& schSettings = m_Parent->Schematic().Settings(); EESCHEMA_SETTINGS* cfg = static_cast( Kiface().KifaceSettings() ); - cfg->m_AnnotatePanel.sort_order = GetSortOrder(); - cfg->m_AnnotatePanel.method = GetAnnotateAlgo(); - cfg->m_AnnotatePanel.options = m_rbOptions->GetSelection(); + schSettings.m_AnnotateMethod = m_rbOptions->GetSelection(); if( m_rbScope_Schematic->IsEnabled() ) { @@ -143,24 +142,35 @@ DIALOG_ANNOTATE::~DIALOG_ANNOTATE() cfg->m_AnnotatePanel.recursive = m_checkRecursive->GetValue(); } - cfg->m_AnnotatePanel.messages_filter = m_MessageWindow->GetVisibleSeverities(); - - // Get the "start annotation after" value from dialog and update project settings if changed + int sort = GetSortOrder(); + int method = GetAnnotateAlgo(); int startNum = GetStartNumber(); if( SCH_EDIT_FRAME* schFrame = dynamic_cast( m_parentFrame ) ) { SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings(); + bool modified = false; - // If the user has updated the start annotation number then update the project file. - // We manually update the project file here in case the user has changed the value - // and just clicked the "Close" button on the annotation dialog. + if( projSettings.m_AnnotateSortOrder != sort ) + { + projSettings.m_AnnotateSortOrder = sort; + modified = true; + } + + if( projSettings.m_AnnotateMethod != method ) + { + projSettings.m_AnnotateMethod = method; + modified = true; + } if( projSettings.m_AnnotateStartNum != startNum ) { projSettings.m_AnnotateStartNum = startNum; - schFrame->OnModify(); + modified = true; } + + if( modified ) + schFrame->OnModify(); } } @@ -169,7 +179,6 @@ bool DIALOG_ANNOTATE::TransferDataToWindow() { // We still save/restore to config (instead of letting DIALOG_SHIM do it) because we also // allow editing of these settings in preferences. - EESCHEMA_SETTINGS* cfg = static_cast( Kiface().KifaceSettings() ); if( m_rbScope_Schematic->IsEnabled() ) @@ -187,31 +196,27 @@ bool DIALOG_ANNOTATE::TransferDataToWindow() m_rbOptions->SetSelection( cfg->m_AnnotatePanel.options ); - switch( cfg->m_AnnotatePanel.sort_order ) - { - default: - case SORT_BY_X_POSITION: m_rbSortBy_X_Position->SetValue( true ); break; - case SORT_BY_Y_POSITION: m_rbSortBy_Y_Position->SetValue( true ); break; - } - - switch( cfg->m_AnnotatePanel.method ) - { - default: - case INCREMENTAL_BY_REF: m_rbFirstFree->SetValue( true ); break; - case SHEET_NUMBER_X_100: m_rbSheetX100->SetValue( true ); break; - case SHEET_NUMBER_X_1000: m_rbSheetX1000->SetValue( true ); break; - } - - int annotateStartNum = 0; // Default "start after" value for annotation - - // See if we can get a "start after" value from the project settings if( SCH_EDIT_FRAME* schFrame = dynamic_cast( m_parentFrame ) ) { SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings(); - annotateStartNum = projSettings.m_AnnotateStartNum; - } - m_textNumberAfter->SetValue( wxString::Format( wxT( "%d" ), annotateStartNum ) ); + switch( projSettings.m_AnnotateSortOrder ) + { + default: + case SORT_BY_X_POSITION: m_rbSortBy_X_Position->SetValue( true ); break; + case SORT_BY_Y_POSITION: m_rbSortBy_Y_Position->SetValue( true ); break; + } + + switch( projSettings.m_AnnotateMethod ) + { + default: + case INCREMENTAL_BY_REF: m_rbFirstFree->SetValue( true ); break; + case SHEET_NUMBER_X_100: m_rbSheetX100->SetValue( true ); break; + case SHEET_NUMBER_X_1000: m_rbSheetX1000->SetValue( true ); break; + } + + m_textNumberAfter->SetValue( wxString::Format( wxT( "%d" ), projSettings.m_AnnotateStartNum ) ); + } return true; } diff --git a/eeschema/dialogs/dialog_sch_import_settings_base.cpp b/eeschema/dialogs/dialog_sch_import_settings_base.cpp index 3aece62d7f..8b388aea4d 100644 --- a/eeschema/dialogs/dialog_sch_import_settings_base.cpp +++ b/eeschema/dialogs/dialog_sch_import_settings_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -48,6 +48,9 @@ DIALOG_SCH_IMPORT_SETTINGS_BASE::DIALOG_SCH_IMPORT_SETTINGS_BASE( wxWindow* pare m_FormattingOpt = new wxCheckBox( this, wxID_ANY, _("Formatting preferences"), wxDefaultPosition, wxDefaultSize, 0 ); bmiddleSizer->Add( m_FormattingOpt, 0, wxALL, 5 ); + m_annotationOpt = new wxCheckBox( this, wxID_ANY, _("Annotation preferences"), wxDefaultPosition, wxDefaultSize, 0 ); + bmiddleSizer->Add( m_annotationOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + m_FieldNameTemplatesOpt = new wxCheckBox( this, wxID_ANY, _("Field name templates"), wxDefaultPosition, wxDefaultSize, 0 ); bmiddleSizer->Add( m_FieldNameTemplatesOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 ); diff --git a/eeschema/dialogs/dialog_sch_import_settings_base.fbp b/eeschema/dialogs/dialog_sch_import_settings_base.fbp index efd9a851b5..bf5d4ed808 100644 --- a/eeschema/dialogs/dialog_sch_import_settings_base.fbp +++ b/eeschema/dialogs/dialog_sch_import_settings_base.fbp @@ -1,34 +1,36 @@ - + - C++ - 1 - source_name - 0 - 0 + + 1 + connect + none + + + 0 + 1 res UTF-8 - connect dialog_sch_import_settings_base 1000 - none - - 1 + 1 + UI dialog_import_settings_base - . - + 0 + source_name + 1 + 0 + source_name + + + 1 1 - 1 - 1 - 1 - UI - 0 - 1 0 + 0 0 wxAUI_MGR_DEFAULT @@ -80,10 +82,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -142,10 +144,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -207,10 +209,10 @@ 1 1 1 - + 0 - - + 0 + 0 0 @@ -293,10 +295,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -355,10 +357,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -411,6 +413,71 @@ + + 5 + wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Annotation preferences + + 0 + + + 0 + + 1 + m_annotationOpt + 1 + + + public + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxBOTTOM|wxRIGHT|wxLEFT @@ -420,10 +487,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -485,10 +552,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -550,10 +617,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -615,10 +682,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -680,10 +747,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -745,10 +812,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -810,10 +877,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -875,10 +942,10 @@ 1 1 1 - + 0 - - + 0 + 0 @@ -951,10 +1018,10 @@ 1 1 1 - + 0 - - + 0 + 0 0 diff --git a/eeschema/dialogs/dialog_sch_import_settings_base.h b/eeschema/dialogs/dialog_sch_import_settings_base.h index 5f00886ca7..e61b295af4 100644 --- a/eeschema/dialogs/dialog_sch_import_settings_base.h +++ b/eeschema/dialogs/dialog_sch_import_settings_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -55,6 +55,7 @@ class DIALOG_SCH_IMPORT_SETTINGS_BASE : public DIALOG_SHIM public: wxCheckBox* m_FormattingOpt; + wxCheckBox* m_annotationOpt; wxCheckBox* m_FieldNameTemplatesOpt; wxCheckBox* m_BomPresetsOpt; wxCheckBox* m_BomFmtPresetsOpt; diff --git a/eeschema/dialogs/dialog_schematic_setup.cpp b/eeschema/dialogs/dialog_schematic_setup.cpp index dbe3ec8222..bdf69f1090 100644 --- a/eeschema/dialogs/dialog_schematic_setup.cpp +++ b/eeschema/dialogs/dialog_schematic_setup.cpp @@ -22,10 +22,10 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -67,7 +67,7 @@ DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) : m_treebook->AddLazySubPage( [this]( wxWindow* aParent ) -> wxWindow* { - return new PANEL_SETUP_ANNOTATION( aParent, m_frame ); + return new PANEL_EESCHEMA_ANNOTATION_OPTIONS( aParent, m_frame ); }, _( "Annotation" ) ); m_fieldNameTemplatesPage = m_treebook->GetPageCount(); @@ -245,6 +245,12 @@ void DIALOG_SCHEMATIC_SETUP::onAuxiliaryAction( wxCommandEvent& event ) ->ImportBomFmtPresetsFrom( *file.m_SchematicSettings ); } + if( importDlg.m_annotationOpt->GetValue() ) + { + static_cast( m_treebook->ResolvePage( m_annotationPage ) ) + ->ImportSettingsFrom( *file.m_SchematicSettings ); + } + if( importDlg.m_BusAliasesOpt->GetValue() ) { // The bus aliases are stored on individual sheets, so we have to load the whole diff --git a/eeschema/dialogs/panel_eeschema_annotation_options.cpp b/eeschema/dialogs/panel_eeschema_annotation_options.cpp index 829b4290fd..91e97bca0f 100644 --- a/eeschema/dialogs/panel_eeschema_annotation_options.cpp +++ b/eeschema/dialogs/panel_eeschema_annotation_options.cpp @@ -23,9 +23,9 @@ */ #include +#include #include #include -#include #include #include #include @@ -42,68 +42,93 @@ PANEL_EESCHEMA_ANNOTATION_OPTIONS::PANEL_EESCHEMA_ANNOTATION_OPTIONS( } -void PANEL_EESCHEMA_ANNOTATION_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aCfg ) +void PANEL_EESCHEMA_ANNOTATION_OPTIONS::loadEEschemaSettings( SCHEMATIC_SETTINGS* aCfg ) { - m_checkAutoAnnotate->SetValue( aCfg->m_AnnotatePanel.automatic ); + int annotateStartNum = aCfg->m_AnnotateStartNum; - switch( aCfg->m_AnnotatePanel.sort_order ) + switch( aCfg->m_AnnotateSortOrder ) { default: - case 0: m_rbSortBy_X_Position->SetValue( true ); break; - case 1: m_rbSortBy_Y_Position->SetValue( true ); break; + case SORT_BY_X_POSITION: m_rbSortBy_X_Position->SetValue( true ); break; + case SORT_BY_Y_POSITION: m_rbSortBy_Y_Position->SetValue( true ); break; } - switch( aCfg->m_AnnotatePanel.method ) + switch( aCfg->m_AnnotateMethod ) { default: - case 0: m_rbFirstFree->SetValue( true ); break; - case 1: m_rbSheetX100->SetValue( true ); break; - case 2: m_rbSheetX1000->SetValue( true ); break; - } - - int annotateStartNum = 0; // Default "start after" value for annotation - - // See if we can get a "start after" value from the project settings - SCH_EDIT_FRAME* schFrame = dynamic_cast( m_schSettingsProvider ); - - if( schFrame ) - { - SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings(); - annotateStartNum = projSettings.m_AnnotateStartNum; + case INCREMENTAL_BY_REF: m_rbFirstFree->SetValue( true ); break; + case SHEET_NUMBER_X_100: m_rbSheetX100->SetValue( true ); break; + case SHEET_NUMBER_X_1000: m_rbSheetX1000->SetValue( true ); break; } m_textNumberAfter->SetValue( wxString::Format( wxT( "%d" ), annotateStartNum ) ); + + if( aCfg->m_SubpartFirstId == 'A' ) + { + switch( aCfg->m_SubpartIdSeparator ) + { + default: + case 0: m_choiceSeparatorRefId->SetSelection( 0 ); break; + case '.': m_choiceSeparatorRefId->SetSelection( 1 ); break; + case '-': m_choiceSeparatorRefId->SetSelection( 2 ); break; + case '_': m_choiceSeparatorRefId->SetSelection( 3 ); break; + } + } + else + { + switch( aCfg->m_SubpartIdSeparator ) + { + default: + case '.': m_choiceSeparatorRefId->SetSelection( 4 ); break; + case '-': m_choiceSeparatorRefId->SetSelection( 5 ); break; + case '_': m_choiceSeparatorRefId->SetSelection( 6 ); break; + } + } + + m_checkReuseRefdes->SetValue( aCfg->m_refDesTracker->GetReuseRefDes() ); } bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataToWindow() { - loadEEschemaSettings( GetAppSettings( "eeschema" ) ); + if( SCH_EDIT_FRAME* schFrame = dynamic_cast( m_schSettingsProvider ) ) + loadEEschemaSettings( &schFrame->Schematic().Settings() ); + return true; } bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataFromWindow() { - if( EESCHEMA_SETTINGS* cfg = GetAppSettings( "eeschema" ) ) - { - cfg->m_AnnotatePanel.automatic = m_checkAutoAnnotate->GetValue(); - - cfg->m_AnnotatePanel.sort_order = m_rbSortBy_Y_Position->GetValue() ? ANNOTATE_ORDER_T::SORT_BY_Y_POSITION - : ANNOTATE_ORDER_T::SORT_BY_X_POSITION; - - if( m_rbSheetX100->GetValue() ) - cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::SHEET_NUMBER_X_100; - else if( m_rbSheetX1000->GetValue() ) - cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::SHEET_NUMBER_X_1000; - else - cfg->m_AnnotatePanel.method = ANNOTATE_ALGO_T::INCREMENTAL_BY_REF; - } - if( SCH_EDIT_FRAME* schFrame = dynamic_cast( m_schSettingsProvider ) ) { SCHEMATIC_SETTINGS& projSettings = schFrame->Schematic().Settings(); + + projSettings.m_AnnotateSortOrder = m_rbSortBy_Y_Position->GetValue() ? + ANNOTATE_ORDER_T::SORT_BY_Y_POSITION : ANNOTATE_ORDER_T::SORT_BY_X_POSITION; + + if( m_rbSheetX100->GetValue() ) + projSettings.m_AnnotateMethod = ANNOTATE_ALGO_T::SHEET_NUMBER_X_100; + else if( m_rbSheetX1000->GetValue() ) + projSettings.m_AnnotateMethod = ANNOTATE_ALGO_T::SHEET_NUMBER_X_1000; + else + projSettings.m_AnnotateMethod = ANNOTATE_ALGO_T::INCREMENTAL_BY_REF; + projSettings.m_AnnotateStartNum = EDA_UNIT_UTILS::UI::ValueFromString( m_textNumberAfter->GetValue() ); + projSettings.m_refDesTracker->SetReuseRefDes( m_checkReuseRefdes->GetValue() ); + + switch( m_choiceSeparatorRefId->GetSelection() ) + { + default: + case 0: projSettings.m_SubpartFirstId = 'A'; projSettings.m_SubpartIdSeparator = 0; break; + case 1: projSettings.m_SubpartFirstId = 'A'; projSettings.m_SubpartIdSeparator = '.'; break; + case 2: projSettings.m_SubpartFirstId = 'A'; projSettings.m_SubpartIdSeparator = '-'; break; + case 3: projSettings.m_SubpartFirstId = 'A'; projSettings.m_SubpartIdSeparator = '_'; break; + case 4: projSettings.m_SubpartFirstId = '1'; projSettings.m_SubpartIdSeparator = '.'; break; + case 5: projSettings.m_SubpartFirstId = '1'; projSettings.m_SubpartIdSeparator = '-'; break; + case 6: projSettings.m_SubpartFirstId = '1'; projSettings.m_SubpartIdSeparator = '_'; break; + } + } return true; @@ -112,8 +137,12 @@ bool PANEL_EESCHEMA_ANNOTATION_OPTIONS::TransferDataFromWindow() void PANEL_EESCHEMA_ANNOTATION_OPTIONS::ResetPanel() { - EESCHEMA_SETTINGS cfg; - cfg.Load(); // Loading without a file will init to defaults - + SCHEMATIC_SETTINGS cfg( nullptr, "" ); loadEEschemaSettings( &cfg ); } + + +void PANEL_EESCHEMA_ANNOTATION_OPTIONS::ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings ) +{ + loadEEschemaSettings( &aSettings ); +} \ No newline at end of file diff --git a/eeschema/dialogs/panel_eeschema_annotation_options.h b/eeschema/dialogs/panel_eeschema_annotation_options.h index 19edf525cc..9c51bff43f 100644 --- a/eeschema/dialogs/panel_eeschema_annotation_options.h +++ b/eeschema/dialogs/panel_eeschema_annotation_options.h @@ -25,7 +25,7 @@ #include "panel_eeschema_annotation_options_base.h" class EDA_BASE_FRAME; -class EESCHEMA_SETTINGS; +class SCHEMATIC_SETTINGS; class PANEL_EESCHEMA_ANNOTATION_OPTIONS : public PANEL_EESCHEMA_ANNOTATION_OPTIONS_BASE @@ -38,8 +38,10 @@ public: void ResetPanel() override; + void ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings ); + private: - void loadEEschemaSettings( EESCHEMA_SETTINGS* aCfg ); + void loadEEschemaSettings( SCHEMATIC_SETTINGS* aCfg ); EDA_BASE_FRAME* m_schSettingsProvider; }; diff --git a/eeschema/dialogs/panel_eeschema_annotation_options_base.cpp b/eeschema/dialogs/panel_eeschema_annotation_options_base.cpp index 053776a6a8..57c2b5aa7d 100644 --- a/eeschema/dialogs/panel_eeschema_annotation_options_base.cpp +++ b/eeschema/dialogs/panel_eeschema_annotation_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -17,9 +17,28 @@ PANEL_EESCHEMA_ANNOTATION_OPTIONS_BASE::PANEL_EESCHEMA_ANNOTATION_OPTIONS_BASE( wxBoxSizer* bLeftColumn; bLeftColumn = new wxBoxSizer( wxVERTICAL ); - m_checkAutoAnnotate = new wxCheckBox( this, wxID_ANY, _("Automatically annotate symbols"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkAutoAnnotate->SetValue(true); - bLeftColumn->Add( m_checkAutoAnnotate, 0, wxTOP|wxLEFT, 12 ); + m_orderLabel1 = new wxStaticText( this, wxID_ANY, _("Units"), wxDefaultPosition, wxDefaultSize, 0 ); + m_orderLabel1->Wrap( -1 ); + bLeftColumn->Add( m_orderLabel1, 0, wxLEFT|wxRIGHT|wxTOP, 13 ); + + wxBoxSizer* bSizer5; + bSizer5 = new wxBoxSizer( wxHORIZONTAL ); + + m_staticText6 = new wxStaticText( this, wxID_ANY, _("Symbol unit notation:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText6->Wrap( -1 ); + bSizer5->Add( m_staticText6, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); + + + bSizer5->Add( 0, 0, 1, wxEXPAND, 5 ); + + wxString m_choiceSeparatorRefIdChoices[] = { _("A"), _(".A"), _("-A"), _("_A"), _(".1"), _("-1"), _("_1") }; + int m_choiceSeparatorRefIdNChoices = sizeof( m_choiceSeparatorRefIdChoices ) / sizeof( wxString ); + m_choiceSeparatorRefId = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceSeparatorRefIdNChoices, m_choiceSeparatorRefIdChoices, 0 ); + m_choiceSeparatorRefId->SetSelection( 0 ); + bSizer5->Add( m_choiceSeparatorRefId, 1, wxLEFT|wxRIGHT, 5 ); + + + bLeftColumn->Add( bSizer5, 0, wxEXPAND, 0 ); bLeftColumn->Add( 0, 15, 0, wxEXPAND, 5 ); @@ -88,6 +107,9 @@ PANEL_EESCHEMA_ANNOTATION_OPTIONS_BASE::PANEL_EESCHEMA_ANNOTATION_OPTIONS_BASE( m_rbSheetX1000 = new wxRadioButton( this, wxID_SHEET_X_1000, _("First free after sheet number X 1000"), wxDefaultPosition, wxDefaultSize, 0 ); gbSizerNumbering->Add( m_rbSheetX1000, wxGBPosition( 2, 0 ), wxGBSpan( 1, 2 ), wxTOP|wxBOTTOM|wxLEFT, 2 ); + m_checkReuseRefdes = new wxCheckBox( this, wxID_ANY, _("Allow reference reuse"), wxDefaultPosition, wxDefaultSize, 0 ); + gbSizerNumbering->Add( m_checkReuseRefdes, wxGBPosition( 3, 0 ), wxGBSpan( 1, 1 ), wxALL, 2 ); + bLeftColumn->Add( gbSizerNumbering, 1, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 ); diff --git a/eeschema/dialogs/panel_eeschema_annotation_options_base.fbp b/eeschema/dialogs/panel_eeschema_annotation_options_base.fbp index c3e76d139d..9dd65202c9 100644 --- a/eeschema/dialogs/panel_eeschema_annotation_options_base.fbp +++ b/eeschema/dialogs/panel_eeschema_annotation_options_base.fbp @@ -69,11 +69,11 @@ bLeftColumn wxVERTICAL none - - 12 - wxTOP|wxLEFT + + 13 + wxLEFT|wxRIGHT|wxTOP 0 - + 1 1 1 @@ -87,7 +87,6 @@ 1 0 - 1 1 1 @@ -103,7 +102,8 @@ 0 0 wxID_ANY - Automatically annotate symbols + Units + 0 0 @@ -111,7 +111,7 @@ 0 1 - m_checkAutoAnnotate + m_orderLabel1 1 @@ -125,13 +125,158 @@ ; ; forward_declare 0 - - wxFILTER_NONE - wxDefaultValidator - + -1 + + + + 0 + wxEXPAND + 0 + + + bSizer5 + wxHORIZONTAL + none + + 5 + wxALIGN_CENTER_VERTICAL|wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Symbol unit notation: + 0 + + 0 + + + 0 + + 1 + m_staticText6 + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + + + -1 + + + + 5 + wxEXPAND + 1 + + 0 + protected + 0 + + + + 5 + wxLEFT|wxRIGHT + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + "A" ".A" "-A" "_A" ".1" "-1" "_1" + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_choiceSeparatorRefId + 1 + + + protected + 1 + + Resizable + 0 + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + @@ -979,6 +1124,74 @@ OnOptionChanged + + 2 + 1 + 0 + wxALL + 3 + 1 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Allow reference reuse + + 0 + + + 0 + + 1 + m_checkReuseRefdes + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + diff --git a/eeschema/dialogs/panel_eeschema_annotation_options_base.h b/eeschema/dialogs/panel_eeschema_annotation_options_base.h index 2eb756dedd..7ba08d4198 100644 --- a/eeschema/dialogs/panel_eeschema_annotation_options_base.h +++ b/eeschema/dialogs/panel_eeschema_annotation_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -12,20 +12,21 @@ #include #include "widgets/resettable_panel.h" #include -#include +#include #include #include #include #include -#include +#include +#include #include #include #include #include #include #include -#include #include +#include #include #include @@ -45,7 +46,9 @@ class PANEL_EESCHEMA_ANNOTATION_OPTIONS_BASE : public RESETTABLE_PANEL private: protected: - wxCheckBox* m_checkAutoAnnotate; + wxStaticText* m_orderLabel1; + wxStaticText* m_staticText6; + wxChoice* m_choiceSeparatorRefId; wxStaticText* m_orderLabel; wxStaticLine* m_staticline2; wxRadioButton* m_rbSortBy_X_Position; @@ -58,6 +61,7 @@ class PANEL_EESCHEMA_ANNOTATION_OPTIONS_BASE : public RESETTABLE_PANEL wxTextCtrl* m_textNumberAfter; wxRadioButton* m_rbSheetX100; wxRadioButton* m_rbSheetX1000; + wxCheckBox* m_checkReuseRefdes; // Virtual event handlers, override them in your derived class virtual void OnOptionChanged( wxCommandEvent& event ) { event.Skip(); } diff --git a/eeschema/dialogs/panel_eeschema_editing_options.cpp b/eeschema/dialogs/panel_eeschema_editing_options.cpp index 052ca6a5e8..b06930d2a8 100644 --- a/eeschema/dialogs/panel_eeschema_editing_options.cpp +++ b/eeschema/dialogs/panel_eeschema_editing_options.cpp @@ -123,6 +123,7 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC m_cbAutoStartWires->SetValue( aCfg->m_Drawing.auto_start_wires ); m_escClearsNetHighlight->SetValue( aCfg->m_Input.esc_clears_net_highlight ); + m_checkAutoAnnotate->SetValue( aCfg->m_AnnotatePanel.automatic ); m_choicePower->SetSelection( static_cast( aCfg->m_Drawing.new_power_symbols ) ); } @@ -161,6 +162,7 @@ bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow() cfg->m_Drawing.auto_start_wires = m_cbAutoStartWires->GetValue(); cfg->m_Input.esc_clears_net_highlight = m_escClearsNetHighlight->GetValue(); + cfg->m_AnnotatePanel.automatic = m_checkAutoAnnotate->GetValue(); } return true; diff --git a/eeschema/dialogs/panel_eeschema_editing_options_base.cpp b/eeschema/dialogs/panel_eeschema_editing_options_base.cpp index 300ac08120..054e084fea 100644 --- a/eeschema/dialogs/panel_eeschema_editing_options_base.cpp +++ b/eeschema/dialogs/panel_eeschema_editing_options_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -66,7 +66,10 @@ PANEL_EESCHEMA_EDITING_OPTIONS_BASE::PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWind m_escClearsNetHighlight = new wxCheckBox( this, wxID_ANY, _(" clears net highlighting"), wxDefaultPosition, wxDefaultSize, 0 ); m_escClearsNetHighlight->SetToolTip( _("First in selection tool clears selection, next clears net highlighting") ); - bSizer5->Add( m_escClearsNetHighlight, 0, wxBOTTOM|wxLEFT|wxRIGHT|wxTOP, 5 ); + bSizer5->Add( m_escClearsNetHighlight, 0, wxLEFT|wxRIGHT|wxTOP, 5 ); + + m_checkAutoAnnotate = new wxCheckBox( this, wxID_ANY, _("Automatically annotate symbols"), wxDefaultPosition, wxDefaultSize, 0 ); + bSizer5->Add( m_checkAutoAnnotate, 0, wxALL, 5 ); bLeftColumn->Add( bSizer5, 0, wxEXPAND|wxTOP|wxLEFT, 5 ); diff --git a/eeschema/dialogs/panel_eeschema_editing_options_base.fbp b/eeschema/dialogs/panel_eeschema_editing_options_base.fbp index 5da4669c83..f796308c82 100644 --- a/eeschema/dialogs/panel_eeschema_editing_options_base.fbp +++ b/eeschema/dialogs/panel_eeschema_editing_options_base.fbp @@ -596,7 +596,7 @@ 5 - wxBOTTOM|wxLEFT|wxRIGHT|wxTOP + wxLEFT|wxRIGHT|wxTOP 0 1 @@ -659,6 +659,71 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + 0 + + 0 + 0 + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Automatically annotate symbols + + 0 + + + 0 + + 1 + m_checkAutoAnnotate + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + diff --git a/eeschema/dialogs/panel_eeschema_editing_options_base.h b/eeschema/dialogs/panel_eeschema_editing_options_base.h index 533ed3a043..3b6f8bfe42 100644 --- a/eeschema/dialogs/panel_eeschema_editing_options_base.h +++ b/eeschema/dialogs/panel_eeschema_editing_options_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6) +// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -47,6 +47,7 @@ class PANEL_EESCHEMA_EDITING_OPTIONS_BASE : public RESETTABLE_PANEL wxCheckBox* m_mouseDragIsDrag; wxCheckBox* m_cbAutoStartWires; wxCheckBox* m_escClearsNetHighlight; + wxCheckBox* m_checkAutoAnnotate; wxStaticText* m_staticText26; wxStaticLine* m_staticline4; wxStaticText* m_borderColorLabel; diff --git a/eeschema/dialogs/panel_setup_annotation.cpp b/eeschema/dialogs/panel_setup_annotation.cpp deleted file mode 100644 index 7e16764fa2..0000000000 --- a/eeschema/dialogs/panel_setup_annotation.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright The 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 as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#include -#include -#include -#include -#include - -#include "panel_setup_annotation.h" - - -PANEL_SETUP_ANNOTATION::PANEL_SETUP_ANNOTATION( wxWindow* aWindow, SCH_EDIT_FRAME* aFrame ) : - PANEL_SETUP_ANNOTATION_BASE( aWindow ), - m_frame( aFrame ) -{ -} - -int getRefStyleMenuIndex( int aSubpartIdSeparator, int aFirstSubpartId ) -{ - // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1" - switch( aSubpartIdSeparator ) - { - default: - case 0: return 0; - case '.': return aFirstSubpartId == '1' ? 4 : 1; - case '-': return aFirstSubpartId == '1' ? 5 : 2; - case '_': return aFirstSubpartId == '1' ? 6 : 3; - } -} - - -bool PANEL_SETUP_ANNOTATION::TransferDataToWindow() -{ - SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings(); - - m_choiceSeparatorRefId->SetSelection( getRefStyleMenuIndex( settings.m_SubpartIdSeparator, - settings.m_SubpartFirstId ) ); - - m_checkReuseRefdes->SetValue( settings.m_refDesTracker->GetReuseRefDes() ); - - return true; -} - - -bool PANEL_SETUP_ANNOTATION::TransferDataFromWindow() -{ - SCHEMATIC_SETTINGS& settings = m_frame->Schematic().Settings(); - - // Reference style one of: "A" ".A" "-A" "_A" ".1" "-1" "_1" - switch( m_choiceSeparatorRefId->GetSelection() ) - { - default: - case 0: settings.m_SubpartFirstId = 'A'; settings.m_SubpartIdSeparator = 0; break; - case 1: settings.m_SubpartFirstId = 'A'; settings.m_SubpartIdSeparator = '.'; break; - case 2: settings.m_SubpartFirstId = 'A'; settings.m_SubpartIdSeparator = '-'; break; - case 3: settings.m_SubpartFirstId = 'A'; settings.m_SubpartIdSeparator = '_'; break; - case 4: settings.m_SubpartFirstId = '1'; settings.m_SubpartIdSeparator = '.'; break; - case 5: settings.m_SubpartFirstId = '1'; settings.m_SubpartIdSeparator = '-'; break; - case 6: settings.m_SubpartFirstId = '1'; settings.m_SubpartIdSeparator = '_'; break; - } - - settings.m_refDesTracker->SetReuseRefDes( m_checkReuseRefdes->GetValue() ); - return true; -} - - -void PANEL_SETUP_ANNOTATION::ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings ) -{ - m_choiceSeparatorRefId->SetSelection( getRefStyleMenuIndex( aSettings.m_SubpartIdSeparator, - aSettings.m_SubpartFirstId ) ); - - m_checkReuseRefdes->SetValue( aSettings.m_refDesTracker->GetReuseRefDes() ); -} - - -void PANEL_SETUP_ANNOTATION::ResetPanel() -{ - // Reset the panel to the default values - m_choiceSeparatorRefId->SetSelection( 0 ); - m_checkReuseRefdes->SetValue( true ); -} diff --git a/eeschema/dialogs/panel_setup_annotation.h b/eeschema/dialogs/panel_setup_annotation.h deleted file mode 100644 index 40712a0de2..0000000000 --- a/eeschema/dialogs/panel_setup_annotation.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright The 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 as published by the - * Free Software Foundation, either version 3 of the License, or (at your - * option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see . - */ - -#ifndef KICAD_PANEL_SETUP_ANNOTATION_H -#define KICAD_PANEL_SETUP_ANNOTATION_H - -#include -#include "panel_setup_annotation_base.h" - -class SCH_EDIT_FRAME; -class SCHEMATIC_SETTINGS; -class GAL_OPTIONS_PANEL; - - -class PANEL_SETUP_ANNOTATION : public PANEL_SETUP_ANNOTATION_BASE -{ -public: - PANEL_SETUP_ANNOTATION( wxWindow* aWindow, SCH_EDIT_FRAME* aFrame ); - - bool TransferDataToWindow() override; - bool TransferDataFromWindow() override; - - void ResetPanel() override; - - void ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings ); - -private: - SCH_EDIT_FRAME* m_frame; -}; - - -#endif // KICAD_PANEL_SETUP_ANNOTATION_H diff --git a/eeschema/dialogs/panel_setup_annotation_base.cpp b/eeschema/dialogs/panel_setup_annotation_base.cpp deleted file mode 100644 index e30b7647ba..0000000000 --- a/eeschema/dialogs/panel_setup_annotation_base.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "panel_setup_annotation_base.h" - -/////////////////////////////////////////////////////////////////////////// - -PANEL_SETUP_ANNOTATION_BASE::PANEL_SETUP_ANNOTATION_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name ) -{ - wxBoxSizer* bPanelSizer; - bPanelSizer = new wxBoxSizer( wxHORIZONTAL ); - - wxBoxSizer* bLeftColumn; - bLeftColumn = new wxBoxSizer( wxVERTICAL ); - - m_checkReuseRefdes = new wxCheckBox( this, wxID_ANY, _("Allow reference reuse"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkReuseRefdes->SetValue(true); - m_checkReuseRefdes->SetToolTip( _("Allow reusing references from removed components") ); - - bLeftColumn->Add( m_checkReuseRefdes, 0, wxLEFT|wxTOP, 12 ); - - - bLeftColumn->Add( 0, 5, 0, wxEXPAND, 5 ); - - m_unitsLabel = new wxStaticText( this, wxID_ANY, _("Units"), wxDefaultPosition, wxDefaultSize, 0 ); - m_unitsLabel->Wrap( -1 ); - bLeftColumn->Add( m_unitsLabel, 0, wxLEFT|wxRIGHT, 13 ); - - m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); - bLeftColumn->Add( m_staticline2, 0, wxEXPAND|wxTOP|wxBOTTOM, 2 ); - - wxBoxSizer* bSizer5; - bSizer5 = new wxBoxSizer( wxHORIZONTAL ); - - m_staticText3 = new wxStaticText( this, wxID_ANY, _("Symbol unit notation:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_staticText3->Wrap( -1 ); - bSizer5->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 ); - - wxString m_choiceSeparatorRefIdChoices[] = { _("A"), _(".A"), _("-A"), _("_A"), _(".1"), _("-1"), _("_1") }; - int m_choiceSeparatorRefIdNChoices = sizeof( m_choiceSeparatorRefIdChoices ) / sizeof( wxString ); - m_choiceSeparatorRefId = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceSeparatorRefIdNChoices, m_choiceSeparatorRefIdChoices, 0 ); - m_choiceSeparatorRefId->SetSelection( 0 ); - bSizer5->Add( m_choiceSeparatorRefId, 1, wxEXPAND|wxRIGHT, 5 ); - - - bLeftColumn->Add( bSizer5, 0, wxEXPAND|wxTOP, 5 ); - - - bLeftColumn->Add( 0, 0, 1, wxEXPAND, 5 ); - - - bPanelSizer->Add( bLeftColumn, 0, wxEXPAND, 5 ); - - - this->SetSizer( bPanelSizer ); - this->Layout(); - bPanelSizer->Fit( this ); -} - -PANEL_SETUP_ANNOTATION_BASE::~PANEL_SETUP_ANNOTATION_BASE() -{ -} diff --git a/eeschema/dialogs/panel_setup_annotation_base.fbp b/eeschema/dialogs/panel_setup_annotation_base.fbp deleted file mode 100644 index 25e7d825f1..0000000000 --- a/eeschema/dialogs/panel_setup_annotation_base.fbp +++ /dev/null @@ -1,421 +0,0 @@ - - - - - C++ - - 1 - connect - none - - - 0 - 0 - res - UTF-8 - panel_setup_annotation_base - 19200 - 1 - 1 - UI - PanelSetupAnnotationBase - . - 0 - source_name - 1 - 0 - source_name - - - 1 - 1 - 0 - 0 - - 0 - wxAUI_MGR_DEFAULT - - - 1 - 0 - 1 - impl_virtual - - - 0 - wxID_ANY - - - PANEL_SETUP_ANNOTATION_BASE - - -1,-1 - RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare - - 0 - - - wxTAB_TRAVERSAL - - - bPanelSizer - wxHORIZONTAL - none - - 5 - wxEXPAND - 0 - - - bLeftColumn - wxVERTICAL - none - - 12 - wxLEFT|wxTOP - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Allow reference reuse - - 0 - - - 0 - - 1 - m_checkReuseRefdes - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - Allow reusing references from removed components - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - 5 - wxEXPAND - 0 - - 5 - protected - 0 - - - - 13 - wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Units - 0 - - 0 - - - 0 - - 1 - m_unitsLabel - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 2 - wxEXPAND|wxTOP|wxBOTTOM - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_staticline2 - 1 - - - protected - 1 - - Resizable - 1 - - wxLI_HORIZONTAL - ; ; forward_declare - 0 - - - - - - - - 5 - wxEXPAND|wxTOP - 0 - - - bSizer5 - wxHORIZONTAL - none - - 5 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT - 0 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - Symbol unit notation: - 0 - - 0 - - - 0 - - 1 - m_staticText3 - 1 - - - protected - 1 - - Resizable - 1 - - - ; ; forward_declare - 0 - - - - - -1 - - - - 5 - wxEXPAND|wxRIGHT - 1 - - 1 - 1 - 1 - 1 - 0 - - 0 - 0 - - - - 1 - 0 - "A" ".A" "-A" "_A" ".1" "-1" "_1" - 1 - - 1 - 0 - Dock - 0 - Left - 0 - 1 - - 1 - - 0 - 0 - wxID_ANY - - 0 - - - 0 - - 1 - m_choiceSeparatorRefId - 1 - - - protected - 1 - - Resizable - 0 - 1 - - - ; ; forward_declare - 0 - - - wxFILTER_NONE - wxDefaultValidator - - - - - - - - - - 5 - wxEXPAND - 1 - - 0 - protected - 0 - - - - - - - - diff --git a/eeschema/dialogs/panel_setup_annotation_base.h b/eeschema/dialogs/panel_setup_annotation_base.h deleted file mode 100644 index 0284995032..0000000000 --- a/eeschema/dialogs/panel_setup_annotation_base.h +++ /dev/null @@ -1,49 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 4.2.1-0-g80c4cb6a-dirty) -// http://www.wxformbuilder.org/ -// -// PLEASE DO *NOT* EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include -#include "widgets/resettable_panel.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -/// Class PANEL_SETUP_ANNOTATION_BASE -/////////////////////////////////////////////////////////////////////////////// -class PANEL_SETUP_ANNOTATION_BASE : public RESETTABLE_PANEL -{ - private: - - protected: - wxCheckBox* m_checkReuseRefdes; - wxStaticText* m_unitsLabel; - wxStaticLine* m_staticline2; - wxStaticText* m_staticText3; - wxChoice* m_choiceSeparatorRefId; - - public: - - PANEL_SETUP_ANNOTATION_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_SETUP_ANNOTATION_BASE(); - -}; - diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 9db695d0c5..f2315c97a9 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -319,9 +319,6 @@ static struct IFACE : public KIFACE_BASE, public UNITS_PROVIDER return new PANEL_EESCHEMA_EDITING_OPTIONS( aParent, this, frame ); } - case PANEL_SCH_ANNO_OPTIONS: - return new PANEL_EESCHEMA_ANNOTATION_OPTIONS( aParent, aKiway->Player( FRAME_SCH, false ) ); - case PANEL_SCH_TOOLBARS: { APP_SETTINGS_BASE* cfg = GetAppSettings( "eeschema" ); diff --git a/eeschema/eeschema_settings.cpp b/eeschema/eeschema_settings.cpp index 7206043af0..80a69b8d9a 100644 --- a/eeschema/eeschema_settings.cpp +++ b/eeschema/eeschema_settings.cpp @@ -424,9 +424,6 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : m_params.emplace_back( new PARAM( "annotation.recursive", &m_AnnotatePanel.recursive, true ) ); - m_params.emplace_back( new PARAM( "annotation.method", - &m_AnnotatePanel.method, 0, 0, 2 ) ); - m_params.emplace_back( new PARAM( "annotation.scope", &m_AnnotatePanel.scope, 0, 0, 2 ) ); @@ -436,8 +433,6 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() : m_params.emplace_back( new PARAM( "annotation.messages_filter", &m_AnnotatePanel.messages_filter, -1 ) ); - m_params.emplace_back( new PARAM( "annotation.sort_order", - &m_AnnotatePanel.sort_order, 0, 0, 1 ) ); m_params.emplace_back( new PARAM( "bom.selected_plugin", &m_BomPanel.selected_plugin, "" ) ); @@ -715,9 +710,7 @@ bool EESCHEMA_SETTINGS::MigrateFromLegacy( wxConfigBase* aCfg ) ret &= fromLegacy( aCfg, "SelectPinSelectSymbolOpt", "selection.select_pin_selects_symbol" ); - ret &= fromLegacy( aCfg, "AnnotateAlgoOption", "annotation.method" ); ret &= fromLegacy( aCfg, "AnnotateFilterMsg", "annotation.messages_filter" ); - ret &= fromLegacy( aCfg, "AnnotateSortOption", "annotation.sort_order" ); ret &= fromLegacyString( aCfg, "bom_plugin_selected", "bom.selected_plugin" ); ret &= fromLegacyString( aCfg, "bom_plugins", "bom.plugins" ); diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h index 84603f4a57..afef0f4451 100644 --- a/eeschema/eeschema_settings.h +++ b/eeschema/eeschema_settings.h @@ -221,9 +221,7 @@ public: bool recursive; int scope; int options; - int method; int messages_filter; - int sort_order; }; struct PANEL_BOM diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index f1958785c8..217edb5431 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -743,8 +743,7 @@ void SCH_EDIT_FRAME::setupUIConditions() auto showAnnotateAutomaticallyCond = [this]( const SELECTION& ) { - EESCHEMA_SETTINGS* cfg = eeconfig(); - return cfg && cfg->m_AnnotatePanel.automatic; + return eeconfig()->m_AnnotatePanel.automatic; }; auto remapSymbolsCondition = diff --git a/eeschema/schematic_settings.cpp b/eeschema/schematic_settings.cpp index d61c90977a..8aa132eebc 100644 --- a/eeschema/schematic_settings.cpp +++ b/eeschema/schematic_settings.cpp @@ -50,6 +50,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin m_HopOverScale( 0.0 ), m_ConnectionGridSize( DEFAULT_CONNECTION_GRID_MILS * schIUScale.IU_PER_MILS ), m_AnnotateStartNum( 0 ), + m_AnnotateSortOrder( 0 ), + m_AnnotateMethod( 0 ), m_IntersheetRefsShow( false ), m_IntersheetRefsListOwnPage( true ), m_IntersheetRefsFormatShort( false ), @@ -223,6 +225,12 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin m_params.emplace_back( new PARAM( "annotate_start_num", &m_AnnotateStartNum, 0 ) ); + m_params.emplace_back( new PARAM( "annotation.sort_order", + &m_AnnotateSortOrder, 0, 0, 1 ) ); + + m_params.emplace_back( new PARAM( "annotation.method", + &m_AnnotateMethod, 0, 0, 2 ) ); + m_NgspiceSettings = std::make_shared( this, "ngspice" ); m_params.emplace_back( new PARAM_LAMBDA( "reuse_designators", diff --git a/eeschema/schematic_settings.h b/eeschema/schematic_settings.h index f13bcf599f..896d944c9c 100644 --- a/eeschema/schematic_settings.h +++ b/eeschema/schematic_settings.h @@ -69,6 +69,9 @@ public: int m_ConnectionGridSize; // usually 50mils (IU internally; mils in the JSON file) int m_AnnotateStartNum; // Starting value for annotation + int m_AnnotateSortOrder; // Annotation sort order + int m_AnnotateMethod; // Annotation numbering method (linear, sheet * 100, etc) + int m_SubpartIdSeparator; // the separator char between the subpart id and the // reference like U1A, U1.A or U1-A int m_SubpartFirstId; // the ASCII char value to calculate the subpart symbol diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 8ec596cf48..e6471aa049 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -234,8 +234,8 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) if( cfg->m_AnnotatePanel.automatic || newReference.AlwaysAnnotate() ) { - refs.ReannotateByOptions( (ANNOTATE_ORDER_T) cfg->m_AnnotatePanel.sort_order, - (ANNOTATE_ALGO_T) cfg->m_AnnotatePanel.method, + refs.ReannotateByOptions( (ANNOTATE_ORDER_T) schSettings.m_AnnotateSortOrder, + (ANNOTATE_ALGO_T) schSettings.m_AnnotateMethod, schSettings.m_AnnotateStartNum, existingRefs, false, &hierarchy ); @@ -792,14 +792,12 @@ int SCH_DRAWING_TOOLS::ImportSheet( const TOOL_EVENT& aEvent ) if( !keepAnnotations ) { - EESCHEMA_SETTINGS::PANEL_ANNOTATE& annotate = cfg->m_AnnotatePanel; - - if( annotate.automatic ) + if( cfg->m_AnnotatePanel.automatic ) { NULL_REPORTER reporter; m_frame->AnnotateSymbols( &commit, ANNOTATE_SELECTION, - (ANNOTATE_ORDER_T) annotate.sort_order, - (ANNOTATE_ALGO_T) annotate.method, true /* recursive */, + (ANNOTATE_ORDER_T) schSettings.m_AnnotateSortOrder, + (ANNOTATE_ALGO_T) schSettings.m_AnnotateMethod, true /* recursive */, schSettings.m_AnnotateStartNum, false, false, reporter ); } @@ -3187,9 +3185,8 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent ) // This convoluted logic means we always annotate unless we are drawing a copy/design block // and the user has explicitly requested we keep the annotations via checkbox - EESCHEMA_SETTINGS::PANEL_ANNOTATE& annotate = cfg->m_AnnotatePanel; - if( annotate.automatic + if( cfg->m_AnnotatePanel.automatic && !( ( isDrawSheetCopy || isDrawSheetFromDesignBlock ) && cfg->m_DesignBlockChooserPanel.keep_annotations ) ) { @@ -3198,8 +3195,8 @@ int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent ) NULL_REPORTER reporter; m_frame->AnnotateSymbols( - &c, ANNOTATE_SELECTION, (ANNOTATE_ORDER_T) annotate.sort_order, - (ANNOTATE_ALGO_T) annotate.method, true /* recursive */, + &c, ANNOTATE_SELECTION, (ANNOTATE_ORDER_T) schSettings.m_AnnotateSortOrder, + (ANNOTATE_ALGO_T) schSettings.m_AnnotateMethod, true /* recursive */, schSettings.m_AnnotateStartNum, true, false, reporter ); } diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index b065bb3c84..a9d2ce411c 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -809,7 +809,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) if( head && head->IsMoving() ) moving = true; - + if( principalItemCount == 1 ) { if( moving && selection.HasReferencePoint() ) @@ -989,7 +989,7 @@ int SCH_EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) if( item->Type() == SCH_LINE_T ) { - SCH_LINE* line = (SCH_LINE*) item; + SCH_LINE* line = (SCH_LINE*) item; line->Rotate( rotPoint, !clockwise ); } @@ -1582,17 +1582,18 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent ) if( newItem->Type() == SCH_SYMBOL_T ) { - EESCHEMA_SETTINGS::PANEL_ANNOTATE& annotate = m_frame->eeconfig()->m_AnnotatePanel; SCHEMATIC_SETTINGS& projSettings = m_frame->Schematic().Settings(); int annotateStartNum = projSettings.m_AnnotateStartNum; + ANNOTATE_ORDER_T annotateOrder = static_cast( projSettings.m_AnnotateSortOrder ); + ANNOTATE_ALGO_T annotateAlgo = static_cast( projSettings.m_AnnotateMethod ); - if( annotate.automatic ) + if( m_frame->eeconfig()->m_AnnotatePanel.automatic ) { static_cast( newItem )->ClearAnnotation( nullptr, false ); NULL_REPORTER reporter; m_frame->AnnotateSymbols( &commit, ANNOTATE_SELECTION, - (ANNOTATE_ORDER_T) annotate.sort_order, - (ANNOTATE_ALGO_T) annotate.method, true /* recursive */, + annotateOrder, + annotateAlgo, true /* recursive */, annotateStartNum, false, false, reporter ); } diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 8625af7c24..0e909c7dbd 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -1706,11 +1706,11 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent ) tempScreen->MigrateSimModels(); - EESCHEMA_SETTINGS::PANEL_ANNOTATE& annotate = m_frame->eeconfig()->m_AnnotatePanel; + bool annotateAutomatic = m_frame->eeconfig()->m_AnnotatePanel.automatic; SCHEMATIC_SETTINGS& schematicSettings = m_frame->Schematic().Settings(); int annotateStartNum = schematicSettings.m_AnnotateStartNum; - PASTE_MODE pasteMode = annotate.automatic ? PASTE_MODE::RESPECT_OPTIONS : PASTE_MODE::REMOVE_ANNOTATIONS; + PASTE_MODE pasteMode = annotateAutomatic ? PASTE_MODE::RESPECT_OPTIONS : PASTE_MODE::REMOVE_ANNOTATIONS; bool forceRemoveAnnotations = false; if( aEvent.IsAction( &ACTIONS::pasteSpecial ) ) @@ -1998,7 +1998,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent ) for( SCH_SHEET_PATH& sheetPath : sheetPathsForScreen ) { SCH_SHEET_PATH subPath = updatePastedSheet( sheet, sheetPath, clipPath, - ( forceKeepAnnotations && annotate.automatic ), + ( forceKeepAnnotations && annotateAutomatic ), &pastedSheets[sheetPath], pastedSymbols ); } @@ -2119,6 +2119,9 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent ) if( !annotatedSymbols.empty() ) { + ANNOTATE_ORDER_T annotateOrder = static_cast( schematicSettings.m_AnnotateSortOrder ); + ANNOTATE_ALGO_T annotateAlgo = static_cast( schematicSettings.m_AnnotateMethod ); + for( SCH_SHEET_PATH& path : sheetPathsForScreen ) { annotatedSymbols[path].SortByReferenceOnly(); @@ -2130,8 +2133,8 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent ) } else { - annotatedSymbols[path].ReannotateByOptions( (ANNOTATE_ORDER_T) annotate.sort_order, - (ANNOTATE_ALGO_T) annotate.method, + annotatedSymbols[path].ReannotateByOptions( annotateOrder, + annotateAlgo, annotateStartNum, existingRefs, false, &hierarchy ); } @@ -2153,8 +2156,8 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent ) } else { - annotatedSymbols[pastedSheetPath].ReannotateByOptions( (ANNOTATE_ORDER_T) annotate.sort_order, - (ANNOTATE_ALGO_T) annotate.method, + annotatedSymbols[pastedSheetPath].ReannotateByOptions( annotateOrder, + annotateAlgo, annotateStartNum, existingRefs, false, &hierarchy ); @@ -2799,14 +2802,6 @@ int SCH_EDITOR_CONTROL::ToggleAnnotateAuto( const TOOL_EVENT& aEvent ) } -int SCH_EDITOR_CONTROL::ToggleAnnotateRecursive( const TOOL_EVENT& aEvent ) -{ - EESCHEMA_SETTINGS* cfg = m_frame->eeconfig(); - cfg->m_AnnotatePanel.recursive = !cfg->m_AnnotatePanel.recursive; - return 0; -} - - int SCH_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent ) { diff --git a/eeschema/tools/sch_editor_control.h b/eeschema/tools/sch_editor_control.h index ea4b38c741..a822be07c0 100644 --- a/eeschema/tools/sch_editor_control.h +++ b/eeschema/tools/sch_editor_control.h @@ -146,7 +146,6 @@ public: int ChangeLineMode( const TOOL_EVENT& aEvent ); int NextLineMode( const TOOL_EVENT& aEvent ); int ToggleAnnotateAuto( const TOOL_EVENT& aEvent ); - int ToggleAnnotateRecursive( const TOOL_EVENT& aEvent ); int TogglePythonConsole( const TOOL_EVENT& aEvent ); int ReloadPlugins( const TOOL_EVENT& aEvent ); diff --git a/include/frame_type.h b/include/frame_type.h index bc360b1929..2045e14365 100644 --- a/include/frame_type.h +++ b/include/frame_type.h @@ -78,7 +78,6 @@ enum FRAME_T PANEL_SCH_DISP_OPTIONS, PANEL_SCH_GRIDS, PANEL_SCH_EDIT_OPTIONS, - PANEL_SCH_ANNO_OPTIONS, PANEL_SCH_COLORS, PANEL_SCH_TOOLBARS, PANEL_SCH_FIELD_NAME_TEMPLATES,