Commit Graph

176 Commits

Author SHA1 Message Date
Wayne Stambaugh b55eb0b5f1 Eeschema: fix assertion in LIB_PART destructor.
A new legacy symbol library plugin deletes all of the aliases from each
LIB_PART object that it owns cause an assertion in the dtor which calls
GetName() which checks for an empty alias list to prevent a segfault.
Remove the call to GetName() from the dtor trace message.

Fixes lp:1740597

https://bugs.launchpad.net/kicad/+bug/1740597
2017-12-30 19:55:11 -05:00
Wayne Stambaugh 51717aad22 Eeschema: fix segfault bug when LIB_PART has no aliases.
The GetName() method attempts to access the first LIB_ALIAS pointer in
the m_aliases member without checking if m_aliases is empty.  This
should never happen because a new LIB_PART creates a LIB_ALIAS object
in the ctor.  Some how, this is getting bypassed and causing Eeschema
to crash in the LIB_PART dtor on debug builds.  GetName() now checks
for an empty alias list to prevent a null pointer segfault.

Fixes lp:1739614

https://bugs.launchpad.net/kicad/+bug/1739614
2017-12-29 09:57:12 -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 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 0acdd9f02e Remove obsolete symbol library item load code. 2017-11-27 14:42:22 -05:00
Tomasz Włostowski 7fc1e1d53c Library Editor: component cut/copy/paste/duplicate 2017-11-21 23:18:55 +01: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 445ac50588 Keep LIB_ID and LIB_PART name/library in sync
Updates LIB_ID::LibItemName field when a part is renamed and LIB_PART
name when a new LIB_ID is set.

Similarly, LIB_ID::LibNickName field is updated when a library set, but
there is no easy way to assign library when LIB_ID::LibNickName is
modified.
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 bdc6a5950b rename plot_common.h to class_plotter.h, a better name, consistent with other class definitions. 2017-11-16 15:53:30 +01: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 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 55bc8da726 LIB_ITEMS_CONTAINER code formatting 2017-09-20 08:39:14 +02:00
Bernhard Stegmaier 0be357ec3e LIB_ITEMS_CONTAINER reimplemented using C-style array of boost::ptr_vector
Fixes: lp:1714974
* https://bugs.launchpad.net/kicad/+bug/1714974
2017-09-20 08:39:14 +02: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
Seth Hillbrand 1c617b9f56 Prevent duplicate objects during block copy in symbol library editor.
Fixes lp:1714109

https://bugs.launchpad.net/kicad/+bug/1714109
2017-08-31 12:26:39 -04:00
Maciej Suminski 352919658d Refactored LIB_PART data storage
Instead of keeping all items in a boost::ptr_vector(), LIB_ITEMs are now
stored in an integer (KICAD_T) to LIB_ITEMS map.

The map allows to quickly access a subset of items of given type.
As the items are stored per type, there is no need to call
LIB_ITEMS::sort() to assure the correct drawing order. As a result,
libraries load faster.

To retain the old interface, there is a LIB_ITEMS_LIST wrapper for
the map, allowing the developers to access the items as if it was a flat
list-like structure.
2017-08-16 16:05:22 +02:00
Oliver Walters f509ccc7cf Search component footprint text
- Added footprint text to search string for each component.
2017-07-18 08:58:03 -04:00
Simon Richter 1502e27695 Remove debug code matching on specific component names 2017-03-03 08:30:48 -05:00
Maciej Suminski 0dc88bb4cf Changed COLOR4D defines to static consts 2017-02-22 17:35:00 +01:00
Jon Evans a52250a91e Change from EDA_COLOR_T to COLOR4D globally; arbitrary color support
eeschema now supports arbitrary colors for all object types, and
pcbnew does in GAL canvas.  When switching from GAL to legacy canvas,
pcbnew will convert colors to the nearest legacy color.
2017-02-22 17:35:00 +01:00
Chris Pavlina a61be7e00e Move LIB_PART::Draw drawing options into a struct
This makes configuring the options clearer, avoiding the long list of
non-self-explanatory arguments at the small cost of requiring a few more
lines.
2017-02-19 13:40:26 -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
jean-pierre charras f15a59f0ad Component Editor and Component viewer: add option to show the electrical pin type. 2016-11-04 12:13:22 +01:00
Simon Richter b0f9864bc4 Clean up warnings from exception handlers
The exception objects caught are either not referenced at all, or only in
debug builds. This avoids the warnings for the unused variables.
2016-10-10 11:08:49 -04:00
Chris Pavlina 9547dd4e52 Fix GetBoundingBox hiding overloaded virtual 2016-09-30 22:32:24 -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
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
Maciej Suminski 9748b65a6d str[n]icmp -> str[n]casecmp 2016-08-11 14:41:06 +02:00
Simon Richter 1b2fd6a382 Replace BOOST_FOREACH with C++11 range based for. 2016-06-29 16:07:55 -04:00
Chris Pavlina c13f80bb49 Remove unneeded compile option KICAD_KEEPCASE
Libraries have been 100% case-sensitive for a while now; there is no longer a
need to keep this option around. This will change nothing except for any
stragglers still manually specifying this old option.
2016-06-10 23:15:02 -04:00
Wayne Stambaugh ce9d9afed5 Fix bug in component library editor. (fixes lp:1547299)
* Use temporary storage of new pins to prevent corruption of the library part draw items
  list when adding alternater body style pins to existing component which caused segfault.
