Commit Graph

35 Commits

Author SHA1 Message Date
Wayne Stambaugh 175d68fbb1 Fix schematic cache library broken by schematic I/O plugin changes.
Check for existence of cache library when before attempting to rebuild
the cache.  Create a new cache library object if no cache library was
loaded.

Add missing buffering and cache properties to LIB_PART::FindAlias() to
prevent the plugin from reloading the cache library that may not exist.

Add method to find library by full path and file name.

Revert the check for a symbol in the cache library remove from last
patch.

Add checks for plugin cache file name validity and existence of a the
file before attempting to verify the file modification time to prevent
wxWidgets from raising an assertion in debug builds.

Clear modified flag when saving buffered and/or cached library.
2017-02-13 13:47:46 -05:00
Wayne Stambaugh d5bf465dc6 Fix library save bug in legacy schematic I/O plugin.
Add the ability to save empty symbol library file for caching and empty
schematic.

Remove check for existing symbol in cache populating routine.  Just perform
a complete rebuild of the cache library and overwrite the existing one.

Fixes lp:1663871

https://bugs.launchpad.net/kicad/+bug/1663871
2017-02-12 18:40:53 -05:00
Wayne Stambaugh e8cf4f0724 Fix bug in legacy schematic I/O plugin.
Move adding LIB_PART to library until the part is fully parse.  The problem
was unique_ptr was cleaning up the part when an exception was thrown during
parsing causing a double free when the cache was deleted.

Add missing try/catch block when loading the cache library during an append
schematic operation.

Fixes lp:1663869

https://bugs.launchpad.net/kicad/+bug/1663869
2017-02-11 20:19:52 -05:00
Wayne Stambaugh eb06b35852 Eeschema: fix schematic I/O plugin symbol name issue.
LIB_ID was changing the symbol name due to the parser dropping everything
past the first '/' character which is interpreted by LIB_ID as the item
version.  Add flag to ignore this in LIB_ID::SetLibItemName() and add a
new ctor so the library nickname, item name, and revision can be set as
required to prevent the standard LIB_ID parsing.

Fix a few places where PART_LIBS functions FindLibraryAlias() and
FindLibPar() were translating wxString symbol names to LIB_IDs where the
LIB_ID parser was truncating the symbol name.
2017-02-11 13:44:17 -05:00
Wayne Stambaugh 7ccdca5ced Use library ID to store library symbol information in the schematic symbol.
Use LIB_ID instead of wxString for storing the library symbol information
in the schematic symbol in preparation for the upcoming symbol library table
implementation.

Change the FindLibAlias and FindLibPart functions in the PART_LIBS object
instead of wxString.  Please note that only the library ID name is used to
search the list of libraries.  The library nickname is ignored.  Once the
symbol library table is implemented and full LIB_IDs are defined, the
library search code will no longer be used and will only be kept to load
older schematics that have not been converted.

Move SCH_LEGACY_PLUGIN_CACHE definition so that the legacy plugin knows
how to properly delete the cache object.
2017-02-10 08:36:59 -05:00
Wayne Stambaugh fda677eecc Prevent schematic I/O plugin from setting the library cache to null.
Don't call init() when performing library functions as it was always
setting the m_cache variable to null which cause the library to be
reloaded every time a library command was performed as well as a
memory leak.

Delete cache object when the plugin is destroyed.
2017-02-10 08:36:58 -05:00
Wayne Stambaugh 73bbc35c3e Make the schematic I/O plugin the only option.
Add SCH_PLUGIN object to PART_LIB object.

Convert all PART_LIB I/O to use SCH_PLUGIN.

Remove library caching from PART_LIB and use caching provided by SCH_PLUGIN.

Add support to use PROPERTIES for buffering and document file write control
instead of adding code the SCH_PLUGIN object in the SCH_LEGACY_PLUGIN that
will not be required when the new file formats are implemented.

Add buffering to SCH_LEGACY_PLUGIN to prevent cache from writing file on
every change to library.  This is to prevent the cache library from being
written every time a new symbol is added.

Add option to not save library document file when saving library.  This is
primarily used by the cache library write code.

