Commit Graph

600 Commits

Author SHA1 Message Date
Tomasz Wlostowski dbe90e163e router: use one global logger object 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 4281bd8207 router: keep board in base Kicad Iface class 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 9e605d6958 router: DEBUG_DECORATOR now allows to name each primitive 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 065d634b30 router: put non-graphical part of ROUTER_IFACE into a parent class (for unit tests) 2020-02-27 22:02:56 +01:00
Jon Evans 9f8ff236d6 Fix load and save of PNS settings 2020-02-25 19:36:36 -05:00
jean-pierre charras f206db2041 Pcbnew: fix crash on exit after using the track length tool.
This is due to the fact the PNS_TUNE_STATUS_POPUP was not hidden
before calling its destructor.
It is now fixed by setting its virtual destructor calling Hide().

TODO: see if it could be used for any class derived from STATUS_POPUP.
(We already have this issue in other places)
2020-02-22 10:34:11 +01:00
Seth Hillbrand 8c19b4b6ae pcbnew: Adding arcs to PNS
This is allows ARCs in tracks to be synchronized with
the PNS router.  Note this does not yet include the UI components
to route curved traces
2020-02-21 16:11:41 -08: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
Ian McInerney 8b7d4c2a55 Put tool graphics back on the stack
Now that the tool framework gracefully shutdowns the tools, graphics
can be created on the stack inside a tool function.

This reverts commit f6881ce3de.
2020-02-05 22:23:44 +00:00
Ian McInerney 34e5b76c5f Add virtual constructors to some classes that should have them
This is more for safety from undefined deletion behavior than
anything else (it also silences the Clang -Wnon-virtual-dtor warning).
2020-02-05 22:19:14 +00:00
Seth Hillbrand c4fff95078 PNS: Detect collisions including newline width
The new line collision search uses BBox() to check for colliding
objects.  BBox in the SHAPE_LINE_CHAIN did not include width as the
chains were assumed to be zero-width.  This is not the case for
PNS::LINE elements.

We mostly don't notice this because DRC checks for SEGMENT collisions
but it becomes obvious/annoying when we cannot place a track for unknown
reasons and the snap-back doesn't take line width into account.

Fixes #3776 | https://gitlab.com/kicad/code/kicad/issues/3776
2020-01-17 11:23:08 -08:00
Seth Hillbrand f7cb970a02 PNS: Modify MarkObstacles logic to select shorter
When routing where we hit multiple obstacles, we choose the shortest
path to allow overlapping hits to choose the shorter path, thus giving a
better chance of returning true for the DRC-compliant path.

Fixes #3773 | https://gitlab.com/kicad/code/kicad/issues/3773
2020-01-16 19:57:38 -08:00
Ian McInerney 3ab9db6ff1 Update cast in PNS since we are guaranteed to have text
We are guaranteed that the BOARD_ITEM will be a TEXTE_MODULE
since we have tested its type already, so just use a static_cast
to remove the overhead.
2020-01-13 19:42:49 +00:00
Seth Hillbrand 52bfdb9703 PNS: Assume the current line is a base before optimizing
We use the cost of the current line before trying to improve the pad
breakout cost when optimizing the smart pads

Fixes #3759 | https://gitlab.com/kicad/code/kicad/issues/3759
2020-01-12 11:08:46 -08:00
Ian McInerney 00e58cd974 Fix unintialized values (from coverity scan) 2020-01-12 13:00:42 +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
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
Ian McInerney 5d46e721e5 pcbnew: Cleanup includes of pcbnew_id.h
* Remove unused IDs from the enum
* Remove the include statements from files that no longer need it
2020-01-03 15:39:05 +00:00
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
Seth Hillbrand eb3d32f967 SHAPE_LINE_CHAIN: Unify constructors
Keeps the multi element SHAPE_LINE_CHAIN constructors in a single
routine using std::vector and implicit construction.
2019-12-12 13:54:48 +00:00
Seth Hillbrand c4d853c1e8 SHAPE_LINE_CHAIN: Remove element access
This is the first step to allowing non-segments in the line chain.
External routines cannot be allowed to change the line chain without
going through the internal routines.  To accomplish this, we remove the
Vertex() and Point() access routines and only leave the const versions.
Transformations are given for both points as well as the chain itself.
2019-12-12 13:54:48 +00:00
jean-pierre charras 21dd8db7a9 P&S router: length tuning tool: fix a crash after trying to tune a track.
It happens on Windows, and wxWidgets 3.1.3.
It is created by PNS_TUNE_STATUS_POPUP instance used in tool.
I am pretty sure this crash is created by the stack switching
when managing events, due to some changes in wxWidgets code.
the fix creates the instance on the heap, instead of on the stack.
This is not the first time I see this kind of issue.
2019-12-12 09:39:51 +01:00
Seth Hillbrand b6b805548d PNS: Allow snap to temp hidden
The IFACE for kicad refers to the board hidden state, not the
temporarily hidden state used by the router.  We allow snapping to items
that have been removed by the temporary router state to provide snapping
to original track location.

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

