diff --git a/eeschema/dialogs/panel_setup_formatting.cpp b/eeschema/dialogs/panel_setup_formatting.cpp index 1637393a91..193264e575 100644 --- a/eeschema/dialogs/panel_setup_formatting.cpp +++ b/eeschema/dialogs/panel_setup_formatting.cpp @@ -41,6 +41,17 @@ PANEL_SETUP_FORMATTING::PANEL_SETUP_FORMATTING( wxWindow* aWindow, SCH_EDIT_FRAM { } +void PANEL_SETUP_FORMATTING::onCheckBoxIref( wxCommandEvent& event ) +{ + bool enabled = m_showIntersheetsReferences->GetValue(); + + m_radioFormatStandard->Enable( enabled ); + m_radioFormatAbbreviated->Enable( enabled ); + m_prefixCtrl->Enable( enabled ); + m_suffixCtrl->Enable( enabled ); + m_listOwnPage->Enable( enabled ); +} + bool PANEL_SETUP_FORMATTING::TransferDataToWindow() { @@ -70,10 +81,18 @@ bool PANEL_SETUP_FORMATTING::TransferDataToWindow() m_choiceJunctionDotSize->SetSelection( settings.m_JunctionSizeChoice ); m_showIntersheetsReferences->SetValue( settings.m_IntersheetRefsShow ); + + m_radioFormatStandard->Enable( settings.m_IntersheetRefsShow ); + m_radioFormatAbbreviated->Enable( settings.m_IntersheetRefsShow ); + m_prefixCtrl->Enable( settings.m_IntersheetRefsShow ); + m_suffixCtrl->Enable( settings.m_IntersheetRefsShow ); + m_listOwnPage->Enable( settings.m_IntersheetRefsShow ); + m_radioFormatStandard->SetValue( !settings.m_IntersheetRefsFormatShort ); m_radioFormatAbbreviated->SetValue( settings.m_IntersheetRefsFormatShort ); m_prefixCtrl->ChangeValue( settings.m_IntersheetRefsPrefix ); m_suffixCtrl->ChangeValue( settings.m_IntersheetRefsSuffix ); + m_listOwnPage->SetValue( settings.m_IntersheetRefsListOwnPage ); wxString offsetRatio = wxString::Format( "%f", settings.m_TextOffsetRatio * 100.0 ); m_textOffsetRatioCtrl->SetValue( offsetRatio ); @@ -145,6 +164,7 @@ bool PANEL_SETUP_FORMATTING::TransferDataFromWindow() settings.m_IntersheetRefsFormatShort = !m_radioFormatStandard->GetValue(); settings.m_IntersheetRefsPrefix = m_prefixCtrl->GetValue(); settings.m_IntersheetRefsSuffix = m_suffixCtrl->GetValue(); + settings.m_IntersheetRefsListOwnPage = m_listOwnPage->GetValue(); double dtmp = 0.0; wxString msg = m_textOffsetRatioCtrl->GetValue(); @@ -175,6 +195,7 @@ void PANEL_SETUP_FORMATTING::ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings ) m_radioFormatAbbreviated->SetValue( !aSettings.m_IntersheetRefsFormatShort ); m_prefixCtrl->ChangeValue( aSettings.m_IntersheetRefsPrefix ); m_suffixCtrl->ChangeValue( aSettings.m_IntersheetRefsSuffix ); + m_listOwnPage->SetValue( aSettings.m_IntersheetRefsListOwnPage ); wxString offsetRatio = wxString::Format( "%f", aSettings.m_TextOffsetRatio * 100.0 ); m_textOffsetRatioCtrl->SetValue( offsetRatio ); diff --git a/eeschema/dialogs/panel_setup_formatting.h b/eeschema/dialogs/panel_setup_formatting.h index 248db709c4..5da0250970 100644 --- a/eeschema/dialogs/panel_setup_formatting.h +++ b/eeschema/dialogs/panel_setup_formatting.h @@ -44,6 +44,9 @@ public: bool TransferDataFromWindow() override; void ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings ); + +protected: + void onCheckBoxIref( wxCommandEvent& event ) override; }; diff --git a/eeschema/dialogs/panel_setup_formatting_base.cpp b/eeschema/dialogs/panel_setup_formatting_base.cpp index 524f0a248f..a4c3bf5a68 100644 --- a/eeschema/dialogs/panel_setup_formatting_base.cpp +++ b/eeschema/dialogs/panel_setup_formatting_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) +// C++ code generated with wxFormBuilder (version 3.9.0 Mar 8 2021) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -9,6 +9,10 @@ /////////////////////////////////////////////////////////////////////////// +BEGIN_EVENT_TABLE( PANEL_SETUP_FORMATTING_BASE, wxPanel ) + EVT_CHECKBOX( wxID_ANY, PANEL_SETUP_FORMATTING_BASE::_wxFB_onCheckBoxIref ) +END_EVENT_TABLE() + PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_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; @@ -152,6 +156,10 @@ PANEL_SETUP_FORMATTING_BASE::PANEL_SETUP_FORMATTING_BASE( wxWindow* parent, wxWi wxBoxSizer* bSizerMargins; bSizerMargins = new wxBoxSizer( wxVERTICAL ); + m_listOwnPage = new wxCheckBox( sbSizerIREf->GetStaticBox(), wxID_ANY, _("Show own page reference"), wxDefaultPosition, wxDefaultSize, 0 ); + m_listOwnPage->SetValue(true); + bSizerMargins->Add( m_listOwnPage, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 ); + m_radioFormatStandard = new wxRadioButton( sbSizerIREf->GetStaticBox(), wxID_ANY, _("Standard (1,2,3)"), wxDefaultPosition, wxDefaultSize, 0 ); m_radioFormatStandard->SetValue( true ); bSizerMargins->Add( m_radioFormatStandard, 0, wxALL, 5 ); diff --git a/eeschema/dialogs/panel_setup_formatting_base.fbp b/eeschema/dialogs/panel_setup_formatting_base.fbp index ec4fb55fb6..04d61d7469 100644 --- a/eeschema/dialogs/panel_setup_formatting_base.fbp +++ b/eeschema/dialogs/panel_setup_formatting_base.fbp @@ -1258,6 +1258,7 @@ + onCheckBoxIref @@ -1269,6 +1270,70 @@ bSizerMargins wxVERTICAL none + + 5 + wxBOTTOM|wxLEFT|wxRIGHT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Show own page reference + + 0 + + + 0 + + 1 + m_listOwnPage + 1 + + + protected + 1 + + Resizable + 1 + + + ; ; forward_declare + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxALL @@ -1401,7 +1466,7 @@ 5 wxEXPAND 1 - + 2 wxBOTH 1 diff --git a/eeschema/dialogs/panel_setup_formatting_base.h b/eeschema/dialogs/panel_setup_formatting_base.h index b016fdde01..24699fd763 100644 --- a/eeschema/dialogs/panel_setup_formatting_base.h +++ b/eeschema/dialogs/panel_setup_formatting_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.9.0 Nov 1 2020) +// C++ code generated with wxFormBuilder (version 3.9.0 Mar 8 2021) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -31,8 +31,13 @@ /////////////////////////////////////////////////////////////////////////////// class PANEL_SETUP_FORMATTING_BASE : public wxPanel { + DECLARE_EVENT_TABLE() private: + // Private event handlers + void _wxFB_onCheckBoxIref( wxCommandEvent& event ){ onCheckBoxIref( event ); } + + protected: wxStaticText* m_staticText26; wxChoice* m_choiceSeparatorRefId; @@ -51,6 +56,7 @@ class PANEL_SETUP_FORMATTING_BASE : public wxPanel wxStaticText* m_staticText261; wxChoice* m_choiceJunctionDotSize; wxCheckBox* m_showIntersheetsReferences; + wxCheckBox* m_listOwnPage; wxRadioButton* m_radioFormatStandard; wxRadioButton* m_radioFormatAbbreviated; wxStaticText* m_prefixLabel; @@ -58,6 +64,10 @@ class PANEL_SETUP_FORMATTING_BASE : public wxPanel wxStaticText* m_suffixLabel; wxTextCtrl* m_suffixCtrl; + // Virtual event handlers, override them in your derived class + virtual void onCheckBoxIref( wxCommandEvent& event ) { event.Skip(); } + + public: PANEL_SETUP_FORMATTING_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 ); diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h index a30db095ef..1481ad5a11 100644 --- a/eeschema/eeschema_settings.h +++ b/eeschema/eeschema_settings.h @@ -88,6 +88,7 @@ public: bool hv_lines_only; int repeat_label_increment; bool intersheets_ref_show; + bool intersheets_ref_own_page; bool intersheets_ref_short; wxString intersheets_ref_prefix; wxString intersheets_ref_suffix; diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 601352e619..907b813216 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -469,6 +469,17 @@ void SCH_FIELD::DoHypertextMenu( EDA_DRAW_FRAME* aFrame ) pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() ); std::sort( pageListCopy.begin(), pageListCopy.end() ); + if( !Schematic()->Settings().m_IntersheetRefsListOwnPage ) + { + wxString currentPage = Schematic()->CurrentSheet().GetPageNumber(); + pageListCopy.erase( std::remove( pageListCopy.begin(), + pageListCopy.end(), + currentPage ), pageListCopy.end() ); + + if( pageListCopy.empty() ) + return; + } + for( const SCH_SHEET_PATH& sheet : Schematic()->GetSheets() ) { if( sheet.size() == 1 ) diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 7a3ebf52c7..fea4c08028 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -1159,6 +1159,14 @@ bool SCH_GLOBALLABEL::ResolveTextVar( wxString* token, int aDepth ) const pageListCopy.insert( pageListCopy.end(), it->second.begin(), it->second.end() ); std::sort( pageListCopy.begin(), pageListCopy.end() ); + if( !settings.m_IntersheetRefsListOwnPage ) + { + wxString currentPage = Schematic()->CurrentSheet().GetPageNumber(); + pageListCopy.erase( std::remove( pageListCopy.begin(), + pageListCopy.end(), + currentPage ), pageListCopy.end() ); + } + token->Printf( "%s", settings.m_IntersheetRefsPrefix ); if( ( settings.m_IntersheetRefsFormatShort ) && ( pageListCopy.size() > 2 ) ) diff --git a/eeschema/schematic_settings.cpp b/eeschema/schematic_settings.cpp index e153642786..9b10f19131 100644 --- a/eeschema/schematic_settings.cpp +++ b/eeschema/schematic_settings.cpp @@ -43,6 +43,7 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin m_JunctionSize( DEFAULT_JUNCTION_DIAM * IU_PER_MILS ), m_JunctionSizeChoice( 3 ), m_IntersheetRefsShow( false ), + m_IntersheetRefsListOwnPage( true ), m_IntersheetRefsFormatShort( false ), m_IntersheetRefsPrefix( DEFAULT_IREF_PREFIX ), m_IntersheetRefsSuffix( DEFAULT_IREF_SUFFIX ), @@ -66,6 +67,8 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin appSettings ? appSettings->m_Drawing.junction_size_choice : 3; bool defaultIntersheetsRefShow = appSettings ? appSettings->m_Drawing.intersheets_ref_show : false; + bool defaultIntersheetsRefOwnPage = + appSettings ? appSettings->m_Drawing.intersheets_ref_own_page : true; bool defaultIntersheetsRefFormatShort = appSettings ? appSettings->m_Drawing.intersheets_ref_short : false; wxString defaultIntersheetsRefPrefix = @@ -76,6 +79,9 @@ SCHEMATIC_SETTINGS::SCHEMATIC_SETTINGS( JSON_SETTINGS* aParent, const std::strin m_params.emplace_back( new PARAM( "drawing.intersheets_ref_show", &m_IntersheetRefsShow, defaultIntersheetsRefShow ) ); + m_params.emplace_back( new PARAM( "drawing.intersheets_ref_own_page", + &m_IntersheetRefsListOwnPage, defaultIntersheetsRefOwnPage ) ); + m_params.emplace_back( new PARAM( "drawing.intersheets_ref_short", &m_IntersheetRefsFormatShort, defaultIntersheetsRefFormatShort ) ); diff --git a/eeschema/schematic_settings.h b/eeschema/schematic_settings.h index 36a864b475..11e4f3c7e3 100644 --- a/eeschema/schematic_settings.h +++ b/eeschema/schematic_settings.h @@ -53,6 +53,7 @@ public: int m_JunctionSizeChoice; bool m_IntersheetRefsShow; + bool m_IntersheetRefsListOwnPage; bool m_IntersheetRefsFormatShort; wxString m_IntersheetRefsPrefix; wxString m_IntersheetRefsSuffix;