Commit Graph

376 Commits

Author SHA1 Message Date
Jeff Young 92910d5d0f Factor common parts of SCH_ & LIB_SYMBOL into SYMBOL. 2024-04-04 13:18:55 +01:00
Mark Roszko 7b904545e9 Fix explicit wxstring build breakage 2024-03-21 03:25:15 +00:00
Jon Evans f00f47df13 wxWidgets 3.3 compatibility: explicit wxString conversion 2024-03-20 22:02:41 -04:00
Yon Uriarte b7b64d959f Performance UpdateDanglingState
Avoid O(N^2) by spatial sorting, don't run checks if the bounding boxes
don't overlap.
A second copy is ordered by type to help classes that only want to check
a few types having to walk the whole list.
2024-02-23 19:21:44 +00:00
Jeff Young ee5e2e56c0 Naming conventions; no functional changes. 2024-01-29 16:00:06 +00:00
Wayne Stambaugh 0df8d5c2d6 Do not assert when pruning orphaned sheet and/or symbol instances.
Running the schematic editor in the stand alone mode can result in an
empty project name.  Rather than assert when the project name is empty,
just don't run the pruning algorithm.  The pruning will just have to
happen on the next load of the schematic when it has a proper project
name.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16577
2024-01-11 15:47:21 -05:00
Wayne Stambaugh 04d15026c5 Rename SCH_SYMBOL::GetInstanceReferences() to GetInstances(). 2023-12-28 18:25:56 -05:00
Wayne Stambaugh 482aff3f0b Prune orphaned schematic sheet instances.
Pasting from the clipboard when copying from another project can leave
sheet instance information that is not valid for the current project.
This change prunes all sheet instance information that is not relevant
to the current project.  It also prunes invalid paths created by pasting
sheets from different paths in the same project.
2023-12-28 12:19:19 -05:00
jean-pierre charras 3bd7d92522 Fix crash: Under some circumstances the command "Export symbols to (new) library"
produces a crash when the library links are updated, and a power symbol is not found
in any loaded library.
Add also an option to export all symbols or all not pwer symbols
Fixes #16229
https://gitlab.com/kicad/code/kicad/-/issues/
2023-12-04 18:12:51 +01:00
Wayne Stambaugh 764df1d107 Fix crash when saving pasted root sheet symbols.
The paste code creates invalid KIID_PATH objects with a zero length.  All
paths must include the root KIID at a minimum.  Code was added to prune
the invalid paths and some defensive code was adding to the formatter to
prevent the crash in case there are other paths where someone generates
a zero length path.

Pruning orphaned instance data does not work when loading schematics prior
to version 7 because the paths did not include the root sheet UUID.  Once
the file is saved to V7 or later, the next load will prune any orphaned or
invalid instance data for the current project.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16245
2023-12-03 08:03:31 -05:00
Wayne Stambaugh 6dc25f4775 Fix broken symbol reference designators on paste special.
It appears that in our zeal to prevent file changes when saving shared
schematics, we (I) clobbered saving relative symbol instance data paths
to the clipboard.  This has be restored along with setting the correct
symbol unit for relative clipboard paths.

Fixed a serious issue with KIID_PATH::MakeRelativeTo() where the original
path was not restored when the incremental KIID object test fails.  This
also included a minor optimization using the actual KIID object for
comparison instead of converting it to a string and then comparing the
string.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15981
2023-12-01 14:18:47 -05:00
Jeff Young f50de028fb Make plotting of PDF property popups optional. 2023-10-21 21:52:51 +01:00
Jeff Young 003acbd686 Clear render caches before plotting.
Also fixes a bug where text variables in LIB_TEXT weren't getting
expanded when plotting.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15765
2023-10-02 15:39:14 +01:00
Marek Roszko 8c6899b0d3 Tear out the eeschema conditional compile of PROJECT 2023-09-27 23:05:30 -04:00
Marek Roszko 22b733209d Fail GAL on its header leaking audit
Maybe we should rethink directly accessing GAL so much, but at least 600 files didn't need GAL leaked into them due to view_overlay.h
2023-09-18 19:52:27 -04:00
Jeff Young 0310973e3f Push TEXT_SPIN_STYLE from SCH_TEXT out to SCH_LABEL_BASE.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15444
2023-09-07 17:42:51 +01:00
Marek Roszko 7505fd0f37 Profile can live in core 2023-09-07 07:47:01 -04:00
Seth Hillbrand c2fd2f42eb Update TestDanglingEnds to O(n) speed
The elements don't care which they connect to, so don't search for
points on the page, just collect them all and then test them all

Adjusts f3dd5b73
2023-08-31 15:31:48 +00:00
Jeff Young 6cef504d2d Don't consider newly-added labels when looking for terminal items.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15313
2023-08-05 18:50:29 +01:00
Jon Evans 35c372a072 Support expanding selection for schematic graphic lines
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12032
2023-08-01 21:22:35 -04:00
Jon Evans 148e111579 Refactor pin orientation to be an enum class
Add various LIB_PIN properties
2023-07-26 23:46:15 -04:00
Jeff Young c8e8b71198 TestDanglingEnds needs to test sheet pins as well.
Also fixes a bug where zooming doesn't get a redraw until mouse moves.

Also fixes a couple of bugs where dangling markers on SCH_SHEET_PINs
and SCH_HIERLABELs weren't getting drawn.