(cherry picked from commit 1e64524afb)
2019-12-07 09:51:02 -08:00
Fabien Corona 36fba5bd7f PCBnew: placing a blind/buried via sometimes incorrectly place a through via.
Fixes #1819
https://gitlab.com/kicad/code/kicad/issues/1819
2019-12-06 13:11:33 +01:00
Seth Hillbrand 6983c56cf8 Use const references where possible
This avoids copy cost on local vars where we only read.
2019-12-05 14:40:22 -08:00
Seth Hillbrand c6f5df134c Minor speed cleanup
This adjusts iterators to use const reference when only used for
copy.  It also ensures pre-allocation of vectors when size is known
ahead of time.
2019-12-05 14:20:59 -08:00
Seth Hillbrand b5f021ff9f Cleanup: Replace push_back with emplace_back
In cases where we create a new item and immediately push into a
container, the emplace idiom is faster and more efficient.
2019-12-05 13:41:21 -08:00
Seth Hillbrand 4d2e953f42 Cleanup: Replace C-only deprecated headers
This replaces headers deprecated by C++14 with their equivalent
replacement
2019-12-05 11:03:15 -08:00
Seth Hillbrand a2edf9c442 Unified update to C++14 std::make_unique
This update replaces the existing uses of unique pointer creation with
the C++14 std::make_unique call that provides proper memory release in
event of an exception.
2019-12-05 10:43:55 -08:00
Ian McInerney 1b14a38b01 pcbnew: Fix hotkeys during routing
CHANGED: Fix hotkeys for actions during routing

Previously hotkeys on shifted characters would not be
passed through the router and processed.
2019-11-10 17:47:51 +00:00
Ian McInerney d8c80623ce pcbnew: Fix cursor position after via layer select
CHANGED: Move cursor to event position instead of the
dialog position when selecting the via layer
2019-11-10 17:34:16 +00:00
Fabien Corona 6182133a4e Ratsnest default value for tracks and vias
Fixes: lp:1851611
* https://bugs.launchpad.net/kicad/+bug/1851611
2019-11-07 08:41:56 -08:00
Seth Hillbrand 6625d0721e Implement Get/Set display options
The pointer passing for display options is deprecated.  This removes the
excess casting as the EDA_FRAME didn't need the base call with no value.
All requests for display options are now returned const and are updated
with a Set() routine after modification.

In Gerbview, this resolves an issue where the display options were not
stored because it was receiving the NULL from EDA_FRAME.
2019-11-07 08:26:44 -08:00
Seth Hillbrand 42daf172fd router: Keep meander placer world in base
m_world overloaded in pns_meander_placer and didn't get the correct
pointer in certain tune modes.

Fixes: lp:1851251
* https://bugs.launchpad.net/kicad/+bug/1851251
2019-11-04 09:11:19 -08:00
Seth Hillbrand 4178cf7f36 pcbnew: Add PadToDie length for tuning actions
This adds the pad to die parameter from each pad to the total line
length of the tuned line for comparison with desired.

Fixes: lp:1711541
* https://bugs.launchpad.net/kicad/+bug/1711541
2019-10-31 16:00:19 -07:00
Seth Hillbrand 4135f0c0e7 pcbnew: Don't duplicate tracks
Dragging in freeangle mode can be forced, in which case, we don't want
the extra line from the SHOVE element.

