Commit Graph

561 Commits

Author SHA1 Message Date
Wayne Stambaugh 85805bdad7 Fix broken legacy file format symbol instance data import. 2022-10-19 12:23:28 -04:00
Wayne Stambaugh 598b09821a Coverity fixes. 2022-10-17 15:30:20 -04:00
Wayne Stambaugh b109136c5c Fix complex hierarchy instance data when loading legacy schematic. 2022-10-15 14:50:06 -04:00
Wayne Stambaugh f782323960 Fix yet another symbol instance issue when loading legacy schematics. 2022-10-15 14:16:03 -04:00
Jeff Young 254dff2813 Add do_not_autoplace to schematic parser and printer.
Fixes https://gitlab.com/kicad/code/kicad/issues/12657
2022-10-15 19:09:25 +01:00
Seth Hillbrand 5c974f8cd0 Don't arbitrarily close tags that are not open
Fixes https://gitlab.com/kicad/code/kicad/issues/12647
2022-10-14 15:30:51 -07:00
Wayne Stambaugh 148467d2a1 Fix schematic symbol rescue issues.
This fix makes some fundamental changes to the way symbols are rescued:

* The new symbol library file format is used when rescuing symbols defined
  in the symbol library table.
* The original library nickname is appended to the symbol name rather than
  the rescue library nickname when rescuing symbol defined in the symbol
  library table.
* Escaping strings has been removed from legacy library rescues since the
  legacy library file format never supported it.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12525

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12624
2022-10-11 16:18:59 -04:00
jean-pierre charras 8c19bf4815 eeschema: fix arc orientation issue when reading old symbol libs (version 20210619).
Fixes #12514
https://gitlab.com/kicad/code/kicad/issues/12514
2022-10-07 16:57:45 +02:00
Wayne Stambaugh 03d847118a Fix crash when copying symbol in schematic editor.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12574
2022-10-04 17:51:58 -04:00
Wayne Stambaugh a11c40197f Expunge default symbol instance from schematic file format.
Now that importing hierarchical sheets "properly" imports instance data,
the default symbol instance setting doesn't have any meaning.
2022-10-04 15:42:41 -04:00
Seth Hillbrand f5f6d44a48 Correctly increment field IDs
Setting to -1 is no longer valid despite the previous comment as this
will pick out a single non-mandatory field to save

Fixes https://gitlab.com/kicad/code/kicad/issues/12567
2022-10-03 21:50:29 -07:00
Wayne Stambaugh 2b387ae9c3 Move schematic symbol instance data back into symbol definition.
This change reverts the storage of all symbol instance data in the root
schematic.  This was done because it's not possible to reuse instance
data when importing from sub-sheets.

There has been a fundamental change in how sheet paths are store in the
instance data.  The root schematic UUID is always used when saving the
instance data.  To prevent file churn, the virtual root sheet UUID is set
to the root schematic UUID when loading the project.  This provides a way
to determine the project that stored the instance data.  All uses of paths
without root sheet have been expunged from the code.

The sheet instance data is still saved only in the root sheet for the
time being.  New sheet instances will be automatically assigned an page
number based on the incremental virtual sheet page number.  Sheet page
numbers will not be imported.

Added project name to instance data to improve the readability of the
schematic file format.  It also creates an opportunity to remove orphaned
instance data by project name rather than cryptic UUIDs.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12472
2022-10-02 15:06:42 -04:00
Jeff Young 27296b5043 Quote all bus members when writing to file.
Fixes https://gitlab.com/kicad/code/kicad/issues/12447
2022-10-02 17:43:47 +01:00
Seth Hillbrand 93239516d9 Remove ID from property fields
ID was not maintained or used other than to ensure unique fields.
Instead of saving, we assign the known IDs to specific field names and
sequentially create new IDs on load

