Commit Graph

1462 Commits

Author SHA1 Message Date
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
Fabien Corona 496f3d49e4 pcbnew: When using '+' and '-' hotkeys, skip non-visible layers
CHANGED: pcbnew: When using '+' and '-' hotkeys, skip non-visible layers

Fixes https://gitlab.com/kicad/code/kicad/issues/3443
2019-12-29 23:37:25 +00:00
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
jean-pierre charras a12b803af5 Add missing option to show footprint texts in fill or sketch (line) mode.
This option is settable in stable version, but not in master.
So, this option set from the stable version could be modified in master version.
2019-12-23 18:11:45 +01:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
jean-pierre charras cc185e4b8a Pcbnew: fix crash when deleting pads in the board editor
Fixes # |3684 https://gitlab.com/kicad/code/kicad/issues/3684
2019-12-17 13:56:17 +01:00
jean-pierre charras 6bc8005d60 Pcbnew: fix strange behavior when editing board setup, if a zone is currently selected.
The zone was silently deleted.

Fixes #3673 | https://gitlab.com/kicad/code/kicad/issues/3673
2019-12-16 12:44:53 +01:00
Jeff Young d40019210f Allow undo during a drag. 2019-12-15 21:33:58 +00:00
Jeff Young 1f07505b27 Fix long-standing issue with arrow keys moving in both axes. 2019-12-15 14:29:47 +00:00
jean-pierre charras d14950c3f8 Pcbnew: Add missing options to show graphics in fill or sketch mode.
These options where settable in stable version, but not in master.
So, the options set from the stable version cannot be modified in master version.
2019-12-15 13:56:26 +01: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
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 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
Jeff Young a9da0c6ecf Update local coords when editing EDGE_MODULEs.
Fixes: lp:1853726
* https://bugs.launchpad.net/kicad/+bug/1853726
2019-12-02 20:01:44 +00:00
jean-pierre charras c186e7d391 Cosmetic and usability enhancements.
- Better menu texts
- do not show pad edit options in board editor,
when they are used only in the footprint editor.
2019-11-26 19:53:00 +01:00
jean-pierre charras c34dfc4230 fix a minor compil warning 2019-11-23 18:36:40 +01:00
Jeff Young 13df645af9 Fold down select/expand connection/copper to a single action.
Fixes: lp:1832902
* https://bugs.launchpad.net/kicad/+bug/1832902
2019-11-22 19:30:36 +00:00
Jeff Young 523de87b45 Re-implement copper selection algorithms.
Fixes: lp:1832902
* https://bugs.launchpad.net/kicad/+bug/1832902
2019-11-22 19:30:36 +00:00
jean-pierre charras 6f2cbe5982 Pcbnew: housekeeping: move netlist code to netlist_reader sub directory. 2019-11-17 13:58:38 +01:00
Jeff Young 490bc2874f Clean up board commit a bit.
This change makes it so that we don't run the event loop inside
the commit.  It's not clear this is an issue, but it seems safer
not to.

Fixes: lp:1852589
* https://bugs.launchpad.net/kicad/+bug/1852589
2019-11-16 22:32:52 +00: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 19c643b29a pcbnew: Prevent extra selection
We want to avoid selecting items that are disabled in the item list.
Our standard method is in the GetViewLOD() that performs both size and
visibility.  This extends the check to module text and via.

Fixes: lp:1851133
* https://bugs.launchpad.net/kicad/+bug/1851133
2019-11-05 12:24:29 -08:00
Jeff Young 1c153c55c0 Add default units and precision for new dimension objects.
Fixes: lp:1846376
* https://bugs.launchpad.net/kicad/+bug/1846376
2019-11-05 17:22:51 +00:00
Jeff Young 872826085a Filter PCBNew contents when pasting into Footprint Editor.
Fixes: lp:1850724
* https://bugs.launchpad.net/kicad/+bug/1850724
2019-11-05 17:22:51 +00:00
Jeff Young 48c8ac9663 Added new action for "Change Track Width".
Default out-of-the-box is no hotkey. Removed all the preference stuff.

Note that the new implementation is a little different: the old one only
operated on a selection with a single item where the new one operates on
all selected items. So if you want the whole track do a 'U' before the 'W'
(or whatever you have Change Track Width assigned to).

