Commit Graph

389 Commits

Author SHA1 Message Date
Jeff Young c549a214c9 Performance: don't alloc std::vector in critical areas.
For some history, see also aa2ad3b44c
2024-06-21 19:07:46 +01:00
Mike Williams a5e2615251 Revert "SCH/LIB SYMBOL: never allow null LIB_SYMBOLs in SCH_SYMBOL"
This reverts commit 0b187e7122.
2024-06-12 13:30:29 -04:00
Wayne Stambaugh 74070afbc6 Fix a bunch of GCC build warnings compiling the schematic editor.
Apparently GCC does not like competing definitions of the == operator.
The recent refactoring away of all LIB_ITEM objects created a conflict
with the SCH_ITEM == operator definition.  This change required some
rather ugly comparison changes.  There were no unit test failures but
that doesn't mean something didn't get broken.
2024-06-11 08:07:32 -04:00
Mike Williams 0b187e7122 SCH/LIB SYMBOL: never allow null LIB_SYMBOLs in SCH_SYMBOL
Also always always flatten incoming lib symbols.
2024-06-10 08:36:42 -04:00
Jeff Young edc7603d2a Make it clear that GetSheets() is heavy.
Also removes the side-effect that SCH_SHEET_LIST's
c'tor would sort the list (and write virtual page
numbers) anytime the starting sheet was the root.

Also, definitely don't build a SHEET_LIST (sorted or
otherwise) if you're not even going to use it.

Also don't build SCH_SHEET_LISTs on idle events.  Better
to just always have the Next Sheet button enabled (we
already beep if you click it and there's no next sheet).

Also, use a SCREEN_LIST when you can.  It's much cheaper
to create.
2024-06-06 18:00:59 +01:00
John Beard 6992afeb38 Consider a bus entry hitting a wire corner or tee to be dot-worthy
This doesn't change the connectivity, it just makes putting the
dot more closely match what the connectivity already does.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18046
2024-05-20 12:40:29 +08:00
John Beard 6313b58ad6 Break out junction analysis so it can be tested in isolation
There are some corner cases with bus entries that could do with
care and it's a bit tricky to keep all the cases in mind at once!
2024-05-20 12:40:29 +08:00
Alex Shvartzkop 5475359d00 More build time optimizations. 2024-05-06 04:39:28 +03:00
Seth Hillbrand ba4974749c Fix renaming sheet check
If we are renaming a sheet that exists only once in the schematic, then
we don't need to warn about case sensitivity.  If the sheet exists
multiple times, we do.  We can't check this using SCREENS because the
screens don't maintain full state information about where they are used.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17901
2024-05-03 13:23:03 -07:00
Jeff Young 95136494b3 RIP LIB_PIN. 2024-04-20 12:10:31 +01:00
Jeff Young d77eae3e7e Collapse LIB_FIELD into SCH_FIELD. 2024-04-13 15:42:13 +01:00
Jeff Young 5abc7145da Fold LIB_ITEM into SCH_ITEM. 2024-04-08 10:24:50 +01:00
Jeff Young 1028a76e4a Harmonize print/plot APIs. 2024-04-06 09:34:56 +01:00
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