kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #39872
Re: [eeschema] Names/descriptions for units
-
To:
kicad-developers@xxxxxxxxxxxxxxxxxxx
-
From:
"Kliment (Future Bits)" <kliment@xxxxxxxx>
-
Date:
Sun, 24 Mar 2019 00:34:35 +0100
-
Autocrypt:
addr=kliment@xxxxxxxx; prefer-encrypt=mutual; keydata= mQINBFPtJ9wBEADeq3GIygRh2Kb1MovcIzdT6cdWZlEG+SEMl4EJRd904RkgzgLLD5T3J1DZ aAhE3o9aZUScMrzxE2Cl5nsn9I4BEMix5maWhW9zEr5COix02NqLh8l4xmDp5rGeQX4KoIBY WKidMQ7GB6/rIEDBI0BimTarOQzm8KeUybkr90Ck6lC9kIjis8GBbWegFrY6EI7dE40dO5mT AMuseDkPsn1HnKtI7zhO8iZSfjGCofZL0wOsD8diFpHgWvEGSqtZ5qPJAlwSge3J23TA7e9c ljt94c4Vg+jwjxYObRXYz0x3VOZxgHqooIhABY92vlBlYelIwXD42Gas7jULQd3BAQhmPWNl NXuwYzK9uOnpJCrTDGhYtV4DsWLWVVjnlsM2PcPKpEjIrQvtN56Rs/6eE991dhzQB3KH9nDU uMyaWx2LUi15G7FmGHjCOjVmlJlLyUh8pgbhNHgX0J8TAQoq3lAKti2DGJuz82WUgLM8pSk3 Pznmx6gZtd0kP1s/RuN5bP5EGDWawheFhAni7SXAtgKS+BuRRI42h8rJdN5c+6+9SSiHg4py CqbV9hnSAP7+U1wS6VVps5kAzDOjwMn0yB0uG92V92dZ49nBEjOeySNQPQyYUZ427ErhKNUu xeRmx2+Bscgj6M0CK7P5VynNwEpCTx+gdVb9bSI4ucGZ/S8+gQARAQABtChLbGltZW50IChG dXR1cmUgQml0cykgPGtsaW1lbnRAMHhmYi5jb20+iQI+BBMBAgAoBQJT7SfcAhsjBQkJZgGA BgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRAvRRxcBGc6lfNmD/sGJ/YbKwisrUnQl33h 593cu0xsUrn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@0xfb.com>
-
Openpgp:
preference=signencrypt
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1
I have a prototype implementation of this now - descriptions are
currently taken from fields _UNITDESC_A, _UNITDESC_B etc. The unit
descriptions show up when browsing parts in the add dialog, and in the
dropdown menu when selecting units in the symbol editor. There is no GUI
for setting unit names yet - for the moment you have to add them as
normal fields. Patch is attached. All feedback very welcome.
Kliment
On 22.03.19 21:56, Kliment (Future Bits) wrote:
> I don't quite follow - what I'm proposing doesn't require any file
> format changes, I was planning to just use the existing field functionality.
>
> If you want to bake it into the format instead, I'm 100% okay with that,
> but I don't think it's necessary. I'll look into implementing the UI
> functionality and defer to you on how/where to store the data.
>
> On 22.03.19 21:45, Wayne Stambaugh wrote:
>> Hi Kliment
>>
>> This cannot happen until the new symbol library file format is
>> implemented. There is a freeze (except for the new bus expansion
>> changes) on the current file format. I will add a unit description
>> field for units in the new file format this way you can add a unique
>> description for each unit should you desire.
>>
>> Cheers,
>>
>> Wayne
>>
>> On 3/22/19 4:38 AM, Kliment (Future Bits) wrote:
>>> Hey,
>>>
>>> I'm working with a part that has a very large number of
>>> non-interchangeable units, each with many pins. For a part like this,
>>> it's very difficult to tell which unit is which from the preview. Parts
>>> have a description field that is shown in the list, but units don't. For
>>> parts with non-interchangeable units, I think a description like that
>>> would be very useful. I'd be interested in implementing such a thing.
>>> One way I can think of of doing this would be as follows:
>>>
>>> UI changes:
>>> 1. minor change to add part/component selection dialog - use the space
>>> to the right of "Unit A" etc to show description, add description to the
>>> space after the RD in the bottom part of the dialog
>>>
>>> 2. change to symbol editor - display unit description after "Unit A" in
>>> unit dropdown
>>>
>>> optionally, 3. make unit dropdown editable, make changes there save to
>>> unit name
>>>
>>> I would propose storing the descriptions in fields with special names of
>>> the form UNITDESC_A, _B etc. This requires no change to the existing
>>> data model.
>>>
>>> I'd like some feedback on a) whether this is a good idea, b) whether I'm
>>> stepping on anyone's toes if I do it and c) what branch should I base it off
>>>
>>> Thanks!
>>>
>>> Kliment
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help : https://help.launchpad.net/ListHelp
>>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help : https://help.launchpad.net/ListHelp
>>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
From f8432c1eb96eef566254f5e6006060d09022444c Mon Sep 17 00:00:00 2001
From: Kliment Yanev <kliment.yanev@xxxxxxxxx>
Date: Sun, 24 Mar 2019 00:23:00 +0100
Subject: [PATCH] Add unit label functionality If a part has _UNITDESC_A,
_UNITDESC_B etc fields their values will be shown as the unit description in
the part selection dialog and the unit selection dropdown
---
common/lib_tree_model.cpp | 3 +--
eeschema/class_libentry.cpp | 17 +++++++++++++++++
eeschema/class_libentry.h | 11 +++++++++++
eeschema/libedit/lib_edit_frame.cpp | 2 +-
include/lib_tree_item.h | 1 +
5 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/common/lib_tree_model.cpp b/common/lib_tree_model.cpp
index 71fe74c7d..dbee70166 100644
--- a/common/lib_tree_model.cpp
+++ b/common/lib_tree_model.cpp
@@ -129,7 +129,6 @@ LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* a
{
static void* locale = nullptr;
static wxString namePrefix;
-
// Fetching translations can take a surprising amount of time when loading libraries,
// so only do it when necessary.
if( Pgm().GetLocale() != locale )
@@ -145,7 +144,7 @@ LIB_TREE_NODE_UNIT::LIB_TREE_NODE_UNIT( LIB_TREE_NODE* aParent, LIB_TREE_ITEM* a
LibId = aParent->LibId;
Name = namePrefix + " " + aItem->GetUnitReference( aUnit );
- Desc = wxEmptyString;
+ Desc = aItem->GetUnitDescription( aUnit );
MatchName = wxEmptyString;
IntrinsicRank = -aUnit;
diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp
index 0a96f849d..cb422ddd6 100644
--- a/eeschema/class_libentry.cpp
+++ b/eeschema/class_libentry.cpp
@@ -146,6 +146,11 @@ wxString LIB_ALIAS::GetUnitReference( int aUnit )
return LIB_PART::SubReference( aUnit, false );
}
+wxString LIB_ALIAS::GetUnitDescription( int aUnit )
+{
+ return shared->GetUnitDescription(aUnit);
+}
+
const EDA_RECT LIB_ALIAS::GetBoundingBox() const
{
@@ -341,6 +346,18 @@ wxString LIB_PART::SubReference( int aUnit, bool aAddSeparator )
return subRef;
}
+wxString LIB_PART::GetUnitDescription( int aUnit )
+{
+ wxString fieldid="_UNITDESC_";
+ fieldid<<LIB_PART::SubReference(aUnit,false);
+ LIB_FIELD* descfield=FindField(fieldid);
+ if(descfield==NULL)
+ {
+ return wxEmptyString;
+ } else {
+ return descfield->GetFullText();
+ }
+}
const wxString& LIB_PART::GetName() const
{
diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h
index dcca4e029..c8da0523d 100644
--- a/eeschema/class_libentry.h
+++ b/eeschema/class_libentry.h
@@ -174,6 +174,11 @@ public:
*/
wxString GetUnitReference( int aUnit ) override;
+ /**
+ * For symbols with units, return a unit description for unit x if available.
+ */
+ wxString GetUnitDescription( int aUnit ) override;
+
/**
* A temporary conversion (deMorgan) designation for rendering, preview, etc.
*/
@@ -668,6 +673,12 @@ public:
*/
static wxString SubReference( int aUnit, bool aAddSeparator = true );
+ /**
+ * @return the description of this unit (if any)
+ * @param aUnit = the part identifier ( 1 to max count)
+ */
+ wxString GetUnitDescription( int aUnit);
+
// Accessors to sub ref parameters
static int GetSubpartIdSeparator() { return m_subpartIdSeparator; }
diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp
index 9a81b354e..a6936f29a 100644
--- a/eeschema/libedit/lib_edit_frame.cpp
+++ b/eeschema/libedit/lib_edit_frame.cpp
@@ -372,7 +372,7 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
for( int i = 0; i < part->GetUnitCount(); i++ )
{
wxString sub = LIB_PART::SubReference( i+1, false );
- wxString unit = wxString::Format( _( "Unit %s" ), GetChars( sub ) );
+ wxString unit = wxString::Format( _( "Unit %s %s" ), GetChars( sub ), GetChars(part->GetUnitDescription(i+1)) );
m_partSelectBox->Append( unit );
}
}
diff --git a/include/lib_tree_item.h b/include/lib_tree_item.h
index 5ad5ef4bd..6efd7f041 100644
--- a/include/lib_tree_item.h
+++ b/include/lib_tree_item.h
@@ -62,6 +62,7 @@ public:
* For items with units, return an identifier for unit x.
*/
virtual wxString GetUnitReference( int aUnit ) { return wxEmptyString; }
+ virtual wxString GetUnitDescription( int aUnit ) { return wxEmptyString; }
};
#endif //LIB_TREE_ITEM_H
--
2.17.1
Follow ups
References