Commit Graph

4094 Commits

Author SHA1 Message Date
Tomasz Włostowski 313ebb9dff router: correct walkaround corner case when both ends of the line lie on the hull edge
Fixes: lp:1810935
* https://bugs.launchpad.net/kicad/+bug/1810935
2019-02-03 11:22:18 +01:00
Seth Hillbrand 611c555eaf lib_tree: Ensure ON_CHAR events are passed 2019-02-03 06:01:21 +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
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
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
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 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 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
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
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 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 9d99fd188f Revert "Change top selection drop-down to combobox"
This reverts commit 7d06651a10.
2019-01-28 10:15:32 -08:00
Tomasz Włostowski 4a0fba309a geometry: revert SHAPE_LINE_CHAIN::PointInside/PointOnEdge() optimizations so that it's consistent with other collision checking methods (i.e. SEG::Distance() )
Fixes: lp:1810935
* https://bugs.launchpad.net/kicad/+bug/1810935
2019-01-28 13:24:41 +01:00
jean-pierre charras e850a482d1 Gerber output: fix a potential minor issue in a G04 line comment.
In gbr files only ASCII7 chars are allowed.
However, in a comment line a UTF8 string is used. It should not create issues, but it is incorrect.
2019-01-27 10:14:16 +01:00
Wayne Stambaugh a55d9819bc Do not use project path when searching for default library tables.
When no default library tables are found, set the default wxFilePickerCtrl
to the users configuration path instead of the current project path to
prevent any project library tables from being used as the default.

Fixes lp:1809769

https://bugs.launchpad.net/kicad/+bug/1809769
2019-01-26 16:19:02 -05:00
Seth Hillbrand 594d5c3e34 pcbnew: overwrite hotkeys cleanly
If user hotkeys do not map all available actions, we still want the most
recent change to be the primary value.  This can happen if the defaults
load a set of hotkeys that are not completely overwritten by the updated
hotkey preferences file.  We assume that the most recent hotkey is what
the user want to map.

Fixes: lp:1778408
* https://bugs.launchpad.net/kicad/+bug/1778408
2019-01-26 12:19:35 -08:00
jean-pierre charras 90178eb681 Optimize DRC calculation for copper texts. fix also a bug in SHAPE_POLY_SET::Distance( const SEG& aSegment, int aSegmentWidth ).
This bug calculate incorrectly the distance between aSegment and the SHAPE_POLY_SET for the first segment of the SHAPE_POLY_SET.
2019-01-26 13:01:48 +01:00
jean-pierre charras b8cfabd22e Fix some issues in I10n strings
Fix typo and missing I10n identifier for 2 strings
2019-01-26 09:25:12 +01:00
Seth Hillbrand b63cdcf225 Type cleanup 2019-01-25 13:03:36 -08:00
Seth Hillbrand 4fbd5e8e0f pcbnew: UTF8 strings for MSW display
Some MSW seem to have issues with the UTF-8 characters in const
wxString.  This explictly casts to wxString from UTF-8 handling the
platform differences

Fixes: lp:1813329
* https://bugs.launchpad.net/kicad/+bug/1813329
2019-01-25 10:06:26 -08:00
Seth Hillbrand 3ea766154b eeschema: Allow tree expand/collapse with +/- 2019-01-24 17:24:28 -08:00
John Beard 8297ab24e4 DRC: Break out courtyard overlap function
Introduce the concept of a DRC_PROVIDER which allows
to separate the various DRC functions to their own
areas. This allows, amongst other things, a slimmer core
DRC class, and allows DRC functions to be separately testable.

The courtyard DRCs (overlap, missing and malformed)
are the first victims, so instrumentation can be added to this function.