Move symbol library write code out of LIB_PART and into SCH_LEGACY_PLUGIN.

Add exception handling where LIB_PART caught the exception and returned
an error status.

Remove KICAD_SCH_IO_MANAGER build option as it is no longer optional.
2017-02-10 08:36:57 -05:00
Dick Hollenbeck 0c459ced97 EDA_TEXT object refactor.
Make all EDA_TEXT data private and rename accessors to avoid function
name collisions in derived classes.

Overload EDA_TEXT's SetTextAngle() and SetEffects() in TEXTE_PCB.

Add support for preserving Reference text position, size, orientation
during a netlist import into a BOARD, as well as the one off footprint
update dialog.
2017-01-25 08:03:32 -05:00
jean-pierre charras dec2d6e8cc Fix a few Coverity warnings. A bit of clean code in export_vrml.cpp. 2016-12-30 12:40:05 +01:00
jean-pierre charras a5178c70db sch legacy plugin: fix a compatibility issue with old schematic files 2016-12-29 19:38:48 +01:00
jean-pierre charras 308dc0e46a sch legacy plugin: fix compatibility with old and very old library and symbol files 2016-11-21 09:57:07 +01:00
jean-pierre charras 430a09a5a0 sch legacy plugin: fix compatibility issues with old library 2.2 version 2016-11-20 15:19:06 +01:00
Jean-Noel Avila 58af5bc3a4 Eeschema: Fix off-by-one in saving bitmaps 2016-11-09 09:46:35 +01:00
jean-pierre charras 3bb3f31c7a schematic legacy plugin: fix compatibility with old files, and with doc. 2016-11-02 19:47:38 +01:00
Wayne Stambaugh 4ee0b3827e Eeschema: more schematic I/O plugin prep work.
Add code to schematic I/O plugin for updating library modification
hashes.

Remove unused RemoveLibrary() method from PART_LIBS object.

Purge wxT() macros from modified files.
2016-10-25 18:45:33 -04:00
Michele Renda 64bb1ca924 Fix infinite loop when schema file contains a comment or an empty line 2016-10-17 08:35:20 -04:00
Wayne Stambaugh 213ceaa280 Eeschema: add delete symbol library code to schematic legacy plugin. 2016-10-09 08:29:44 -04:00
Wayne Stambaugh 4f0c2ad083 Eeschema: add create symbol library to legacy schematic I/O plugin. 2016-10-07 09:18:15 -04:00
Wayne Stambaugh 9d258ba921 Eeschema: fix parsing bug in legacy schematic I/O plugin.
Yet another quirk parsing LIB_TEXT object was found.  Apparently even in
library version 2.3, the text properties can be dropped so a check for
end of line was added to prevent the parser from choking on a valid text
line.

Fixes lp:1628160

https://bugs.launchpad.net/kicad/+bug/1628160
2016-09-30 10:01:50 -04:00
Wayne Stambaugh aa5e979b8a Eeschema: add delete symbol method to schematic I/O plugin. 2016-09-29 18:34:31 -04:00
Wayne Stambaugh 58abb29827 Eeschema: add delete alias from library to I/O manager.
Modify base I/O manager class to delete alias from a symbol library.

Add delete alias from legacy symbol library plugin.
2016-09-23 13:29:17 -04:00
Wayne Stambaugh 679eef1c43 Eeschema: fix build errors and warnings.
Fix build error when KICAD_USE_SCH_IO_MANAGER=OFF due to const issues with
LIB_PART ctor.

Fix unused variable build warning in legacy schematic plugin.
2016-09-17 20:18:03 -04:00
Wayne Stambaugh 3ae240ea46 Eeschema: add save code to legacy symbol library plugin.
Make LIB_PART copy constructor take a const LIB_PART reference.

Add SaveSymbol to legacy symbol library plugin.

Add removeAlias to legacy symbol library cache.

