Commit Graph

102 Commits

Author SHA1 Message Date
Wayne Stambaugh 34ea79eddb Fix LIB_ID illegal character tests.
The '/' and ':' are reserved and cannot be used in symbol or footprint
names.  They will cause the LIB_ID parser and formatter to fail.  While
it seems like they should be legal in symbol alias names, they will
trigger a symbol rescue the next time the schematic is loaded.

Use ID_SCH as in the Eagle schematic plugin rather than ID_ALIAS to
ensure symbol names do not need rescued the next time the schematic is
opened.

Remove ID_ALIAS since the rules for alias names are the same as the
rules for symbol names.  Otherwise, allowing '/' and ':' in alias names
will force a symbol rescue on the next schematic load.

Fixes lp:1795600

https://bugs.launchpad.net/kicad/+bug/1795600
2018-10-07 09:09:27 -04:00
Jeff Young 0b39b68d37 Generate error dialog when a symbol library can't be found.
Fixes: lp:1789047
* https://bugs.launchpad.net/kicad/+bug/1789047
2018-09-17 18:01:08 +01:00
jean-pierre charras 202b35bc90 Eeschema: Fix incorrect parsing of old schematic files (version 2) for HLabels and GLabels 2018-09-03 19:51:17 +02:00
jean-pierre charras 45395f9b59 Eeschema: fix a bug when reading .dcm files (the eol char was not stripped, giving broken fields values)
The parser also now skip empty lines.

This bug created unreadable saved .dcm files and .sch files after adding a new symbol.

Fixes: lp:1786141
https://bugs.launchpad.net/kicad/+bug/1786141
2018-08-09 09:09:36 +02:00
jean-pierre charras 21195a751d Eeschema: sch_legacy_plugin.cpp: fix incorrect parsing of pin position.
The issue is in:
wxPoint( parseInt( aReader, line, &line ), parseInt( aReader, line, &line ) )
that calls parseInt() twice, but parseInt changes parameters at each call.
(Does not return the same value at each call).
However, due to some side effect or compil optimization, the value returned is incorrect.
It can be dependent of the compiler, and optimization level.

This kind of code must be avoided.
2018-08-08 10:15:44 +02:00
Jeff Young 20bf6827e7 Minor performance enhancements to symbol loading. 2018-08-07 17:01:44 +01:00
Jeff Young cb61525394 Handle separate parsing rules for ID_SCH and ID_PCB.
This removes the existing constructors so that all parsing must
be explicit and callers are made aware that they need to think
about illegal characters, malformed ids, etc.

Fixes: lp:1783474
* https://bugs.launchpad.net/kicad/+bug/1783474
2018-07-26 15:43:53 +01:00
Jeff Young f79ca271e3 Replace missing #ifndef's.
We only process symlinks on POSIX kernels (Linux and OSX).

Fixes: lp:1548798
* https://bugs.launchpad.net/kicad/+bug/1548798
2018-07-24 09:05:39 +01:00
Jeff Young bc47f085df Support symlinks for .pretty and .lib files.
Fixes: lp:1548798
* https://bugs.launchpad.net/kicad/+bug/1548798
2018-07-23 23:50:13 +01:00
Maciej Suminski 8ba694e6fd eeschema: fix alias names in .dcm files
Fixes: lp:1781761
* https://bugs.launchpad.net/kicad/+bug/1781761
2018-07-17 14:27:41 +02:00
Seth Hillbrand d30ac2967a eeschema: Rescue symbols with illegal chars
When parsing component names, we need to account for the possibility of
illegal characters (e.g. "/", ":") in the names from v4 libraries.  They
are fixed internally by the cache parser but if we don't fix them
in the rescue routine, the symbol won't match it's cache name.

This standardizes all schematic illegal character routines into LIB_ID

Fixes: lp:1774774
* https://bugs.launchpad.net/kicad/+bug/1774774
2018-06-27 14:15:30 -07:00
jean-pierre charras 509793a5b4 Symbol editor: Inversion sign ("~") incorectly ùmanaged in graphic texts.
It was always replaced with space in a graphic text, but it should happens
only in non quoted texts
Now graphic texts containing ' ' or '~' or '"' are always quoted
(work fine with 4.0 version)

Fixes: lp:1771105
https://bugs.launchpad.net/kicad/+bug/1771105
2018-05-14 17:49:30 +02:00
Maciej Suminski 194c57133c SCH_LEGACY_PLUGIN::loadHierarchy() uses a stack to maintain sheet paths
Path keeping stack copes well with paths pointing outside the project
directory (e.g. "../path"). The so far used wxFileName::GetDirCount() and
wxFileName::RemoveLastDir() remove too many directories, as ".." is also
counted as a directory.