Fixes https://gitlab.com/kicad/code/kicad/issues/12390
2022-09-30 17:19:53 -07:00
Jeff Young c0a666507c Work around more instances of the wxWidgets color string locale bug.
Fixes https://gitlab.com/kicad/code/kicad/issues/12552
2022-09-30 20:56:25 +01:00
Wayne Stambaugh 979b4a4eb7 Revert "Move schematic symbol instance data back into symbol definition."
This reverts commit 7984e114db.
2022-09-29 15:33:23 -04:00
Wayne Stambaugh a60ed99510 Revert "Add project name to symbol instance data."
This reverts commit 4b276b339a.
2022-09-29 15:33:23 -04:00
Wayne Stambaugh 4b276b339a Add project name to symbol instance data.
This improves the readability of the schematic file format and creates
an opportunity to remove orphaned instance data by project name rather
than cryptic UUIDs.
2022-09-29 17:47:57 +00:00
Wayne Stambaugh 7984e114db Move schematic symbol instance data back into symbol definition.
This change reverts the storage of all symbol instance data in the root
schematic.  This was done because it's not possible to reuse instance
data when importing from sub-sheets.

There has been a fundamental change in how sheet paths are store in the
instance data.  The root schematic UUID is always used when saving the
instance data.  To prevent file churn, the virtual root sheet UUID is set
to the root schematic UUID when loading the project.  This provides a way
to determine the project that stored the instance data.  All uses of paths
without root sheet have been expunged from the code.

The sheet instance data is still saved only in the root sheet for the
time being.  New sheet instances will be automatically assigned an page
number based on the incremental virtual sheet page number.  Sheet page
numbers will not be imported.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12472
2022-09-29 17:47:57 +00:00
Jeff Young 10d8db482e Init intersheet refs field pos to local {0,0}, not global {0,0}
Fixes https://gitlab.com/kicad/code/kicad/issues/12517
2022-09-26 21:00:46 +01:00
Ian McInerney 44c2782d39 Fix more for loops making copies of iterates 2022-09-25 00:48:38 +01:00
Jeff Young 45d6b4a9fc Readability improvements. 2022-09-19 11:18:20 +01:00
Marek Roszko ece23d434b Split up Double2Str to a format function to make its use case clear 2022-09-17 00:10:22 -04:00
Marek Roszko 3d5913c825 Remove convert_to_biu.h, merge contents to base_units.h 2022-09-16 21:09:28 -04:00
Marek Roszko 66e8931405 Remove IU_PER_MM thats standalone 2022-09-16 21:09:27 -04:00
Marek Roszko 7a5829f8d6 Move IU2Mils 2022-09-16 21:09:27 -04:00
Marek Roszko 61e11d6896 Strip out Mils2Iu 2022-09-16 21:09:27 -04:00
Marek Roszko e6ed275c25 Repoint IU_PER_MILS 2022-09-16 21:09:26 -04:00
Marek Roszko a8613ee80f Combine Iu2Millimeter & remove PcbMm2iu 2022-09-16 21:09:26 -04:00
Seth Hillbrand 524b129c64 ADDED: Support for explicit DNP field
Dims elements shown as DNP.  Adds property `dnp` to explicitly denote
parts that should not be populated. These parts are not included in X/Y
files
2022-09-16 22:26:16 +00:00
Mark Roszko b00178adb3 Nuke base_units from orbit 2022-09-16 04:38:10 +00:00
kliment b97f9ea329 Add support for symbol unit display names in eeschema and symbol editor 2022-09-14 22:11:37 +00:00
Marek Roszko e473e71ef8 Restore the original lib property file indentation 2022-09-13 23:39:35 -04:00
Jeff Young 536561f7b3 Move bus aliases to std::set.
This is mostly to output the aliases sorted (for ease of VCS integration),
but also because a btree will be faster than hashing on a small dataset.

Fixes https://gitlab.com/kicad/code/kicad/issues/11890
2022-09-11 19:48:08 +01:00
Seth Hillbrand 09ef7c8f1e Add RPT_SEVERITY_DEBUG for developer-type messages
Move a bunch of importer messages out of the user-visible space as they
are not information that the average user can act on.
2022-09-09 17:21:47 -07:00
Jeff Young d030f03844 Don't allow a SaveAs to overwrite the root sheet.
Also prevents EESchema from loading sheets which recurse.

