Commit Graph

148 Commits

Author SHA1 Message Date
Wayne Stambaugh 54f066fed7 Implement simple inheritance for library symbols.
This change completely removes the LIB_ALIAS design pattern an replaces
it by allowing LIB_PART objects to inherit from other LIB_PART objects.
The initial implementation only allows for single inheritance and only
supports the mandatory fields in the derived part because that is all
that the current symbol library file format will support.  Once the new
file format is implemented and saving to the old file format is deprecated,
more complex inheritance will be added.  The LIB_ALIAS information saved
in the document files was move into the LIB_PART object.  This change
impacts virtually every part of the schematic and symbol library editor
code so this commit message is woefully incomplete.

REMOVE: Removed the symbol aliases concept from the schematic and symbol
editors and the symbol viewer.

NEW: Replace the symbol alias concept with simple inheritance that allows
a library symbol to be derived from another library symbol.
2019-12-06 11:33:52 -05:00
Seth Hillbrand c6f5df134c Minor speed cleanup
This adjusts iterators to use const reference when only used for
copy.  It also ensures pre-allocation of vectors when size is known
ahead of time.
2019-12-05 14:20:59 -08:00
Jeff Young b4c8657904 Fix non-visible-part or conversion items from getting selected.
Also renames lib_draw_item to lib_item to match the class.

Fixes: lp:1840170
* https://bugs.launchpad.net/kicad/+bug/1840170
2019-08-15 10:00:23 +01:00
Seth Hillbrand bc096dc4ee Eagle: Fix stacked NC pin import
Since Eagle does not connect stacked NC pins but KiCad will if the pins
are coincident, we choose to only import the first of the stacked NC
pins.  While this creates symbols that are slightly different in pin
count from the Eagle version, it keeps the schematic and netlist
functionally correct relative to the Eagle version.

Fixes: lp:1821319
* https://bugs.launchpad.net/kicad/+bug/1821319

(cherry picked from commit 370109b868)
2019-06-09 17:03:44 -07:00
Seth Hillbrand 598b140112 eagle: Strip newlines from description
Eeschema old format is line-terminated so the newlines in descriptions
will break the schematic file if saved.

Fixes: lp:1829707
* https://bugs.launchpad.net/kicad/+bug/1829707

(cherry picked from commit fb85612f81)
2019-06-07 22:08:58 -07:00
Jon Evans 1142eb259b Eagle: properly translate group buses now that we support them 2019-06-05 22:09:09 -04:00
Jeff Young d6e9bdf07b Convert remaining legacy drawing code to print code. 2019-05-31 21:54:22 +01:00
Seth Hillbrand 0e5cc54ec9 Eagle: Fix crash when importing Eagle V6
This fixes multiple issues when importing Eagle V6 files.

Crashes occured when arcs of 0-length were found and when parts were
referenced in the schematic that were not found in the library.  This
could happen if the library and schematic were different cases.

Fixes: lp:1830564
* https://bugs.launchpad.net/kicad/+bug/1830564
2019-05-26 20:31:55 -07:00
Jeff Young 323bb0f8e1 Moving PageLayout editor to GAL canvas and modern toolset. 2019-05-24 19:49:09 +01:00
Seth Hillbrand a62a89eac3 EAGLE: Prevent numeric-only component references
KiCad does not allow references to be numeric only.  This prefixes such
references with "UNK" to note that the reference designator type is
unknown.
2019-05-21 13:49:18 -07:00
Jeff Young d8cc2f8280 More cleanup from non-reference return from GetText(). 2019-04-03 19:35:25 +01:00
Jeff Young 3ace73fbdd Fold various SCH pin shadow data structures into SCH_PIN. 2019-04-03 10:18:11 +01:00
Seth Hillbrand 0a4812be07 eagle: Set default pin type
Eagle 7.4 DTD defines pin direction as optional with a default of IO
(bidirectional).

Fixes: lp:1808585
* https://bugs.launchpad.net/kicad/+bug/1808585
2019-01-06 08:54:14 -08:00
Wayne Stambaugh 34ea79eddb Fix LIB_ID illegal character tests.
The '/' and ':' are reserved and cannot be used in symbol or footprint
names.  They will cause the LIB_ID parser and formatter to fail.  While
it seems like they should be legal in symbol alias names, they will
trigger a symbol rescue the next time the schematic is loaded.

Use ID_SCH as in the Eagle schematic plugin rather than ID_ALIAS to
ensure symbol names do not need rescued the next time the schematic is
opened.

Remove ID_ALIAS since the rules for alias names are the same as the
rules for symbol names.  Otherwise, allowing '/' and ':' in alias names
will force a symbol rescue on the next schematic load.

Fixes lp:1795600

https://bugs.launchpad.net/kicad/+bug/1795600
2018-10-07 09:09:27 -04:00
Maciej Suminski 2c217499b5 Eagle SCH importer: fix slash characters when fixing symbol names
Even though slash is a valid character in symbol names, it is a revision
separator, but is not the case with Eagle symbol names.

