Commit Graph

232 Commits

Author SHA1 Message Date
Roberto Fernandez Bautista 91fd28c4be Refactor saving sheet and symbol instances in SCH_SEXPR_PLUGIN::Format
Avoid code duplication by moving all common code to a new function
SCH_SEXPR_PLUGIN::saveInstances

Also fixes a bug that was resulting in footprint and value information
not being saved for subsheets that were root sheets in a different
project.
2021-05-03 16:54:42 +01:00
Ian McInerney ecd9bf696e Be consistent about using nullptr instead of 0
0 can be too easily overloaded into an int, so ensure we use nullptr
when we mean pointers.
2021-04-22 22:20:34 +01:00
Ian McInerney ae91042544 Implement thread safety for symbol loading routines
These functions can be called from any thread of the library
loader, so we need to ensure we have some thread safety with them.
2021-04-18 18:39:46 +01:00
jean-pierre charras 31e9895a1a Fix a minor compil warning 2021-04-15 19:49:41 +02:00
Roberto Fernandez Bautista 45409ec314 CADSTAR Schematic: Fix orientation of symbol fields 2021-04-12 20:25:04 +01:00
Roberto Fernandez Bautista 9148542219 CADSTAR Schematic: Fix Text Positioning within Symbols 2021-04-12 20:25:03 +01:00
Thomas Pointhuber f13eb13b9a altium: import images from SchDoc 2021-04-10 21:52:37 +02:00
Wayne Stambaugh 2b86b34124 Eeschema: split out SCH_SHEET_PIN declarations into separate header. 2021-04-06 17:15:49 -04:00
Wayne Stambaugh df186a2049 Eeschema: fix root sheet UUID changing in project file.
This change is a bit more invasive than the description above would
suggest. UUIDs have been added to all schematics.  For now, it's only
useful to the root schematic so that the UUID in the project file does
not change every time the project file is save.  In the future, it may
be useful to store and check the schematic UUIDs against the one's saved
in the project file.

Fixes https://gitlab.com/kicad/code/kicad/issues/7763
2021-04-06 14:28:01 -04:00
Roberto Fernandez Bautista d041578150 CADSTAR Schematic: Fix import of text alignment
Ensure that the text alignment applied to text objects corresponds to
valid text alignments that can be set within eeschema

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8090
2021-04-05 20:15:08 +01:00
Carsten Schoenert cb17c9f3dd Typo fix: Correct various misspelled words
agressive -> aggressive
decription -> description
miscellanous-> miscellaneous
rectange -> rectangle
Unkown -> Unknown
2021-04-03 13:39:50 +00:00
Jeff Young ebfbe14185 Persist fields_autoplaced information.
Fixes https://gitlab.com/kicad/code/kicad/issues/8086
2021-04-02 17:08:58 +01:00
jean-pierre charras 655a696589 fix compil issue 2021-04-01 11:36:30 +02:00
jean-pierre charras 6499b5f296 Eeschema: protect lib symbols against duplicate field names.
If a field name is already in use, try to rename the new field name
(adding the suffix "_1" or "_2" or ... )
This is especially critical when a non mandatory field has the same name as
a mandatory field (was crashing before)
Fixes #8081
https://gitlab.com/kicad/code/kicad/issues/8081
2021-04-01 11:27:14 +02:00
Jeff Young 2ad69fc56b Move importers from wxLog to REPORTER.
Fixes https://gitlab.com/kicad/code/kicad/issues/6389
2021-03-31 22:54:30 +01:00
Roberto Fernandez Bautista c5e4220b5b CADSTAR Schematic: Fix duplicate pins
Fixes a bug that was causing duplicate pins to be loaded
(one on top of the other) for all symbols.
2021-03-30 13:03:56 +00:00
Roberto Fernandez Bautista 1629b038e1 CADSTAR Schematic: Fix loading of symbol instances differing from part
The previous assumption was that a part definition would always hold
the information about the symbol. However some designs have symbol
instances that refer to a different symbol definition than that
specified in the part.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7808
2021-03-30 13:03:56 +00:00
Roberto Fernandez Bautista e6c7ddc271 CADSTAR Schematic: Fix loading of symbol attributes
Fixes an issue that resulted in incorrect field values being loaded
2021-03-30 13:03:56 +00:00
Roberto Fernandez Bautista 51db9cfcef CADSTAR Schematic: Text Loading improvements 2021-03-30 13:03:56 +00:00
Jeff Young a0a5e93782 Remove m_props from symbol library plugins. It's not thread-safe.
Fixes https://gitlab.com/kicad/code/kicad/issues/8035
2021-03-26 21:57:32 +00:00
Jeff Young 3d6c05b210 Apply symbol field id fixup logic to lib parts.
Fixes https://gitlab.com/kicad/code/kicad/issues/7903
2021-03-26 21:57:32 +00:00
Roberto Fernandez Bautista e0d2724f68 CADSTAR Schematic: Increase "tiny" bus labels to 0.4mm text size
Also fix incorrect label orientation
2021-03-25 19:10:49 +00:00
Roberto Fernandez Bautista 6494e0bf25 CADSTAR Schematic: Fix orientation of net labels and sheet pins 2021-03-25 17:50:33 +00:00
Roberto Fernandez Bautista 5a74fb9bb1 CADSTAR Schematic: Ensure connectivity with tiny labels at Bus Entries
Always add a label at bus terminals to ensure connectivity. The original
design might already have a bus terminal with a given location.
If the original design does not have a label, just make it very small
to keep connectivity but make the design look visually similar to
the original.
2021-03-25 17:50:33 +00:00
Wayne Stambaugh cfaca0e4bb Revert "Eeschema: remove all legacy schematic and symbol library save code."
This reverts commit 9c19c2306e.