Fixes: lp:1844023
* https://bugs.launchpad.net/kicad/+bug/1844023
2019-11-05 17:22:51 +00:00
Seth Hillbrand dc5e8aa609 pcbnew: Performance improvement on moving items
This adjusts the fix for 1813038 to focus on the duplicate ghost,
preventing the need to unselect/reselect in every cycle.  This improves
large move speeds substantially
2019-11-01 10:00:38 -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
jean-pierre charras bc5dcf182f keepout in footprint: fix some crashes and issues. Create a specific type (PCB_MODULE_ZONE_AREA_T) for zones in footprint. The new class (MODULE_ZONE_CONTAINER) is the same as ZONE_CONTAINER, but the type ID is PCB_MODULE_ZONE_AREA_T instead of PCB_ZONE_AREA_T.
This is mandatory because these zones must be handled differently in many functions.
2019-10-29 11:24:57 +01:00
Ross Schlaikjer 64a42ffa35 Add keepout in footprints: Starting point. 2019-10-29 11:24:30 +01:00
Seth Hillbrand 39241dc0ff Footprint browser: Handle frame calls
The frame() call requires an edit frame but the browser is derived from
PCB_BASE_FRAME.

Fixes: lp:1849962
* https://bugs.launchpad.net/kicad/+bug/1849962
2019-10-26 08:27:27 -07:00
Seth Hillbrand bae50fab9f pcbnew: Fix 45° snapping polygons
The constrained draw was constraining the polygon size to fit the
existing points rather than extending the existing points to fit the
user's intent.

This adds a 90° double-joint for the completion polygon that allows the
user to complete common constrained polygons visually based on the
preview with a double-click to finish.
2019-10-24 16:01:14 -07:00
jean-pierre charras 4813eb12e6 DIALOG_POSITION_RELATIVE: fix some issues: wxWidgets alerts and unit selection not taken in account after the first run.
Fixes: lp:1849231
https://bugs.launchpad.net/kicad/+bug/1849231
2019-10-22 14:09:11 +02:00
Seth Hillbrand 8f1c1cf298 pcbnew: Don't limit editing of the polygons
45 deg contraints are not saved per polygon, so don't limit per polygon.
The constraint is only enforced during creation.

Fixes: lp:1847722
* https://bugs.launchpad.net/kicad/+bug/1847722

Fixes: lp:1846029
* https://bugs.launchpad.net/kicad/+bug/1846029
2019-10-20 09:29:42 -07:00
Seth Hillbrand 2e1af66a2b pcbnew: Commit polygon points to new constrained zone
Adds leader points if they are not already existing in the zone

Fixes: lp:1846028
* https://bugs.launchpad.net/kicad/+bug/1846028
2019-10-20 09:29:35 -07:00
Jeff Young e73e7bdc23 Process via size inc/dec commands while running via tool.
Fixes: lp:1846320
* https://bugs.launchpad.net/kicad/+bug/1846320
2019-10-17 20:17:26 +01:00
Jeff Young 0995433601 Map nets (if possible) from clipboard to destination.
Fixes: lp:1795057
* https://bugs.launchpad.net/kicad/+bug/1795057
2019-10-17 18:04:07 +01: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 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 b58df5e777 Flip Start0 etc. when in ModEdit.
ModEdit and PCBNew use Start0/End0/etc. differently so care must
be taken when flipping.

Fixes: lp:1845402
* https://bugs.launchpad.net/kicad/+bug/1845402
2019-10-01 11:02:52 +01:00
Jeff Young 4bf2b6a9f7 Performance enhancements for cross-probing.
While found when profiling cross-probing, many of these will also
improve other things.
2019-09-27 19:58:16 +01:00
jean-pierre charras 072ea9a33e Pcbnew: flip command: when flipping only one item, flip it around its anchor instead of its bounding box.
This is the behavior of previous 5.1 version.
Using the bounding box has advantages, but unfortunately in many cases the footprint position is moved.
If a lot of flip commands are made on the same footprint, it is moved far from its initial position.
2019-09-17 10:06:39 +02:00
Jeff Young 7dc9beaf11 Add type filter to push pad properties.
Fixes: lp:1827820
* https://bugs.launchpad.net/kicad/+bug/1827820
2019-09-08 23:50:36 +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 10c25a2290 Update frame type enum to match current class names. 2019-09-06 23:38:20 +01:00
Jeff Young 6688e80131 Update description in footprint tree when it's edited.
Also implements a more useful message panel for Footprint Editor.

