Default intersheet ref field visibility to off, and show warning

when user tries to edit via Symbol Properties or Field Propeties.
This commit is contained in:
Jeff Young 2022-09-26 20:25:18 +01:00
parent 10d8db482e
commit 838bd7292c
6 changed files with 36 additions and 6 deletions

View File

@ -662,6 +662,18 @@ void DIALOG_SCH_FIELD_PROPERTIES::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH
else if( fieldType == FOOTPRINT_FIELD ) else if( fieldType == FOOTPRINT_FIELD )
symbol->SetFootprint( m_text ); symbol->SetFootprint( m_text );
} }
else if( parent && parent->Type() == SCH_GLOBAL_LABEL_T )
{
if( fieldType == 0 )
{
if( m_visible->GetValue() != parent->Schematic()->Settings().m_IntersheetRefsShow )
{
DisplayInfoMessage( this, _( "Intersheet reference visibility is "
"controlled globally from "
"Schematic Setup > General > Formatting" ) );
}
}
}
bool positioningModified = false; bool positioningModified = false;

View File

@ -450,11 +450,24 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataFromWindow()
field.Offset( m_currentLabel->GetPosition() ); field.Offset( m_currentLabel->GetPosition() );
if( field.GetCanonicalName() == wxT( "Netclass" ) ) if( field.GetCanonicalName() == wxT( "Netclass" ) )
{
field.SetLayer( LAYER_NETCLASS_REFS ); field.SetLayer( LAYER_NETCLASS_REFS );
}
else if( field.GetCanonicalName() == wxT( "Intersheetrefs" ) ) else if( field.GetCanonicalName() == wxT( "Intersheetrefs" ) )
{
if( field.IsVisible() != m_Parent->Schematic().Settings().m_IntersheetRefsShow )
{
DisplayInfoMessage( this, _( "Intersheet reference visibility is "
"controlled globally from "
"Schematic Setup > General > Formatting" ) );
}
field.SetLayer( LAYER_INTERSHEET_REFS ); field.SetLayer( LAYER_INTERSHEET_REFS );
}
else else
{
field.SetLayer( LAYER_FIELDS ); field.SetLayer( LAYER_FIELDS );
}
} }
if( positioningChanged( m_fields, m_currentLabel->GetFields() ) ) if( positioningChanged( m_fields, m_currentLabel->GetFields() ) )

View File

@ -485,7 +485,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
initScreenZoom(); initScreenZoom();
SetSheetNumberAndCount(); SetSheetNumberAndCount();
RecomputeIntersheetRefs(); RecomputeIntersheetRefs( true );
GetCurrentSheet().UpdateAllScreenReferences(); GetCurrentSheet().UpdateAllScreenReferences();
// re-create junctions if needed. Eeschema optimizes wires by merging // re-create junctions if needed. Eeschema optimizes wires by merging

View File

@ -1533,7 +1533,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
} }
void SCH_EDIT_FRAME::RecomputeIntersheetRefs() void SCH_EDIT_FRAME::RecomputeIntersheetRefs( bool autoplaceUninitialized )
{ {
std::map<wxString, std::set<int>>& pageRefsMap = Schematic().GetPageRefsMap(); std::map<wxString, std::set<int>>& pageRefsMap = Schematic().GetPageRefsMap();
@ -1579,10 +1579,15 @@ void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
for( SCH_GLOBALLABEL* globalLabel : globalLabels ) for( SCH_GLOBALLABEL* globalLabel : globalLabels )
{ {
globalLabel->GetFields()[0].SetVisible( show ); std::vector<SCH_FIELD>& fields = globalLabel->GetFields();
fields[0].SetVisible( show );
if( show ) if( show )
{ {
if( fields.size() == 1 && fields[0].GetTextPos() == globalLabel->GetPosition() )
globalLabel->AutoplaceFields( GetScreen(), false );
GetScreen()->Update( globalLabel ); GetScreen()->Update( globalLabel );
GetCanvas()->GetView()->Update( globalLabel ); GetCanvas()->GetView()->Update( globalLabel );
} }
@ -1593,7 +1598,7 @@ void SCH_EDIT_FRAME::RecomputeIntersheetRefs()
void SCH_EDIT_FRAME::ShowAllIntersheetRefs( bool aShow ) void SCH_EDIT_FRAME::ShowAllIntersheetRefs( bool aShow )
{ {
if( aShow ) if( aShow )
RecomputeIntersheetRefs(); RecomputeIntersheetRefs( true );
GetCanvas()->GetView()->SetLayerVisible( LAYER_INTERSHEET_REFS, aShow ); GetCanvas()->GetView()->SetLayerVisible( LAYER_INTERSHEET_REFS, aShow );
} }

View File

@ -804,7 +804,7 @@ public:
* Update the schematic's page reference map for all global labels, and refresh the labels * Update the schematic's page reference map for all global labels, and refresh the labels
* so that they are redrawn with up-to-date references. * so that they are redrawn with up-to-date references.
*/ */
void RecomputeIntersheetRefs(); void RecomputeIntersheetRefs( bool autoplaceUninitialized = false );
void ShowAllIntersheetRefs( bool aShow ); void ShowAllIntersheetRefs( bool aShow );

View File

@ -1233,7 +1233,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const VECTOR2I& pos, const wxString& text ) :
m_fields.emplace_back( SCH_FIELD( pos, 0, this, _( "Sheet References" ) ) ); m_fields.emplace_back( SCH_FIELD( pos, 0, this, _( "Sheet References" ) ) );
m_fields[0].SetText( wxT( "${INTERSHEET_REFS}" ) ); m_fields[0].SetText( wxT( "${INTERSHEET_REFS}" ) );
m_fields[0].SetVisible( true ); m_fields[0].SetVisible( false );
m_fields[0].SetLayer( LAYER_INTERSHEET_REFS ); m_fields[0].SetLayer( LAYER_INTERSHEET_REFS );
m_fields[0].SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); m_fields[0].SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
} }