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.
* 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.
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
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
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.
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.
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
* 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
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
Abandon the previous behavior of always creating a new copy of the
buffered symbol which required a re-parenting of every derived symbol
to prevent accidentally orphaning a derived symbol parent symbol
pointers.
This change required something that should have been done a long time
ago by adding an assignment operator to LIB_PART. The assignment
operator makes it possible to create a single copy of the symbol to
buffer which gets updated rather than deleting the last copy and
replacing it with a new copy.
Add a clear method to the MULTIVECTOR class so that existing LIB_PART
object draw items can be removed before assigning the draw items from
the part being assigned.
Fixes#3672https://gitlab.com/kicad/code/kicad/issues/3672
Create an IsContentModified() function in each frame
that provides if the content has been modified, and
use that instead of always copying the checks.
There is no need to create a new root symbol and re-parent all derived
symbols when renaming a root symbol. Just rename the buffered root
symbol.
Test for duplicate symbol names when validating the properties dialog
information to prevent broken symbol pointers.
Fix a field drawing bug when editing derived symbols.
Fix bug to insure duplicate symbol names cannot exist in a library.
Fixes kicad/code/kicad#3654
Fixes kicad/code/kicad#3672
The library manager update part function was orphaning the root symbol
of derived symbols when the root symbol was edited. Re-parent the
inherited symbols when updating a root symbol.
Update the mandatory field attributes whenever the parent is set for
derived parts. This will show the fields with the correct attributes
in the symbol editor and viewer.
Using std::unique_ptr to hold the current symbols was deleting the
pointer on symbol selection changes causing the pointer in the library
manager buffer to be stale in some cases. Revert back to using a
simple pointer and manual clean up as required.
Prevent derived symbols from being saved to a different library to
prevent orphaned symbols.
Fixes kicad/code/kicad#3649
The symbol editor selection criteria did not include LIB_FIELD objects
which allowed the root symbol name to be changed causing broken derived
symbol links. Disable the symbols fields from being edited when a
derived part is shown in the editor to prevent this.
Add a missing warning that deleting a root symbol used to derive other
symbols would also delete all derived symbols from a library. Give the
user a chance to cancel the delete operation in this case.
Fixes kicad/code/kicad#3654
This change completely removes the LIB_ALIAS design pattern an replaces
it by allowing LIB_PART objects to inherit from other LIB_PART objects.
The initial implementation only allows for single inheritance and only
supports the mandatory fields in the derived part because that is all
that the current symbol library file format will support. Once the new
file format is implemented and saving to the old file format is deprecated,
more complex inheritance will be added. The LIB_ALIAS information saved
in the document files was move into the LIB_PART object. This change
impacts virtually every part of the schematic and symbol library editor
code so this commit message is woefully incomplete.
REMOVE: Removed the symbol aliases concept from the schematic and symbol
editors and the symbol viewer.
NEW: Replace the symbol alias concept with simple inheritance that allows
a library symbol to be derived from another library symbol.
1) don't ASSERT; use exceptions (which can be caught) instead.
2) clean up LIB_LOGGER so it's only used during sync
3) fix typos in wxLogMessage() calls so they produce output.
4) throw on unrecognized token in loadContent().
5) if clipboard can't be pasted as content then paste as text.
Fixes: lp:1840172
* https://bugs.launchpad.net/kicad/+bug/1840172
* Push a function into CONDITIONAL_MENU that adds the item
* Modify the tooltip for close and exit items to have the
program name
Fixes: lp:1835454
* https://bugs.launchpad.net/kicad/+bug/1835454
Previously, for instance after modifying preferences or language,
they were rebuilt but the tools state was not set due to a missing call to SyncToolbars() after rebuilding.
wxLog::SetActiveTarget() was initialised to libedit frame,
but the active target was not released after closing and deleting libedit, thus creating a crash on Kicad exit.
Replace also in lib_manager.cpp some DisplayErrorMessage calls by wxLogMessage calls,
to avoid hanging or crashes, at least on Windows.
wxLogMessage also has the advantage of grouping all messages and displaying them during a idle time.
In singletop mode, all frames show the "Quit" option in the file menu
and will quit on Ctrl-Q. When launched from the main KiCad interface,
sub-programs show the "Close" option instead and will close with Ctrl-W.
In this mode, Ctrl-Q will instruct the main program to exit.
Fixes: lp:1779938
* https://bugs.launchpad.net/kicad/+bug/1779938
Also changes the presentation of the string when the checkbox appears
so that the "Changes will be lost" warning isn't hidden by the turndown.
This last part may require conditional compilation as it's undocumented.
Lastly, regularizes the Unsaved Changes strings between the apps.
A bug in LIB_MANAGER::LibraryExists() prevented a library removed from
the symbol library table from being removed from the tree view. Add the
proper check to SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync().
This exposed another issue with synchronization between the library
table editor and the tree view which could lead to orphaned library
modifications and/or a segfault when the currently selected library was
removed from the symbol library table. Give the user a chance to save
or revert any changes before allowing changes to the symbol library
table.
Fixes lp:1821691
https://bugs.launchpad.net/kicad/+bug/1821691