Commit Graph

554 Commits

Author SHA1 Message Date
Wayne Stambaugh 590a101a88 Eeschema: fix update schematic symbol library link bugs. 2020-05-05 18:06:43 -04:00
Wayne Stambaugh 9c99286385 Fix a few Coverity warnings. 2020-05-05 16:42:59 -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
Jeff Young 5bed201a23 Don't collect connected labels on a paste.
Fixes https://gitlab.com/kicad/code/kicad/issues/4311
2020-05-03 21:47:53 +01:00
Jeff Young 199bb2ffb0 Add hittesting for worksheets in Pcbnew and Eeschema.
Fixes https://gitlab.com/kicad/code/kicad/issues/4282
2020-05-03 00:07:38 +01:00
Wayne Stambaugh fa57c8a570 Eeschema: fix sheet bug in schematic editor drawing tool.
SCH_SHEET objects can only have another SCH_SHEET object as a parent
or nullptr for the root sheet so overload EDA_ITEM::SetParent() to
prevent the parent from being set to another type of object and add
some checks to the root sheet code just in case someone gets clever
and attempts to bypass the overloaded SetParent() call.
2020-04-26 14:27:51 -04:00
Jeff Young 1535c83b88 Lay some groundwork for adding distances to DRC errors.
modified:   eeschema/lib_rectangle.cpp
2020-04-24 14:46:22 +01:00
Jeff Young 7308099852 Add an icon and put Schematic Setup in the toolbar. 2020-04-24 14:46:22 +01:00
Ian McInerney facf40d3ce libedit: Add drag to move behavior
ADDED: Drag to move behavior in the symbol editor

Fixes https://gitlab.com/kicad/code/kicad/issues/1904
2020-04-23 23:58:33 +01:00
Jeff Young f113370e1e Edit worksheet properties when no other selection is available.
Fixes https://gitlab.com/kicad/code/kicad/issues/4044
2020-04-21 21:17:59 +01:00
Jeff Young a286cb5a8f Keep labels on dragged wires.
Fixes https://gitlab.com/kicad/code/kicad/issues/2107
2020-04-19 18:24:39 +01:00
Jeff Young 2b6089240a Change super/subscript syntax to ^{foo} and _{foo}. 2020-04-18 21:04:41 +01:00
Jeff Young 42cd604c3c Expose Show Hidden Fields to GUI.
Fixes https://gitlab.com/kicad/code/kicad/issues/2010
2020-04-18 16:36:51 +01:00
Jeff Young d7d1cb6f78 A bunch of fixes to Eeschema Find/Replace. 2020-04-18 14:43:08 +01:00
Jeff Young 9c8941e040 Remove a bunch of globals. 2020-04-16 17:34:46 +01:00
Jeff Young 122b1ddaae Unwrap an unnecessary layer now that we have new config stuff. 2020-04-13 20:58:12 +01:00
Jeff Young c82679a6f2 Fix crash bug when highlighting no net (found by Coverity). 2020-04-12 11:19:44 +01:00
Jeff Young 292a9fadd9 Allow a click in the value field when searching for power nodes.
Fixes https://gitlab.com/kicad/code/kicad/issues/4180
2020-04-11 23:51:00 +01:00
Jeff Young c4994eee7b Fix a pair of bugs in the new highlight net logic.
Fixes https://gitlab.com/kicad/code/kicad/issues/4180
2020-04-11 13:02:18 +01:00
Jeff Young 962aa73e12 Improve EE_COLLECTOR to not miss children of sheets or symbols.
Also implements pin highlighting and special cases for power symbols.

Fixes https://gitlab.com/kicad/code/kicad/issues/4180
2020-04-10 14:09:26 +01:00
jean-pierre charras cb7263d017 Eeschema: fix ERC dialog not shown after a double click, when recalled by tool ERC.
(the dialog was reactivated by calling Raise(), but this is not enough: Show()
must be called also, at least on Windows).
Fix also a minor wxWidgets alert in ERC dialog.

Fixes #4171
https://gitlab.com/kicad/code/kicad/issues/4171
2020-04-08 10:03:51 +02:00
Jeff Young 8eb15fe911 Tidy up some Coverity issues. 2020-04-07 17:29:58 +01:00
jean-pierre charras 1027c2fb8d Eeschema: when placing a symbol, and after placing others instances of the symbol
deselect the previously placed items.
Otherwise, the changes (rotation, mirroring...) made during placing the current symbol
are applied to other previously placed items.
This is obviously not what is wanted, and creates crashes in Eeschema.