Also simplifies drawing algorithm by removing aesthetic offset (which
wasn't implemented when pin is drawn as part of selection VIEW_GROUP).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15129
2023-07-08 12:55:45 +01:00
Wayne Stambaugh d962b062ca Fix crash when duplicating symbol unit with alternate body style.
* Add check for valid symbol library link in annotation code to prevent
  crash even if the symbol was not defined correctly.  This will assert
  in debug builds.
* Fix broken pin comparisons when library symbols have units with alternate
  body style defined.
* Remove some macros from LIB_SYMBOL comparison function which made
  debugging painful.
* Exit LIB_SYMBOL comparison function as soon as non-equivalent comparison
  occurs.
* Fix broken library symbol comparison due to name differences when
  checking for existing variants of the library symbol.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14491
2023-04-08 15:29:01 -04:00
Wayne Stambaugh a0d02fbab1 Make multivector.h header order independent.
Attempt to clean up all redundant headers that multivector.h touches.
2023-03-23 13:26:32 -04:00
jean-pierre charras 893a362d9e Minor Coverity and compil warnings fix. 2023-03-15 20:09:04 +01:00
Mike Williams 959a19a461 Power Symbols: automatically fix mismatched legacy symbols, add tests
Has netlist generation test for legacy power symbols, and test for
fixing legacy mismatched power symbol text fields and invisible pin names.
2023-02-22 18:01:47 +00:00
jean-pierre charras 8ce0a84ca7 Fix compatibility with older wxWidgets versions.
Fix also a compil warning
2023-02-03 08:24:38 +01:00
Wayne Stambaugh c88c4e1200 Fix schematic update library symbols issues.
Rather than update library symbols one at a time, queue them up by
schematic symbol to prevent multiple updates to the same symbol in
complex hierarchies.  This also removes all of the library symbols
first which will clear out all of the library symbol variants that
were created by modifying library symbols in place and/or changes to
the symbol in the library.

Don't add new variant library symbol if an equivalent variant already
exists in the schematic local cache.  This prevents duplicate library
symbols from being added to the local cache when the first variant in
the cache does not match that of the symbol being added.
2023-02-02 15:54:24 -05:00
Seth Hillbrand 6fa2eedb4b Avoid the obsolete GetNextPin() call
This iterated over all pins to find the pin after a given item.  Because
out pattern is consistently to iterate in the outer loop, this means
that we were an O(n^2) loop for the pins just to find their names.  This
affected very large parts (e.g. FPGAs) when switching sheets to display
2023-01-20 14:12:15 -08:00
Roberto Fernandez Bautista c7f33e21f8 Extract SCH_SCREEN::GetNeededJunctions from AddJunctionsIfNeeded 2023-01-15 19:17:39 +01:00
Roberto Fernandez Bautista 7332c0c54d Move SCH_EDIT_FRAME::GetSchematicConnections into SCH_SCREEN::GetConnections 2023-01-15 19:17:38 +01:00
Roberto Fernandez Bautista 64105dcf84 Extract GetBusesAndWires function out of SCH_EDIT_FRAME::BreakSegments
This function is called by SCH_EDIT_FRAME::AddJunction
2023-01-15 19:17:38 +01:00
Seth Hillbrand f99e374559 Make DNP more visible
Adds red cross to the DNP display.  Allows showing the DNP even when
plotting black/white

Fixes https://gitlab.com/kicad/code/kicad/issues/13456
2023-01-09 15:31:50 -08:00
Wayne Stambaugh d99e09014b Rename SYMBOL_INSTANCE_REFERENCE to SCH_SYMBOL_INSTANCE. 2023-01-04 15:39:50 -05:00
Mike Williams f03fd5ad2d Schematic: remove IS_RESIZING
Is unused/redundant with IS_MOVING
2022-12-28 12:27:57 -05:00
Jeff Young 50ccc4e6da Fix issue converting legacy SPICE models.
1) if a legacy model references a library then we need to see if said
   libraray exists and read model from it if so
2) legacy node ordering is by index, not pin name
3) we can't auto-generate a pin map when we don't know the pin names,
   so don't try
2022-12-14 13:36:28 +00:00
Jeff Young 8931e55dd2 Templatize MigrateSimModel() so it can be used on LIB_SYMBOLs as well.
Fixes https://gitlab.com/kicad/code/kicad/issues/13080
2022-12-08 23:57:43 +00:00
Jeff Young bb6544914e Bring simulator file menu commands more in line with rest of Kicad. 2022-12-08 23:57:42 +00:00
Jeff Young 3836ec481f Add fixups for legacy syntax used during 7.0 development. 2022-12-06 16:01:18 +00:00
Jeff Young 39ad7c8205 Formatting and Kicad naming conventions. 2022-12-06 16:01:18 +00:00
Jeff Young 38906397d2 Move V6->V7 sim model migration from sheets to screens.
Also moves passive RLC inference out from migration to just-in-time
creation for the simulator or netlisting.

Also fixes a version guard mismatch because the spice migration was
done inside UpdateSymbolInstances (which has its own version guard).

Also changed UpdateSymbolInstances to UpdateSymbolInstanceData so
someone else in the future doesn't think it's a general-purpose symbol
instance updater.
2022-12-06 16:01:18 +00:00
Wayne Stambaugh 0a62c17040 Remove schematic symbol value and footprint field instance data.
https://gitlab.com/kicad/code/kicad/-/issues/12933
2022-11-30 11:47:13 -05: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
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 e055302a3c Allow printing backgrounds prior to foreground
Eeschema shows background fills on a different z-level than the rest of
the symbols/elements.  Print the backgrounds prior to the foregrounds in
order to preserve this view for print output

Fixes https://gitlab.com/kicad/code/kicad/issues/12559
2022-10-02 13:23:54 -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
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 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
Marek Roszko e6ed275c25 Repoint IU_PER_MILS 2022-09-16 21:09:26 -04:00
Jeff Young eb70934457 Fix type in SelectConnection.
Fixes https://gitlab.com/kicad/code/kicad/issues/12341
2022-09-10 20:56:35 +01:00