Commit Graph

182 Commits

Author SHA1 Message Date
Jeff Young b1e5cb5a56 ADDED ${SYMBOL_DESCRIPTION} and ${SYMBOL_KEYWORDS}.
Fixes https://gitlab.com/kicad/code/kicad/issues/9783
2022-09-03 19:29:59 +01:00
jean-pierre charras c72091d7e0 fix a compil warning. 2022-09-03 19:55:54 +02:00
Wayne Stambaugh 4c096fee15 Eeschema: fix crash when attempting to edit missing library symbol.
Disable the edit symbol buttons in the symbol properties dialog when
there is no library symbol to edit.

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

(cherry picked from commit 5afeb45a84)
2022-09-02 16:25:34 -04:00
Jeff Young f17a865593 Move EDA_ITEM hitTest to BOX2I. 2022-08-31 17:18:45 +01:00
Jeff Young 2dc6300501 Move EDA_ITEM bounding boxes to BOX2I. 2022-08-31 10:16:55 +01:00
Jeff Young 5679b9dbdc Remove a few EDA_RECT instances. 2022-08-31 01:22:49 +01:00
Jon Evans 5c43c46365 Add new symbol fields to autocomplete list 2022-08-26 23:53:23 -04:00
Jon Evans 460e8015f0 Allow referencing LIB_ID components in symbol fields 2022-08-26 20:30:48 -04:00
Wayne Stambaugh 7c6d9f67f9 Eeschema: fix broken instance data when adding new symbol.
Pass the current SCHEMATIC object pointer in SCH_SYMBOL ctor so that
newly created symbols will update the current instance data on creation
when the current sheet instance is being displayed.

This is a better fix for the master branch and cherry-picking from 6.0
was a mess.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12190
2022-08-26 13:35:49 -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
Marek Roszko e0f28fc4e1 Replace wxFindReplaceData with our own container
By dropping the flags, we can be strict with options.
Also it makes future usage of search functionality a little more "UI" framework independent
2022-08-23 22:16:51 -04:00
Mikolaj Wielgus 6fad25f8ed Allow mapping sim model pins to arbitrary string symbol pin numbers
This change removes the incorrect assumption that symbol pin numbers are
integers and are the same as indexes in the vector storing the symbol
pins.

"~" is now used to denote a floating sim model pin.
2022-08-22 08:13:26 +02:00
Jeff Young 4f0136db3b Attempt to fix std::initializer_list lifetime issue. 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
Jon Evans 8694c37376 Remove requirement that non-power symbols share a name and value
There is no technical reason for this restriction for non-power symbols, so let's remove it.
This will allow more flexibility and compatibility with other tools.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9389
2022-08-20 17:43:43 -04:00
Jeff Young aa2ad3b44c Move KICAD_T[] to std::initializer_list<KICAD_T>. 2022-08-20 10:28:11 +01: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
Mikolaj Wielgus 978f01553b Sim Model Editor: Serialize models in fields
Implemented serialization and deserialization of models in symbol fields
through the SIM_VALUE class. We don't carry the Spice legacy of
case-insensitive suffixes, instead we conform to the SI standard (i.e. M
is Mega, not milli, P is peta, p is pico).

Parameter grid value validation is implemented by simply not allowing
any characters that will make the value invalid (instead of highlighting
the field in a red color). This will likely be changed at some point in
the future.
2022-07-30 02:25:34 +00:00
Marek Roszko a8505d9c76 SEARCH_RESULT -> INSPECT_RESULT
To fix the name squatting it's doing for future functionality
2022-07-29 20:01:10 -04:00
Jeff Young 5295342f42 Fix another case of the instance data getting messed up.
(Or, more accurately in this case, of the instance data not getting
applied to the current view.)

Fixes https://gitlab.com/kicad/code/kicad/issues/11390
2022-07-27 12:29:01 +01:00
Mike Williams c3d952644c Annotation: fix wrong multi-unit annotation messages
SCH_SYMBOL::Unit() is updated when the symbol is on the screen, we need
to get the instance unit so it's right even if it's not being displayed /
has never been displayed.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/12050
2022-07-25 18:44:55 +00: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 cb77e68076 Don't assume a SCH_EDIT_FRAME in EE_SELECTION_TOOL.
It's also used in the symbol editor.