Add AddSymbol to legacy symbol library cache.
2016-09-17 14:45:01 -04:00
jp-charras 1b62fdae92 Fixes: lp:1623060 (EEschema page orientation is not retrieved when compiled with KICAD_USE_SCH_IO_MANAGER=ON)
https://bugs.launchpad.net/kicad/+bug/1623060
2016-09-13 19:48:43 +02:00
Wayne Stambaugh 24f6c4be21 Eeschema: add code to plugin manager to load a symbol from a library. 2016-09-03 14:28:17 -04:00
jean-pierre charras ea59ce40e1 sch_legacy_plugin.cpp: fix compil warnings about incorrect return type. 2016-08-19 17:31:46 +02:00
Wayne Stambaugh bcfce68daa Fix debug build warning due to improper debug macro. 2016-08-19 08:53:06 -04:00
Wayne Stambaugh eaa7f3f114 Eeschema: implement schematic I/O plugin symbol library parser.
* Write SCH_LEGACY_PLUGIN_CACHE object for handling the legacy symbol library
  file format.

* Write legacy symbol library file parser.

* Write code to transfer cache to PART_LIB object so existing library save
  code can be used for round trip testing.  This is temporary until Eeschema
  is updated to use the plugin for library management rather than PART_LIB.

* Add LIB_XXXX object helper functions where there was no way to set the member
  variables of an object.

* Give the cache object friend status to some object where there are incredibly
  byzantine ways of setting text in LIB_XXXX objects.
2016-08-18 19:23:10 -04:00
Simon Richter bfb6e0bbb2 Convert remaining occurences of stri[n]cmp to str[n]casecmp.
This also reverses the substitution logic if strcasecmp is missing (config.h.cmake)
2016-08-16 10:27:09 +02:00
jean-pierre charras 3ca757b653 Eeschema, new legay plugin reader: ensure component flags (mainly used in edition) are cleared after loading from file. 2016-08-01 09:11:31 +02:00
Wayne Stambaugh 9c5e872a4f Eeschema: fix complex hierarchy file bug. (fixes lp:1605872)
* Add project path to sheet file name and extension so the test to see if a
  file is loaded by another sheet works correctly.
2016-07-24 20:52:40 -04:00
Wayne Stambaugh 98ad5096b0 Eeschema: add saving schematic files to schematic plugin.
* Add SCH_PLUGIN::Save() for current file format and code for saving all
  SCH_XXX objects.

* Add function to SCH_FIELD to get the position of the field in the component
  not the position added to the component position which is what GetPosition()
  does.  This was required because saving the component field expects position
  of the field sans the position of the component.

* Remove public members from BITMAP_BASE object and fix all associated
  code.

* Fix the never ending coding policy violations found making these changes.
2016-07-11 15:48:46 -04:00
Wayne Stambaugh 3bdca9a821 Eeschema: schematic I/O manager bug fixes.
* Create a new dummy root sheet and screen when the schematic fails to load
  which was causing Eeschema to crash.

* Remove conversion from UTF8 to wxString left over from a previous change
  which hopefully will fix an OSX build error.

* Fix parsing of text objects to handle version 1 schematic files.

* Fix parsing of component fields to handle version 1 schematic files.

* Don't throw a parse error when a version 1 schematic file doesn't end with
  $EndSCHEMATC.
2016-07-07 09:09:32 -04:00
Wayne Stambaugh 61e886e956 Eeschema: fix bug in release builds.
* Change debug message macro from wxASSERT to wxCHECK so that the primary
  object token name gets called instead of compiled away on release builds.
2016-07-06 09:52:47 -04:00
Wayne Stambaugh 4ed346ea64 Eeschema: initial schematic I/O plugin.
* Factor out PROPERTIES object from the PCB plugin code and move it into
  common so it can be used by both the Pcbnew and Eeschema plugins.

* Add schematic I/O plugin manager for loading and saving schematic and
  component library files.

* Add initial attempt at a parser for current schematic file format.  This
  parser will be infinitely more strict than the current parser which is very
  forgiving in what it parses.

* Make minor changes to the base bitmap class to support the new parser.

* Add find root sheet support to sheet object to allow fetching the root
  sheet from any sheet in the stack.
2016-07-06 05:22:56 -04:00