Fixes: lp:1842660
* https://bugs.launchpad.net/kicad/+bug/1842660
2019-09-04 17:19:25 +01:00
Jeff Young 720de6bae1 Cleanup. 2019-09-03 17:16:27 +01:00
Jeff Young 9a6c534e60 Another try at the duplicate-then-move ghosting bug.
Fixes: lp:1813038
* https://bugs.launchpad.net/kicad/+bug/1813038
2019-09-03 16:51:00 +01:00
Jeff Young 4c9e4c947c Fix for move-after-duplicate only needs the extra update once.
This version will be quite a bit more performant.

Fixes: lp:1813038
* https://bugs.launchpad.net/kicad/+bug/1813038
2019-09-02 20:46:06 +01:00
Jeff Young 315a99e0fe Use Move() instead of SetPosition() so that the second pt gets updated too.
Fixes: lp:1841989
* https://bugs.launchpad.net/kicad/+bug/1841989
2019-08-30 23:32:17 +01:00
Jeff Young 79d062aefc Don't allow selection dragging when a picker tool is running.
Fixes: lp:1841691
* https://bugs.launchpad.net/kicad/+bug/1841691
2019-08-30 10:33:34 +01:00
Jeff Young d2cd659471 Be better about cleaning up mouse capture.
Fixes: lp:1841996
* https://bugs.launchpad.net/kicad/+bug/1841996
2019-08-29 23:56:16 +01:00
Jeff Young 359cf384de Import graphics is a one-shot, not a tool.
Fixes: lp:1841975
* https://bugs.launchpad.net/kicad/+bug/1841975
2019-08-29 23:56:16 +01:00
Seth Hillbrand 64c012c175 modedit: Enable snapping on anchors
The selection of footprint anchor should obey normal snapping paradigm.
2019-08-28 10:38:27 -07:00
Jeff Young a5a237ac32 Improve readability of flag checking. 2019-08-27 19:23:07 +01:00
Seth Hillbrand b3615b36bb pcbnew: Retain 45° constraint
This also finishes the polygon with 45° lines when chosen as a create
option.

Fixes: lp:1833673
* https://bugs.launchpad.net/kicad/+bug/1833673

(cherry picked from commit fccce265aa)
2019-08-26 14:36:23 -07:00
Jeff Young 03da721030 Move events to wxFormBuilder and fix the missing hookup.
Fixes: lp:1841361
* https://bugs.launchpad.net/kicad/+bug/1841361
2019-08-25 20:48:47 +01:00
Jeff Young 2622f875ee Simplify the pad tool menus a bit. 2019-08-24 17:13:35 +01:00
Seth Hillbrand 8576668eba pcbnew: Snap items to grouped layers
When moving a group of items, the allowed snapping layers should be each
layer in the group, not just the first item's LSET.

Fixes: lp:1830164
* https://bugs.launchpad.net/kicad/+bug/1830164
2019-08-21 12:32:13 -07:00
Jeff Young aaa44b7348 Honor the {0, 0} reference on the clipboard.
Fixes: lp:1840819
* https://bugs.launchpad.net/kicad/+bug/1840819
2019-08-20 19:57:36 +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
Jeff Young b219fbc3d2 Implement undo/redo for lock/unlock/toggle lock.
Fixes: lp:1840770
* https://bugs.launchpad.net/kicad/+bug/1840770
2019-08-20 16:39:40 +01:00
Jeff Young 1bfefc61ea Allow mouse drag to initiate a router drag if over a track or via.
Fixes: lp:1840694
* https://bugs.launchpad.net/kicad/+bug/1840694
2019-08-19 21:09:44 +01:00
Seth Hillbrand 959a4bdded pcbnew: Don't stack same tool handler
The Get and place tool used to live in selection tool and could activate
the edit tool by stacking calls.  Now that it is itself in the edit
tool, we cannot stack another call to the edit tool that runs
immediately, instead we allow the GetAndPlace to finish before beginning
the next tool (Move)
2019-08-14 17:12:00 -07:00
Jeff Young 045f5f6a61 Move some functions out of SELECTION_TOOL that don't really belong there. 2019-08-13 13:29:18 +01:00
Jeff Young dd938b02df New move tool doesn't require GetAndPlace to jump through hoops.
And at least one of those hoops leaves the cursor forced.