Fixes #4163
https://gitlab.com/kicad/code/kicad/issues/4163
2020-04-06 13:00:58 +02:00
Jeff Young cc9ac37a0e Add text variable support to envVar processing. 2020-04-05 20:52:26 +01:00
Jeff Young 591428b0d9 Remove some problematic global variables.
Fixes https://gitlab.com/kicad/code/kicad/issues/4121
2020-04-05 16:17:04 +01:00
Jeff Young 20c00cbb21 Finish off "busses" -> "buses".
Fixes https://gitlab.com/kicad/code/kicad/issues/4144
2020-04-02 18:27:05 +01:00
jean-pierre charras e811101567 fix a few Coverity warnings. 2020-04-01 09:34:44 +02:00
Jeff Young 132d4d3ffa Clean up compiler warning. 2020-03-30 14:15:59 +01:00
Jeff Young 4990d1e7b2 Variable substitution framework.
This implements editing of variables and moving SCH_FIELDs,
TEXTE_MODULEs, TEXTE_PCB and worksheet items over to the new
framework.
2020-03-30 14:15:59 +01:00
Jeff Young 5134856f18 Rationalise 3D settings data-structure.
Move the camera out to its own so that everything else is board-
related, and then rename BOARD_ADAPTER.

At some point the flags should probably be moved out too, and they
can have the EDA_3D_SETTINGS name.
2020-03-28 16:09:40 +00:00
jean-pierre charras 615deb40f3 Eeschema: move, mirror and rotate block: fix some issues.
Fixes #4111
https://gitlab.com/kicad/code/kicad/issues/4111
2020-03-28 13:17:59 +01:00
Jeff Young ba36fc0009 Fix some Coverity issues. 2020-03-25 14:38:43 +00:00
Jeff Young d69ebfae49 Push tool framework base down into TOOL_HOLDER.
This allows us to use it outside of EDA_BASE_FRAMEs (in this case, in
PANEL_PREVIEW_3D.)
2020-03-24 19:00:25 +00:00
Alexander cf25975876 EEschema: Fix back annotation
Repairs back annotation after some schematic code modifications
2020-03-24 10:53:00 +00:00
Jeff Young 66382db7dd Add some defensive code for selection anomalies.
Fixes https://gitlab.com/kicad/code/kicad/issues/4021
2020-03-21 20:55:50 +00:00
Jeff Young 204f2cd580 Reference -> reference designator.
Fixes https://gitlab.com/kicad/code/kicad/issues/4012
2020-03-17 16:09:25 +00:00
Jeff Young cee973dc04 Move ERC error reporting over to the new framework.
Fixes https://gitlab.com/kicad/code/kicad/issues/1989
2020-03-16 11:06:15 +00:00
Jeff Young 085d80e3f3 Remove duplicated settings from preferences.
These have now moved to project-specific settings.
2020-03-13 17:28:53 +00:00
Jeff Young dc9882c3b9 Fix a few bugs with Sheet field dragging and rotating.
Fixes https://gitlab.com/kicad/code/kicad/issues/4046
2020-03-12 13:57:29 +00:00
Jeff Young 437f888c25 Schematic Setup dialog.
Includes:
- moving some of the project settings from the Preferences dialog
- ERC severites
- project-specific field-name templates

Fixes https://gitlab.com/kicad/code/kicad/issues/2145
2020-03-10 18:54:17 +00:00
Jeff Young 535033c5c9 Enable editing of sheet fields. 2020-03-07 18:52:30 +00:00
Jeff Young fe3e0307d8 Move sheet name and filename to SCH_FIELD architecture.
Only internal storage architecture has changed (so far).
2020-03-06 16:23:44 +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 20fde2c16f eeschema: Fix find from RTree change
The RTree doesn't keep pins and fields in the tree, so we need to search
for them differently.

Fixes #3979 | https://gitlab.com/kicad/code/kicad/issues/3979
2020-03-03 09:35:12 -08:00
Simon Richter 866aac9737 Clean up a few unused names of caught exceptions 2020-03-01 00:33:45 +00:00
Jeff Young 3f31d48b5e Use a more friendly method of ensuring unique sheet names.
Also fixes a bug where we were failing to respect the
forceKeepAnnotations flag when processing content nested in
a sheet.

