Commit Graph

905 Commits

Author SHA1 Message Date
Tomasz Wlostowski ac8b072284 router: fix assertion failure when starting a route on an empty board 2020-10-13 19:36:36 +02:00
Jeff Young 44dbe3577b Create proxy items for PNS when needing to query clearances.
Fixes https://gitlab.com/kicad/code/kicad/issues/5929
2020-10-12 20:59:19 +01:00
Michael Kavanagh c40483d18a Cleanup: Move KiCad files into plugins folder 2020-10-12 16:36:08 +00:00
Jeff Young b92cb5c930 Hook up PNS via command to new rule system.
Fixes https://gitlab.com/kicad/code/kicad/issues/5951
2020-10-12 00:14:32 +01:00
Jeff Young bcebb19665 Add implied diffpair netclass rules. 2020-10-11 13:19:23 +01:00
Jeff Young 79f91481f3 Fix missing break stmt. 2020-10-11 01:11:55 +01:00
Jeff Young f680ff17d6 Need an item to pick a netclass value. 2020-10-11 00:14:42 +01:00
Jeff Young 22cde88ba9 Allow chamfering/filleting of zone/board edge intersections.
Fixes https://gitlab.com/kicad/code/kicad/issues/5947
2020-10-10 23:09:43 +01:00
Jeff Young 04c4012ee6 Make track/via sizes UI more predictable and compatible with DRC.
Two main changes: netclass values need to go through the DRC engine
so they can interact with other rules.  They're also now dependent
on the layer being routed as well as the start object.

Also make the controls adjust to each other better.  For instance,
copy-track-width needs to turn off when you select a particular
track width, and a particular track width needs to zero out when
you choose copy-track-width.

Fixes https://gitlab.com/kicad/code/kicad/issues/5951
2020-10-10 19:32:30 +01:00
jean-pierre charras c5f01501c1 PnS, router/router_preview_item: fix incorrect size of SH_RECT shape when drawing it.
The width of the rectangle was used instead of the width of outline (usualy 0) to
draw the shape (when dragging the pad for instance)

