Commit Graph

14959 Commits

Author SHA1 Message Date
Seth Hillbrand b461fc44ef pcbnew: Ensure source snapping
Choosing the drag origin should not be dependent on the snap settings in
pcbnew.  Snap settings are sensible when you are designating a target
only.  Additionally, when dragging a module, we do not want the
footprint's pads to be used as targets for snapping.

Fixes: lp:1814402
* https://bugs.launchpad.net/kicad/+bug/1814402
2019-02-03 04:23:24 +01:00
Seth Hillbrand 5c3f6f2abf eeschema: Fix grid assignment error
Assignment of columns was offset based on the quantity column.  This
cleans the implementation as well as setting the correct width

Fixes: lp:1814380
* https://bugs.launchpad.net/kicad/+bug/1814380
2019-02-02 18:42:51 +01:00
jean-pierre charras 098d9bf056 3D viewer: Fix: board outlines ignored in 3D for triangular board shapes
Fix also a few minor coding style issues.

Fixes: lp:1814324
https://bugs.launchpad.net/kicad/+bug/1814324
2019-02-02 17:59:53 +01:00
Seth Hillbrand c0cd4c03fb pcbnew: Handle cancel action in fp load
When the user cancels the footprint load, we should assume they are
canceling the placement of a new footprint.  This also adds sanity check
when populating the list

Fixes: lp:1814181
* https://bugs.launchpad.net/kicad/+bug/1814181
2019-02-01 15:48:36 +01:00
jean-pierre charras 3ad5fd056e Pcbnew, Update PCB from schematic: Fix the reference point of the new footprints to place, when moving the cursor.
It was a regression from 5.02 version.
The block of new footprints to place has now its reference point (the point that is on the graphic cursor) fixed.
This is the first footprint loaded from the list.
2019-02-01 11:43:16 +01:00
jean-pierre charras 4543bde56b Minor enhancements in 3D viewer hotkey code 2019-01-31 21:03:38 +01:00
Jeff Young b6a06aa129 Improve default canvas handling.
Fixes: lp:1813973
* https://bugs.launchpad.net/kicad/+bug/1813973
2019-01-31 19:43:31 +00:00
Jeff Young a375edf9ac Perform cancel action by hand.
Fixes: lp:1814138
* https://bugs.launchpad.net/kicad/+bug/1814138
2019-01-31 19:07:07 +00:00
John Beard 55b5c7189a Exit dialog: use Layout on the whole window
Prevents mislaignment in footpritn editor on close with unsaved
changes.

Fixes: lp:1813961
* https://bugs.launchpad.net/kicad/+bug/1813961
2019-01-31 08:22:59 +01:00
Tomasz Włostowski 47e28cb5be eeschema: don't clear freshly selected block in HandleBlockEnd() at the first mouse event
Fixes: lp:1813971
* https://bugs.launchpad.net/kicad/+bug/1813971
2019-01-31 02:49:58 +01:00
Jeff Young ba7b970817 Add pre-select architecture to grid helper icon-text-buttons.
Fixes: lp:1813973
* https://bugs.launchpad.net/kicad/+bug/1813973
2019-01-31 01:09:03 +00:00
Seth Hillbrand 88d9f946a2 eeschema: Don't break Eagle junctions on import
Eagle can label nets independently of the connection point position.  In
an "interestingly" designed circuit, this can lead to a junction of a
pin, wire endpoint and unrelated wire.  While this is bad practice,
KiCad shouldn't force an incorrect net connection during the import.  In
this case, we skip the addition of junctions to ensure that we don't
create a schematic error.

Fixes: lp:1788019
* https://bugs.launchpad.net/kicad/+bug/1788019
2019-01-30 17:02:24 -08:00
Seth Hillbrand b14bc1bead svg: Use grouping
Uses existing grouping in SVG output.  Sets schematic components as a
grouped element in SVG as well as pcbnew elements per layer.