Fixes https://gitlab.com/kicad/code/kicad/issues/3681
2020-02-29 00:07:57 +00:00
Ian McInerney d5ceb8252e Clean up some warnings 2020-02-28 00:06:52 +00:00
Seth Hillbrand 245b778454 libedit: Fix speed of lib check
The symbol check output the HTML message for each item.  This is _very_
slow and can lock the system reponsiveness.  Changing to a queue/flush
method is much faster
2020-02-27 15:06:48 -08:00
Jeff Young c7ec110fba Only center focused items when they're not visible.
This includes outside the window and behind an occluding dialog.
This keeps the view from jumping around when focusing on nearby
objects.
2020-02-24 23:19:17 +00:00
Jeff Young c68b554c8e Promote PathsAndReferences from wxArrayString to first-class-citizen.
Keeping the data in an un-serialized format greatly simplifies usage,
and should make it more robust.
2020-02-24 23:19:17 +00:00
Jon Evans 41f59ab873 Avoid intermittent compiler crash in GCC 7.4
Somehow the previous way this statement was written can cause an
internal compiler crash on gcc 7.4.0-1ubuntu1~18.04.1 sometimes.
2020-02-22 21:26:48 -05:00
Jeff Young ea025a35e5 Change KUUID to KIID. 2020-02-21 22:20:42 +00:00
Jon Evans e8e3b4f11e Rename UUID to KUUID to fix MSVC build
Also add another newly-required boost flag
2020-02-20 22:07:17 -05:00
Jeff Young 129042f8a6 Convert timestamps to UUIDs. 2020-02-20 21:29:52 +00:00
Jon Evans e59a3d981e Implement a new settings framework across all of KiCad
CHANGED: Settings are now stored in versioned sub-directories
ADDED: First-run dialog for migrating settings from a previous version
CHANGED: Settings are now stored as JSON files instead of wxConfig-style INI files
CHANGED: Color settings are now all stored in a separate settings file
CHANGED: The symbol editor and footprint editor now have their own settings files
CHANGED: Color settings are no longer exposed through BOARD object
CHANGED: Page layout editor now uses Eeschema's color scheme

Settings are now managed through a central SETTINGS_MANAGER held by PGM_BASE.
Existing settings will be migrated from the wxConfig format on first run of each application.
Per-application settings are now stored in one class for each application.
2020-02-19 23:44:56 -05:00
jean-pierre charras 2ca16c0b29 eeschema: fixes some issues related to translated and not translated field names.
When searching for fields, the code was sometimes comparing translated and not translated names.
This is an issue for mandatory fields, in non English languages.

Translated field names should be used only in messages.
2020-02-16 17:52:53 +01:00
Jeff Young 2017389f2d Pinning for library trees in FPEditor and SymbolEditor.
Fixes https://gitlab.com/kicad/code/kicad/issues/2288
2020-02-14 00:10:40 +00:00
Seth Hillbrand 03f74c87a1 Update immediate mode location and restart wires
The immediate action option clears (or not) the position of the events.
We use this to determine if the command should start at the given
position or merely activate the tool.  This was being checked in the
menu options, which only activated for tool commands in the context
menu.  Moving to the process event, we catch hotkeys as well.

This also restores the previous logic in eeschema that used a static
variable for storing wires rather than the private class variable.
Starting the draw event now picks up from the existing wires when
activated in immediate mode.

Fixes #3891 | https://gitlab.com/kicad/code/kicad/issues/3891
2020-02-11 09:12:36 -08:00
jean-pierre charras ba9dedaaf3 Eeschema, point editor: constraint corners of a SHEET symbol to stay on 50 mil grid
Fixes #3867
https://gitlab.com/kicad/code/kicad/issues/3867
2020-02-07 10:06:01 +01:00
Ian McInerney b1240b5b1e Gracefully shutdown tools when frames are closed
If the tools are not gracefully exited, then the stack variables are
never destroyed, so variable lifetime issues can occur.

Fixes https://gitlab.com/kicad/code/kicad/issues/1753
2020-02-05 22:23:24 +00:00
Seth Hillbrand 7d64527eeb eeschema: Handle Rebuild for subcomponents
The parents are the only items that live in the RTree, so the rebuild
check needs to recurse into the sub structure to check for selection