Fixes https://gitlab.com/kicad/code/kicad/issues/10872
2022-09-08 23:43:07 +01:00
WhiteChairFromIkea 758ba5ab18 Altium sch: Import circle-like ellipses as circles for now 2022-09-08 16:55:32 +00:00
jean-pierre charras 3e257794c0 Legacy symbol library reader: fix incorrect arc angle in some symbols.
Fixes #12346
https://gitlab.com/kicad/code/kicad/issues/12346
2022-09-06 08:29:38 +02:00
Jon Evans e294fe2074 ADDED: Dynamic field columns in symbol chooser
CHANGED: Symbol chooser search now considers custom symbol fields

Visible columns can be controlled in database libraries.
In standard KiCad libraries, we show columns for all custom fields for now.

Customizable column visibility will be added in the future.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11946
2022-09-05 16:38:14 -04:00
WhiteChairFromIkea e155514339 Altium sch: Import non lib shapes line color (ASCH_SHAPE_INTERFACE -> Polygon, Rectangle and Round rect) 2022-09-05 11:22:25 +00:00
WhiteChairFromIkea 2958f66407 Formatting 2022-09-05 11:22:25 +00:00
WhiteChairFromIkea 56e4b3b2c3 Altium sch: Import polyline color 2022-09-05 11:22:25 +00:00
WhiteChairFromIkea 325a6ec8bd Use default Altium colors for Harness ports (there can be no other harness elements to take color from) 2022-09-05 11:22:25 +00:00
Jon Evans a5246a6df7 DbLib: Support showing field names 2022-09-04 13:01:32 -04:00
Jon Evans 04f65c6c5c ADDED: Option to disable autoplacement for particular fields
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5767
2022-09-04 13:01:31 -04:00
Jon Evans 4ea0a80df0 CHANGED: Fields may now optionally display their name before their value
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11457
2022-09-03 17:03:37 -04:00
WhiteChairFromIkea 42efaff045 Altium sch - plot backgrounds of textboxes and harness ports 2022-09-01 12:39:30 +00:00
Jeff Young ebe9617e77 More EDA_RECT expungification, and an attempt to fix the python test. 2022-08-31 17:19:48 +01:00
Jeff Young 2dc6300501 Move EDA_ITEM bounding boxes to BOX2I. 2022-08-31 10:16:55 +01:00
Jon Evans ae879c8f02 DbLib: Add single-row query cache
Since single-row queries are performed rapid-fire during certain actions like
stepping through the symbol browser, there is high value in caching them for
a small amount of time.  The default cache parameters will keep results for
10 seconds, which errs on the side of getting fresh data from the database
on most user interactions.
2022-08-30 22:18:36 -04:00
Jon Evans 1da0572977 DbLib: Retry connection if first attempt fails 2022-08-30 22:18:36 -04:00
Jeff Young 5679b9dbdc Remove a few EDA_RECT instances. 2022-08-31 01:22:49 +01:00
Jeff Young 0c8787cbb9 Some more wxPoint/EDA_RECT yeeting. 2022-08-31 00:44:33 +01:00
Jon Evans 570f4fe4a9 Fix GCC warning 2022-08-30 18:48:18 -04:00
Marek Roszko 03aa63bd50 Move 5 helpers to EDA_UNIT_UTILS since they aren't iu specific 2022-08-29 20:11:03 -04:00
Marek Roszko f0956e48f2 Make EDA_TEXT common
Since EDA_TEXT is a base class, we can just force the child classes to pass the correct iu scaled size

ALLOW_BOLD_THICKNESS removed because it's a pre-custom font holdover
2022-08-29 07:31:03 -04:00
Jon Evans 0474ae86ea DbLib: Use full alias name when loading single symbol 2022-08-27 22:08:01 -04:00
Jon Evans 49354e52a8 Add support for sub-libraries concept
Sub-libraries allow a single-level hierarchy inside a symbol library.