Add some unit tests on this DRC function, as well a few re-usable PCB-based
utility functions in a library (qa_pcbnew_utils) that could be shared between
unit tests and other utilities.
2019-01-23 13:27:52 -05:00
Seth Hillbrand efe880bb79 pcbnew: Fix zone cutout duplication
When creating the zone cutout, we delete the old zone and add a new one
with each cutout.  This requires resetting the source zone and clearing
our previous selection if we would like to continue using the cutout
tool on the new zone.

Fixes: lp:1812339
* https://bugs.launchpad.net/kicad/+bug/1812339
2019-01-23 06:42:07 -08:00
Seth Hillbrand 823dce1a50 modedit: Allow name input for new footprint library
When prompting for a new footprint library, we need to treat the input
as a file for creation rather than a directory for selection.
Otherwise, users cannot specify the name of their new footprint library
independently of the existing directory names.

Fixes: lp:1812135
* https://bugs.launchpad.net/kicad/+bug/1812135
2019-01-22 15:40:10 -08:00
jean-pierre charras d93b694327 Fix a compil warning 2019-01-22 18:01:04 +01:00
Wayne Stambaugh 2dcba4723d Lay groundwork for loading the initial global footprint library table.
Factor out common dialog code from global symbol library table dialog for
loading initial library table.

Update global symbol library table code to user factored out common dialog
code.
2019-01-20 13:09:49 -05:00
Baranovskiy Konstantin 3526c9a37a Grid tricks: paste to selection.
NEW: By default a clipboard is pasted to a grid starting from the
cursor position and doesn't matter is a selection of cells present or
not. Often a grid represents the data of a few similar objects like
components, for example. Some number of cells (fields) may have the same
value for a few rows (components). In this case, when filling data we
must copy the range of identical cells from the first row of similar
components and then paste it to every row of the rest components (by
default). From now it may be done easier. We must copy the range of
identical cells from first row of similar components (here is no
changes) and then select rectangular range of cells (for multiple rows)
where must be placed copied data. After pasting copied cells will be
pasted to every selected row.
So in general, we can copy cells from one row and paste it to multiple
rows at a time.
This new feature also makes possible to copy value from one cell and to
paste it to all from the selection.
If copied range of cells is larger than the selection then only the part
of clipboard that matches the selection will be pasted.
2019-01-19 14:55:22 -05:00
Baranovskiy Konstantin 65f5bd6a01 Dialog: Esc key closes a grid editor first.
CHANGED: By default dialog closes on Esc key immediately and if dialog
has a grid control there is no way to close a cell editor with canceling
changes. New behavior is next: if dialog has a grid and the grid has an
active cell editor Esc key closes cell editor, otherwise Esc key closes
the dialog.
2019-01-19 14:55:15 -05:00
Baranovskiy Konstantin 98a911dcb4 Custom grid editors: cancel changes on escape.
If user closes grid cell editor with Escape key any changes must be
canceled.
2019-01-19 14:54:58 -05:00
Baranovskiy Konstantin 3c2bf5b3bd Grid tricks: paste without grid expanding.
CHANGED: On pasting multiple rows from a clipboard to the end of a
grid, the grid is automatically expanding (appended needed number of
rows). In general case the grid expanding on pasting is inappropriate.
Rows must be added by tools like a button or a menu command etc. In some
cases rows cannot be added at all. So we must paste only the part of
the clipboard that fits between the cursor position and the end of the
grid without a grid extending.
2019-01-19 14:54:50 -05:00
Baranovskiy Konstantin 8400ee41c0 Grid tricks: cell selection fixes.
CHANGED: First click sets a cursor to the specified cell, second click
activates editor (current realization, where first click activates cell
editor, is very buggy especially with cells selection).

Set cursor on cell of reference on mouse left click in Fields editor of
Eeschema.
2019-01-19 14:54:37 -05:00
Seth Hillbrand 4a68ae4bae polygon: Fix missing steiner removal and fracture
When removing steiner points, there is the possibility that the test
point is also removed.  In this case, it is no longer a member of the
linked list and will break the output.