Fixes https://gitlab.com/kicad/code/kicad/issues/3858
2020-02-04 22:49:43 -06:00
Jon Evans ac875e26a8 Fix handling of SCH_PINs on multi-unit parts
Fixes https://gitlab.com/kicad/code/kicad/issues/3770
2020-02-04 11:51:29 +00:00
Seth Hillbrand 9f7e0ef8e8 eeschema: Remove Bus-Bus and Place sheet pin buttons
Cleaning toolbars of functions that are superfluous or do not match well
to the user workflow.
2020-02-04 04:39:26 -06:00
jean-pierre charras b8108d294f Fix a few I18n messages, and minor wxWidgets alerts. 2020-02-01 14:06:56 +01:00
Alexander Shuklin 3d0b3a51f3 Eeschema: Adding back annotation
ADDED: Back annotation algorithm,
eeschema back annotation dialog

CHANGED: added some minor helper methods to SCH_REFERENCE_LIST and SCH_REFERENCE,
split SCH_REFERENCE_LIST::CheckAnnotation on 2 parts to reuse code
2020-01-29 16:33:57 +00:00
Seth Hillbrand 84a697060f Don't insert pins/text when moving
Pins and component fields belong to the parent object and need to be
avoided when moving to prevent re-insertion on update.

Fixes #3804 | https://gitlab.com/kicad/code/kicad/issues/3804

Fixes #3811 | https://gitlab.com/kicad/code/kicad/issues/3811
2020-01-25 09:30:51 -08:00
Jon Evans da222d96b1 Fix a few issues with bus unfolding
Bus submenus weren't sending events because tool wasn't set.
Net names need to be unescaped for display.
Unfolding wasn't drawing the new wire segments.
SCH_LINE_WIRE_BUS_TOOL could get caught in an infinite event handling loop.

Fixes https://gitlab.com/kicad/code/kicad/issues/3796
2020-01-21 22:02:46 -05:00
Mark Roszko 70908043a3 Convert enums inside eeschema and the symbol editor to be scoped
Scope: NETLIST_ITEM, CONNECTION_TYPE, ELECTRICAL_PINTYPE,
       NET_CONNECTION, NETLIST_ITEM, GRAPHIC_PINSHAPE

Note, the pin type enum had PT_ added to the front to prevent
shadowing of the INPUT symbol on msys2 (see discussion at
c17c9960d8)
2020-01-18 20:51:28 +00:00
Seth Hillbrand 40f97b55c7 Remove confused dynamic_cast
dynamic_cast could not resolve the cast chain leading to a null undo
point.  Since we know the item to be LIB_ITEM, we can use static_cast
anyway and avoid the overhead.

Fixes #3771 | https://gitlab.com/kicad/code/kicad/issues/3771
2020-01-16 06:17:04 -08:00
Ian McInerney 33a40e788b Add missing null check to library viewer control tool 2020-01-13 14:40:55 +00:00
Jeff Young 836c1ea56e Fix a bunch of un-caught boost::bad_pointer exceptions.
This also removes vector cover types which do nothing except obfuscate
the underlying implementation.