This is useful for database libraries and for supporting other EDA library types where a
single file can contain multiple logical groupings of symbols.
2022-08-27 18:47:39 -04:00
Roberto Fernandez Bautista 5d90f3f54f WIP - fix up parsing + generalise to the pcb 2022-08-27 19:17:42 +01:00
Roberto Fernandez Bautista 840bcffefb ADDED: Hyperlinks on text items in Schematic Editor 2022-08-27 19:17:42 +01:00
Marek Roszko bf964d8678 Commonize page_info by simply making the Iu scale a parameter on call. 2022-08-27 13:36:00 -04:00
Roberto Fernandez Bautista 6ceddb185b Cleanup loading of arc shapes in Symbol and Schematic editors 2022-08-27 12:51:32 +01:00
Jon Evans 03bc3936c6 Use database table name instead of nickname when loading symbol 2022-08-26 19:10:27 -04:00
Jon Evans ae6a2a6443 ADDED: Database libraries MVP
Allows placing parts from an external database that reference symbols from another loaded library.

Includes:
- nanodbc wrapper
- database schematic library plugin
- basic tests

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7436
2022-08-26 10:51:13 -04:00
Jeff Young 638198251a Coverity fixes. 2022-08-22 17:52:58 +01:00
Jeff Young 88c9177ff6 Move bus members from wxArray to std::vector and fix some bugs in dialog. 2022-08-21 20:54:41 +01:00
Wayne Stambaugh 10123d164f Fix schematic symbol initial default instance data bug.
The commit bumps the schematic file format version in order to fix the
initial symbol default instance data to the first instance of each symbol.
It also sets the initial instance data to undefined in the SCH_SYMBOL
ctor so on the first schematic save, the default instance will be set
to the first instance of the symbol.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12190
2022-08-21 08:03:28 -04:00
Jeff Young aa2ad3b44c Move KICAD_T[] to std::initializer_list<KICAD_T>. 2022-08-20 10:28:11 +01:00
Seth Hillbrand c53fe1c1f0 Be more verbose when finding an error
Try to give the user more information about what the actual file error
is, rather than immediately throwing the IO_ERROR
2022-08-18 12:40:14 -07:00
Wayne Stambaugh 797827b833 Fix missing legacy value and footprint field instance data.
The legacy and s-expression (prior to version 20200828) file formats only
supported symbol unit and reference fields so the newly added value and
footprint fields must be updated from the original symbol fields.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12226
2022-08-17 11:32:04 -04:00
Marek Roszko c2e0c585f8 Add missing pass of uuid for 2pt polylines
Stops file churn
2022-08-16 23:29:03 -04:00
jean-pierre charras 9e3e4ae9a6 Fix minor Coverity warnings 2022-08-16 18:56:37 +02:00
WhiteChairFromIkea 742757b98b Altium: import NOTE and TEXT_FRAME as TextBoxes instead of text objects 2022-08-16 16:34:13 +00:00
WhiteChairFromIkea 088ddf82eb Formatting 2022-08-15 22:55:39 +00:00
WhiteChairFromIkea 94d386d7ee Fixes https://gitlab.com/kicad/code/kicad/-/issues/12191
Autoplace port Sheet References and hide them (question marks), unti we figure out if intersheet references can be read from schdoc
2022-08-15 22:55:39 +00:00
WhiteChairFromIkea 5c9346902a Import HARNESS PORT as textboxes, preserving original formatting + typo fixes 2022-08-15 22:55:39 +00:00
WhiteChairFromIkea 81a2fed5c5 Import HARNESS_TYPE as Hierarchical sheet name 2022-08-15 22:55:39 +00:00
WhiteChairFromIkea 15549364d5 Import HARNESS_ENTRY as Hierarchical sheet pins 2022-08-15 22:55:39 +00:00
WhiteChairFromIkea 14ceece4f6 Import HARNESS_CONNECTOR as Hierarchical sheet 2022-08-15 22:55:39 +00:00
WhiteChairFromIkea b64f6ccc18 Import SIGNAL_HARNESS as graphical polyline 2022-08-15 22:55:39 +00:00
Seth Hillbrand 35ac39844f Clean up some auto usage
Don't make new copies of shared_ptr if we can use references.  Keep auto
usage down to hard-to-type-out sequences
2022-08-15 11:29:45 -07:00
Marek Roszko c418b25756 Centralize the parseDouble functions in the parsers and gcc specialcase 2022-08-14 18:46:19 -04:00
Roberto Fernandez Bautista 69d696660b cadstar: Report warning that imported text may be different
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12195
2022-08-14 22:24:16 +01:00
Marek Roszko a070959209 Switch from strtod to std::from_chars for performance 2022-08-14 16:19:24 +00:00
Jeff Young 6f49b57f9b Cleanup & performance enhancements. 2022-08-01 13:09:51 +01:00
jean-pierre charras 993c446fdf Fix some warnings detected by PVS-STUDIO (most are not used vars) 2022-07-25 18:23:52 +02:00
Jeff Young 404015b0a5 Pay attention to units for page frames.
Fixes https://gitlab.com/kicad/code/kicad/issues/11408
2022-07-23 20:17:04 +01:00
Jeff Young 16b9a7a1e5 Attempt to fix Locale issue.
Fixes https://gitlab.com/kicad/code/kicad/issues/9659
2022-07-23 11:20:04 +01:00
Seth Hillbrand 6fef054c51 Handle basic rounding error in schematic import
The fractional part of Altium schematic units is an integer number of
1/10000 mil segments, which is 2.54 nm.  The internal unit of eeschema
is 10 nm, so each fractional unit in Altium is 0.254 base eeschema
units.  To be consistent with
cf33cfcad1
we round to the nearest 10nm for each element