Fixes #5944
https://gitlab.com/kicad/code/kicad/issues/5944
2020-10-10 10:03:23 +02:00
Jeff Young b31470012a Previous check didn't account for router dragging. 2020-10-09 14:30:55 +01:00
Jeff Young 2ca819a627 Don't assume a DRC_CONSTRAINT has a parent rule.
It will still have a name, though.
2020-10-09 14:26:09 +01:00
Jeff Young 1cb0cbff2e Fix crash when router gets notifed but has no current m_placer.
Fixes https://gitlab.com/kicad/code/kicad/issues/5935
2020-10-09 14:26:04 +01:00
Jon Evans 966730710e Partial fix for routing with no start item 2020-10-08 20:38:08 -04:00
Tomasz Wlostowski 38cef95da9 router: initial support for V6 Design Rules (width/clearance/diff pair width/diff pair gap). Still a lot of work to do! 2020-10-09 00:01:26 +02:00
Tomasz Wlostowski 9bef95418e router: wip on less intrusive dragged trace optimization 2020-10-09 00:01:26 +02:00
Tomasz Wlostowski 5e4fb46aef MINOPTMAX: added OptThenMin() method as syntax sugar 2020-10-09 00:01:26 +02:00
Marek Roszko f5e0754f65 Use the setCursor lambda pattern and fix up the initial cursor states 2020-10-07 23:26:14 -04:00
Mark Roszko d9485129c8 Implement more context specific cursors using both stock and custom cursors. 2020-10-08 00:50:28 +00:00
Tomasz Wlostowski eb8287ded8 router: bring back legacy GetEffectivePolygon() for complex pad shapes (more info in comments) 2020-10-07 16:36:37 +02:00
Jeff Young d23d5510e7 Restore a side-effect that the router appears to depend on. 2020-10-06 00:07:34 +01:00
Jeff Young 35fa857fd8 Make sure router tool passes events it doesn't handle.
Fixes undo/redo when router tool is active but not routing.
2020-10-05 23:16:37 +01:00
Jeff Young 18a3c4c1db Fix some fairly catastrophic bugs in shape collision optimization.
I did a little too much copy & paste last time around....
2020-10-05 22:32:07 +01:00
Jeff Young 6d50c9749c Mark the colliding shape so we know which one to highlight.
Also checks the nets when checking for a pad being flashed on a particular
layer (so we don't end up thinking the currently-routing-collided track
is a connection).
2020-10-05 22:32:07 +01:00
Jeff Young d063c56971 Move PNS pad solids to COMPOUND_SHAPE.
Also fixes plated holes solids to include plating thickness.
2020-10-05 22:32:07 +01:00
Jeff Young 37906511f5 Class renaming.
DRAWSEGMENT  -> PCB_SHAPE
EDGE_MODULE  -> FP_SHAPE
TEXTE_PCB    -> PCB_TEXT
TEXTE_MODULE -> FP_TEXT
2020-10-05 11:55:33 +01:00
Mark Roszko a28a0e14ba Fix conversion warnings 2020-10-05 10:41:14 +00:00
Jeff Young 7a4900b8dc PCB_LINE_T -> PCB_SHAPE_T and PCB_MODULE_EDGE_T -> PCB_FP_SHAPE_T
Also updated footprint text and zone types for consistencey.
2020-10-04 16:49:04 +01:00
Jeff Young bb753aaadf Clean up terminology around active & high contrast layers. 2020-10-03 22:55:34 +01:00
Mikolaj Wielgus 400c15b8eb Add mils to units, remove useMils variables 2020-10-03 20:06:56 +00:00
Jon Evans 6f54a9982c Remove PCB_LAYER_WIDGET 2020-09-30 19:12:26 -04:00
Seth Hillbrand bf3cb0b1d0 Standardize pad type enums 2020-09-30 08:38:35 -07:00
Jeff Young d3f8f2b81e Remove confusion between pad->IsOnLayer and pad->IsPadOnLayer 2020-09-30 11:50:51 +01:00
PJM 258d1a1971 Pcb: Get proper "Break Track" location when invoked from RMB context menu
When invoking "Break Track" from the RMB context menu, Pcbnew
gets and uses the current position of the mouse to figure out where to
break the track.  The problem is that the mouse has to be moved to select
the "Break Track" menu item, and the mouse position used is wrong.  This
can result in the break in the wrong location or not happening at all.

CHANGED: This commit determines if the "Break Track" was invoked from a
context menu or a hotkey.  If a hotkey, it uses the current mosue position.
If a context menu, it uses the original postion of the mouse when the menu
was opened.
2020-09-28 16:56:02 +00:00
Jeff Young f8875bc5a6 Move std::contains to alg::contains. 2020-09-26 14:42:40 +01:00
Jeff Young d7e80f8008 Add std::contains() to simplify a lot of code. 2020-09-26 12:40:32 +01:00
Ian McInerney bba29a1036 Always show the track and via menu in the router context menu 2020-09-25 00:17:54 +01:00
Ian McInerney 672756a018 Move the router tools to a TOOL_MENU context menu
The previous way of displaying a context menu was being
usurped by the selection tool because it was displaying its
menu before DispatchContextMenu was called, and all other tools
explictly use the TOOL_MENU system.