Fixes: lp:1791653
* https://bugs.launchpad.net/kicad/+bug/1791653
2018-09-12 10:13:13 +02:00
Seth Hillbrand 5bd959d92c Eagle: Fix NULL-dereference on malformed Eagle files
Eagle files that are edited may be missing required data.  While we do
not need to handle these files, we do need to prevent segfaults in KiCad
when reading them.
2018-08-19 19:48:10 -07:00
Mark van Doesburg 91e3d21d68 Eeschema: Copy attributes from eagle.
Eagle allows for variants of components to be listed in the schematic.
This patch copies the variant data into the imported schematic item,
prefixing the alternate variant names with "VARIANT_" and keeping the
alternate values.
2018-07-31 11:58:01 -07:00
Seth Hillbrand d30ac2967a eeschema: Rescue symbols with illegal chars
When parsing component names, we need to account for the possibility of
illegal characters (e.g. "/", ":") in the names from v4 libraries.  They
are fixed internally by the cache parser but if we don't fix them
in the rescue routine, the symbol won't match it's cache name.

This standardizes all schematic illegal character routines into LIB_ID

Fixes: lp:1774774
* https://bugs.launchpad.net/kicad/+bug/1774774
2018-06-27 14:15:30 -07:00
Maciej Suminski 228881f552 Eagle SCH import: validate package (footprint) names 2018-06-06 10:12:04 +02:00
Maciej Suminski 94f161b8c2 Eagle SCH import: validate imported symbol names
Fixes: lp:1753189
* https://bugs.launchpad.net/kicad/+bug/1753189
2018-05-29 09:29:22 +02:00
Maciej Suminski e789523632 Eagle SCH import: do not crash if nothing was imported 2018-05-29 09:29:21 +02:00
Jeff Young 62d6750ced Use default for attribute "display" if not found.
Fixes: lp:1767447
* https://bugs.launchpad.net/kicad/+bug/1767447
2018-05-11 16:11:38 +01:00
Maciej Suminski c8f4e1051b Eagle SCH import: keep multi-unit parts not interchangeable
Eagle supports more sophisticated unit swapping information,
so the safest choice is to prevent any unit manipulation.
2018-05-08 12:17:46 +02:00
Maciej Suminski 3f734eb1b5 Improved validation of library and entry names
Symbol/footprint library and entry have the same set of forbidden
characters with a single exception, space character. To accommodate for
this difference, LIB_ID validation and fix methods have been extended to
specify the LIB_ID type that is checked (schematic/board).

LIB_ID::HasIllegalChars() and LIB_ID::FixIllegalChars() had two different
sets of characters treated as invalid in LIB_IDs. The set has been
factored out to another function to avoid duplication.
2018-04-13 14:24:57 +02:00
Maciej Suminski 58c27398cb Eagle SCH import: improved implicit connections resolution
Nets assigned by power pins are weak, meaning they are valid
as long as there is nothing else attached to such pins. This patch
checks whether there are other wires or pins attached to a power pin
before placing a global net label.

Fixes: lp:1755191
* https://bugs.launchpad.net/kicad/+bug/1755191
2018-04-12 18:12:22 +02:00
Maciej Suminski e7ed415930 Eagle SCH import: handle implicit connections
Each named power input pin in Eagle creates an implicit connection to a
net with the name of the pin (e.g. GND, VCC). It is also done for the
units (gates in Eagle nomenclature) that have not been instantiated in
the schematics.

To emulate this behaviour in KiCad:
- Placed components are checked for power input pins, so they will have
global net labels attached to create the described implicit connections.
- As the components are placed, the remaining units of the symbol are
checked for power inputs to see if they need to be instantiated together
with global net labels.

Fixes: lp:1755191
* https://bugs.launchpad.net/kicad/+bug/1755191
2018-04-06 16:20:59 +02:00
Maciej Suminski 78c9b34b5d Eagle SCH import: moved sheet bbox calculation to a function 2018-04-06 16:02:58 +02:00
Maciej Suminski 9ee698bbcd Eagle SCH import: save the imported library file once the library section is processed
It is required to access symbol data in later import stages.
2018-04-06 16:02:18 +02:00
Maciej Suminski 71bf488507 Eagle SCH importer: fixed open-collector pin type, simplified pin direction matching 2018-04-03 14:26:15 +02:00
Maciej Suminski 6d06ed3579 Eagle SCH importer: minor fixes
- set correct reference for components
- handle "pwr" direction for pins
- discarded a redundant variable
2018-04-03 14:26:15 +02:00
Maciej Suminski eb9099238a Eagle SCH import: Improved net label placement algorithm
Eagle support net labels that are naming wires not directly connected to
the labels. In KiCad it is not possible, therefore such detached net
labels need to be moved, so they touch the corresponding wire.