Fixes https://gitlab.com/kicad/code/kicad/issues/11742
2022-07-07 11:13:11 -07:00
Jeff Young d5a6452934 Get rid of special default line style for Eeschema.
Fixes https://gitlab.com/kicad/code/kicad/issues/11882
2022-06-27 19:12:45 -06:00
Jeff Young d9cfbc7b96 Fix missing SCH_LABEL case in SCH_PLUGIN.
Fixes https://gitlab.com/kicad/code/kicad/issues/11913
2022-06-27 16:21:32 -06:00
Roberto Fernandez Bautista 8725c3a35f CADSTAR Schematic: Load symbols even if part definition is incomplete
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11671
2022-06-15 19:47:50 +01:00
Jeff Young ec40a98fe2 wxT 2022-06-08 23:53:18 +01:00
Wayne Stambaugh dfea73f78c Eeschema: fix symbol library remap bug.
The original decision to escape the legacy symbol library names results
in them being escaped every time they are opened which cause the curly
braces '}' from the original escaping to be escaped on subsequent
openings.  This resulted in the symbol library names in the rescue
library not matching the library ID in the schematic.

This fix is likely to have other corner case bugs given the potential
for escaped characters in legacy symbol libraries.  Given that we now
have escaped rescue libraries in play, removing the escaping will only
result in more issues so we will have to fix the corner cases as we go.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11563
2022-06-05 17:00:57 -04:00
Jeff Young aaff163d7c Repair Eagle importer page number handling.
The root sheet needs a page number, and the other sheets need to not
have their last step in the path duplicated.

Fixes https://gitlab.com/kicad/code/kicad/issues/11409
2022-05-31 17:48:38 +01:00
Marek Roszko 88c7322a0d EDA_TEXT Get/SetTextSize should use VECTOR2I 2022-05-14 08:16:15 -04:00
Simon Richter 1e505d4c22 Remove a few call sites of SCH_SHEET::SetSize
This function is dangerous and should be used only by parsers, and not even
those, really.

For new objects, the size can be passed to the constructor.
2022-04-18 16:23:03 +02:00
Jeff Young 6ef6e37edb Disable using default instance data when writing to clipboard.
Fixes https://gitlab.com/kicad/code/kicad/issues/11379
2022-04-14 17:09:27 +01:00
Roberto Fernandez Bautista 85f6ff48e7 CADSTAR Sch: Clear symbol of all elements before overwriting with new one
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11378
2022-04-12 21:34:23 +01:00
Wayne Stambaugh 239f0214ac Eeschema: add support for default schematic symbol instance data.
Prior to fixing the schematic file change churn do to instance data
changing to the last selected sheet instance, the symbol instance data
was set rather than empty.  This change allows for users to set the
default instance data which is used for every new instance of the
schematic.

ADDED: Default schematic symbol instance data (unit and reference, value,
       and footprint fields) can be set to be used as the default settings
       for all new instances of the schematic.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11113
2022-04-09 07:49:36 -04:00