Fixes: lp:1769746
* https://bugs.launchpad.net/kicad/+bug/1769746
2018-05-09 11:30:23 +02:00
Maciej Suminski 26ee673a6b Validate symbol alias names read from .dcm files
Fixes: lp:1766551
* https://bugs.launchpad.net/kicad/+bug/1766551
2018-04-25 10:15:44 +02:00
Wayne Stambaugh 41c1657eb6 Eeschema: fix bug in sheet path loading logic.
When a relative sheet path was not in the project path or a subfolder
within the project path, the schematic path would be empty.  Set the
base path to the project path when the schematic path is no within
the project path hierarchy.
2018-04-22 09:47:54 -04:00
jean-pierre charras 3179e40b57 Fix compil warning (perhaps 32 bit build specific) 2018-04-18 20:41:18 +02:00
Maciej Suminski 41ac458e79 Fixed SCH_LEGACY_PLUGIN_CACHE::saveBezier() 2018-04-18 09:36:22 +02:00
jean-pierre charras 4a254ee7f3 Eeschema, schematic file save issue: fix missing switch to C locale before saving files
The scale factor of bitmap images was incorrectly saved in countries using a comma as floating point separator

Fixes: lp:1763726
https://bugs.launchpad.net/kicad/+bug/1763726
2018-04-14 16:59:17 +02:00
Wayne Stambaugh 81843c37a4 Organize trace debugging code for ease of maintenance. 2018-04-13 09:59:01 -04:00
Carsten Schoenert a11714b1a4 fix misspelled 'an other' -> 'another' 2018-04-08 13:24:37 -04:00
Jeff Young 99e659ff54 Coverity fixes. 2018-03-21 23:11:55 +00:00
Maciej Suminski b3601bd540 SCH_LEGACY_PLUGIN_CACHE: Rename conflicting aliases 2018-03-08 09:48:41 +01:00
Maciej Suminski d74bb131e1 SCH_LEGACY_PLUGIN_CACHE: Do not add the root alias for loaded symbols
The root alias is added in the loop iterating through all aliases.
2018-03-08 09:48:41 +01:00
Seth Hillbrand 886159347a Eeschema: Verify file content exists
Fixes: lp:1752724
* https://bugs.launchpad.net/kicad/+bug/1752724
2018-03-01 14:32:59 -08:00
Wayne Stambaugh b8c00a0d07 Fix hierarchical schematic file sheet path bug.
Sheet file name paths were not being saved and restored properly under
certain conditions when walking the sheet hierarchy causing schematic
load errors.

Changed debugging output to use wxLogTrace left over from last fix.

Fixes lp:1748401

https://bugs.launchpad.net/kicad/+bug/1748401
2018-02-14 13:45:41 -05:00
Wayne Stambaugh 00749af914 Eeschema: fix using subpaths in sheets.
Fix double path name issue when using sheet file name paths that differ
from the project path.

This fix also allows for nesting schematics in subfolder in multiple
root paths.

Fixes lp:1745109
https://bugs.launchpad.net/bugs/1745109

Fixes lp:1735982
https://bugs.launchpad.net/bugs/1735982
2018-02-05 17:07:33 -05:00
Jeff Young 99ad5cf394 More performance optimizations for symbol libraries
1) don't call UI-level LIB_PIN routines when reading library --
not only are they a performance hit, they set the modified flag
too
2) limit progress dialog updating to 15 times a second (this
had crept back up to 31% of the time spent loading libraries)

Fixes: lp:1734773
* https://bugs.launchpad.net/kicad/+bug/1734773
2018-01-30 10:31:51 -05: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
jean-pierre charras 4c5bd01887 Rename a few files 2018-01-28 22:02:31 +01:00
Wayne Stambaugh 2b460bc1ff Eeschema: improve alias load performance.
Don't use wxFileName == operator when comparing cache file name.  There
is a lot of overhead the wxFileName == operator that is not necessary
so just do a comparison with the original string used to create the
cache.
2018-01-24 19:37:07 -05:00
Maciej Suminski 6e65049a56 Do not modify LIB_ID in LIB_PART::SetLib()
This commit is a partial revert of aa81f5b9 & 445ac505. LIB_ID should
not be modified when a library is assigned to its part, as the library
nickname cannot be evaluated during the assignment and might be
different than its filename.
2018-01-10 08:52:17 +01: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
jean-pierre charras dee93e5eeb Minor fix: rename LIB_PART::m_dateModified to LIB_PART::LIB_PART::m_dateLastEdition
and use m_dateLastEdition type for LIB_PART::m_dateLastEdition
2017-12-14 17:27:40 +01:00
Wayne Stambaugh 8af9aa7574 Eeschema: allow for partial schematic loading.
With the implementation of the legacy schematic plugin, any I/O error
when parsing the schematics would prevent the entire schematic from
being loaded.  This change restores (somewhat) the previous behavior
where as long as the root schematic is loaded properly, then all of
the remaining sub-sheet will attempt to load.

