diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index 24394513f0..480004cacb 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -2317,20 +2317,19 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer ) if( aSymbol->GetDNP() ) { - BOX2I bbox = aSymbol->GetBodyAndPinsBoundingBox(); + COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings(); + BOX2I bbox = aSymbol->GetBodyAndPinsBoundingBox(); + VECTOR2I pt1 = bbox.GetOrigin(); + VECTOR2I pt2 = bbox.GetEnd(); m_gal->SetIsStroke( true ); m_gal->SetIsFill( true ); - COLOR_SETTINGS* colors = Pgm().GetSettingsManager().GetColorSettings(); - m_gal->SetStrokeColor( colors->GetColor( LAYER_ERC_ERR ) ); m_gal->SetFillColor( colors->GetColor( LAYER_ERC_ERR ) ); - m_gal->DrawSegment( bbox.GetOrigin(), bbox.GetEnd(), - 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) ); - m_gal->DrawSegment( bbox.GetOrigin() + VECTOR2I( bbox.GetWidth(), 0 ), - bbox.GetOrigin() + VECTOR2I( 0, bbox.GetHeight() ), - 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) ); + m_gal->DrawSegment( pt1, pt2, 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) ); + std::swap( pt1.x, pt2.x ); + m_gal->DrawSegment( pt1, pt2, 3.0 * schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS ) ); } } @@ -2398,6 +2397,16 @@ void SCH_PAINTER::draw( const SCH_FIELD* aField, int aLayer, bool aDimmed ) bbox.Offset( label->GetSchematicTextOffset( &m_schSettings ) ); } + if( m_schSettings.GetDrawBoundingBoxes() ) + { + m_gal->SetIsFill( false ); + m_gal->SetIsStroke( true ); + m_gal->SetStrokeColor( aField->IsSelected() ? COLOR4D( 1.0, 0.2, 0.2, 1 ) + : COLOR4D( 0.2, 0.2, 0.2, 1 ) ); + m_gal->SetLineWidth( schIUScale.MilsToIU( 3 ) ); + m_gal->DrawRectangle( bbox.GetOrigin(), bbox.GetEnd() ); + } + m_gal->SetStrokeColor( color ); m_gal->SetFillColor( color ); diff --git a/eeschema/tools/ee_tool_base.h b/eeschema/tools/ee_tool_base.h index d0ac0d42e1..1822e5e947 100644 --- a/eeschema/tools/ee_tool_base.h +++ b/eeschema/tools/ee_tool_base.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2023 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 @@ -158,7 +158,14 @@ protected: if( editFrame ) { - if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T ) + if( itemType == SCH_FIELD_T ) + { + editFrame->SaveCopyInUndoList( editFrame->GetScreen(), + static_cast( aItem->GetParent() ), + UNDO_REDO::CHANGED, aAppend, + false ); + } + else if( itemType == SCH_PIN_T || itemType == SCH_SHEET_PIN_T ) { editFrame->SaveCopyInUndoList( editFrame->GetScreen(), static_cast( aItem->GetParent() ), diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 2d27904ba5..a340f802c6 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 CERN - * Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2019-2023 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 @@ -1361,11 +1361,15 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent ) void SCH_EDIT_TOOL::editFieldText( SCH_FIELD* aField ) { + KICAD_T parentType = aField->GetParent() ? aField->GetParent()->Type() : SCHEMATIC_T; + // Save old symbol in undo list if not already in edit, or moving. if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved saveCopyInUndoList( aField, UNDO_REDO::CHANGED ); - KICAD_T parentType = aField->GetParent() ? aField->GetParent()->Type() : SCHEMATIC_T; + if( parentType == SCH_SYMBOL_T && aField->GetId() == REFERENCE_FIELD ) + static_cast( aField->GetParent() )->SetConnectivityDirty(); + wxString caption; // Use title caps for mandatory fields. "Edit Sheet name Field" looks dorky.