Commit Graph

505 Commits

Author SHA1 Message Date
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
Jeff Young e8a543f1ea Colors for text in PL_Editor and Eeschema.
Fixes https://gitlab.com/kicad/code/kicad/issues/1952
2022-03-31 19:43:56 +01:00
Jeff Young 47f4503564 SCH textboxes start/end -> at/size.
The at token can handle an angle; start/end does not.

Fixes https://gitlab.com/kicad/code/kicad/issues/11252
2022-03-28 11:16:39 +01:00
jean-pierre charras cfe0003ca4 Eeschema: fix misplaced nullptr test that prevent saving SCH_TEXT items.
Fixes #11250
https://gitlab.com/kicad/code/kicad/issues/11250
2022-03-27 18:48:55 +02:00
jean-pierre charras 38bd612c01 sch_sexpr_parser.cpp: allows reading a polyline descr with more than 2 points
In symbols, a polyline descr is already a true polyline / polygon descr.
In schematic, a polyline descr was restricted to only 2 points (a line).
A true polyline / polygon descr is now allowed in schematic that support already
polygons.
For compatibility reason, a 2 points polygon (SCH_SHAPE) is converted to a SCH_LINE.
2022-03-27 10:31:21 +02:00
Wayne Stambaugh 7da7864f5e Fix some Coverity issues. 2022-03-25 15:51:05 -04:00
Jeff Young 8eb10c41d8 Name any unnamed fields so they don't clobber each other.
Fixes https://gitlab.com/kicad/code/kicad/issues/10039
2022-03-22 18:08:05 +00:00
jean-pierre charras 21144481d2 PLOTTER: do not clamp coordinates to an arbitrary value.
Previously, coordinates were clamped to +- 60 inches. It makes no sense to
clamp them at plotter level: max cooed depends on the editor (schematic/board...)
Rename MAX_PAGE_SIZE_MILS to MAX_PAGE_SIZE_EESCHEMA_MILS and use it only for Eeschema.
Fixes #11196
https://gitlab.com/kicad/code/kicad/issues/11196
2022-03-22 10:32:36 +01:00
Jeff Young 4f62960334 Update message panel from PCB point editor and SCH drawing tools.
Fixes https://gitlab.com/kicad/code/kicad/issues/11186
2022-03-21 10:32:36 +00:00
jean-pierre charras 1f5ec30566 Fix and issue about 180 deg arcs in symbols from "old" libraries.
Can be seen with lib version 20201005, not with latest version.
The fix is similar to commit 8a17fb8d, but for arcs defined by start, end, angles
(modify 180 deg arcs)
Fixes #11130
https://gitlab.com/kicad/code/kicad/issues/11130
2022-03-15 11:31:58 +01:00
Wayne Stambaugh dd1dbb81f6 Improve shared schematic file churn heuristics.
The previous solution cleared all of the fields and force the unit setting
to unit one which would have less than desirable effects when reusing a
schematic in another project.  This solution forces all of the instance
settings to the first sheet instance of the current project to prevent file
change churn when changing shared sheets in the current project.

This will not prevent shared schematic file changes when the first sheet
instance data differs between projects.
2022-03-11 12:37:30 -05:00
Wayne Stambaugh bf5d585e24 Reduce shared schematic file change churn. 2022-03-11 00:32:34 +00:00
Seth Hillbrand cd7141fd10 Cache read arc data for stability
Arcs can be altered by the process of changing from on-disk
representation to in-memory representation.  Saving back to disk without
modifying the arc should not modify the calculated values.

This stores a copy of the on-disk representation that is only used to
save back to disk in the event that the arc is not modified during
editing.

Fixes https://gitlab.com/kicad/code/kicad/issues/10442
2022-03-04 15:20:31 -08:00
Jeff Young c025b4c73d Save all stroke parameters of sch & lib shapes.
We were failing to save the line style, which caused ERC errors when
DEFAULT != SOLID.
2022-03-03 14:37:04 +00:00
Seth Hillbrand 8c36ba3653 Explicitly give unit values
Removes the ability to hide symbol units in file formats.  This was
mostly the case for a while but there remained corner cases where we
left a default/hidden option