But in any case, pins of other units have no business being in an
SCH_SYMBOL anyway.

Fixes https://gitlab.com/kicad/code/kicad/issues/12076
2022-07-23 14:28:07 +01:00
Jeff Young d24e6c3408 Auto-annotate (and then don't re-annotate) power symbols.
Fixes https://gitlab.com/kicad/code/kicad/issues/11942
2022-07-11 21:46:01 -06:00
Seth Hillbrand ff54b8c718 Overplot schematic symbol fields and pins
In the absence of z-ordering, we need to ensure that pin text and symbol
fields are always visible in plots as they are in the schematic window.
We do this by overplotting the fields/pins when symbols overlap each
other.

This can be removed if/when we implement https://gitlab.com/kicad/code/kicad/-/issues/2211

Fixes https://gitlab.com/kicad/code/kicad/issues/11969
2022-07-05 16:39:53 -07:00
Jeff Young e4798199c6 Handle alt pins in plot code.
Fixes https://gitlab.com/kicad/code/kicad/issues/11728
2022-06-10 22:38:01 +01:00
Seth Hillbrand 1a70465927 Use instance data to store values
Previous use of instance was as an "override" of the default value.
This has changed to be used as the primary storage location for all
values.  This means that we cannot clear the instance data when setting
a new value for all instances, instead we have to change the instance
data and the default value is superfluous

Fixes https://gitlab.com/kicad/code/kicad/issues/11439
2022-04-25 12:47:48 -07:00
Jeff Young 160240166c Cleanup. 2022-04-14 17:09:27 +01:00
Jeff Young 034b57d9c0 When reannotating keep existing prefix in most cases.
(Execption is reannotating entire schematic, in which case we reset
all of them.)

Fixes https://gitlab.com/kicad/code/kicad/issues/11379
2022-04-13 23:38:45 +01:00
Jeff Young 8358685920 Dual-purpose IsMovableFromAnchorPoint to keep from moving symbols off-grid.
Fixes https://gitlab.com/kicad/code/kicad/issues/11360
2022-04-11 12:02:20 +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 3196857449 Fix incorrectly initialized variable.
The SCH_ITEM default is LAYER_WIRE, which we don't want for a symbol.

Fixes https://gitlab.com/kicad/code/kicad/issues/11307
2022-04-05 13:57:28 +01: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
Jeff Young 41c0009c51 Off-grid ERC warnings.
Fixes https://gitlab.com/kicad/code/kicad/issues/10379
2022-03-17 20:23:56 +00:00
Jeff Young c919817c18 Don't reserve space for private items when autoplacing. 2022-03-06 16:12:49 +00:00
Seth Hillbrand ac87d5e940 Resolve text when requested
Getting resolved text for a symbol should always happen, even if we have
unresolved data in the instances

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

(cherry picked from commit acb5ce7108)
2022-03-01 15:11:06 -08:00
Jeff Young f11b8011cd Separate plotting into background and foreground.
Fixes https://gitlab.com/kicad/code/kicad/issues/10390
2022-02-10 20:33:06 +00:00
Jeff Young e61144d45a Finish with EDA_ANGLE. 2022-01-16 21:15:40 +00:00
Marek Roszko ac715d2e51 Scoop up some more wxPoint instances 2022-01-03 20:00:53 -05:00
Marek Roszko d1552c3fec Some more wxPoint removal 2022-01-01 12:11:21 -05:00
Marek Roszko c4c56de708 Neurotically update position wxPoint usages 2022-01-01 11:55:51 -05:00
Marek Roszko 347e03363a Convert wxPoint/wxSize starting from EDA_RECT usages 2022-01-01 11:30:33 -05:00
Jeff Young 889970a449 SCH_NETCLASS_FLAGs and SCH_FIELDs for labels.
ADDED: a new label type for netclass flags.
ADDED: the ability to define fields on labels.
2021-12-24 16:13:27 +00:00
Jeff Young 2bc86fa0a8 Shapes for schematic.
ADDED arc, circle and rectangle shapes for schematic.  Shapes support
line styles and fill colors.

CHANGED sheet background color in Edit Text & Graphics Properties to
fill color (and it now affects shapes).

Pushed STROKE_PARAMS down into common and moved all shapes to using it
for stroke descriptions.
2021-12-23 20:36:07 +00:00
Jeff Young 3d97138d92 Bug fix for dangling symbols on pins.
Fixes https://gitlab.com/kicad/code/kicad/issues/9667
2021-12-07 21:39:06 +00:00
Jeff Young 80d6b9e76d Tighten up hittesting for symbols and other items.
Grid-based accuracy doesn't need to be any larger than 1/2 the
diagonal as we'll snap to one side or the other.  And symbols don't
need as much slop as other items since there's plenty of "meat" on
them.

Fixes https://gitlab.com/kicad/code/kicad/issues/9805
2021-11-28 19:03:51 +00:00
Jeff Young 40b4052ad4 Improve text hittesting in schematics.
Text has a fairly big bounding box to account for descenders, overbars,
etc., but it makes it feel too sloppy for hittesting.  This change
allows selection disambiguation to look at the actual strokes of the
text when deciding what's "closest".

Fixes https://gitlab.com/kicad/code/kicad/issues/9506
2021-11-01 21:13:12 +00:00
Jeff Young fe6cb7dbb4 Mirror sheet fields when mirroring sheet.
Fixes https://gitlab.com/kicad/code/kicad/issues/9479
2021-10-28 21:45:22 +01:00
Jeff Young b52529521e Replace individual LIB_* shapes with LIB_SHAPE (based on EDA_SHAPE).
Also moves to more capable FILL_T model that can be shared.
2021-10-15 12:45:43 +01:00
Jeff Young f73042fe24 Some minor performance enhancements. 2021-09-28 14:28:35 +01:00
Jeff Young 5f3c67bd2b Fill in some missing GetMsgPanelItems and make some others consistent.
Also expunges a std::vector<MSG_PANEL_ITEM> cover type.
2021-09-27 00:23:40 +01:00
Jeff Young 2d72ccb6ae Simplify dangling end stuff a bit and remove graphic lines from it. 2021-09-24 12:19:27 +01:00
Jeff Young 552f053a55 Remove pins from symbol hit-testing.
Fixes https://gitlab.com/kicad/code/kicad/issues/8508
2021-09-23 22:07:51 +01:00
Jeff Young 3b121359ae Fix a couple of escape-string issues.
Fixes https://gitlab.com/kicad/code/kicad/issues/9167
2021-09-14 18:30:19 +01:00
jean-pierre charras a5560bb5f9 Eeschema, Add new symbol to schematics: update Value and Footprint texts
to be currently displayed.
Fixes #9025
https://gitlab.com/kicad/code/kicad/issues/9025
2021-08-25 15:13:40 +02:00
Jeff Young 3bddadc03d Fix a typo in reference clearing.
Also fixes an unrelated bug where all values/footprints were getting
reset rather than just the instance versions.

Fixes https://gitlab.com/kicad/code/kicad/issues/8891
2021-08-22 19:55:20 +01:00
Jeff Young 6aaf4413b3 Fix kicad_string.h / string.cpp mismatch.
They don't define a KiCad string class, so the header file name was
somewhat misleading. But the fact that they didn't match definitely
made coding more difficult.
2021-07-29 16:03:25 +01:00
Jeff Young 726f4d8016 Fix up some more cases of missing escaping for symbol names.
Fixes https://gitlab.com/kicad/code/kicad/issues/8694
2021-07-28 16:40:38 +01:00
Jeff Young fa93c1ec65 Don't include hidden fields in bounding box.
Fixes https://gitlab.com/kicad/code/kicad/issues/8809
2021-07-22 13:56:09 +01:00
Wayne Stambaugh cb72da294a More NULL expunging. 2021-07-16 16:13:41 -04:00
Wayne Stambaugh 9d348d7e6d Coverity issue fixes. 2021-07-06 13:32:34 -04:00
Jeff Young 2aa2493472 Resolve un-set template fieldnames to empty string.
Fixes https://gitlab.com/kicad/code/kicad/issues/8699
2021-06-30 13:12:57 +01:00
Jeff Young b1b4caee6a Escape "naughty" characters in symbol names.
It's tempting to say that we don't need to exclude filename chars
from symbols, but we might regret that decision down the road.  Better
to just escape them.

Fixes https://gitlab.com/kicad/code/kicad/issues/8694
2021-06-30 13:12:57 +01:00
Wayne Stambaugh ee3eac325d Expunge the use of the word part from Eeschema code. 2021-06-15 08:32:11 -04:00
Wayne Stambaugh 71c183d7bb Rename LIB_PART to LIB_SYMBOL. 2021-06-14 07:11:17 -04:00
Wayne Stambaugh fbc135e69f Rename SCH_COMPONENT to SCH_SYMBOL. 2021-06-10 10:34:49 -04:00
Wayne Stambaugh 9ebabb222c Pass objects by reference instead of on the stack. 2021-06-08 10:09:38 -04:00
Marek Roszko 4df3cb912d Remove another leaky wx/log.h header 2021-06-03 08:11:15 -04:00
Jeff Young 2e3860de6f Naming conventions. 2021-05-05 22:58:40 +01:00
Seth Hillbrand d934dae21a null check for non-schematic symbol
Fixes https://gitlab.com/kicad/code/kicad/issues/8279
2021-04-22 17:53:45 -07:00
jean-pierre charras 8967e7eb3e Eeschema: remove a strange test that modified the reference position.
For some reason, when the reference was empty, the position was changed
without a good reason. (It happens in the SCH_COMPONENT ctor).
Fixes #8230
https://gitlab.com/kicad/code/kicad/issues/8230
2021-04-18 11:27:05 +02:00
Jeff Young 13473420e5 Remove duplicated routine and fix bug in UTIL version. 2021-04-17 15:10:59 +01:00
Jeff Young f7ae819430 Don't confuse annotation prefix *letters* with root annotation.
Given a symbol U12A, some parts of the code were assuming the prefix was
'U' while others were assuming 'U12'.  Further complication arose when
there were '?' in the library version.

Fixes https://gitlab.com/kicad/code/kicad/issues/8223
2021-04-17 12:30:40 +01:00
Jeff Young df5f010514 Bug fixes for fields when editing a symbol from the schematic.
1) Don't reset value when name changes
2) Don't fire events when initialising dialog
3) Make sure when symbol is saved back to schematic that only current
instance has its ref updated, but that all instances have their other
fields updated.
4) When saving symbol back to board always use the fields from the
editor and not the (alias-specific) ones from the library.

