← Back to team overview

kicad-developers team mailing list archive

Libedit regression patch


Hi Guys,

Just a really quick patch to fix a libedit regression.

To repeat:

Select a component (CMPA) Which will be the basis of a new component.
Select the edit fields dialog, and edit the value field to effectively
create a new part (CMPB)
Save the new edited component, and eeschema will inform you that CMPA
exists in the library, do you want to modify it?

The problem stems from not propogating the value field change to the
name of the component, and the save function uses the name of the
component instead of the value.

It's a bit of a grey area I think, but at the moment we need to keep
the name and value in sync until they are properly separated.

Attached is a very quick patch to solve the problem, though it might
be better to do this patch in the OnOk method of the edit fields
dialog instead.

Best Regards,

=== modified file 'eeschema/class_libentry.cpp'
--- eeschema/class_libentry.cpp	2010-08-10 15:42:26 +0000
+++ eeschema/class_libentry.cpp	2010-08-20 21:14:40 +0000
@@ -1005,7 +1005,11 @@
         drawings.push_back( field );
-    drawings.sort();    // would be nice to know why...
+    // Enables the use of GetField( VALUE ), etc.
+    drawings.sort();
+    // We need to keep the name and the value the same at the moment!
+    SetName(GetValueField().m_Text);

Follow ups