Commit Graph

113 Commits

Author SHA1 Message Date
jean-pierre charras 2758acfd42 Fix compatibility with some old V4 schematic files.
From master branch, commit #bfe59581
2021-12-01 13:45:05 +01:00
Wayne Stambaugh f61c692929 Eeschema: fix partial schematic load bug in the legacy plugin.
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.

(cherry picked from commit 1a8082c6d6)
2020-05-11 16:45:11 -04:00
Wayne Stambaugh 69b5d24f28 Eeschema: do not save legacy symbol libraries in schematic file.
Fixes lp:1843473

https://bugs.launchpad.net/kicad/+bug/1843473
(cherry picked from commit 7cf42bb308)
2019-09-18 14:24:20 -04:00
Wayne Stambaugh e07ef3be9c Minor schematic formatter fix.
Apparently at some point in KiCad's development, a '~' character was
prefixed to the symbol name to indicate that it was not visible.  The
visibility state is now saved in the name field so remove the prefix.
The parser was kept unchanged.

Fixes lp:1632048

https://bugs.launchpad.net/kicad/+bug/1632048

(cherry picked from commit ee14da3093)
2019-04-04 10:50:23 -04:00
jean-pierre charras b154c9a5c4 Eeschema: Force time stamp to 32 bits unsigned values, and make it
tolerant to files using 64 bits values. define timestamp_t as uint32_t.

This fix is adapted from master, commit 175a2bc0b (bug fix lp:1821476)
2019-03-27 13:17:54 +01:00
Jon Evans 5f9fa05e21 Fix loading of components with convert parameter set to zero
(cherry picked from commit ab74445df4)
2019-03-23 18:58:17 -04:00
Seth Hillbrand 72c885797e Eeschema: prevent schematic images with bad scales
Prevent obvious scale issues (0.0, nan, etc) from corrupting display of
schematic images.  In these cases, we reset the scale value to 1.0 and
allow the user to input the appropriate value when editing the
schematic.

Fixes: lp:1811066
* https://bugs.launchpad.net/kicad/+bug/1811066
2019-01-15 07:42:22 -08:00
jean-pierre charras e50d9df76a Eeschema: fix incorrect parsing of line color (r v b values).
Only the R and V were read, the parsing was stopping before reading the B value.
2018-12-09 17:59:24 +01:00
Wayne Stambaugh b8de4e73bf Eeschema: fix schematic symbol parsing bug.
Schematic symbol library link names are unquoted strings that can
contain non-ascii characters which breaks the parser.  Converting
the line to uft-8 before breaking the string into tokens resolves
the issue.
2018-12-06 12:44:13 -05:00
Wayne Stambaugh 742961119d Eeschema: fix library symbol pin definition parsing bug.
Pin names are unquoted strings that can contain non-ascii characters
which breaks the parser.  Converting the line to uft-8 before breaking
the string into tokens resolves the issue.
2018-12-06 11:47:20 -05:00
Wayne Stambaugh a61a51f26e Eeschema: fix UTF8 character handling bug in legacy parser.
Iterating over unquoted strings as ASCII8 fails when ' ' character is
not the LSB of a UTF8 string with wide characters.  Change parsing method
for unquoted strings to convert the entire line as UTF8 and then use
wxStringTokenizer to break the line into tokens at the ' ' characters.

Fixes lp:1806206

https://bugs.launchpad.net/kicad/+bug/1806206
2018-12-05 13:54:51 -05:00
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