Add GetError() method the SCH_PLUGIN object to allow for partial
schematic loading.

Check the error message contents when no exception was caught to warn
the user of any accumulated errors.

Fixes lp:1690644

https://bugs.launchpad.net/kicad/+bug/1690644
2017-12-06 19:11:09 -05:00
Wayne Stambaugh 694ad93385 Move LIB_PART save code to legacy schematic plugin.
This is the last of the object save/load code that was not moved into
the SCH_LEGACY_PLUGIN object.  All schematic and library I/O is now
performed in the SCH_LEGACY_PLUGIN object and as been removed from the
schematic and library objects.

The old single symbol file format has been replaced with the normal
symbol library file format since there was no difference between them
except the SYMBOL token.  The SYMBOL token was no longer being read
since the introduction of the SCH_LEGACY_PLUGIN symbol library loader.

Update the Doxygen comments in all of the modified files.
2017-12-01 11:49:44 -05:00
Wayne Stambaugh b82bd8e0c5 Fix symbol names with illegal library ID characters.
Change the legacy schematic plugin to preserve illegal LIB_ID characters
when load schematics prior to version 4.

Check for illegal LIB_ID symbol names during project rescue.  Rename and
rescue any symbols with illegal LIB_ID names.

Add static methods to LIB_ID object for testing for and fixing names
with illegal characters so there is uniform code for doing so.

Update the Eagle plugin symbol loader to fix symbol names using the new
LIB_ID fix illegal names method.

Fixes lp:1732236

https://bugs.launchpad.net/kicad/+bug/1732236
2017-11-23 10:52:55 -05:00
Maciej Suminski aa81f5b98d Removed LIB_PART::SetLibId()
To avoid potential incoherency, LIB_ID is defined by setting the part
name and library.
2017-11-21 23:18:55 +01:00
Maciej Suminski 4c4f5ae962 Unified way of setting LIB_PART name
LIB_PART name is stored in three places that might be changed
independently:
- the first LIB_ALIAS in m_aliases
- LIB_FIELD with VALUE ID
- m_name wxString field

This is potentially leads to an incoherent LIB_PART state. To prevent
this, all fields are changed using only one method: LIB_PART::SetName().

LIB_PART::m_name has been removed as the same information is available
in two other variables.
2017-11-21 23:18:55 +01:00
Julius Schmidt 375a4e28d6 fix MANDATORY_FIELDS comparisons (need to exclude -1) 2017-11-20 08:48:01 +01:00
jean-pierre charras 0517f78085 eeschema: store line style using a more readable format 2017-11-15 14:08:27 +01:00
Seth Hillbrand b576189a00 Eeschema: Adding line styling options
NEW: Adds support in eeschema for changing the default line style,
width and color on a case-by-case basis.

CHANGED: "Wire" lines now optionally include data on the line style,
width and color if they differ from the default.

Fixes: lp:594059
* https://bugs.launchpad.net/kicad/+bug/594059

Fixes: lp:1405026
* https://bugs.launchpad.net/kicad/+bug/1405026
2017-11-15 08:10:51 +01: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 0cf2df51c6 Convert symbol library viewer over to symbol library table.
Remove all instances of PART_LIBS and replace them with SYMBOL_LIB_TABLE
except for the CMP_TREE_MODEL_ADAPTER which requires updating as well.

Return the selected symbol using the LIB_NICKNAME:SYMBOL_NAME format when
viewer is launched as modal.

Add code to SYMBOL_LIB_TABLE object to allow enumerating symbol library
power symbols only.

Add a non-const version of LIB_TABLE::findRow().

Remove redundant information from Doxygen comments.
2017-11-09 18:50:17 -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
Russell Oliver 4e69acbb49 Eeschema: Add CheckHeader function to SCH_PLUGIN and cycle through plugins when loading files. 2017-10-20 08:38:38 +02:00
Oliver Walters 948dfe88ce Added option to not test other pins when setting pin parameters
- On loading from file, other pins are not LINKED and thus can be ignored
- 90% reduction in library load time when launching eeschema
2017-09-28 13:10:08 -04:00
Wayne Stambaugh cb764d73c5 Minor trace logging improvements.
Make all trace environment variable strings upper case and prefix with
KICAD_TRACE_ for consistency.

Add Doxygen group for the trace environment variable strings.
2017-09-21 08:58:41 -04:00
Maciej Suminski 85be485c34 Enable long names for pin numbers and pads
- pad names are stored as wxString instead of a char[4] & integer union
- removed pad name to string conversion functions
- fixed pad & pin properties dialog restrictions regarding the name
length
2017-09-19 18:19:49 +02:00
jean-pierre charras 8dacd0582a Make a few internal error strings not translatable 2017-08-04 20:43:31 +02:00