← Back to team overview

kicad-developers team mailing list archive

[PATCH] Clear autoplaced flag when modifiying field orientation/justification

 

Fixes: https://bugs.launchpad.net/kicad/+bug/1743893

-Jon
From 296e2ea514ce1f8773b4aefc49f3fe25b147fd14 Mon Sep 17 00:00:00 2001
From: Jon Evans <jon@xxxxxxxxxxxxx>
Date: Wed, 17 Jan 2018 21:51:48 -0500
Subject: [PATCH] Clear autoplaced flag when modifiying field
 orientation/justification

Fixes: lp:1743893
* https://bugs.launchpad.net/kicad/+bug/1743893
---
 eeschema/dialogs/dialog_edit_one_field.cpp | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/eeschema/dialogs/dialog_edit_one_field.cpp b/eeschema/dialogs/dialog_edit_one_field.cpp
index 6fd58bf28..3aeea4d36 100644
--- a/eeschema/dialogs/dialog_edit_one_field.cpp
+++ b/eeschema/dialogs/dialog_edit_one_field.cpp
@@ -301,6 +301,25 @@ void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH*
             component->SetRef( aSheetPath, m_text );
     }
 
+    bool modified = false;
+
+    modified = ( modified ||
+                 ( ( aField->GetTextAngle() == TEXT_ANGLE_VERT ) != m_orientation ) );
+
+    modified = ( modified ||
+                 ( ( aField->GetHorizJustify() !=
+                     IntToEdaTextHorizJustify( m_horizontalJustification - 1 ) ) ) );
+
+    modified = ( modified ||
+                 ( ( aField->GetVertJustify() !=
+                     IntToEdaTextVertJustify( m_verticalJustification - 1 ) ) ) );
+
     aField->SetText( m_text );
     updateText( aField );
+
+    if( modified )
+    {
+        auto component = static_cast< SCH_COMPONENT* >( aField->GetParent() );
+        component->ClearFieldsAutoplaced();
+    }
 }
-- 
2.14.1


Follow ups