Fixes: lp:1839877
* https://bugs.launchpad.net/kicad/+bug/1839877
2019-08-13 10:01:47 +01:00
Jeff Young f3f0a6899f Invoke move by ACTION; the EDIT_TOOL does lots of other stuff too.
Fixes: lp:1839877
* https://bugs.launchpad.net/kicad/+bug/1839877
2019-08-12 22:21:09 +01:00
Jeff Young 3bf24fae7a Set selection reference point to top-left item.
Fixes: lp:1771016
* https://bugs.launchpad.net/kicad/+bug/1771016
2019-08-12 22:21:09 +01:00
Jeff Young cc0bd9a171 Even out PCB_EDITOR_CONTROL and PCB_INSPECTION_TOOL. 2019-08-12 22:21:09 +01:00
Michael Kavanagh 79b2ff7551 Refactor deleteTool ACTION removing duplicates 2019-08-12 13:49:55 -04:00
Jeff Young c836cc9cf8 Don't use activate to move as the edit tool must activate for other ops.
Fixes: lp:1839534
* https://bugs.launchpad.net/kicad/+bug/1839534
2019-08-10 11:58:05 +01:00
Jeff Young c60118b6a4 Ativate delete tool so it can display the selection clarification menu when needed.
Fixes: lp:1835371
* https://bugs.launchpad.net/kicad/+bug/1835371
2019-08-03 22:17:31 -06:00
Jeff Young 01e78b04c6 Save last-used-paths in export dialogs.
Also fixes the export GenCAD dialog so that browse correctly updates
the textbox.

Fixes: lp:1793761
* https://bugs.launchpad.net/kicad/+bug/1793761
2019-08-02 21:03:48 -06:00
Jeff Young b8a03be869 Flip block around center instead of first item's anchor.
Fixes: lp:1789775
* https://bugs.launchpad.net/kicad/+bug/1789775
2019-08-02 16:07:25 -06:00
Jeff Young 3f28a1d1cb Cleanup after cancelled add text dialog.
Fixes: lp:1838452
* https://bugs.launchpad.net/kicad/+bug/1838452
2019-07-31 23:10:13 -06:00
Jeff Young 987642eb8c Apply selectable logic to delete tool.
Fixes: lp:1838191
* https://bugs.launchpad.net/kicad/+bug/1838191
2019-07-28 12:31:18 -06:00
Jeff Young 5347c2ad3d Clear selection when running drawing tools.
Fixes: lp:1837796
* https://bugs.launchpad.net/kicad/+bug/1837796
2019-07-26 23:38:37 -06:00
Jeff Young 7314acf053 Renaming. 2019-07-26 13:19:17 -06:00
Jeff Young 77334628c4 Change default tool behaviour to skip unhandled events.
The problem is that wxEVT_CHAR_HOOK doesn’t do the key translation
properly.  wxEVT_CHAR does, but we only get to that if we skip the
event at the end of the tool’s event processing loop, which most tools
don’t do.  (Selection tools, point editors, pickers, and a couple of
others do skip, which is probably why this didn’t get reported earlier.)

I played around with a couple of ways to fix wxEVT_CHAR_HOOK.  Most of
them don’t work, and the few egregious hacks I tried weren't cross-
platform.

So I’m changing it so that most tools now skip at the end of their
event loops.  I left out a couple that I felt were high risk (length
tuning, for instance).  But there’s still enough risk that I’m 100%
sure it will break something, I just haven’t a clue what.

Fixes: lp:1836903
* https://bugs.launchpad.net/kicad/+bug/1836903
2019-07-26 12:21:24 -06:00
Jeff Young 815602d1af Fix missing AF_ACTIVATE flags on some tools.
Fixes: lp:1813659
* https://bugs.launchpad.net/kicad/+bug/1813659
2019-07-26 12:21:24 -06:00
Jeff Young 460b03372d Implement preference for immediate actions.
Also pushes prefer-selection-to-dragging to common.
2019-07-25 20:41:22 -06:00
jean-pierre charras 30c724e858 Pcbnew: Mark some strings translatable in menu and/or hotkey list. 2019-07-23 11:53:55 +02:00
Jeff Young 1808d8bd40 Add hole-to-hole-minimum checking to via placement.
Courtesy of Frank Severinsen.