Fixes https://gitlab.com/kicad/code/kicad/issues/5762
2020-09-24 23:51:34 +01:00
Jon Evans 18e17abd6a Rename "Keepout" to "Rule Area"
These objects can now be used in advanced DRC rules and
not just for keeping things out.  Also remove the restriction
that at least one of the "basic" keepout rules must be set,
so that these areas can be used for more advanced rules.
2020-09-21 23:55:02 -04:00
Jeff Young ece2ae9805 Don't capture commands in the router eventloop that it doesn't process.
Fixes https://gitlab.com/kicad/code/kicad/issues/5692
2020-09-19 12:08:18 +01:00
Seth Hillbrand f493e270ea ADDED: Menu option to enable/disable snap to grid
You can now enable and disable snap to grid when drawing/editing across
all apps.  You can also tie snap to grid to the visibility of the grid
to allow rapid enable/disable via grid display.
2020-09-10 20:09:30 -07:00
Seth Hillbrand 173b4ff588 Add snapping to eeschema
This generalizes both the SetPosition() function and ORIGIN_VIEWITEM
class away from the pcbnew-centric.
2020-09-09 10:18:15 -07:00
Tomasz Wlostowski 54ca66be72 router: NODE::AllItemsInNet() can now filter by item type 2020-09-08 01:31:42 +02:00
Tomasz Wlostowski f2338d9faa router: fix segfault with NPTH holes in COMPONENT_DRAGGER 2020-09-08 01:31:42 +02:00
Jeff Young 88635ee5b6 Clean up error messages.
Convert a lot of nags to InfoBar errors/warnings/messages, and some
that never should have been exposed to wxFAIL_MSGs.
2020-08-31 14:19:57 +01:00
Jon Evans 7a5c99ee0f Tweak the mouse-based posture solver
Add an epsilon to reduce flutter
Add a lock after a certain distance
Forget the old trail when unlocking

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5381
2020-08-30 19:54:09 -04:00
Jeff Young 8b7c0cbe04 Adjust footprint zones while dragging footprint. 2020-08-28 11:05:58 +01:00
Seth Hillbrand f4e8c194be Revise restriction on No Copper setting
This allows the user to specify a NPTH with "No Copper", allowing a pad
to retain the mask layer without a copper landing.

Fixes https://gitlab.com/kicad/code/kicad/issues/3407

Fixes https://gitlab.com/kicad/code/kicad/issues/5237
2020-08-26 18:09:06 +00:00
Seth Hillbrand adff7f749b PNS: Addition layer smarts
Edge.Cuts have no parent but cross all layers, so we need to handle the
"all layers" case.  Also renames "IsPadOnLayer" to "IsOnLayer".

Fixes https://gitlab.com/kicad/code/kicad/issues/5351
2020-08-25 09:42:50 -07:00
Seth Hillbrand 686af65a9b Fix issue generating alternate shape
Boolean ops need boolean inputs.
2020-08-22 08:04:03 -07:00
Jeff Young 842641308f Solids don't always have nets (even a defualt one).
Fixes https://gitlab.com/kicad/code/kicad/issues/5290
2020-08-21 20:08:12 +01:00
Seth Hillbrand 9a4f92dfd9 Ensure that all pads with holes have alts
Alternate shapes for holes that are fallback clearance are needed in
case we have missing copper on any layer

Fixes https://gitlab.com/kicad/code/kicad/issues/5233
2020-08-20 21:50:37 -07:00
Seth Hillbrand dd9f7c8c25 PNS: Add defensive coding to AlternateShape()
Adds additional check/warnings about missing alternate shapes when they
are expected.

Fixes https://gitlab.com/kicad/code/kicad/issues/5233
2020-08-19 09:02:06 -07:00
Wayne Stambaugh ede39780e2 Remove all debugging output that cannot be disabled.
The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
2020-08-18 10:17:36 -04:00
Seth Hillbrand 4cc820f550 PNS: skip hulls for layers where the solid isn't
If we don't have an object on the required layer and there isn't a
through-hole (m_alternateShape), then we shouldn't return a hull

Fixes https://gitlab.com/kicad/code/kicad/issues/5233
2020-08-18 06:53:03 -07:00
Seth Hillbrand 5c3a1d059e Fix memory mgmt issue with SOLID shapes
We don't delete items from the CTOR but we do need to check if they
exist in the incoming SOLID before cloning

Fixes https://gitlab.com/kicad/code/kicad/issues/5214
2020-08-17 06:16:11 -07:00
Seth Hillbrand afc94fdec3 PNS: Be better about handling multiple layers
Rather than adding pads/vias multiple times for each layer, we introduce
the "alternate shape" idiom to PNS that allows us to optionally place
the collision constraint on the hole instead of the pad for those
vias/pads that have inner layers removed.

Fixes https://gitlab.com/kicad/code/kicad/issues/5158

Fixes https://gitlab.com/kicad/code/kicad/issues/5198