2016-02-19 16:29:56 -05:00
Chris Pavlina ac54b7d114 libedit: fix iterator off end of vector (lp:1537946) 2016-01-25 20:52:13 -05:00
jean-pierre charras 59d02cf1a4 Minor fixes:
* fix minor coding style issues.
* remove unused member in modview_frame.
* use different frame names in ctor of modview_frame and viewlib_frame depending on the fact they are built modal or not modal (allowing identifications when calling wxFindWindowByName)
* change questionnable code in  class_libentry.cpp.
* remove unused code in class_treeproject_item.cpp
2015-12-22 12:58:26 +01:00
jean-pierre charras 0842a107fb Fix Bug #1527804 (Eeschema crashes when loading malformed libraries (mainly incorrect libs converted from Eagle) 2015-12-19 10:49:48 +01:00
Chris Pavlina 50c418a332 Eeschema: add field automatic placement feature. 2015-12-13 11:56:47 -05:00
Chris Pavlina 3921f78ac2 Eeschema: fix connection indicators for power symbol targets. 2015-07-21 10:07:52 -04:00
jean-pierre charras d4d201f0d8 Libedit: Fix an issue relative to bounding boxes of symbol items: some were calculated using the top to bottom draw Y axis, some others using the bottom to top libedit Y axis
Now all are calculated using the top to bottom draw Y axis. This is perhaps not a good idea, but at least it will be easy to change, later.
Code cleaning relative to these bounding boxes.
2015-06-18 16:56:08 +02:00
Chris Pavlina eb800d903f Hide pin and wire targets to show wire connections in Eeschema. 2015-06-07 20:07:42 -04:00
Chris Pavlina 26c320db57 Add schematic component library change rescue feature (fixes lp:1435338).
* Add code to test if any of the components in the schematic cache have been changed
  in the component libraries.
* Prompt user to accept or reject components when changes are found.
* If the user chooses to use the components in the cache, create a new library with the old
  components and add it to the beginning of the component library list so the schematic will
  not be changed.
* Create dialogs to handle user feedback and status.
2015-04-25 18:26:51 -04:00
jean-pierre charras d38c9b205f Extend max number of units per package: fix incorrect unit string for unit >= 52. Fix unit list limited to 26 in dialof edit compinent in schematic..cpp
lib_pin.cpp: in 4 functions, use an unsigned param instead of int, for  a better code.
2015-04-07 15:19:30 +02:00
jean-pierre charras 17297babe7 Eeschema: extend max number of units per package to 52 and clean code to easily extend this value upto 26x26 (but 52 is a reasonable max value).
Fix a few minor coverity warnings.
Add about_dialog typo fix from Nick Østergaard
2015-04-07 13:52:29 +02:00
Wayne Stambaugh b42e47eeed Fix a few more wxLog string formatting assertions in Eeshcema. 2015-02-28 08:12:09 -05:00
Wayne Stambaugh d8a74aa7af wxLog string arguement parsing assertion message fixes. 2015-02-27 14:12:01 -05:00
Wayne Stambaugh 8f1addc1f8 Fix serious memory leak in schematic part library manager. 2015-02-06 10:34:11 -05:00
Wayne Stambaugh 93b0a0831e Minor fixes and code cleaning.
* Check to see if image handler is already initialized to prevent warning
  on debug builds.
* Change LIB_PART destructor message output to use wxLogDebug for debugging
  on windows builds.
* Minor code cleaning and coding policy fixes.
2015-01-27 13:40:52 -05:00
jean-pierre charras 64925bfc4f Very minor fixes: add missing const return type to some GetBoundingBox() declarations. Change few functions names to better names in some places (like GetName() to GetPinName() ) 2015-01-18 18:28:14 +01:00
jean-pierre charras 9e6ed2b75f Eeschema plot: fix Bug #1391538 (eeschema PS/PDF export, objects have wrong Z-order ) 2014-11-12 11:32:02 +01:00