Fixes: lp:1833214
* https://bugs.launchpad.net/kicad/+bug/1833214
2019-07-21 21:21:11 -06:00
Jeff Young 2ca379b281 Copy ratsnest flags when exchanging modules.
Fixes: lp:1834214
* https://bugs.launchpad.net/kicad/+bug/1834214
2019-07-21 19:49:13 -06:00
Jeff Young b858fa38c4 Fix crash bugs in picker tools. 2019-07-21 19:06:06 -06:00
Alexander bb290abe91 added board statistics dialog, which shows info for production and assembly 2019-07-20 14:39:08 -06:00
Jeff Young d746ba892d Make sure the postion relative tool gets activated when used.
Fixes: lp:1836978
* https://bugs.launchpad.net/kicad/+bug/1836978
2019-07-19 20:14:40 -06:00
Jeff Young 02eb1d2c62 Don't try and run drawing tools in ModEdit with no module selected.
Fixes: lp:1836673
* https://bugs.launchpad.net/kicad/+bug/1836673
2019-07-19 15:29:10 -06:00
Jeff Young 0b08e4dcd2 Deactivate other tools when running one based on a PICKER.
In particular, if the last one was a PICKER tool, then we're going
to assert on "click-handler-already-set".

Fixes: lp:1836673
* https://bugs.launchpad.net/kicad/+bug/1836673
2019-07-19 15:29:10 -06:00
jean-pierre charras b4fc78fc0d kicad_plugin.cpp: fix incorrect detection of existing footprints in PCB_IO::FootprintExists(), when fp names contain a point.
Fixes: lp:1837221
https://bugs.launchpad.net/kicad/+bug/1837221
2019-07-19 18:16:07 +02:00
Jeff Young 3de00eef5f Cleanup. 2019-07-17 21:45:43 +01:00
Jeff Young d67c2d13c7 Fix re-entrancy problem in cross-probing.
Fixes: lp:1836940
* https://bugs.launchpad.net/kicad/+bug/1836940

Fixes: lp:1836937
* https://bugs.launchpad.net/kicad/+bug/1836937
2019-07-17 21:35:28 +01:00
Jeff Young 7c1049d86b Fix event-loop issue with some pickers.
RunAction returns immediately even when called with "run now" flag.

Fixes: lp:1836905
* https://bugs.launchpad.net/kicad/+bug/1836905
2019-07-17 21:35:28 +01:00
Jeff Young ba7ad7ddf4 Fix bug with PCBNEW_PICKER_TOOL not doing a push/pop.
PICKER_TOOL got updated but PCBNEW_PICKER_TOOL didn't.
2019-07-16 20:25:25 +01:00
Jeff Young e816a0c29d Push Eeschema & PLEditor PICKER_TOOLs down into common.
Also implements a more robust push/pop tool strategy for pickers.
2019-07-16 00:44:01 +01:00
Jeff Young 58ca5b71a9 A more robust fix for 36f1d023f0.
This one also handles when the events get out-of-order due to them
starting out in the Simulation window and not getting dispatched until
the mouse goes over the Schematic window.

Fixes: lp:1835907
* https://bugs.launchpad.net/kicad/+bug/1835907

Fixes: lp:1836544
* https://bugs.launchpad.net/kicad/+bug/1836544
2019-07-15 14:15:24 +01:00
Jeff Young a3c74051c2 Allow edits to self-intersecting polygons.
1) Intermediate states might be self-intersecting, and we shouldn't
be policing our users on what order to do things in
2) The polygon might already be self-intersecting, at which point we're
preventing the user from fixing it.

Also includes better const management for SHAPE_POLY_SET API.

Fixes: lp:1833831
* https://bugs.launchpad.net/kicad/+bug/1833831
2019-07-14 18:18:48 +01:00
Jeff Young fe188489c7 A better hack for the post-ProgressReporter-loss-of-focus issue. 2019-07-14 18:18:48 +01:00
Jeff Young 928d6c5dff Implement preserved-corners to prevent divots when filling adjacent zones.
Fixes: lp:1460787
* https://bugs.launchpad.net/kicad/+bug/1460787
2019-07-14 18:18:48 +01:00
Jeff Young 560fda70a2 Update position before first mouse-move-event.
Fixes: lp:1780426
* https://bugs.launchpad.net/kicad/+bug/1780426
2019-07-14 10:39:38 +01:00