Fixes https://gitlab.com/kicad/code/kicad/issues/10888
2022-03-02 16:01:08 -08:00
Steffen Mauch 78620347c8 Fixing Eagle refs that do not work with KiCad
KiCad has stricter requirements for what consititutes an annotated
symbol.  This checks for and corrects annotations that begin with '#',
do not begin with a non-numeric character or do not end with a number
2022-02-25 23:42:47 +00:00
Thomas Pointhuber 8ef7252330 altium: Don't use string concatenation for paths pointing in the compound file
* std::vector do not need to be split apart again
* supports backslash in footprint names
2022-02-19 16:46:20 +01:00
Jeff Young bc7742cb2e Various text object defaults don't necessarily match file defaults.
Fixes https://gitlab.com/kicad/code/kicad/issues/10862
2022-02-15 23:25:59 +00:00
Jeff Young 940e03e567 Remove arc end swapping when parsing.
See: 2366b06e77 (note_839061664)
2022-02-11 13:10:52 +00:00
Jeff Young 2366b06e77 Don't parse multiple items in a single c'tor or function call.
The C++ optimizer is not always your friend and may do them in the
reverse order.
2022-02-10 17:54:13 +00:00
Jeff Young d33d092e8e Add a second fix for backwards arcs.
This one *should* also be good when we support larger-than-180
degree arcs.
2022-02-10 15:46:02 +00:00
Jeff Young cb8e803788 Formatting. 2022-02-10 13:04:29 +00:00
jean-pierre charras b9843a23eb Eeschema, legacy *lib files: fix issues with 180 deg arcs.
180 deg arcs are a limit, so when importing them convert them to slightly
smaller arc (arc angle = 179.5 deg)
Fixes #10455
https://gitlab.com/kicad/code/kicad/issues/10455
2022-02-10 12:45:54 +01:00
Wayne Stambaugh 3f8f90db9f Factor out common s-expression library cache source code. 2022-02-09 11:20:14 -05:00
Wayne Stambaugh 7181f0b40b Fix clang broken build. 2022-02-09 07:55:50 -05:00
Wayne Stambaugh fe82f2dd40 Factor out common schematic s-expression source code. 2022-02-08 14:44:38 -05:00
Wayne Stambaugh fc3cad0b54 Hash symbol libraries per library rather than statically per cache type. 2022-02-07 15:40:21 -05:00
Jeff Young b57ac3d517 Handle SCH_TEXTBOX in SCH_SEXPR_PLUGIN::Format.
Fixes https://gitlab.com/kicad/code/kicad/issues/10771
2022-02-06 19:43:25 +00:00
Marek Roszko d9c04da407 Sprinkle in some make_unique 2022-02-05 21:26:36 -05:00
Marek Roszko ca7840334c Mark some limits as constexpr
gcc doesn't need it and computes during compile regardless, but experimenting in godbolt, both clang and MSVC actually do need it or else it's partially computed at runtime
2022-02-04 07:50:13 -05:00
Marek Roszko fa1d316d84 Fix windows build error 2022-02-02 17:43:47 -05:00
Wayne Stambaugh e590d07224 Fix clang build error. 2022-02-02 07:44:11 -05:00
Wayne Stambaugh 9260431fe4 Abstract out symbol library parser object. 2022-02-02 07:07:39 -05:00
Wayne Stambaugh 6fcc6f7c9d Factor out common legacy schematic and symbol library parser code. 2022-02-01 16:30:15 -05:00
Jeff Young f3cd36d1d7 Bring EEschema textboxes in line with PCBNew's.
Also adds Border checkboxes and fixes a bunch of bugs.
2022-01-31 21:46:40 +00:00
Wayne Stambaugh b36e31c49f Factor out common and remove dead legacy symbol library code. 2022-01-29 14:13:00 -05:00
Jeff Young c6a8100d46 Schematic and symbol text boxes.
Also fixes some plot bugs with arcs.