Unfortunately writing legacy symbols libraries can never be removed because
of the symbol rescue feature. :(

Fixes https://gitlab.com/kicad/code/kicad/issues/7986
2021-03-22 08:19:47 -04:00
Roberto Fernandez Bautista a0889705e7 EAGLE and Altium SCH importers: UpdateSymbolLinks after import
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7687
2021-03-21 20:13:20 +00:00
Thomas Pointhuber d9229697d8 altium: special string override map should be case-insensitive
This only fixes overrides where we explicitly map an override. Wrongly written variables pointing to fields are not corrected by this.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/6256
2021-03-20 20:42:25 +01:00
Wayne Stambaugh 9c19c2306e Eeschema: remove all legacy schematic and symbol library save code.
Legacy schematic and symbol library saving is officially deprecated.
2021-03-20 13:29:44 -04:00
Jon Evans c04e19f9ac Include optimization: move some things from common.h to point-of-use 2021-03-20 12:09:18 -04:00
Thomas Pointhuber 4482b3baba altium: Handle special strings and convert them into KiCad variables. Use Comment for VALUE.
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/6256
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/7736
2021-03-14 16:40:36 +01:00
Jeff Young 2a9186d9e9 Don't re-use FieldIDs when assigning ids on save.
Fixes https://gitlab.com/kicad/code/kicad/issues/7849
2021-03-09 15:09:31 +00:00
Dominik Wernberger e2aa7be4b3 Added a lot of consts and refactored a few lines 2021-03-08 12:49:48 -08:00
Wayne Stambaugh 7a00e01b3e Eeschema: fix false positive library symbol changed ERC errors.
This fix required sorting all of the LIB_PART draw items to ensure
accurate comparison between the symbols stored in the schematic and the
original library symbols.  This has a noticeable impact on symbol library
load performance.  It may also cause significant changes the next time
the library is saved due to changes in the draw item sorting.  Hashing
may be a better solution here but this addressed the immediate problem.

A skeleton method SCH_SCREEN::SwapSymbolLinks() was added because there
is most likely an issue with orphaned symbols in the schematic library
symbol cache during undo/redo operations.  More testing is required to
verify this.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7263
2021-03-04 17:59:24 -05:00
WhiteChairFromIkea ff23f4324a Do not hardcode altium file extension length 2021-03-04 12:20:40 +00:00
Ian McInerney 908de37e7c Don't hardcode the file extensions where possible 2021-03-03 01:13:59 +00:00
WhiteChairFromIkea 2c289b3f35 Check for ".SchDoc" before replacing to ".kicad_sch" for subsheet 2021-03-02 22:30:08 +00:00
WhiteChairFromIkea f83b9236ac Formatting 2021-03-02 22:30:08 +00:00
WhiteChairFromIkea b98602583c Remove "SchDoc" and use "kicad_sch" instead for subsheet names 2021-03-02 22:30:08 +00:00
WhiteChairFromIkea 042ea9761c Revert "Import footprint to symbols. Subsheet is name is prepended to footprint name,..."
This reverts commit 8aa4faa4ce24adc6310223952e8b5773ce245778
2021-03-02 22:30:08 +00:00
WhiteChairFromIkea 292aff48fd Import footprint to symbols. Subsheet is name is prepended to footprint name, which is probably NOT OK when syncing with PCB. 2021-03-02 22:30:08 +00:00
Jeff Young 8a33542bcd SCH_COMPONENT::GetField() expects a vector index, not a field id.
Check this at compile time.  Callers wanting to use an index now must
use SCH_COMPONENT::GetFields()[i] instead.

Fixes https://gitlab.com/kicad/code/kicad/issues/7757
2021-02-28 15:10:37 +00:00
Roberto Fernandez Bautista 76ef98339d CADSTAR PCB Archive Importer: Re-write loading of power symbols
Ensure all each power symbol is unique for each net name even
if it uses the same graphical symbol.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7722
2021-02-26 19:32:44 +00:00
Wayne Stambaugh 1786ae8773 Eeschema: use symbol nomenclature for object file naming. 2021-02-24 08:48:02 -05:00
Jeff Young a3b9e8ddb4 Round 2 of Worksheet -> Drawing Sheet. 2021-02-23 11:57:44 +00:00
Roberto Fernandez Bautista ccbc0f73cc CADSTAR Schematic Archive Importer: Fix Coordinate Rounding error
Rewrite of the calculation to convert CADSTAR to KiCad coordinates,
rounding half way cases away from zero.
Use integer division instead of double, to ensure precision.
2021-02-22 13:24:00 +00:00
Roberto Fernandez Bautista 842a930ced CADSTAR Schematic Archive Importer: Autoplace fields when adding sheet
Makes the sheets look a little bit better when there is no block name
in the original CADSTAR design.
2021-02-22 13:24:00 +00:00
Roberto Fernandez Bautista 7b5cf955af CADSTAR Schematic Archive Importer: Visible fields to calculate BBOX
- Ensures page size is calculated correctly
2021-02-22 13:24:00 +00:00
Roberto Fernandez Bautista 5acdf1ddb1 CADSTAR Schematic Archive Importer: Align to original grid
Previous assumption of 100mil grid in CADSTAR schematic designs has
been proven to be incorrect. Let's use the "working grid" in the
original design instead.
2021-02-22 13:24:00 +00:00
Roberto Fernandez Bautista c98106ebcf CADSTAR Schematic Archive Importer: Parse TESTPOINT
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7574
2021-02-22 13:24:00 +00:00
Roberto Fernandez Bautista 09ebfcd650 CADSTAR Importer: Fix Code Style
- Rename member variable names to use the 'm_' prefix
- Rename a few object types that clashed with KiCad object names, such
  as BOARD and SCHEMATIC, to avoid the use of '::' to access the KiCad
  objects.
- Remove some unused code.
2021-02-22 13:24:00 +00:00
Jeff Young 2a7e60960a Use standard mirror icons & terminology.
Also use standard group icons.

Also put both (and rotate commands) in toolbar.

Fixes https://gitlab.com/kicad/code/kicad/issues/7504
2021-02-16 21:11:36 +00:00
Wayne Stambaugh 114dceec2e Eeschema: Eagle schematic plugin parser improvements.
* Complete drawing of sheet border/title block symbol.
2021-02-16 09:33:15 -05:00
Wayne Stambaugh 089b7afacf Eeschema: Eagle schematic plugin parser improvements.
* Fix multi line text alignment.
* Parse schematic frame objects and convert them to lines.
* Make implicit global labels normal size so they can easily be seen.
* Move sheet fields to a more sensible position.
* Parse schematic symbol instances before wires so that the implicit power
  connections can properly be tested.  This will be used at a later time.
* Scale label text size down to allow for differences in label offset and
  graphical items.
2021-02-15 16:44:58 -05:00
Seth Hillbrand 8745691da3 Toggle LOCALE_IO before re-caching
cacheLib() can cause a re-load event, which requires the C-locale.
LOCALE_IO needs to be set before this event to prevent mistaken ','/'.'
mixups

Fixes https://gitlab.com/kicad/code/kicad/issues/6434
2021-02-15 09:10:21 -08:00
Seth Hillbrand cea9e1b62c Remove Eagle workaround for stacked NC pins
We no longer put stacked NC pins in the same net, so we do not require
this hack.
2021-02-11 16:47:21 -08:00
Roberto Fernandez Bautista 7c06bdbd2e CADSTAR Schematic Archive Importer: Fix parsing of TERMINAL_SHAPE
TRIANGLE shape and a few others do not have a "right length",
only a "length".
Fixes the error "Missing Parameter ‘2’ in ‘TRIANGLE’".
2021-02-10 18:49:21 +00:00
Roberto Fernandez Bautista 80d8974f87 CADSTAR Archive Importer: Fix loading of non-cadstar font text sizes
Non-cadstar fonts use a width of 0.
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista 49bf957c48 CADSTAR Schematic Archive Importer: Fix positioning of global labels
Previous calculation did not take into account rotation of the labels
when calculating the final position.
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista 0841f3ae25 CADSTAR Schematic Archive Importer: Fix wires (Implied connections)
There is an implied connection between elements in a net even though
there might not be a graphical connection in the file.
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista 8add7a880d CADSTAR Schematic Archive Importer: Fix positioning and margins
Fix calculation of sheet bounding box and sheet margins with the aim
of matching CADSTAR pdf output as closely as possible.
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista cb90a4b7e6 CADSTAR Schematic Archive Importer: Handle Pin Swaps
Each schematic symbol instance can have pin numbers that diverge from
the pin number definitions in the library
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista 4ea487936b CADSTAR Schematic Archive Importer: Simplify symbol library name 2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista 4dc264175a CADSTAR Schematic Archive Importer: Symbol name is case insensitive
Fixes an issue on some designs that would not be able to find the
symbol definition referenced by the part due to different
capitalisation of the symbol name in the part definition and
the symbol definition.
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista 914ae001b5 CADSTAR Schematic Archive Importer: Load pin types
Default to passive if undefined
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista f530b12c31 CADSTAR Schematic Archive Importer: Handle undefined pin number in part
Use terminal pin number (i.e. from the symbol definition) when the pin
number is undefined in the part.
This fixes a bug that resulted in symbols with "0" as the pin numbers.
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista cc27c31ab0 CADSTAR Schematic Archive Importer: Import common fields visibilities
Import field visibilities for Ref, Value and Part Name
Also fix incorrect loading of designator from previous commit
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista 297ff282f1 CADSTAR Importer: Update copyright years and remove white spaces 2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista bb6fee531e CADSTAR Schematic Archive Importer: Correctly load symbol instances
Previous implementation was not loading all fields defined in the
library.
2021-02-10 18:49:20 +00:00
Roberto Fernandez Bautista b0051c07cb CADSTAR Schematic Archive Importer: Load all fields in symbols
- Load Fields in the library items as well as schematic instances
- Remove invalid characters (e.g. '\n', '\t', '\r') in fields
- Load footprint field (assume that the footprint library name
  is the same as the filename of the schematic)
2021-02-10 18:49:20 +00:00
Wayne Stambaugh c11ded24cd Add instrumentation to track down local issues in symbol library file code. 2021-02-01 12:57:16 -05:00
Jeff Young dfc6070178 Unify schematic file version checking with PCBNew.
This also makes sure that the user gets a warning before saving over
an older s-expr format.  While that won't always be wanted, it's now
in the infobar (like in PCBNew), so it's not too onerous.§

Fixes https://gitlab.com/kicad/code/kicad/issues/7347
2021-01-31 17:28:14 +00:00
Thomas Pointhuber 619e128536 altium: Fix #6194 by no longer mirroring schematic text. Furthermore improve value parsing. 2021-01-30 15:44:32 +01:00
Jeff Young 540dd11b58 Use the file version when reading lib symbols from schematic file. 2021-01-28 21:31:33 +00:00
Jeff Young ff7742c6b8 File naming and include cleanup. 2021-01-28 11:35:18 +00:00
Jeff Young 0967f8fc78 Fix typo. 2021-01-26 23:17:30 +00:00
Jeff Young 06f85471a4 Fix copy/paste error. 2021-01-26 19:01:31 +00:00
david-beinder 4bcd56b1f6 Always include unit number when copying to clipboard
Fixes https://gitlab.com/kicad/code/kicad/issues/5898 (A)
2021-01-26 18:12:49 +00:00
Wayne Stambaugh 4619d5e112 Fix more broken Doxygen comment specifiers. 2021-01-26 12:17:52 -05:00
Jeff Young 3702f2e0a9 Add uuid r/w for sch pins, text, wires, etc.
Fixes https://gitlab.com/kicad/code/kicad/issues/7269
2021-01-26 10:56:19 +00:00
Jeff Young 0ba0160da9 Add a PT_NIC pin electrical type and a netlist token for SCH_NO_CONNECT.
ADDED a new pin electrical type "free" for internally unconnected pins.

CHANGED the "unconnected" pin electrical type is now represented by
"no_connect" in files and netlists.  (The legacy syntax is also accepted
in files.)
2021-01-23 00:10:01 +00:00
Roberto Fernandez Bautista 42cbcf7ef4 Don't allow empty page numbers
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6698
2021-01-22 14:02:34 +00:00
Roberto Fernandez Bautista b168b74919 CADSTAR Archive Importer: Fix position of multiline text with NO_ALIGNMENT in CADSTAR 2020-12-30 18:53:43 +00:00
Roberto Fernandez Bautista a33ccf48b9 CADSTAR Schematic Archive Importer: Load signal name even if no net label (global labels and power symbols)
Fixes error that prevented global net names from being loaded properly
2020-12-30 18:53:43 +00:00
Roberto Fernandez Bautista f6ec173ba7 CADSTAR Schematic Archive Importer: Do not load blocks without a linked sheet
Fixes std::out_of_range error
2020-12-30 18:53:43 +00:00
Roberto Fernandez Bautista 728792aa3c CADSTAR Schematic Archive Importer: Fix SIGLOC in JPT (Load labels in junctions)
Fixes but that refused to open file with a SIGLOC node in JPT
2020-12-30 18:53:43 +00:00
Roberto Fernandez Bautista a5118df44c CADSTAR Schematic Archive Importer: Load Schematic Text Variables to KiCad project 2020-12-30 18:53:43 +00:00
Roberto Fernandez Bautista 9ed4780fec CADSTAR Archive Importer: Change architecture to Parse CADSTAR fields and store them in a static map
Architecture of the parser changed to have a shared PARSER_CONTEXT between all the individual parsers.
Parses CADSTAR fields such as <@DESIGN_TITLE@> or <@SHEET_NUMBER@> and replaces with an equivalent KiCad Text Variable.
2020-12-30 18:53:42 +00:00
Jeff Young bf632ad771 Pick up root sheet KIID from sheet instances.
Fixes https://gitlab.com/kicad/code/kicad/issues/6725
2020-12-18 12:49:20 +00:00
Jeff Young bb232e6ac6 Unify LIB_IDs now that both are stored in sexpr files.
Fixes https://gitlab.com/kicad/code/kicad/issues/6764
2020-12-18 00:30:26 +00:00
Jeff Young 10e68daa37 Fix some bugs in Change Symbol and Update Symbols.
In particular, there was a typo that kept library values from being
updated, and there was missing logic to fetch the various field names
from the library parts (and the change-to part).

Also implements some performance gains by desisting from copying
LIB_FIELDs around every time we want to look at them.

Fixes https://gitlab.com/kicad/code/kicad/issues/6733

Fixes https://gitlab.com/kicad/code/kicad/issues/6749
2020-12-15 16:12:17 +00:00
Jeff Young 797a588015 Aliases should inherit their descs, keywords, and fp filters.
Assuming they're not set locally, of course.

Also updates to new class structure order.

Fixes https://gitlab.com/kicad/code/kicad/issues/6051
2020-12-14 13:48:26 +00:00
Wayne Stambaugh e61f768fbc Eeschema: add defensive code to symbol library cache I/O. 2020-12-09 11:46:10 -05:00
Jeff Young d8fa37d5c2 Remove old root-schematic hacks. They don't work anymore anyway.
Fixes https://gitlab.com/kicad/code/kicad/issues/6583
2020-12-02 14:27:43 +00:00
Ian McInerney aa09418a14 Fixup memory lifespan of GAL options for the settings preview canvas
The canvas keeps a reference to the settings object, so we
can't pass one from the stack because it runs into lifetime
issues.

Also cleanup some loop-iterator problems.

Fixes https://gitlab.com/kicad/code/kicad/issues/6338
2020-12-01 01:12:07 +00:00
jean-pierre charras 56bb91b042 French translation update 2020-11-29 13:40:48 +01:00
jean-pierre charras 09a1137f11 Fix a minor compil warning 2020-11-29 13:06:44 +01:00
Roberto Fernandez Bautista 6a28d6af27 CADSTAR Schematic Archive Importer: Fix loading of Schematic Sheet Pins and Orientation of Labels
- Find the intersection between the wire and the sheet and place the sheet pin there
- Fix orientation of hierarchical labels and global labels by applying opposite orientation to the connecting wire
2020-11-28 17:18:17 +00:00
Roberto Fernandez Bautista ba77bf662c CADSTAR Schematic Importer: Fix loading of buses
Place bus labels and correctly group nets for the bus in a BUS_ALIAS
2020-11-28 17:18:17 +00:00
Roberto Fernandez Bautista 0691e942f4 CADSTAR Archive Importer: Fix duplicate KIID for loaded elements
Don't use clone to copy an EDA_ITEM. Use Duplicate().
Even if you give the clone a new KIID, all its children will still be clones.
Create Duplicate() in LIB_PART
2020-11-28 17:18:17 +00:00
Roberto Fernandez Bautista d2fbe12cfd CADSTAR Schematic Archive Importer: Parse SCALE token in Symbol and warn user this is not supported
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6463
2020-11-28 17:18:17 +00:00