Mainly changes SCH_SHEET_PINS and CONFIG_PARAM_ARRAY (which will soon
be replaced by Jon's new stuff).
2020-01-12 19:55:00 +00:00
Ian McInerney 960b553a70 Cleanup type casting in EE toolbase
* Ensure the lib edit undo checks for pointer validity
* Assert that the frames are the correct type (satisfies coverity)
* Convert C casts to C++ casts
2020-01-12 19:47:13 +00:00
Seth Hillbrand 84d5d6c168 Eeschema: Return null in case of canceling placement 2020-01-11 17:02:55 -08:00
Jeff Young 3d8150032f Fix some uninitialized variables found by Coverity. 2020-01-11 21:29:25 +00:00
Seth Hillbrand 7c28c3838a Comment-only changes
Makes class comments conform to coding standards
2020-01-10 16:43:01 -08:00
Jeff Young 88eab8134e Fix a couple of uninitialized variables (from Coverity scan). 2020-01-11 00:11:31 +00:00
Jeff Young 8abfc13053 Fix possible null dereference (from Coverity scan). 2020-01-10 22:32:50 +00:00
Seth Hillbrand 77c60d9655 Remove the last vestiges of dlist
It served us (mostly) well for more than a decade.  It helped KiCad grow
before the std:: came into decent shape or speed.  It was a good little
list.

RIP DLIST 2008-2020
2020-01-10 06:37:08 -08: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
Mark Roszko ca34ade00c Make global labels have the same spin style as net/hierarchical labels
For legacy reasons, it stored left and right "spin" as flipped integers in the file format.
But the code handled the flip in multiple locations rather than just doing it on file io.
This change unifies the internal code and does the mapping in the file I/O.
2020-01-08 19:07:55 +00:00
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Jon Evans 5255a29bc0 Always use local bus member names for unfolding menu 2020-01-03 22:11:00 -05:00
Jon Evans d5a80e9cfd Fix shadowing warning 2020-01-03 18:52:46 -05:00
Franck Jullien ea218bc722 eeschema: Allow hierarchy navigator to stay open
ADD: User can now decide to keep the hierarchy navigator open while working
on a schematic.

This behavior can be configured in eeschema->preferences->eeschema->Editing options.
2020-01-03 21:08:40 +01:00
Ian McInerney 81292d2bf1 eeschema: Cleanup processing for multiple line editing 2020-01-03 19:30:29 +00:00
Ian McInerney 079423c3cc eeschema: Remove unused include of eeschema_id.h 2020-01-03 16:04:54 +00:00
Mark Roszko b84fe2b703 ADDED: Editing style of multiple graphical lines at the same time.
Provides the ability to quickly set the style of multiple lines.  This is only allowed if the selection includes _only_ graphical lines.
2019-12-31 04:05:51 +00:00
Jeff Young e85701f405 Don't allow IS_NEW flag on created-line-segments to fool us.
When dragging we'll create new line segments between selection-edge
objects and things outside the selection that they're attached to.
These new lines have their IS_NEW flags set, but shouldn't fool us
into thinking that the selection contains pasted (or placed) items.
2019-12-28 11:58:33 +00:00
Jeff Young 87e163945e Items added to a selection for a drag should only be temporary.
After the drag, cancel, or undo, only the originally-selected items
should remain selected.
2019-12-28 11:58:33 +00:00
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
Mark Roszko d3edeaec50 Fix "Properties" not appearing in right click menu for graphic line. 2019-12-26 15:15:34 +00:00
Ian McInerney 3ca231aa78 Rename lib viewer frame files to use the class name 2019-12-19 14:05:46 +00:00
jean-pierre charras d9de28de35 Eeschema: usability enhancement.
ADDED: a config option to select (when clicking on a pin) the parent symbol
or only the pin.

Previously, when cliking on a pin, the parent symbol was selected.

Allowing the pin selection is mandatory in cross probing, and to display the pin
characteristics in some cases, for instance if a pin is flagged by the ERC tooL.
2019-12-19 12:41:51 +01:00
jean-pierre charras a049348576 Eeschema: fix null pointer use.
Fixes #3694 | https://gitlab.com/kicad/code/kicad/issues/3694
2019-12-19 09:11:34 +01:00
Wayne Stambaugh 2b920ffa04 Symbol editor: inheritance symbol editing bug fixes.
There is no need to create a new root symbol and re-parent all derived
symbols when renaming a root symbol.  Just rename the buffered root
symbol.

Test for duplicate symbol names when validating the properties dialog
information to prevent broken symbol pointers.

Fix a field drawing bug when editing derived symbols.

Fix bug to insure duplicate symbol names cannot exist in a library.

Fixes kicad/code/kicad#3654

Fixes kicad/code/kicad#3672
2019-12-16 10:11:06 -05:00
Seth Hillbrand e9323fff82 Eeschema: Move SCH_LINE_WIRE_BUS_TOOL to class
The remaining static elements of SCH_LINE_WIRE_BUS_TOOL are moved into
the class and passed elements eliminated in favor of held class
elements.
2019-12-13 12:41:57 -08:00
Seth Hillbrand cda291adae eeschema: Clean bits of DLIST
Removes the extra DLIST manipulation from SCH_LINE_WIRE_BUS_TOOL and
moves the static storage into class storage
2019-12-13 11:22:18 -08:00
Wayne Stambaugh 20836261d7 Fix minor coding policy violations. 2019-12-12 14:55:35 -05:00
Wayne Stambaugh a18d7a8495 Eeschema: fix a selection bug created in commit bec87864.
Apparently the schematic and symbol library editors now have common
selection filtering so checking for a valid LIB_EDIT_FRAME when
filtering for the  schematic editor frame prevented all schematic
object from being selected.
2019-12-12 11:42:11 -05:00
Wayne Stambaugh bec878640c Symbol editor: fix crash caused by broken root symbol name.
The symbol editor selection criteria did not include LIB_FIELD objects
which allowed the root symbol name to be changed causing broken derived
symbol links.  Disable the symbols fields from being edited when a
derived part is shown in the editor to prevent this.

Add a missing warning that deleting a root symbol used to derive other
symbols would also delete all derived symbols from a library.  Give the
user a chance to cancel the delete operation in this case.

Fixes kicad/code/kicad#3654
2019-12-12 10:45:12 -05:00
Wayne Stambaugh 8e150521a2 Fix a few minor symbol library inheritance bugs.
Don't clobber value file when load aliases in legacy symbol library cache
parser.

Use actual symbol library LIB_PART pointer rather than a flattened copy
of the symbol.  This fixed a bug when displaying the parent field in the
message panel for derived symbols.

Simplify the flatten code by copying the parent and updating the lesser
information from the inherited symbol.
2019-12-06 11:33:52 -05: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 3af3bf894c Make sure the IS_MOVED flag gets set when breaking out of a bus.
This (among other things) causes an update-preview event to be sent
when modifying it (such as rotating).

Fixes: lp:1854456
* https://bugs.launchpad.net/kicad/+bug/1854456
2019-12-02 20:01:44 +00:00
Seth Hillbrand ffcf3b01fc Fixup issue with adding junctions
Segfault when we pass a component to the routine as it expects to see a
selection.
2019-11-27 11:13:01 -08:00
Franck Jullien a5f8340654 eechema: add junction if needed when component is placed
Fixes: lp:1849376
* https://bugs.launchpad.net/kicad/+bug/1849376
2019-11-26 19:23:02 -08:00
Ian McInerney 087a90cf99 eeschema: Update titlebar when searching schematics
Fixes: lp:1851641
* https://bugs.launchpad.net/kicad/+bug/1851641
2019-11-24 01:25:00 +00:00
Ian McInerney 7339eb31eb eeschema: Allow bus entry labels to rotate and mirror
Fixes: lp:1853079
* https://bugs.launchpad.net/kicad/+bug/1853079
2019-11-23 23:35:21 +00:00
Jeff Young fb52124426 Fix several issue with bus entry connectivity.
When dragging a bus the entry is connected to the bus so the wire
connected to the entry (if any) needs to stretch.

While an entry can connect in the middle of bus, it cannot connect
in the middle of a wire.

Fixes: lp:1849973
* https://bugs.launchpad.net/kicad/+bug/1849973
2019-11-18 11:36:30 +00:00
Ian McInerney 1df7b718d9 eeschema: Allow labels to rotate on bus unfold 2019-11-15 20:43:56 +00:00
Seth Hillbrand 42f5c944b3 libedit: When pasting keep original multi-unit
Copy/Paste should keep the original items' designation for all units and
conversion type.  If it was specified in the original copy, we should
keep the same specification when pasting (but update for the current
frame)
2019-11-12 16:11:08 -08:00
Jeff Young 9d288968e7 Be more explicit about extent of schematic cleanups.
The new connectivity algorithm had a tendency to cleanup
globally, but that could insert undo records from other sheets
into the current screen's undo stack.  Needless to say, this
was a recipie for segfaults.

Fixes: lp:1846247
* https://bugs.launchpad.net/kicad/+bug/1846247
2019-11-10 23:25:54 +00:00
Seth Hillbrand 81ce588a00 eeschema: Set sheet unit number when setting unit
The auto increment needs to ensure the unit number is updated in two
places.  Hierarchy and draw list.

Fixes: lp:1851431
* https://bugs.launchpad.net/kicad/+bug/1851431
2019-11-05 14:04:01 -08:00
Jeff Young 984c64677e Hook up rotate & flip to bus entries when drawing them.
Also adds support for the bus entry shape hotkeys while drawing.

Fixes: lp:1849967
* https://bugs.launchpad.net/kicad/+bug/1849967
2019-11-05 17:22:51 +00:00
Seth Hillbrand bbf355a12f eeschema: Fix an issue with duplicate timestamps
Duplicating into a non-clone still doesn't get a new timestamp, so we
need to explicitly set it.
2019-10-29 16:48:19 -07:00
Seth Hillbrand 868ff5bb2c Right click gets a new object if the mouse has moved
Right click is a pointing operation combined with a request for the
context menu.  We need to highlight the user's intended object when they
have moved their mouse to a new element instead of showing the context
menu for the selected object.

However, in cases where the selection is difficult to make, it is
sometimes helpful to select the item first, then right-click.  In these
cases, we keep the selection where the mouse remains inside the selected
object's bounding box.
2019-10-29 16:11:06 -07:00
Seth Hillbrand 7b2d6ab40e eeschema: Allow mult-part placement option
When placing a new component in the schematic, this allows the user to
iterate through all units in the selected component without re-opening
the choose part dialog.  It also allows the optional addition of
multiple copies of the same component to be placed in the schematic.

Fixes: lp:1806217
* https://bugs.launchpad.net/kicad/+bug/1806217
2019-10-29 12:20:14 -07:00
Seth Hillbrand e533ea4ae6 eeschema: Keep selection with only components
Adding a field to a selection changes the bounding box and count for
rotation.  This can cause odd offsets when the field is rotated against
the selection center rather than the bounding box as well as with the
component.

Fixes: lp:1849078
* https://bugs.launchpad.net/kicad/+bug/1849078
2019-10-28 10:50:26 -07:00
Seth Hillbrand 080275b4ee Cleanup wire merge code 2019-10-18 20:15:29 -07:00
Seth Hillbrand 92011d91d2 eeschema: Testing for static/dynamic cast failure 2019-10-18 15:29:26 -07:00
Seth Hillbrand 363281dd4d eeschema: add junction when needed for broken wire
The break wire command will break all wires at a point.  If there are
multiple crossing wires, we need to check to see if a junction might be
required to reflect the new connection.

Fixes: lp:1848450
* https://bugs.launchpad.net/kicad/+bug/1848450
2019-10-17 12:22:57 -07:00
Jeff Young d9336e9f97 Reset autoplace flag when a field is moved with respect to its component.
Fixes: lp:1843929
* https://bugs.launchpad.net/kicad/+bug/1843929
2019-10-01 15:31:52 +01:00
Seth Hillbrand f2bf9fa534 eeschema: Prevent crash on move/drag re-entry
Restarting a move/drag operation breaks the stack by starting the tool
without popping it on exit.

TODO: implement RAII for these stack push/pop
2019-09-11 17:01:16 -07:00
Jeff Young 1a375a1e71 Better handling of SPICE current probe statements. 2019-09-10 11:07:47 +01:00
Jeff Young f21e24cd17 Fix pin rotatation and SPICE current probe statement for 2-pin symbols
Fixes: lp:1843159
* https://bugs.launchpad.net/kicad/+bug/1843159
2019-09-08 22:54:49 +01:00
Jeff Young 44a1cf9f1b Implement quiet-mode for selection clearing.
Also adds comments for exising quiet-mode calls.

Fixes: lp:1843177
* https://bugs.launchpad.net/kicad/+bug/1843177
2019-09-08 19:45:35 +01:00
Jeff Young 0ff20c18a3 More direct selection handling.
Fixes: lp:1842750
* https://bugs.launchpad.net/kicad/+bug/1842750
2019-09-07 20:52:17 +01:00
Jeff Young 3996a490a1 Re-allocating a std::vector invalidates its iterators.
When we add enough SHEET_PINs that the vector has to grow, it
re-allocates the vector causing our for-loop to get its knickers
tied in a knot.

Fixes: lp:1842394
* https://bugs.launchpad.net/kicad/+bug/1842394
2019-09-04 11:50:56 +01:00
Jeff Young 8bbbc66e46 Another attempt to fix the crash-on-selection bug.
Fixes: lp:1842394
* https://bugs.launchpad.net/kicad/+bug/1842394
2019-09-03 22:29:05 +01:00
Jeff Young 54a85cfaa2 Not everything in a VIEW_GROUP is an EDA_ITEM.
Fixes: lp:1842394
* https://bugs.launchpad.net/kicad/+bug/1842394
2019-09-03 17:24:50 +01:00
Jeff Young efbc802f4d Fix sheet rotation issues.
1) When sheet pins are on 3 or more sides there's no point in switching
the orientation to vertical.
2) Careful that we don't cause the sheet to walk when rotating and the
sheet-name or file-name is longer than the side it's on.

