It's a real mess IMHO... I think most of the issues comes from the reference m_Text needing to contain the 'full' reference, instead of only the reference field. Why is that?
Because it's also an EDA_TEXT which draws m_Text without passing from GetText(), simply (there may be other reasons). The fact that complex hierarchies exist only aggravate the issue :((( From a pure modelling standpoint the SCH_FIELD(REFERENCE) should only contain the base reference. But then it wouldn't be shown properly. Even if we make EDA_TEXT go through GetText and override (as it is now) GetText to get the 'full' reference, we would lose the ref->SetText(ref->GetText()) invariant, which is actually what give the problem. As a quick hack I'd would suggest a GetBaseText (as proposed) which would *strip* the subpart ID from the reference; I feel that would be extremely wrong and source of further problems... OTOH why the GetRef function would need the SCH_SHEET_PATH to work? hasn't the SCH_COMPONENT already have the needed infos? I think a more 'elegant' solution would be: - The field itself (its m_Text) *always* contains the reference without subpart ID. That would rid of many (all?) of the current SetText(GetText) calls. - The EDA_TEXT would follow a MVC route and use a virtual override (something like GetPresentationText) to allow runtime generation of the text (the default would be a no-op). - SCH_FIELD having access to the component via the m_Parent link would override the GetPresentationText to correctly show the subid (this would also handle the GOST variant) - SCH_COMPONENT would get the GetRef() and GetFullRef() members to obtain the reference (with or without subpart id). This would also clean some of the usage of GetField(REFERENCE)->GetText() - Need to inspect all the GetField(REFERENCE) to ensure it's getting the correct stuff Not easy but I can't devise a more simple/elegant solution. How do you feel about that? -- Lorenzo Marcantonio Logos Srl
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