Fixes: lp:1845844
* https://bugs.launchpad.net/kicad/+bug/1845844
2019-10-30 10:44:33 -07:00
jean-pierre charras 1c2891e6d4 Fp editor: allow internal layers in footprint keep-out zones Especially: Enable one internal layer to manage keep-out areas only on internal layers Allowing one internal layer is a trick to manage these keep-out areas (visibility and selection) In fact this internal layer groups all internal layers enabled is these keep-out areas. 2019-10-29 11:24:57 +01:00
Seth Hillbrand 133772e964 pcbnew: Correct optimizer breakout calculation
The previous fix for optimizer breakout length calculation was providing
better scores to longer traces rather than longer breakouts as intended.

This limits the length scoring to breakout only.
2019-10-25 11:18:16 -07:00
Seth Hillbrand 07c8596084 pcbnew: Check all layers for routing snaps
Flipped footprint pads may report their "primary" layer as not the front
layer in high contrast.  We need to check whether the board item for
snaps is visible on the active layers.

Fixes: lp:1847877
* https://bugs.launchpad.net/kicad/+bug/1847877
2019-10-15 09:44:16 -07:00
Seth Hillbrand 0f8a1c22ad pcbnew: Snap during routing needs active parent
The router items may not yet have a board item parent.  In this case,
the reference to the parent needs to be guarded before dereferencing.

Fixes: lp:1847717
* https://bugs.launchpad.net/kicad/+bug/1847717
2019-10-11 09:16:26 -07:00
Seth Hillbrand cecfeea947 pcbnew: Remove snapping to hidden items
Items and layers that are hidden in the view should not be used as snap
points.  This happens in multiple locations:
1) Grid Helper for normal tools
2) TOOL_BASE::snapToItem for router

Resolves KiPro Issue #116

Fixes: lp:1833128
* https://bugs.launchpad.net/kicad/+bug/1833128
2019-10-10 09:37:25 -07:00
Ian McInerney 58d4a8bb4a pcbnew: Don't reinitialize the router tool in an action
Calling Init() in an action routine will reset the router
settings to the state they were in when first starting pcbnew.
The Init() function is automatically called when the tool is created.

Fixes: lp:1843810
* https://bugs.launchpad.net/kicad/+bug/1843810
2019-10-07 16:07:05 -04:00
Ian McInerney 0aa5424511 pcbnew: Switch over some drawing tools to use PrimeTool
Before, if the tools were activated from the context menu,
they would start drawing where the menu item was selected
instead of where the menu was opened.
2019-10-03 19:04:36 +01:00
Jeff Young 9a349065db Better error messages for router. 2019-10-01 15:02:41 +01:00
Seth Hillbrand e7c07501c5 Minor compile warning cleanup 2019-09-05 09:47:52 -07:00
Seth Hillbrand c8a6878eb8 pcbnew: Allow tuning length to be longer than INT_MAX
The INT_MAX limit for most elements makes sense only for single-segment,
straight line elements.  For elements that accumulate lengths, we should
utilize the long long int (64 bits) to allow for greater lengths.

Fixes: lp:1842367
* https://bugs.launchpad.net/kicad/+bug/1842367
2019-09-03 16:41:09 -07:00
Seth Hillbrand 03d5bf0df5 PNS: Check that we are optimizing a pad
Vias are also sent to breakout optimizer, so we need to check for the
solid cast before dereference.

Fixes: lp:1841057
* https://bugs.launchpad.net/kicad/+bug/1841057
2019-08-22 08:57:19 -07:00
Seth Hillbrand 06cb21cc47 pcbnew: Optimize pad connection revision
This modifies that logic for optimizing pad connections.

1) Custom pads now prefer the connections to their longer side.  This is
particularly important to match the behavior in a rectangular pad
2) Costs for straight lines are non-zero.  This favors fewer connections
3) Custom pad breakouts are at the polygon boundary rather than offset
by 0.1mm.  This also matches the circular and rectangular paradigm.
4) Line Heads contained in the pad itself are not optimized.  This
prevents escaping the pad unnecessarily

Fixes: lp:1824182
* https://bugs.launchpad.net/kicad/+bug/1824182
2019-08-20 19:35:26 -07:00