Fixes https://gitlab.com/kicad/code/kicad/issues/8159
2021-04-09 17:14:53 +01:00
Wayne Stambaugh 925b6d9387 Eeschema header housekeeping round 2. 2021-03-25 17:55:16 -04:00
Jon Evans f7c20c6bef Only consider pins on this unit as clickable anchors
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7987
2021-03-21 19:18:13 -04:00
Jeff Young 7a13ad7b17 Consistent naming. 2021-03-19 23:06:19 +00:00
Jon Evans 18037e2f65 Rework bitmap system to load from archived PNGs
Bitmaps are now identified by an enum class instead of by pointers.
Bitmap loading and caching is now handled by a class in common, and
we no longer compile most bitmaps into the binary, so there is no
longer a bitmaps static library.

Instead, bitmaps are archived to a .tar.gz file which is installed
in ${KICAD_DATA}/resources/images.tar.gz

The source PNGs are checked in to Git as the original CPP files were,
so that people can build without the required dependencies to convert
SVGs to PNGs.

Initial support is also added for dark theme icons, although this
is not yet exposed in the GUI.

Stubs are present for multi-resolution image resources, but this is
not fully-baked yet and could use some refinement.
2021-03-11 08:37:35 -05: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
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
Wayne Stambaugh 1786ae8773 Eeschema: use symbol nomenclature for object file naming. 2021-02-24 08:48:02 -05:00
Renamed from eeschema/sch_component.cpp (Browse further)