Fixes https://gitlab.com/kicad/code/kicad/issues/5195
2020-08-16 12:39:15 -07:00
Jeff Young 57c3d8e8d8 Make sure preview group gets added to view after a clear. 2020-08-15 21:13:44 +01:00
Jon Evans bd14f8a82a ADDED: New appearance control widget for PcbNew
Featuring:
- Layer view presets
- Per-type opacity for tracks, vias, pads, zones
- Net and netclass color and visibility controls

CHANGED: Simplified object visibilty controls

Fixes https://gitlab.com/kicad/code/kicad/-/issues/1951
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1981
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2003
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2173
Fixes https://gitlab.com/kicad/code/kicad/-/issues/2254
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4325
2020-08-15 15:24:28 -04:00
Jeff Young 463100d67f Remove a long-standing hack to keep divots out of adjacent zones.
The new algorithm unions any adjacent zones before doing the
chamfer/fillet and then subtracts the other zones back out afterwards.

Fixes https://gitlab.com/kicad/code/kicad/issues/3812
2020-08-12 22:20:08 +01:00
Seth Hillbrand 9a66a5acad Cleanup code line endings 2020-08-10 03:27:27 +00:00
Seth Hillbrand 5fc6b74c89 ADDED: Remove unused pads
This option removes copper layers from pads and vias where they are not
connected to other board elements.  This allows the inner layers to be
more closely routed if the via landing pad is not needed.

Fixes https://gitlab.com/kicad/code/kicad/issues/1835
2020-08-10 03:27:26 +00:00
Ian McInerney 90a17427ee Give the length tuning tool an inital end point that isn't the start point
Using the starting point as the end point means that the tool
initializes with 0 length traces and so nothing is visible.

Fixes https://gitlab.com/kicad/code/kicad/issues/1912
2020-08-08 23:41:48 +01:00
Jeff Young 7cd8f710b6 Clean up unused includes. 2020-08-08 16:25:30 +01:00
Seth Hillbrand c57c168753 PNS: Remove items from all layers
subIndices control which layers the items are inserted onto and removed
from.  The iterator to remove items needs to be inclusive of the
first/last layers

Fixes https://gitlab.com/kicad/code/kicad/issues/5090

Fixes https://gitlab.com/kicad/code/kicad/issues/5075

Fixes https://gitlab.com/kicad/code/kicad/issues/5034
2020-08-05 19:39:55 -07:00
Jeff Young 73832a9708 Work around an event processing failure.
Fixes https://gitlab.com/kicad/code/kicad/issues/4273
2020-08-05 19:36:58 +01:00
Jeff Young e2ec9d9f00 A more fail-safe way to disallow editing while routing.
Fixes https://gitlab.com/kicad/code/kicad/issues/4413

Fixes https://gitlab.com/kicad/code/kicad/issues/5067
2020-08-05 16:51:58 +01:00
Jeff Young 59ba793096 Disable various combinations of router and editing commands.
They just confuse each other.

Fixes https://gitlab.com/kicad/code/kicad/issues/5067
2020-08-04 14:32:02 +01:00
Jeff Young 74b9cce682 Try again at dragging module edges.
Fixes https://gitlab.com/kicad/code/kicad/issues/5037
2020-08-03 23:53:45 +01:00
Jeff Young ef2388b5bb Fix issue with dragging flipped MODULE. 2020-08-02 17:05:13 +01:00
Jeff Young d586495c0a Preview fp edges & text while dragging in router.
Fixes https://gitlab.com/kicad/code/kicad/issues/5037
2020-08-01 15:40:34 +01:00
Tomasz Wlostowski 89a953e039 Migrated GetEffectiveShape(s) to SHAPE_COMPOUND 2020-07-29 23:14:03 +02:00
Tomasz Wlostowski 85aecc15ee router: fix mistake in 45/free-angle mode selection when dragging corners 2020-07-29 23:14:03 +02:00
Tomasz Wlostowski c2b9db293f router: prevent heap crash when initial walkaround line is empty 2020-07-29 23:14:03 +02:00
Seth Hillbrand 1f5fb979b9 Keep PNS item RTree on layer-by-layer
Rather than extra splitting of the RTree that we use for collision
detection on types and direction, we limit this to checks on
layer-by-layer basis.  This also allows for layer expansion by using
deque of RTrees rather than fixed index

