Move updating the pin maps from external code to the SCH_COMPONENT object
when changing the symbol body style (DeMorgan). This is a vein attempt
to make the SCH_COMPONENT object self contained so we don't have to depend
on the caller needing to figure out how to keep internal objects synced.
SCH_SCREEN::UpdateSymbolLinks() should only be called when working with
the legacy schematic file format. Add schematic symbol library symbol
links should be set using SCH_COMPONENT::SetLibSymbol() which updates
the symbol link and pin map accordingly.
Change the schematic symbol LIB_ID edit dialog to properly use the new
SCH_COMPONENT::SetLibSymbol() function.
Use flattened (root) library symbols to prevent broken library symbols
in schematic files.
Remove the edited symbol from screen before making changes to the symbol
to prevent potential orphaned symbol libraries being saved in schematic
file.
Add some defensive programming to let developers know that an invalid
library symbol link was used when calling SCH_COMPONENT::SetLibSymbol().
Removed some rogue calls to SCH_SCREEN::UpdateSymbolLinks() which should
only be called the last time the schematic is loaded from the legacy file
format. After that, all symbol library links should be changed using
SCH_COMPONENT::SetLibSymbol() which will prevent the pin maps from ending
up with broken symbol library pin links.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4318
There has been a long standing (since the beginning of the project?)
issue with sharing schematics between projects. It has been somewhat
supported for complex hierarchies (a sheet shared multiple times in a
single design) but it has not been well supported for simple hierarchies
(the symbol references cannot be changed in the shared schematic). This
issue has been resolved by moving all of the symbol instance sheet paths
from the symbol definitions in the all of the project files and save all
symbol path instances in the root sheet. This ensures that orphaned
symbol instance paths do not accumulate in shared schematic files and
that designs that reuse schematic in simple hierarchies can how have
different references. It also allows the root schematic from one project
to be uses as a sub-sheet in another project.
When legacy schematics are loaded, all sheet and symbol UUIDs are
converted from time stamps to true UUIDs. This is done to ensure there
are no sheet path instance clashes between projects. That being said,
there are no checks for this. It is assumed that the probability of
UUID clashes is so low that it doesn't make sense to test for them.
This is a very large and potentially disruptive change so this will be an
unusually long and detailed commit message.
The new file formats are now the default in both the schematic and symbol
library editors. Existing symbol libraries will be saved in their current
format until new features are added to library symbols. Once this happens,
both the legacy schematic and symbol file formats will be no longer be
savable and existing libraries will have to be converted. Saving to the
legacy file formats is still available for round robin testing and should
not be used for normal editing.
When loading the legacy schematic file, it is imperative that the schematic
library symbols are rescued and/or remapped to valid library identifiers.
Otherwise, there will be no way to link to the original library symbol and
the user will be required manually set the library identifier. The cached
symbol will be saved in the schematic file so the last library symbol in
the cache will still be used but there will be no way to update it from the
original library.
The next save after loading a legacy schematic file will be converted to
the s-expression file format. Schematics with hierarchical sheets will
automatically have all sheet file name extensions changed to .kicad_sym
and saved to the new format as well.
Appending schematics requires that the schematic to append has already been
converted to the new file format. This is required to ensure that library
symbols are guaranteed to be valid for the appended schematic.
The schematic symbol library symbol link resolution has been moved out of
the SCH_COMPONENT object and move into the SCH_SCREEN object that owns the
symbol. This was done to ensure that there is a single place where the
library symbol links get resolved rather than the dozen or so different
code paths that previously existed. It also removes the necessity of the
SCH_COMPONENT object of requiring any knowledge of the symbol library table
and/or the cache library.
When opening an s-expression schematic, the legacy cache library is not
loaded so any library symbols not rescued cannot be loaded. Broken library
symbol links will have to be manually resolved by adding the cache library
to the symbol library table and changing the links in the schematic symbol.
Now that the library symbols are embedded in the schematic file, the
SCH_SCREEN object maintains the list of library symbols for the schematic
automatically. No external manipulation of this library cache should ever
occur.
ADDED: S-expression schematic and symbol library file formats.
Some items (tracks and footprint graphic items) when reading were added in reverse order
of the initial file, creating useless differences and breaking source comparisons.
Also fixes a bug where a bunch of eeschema settings weren't getting
loaded because it looked like they were larger than the max value
(which wasn't being scaled from mils to internal units).
Fixes https://gitlab.com/kicad/code/kicad/issues/2089
Also fixes a bug where we were depending on the old deque stuff's
deterministic traversal, which isn't provided by the new RTree stuff.
Fixes https://gitlab.com/kicad/code/kicad/issues/2433
Once the gal canvas hsad the focus, it was not possible to use arrow keys in library
or symbols or fp lists even after clicking on an item.
This focus issue is now fixed.
Fixes#4292https://gitlab.com/kicad/code/kicad/issues/4292
In Eeschema, texts are expected to have the same size X and size Y.
So we cannot set 2 different values for X and Y pin size:
- only size X is saved in file
- 2 different values for X and Y create bad look for pin + associated graphic symbol
Allowing separte values need a file format change *and* a code change.
Texts were drawn with a minimal line thickness = GetDefaultPenWidth().
The default pen width can be to large for small texts.
So the actual text thickness is now always clamped.
Unlike the global labels, the hierarchical label is not inside the graphic symbol.
So the graphic symbol size depends only of the text size, not of the text offset.
* Push all sizing operations into EDA_BASE_FRAME
* Save the unmaximized window size when maximizing
so that we can then save it in the config if the
window is maximized. Otherwise the config ends up
with the maximized size saved, and weird behavior
occurs when unmaximizing on the next opening.
Move the hierarchical sheet loading outside of the try exception block
so that any sheets that were loaded when a schematic file load fails
are loaded rather than skipped. This allows more of the schematic to
be loaded when any parser errors occur.
SCH_SHEET objects can only have another SCH_SHEET object as a parent
or nullptr for the root sheet so overload EDA_ITEM::SetParent() to
prevent the parent from being set to another type of object and add
some checks to the root sheet code just in case someone gets clever
and attempts to bypass the overloaded SetParent() call.
Now only reposition a window if it is completely on a
disconnected display or if only one corner is on screen
and it is within a region close to the screen border.
CHANGED: Window position on startup should be preserved more
Don't try to use complex algorithms taking into account default
margins, line-widths and pen-widths (especially when they differed
between label types). We now use the (user-controlled) text
offset ratio to determine the margins (from the center-point of
the attached line).
Some graphic line thickness were initialized to 0.
The actual line thickness is set after reading config.
But in some cases the config does not exist, and 0 line thickness creates draw issues.
These panels must have the wxTreeBook as parent to receive mouse and key events.
They previously have the dialog itself, but it does not work on any OS.
When the filter = SCH_LOCATE_ANY_T, components and sheets were selected twice, one
from the main loop, and one from specialized loops for SCH_COMPONENT_T and SCH_SHEET_T.
(the dialog was reactivated by calling Raise(), but this is not enough: Show()
must be called also, at least on Windows).
Fix also a minor wxWidgets alert in ERC dialog.
Fixes#4171https://gitlab.com/kicad/code/kicad/issues/4171
I could not find a reasonable solution to the mandatory field canonical
name issue so field indices are back in play as much as I did not want
to use them. They really only have meaning for the mandatory fields.
For all other fields, the index number is meaningless and the field name
is the primary means for searching.
Fix a broken field size bug in the symbol library formatter.
deselect the previously placed items.
Otherwise, the changes (rotation, mirroring...) made during placing the current symbol
are applied to other previously placed items.
This is obviously not what is wanted, and creates crashes in Eeschema.
Fixes#4163https://gitlab.com/kicad/code/kicad/issues/4163
When editing a sheet properties, the dialog always thinks the sheet filename is changed.
It creates serious issues, like duplicating all items in sheet, because the code try to
again import the existing sheet file content.
The temporary fix does not import the existing sheet file content if the
filename is not modified.
This is a very partial fix, because there are many other issues in this dialog
Use an underscore character instead of a semicolon between the library
ID library nickname and symbol name in library ID search strings when
looking up symbols in the cache library since that is how they are saved
when creating the cache library. This fixes rescuing missing symbols
from the cache when they have been removed from the original library and
preventing a broken symbol link indicator from being shown when a symbol
is removed from the library.
Add some defensive testing to make sure the library passed to function
SchGetLibPart() is actually the cache library.
The code that checked for pin conflicts to determine if a symbol needed
rescued did not check either the pin convert setting so it was possible
for a pin from the other convert on symbols that do not have identical
units to appear to not have a pin conflict. Add tests for pin unit and
convert setting to prevent that from breaking the comparison. This must
have always been broken.
Fix the symbol preview widget to prevent drawing all symbols on top of
each other (if we need to do this the code will have to be revised) and
also show the convert if valid.
Fix broken symbol cache library when saving alias symbols.
Fixes https://gitlab.com/kicad/code/kicad/issues/3879
It looks good, but non-mandatory fields have an ID of -1, so it
doesn't actually work. Some places got around this by converting
the ID to unsigned, but this just hides the real issue from
unsuspecting coders.
Fixes https://gitlab.com/kicad/code/kicad/issues/4140
Move the camera out to its own so that everything else is board-
related, and then rename BOARD_ADAPTER.
At some point the flags should probably be moved out too, and they
can have the EDA_3D_SETTINGS name.
Iterators are invalidated by vector reallocation. We need to keep the
count in the loop in order to have a valid position in the vector
Fixes https://gitlab.com/kicad/code/kicad/issues/4073
Please note that the symbol cache is not embedded in the schematic file
to allow for round robin testing with the existing file format. Once
the parser round robin testing is complete, the symbol cache will be
embedded in the schematic file.
Includes improvements to Update PCB from Schematic dialog and
corresponding changes to Symbol Properties, Sheet Properties and
Footprint Properties.
Fixes https://gitlab.com/kicad/code/kicad/issues/4012
I imagine this was inserted to ensure the selected item is visible,
but selecting the item does that. SyncLibraries() rebuilds the
entire tree, causing it to lose the user's scroll position.
Fixes https://gitlab.com/kicad/code/kicad/issues/4020
Replace SEVERITY_ERROR by RPT_SEVERITY_ERROR to avoid collision with a system definition.
Replace other SEVERITY_XXX by RPT_SEVERITY_XX for consistency.
Fix compil warnings and some other compil issues.
Previously, to list changes, the Reference field was used in comparisons.
In complex hierarchies, this is incorrect: the Reference field contains
only the last displayed reference, not the reference of a given sheet.
The comparison uses now the sheet paths for ref and unit selection.
This implements all existing symbol library object support and the ability
to save and load symbol library files between file formats for round robin
testing.
CHANGES: Symbol library file format has been converted to s-expressions.
Add support code for picking apart symbols at some future junction that
will allow full inheritance conversion of existing symbol libraries. For
now, symbols arranged by unit and body style numbers are nested for round
robin testing of symbol libraries once the parser is complete.
The symbol check output the HTML message for each item. This is _very_
slow and can lock the system reponsiveness. Changing to a queue/flush
method is much faster
Keeping a pointer to the actual file history inside a special
file history menu led to many cases of use after free crashes,
so instead rework the actual file history to add the menu
items.
Fixes https://gitlab.com/kicad/code/kicad/issues/3741
After importing, some schmeatics are moved, item at a time. When moving
schematic items, we need to update the RTree bounding box to allow
searching on position
Fixes#3915 | https://gitlab.com/kicad/code/kicad/issues/3915
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme
Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
When searching for fields, the code was sometimes comparing translated and not translated names.
This is an issue for mandatory fields, in non English languages.
Translated field names should be used only in messages.
Using a UTF8 char inside a C string can work on unix, but not on Windows.
It must be explicitly converted in a unicode value inside a wide string
(like a wxString)
When adding a .pretty library, if the actual .pretty folder were
selected then no folder would be added to the list of libraries.
This led to an assert when normalizing paths, and the library
not being added.
Add also a comment in common.cpp about using wxLocale instead of setlocale.
DIALOG_UPDATE_FIELDS has issues in non English languages, due to its design.
The fix for mandatory fields is only a partial fix that avoid major issues.
The immediate action option clears (or not) the position of the events.
We use this to determine if the command should start at the given
position or merely activate the tool. This was being checked in the
menu options, which only activated for tool commands in the context
menu. Moving to the process event, we catch hotkeys as well.
This also restores the previous logic in eeschema that used a static
variable for storing wires rather than the private class variable.
Starting the draw event now picks up from the existing wires when
activated in immediate mode.
Fixes#3891 | https://gitlab.com/kicad/code/kicad/issues/3891
If the point editor is active and a change is made, the tool was shut down after
deleting the board data, in the frame Dtor.
Therefore a crash happened because a call to GetScreen()->SetModify(); using a null pointer,
and after the test for modifications was done.
Now tools are stopped when closing the window, before any test for modifications.
The parents are the only items that live in the RTree, so the rebuild
check needs to recurse into the sub structure to check for selection
Fixes https://gitlab.com/kicad/code/kicad/issues/3858
Previously, OnModify() was called for a lot of items, even when not modified.
For large schematics, the calculation time was unreasonable ( several minutes)
It is now called only a few times.
Shared sheets can create issues in a complex hierarchy.
This is not related to sharing sheets between projects.
(Sharing sheets between projects is not supported by Kicad)
These help files are created from the .md source files and contain I18n strings,
but do not exist if kicad is not built from sources.
However they are needed by translators.
ADDED: Back annotation algorithm,
eeschema back annotation dialog
CHANGED: added some minor helper methods to SCH_REFERENCE_LIST and SCH_REFERENCE,
split SCH_REFERENCE_LIST::CheckAnnotation on 2 parts to reuse code
The RTree does not have a deterministic iterator, so extracting items
may be in arbitrary order, causing issues as the schematic appears to
change when comparing to previous revisions.
This uses the SCH_ITEM comparison operator to for ordering by type, then
by custom sorting within type.
For the netlist, we choose the first available unit in the sheet for
each component.
Fixes#3811 | https://gitlab.com/kicad/code/kicad/issues/3811
We need to ensure that the appended sheet does not already exist in the
parent hierarchy. We do this for new sheets but need to check for
existing ones as well.
Fixes#3806 | https://gitlab.com/kicad/code/kicad/issues/3806
When opening the symbol editor without loading the schematic editor the
default text size setting is not loaded and was defaulting to the old mils
setting. Convert the default text size to internal units in case the
symbol editor is launched first.
Set default line, bus, and selection highlight width to internal units.
Change new symbol dialog pin position offset control from a spin control
to a text control so the unit binder object can handle converting to and
from internal units.
Fixes#3802https://gitlab.com/kicad/code/kicad/issues/3802
The components are reloaded when libraries change and when loading a
schematic. The initial load does not contain pins and so bbox hits may
miss elements.
Fixes#3800 | https://gitlab.com/kicad/code/kicad/issues/3800
Convert minimum sheet width and height definitions from mils to internal
units.
Add comment to sheet minimum width and height definitions to indicate
sizes are in mils.
This file should really be included first from any source file, because it
contains platform specific workarounds.
This also groups includes a bit by source.
Bus submenus weren't sending events because tool wasn't set.
Net names need to be unescaped for display.
Unfolding wasn't drawing the new wire segments.
SCH_LINE_WIRE_BUS_TOOL could get caught in an infinite event handling loop.
Fixes https://gitlab.com/kicad/code/kicad/issues/3796
Scope: NETLIST_ITEM, CONNECTION_TYPE, ELECTRICAL_PINTYPE,
NET_CONNECTION, NETLIST_ITEM, GRAPHIC_PINSHAPE
Note, the pin type enum had PT_ added to the front to prevent
shadowing of the INPUT symbol on msys2 (see discussion at
c17c9960d8)
Spice lines defining circuit elements are contained in a .subckt ..
.ends block. The intervening lines should be exported to the netlist as
well as the control lines.
dynamic_cast could not resolve the cast chain leading to a null undo
point. Since we know the item to be LIB_ITEM, we can use static_cast
anyway and avoid the overhead.
Fixes#3771 | https://gitlab.com/kicad/code/kicad/issues/3771
This also removes vector cover types which do nothing except obfuscate
the underlying implementation.
Mainly changes SCH_SHEET_PINS and CONFIG_PARAM_ARRAY (which will soon
be replaced by Jon's new stuff).
* Ensure the lib edit undo checks for pointer validity
* Assert that the frames are the correct type (satisfies coverity)
* Convert C casts to C++ casts
It served us (mostly) well for more than a decade. It helped KiCad grow
before the std:: came into decent shape or speed. It was a good little
list.
RIP DLIST 2008-2020
This moves EESchema DLIST structures to rtree. These changes are more
fundamental than the pcbnew changes from 9163ac543888c01d11d1877d7c1
and 961b22d60 as eeschema operations were more dependent on passing
drawing list references around with SCH_ITEM* objects.
Add try/catch blocks when saving symbols using a plugin object directly
to prevent potential unhandled exception bugs. I'm not totally happy
using wxLogError to flag exceptions but I couldn't think of a better way
to handle them.
Fixes#3665https://gitlab.com/kicad/code/kicad/issues/3665
"INPUT" declaration in sch_text.h generate *a lot of* compil warnings.
So it is replaced by PS_INPUT.
For consistency, others member of enum class PINSHEETLABEL_SHAPE are also renamed.
For legacy reasons, it stored left and right "spin" as flipped integers in the file format.
But the code handled the flip in multiple locations rather than just doing it on file io.
This change unifies the internal code and does the mapping in the file I/O.
and switch to the paren sheet from the context menu.
Mainly, change the way the dialog is managed from the sch_edit_frame:
the pointer to find the created dialog is replaced by a call to wxWidows::FindWindowByName().
Using a pointer set and cleared by events is a recipe for crashes.
ADD: Allow drawing of current and phase traces with dotted style
for easier differentiation from voltage and magnitude. The option
is available in the View menu of the simulator.
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions
This is part of cleaning the build system for #1906.