Fixes: lp:1011754
* https://bugs.launchpad.net/kicad/+bug/1011754
2019-01-30 16:58:33 -08:00
Seth Hillbrand 37741048ce plot: Correct a couple SVG output errors
Plotting to closed lines for polygons in SVG.  Also correct the filled
polygon line width for non-copper zones.

Fixes: lp:1813964
* https://bugs.launchpad.net/kicad/+bug/1813964
2019-01-30 15:41:36 -08:00
John Beard 0415c89c5b Fix broken GetReferencePrefix function
This function was incorrectly processing refdeses like "U1000".

Change the algorithm to a simpler STL-compatible one and
update the tests.

Fixes: lp:1813669
* https://bugs.launchpad.net/kicad/+bug/1813669
2019-01-30 15:41:36 -08:00
John Beard 88f9f6f072 Break out ref-des-centric functions to own header
This breaks the following functions out to a general-purposed refdes utils
header:

* MODULE::GetReferencePrefix()
* kicad_string.h RefDesStringCompare()

This acheives:

* Slimming of MODULE interface
* Placement of refdes code in common rather than pcbnew
** Testing of this code in qa_common
* Tighter and smaller includes for code that only needed refdes functions

Note: there are failing tests commited (as expected failures). These
are the cause of lp:1813669 and will be fixed as a follow-up commit.
2019-01-30 15:41:36 -08:00
John Beard dc20521cb9 Break out getTrailingInt from MODULE
This is not logic specific to MODULE. Breaking it out to
kicad_string.h acheives:

* Slimming of the MODULE interface
* Enables reuse of the function
* Enables testing of the function

Also add a test under qa_common for this function.
2019-01-30 15:41:36 -08:00
John Beard f85f10930a Break widget save/restore out to reusable class
The CONFIG_SAVE_RESTORE_WINDOW class does not need to be tied
to the array dialog, put it in common/widgets.