This fixes the missing layernumbers and keeps the layers in a deque to
prevent re-allocation on expansion.

Replaces ad94b6205
2020-07-29 11:21:00 -07:00
jean-pierre charras f00c59c446 Fix a few Coverity warnings. 2020-07-29 09:26:57 +02:00
Seth Hillbrand ad94b6205a Revert "Keep PNS item RTree on layer-by-layer"
This reverts commit a34d33c460.

The commit did not work properly for shove routing.  Will revist in
later commit
2020-07-28 21:20:19 -07:00
Seth Hillbrand a34d33c460 Keep PNS item RTree on layer-by-layer
Rather than extra splitting of the RTree that we use for collision
detection on types and direction, we limit this to checks on
layer-by-layer basis.  This also allows for layer expansion by using
vector of RTrees rather than fixed index
2020-07-28 10:17:56 -07:00
Jeff Young 46602148dc Fix overly aggressive assert. 2020-07-28 13:35:37 +01:00
Jeff Young 4153309fba Add defensive code.
Fixes https://gitlab.com/kicad/code/kicad/issues/4941
2020-07-25 23:54:04 +01:00
Jeff Young bf445c1a95 Performance enhancements.
1) cache pad polygon outlines
   huge improvement in connectivity performance and a decent
   improvement in DRC performance
2) don't pre-allocate CONTEXT stack
   significant improvement in DRC rule performance
2) don't keep re-encoding strings
   decent improvement in DRC rule performance
2020-07-25 13:03:33 +01:00
Tomasz Wlostowski 70b98c3b49 router: dump entire event log + annotated PCB upon user request 2020-07-22 18:05:54 +02:00
Tomasz Wlostowski 379aa8f3b5 router: clearer distinction between LOGGER and DEBUG_DECORATOR classes.
The first one keeps a log of events (start routing, mouse motion, etc).
The second allows for adding temporary debug drawings and messages which are stored synchronously with the events in LOGGER.

The event stream together with the PCB design (now with UUIDs) can be used to deterministically replay routing bugs as the user sees them.
2020-07-22 18:05:54 +02:00
Tomasz Wlostowski 2a2e389a94 router: auto-guess track posture from mouse movements, experimental! 2020-07-22 18:05:50 +02:00
Tomasz Wlostowski fd07e94760 router: abstract segment links into a LINK_HOLDER interface. DIFF_PAIRS are now also linkable 2020-07-22 17:04:42 +02:00
Ian McInerney 450107e453 Remove if statement with duplicated branches in router 2020-07-22 00:18:30 +01:00
Jon Evans 2f31bf278b Fix layer hotkey dispatch
Hotkeys received by more than one tool need AF_NOTIFY
2020-07-11 21:59:16 -04:00
Jon Evans 5d118b0700 More visibility settings infrastructure
ADDED: Three-state high contrast mode action
ADDED: Save contrast mode in local settings

Also some initial infrastructure for layer presets
2020-07-11 21:59:07 -04:00
Jon Evans 0148c1db84 Support layer switch hotkeys while routing
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4699
2020-07-03 19:49:19 -04:00
Jon Evans 3d7610d6b9 Hide PNS debug graphics behind an AC key
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4061
2020-07-03 19:33:36 -04:00
Jon Evans c0aa6965de Migrate PcbNew project settings to new framework
Various architecture upgrades to support this.
Creating a BOARD now requires a valid PROJECT, which caused
some (mostly transparent) changes to the Python API internals.

ADDED: Project local settings file
CHANGED: Board design settings are no longer stored in PCB file
CHANGED: Net classes are no longer stored in PCB file
CHANGED: Importing board settings now reads boards, not just projects