Fixes: lp:1841714
* https://bugs.launchpad.net/kicad/+bug/1841714
2019-09-02 22:36:55 +01:00
Jeff Young fc50ddda64 Implement Paste Special for eeschema.
Also changes the normal paste behaviour to only clear annotations
when a collision is found.

Fixes: lp:1837002
* https://bugs.launchpad.net/kicad/+bug/1837002
2019-09-02 19:24:29 +01:00
Jeff Young 5e353e8967 Fix another case of selection getting out of sync with dragged items.
Use a big hammer this time.

Fixes: lp:1839780
* https://bugs.launchpad.net/kicad/+bug/1839780
2019-08-31 20:23:06 +01:00
Jeff Young 33625dbd9d Add support for cut/paste of unsaved sheet content.
Fixes: lp:1841801
* https://bugs.launchpad.net/kicad/+bug/1841801
2019-08-30 21:56:57 +01:00
Jeff Young 71c7bf3274 Avoid ghosting items in original location when pasting. 2019-08-29 23:56:16 +01:00
Jeff Young 02a7a79e0d Use resolved path when trying to load sheet content.
Also, if it can't be loaded then at least initialize it so that we
don't crash later (trying to access a NULL screen).

Fixes: lp:1841801
* https://bugs.launchpad.net/kicad/+bug/1841801
2019-08-29 23:56:16 +01:00
Jeff Young bc450853ae More robust solution for adding dragged items to selection.
Fixes: lp:1839780
* https://bugs.launchpad.net/kicad/+bug/1839780
2019-08-29 23:56:16 +01:00
Seth Hillbrand 83b2332f1f eeschema: Check for proper type before dereference
When bundling a selection, we need to ensure that we have correct types
before attempting to dereference.

