wxWidgets 3.1 has deprecated wxPATH_NORM_ALL when normalizing file
paths when calling wxFileName::Normalize(). This change keeps the
existing behavior except in places where our own internal
ExpandEnvVarSubstitutions() to expand environment variables.
(cherry picked from commit 898ec0d094)
Also cleans up the dialog a bit.
Also changes the workings of NormalizePath to return the input if
it couldn't be shortened which saves open coding that behaviour in
all its callers.
Fixes https://gitlab.com/kicad/code/kicad/issues/9036
Differentiates better between the EDA_ITEM IsModified(), referring to
items themselves changing and the EDA_SCREEN IsContentModified(),
referring to whether we have made any unsaved changes.
Set up a new lineage for SCH_ITEMS to get back to the SCHEMATIC
they live on: Items will all be parented to the SCH_SCREEN that
they are added to, and each SCH_SCREEN will point back to the
SCHEMATIC that it is part of. Note that this hierarchy is not
the same as the actual schematic hierarchy, which continues to
be managed through SCH_SHEETs and SCH_SHEET_PATHS.
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.
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.
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.
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.
Do not keep pointer to SCH_EDIT_FRAME in the rescuer object to prevent
it from creating dialogs with itself as the parent when call from the
rescue dialog which is itself a grandchild of the frame window.
It can be useful to have similar class messages grouped together so that
error messages in a larger report don't get lost among the
warning/info/action messages.
This patch allows sorting of messages for dialogs that benefit from
organization. Default behavior of reporter messages remains
unchanged by this patch.
Fixes: lp:1772090
* https://bugs.launchpad.net/kicad/+bug/1772090
The backup code was designed for a project with all of the schematics
in the project folder which is not always the case. Fix the schematic
backup to keep the schematic folder structure in tact during backups.
Fixes lp:1751662
https://bugs.launchpad.net/kicad/+bug/1751662
Change the behavior of the remapping algorithm to remap even if a
project symbol library table exists in the project file in case a
previous attempt to remap failed. The existing symbol library table
is backed up to the back folder and rebuilt.
Fixes lp:1741983
https://bugs.launchpad.net/kicad/+bug/1741983
File names with spaces were causing invalid symbol names in both the
rescue library and the cache which would cause both libraries to fail
to load because library symbol names are not escaped so the spaces
tripped up the library parser. Replace the spaces in the file names
with hyphens and in both the rescuer and the remapping code so the
library nickname in the symbol library table does not contain spaces.
Update the symbol library table dialog to prevent users from defining
library nicknames with spaces. This is different than the footprint
library table which allows nicknames with spaces. This solution is
a temporary fix until the new symbol library and schematic file formats
are implemented.
Fix off by one row in illegal nickname error message in the symbol
library table editor.
Create separate folder in project path to backup files changed during
remapping.
Add time stamp to backup file names in case multiple remappings are
performed.
Add backup file information to report panel instead of using debug
trace messages.
Disable the remap button if the user does not have write privileges to
the current project path.
The Windows drive specifier C: was being interpreted as a valid URL by
wxURI which was performing a URL comparison instead of a file comparison
which always failed in LIB_TABLE_BASE::FindRowByURI(). Change test for
URI to search string for "://" to determine if the comparison should be
a URI (string) comparison or a file (wxFileName) comparison.
Don't run final rescue unless the user performs the remapping.
The remapping utility would create a new project specific library when a
symbolic link pointed to a library already defined in the symbol library
table. Now the comparison checks to see if the library path and file
name are actually a symbolic link if the file names are not the same when
the symbol library table entry is a file name rather than a URL. URLs
are simple string comparisons.
Disable the remap button after the remapping completed.
Remove some commented out code from the edit symbol in schematic dialog.
Fixes lp:1738634
https://bugs.launchpad.net/kicad/+bug/1738634
If a schematic contains two symbols with the same name from different
libraries, the cache will contain the last symbol saved with that name.
Prepend the library nickname with the original schematic symbol library
nickname when saving the cache library to prevent name collisions.
Don't back up schematic files unless the user requests a remap.
Back up all files that could be changed by a remap including the
schematic file(s), cache library, project file, and rescue library
files.
Use an HTML control instead of a static text control for improved layout
of the user remap prompt.
Improve the user prompt in the remap dialog to make it clear that changes
will be made to project files.
Do not attempt to normalize environment variables that are not valid
paths, paths that do not exist, or paths that the user does not have
read access to.
Fixes lp:1731655
https://bugs.launchpad.net/kicad/+bug/1731655
In the rare case when something goes wrong with the symbol library
table remapping, do not attempt to rescue symbols that are neither
in the cache nor in any of the libraries.
The legacy rescue library code overwrote the existing library so
previous rescues would get lost. If the rescue library exists,
copy it's contents into the new rescue library before adding the
new rescued symbols so no previously rescued symbols are lost.
Fix a null pointer bug in the symbol library editor when no symbol
is loaded.
Set LIB_ID item name to name passed to LIB_PART ctor.
Copy LIB_ID in LIB_PART copy ctor.