Fixes https://gitlab.com/kicad/code/kicad/-/issues/2578
Fixes https://gitlab.com/kicad/code/kicad/-/issues/4070
2020-07-02 22:08:54 -04:00
Jeff Young 2cfd6ba978 Fix a couple of integer overflows. 2020-07-02 22:52:37 +01:00
Jeff Young eb1ff80d57 SHAPE collision fixes.
1) An actual distance of 0 is still a collision, even if the allowed
distance is 0.
2) Be consitent about edges and interiors.  Everyone expect the edge
of a RECT to be part of the RECT; same with a CIRCLE.  SHAPE_POLY_SET
shouldn't be any different.  (And SHAPE_LINE_CHAIN was a split-
personality with the edge considered part of it for Collide() but not
for PointInside()).
2020-07-02 21:38:37 +01:00
Jeff Young 441dfa30f0 Return individual custom pad shapes instead of a SHAPE_POLY_SET.
Also implements an optional pointer to return the actual distance
from all the SHAPE collision routines.

Fixes https://gitlab.com/kicad/code/kicad/issues/4774
2020-07-02 17:09:15 +01:00
Ian McInerney 17adb6c3c6 Add context menu to route and zone toolbar items
ADDED: Context menu for route and zone toolbar items
2020-06-26 21:29:03 +00:00
Jeff Young d01b29ab37 Cleanup pad geometry handling.
There were a lot of plotters, exporters, etc. that were rolling their
own implementations.

This also introduces a lazily-built set of SHAPE objects for doing
collision detection and some forms of rendering (and later DRC).
2020-06-22 22:28:37 +01:00
Jeff Young aeed8e6e2c Finish implementation of DRAWSEGMENT::C_RECT.
It's currently only supported in the Footprint Editor.  It could be
easily added to the board editor (all the code is there), but the board
editor is a little short on room in the drawing tools toolbar.
2020-06-15 20:51:31 +01:00
Jeff Young 47ab7c78a6 Divorce GRID_HELPER from the parent frame.
This moves GRID_HELPER fully into the tool framework.
2020-06-13 22:44:16 +01:00
Seth Hillbrand a8ab668122 Move SHAPE_ARC to start->mid->end format
The arc shapes need to connect with their adjacent points.  By storing
the relevant points, we allow exact point matching on both ends of the
arc as well as localize point storage.
2020-06-13 11:23:14 -07:00
Seth Hillbrand 1c46bf1955 PNS: Use segment shape for all oval pads
Instead of calculating a simple polygon for the oval pads that are
rotated, we use a rotated segment.

Fixes https://gitlab.com/kicad/code/kicad/issues/4604

(cherry picked from commit 25b8da8e3b)
2020-06-04 20:29:25 -07:00
Seth Hillbrand 674226f99f pcbnew: Set flag when cancelling during routing
Fixes https://gitlab.com/kicad/code/kicad/issues/4475
2020-06-04 15:48:01 -07:00
Jon Evans c7daf8a8f3 ADDED: Cross-probe highlighting of bus members
Note: this is a basic implementation but it could be
improved once we include bus information in the netlist
and pcbnew can natively keep track of buses and nets
instead of just nets.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4158
2020-05-24 13:30:23 -04:00
Ian McInerney 6692935808 Consolidate common viewer actions across cvpcb and pcbnew frames
* Consolidate the measure tool into one tool (this gives cvpcb
  unit changing and snapping capabilities in its measure tool)
