Commit Graph

39 Commits

Author SHA1 Message Date
Jeff Young 1cd2a51db2 Make undo/redo lists protected. 2020-07-13 15:53:36 +01:00
Jeff Young 7340c97ef9 Undo for schematic-wide operations.
Editing value/footprint fields of multi-unit components.
Find/Change.
Annotation.
Back annotation.

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

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

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

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

Fixes https://gitlab.com/kicad/code/kicad/issues/3899
2020-07-13 12:32:17 +01:00
Jon Evans 12b4a55ae8 Port Eeschema to new project settings
DRC/ERC error serialization changed to use explicit tokens
Old stored severities and ignored errors are discarded
2020-07-02 22:08:54 -04:00
Wayne Stambaugh b624c7090a Deprecate saving legacy schematic and symbol library file formats.
REMOVED: The ability to save schematics in the legacy file format.
2020-05-29 12:43:00 +00:00
Jon Evans d7bd4c9b04 Move Eeschema globals to new SCHEMATIC object
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.
2020-05-18 13:04:56 -04:00
Wayne Stambaugh 7183e9f97e Make the new schematic and symbol library file formats the default.
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.
2020-05-04 12:40:03 +00:00
jean-pierre charras b7cd0c54c2 Fix compil issues, especially on Windows:
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.
2020-03-04 10:48:18 +01:00
Jeff Young 85c2e0d23a Add user-defined severities, exclusions and colors to DRC markers.
Exclusions are currently persisted in the project file.

Fixes https://gitlab.com/kicad/code/kicad/issues/1989
2020-03-04 00:39:28 +00:00
Seth Hillbrand 6e5e453d0d Replace EESchema DLIST
This moves EESchema DLIST structures to rtree.  These changes are more
fundamental than the pcbnew changes from 9163ac543 888c01d11 d1877d7c1
and 961b22d60 as eeschema operations were more dependent on passing
drawing list references around with SCH_ITEM* objects.
2020-01-10 06:37:08 -08:00
Ian McInerney 3ca231aa78 Rename lib viewer frame files to use the class name 2019-12-19 14:05:46 +00:00
Wayne Stambaugh 54f066fed7 Implement simple inheritance for library symbols.
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.
2019-12-06 11:33:52 -05:00
Jeff Young 8f84c3ec4f Grid rid of GetCanvas/GetGalCanvas distinction now that there's only gal. 2019-06-13 19:58:37 +01:00
Wayne Stambaugh 44cb979e91 Decouple SCH_EDIT_FRAME from symbol rescue and remap dialogs.
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.
2019-02-05 12:43:46 -05:00
Seth Hillbrand 8c5037a48b Optionally sort reporter messages
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
2018-05-22 13:55:02 -07:00
Wayne Stambaugh ce1bd4c6b7 Eeschema: fix remapping backup project with schematics in subfolders.
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
2018-02-28 11:42:05 -05:00
jean-pierre charras 8022f1cc01 fix code after renamin files 2018-01-30 11:49:51 +01:00
jean-pierre charras 795a36c9fe Fix code after renaming files, and a bit of code cleanup (remove useless includes and multiple includes of the same files) 2018-01-30 09:57:25 +01:00
Wayne Stambaugh 3c9316957d Eeschema: allow remapping if a project symbol library table exists.
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
2018-01-12 10:13:41 -05:00
Wayne Stambaugh 998d9179e9 Eeschema: fix library naming bugs in symbol rescuer and re-mapper.
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.
2018-01-10 16:04:32 -05:00
Chris Pavlina 119a0f665b DIALOG_SYMBOL_REMAP: raise after remap is complete
On macOS in particular, there is a tendency for this to fall behind
other windows where the user has no clue it's still up.
2018-01-06 14:51:53 -07:00
Wayne Stambaugh 202cd43864 Eeschema: minor remapping improvements.
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.
2018-01-03 11:25:19 -05:00
Wayne Stambaugh bf44d394c3 Eeschema: fix remapping bug on windows builds.
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.
2018-01-03 08:37:54 -05:00
Wayne Stambaugh 8f0e6469ca Minor symbol remapping fixes.
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
2017-12-22 08:03:49 -05:00
Simon Richter a9ccf1161b Fix quotes in UI messages
This replaces all single and angle bracket quotes in UI messages with
double quotes, for consistency.

Sorry to all translators.
2017-12-15 07:33:07 -05:00
Wayne Stambaugh 7ca7d9078e Eeschema: fix potential symbol cache library name collisions.
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.
2017-12-08 08:32:23 -05:00
Wayne Stambaugh 84e360dd0d Symbol library table remapping improvements.
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.
2017-11-24 11:43:42 -05:00
Maciej Suminski 759359f602 Moved path normalization functions to a separate file
Normalizing paths to environmental variables might be useful in
many places, therefore it is better to keep them accessible.
2017-11-18 20:05:08 +01:00
Wayne Stambaugh 41a9007b6d Fix assertion in symbol library remap dialog.
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
2017-11-15 12:24:51 -05:00
Wayne Stambaugh d98fc85a83 Improve assert message in symbol table remap dialog.
Fixes lp:1731655