The test for re-fracturing a broken polygon can also result in multiple
polygons, rather than only 0 or 1.  Skipping the extra polygons will
result in a limited tesselation.

Fixes: lp:1812393
* https://bugs.launchpad.net/kicad/+bug/1812393
2019-01-18 09:19:39 -08:00
Seth Hillbrand c3a295df1a Fix segfaults from not checking index
Return value of wxArrayString.Index() always needs to be check for
existence.
2019-01-17 10:23:25 -08:00
jean-pierre charras cdadb48d84 Fix incorrect #ifdef definition
Fixes: lp:1811906
https://bugs.launchpad.net/kicad/+bug/1811906
2019-01-16 17:39:47 +01:00
Wayne Stambaugh 47492f9452 Coding policy fixes in common/common.cpp. 2019-01-15 12:23:26 -05:00
Wayne Stambaugh 69d90a4e84 Do not set wxSetAssertHandler on non-debug builds.
Fixes lp:1809622

https://bugs.launchpad.net/kicad/+bug/1809622
2019-01-15 09:29:33 -05:00
Seth Hillbrand 0f1a11ef38 pcbnew: Cut only copied objects
Fixes a bug where objects where accessed after being freed by the cut

Fixes: lp:1811456
* https://bugs.launchpad.net/kicad/+bug/1811456
2019-01-11 17:27:29 -08:00
jean-pierre charras 644855c5ba Fix incorrect (broken) canvas type saving in config.
The config was saving a canvas type EDA_DRAW_FRAME member not always accurately initialized.
And the last canvas opened frame setup was saved, not necessary a frame having a canvas type that can be set by user.
This is a broken feature especially because the footprint viewer has a fixed canvas setting.
2019-01-11 13:19:46 +01:00
jean-pierre charras ed03d3436d fix a minor wxWidgets assert. 2019-01-10 16:23:52 +01:00
John Beard d6f4f3aca0 Geom: Account for quadrant points in arc bbox calc
This means arcs that pass though quadrant points (multiple of
0, 90, 180, 270 degrees) include these points in the bbox.
2019-01-10 07:52:25 -05:00
Wayne Stambaugh 906161dcf8 Fix configuration dialog layout issues on GTK. 2019-01-09 17:35:12 -05:00
Seth Hillbrand fe30460aeb gal: Save canvas type unconditionally
The canvas type might change without the frame being notified.  If this
happens, the user is presented with repeated notifications of OpenGL
issues.  Howver, switching canvas is not an error and should be
presented to the user as an info message to clarify that the system is
still working but it has changed how it renders the screen.

Fixes: lp:1795240
* https://bugs.launchpad.net/kicad/+bug/1795240
2019-01-09 10:36:01 -08:00
John Beard 73fb050b6d __WXWINDOWS__ does not mean __WXMSW__
Misuse of __WXWINDOWS__ for checking the presence of Windows. The correct
macro is __WINDOWS__ or __WXMSW__ in GUI programs.

__WXWINDOWS__ is always set, on all platforms.
2019-01-09 09:15:32 -05:00
John Beard 658cc8fd96 Wildcards: unify handling of all files wildcards
Use the AddFileExtListToFilter() to also generate the
wildcard for "all files". This is because:

* Users can use AddFileExtListToFilter for the all files WC
  with the same interface as for any other extensions.
* Users do not need to worry about wxGetTranslation, as the
  _() is applied in the same way as the other *Wildcard() helpers,
  and it is a function just like the others, so it is consistent
* There is a testable interface to document the expected result.
  The test is added.
2019-01-09 08:57:42 -05:00
John Beard dd313d4d47 Wildcards: use vectors instead of varargs + tests
Varargs make it very hard to pass strings in flexibly
when they (and the number of them) are not known
at compile time.

For example, this allows up to now amalgamate the "single
ext" and "multiple ext" unit tests.
2019-01-09 08:57:35 -05:00