* Transition cvpcb to use actions for the sketch modes
* Replumb how magnetic items settings are stored and used
2020-05-24 11:58:33 +01:00
Jeff Young 05855a5a1c Performance enhancements for DRC. 2020-05-18 13:38:17 +01:00
Jeff Young 3c3984a6fc Generalize default footprint fields.
Fixes https://gitlab.com/kicad/code/kicad/issues/2289
2020-05-08 23:30:33 +01:00
Jon Evans 51eac3e3e6 Split pcbnew and footprint editor settings getters for clarity 2020-05-05 21:46:00 -04:00
jean-pierre charras 83cb9c0d14 Fix a few Coverity and compil minor warnings. Remove dead code 2020-04-21 12:47:48 +02:00
Michael Kavanagh 7db355e34a ADDED: TOOL_ACTION for switching PNS router mode.
Fixes https://gitlab.com/kicad/code/kicad/issues/2249
2020-04-19 22:44:05 +00:00
Jeff Young 9c8941e040 Remove a bunch of globals. 2020-04-16 17:34:46 +01:00
Tomasz Wlostowski 4a3cd77416 router: smarter way to check the shove direction without using silly heuristics 2020-04-15 13:00:48 +02:00
Jeff Young 6e800bddae Rationalize penWidth processing as first step in removing some globals. 2020-04-13 20:58:13 +01:00
jean-pierre charras bdada70ee7 Cosmetic enhancements: add bitmaps to a few context menus.
Fix also a minor compil warning.
2020-04-12 10:29:28 +02:00
jean-pierre charras ffe0b4aba1 Fix a few Coverity warnings. 2020-04-02 14:21:09 +02:00
jean-pierre charras ddb7b2b2b7 pns router: fix possible hang when using "end" key to finish the current track.
Add also left double click (same as "end" key) to finish the track.

Fixes #4116
https://gitlab.com/kicad/code/kicad/issues/4116
2020-04-02 14:21:09 +02:00
jean-pierre charras e811101567 fix a few Coverity warnings. 2020-04-01 09:34:44 +02:00
jean-pierre charras 6e47f147aa A few Coverity fixes. 2020-03-30 09:50:26 +02:00
jean-pierre charras 9d2712a824 Fix a few Coverity warnings.
It also fix:

Fixes #4082
https://gitlab.com/kicad/code/kicad/issues/4082
2020-03-29 18:42:24 +02:00
Seth Hillbrand 4dfe630b28 PNS: Moving the rest of the placer to Fix/Commit
Springback introduced a new PNS structure to check for valid placement
as well as separating the Fix/Commit routines.  This updates the
remaining placers to utilize the new structure.

Fixes https://gitlab.com/kicad/code/kicad/issues/4008
2020-03-06 09:56:44 -08:00
Seth Hillbrand f6317fba82 PNS: Protect drag from null deref
Items that do not have nets will not be in the index, so we need to
avoid the null pointer when adding drag tagets

Fixes https://gitlab.com/kicad/code/kicad/issues/4009
2020-03-06 09:32:04 -08:00
Seth Hillbrand 0417a6b409 PNS: Fix missing via on zero-length
The current node needs to be kept for zero-length lines when placing a
via.

Fixes https://gitlab.com/kicad/code/kicad/issues/4005
2020-03-05 15:02:40 -08:00
Seth Hillbrand b0d9838fb4 PNS: Correct assertion when dragging
Dragging using highlight caused an assertion as the duplicated lines
were being re-added with their old links still inplace.  While this was
probably fine as the link references shouldn't be stale, we clear them
to allow for the possibibility that the dragger will adjust the links in
the future.
2020-03-05 08:47:06 -08:00
Seth Hillbrand 4c2626f6b0 PNS: Don't use PNS margin to calc bump direction
The bump direction should only be concerned with physical points to
calculate the heuristic for loop-back otherwise we get too many false
positives.

Fixes https://gitlab.com/kicad/code/kicad/issues/3971
2020-03-04 19:22:57 -06:00
Seth Hillbrand fe8524b9bb Update DIFF_PAIR_PLACER to new callbacks
Needs to handle changes to PNS_ROUTER.  This does not implement
springback or backspace in DIFF_PAIR_PLACER, only allows committing
lines as before

Fixes https://gitlab.com/kicad/code/kicad/issues/3988
2020-03-04 17:23:04 -06:00
Seth Hillbrand d4cbc348de PNS: avoid committing route with nothing
The node is not neccesarily populated when committing, so we need to
check for validity first.

Fixes #3984 | https://gitlab.com/kicad/code/kicad/issues/3984
2020-03-03 14:02:32 -08:00
Seth Hillbrand 9769e1020b PNS: Don't link unroutable items
The joint map only works for items that are routable, so don't bother
adding unroutable items as this only takes additional time to process

Fixes #3976 | https://gitlab.com/kicad/code/kicad/issues/3976
2020-03-03 12:42:56 -08:00
Seth Hillbrand d6706c257c PNS: clear via when fixing route
When fixing the route, we need to clear the via to avoid re-placing it
on each future click.