Fixes: lp:1841919
* https://bugs.launchpad.net/kicad/+bug/1841919
2019-08-29 08:47:26 -07:00
Seth Hillbrand 0d3f6a4930 eeschema: Remove Save All
Saving individual parts of a schematic can break the schematic.  This
moves the schematic save option to save all sheets rather than just the
current sheet.

Fixes: lp:1840383
* https://bugs.launchpad.net/kicad/+bug/1840383
2019-08-27 20:21:02 -07:00
Jeff Young 5348f88a8f Add sheet pins to candidate list by hand (as they're not in the view).
Fixes: lp:1841555
* https://bugs.launchpad.net/kicad/+bug/1841555
2019-08-27 21:08:36 +01:00
Jeff Young a5a237ac32 Improve readability of flag checking. 2019-08-27 19:23:07 +01:00
Jeff Young 49a0907c55 Force deletion of junctions which were selected.
Fixes: lp:1841456
* https://bugs.launchpad.net/kicad/+bug/1841456
2019-08-27 19:23:07 +01:00
Jeff Young b109aba663 Add a file browser to the Sheet Properties dialog.
Fixes: lp:1840459
* https://bugs.launchpad.net/kicad/+bug/1840459
2019-08-26 00:45:34 +01:00
Jeff Young 23fd4b64dd Remove curly braces from netname escaping context.
They're now used for bus definition control characters.
Also fixes the sheet pin edit dialog to correctly escape/unescape
netnames.

Fixes: lp:1840834
* https://bugs.launchpad.net/kicad/+bug/1840834
2019-08-22 10:53:39 +01:00
Jeff Young cc93d82025 Don't drop selection until unfold net has been chosen.
Fixes: lp:1831466
* https://bugs.launchpad.net/kicad/+bug/1831466
2019-08-21 15:35:02 +01:00
Jeff Young a25368cc6b Improve spelling.
The groundwork here is thanks to kunda1.

Fixes: lp:1831510
* https://bugs.launchpad.net/kicad/+bug/1831510
2019-08-20 19:14:05 +01:00
Seth Hillbrand 3135b63976 Eeschema: Update pins on paste
We use the pin cache to mark the pin locations for future operations.
This needs to be updated after paste.

Fixes: lp:1840286
* https://bugs.launchpad.net/kicad/+bug/1840286
2019-08-16 09:32:35 -07:00
Ian McInerney 49dd5d838c libedit: Fix inverted Y axis on move command
Also clean up some code formatting issues
2019-08-15 20:13:18 +01:00
Jeff Young 29af26565d Fix re-entrancy issue in LibEdit move tool. 2019-08-15 15:51:27 +01:00
Jeff Young 8ba7d4570c Move warp-mouse-on-move setting from Eeschema settings to common settings.
It's also used by the Symbol Editor, and will likely be used by
Pcbnew and friends in the future.
2019-08-15 12:53:04 +01:00