Also do a refactor and tidy-up of the the class, use a union for (slightly)
better type-safety and syntax (a variant would be better but that's C++17).

Also enable integral field save/restore from text boxes.
2019-01-30 15:41:35 -08:00
John Beard 24ac9b7055 Pcbnew: array: repair dialog value init
Fully initialise the CREATE_ARRAY_DIALOG_ENTRIES object,
and use these values for the dialog on first open. Currently,
the initial values aren't all initialised, and none are used, as the
valid flag is not set. This means there are poor defaults in some
fields.

Also more declarations and defintions of CREATE_ARRAY_DIALOG_ENTRIES
to the .cpp, as these do not need to be exposed in the header,
even privately.
2019-01-30 15:41:35 -08:00
John Beard 6558bd9381 Pcbnew: Also transform and number the original item
The original item is part of the array, so give it a number
and put it in the right place (all current array tools have
a null transform for the first item, but it's not part of the
contract. For example, a circular array with an angle offset
might want to move the first point).
2019-01-30 15:41:35 -08:00
John Beard ffaf99a600 Pcbnew: Enable some numbering options in pcbnew
The numbering axis priority (h then v or v then h), and alternate
reversing are not actually numbering parameters, they are part of
the geometry of the array (the items are physically in different
orders).

So enable these options, even when numbering is disabled.

Also fix broken logic about when numbering scheme is enabled
(it still applies even if the numbering offset is fixed.)
2019-01-30 15:41:35 -08:00
John Beard 453a91f661 Pcbnew: arrays skip existing names
The current module cannot be queried for existing pads as we
add them (because we never commit, until we finish the whole array).

Instead, pre-gather the names and check as we add, skipping any existing
names.

Note: this will not prevent arrays becoming "mis-ordered", but there
is not a lot we can do to prevent all possible errors.

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

The same principle could be used to skip existing ref-des'es on PCBs.
2019-01-30 15:41:35 -08:00
John Beard 5504981d00 Separate ARRAY_OPTIONS to own class in common
The geometry and numbering logic is separate to the dialog, and
can be separated for clearer logic and better testability.

Moreover, refactor it to avoid any dependency on pcbnew
classes, so it can be move to common for potential re-use in
eeschema and friends in future.

Also convert all wxPoint logic in these classes to VECTOR2I and
fix some function visibilities.

Add some unit tests of the ARRAY_OPTIONS geometry and numbering.
2019-01-30 15:41:35 -08:00
Jeff Young f425f49c19 Fetch active sym before launching browser so we can start with it.
Fixes: lp:1813882
* https://bugs.launchpad.net/kicad/+bug/1813882
2019-01-30 21:50:35 +00:00
Jeff Young ca0164aa07 Unify library browser terminology.
Fixes: lp:1813882
* https://bugs.launchpad.net/kicad/+bug/1813882
2019-01-30 19:52:15 +00:00
Jeff Young 626dc7d9cf Load currently selected alias when browsing.
Fixes: lp:1813882
* https://bugs.launchpad.net/kicad/+bug/1813882
2019-01-30 19:43:52 +00:00
Jeff Young 2dea3a49c8 Fix compile error in std::pow useage. 2019-01-30 16:38:34 +00:00
Jeff Young 19c9ae7ecb Use updated value when checking for empty.
Fixes: lp:1813640
* https://bugs.launchpad.net/kicad/+bug/1813640
2019-01-30 16:29:21 +00:00
Jeff Young b3319d29c1 Init footprint chooser with current footprint.
Fixes: lp:1813882
* https://bugs.launchpad.net/kicad/+bug/1813882
2019-01-30 15:45:29 +00:00
John Beard 6880687f00 Geom: interate ClipperLib::Path by reference
ClipperLib::Path is std::vector<IntPoint>. Iterating this with
"for( auto point : path)" could result in 'n' IntPoint copy-constructions.
It does seem GCC 8, at least, manages to optimise these constructions
out.

Replace with the "standard" for( const auto& point : path) idiom.
2019-01-30 11:55:11 +01:00
John Beard 9a41fd060b QA: Account for eeschema tests unit rounding 2019-01-30 11:55:11 +01:00
John Beard 8e75f6029c QA: Mark failing SHAPE_POLY_SET tests as expected failures
This allows the tests to remain sensitive to other errors.

When SHAPE_POLY_SET is fixed, these expected failures should be
removed.
2019-01-30 11:55:10 +01:00
Seth Hillbrand 872f0eb44c eeschema: Set grid editor to use qty as the drop-down
Symbol fields uses a custom expander control.  This should be tied to a
column that cannot be hidden in order to ensure the ability to view sub
elements remains intact, like the standard control.

Fixes: lp:1780847
* https://bugs.launchpad.net/kicad/+bug/1780847
2019-01-29 17:10:58 -08:00
Seth Hillbrand f1fed08fa7 pcbnew: Finalize previous snapping preferences
Snap/Grid modifier follow preferences from 05483a06c6.  Brings Shift/Alt
modifiers into alignment with drawing tools.  Shift modifier still
conflicts when choosing end item with the complete track click-modifier.
This will be addressed in v6 with a larger preference setting.
2019-01-29 17:10:58 -08:00
Tomasz Włostowski 7d544d1ffe geometry: rewrite SHAPE_LINE_CHAIN::PointInside() to use fixed point arithmetic and support non-convex outlines. Fixes both P&S misbehaviours and zone filling/QA issues 2019-01-30 01:08:57 +01:00
John Beard 33bc74a4a2 QA: Tidy qa_utils headers
Move into own include directory for clarity. Also allows qa_utils
to use its own private headers in qa/qa_utils without exposing them
through the target_include_directories directive.
2019-01-29 18:16:00 -05:00
John Beard 47ec2fd5ba QA: Add some tests on SHAPE_POLY_SET::Distance
These tests pick up the bug fixed in: 90178eb681
(as it is already fixed there is no failure).
2019-01-29 18:12:06 -05:00
John Beard 016a544606 Eeschema: fix grammar for text for ERCE_PIN_NOT_DRIVEN
Reported by Kevin Cozens on the mailing list.
2019-01-29 18:09:11 -05:00
John Beard 55fcbddde8 QA: Fix faulty test of SHAPE_POLY_SET Collision
This test assumed points on a edge are counted as colliding.
This is not true: points on an edge are NOT counted at inside
the poly_set.

THe test does still consider points on a *hole* edge as collisions.
The API to SHAPE_POLY_SET is unclear on if this is correct.
2019-01-29 18:06:16 -05:00
Seth Hillbrand 93ecd44f5a Revert "geometry: revert SHAPE_LINE_CHAIN::PointInside/PointOnEdge() optimizations so that it's consistent with other collision checking methods (i.e. SEG::Distance() )"
This reverts commit 4a0fba309a.
2019-01-29 13:36:17 -08:00
Seth Hillbrand 05483a06c6 pcbnew: Re-attach snap options
Snapping to item options were partially disconnected when unifying
framework.  This re-attaches the options and adds the additional option
for graphical items.

Fixes: lp:1801377
* https://bugs.launchpad.net/kicad/+bug/1801377
2019-01-29 13:36:17 -08:00
Seth Hillbrand 914596fcbb pcbnew: Allow STEP export tolerancing
kicad2step has a tolerance level that sets whether two points are at the
same location or not.  This allows KiCad to access these levels to some
degree, permitting a looser interpretation of a closed board outline.
2019-01-29 13:05:23 -08:00
John Beard 9bd7ea815c QA: Centralise BOARD reading functions in pcbnew_utils
Several pcbnew_tools utilities read a file from the command line.
Instead of replicating this code, centralise the code in
qa_pcbnew_utils, which allows simpler reuse.

THe utilities are:

* polygon_triangulation
* polygon_generator
* drc_tool

pcb_parser keeps its own function, as that is the focus of the tool,
and its likely to have its own instrumention.

This also adds the ability to read from stdin for the above tools,
which means fuzz testers could theoretically work with them, and it
also can make life easier if you can pipe a board to the executable
directly.
2019-01-29 08:16:02 -05:00
John Beard adddc41bc5 QA: Reinstate polygon_triangulation utility
This utility has been disabled since the eeschema GAL merge. It
can be reinstated as part of the qa_pcbnew_tools framework.
2019-01-29 08:15:51 -05:00
John Beard 11745f8f44 QA: Move contents qa_shape_poly_set_refactor to qa_common
The "refactor" element of qa_shape_poly_set_refactor has been
previously removed, so these tests are now just regular tests on
libcommon classes. These can therefore be moved to qa_common
and the qa_shape_poly_set_refactor unit test suit can finally be
totally removed.
2019-01-29 08:15:44 -05:00
John Beard e4b4230bcf QA: Put UTILITY_PROGRAM in KI_TEST
Also expand some documentation of some other KI_TEST functions.
2019-01-29 08:15:37 -05:00
John Beard b94cf9d564 Docs: Describe QA util programs in the testing docs 2019-01-29 08:15:30 -05:00
jean-pierre charras a4d4d9a241 Fix not working sdip_wizard.py 2019-01-29 08:42:28 +01:00
Seth Hillbrand b71c2e5edf Ensure we have a destination for config template
In the event that we do not have a project configuration file, the
default template will be used.  But it needs a destination filename for
copy_pro_file_template().

Fixes: lp:1745022
* https://bugs.launchpad.net/kicad/+bug/1745022
2019-01-28 17:16:53 -08:00
Seth Hillbrand cf6ba6ad94 pcbnew: Get correct end when dragging
The selection for interactive drag uses cursor position  off grid to
choose the element for dragging.  We pass the same value into the start
dragging routine to choose the correct end of the element.

Fixes: lp:1813665
* https://bugs.launchpad.net/kicad/+bug/1813665
2019-01-28 15:16:07 -08:00