Fixes #3966 | https://gitlab.com/kicad/code/kicad/issues/3966
2020-03-02 16:22:34 -08:00
Seth Hillbrand 386147628e PNS: Initialize placement test 2020-03-02 16:22:34 -08:00
Seth Hillbrand 3c19704349 PNS: Don't add null items to drag
Not all footprint pad items are connected to elements in the PNS, so if
we don't find the parent element, we avoid later crashes/assertions by
skipping their addition

Fixes #3972 | https://gitlab.com/kicad/code/kicad/issues/3972
2020-03-02 11:28:14 -08:00
Seth Hillbrand 18db471967 PNS: Line placer returns false when nothing committed
The true/false return should be triggered on whether any elements have
been commited to the line

Fixes #3969 | https://gitlab.com/kicad/code/kicad/issues/3969
2020-03-02 11:11:13 -08:00
Tomasz Wlostowski a28f58d14d router: fix regression in PNS_KICAD_IFACE treating newly created items as invisible (side effect = non-45 degree angles due to incorrect snapping) 2020-02-29 20:41:31 +01:00
Tomasz Wlostowski 6850067182 router: commit traces made in single stroke/click (fixes regression introduced with Backspace support) 2020-02-29 20:40:19 +01:00
Tomasz Wlostowski e5fff302a3 router: fix arc drawing in ROUTER_PREVIEW_ITEM 2020-02-28 23:52:33 +01:00
Tomasz Wlostowski e0bad936bf router: enable inline dragging of components 2020-02-28 23:17:15 +01:00
Tomasz Wlostowski 44905e1b0a router: initial support for dragging components with traces attached 2020-02-28 23:17:15 +01:00
Tomasz Wlostowski b2b1edbcd1 router: KICAD_IFACE can now commit changes to module positions 2020-02-28 23:17:15 +01:00
Tomasz Wlostowski b6e059f018 router: use a common base class for all dragging algorithms 2020-02-28 23:17:15 +01:00
Tomasz Wlostowski 1d0ee66187 router: kill debug printf() 2020-02-28 23:17:15 +01:00
Tomasz Wlostowski 77478014d8 router: kill some warnings in OPTIMIZER 2020-02-28 23:17:15 +01:00
Tomasz Wlostowski 796aec6e6e router: SOLID::SetPos() should update the shape position too 2020-02-28 23:17:15 +01:00
Tomasz Wlostowski 5a16fda11a router: allow modification of SOLIDs in PNS::NODE 2020-02-28 23:17:15 +01:00
Seth Hillbrand 7cb3ed456e PNS: No free-angle drag at the moment.
Fixes #3954 | https://gitlab.com/kicad/code/kicad/issues/3954
2020-02-28 12:43:59 -08:00
Jon Evans 9cc5b4b3f9 Fix management of nested settings for PNS 2020-02-27 22:53:00 -05:00
Tomasz Wlostowski f77d2f8cb8 router: option to enable optimization of the track being dragged 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 4525a17076 router: backspace key to undo last fixed segment(s) 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski b5c11f21e5 router: rounding mode context menu entry 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski d1a5d8c78b router: don't forget the tail when toggling via placement 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 8ddeb966ca pns: drag wip on walkaround via mode 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski cf4945afaa router: optimizer should now handle 'keep vertex' constraint correctly... 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 53c3f95ac4 router: initial attempt at walkaround mode for dragger 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski c0314dbb29 router: dragger can now optimize also the segment being dragged 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski a6d3ae3c5b router: NODE now can also query joints 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 6b767d50c3 router: initial support for user-provided constraints for the optimizer 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski c2d95a00c1 router: improved handling of corner cases in LINE::Walkaround 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 37a754c4dd router: initial attempt at improved 'aim at mouse cursor' strategy in walkaround mode, wip... 2020-02-27 22:02:56 +01:00
Tomasz Wlostowski 43b71cd9e3 router: Clear() method for PNS::LINE 2020-02-27 22:02:56 +01:00
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