https://bugs.launchpad.net/kicad/+bug/1731655
2017-11-13 14:17:49 -05:00
Wayne Stambaugh 610ff7485f Fix more bugs in the schematic symbol rescuer.
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.
2017-11-09 21:24:43 -05:00
Wayne Stambaugh a2e7e7aed4 Clear symbol library list from project file after remapping.
The old symbol library list save/load code does not get called in the
schematic project file configuration code.  Use the LibNamesAndPaths
static function from the PART_LIBS object.

Bump schematic file version from 3 to 4 which represents the switch to
the library table symbol linking which is incompatible with all previous
versions.

Refresh the schematic after running remapping dialog manually.
2017-11-09 18:50:23 -05:00
Wayne Stambaugh 8fd89c881d Final symbol library table changes before merge.
Remove all symbol libraries from the project file after remapping to
prevent symbols that should be loaded from the cache being loaded from
a library further up the search order.  Save the project file to clear
all of the libraries so they never get reloaded again.

Remove the symbol library management dialog and menu entries.

Rename the symbol library table dialog menu entry.

Remove all symbol libraries from default project file to prevent clashes
with the cache library.

Fix illegal symbol naming in Eagle plugin.
2017-11-09 18:50:21 -05:00
Wayne Stambaugh c1f7c1778a Revise symbol rescuer to support symbol library table.
Refactor rescue objects so that they can support derivation.

Factor out legacy rescuer code to perform legacy project rescues.

Create new symbol library table rescuer for rescuing symbol library table
based projects.

Perform the correct rescue type on project load.

Add symbol library table remapping support to the tools menu for run on
demand as applicable.

Add flag to SCH_SCREENS::UpdateSymbolLinks() to allow forcing the symbol
link updates when the library modification hash has not changed.
2017-11-09 18:50:20 -05:00
Wayne Stambaugh 36f6d4a1f4 Convert symbol library editor over to use symbol library table.
Simplify some of the library editing code.  There have been a few minor
changes in the behavior of the editor.  If the current symbol is deleted
from the library, the next symbol in the library is not loaded.  The
deleted symbol is cleared and the current symbol is empty.

Change component to symbol to align with the preferred terminology
discussed on the developer's mailing list.

Add separate update UI event for save library as to enable the menu entry
whenever a library is selected.

Change the select symbol list dialog to a single column using the LIB_ID
format LIB_NICKNAME:LIB_ITEM_NAME so that the selection can be parsed by
LIB_ID.

Add method to expand URI to LIB_TABLE_BASE.

Override wxApp::OnExceptionInMainLoop() in debug builds to make debugging
easier when an unhandled exception occurs in a wxUpdateUIEvent handler.

Change SCH_SCREENS::HasNoFullyDefinedLibIds() to return false when the
schematic has no symbols to prevent the remapping dialog from being run.

Use SCH_COMPONENT part reference when creating netlist rather than looking
up the library symbol.
2017-11-09 18:50:20 -05:00
Wayne Stambaugh 81e8d8fd89 Symbol library table remapping fixes.
Use GetPath() instead of GetFullPath() when initializing environment
variable table entries KICAD_SYMBOL_DIR and KICAD_PTEMPALTE due to
unexpected trailing path separator which was causing find libraries
by URI to fail.

Don't create a project symbol library table when there are no libraries
not found in the global symbol library table.

Don't add non-existent libraries to project symbol library table.

Clear symbol library table when loading a new schematic.

Minor remapping status message improvements.
2017-11-09 18:50:18 -05:00
Wayne Stambaugh 96c3d5ff21 Enable symbol library table remapping.
Check the if the schematic being loaded has been remapped (no symbol
library table nicknames defined) and remap accordingly.

Fix issues when resolving the library symbol links in the schematic
symbols.

Add cache library fallback when resolving symbols that cannot be
remapped.

Add remap complete message to remap dialog.

Add HasLibrary() helper to LIB_TABLE_BASE.

Fix issues when loading library symbols using symbol library table.

Add hashing function to symbol library table.

Improve the symbol panel message to warn user when cache library is
used to resolve symbol.
2017-11-09 18:50:17 -05:00
Dick Hollenbeck 19e6bde09a Rewrite class UTF8 to contain rather than extend std::string storage.
This forces the compiler class specific features rather than borrowing
from the base class's std::string.  In some cases prior to this,
wxString( std::string ) was being called rather than UTF8::operator
wxString() leading to garbled wxStrings.

Added function UTF8::wx_str() which is of great convenience also.

Implicit conversions still work as before, and hopefully more reliably.
2017-07-26 08:30:12 -04:00
Wayne Stambaugh 578f01bfd9 Fix debug build error in symbol remap dialog. 2017-04-05 08:43:05 -04:00
Wayne Stambaugh 36606ceeb7 Add symbol library table remapping dialog.
Create dialog and code to allow legacy schematic symbols to be remapped
from the old library path look up method to the new symbol library table
method by using the following steps:

  1) Create a project symbol library table containing all of the symbol
     libraries defined in the old library look up list not found in the
     global symbol library table.

  2) Map each symbol to the correct symbol in the symbol library table
     if possible.

Recreate library link to symbols so look up method can be converted to
symbol library table properly.

Add function to SCH_COMPONENT to link library symbols using the symbol
library table.
2017-04-04 18:31:28 -04:00