The initial algorithm did not take into account that a moved net label
might be placed on a wire crossing, effectively shorting two nets. This
commit improves the placement algorithm by avoiding the wire crossing
points when placing a label.

Fixes: lp:1748502
* https://bugs.launchpad.net/kicad/+bug/1748502
2018-03-29 12:16:11 +02:00
Maciej Suminski 88915f7940 SCH_EAGLE_PLUGIN::addBusEntries(): prevent operating on deleted objects 2018-03-29 12:11:36 +02:00
Maciej Suminski 99e79c077a Eagle SCH import: Code formatting 2018-03-29 12:11:35 +02:00
Maciej Suminski 434b385a95 Eagle SCH importer: prepend # to references of symbols without assigned footprints
With hash character starting the reference value, schematic components
are considered as virtual and therefore netlist updater do not warn about
an unsigned footprint anymore. This approach is useful to handle logos,
frames or other virtual Eagle components.

Fixes: lp:1756281
* https://bugs.launchpad.net/kicad/+bug/1756281
2018-03-22 18:20:02 +01:00
Maciej Suminski e9537953cd Eagle SCH importer: reduced code duplication for importing labels 2018-03-22 18:20:02 +01:00
Maciej Suminski 260f680c6c Eagle import: fix memory leak on schematic sheets import 2018-03-04 16:47:26 +01:00
Russell Oliver 3d9c25494c Revert "Eagle importer: use only global net labels"
This reverts commit b1f456fade.
2018-03-04 16:42:55 +01:00
Carsten Schoenert ff305781fb fix misspelled 'neeeded' -> 'needed' 2018-02-25 17:10:10 -05:00
Maciej Suminski 24fcdb00cc Eagle importer: convert special characters in net names
Convert '!' to '~' to reflect overbar toggling and change '~' to '~~'.
Now it matches the net names in schematics import plugin.
2018-02-17 00:03:28 +01:00
Maciej Suminski b1f456fade Eagle importer: use only global net labels
Local net labels are preceded with sheetpath (even for single sheet
schematics it is '/') causing net name conflicts between schematics and
layout. It can be easily avoided by using exclusively global net
labels, at the cost having uglier schematics.
2018-02-17 00:03:28 +01:00
Maciej Suminski ac9fc949bd Code formatting for 013f7b4d 2018-02-13 14:56:11 +01:00
Russell Oliver 34b52c91b7 Add empty eeschema page layout for Eagle schematic import.
Fixes: lp:1729722
* https://bugs.launchpad.net/kicad/+bug/1729722
2018-02-13 14:56:11 +01:00
Russell Oliver e340e8a838 Eagle Schematic Import: Label Placement fix.
Extra labels to preserve eagle named nets feature are now placed at the
end of a wire segment instead of the middle of a wire. Prevents a label
being placed on crossing wires that are not connected by a junction
resulting in an incorrent netlist.
2018-02-12 15:35:28 +01:00
jean-pierre charras 8022f1cc01 fix code after renamin files 2018-01-30 11:49:51 +01:00
jean-pierre charras 795a36c9fe Fix code after renaming files, and a bit of code cleanup (remove useless includes and multiple includes of the same files) 2018-01-30 09:57:25 +01:00
jean-pierre charras 4c5bd01887 Rename a few files 2018-01-28 22:02:31 +01:00
Maciej Suminski 378846c2e3 Eagle Schematics Importer: support for UTF-8
Fixes: lp:1736083
* https://bugs.launchpad.net/kicad/+bug/1736083
2017-12-17 19:54:21 +01:00
Maciej Suminski 7665a839cd Eagle Schematic Import: try harder to generate a meaningful library name
The previous implementation relied only on the project name. When it is
set, the imported library was named '-eagle-import'. Now it tries
the project name and then the file name, using 'noname-eagle-import'
as fallback.

The library name is stored in the plugin to avoid changing the library
name after the project name has been set.
2017-12-17 18:45:40 +01:00
Simon Richter a9ccf1161b Fix quotes in UI messages
This replaces all single and angle bracket quotes in UI messages with
double quotes, for consistency.

Sorry to all translators.
2017-12-15 07:33:07 -05:00
Wayne Stambaugh b82bd8e0c5 Fix symbol names with illegal library ID characters.
Change the legacy schematic plugin to preserve illegal LIB_ID characters
when load schematics prior to version 4.

Check for illegal LIB_ID symbol names during project rescue.  Rename and
rescue any symbols with illegal LIB_ID names.

Add static methods to LIB_ID object for testing for and fixing names
with illegal characters so there is uniform code for doing so.

Update the Eagle plugin symbol loader to fix symbol names using the new
LIB_ID fix illegal names method.

Fixes lp:1732236

https://bugs.launchpad.net/kicad/+bug/1732236
2017-11-23 10:52:55 -05:00