Also moves polygonization of arcs (when required) in plotting code
from 5 degrees to calculated based on ARC_HIGH_DEF.

Fixes https://gitlab.com/kicad/code/kicad/issues/5017
2022-01-28 21:38:15 +00:00
Jeff Young 3409783d9f Break sch_text.h/.cpp into sch_text and sch_label.
Also moves SCH_NETCLASS_FLAG to SCH_DIRECTIVE_LABEL, and remaps Altium
harnesses from SCH_TEXT to SCH_DIRECTIVE_LABEL.
2022-01-28 21:38:15 +00:00
Franck a6203617d9 Fix Altium schematic port component import assertion.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/10322

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10401
2022-01-28 15:52:30 +00:00
jean-pierre charras 8a17fb8d19 SCH_SEXPR_PARSER::parseArc(): fix a very annoying issue: each time the lib or
sch files are saved and reopened, 180 deg arcs were flipped.
This fix is a workaround, but avoid flipped arcs after saving/reopening these files.
2022-01-26 18:19:52 +01:00
jean-pierre charras 694ae59664 fix a minor compil warning (shadowed vars) 2022-01-21 14:09:42 +01:00
Jeff Young c8a50d9b50 Remove unit-less angles from VECTOR2I/D APIs. 2022-01-20 23:58:20 +00:00
Jeff Young 3ba89f50ef Maybe, just maybe, fix LibEdit arc parsing.
Fixes https://gitlab.com/kicad/code/kicad/issues/10455
2022-01-19 22:22:18 +00:00
Jeff Young 8445783216 Fix backwards arcs in legacy LIB_ARCs.
Fixes https://gitlab.com/kicad/code/kicad/issues/10455
2022-01-18 14:08:47 +00:00
Jeff Young de31b813f3 Angle cleanup in the Cadstar importer. 2022-01-18 02:31:37 +00:00
Jeff Young 622f94e7b9 Angle cleanup in Altium importer. 2022-01-18 02:31:37 +00:00
Jeff Young 0218b782f4 Angle cleanup in Eagle importer. 2022-01-18 02:31:37 +00:00
Thomas Pointhuber 0129e49b79 altium: Introduce new ALTIUM_COMPOUND_FILE object to handle file opening and searching for streams at a central place 2022-01-17 19:54:26 +01:00
Jeff Young e61144d45a Finish with EDA_ANGLE. 2022-01-16 21:15:40 +00:00
Jeff Young e84c574830 Some more EDA_ANGLE cleanup. 2022-01-16 19:16:18 +00:00
jean-pierre charras 516d038bdf Eeschema: fix incorrect stored rotation value in file of the global and hierarch. labels.
The stored value was the rotation of the text (always 0 or 90 deg), but these labels can also
be rotated by -90 or 180 deg
Fixes #10450
https://gitlab.com/kicad/code/kicad/issues/10450
Fixes #10457
https://gitlab.com/kicad/code/kicad/issues/10457
2022-01-16 17:19:36 +01:00
Jeff Young 9b661aea10 EDA_ANGLE for plotters.
Also fixes a compile error in the PNS Playground.
2022-01-16 01:19:45 +00:00
Jeff Young 07013d00e1 More EDA_ANGLE. 2022-01-14 16:08:19 +00:00
Jeff Young 1b19ff5f42 More EDA_ANGLE changes. 2022-01-14 16:08:19 +00:00
Jeff Young e048e51f5d Improve SNR of EDA_ANGLE stuff. 2022-01-14 16:08:18 +00:00
Seth Hillbrand e244ce1431 Fix cherry-picked wxPoint 2022-01-12 15:49:03 -08:00
Seth Hillbrand d3f24308e6 Handle rotated symbol rectangles in Eagle import
Fixes https://gitlab.com/kicad/code/kicad/issues/10360

(cherry picked from commit dcb8f29317)
2022-01-12 15:11:18 -08:00