eeschema: add a setting to allow intersheets to not list their own page

Also disable inter-sheet options when "Show inter-sheet references" is
not checked.
This commit is contained in:
Franck Jullien 2021-03-04 22:29:41 +01:00 committed by Seth Hillbrand
parent 14b1d36b38
commit c16199c3f9
10 changed files with 137 additions and 3 deletions

View File

@ -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 );

View File

@ -44,6 +44,9 @@ public:
bool TransferDataFromWindow() override;
void ImportSettingsFrom( SCHEMATIC_SETTINGS& aSettings );
protected:
void onCheckBoxIref( wxCommandEvent& event ) override;
};

View File

@ -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 );

View File

@ -1258,6 +1258,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnCheckBox">onCheckBoxIref</event>
</object>
</object>
<object class="sizeritem" expanded="1">
@ -1269,6 +1270,70 @@
<property name="name">bSizerMargins</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Show own page reference</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_listOwnPage</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxALL</property>
@ -1401,7 +1466,7 @@
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<object class="wxFlexGridSizer" expanded="0">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>

View File

@ -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 );

View File

@ -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;

View File

@ -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 )

View File

@ -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 ) )

View File

@ -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<bool>( "drawing.intersheets_ref_show",
&m_IntersheetRefsShow, defaultIntersheetsRefShow ) );
m_params.emplace_back( new PARAM<bool>( "drawing.intersheets_ref_own_page",
&m_IntersheetRefsListOwnPage, defaultIntersheetsRefOwnPage ) );
m_params.emplace_back( new PARAM<bool>( "drawing.intersheets_ref_short",
&m_IntersheetRefsFormatShort, defaultIntersheetsRefFormatShort ) );

View File

@ -53,6 +53,7 @@ public:
int m_JunctionSizeChoice;
bool m_IntersheetRefsShow;
bool m_IntersheetRefsListOwnPage;
bool m_IntersheetRefsFormatShort;
wxString m_IntersheetRefsPrefix;
wxString m_IntersheetRefsSuffix;